Prechádzať zdrojové kódy

update 病号结束判定

A17404李放 3 rokov pred
rodič
commit
f88e2ef33f

+ 9 - 4
nb-system/src/main/java/com/coffee/bus/controller/BusPatientController.java

@@ -116,11 +116,16 @@ public class BusPatientController  implements BaseQueryController<BusPatientEnti
         if(CollUtil.isEmpty(patientCodes)){
             throw new CustomException("请选择一个病患");
         }
+        List<BusPatientEntity> patients = patientService.list(new QueryWrapper<BusPatientEntity>()
+                .lambda().in(BusPatientEntity::getCode, patientCodes));
+        if(CollUtil.isEmpty(patients)){
+            throw new CustomException("病号不存在,请刷新后重试");
+        }
         return R.success(infusionService.count(new QueryWrapper<BusInfusionHistoryEntity>()
                 .lambda()
                 .nested(i->i.ne(BusInfusionHistoryEntity::getRunState,DeviceStatusEnum.Shutdown)
                         .ne(BusInfusionHistoryEntity::getRunState,DeviceStatusEnum.NoSignal))
-                .in(BusInfusionHistoryEntity::getPatientCode,patientCodes)
+                .in(BusInfusionHistoryEntity::getPatientId,patients.stream().map(BusPatientEntity::getId).collect(Collectors.toList()))
                 .eq(BusInfusionHistoryEntity::getFinished,false))!=0);
     }
 
@@ -129,8 +134,8 @@ public class BusPatientController  implements BaseQueryController<BusPatientEnti
     @ApiResponse(code = 4001,message = "病号当前绑定了多个设备,不可结束管理")
     @ApiOperation(value = "结束管理",notes = "病患当前绑定主设备必须要在关机、不在服务器、待机中才能结束管理,权限【bus:patient:finished】")
     public R<Boolean> finished(@PathVariable("monitorType")@ApiParam(value = "是否为无泵管理 false、无泵 true、有泵",defaultValue = "false" ) boolean haveDevice,
-                      @RequestBody MonitorFinishedVo monitorFinishedVo,
-                      @RequestAttribute("tenantId")@ApiParam(hidden = true) String tenantId){
+                               @RequestBody MonitorFinishedVo monitorFinishedVo,
+                               @RequestAttribute("tenantId")@ApiParam(hidden = true) String tenantId){
         log.info("结束管理,【{}】",JSONUtil.toJsonStr(monitorFinishedVo));
         if(haveDevice){
             R<Boolean> result = monitorFinished(monitorFinishedVo, tenantId);
@@ -289,7 +294,7 @@ public class BusPatientController  implements BaseQueryController<BusPatientEnti
                 //无泵查看
                 result.setDeviceManual( manualService.getOne(new QueryWrapper<BusDeviceManualEntity>().lambda().eq(BusDeviceManualEntity::getClinicId, clinic.getId())));
             }
-           }
+        }
         if(clinic==null){
             throw new CustomException("该临床信息不存在,请刷新后重试");
         }