diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java index a6957b5..2239989 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java @@ -1246,9 +1246,18 @@ public class PatientController { public BaseResponse delBookbuildingPatient(Integer id) { BaseResponse baseResponse =new BaseResponse(); try { - final boolean b = lymsPatientService.removeById(id); - baseResponse.setErrorcode(b?0:1); - baseResponse.setErrormsg(b?"成功":"失败"); + //查询患者的就诊记录 + LambdaQueryWrapper wrapper = new QueryWrapper().lambda(); + wrapper.eq(LymsPcase::getPid, id); + List lymsPcaseList = lymsPcaseService.list(wrapper); + if(CollectionUtils.isEmpty(lymsPcaseList)) { + final boolean b = lymsPatientService.removeById(id); + baseResponse.setErrorcode(b ? 0 : 1); + baseResponse.setErrormsg(b ? "成功" : "失败"); + }else { + baseResponse.setErrorcode(1); + baseResponse.setErrormsg("该档案有关联病例,不许删除"); + } } catch (Exception e) { e.printStackTrace(); }