diff --git a/app/Services/PatientFamilyService.php b/app/Services/PatientFamilyService.php index 22ae70a..9158d4a 100644 --- a/app/Services/PatientFamilyService.php +++ b/app/Services/PatientFamilyService.php @@ -333,16 +333,15 @@ class PatientFamilyService extends BaseService $params[] = ["family_id", '!=', $family_id]; $patient_familys = PatientFamilyModel::getList($params); if (!empty($patient_familys)) { - foreach ($patient_familys as $key => $value) { + foreach ($patient_familys as $value) { if ($value['family_id'] == $family_id){ continue; } + // 检测姓名是否重复 - if ($patient_family['card_name'] != $request_params['card_name']) { - if ($request_params['card_name'] == $value['card_name']) { - // 姓名改变 检测是否与其他家庭成员姓名重复 - return fail(HttpEnumCode::HTTP_ERROR, "姓名重复"); - } + if ($value['card_name'] != $request_params['card_name']) { + // 姓名改变 检测是否与其他家庭成员姓名重复 + return fail(HttpEnumCode::HTTP_ERROR, "姓名重复"); } // 检测证件号是否重复 @@ -352,7 +351,7 @@ class PatientFamilyService extends BaseService // 检测是否已经存在本人 if (isset($request_params['relation'])) { - if ($request_params['relation'] == 1 && $patient_family['relation'] == 1) { + if ($request_params['relation'] == 1 && $value['relation'] == 1) { return fail(HttpEnumCode::HTTP_ERROR, "关系为本人的患者只能添加一位"); } }