diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/MpController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/MpController.java index 9ae46b6..b4229f1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/MpController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/MpController.java @@ -67,6 +67,7 @@ public class MpController extends BaseController { recordHistoryService.saveHistory(recordId); tRecord.setId(recordId); + tRecord.setStatus("0"); tRecord.setUpdateResult(""); tRecord.setUpdateResult2(""); tRecordService.updateTRecord(tRecord); @@ -90,11 +91,9 @@ public class MpController extends BaseController { TRecord tRecord = new TRecord(); tRecord.setPatientId(appPatientHospitalDoctor.getPatientId()); tRecord.setHospitalId(appPatientHospitalDoctor.getHospitalId()); - tRecord.setStatus("0"); tRecord.setDoctorId(appPatientHospitalDoctor.getDoctorId()); tRecord.setAppointmentTime(DateUtils.dateTime(new Date())); - List tRecords = tRecordService.selectTRecordList(tRecord); - if (!CollectionUtils.isEmpty(tRecords)) { + if (whetherRegistration(tRecord, "0") || whetherRegistration(tRecord, "2") || whetherRegistration(tRecord, "3")) { AjaxResult ajaxResult = AjaxResult.error(); ajaxResult.put("msg", "当前患者已登记过信息!"); return ajaxResult; @@ -104,6 +103,7 @@ public class MpController extends BaseController { TPatientHospitalDoctor tPatientHospitalDoctor = new TPatientHospitalDoctor(); BeanUtils.copyProperties(appPatientHospitalDoctor, tPatientHospitalDoctor); tRecord.setCreateBy(getUsername()); + tRecord.setStatus("0"); tRecordService.insertTRecord(tRecord); List tPHDs = itPatientHospitalDoctorService.selectTPatientHospitalDoctorList(tPatientHospitalDoctor); if (tPHDs.isEmpty()) @@ -118,4 +118,10 @@ public class MpController extends BaseController { ajaxResult.put("msg", "登记成功"); return ajaxResult; } + + private Boolean whetherRegistration(TRecord tRecord, String status) { + tRecord.setStatus(status); + List tRecords = tRecordService.selectTRecordList(tRecord); + return !CollectionUtils.isEmpty(tRecords); + } }