diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java index c41499a..b07ad1b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java @@ -205,9 +205,19 @@ public class AppController extends BaseController logger.info("add patient param is {} ", appPatientReq); TPatient tPatient = new TPatient(); BeanUtils.copyProperties(appPatientReq, tPatient); - if (UserConstants.NOT_UNIQUE.equals(tPatientService.checkPhoneUnique(tPatient.getPhone()))) + // 查询患者信息 + TPatient currentPatient = tPatientService.queryTPatient(tPatient); + if (Objects.nonNull(currentPatient)) { - return AjaxResult.error("手机号已注册"); + //患者信息已存在 新增诊断记录 + TRecord tRecord = new TRecord(); + tRecord.setHospitalId(appPatientReq.getHospitalId()); + tRecord.setPatientId(currentPatient.getId()); + tRecord.setDoctorId(appPatientReq.getDoctorId()); + tRecord.setStatus("0"); + tRecord.setCreateBy(getUsername()); + tRecordService.insertTRecord(tRecord); + return AjaxResult.success("手机号已注册"); } tPatientService.insertTPatient(tPatient); Long identifier = 10000000L + tPatient.getId(); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITPatientService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITPatientService.java index 076069a..d64a7d8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITPatientService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITPatientService.java @@ -64,4 +64,6 @@ public interface ITPatientService List queryByPage(PcTPatintQueryByPageReq pcTPatintQueryByPageReq); String checkPhoneUnique(String phone); + + public TPatient queryTPatient(TPatient tPatient); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TPatientServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TPatientServiceImpl.java index eaafadf..1f6e81c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TPatientServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TPatientServiceImpl.java @@ -134,4 +134,9 @@ public class TPatientServiceImpl implements ITPatientService } return UserConstants.UNIQUE; } + + @Override + public TPatient queryTPatient(TPatient tPatient) { + return tPatientMapper.queryTPatient(tPatient); + } }