From 90e76b0400baa83e0a2844fa105564d95fc6c65a Mon Sep 17 00:00:00 2001 From: panliang <1163816051@qq.com> Date: Fri, 27 Oct 2023 10:25:37 +0800 Subject: [PATCH] patient_record.patient_id --- app/Admin/Controllers/PatientRecordController.php | 5 ++++- lang/zh_CN/patient-record.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Admin/Controllers/PatientRecordController.php b/app/Admin/Controllers/PatientRecordController.php index 29d45a9..019c462 100644 --- a/app/Admin/Controllers/PatientRecordController.php +++ b/app/Admin/Controllers/PatientRecordController.php @@ -206,7 +206,10 @@ class PatientRecordController extends AdminController public function getPatientOptions() { if (!$this->patientOptions) { - $this->patientOptions = Patient::select(['id as value', 'name as label'])->sort()->get(); + $this->patientOptions = Patient::with(['type'])->orderBy('type_id')->sort()->get()->map(fn ($item) => [ + 'label' => $item->type?->name.'--'.$item->name, + 'value' => $item->id, + ]); } return $this->patientOptions; diff --git a/lang/zh_CN/patient-record.php b/lang/zh_CN/patient-record.php index 1fcb996..93bae87 100644 --- a/lang/zh_CN/patient-record.php +++ b/lang/zh_CN/patient-record.php @@ -2,7 +2,7 @@ return [ 'id' => 'ID', - 'patient_id' => '姓名', + 'patient_id' => '病人', 'type_id' => '类别', 'treat_at' => '诊疗时间', 'admin_user_id' => '相关人员',