From 35d35259775840c13a4b6f83f498155dfa29ff80 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 17 Apr 2023 14:38:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=82=A3=E8=80=85=E5=85=B3?= =?UTF-8?q?=E7=B3=BB=E5=8F=AA=E8=83=BD=E5=90=8C=E6=97=B6=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E6=9C=AC=E4=BA=BA=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/PatientFamilyService.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/app/Services/PatientFamilyService.php b/app/Services/PatientFamilyService.php index 42dff0d..22ae70a 100644 --- a/app/Services/PatientFamilyService.php +++ b/app/Services/PatientFamilyService.php @@ -83,6 +83,13 @@ class PatientFamilyService extends BaseService $is_default_id = $patient_family['family_id']; } } + + // 检测是否已经存在本人 + if (isset($request_params['relation'])) { + if ($request_params['relation'] == 1 && $patient_family['relation'] == 1) { + return fail(HttpEnumCode::HTTP_ERROR, "关系为本人的患者只能添加一位"); + } + } } } @@ -343,10 +350,12 @@ class PatientFamilyService extends BaseService return fail(HttpEnumCode::HTTP_ERROR, "证件号码重复"); } -// // 检测患者关系-本人类型是否重复 -// if ($request_params['relation'] == 1 && $value['relation'] == 1) { -// return fail(HttpEnumCode::HTTP_ERROR, "患者类型重复"); -// } + // 检测是否已经存在本人 + if (isset($request_params['relation'])) { + if ($request_params['relation'] == 1 && $patient_family['relation'] == 1) { + return fail(HttpEnumCode::HTTP_ERROR, "关系为本人的患者只能添加一位"); + } + } // 检测是否默认字段是否重复 if (isset($request_params['is_default'])) {