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'])) {