diff --git a/member/modules/v1/controllers/PatientController.php b/member/modules/v1/controllers/PatientController.php index 706442e..de291a4 100644 --- a/member/modules/v1/controllers/PatientController.php +++ b/member/modules/v1/controllers/PatientController.php @@ -67,6 +67,16 @@ class PatientController extends BaseAppController $this->requestValidate($post, [ ['up_id', 'required'] ]); + if (!empty($post['id']?? '')) { + $info = UserPatient::find()->where([ + 'id' => $post['up_id'], + 'user_id' => \Yii::$app->user->identity->getId(), + ])->one(); + if (!$info) { + throw new Exception('就诊人不存在'); + } + $post['id_card'] = $info->id_card; + } $form = new PatientForm(); $form->attributes = $post;