From b064d608764a56c29bd0682030b1c78912ce9fef Mon Sep 17 00:00:00 2001 From: liqi Date: Wed, 15 Jan 2025 14:47:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E5=8A=A0=E5=AF=86=E7=9B=B8=E5=85=B3=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- member/models/forms/PatientForm.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/member/models/forms/PatientForm.php b/member/models/forms/PatientForm.php index 3bc3c6b..f7c71dc 100644 --- a/member/models/forms/PatientForm.php +++ b/member/models/forms/PatientForm.php @@ -133,6 +133,7 @@ class PatientForm extends BaseModel throw new Exception($this->getErrorMsg()); } $user_id = \Yii::$app->user->identity->id; + $isSave = false; //修改 if ($this->id) { $patient = UserPatient::findOne([ @@ -143,6 +144,8 @@ class PatientForm extends BaseModel if (!$patient) { throw new Exception('就诊人不存在'); } + $isSave = true; + $idCard = $patient->id_card; } else {//新增 $patient = new UserPatient(); } @@ -154,6 +157,9 @@ class PatientForm extends BaseModel } $patient->user_id = \Yii::$app->user->id; $patient->attributes = $this->attributes; + if ($isSave) { + $patient->id_card = $idCard; + } $patient->saveOrFail(); $UserPatientHealthInquiry = UserPatientHealthInquiry::find()->where([