Commit ec865d3d159e1759c6015bc6fecba124f3894b66
1 parent
8655d12162
Exists in
master
update
Showing 1 changed file with 12 additions and 3 deletions
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java
View file @
ec865d3
... | ... | @@ -1246,9 +1246,18 @@ |
1246 | 1246 | public BaseResponse delBookbuildingPatient(Integer id) { |
1247 | 1247 | BaseResponse baseResponse =new BaseResponse(); |
1248 | 1248 | try { |
1249 | - final boolean b = lymsPatientService.removeById(id); | |
1250 | - baseResponse.setErrorcode(b?0:1); | |
1251 | - baseResponse.setErrormsg(b?"成功":"失败"); | |
1249 | + //查询患者的就诊记录 | |
1250 | + LambdaQueryWrapper<LymsPcase> wrapper = new QueryWrapper().lambda(); | |
1251 | + wrapper.eq(LymsPcase::getPid, id); | |
1252 | + List<LymsPcase> lymsPcaseList = lymsPcaseService.list(wrapper); | |
1253 | + if(CollectionUtils.isEmpty(lymsPcaseList)) { | |
1254 | + final boolean b = lymsPatientService.removeById(id); | |
1255 | + baseResponse.setErrorcode(b ? 0 : 1); | |
1256 | + baseResponse.setErrormsg(b ? "成功" : "失败"); | |
1257 | + }else { | |
1258 | + baseResponse.setErrorcode(1); | |
1259 | + baseResponse.setErrormsg("该档案有关联病例,不许删除"); | |
1260 | + } | |
1252 | 1261 | } catch (Exception e) { |
1253 | 1262 | e.printStackTrace(); |
1254 | 1263 | } |