From efc151ed9ea9a627fa831a25aaf8eea18dec35ee Mon Sep 17 00:00:00 2001 From: lq Date: Fri, 15 Nov 2024 10:36:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B0=B1=E8=AF=8A=E4=BA=BA?= =?UTF-8?q?=E5=81=A5=E5=BA=B7=E4=BF=A1=E6=81=AF=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v1/controllers/PatientController.php | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/member/modules/v1/controllers/PatientController.php b/member/modules/v1/controllers/PatientController.php index 0160679..c987b33 100644 --- a/member/modules/v1/controllers/PatientController.php +++ b/member/modules/v1/controllers/PatientController.php @@ -185,27 +185,29 @@ class PatientController extends BaseAppController $info = $HealthForm->info(); - $familyHistory = !empty($info['family_history']) ? explode(',', $info['family_history']) : []; - $personHistory = !empty($info['person_history']) ? explode(',', $info['person_history']) : []; - $allergicHistory = !empty($info['allergic_history']) ? explode(',', $info['allergic_history']) : []; - - foreach ($familyHistory as $k => $v) { - $info['family_history'][] = [ - 'name' => $v, - 'checked' => true - ]; + if (!empty($info['family_history'])) { + foreach (explode(',', $info['family_history']) as $v) { + $info['family_history'][] = [ + 'name' => $v, + 'checked' => true + ]; + } } - foreach ($personHistory as $k => $v) { - $info['person_history'][] = [ - 'name' => $v, - 'checked' => true - ]; + if (!empty($info['person_history'])) { + foreach (explode(',', $info['person_history']) as $v) { + $info['person_history'][] = [ + 'name' => $v, + 'checked' => true + ]; + } } - foreach ($allergicHistory as $k => $v) { - $info['allergic_history'][] = [ - 'name' => $v, - 'checked' => true - ]; + if (!empty($info['allergic_history'])) { + foreach (explode(',', $info['allergic_history']) as $v) { + $info['allergic_history'][] = [ + 'name' => $v, + 'checked' => true + ]; + } } return $info;