Просмотр исходного кода

update 删除重复报警和提醒

A17404李放 3 лет назад
Родитель
Сommit
222ebc2c28

+ 14 - 14
nb-system/src/main/java/com/nb/bus/controller/BusPatientController.java

@@ -100,9 +100,9 @@ public class BusPatientController  implements BaseQueryController<BusPatientEnti
     @ApiResponses({
             @ApiResponse(code = 200,message = "0 病人中未出现重复,非0 病人中出现重复"),
     })
-    public R<Long> judgeRepeat(@RequestBody List<String> patientCode){
-        log.info("判断所给病号中是否出现了绑定设备重复,【{}】",patientCode);
-        return R.success(patientService.count(new QueryWrapper<BusPatientEntity>().lambda().in(BusPatientEntity::getCode,patientCode).eq(BusPatientEntity::getAlarm,PatientAlarmEnum.DEVICE_REPEAT)));
+    public R<Long> judgeRepeat(@RequestBody List<String> patientIds){
+        log.info("判断所给病号中是否出现了绑定设备重复,【{}】",patientIds);
+        return R.success(patientService.count(new QueryWrapper<BusPatientEntity>().lambda().in(BusPatientEntity::getId,patientIds).eq(BusPatientEntity::getAlarm,PatientAlarmEnum.DEVICE_REPEAT)));
     }
 
     @PostMapping("/judge/finished")
@@ -111,13 +111,13 @@ public class BusPatientController  implements BaseQueryController<BusPatientEnti
             @ApiResponse(code = 500,message = "没有选择病号"),
             @ApiResponse(code =200 ,message = "若存在不可以结束的临床信息,返回1",response = BusDeviceRunningEntity.class)
     })
-    public R<Boolean> judgeFinished(@RequestBody List<String> patientCodes){
-        log.info("判断给定病号中是否可以结束临床管理,【{}】",patientCodes);
-        if(CollUtil.isEmpty(patientCodes)){
+    public R<Boolean> judgeFinished(@RequestBody List<String> patientIds){
+        log.info("判断给定病号中是否可以结束临床管理,【{}】",patientIds);
+        if(CollUtil.isEmpty(patientIds)){
             throw new CustomException("请选择一个病患");
         }
         List<BusPatientEntity> patients = patientService.list(new QueryWrapper<BusPatientEntity>()
-                .lambda().in(BusPatientEntity::getCode, patientCodes));
+                .lambda().in(BusPatientEntity::getId, patientIds));
         if(CollUtil.isEmpty(patients)){
             throw new CustomException("病号不存在,请刷新后重试");
         }
@@ -157,20 +157,20 @@ public class BusPatientController  implements BaseQueryController<BusPatientEnti
      * @return R
      */
     private R<Boolean> monitorFinished(MonitorFinishedVo monitorFinishedVo, String tenantId){
-        List<String> patientCodes = monitorFinishedVo.getPatientCodes();
-        if(CollUtil.isEmpty(patientCodes)){
+        List<String> patientIds = monitorFinishedVo.getPatientIds();
+        if(CollUtil.isEmpty(patientIds)){
             List<String> clinicIds = monitorFinishedVo.getClinicIds();
             if (CollUtil.isEmpty(clinicIds)) {
                 throw new CustomException("未选择临床信息");
             }
         }
-        List<BusPatientEntity> patients = patientService.list(new QueryWrapper<BusPatientEntity>().lambda().in(BusPatientEntity::getCode, patientCodes));
+        List<BusPatientEntity> patients = patientService.list(new QueryWrapper<BusPatientEntity>().lambda().in(BusPatientEntity::getId, patientIds));
         List<ManualUndoConfig> undoConfigs=new ArrayList<>();
         for (BusPatientEntity patient : patients) {
             undoConfigs.add(
                     ManualUndoConfig.of(
                             Collections.singletonList(patient.getInfusionId()),
-                            patient.getCode(),
+                            patient.getId(),
                             patient.getClinicId(),
                             tenantId,
                             true,
@@ -239,13 +239,13 @@ public class BusPatientController  implements BaseQueryController<BusPatientEnti
     public R shift(@RequestBody@Validated ManualUndoConfig undoConfig, @RequestAttribute("tenantId")@ApiParam(hidden = true) String tenantId){
         log.info("批量撤泵,【{}】",JSONUtil.toJsonStr(undoConfig));
         undoConfig.setTenantId(tenantId);
-        BusPatientEntity patient = patientService.findByFormatCode( undoConfig.getPatientCode());
+        BusPatientEntity patient = patientService.getById( undoConfig.getPatientId());
         if(patient==null){
-            throw new CustomException(String.format("病号【%s】不存在,请刷新后重试",undoConfig.getPatientCode()));
+            return R.success();
         }
         //泵切换完成后,对病号报警解除
         infusionService.undo(undoConfig,false);
-        PatientOperator operator = patientRegistry.getOperator(undoConfig.getTenantId(), undoConfig.getPatientCode());
+        PatientOperator operator = patientRegistry.getOperator(undoConfig.getTenantId(), patient.getOriginCode());
         //判断当前病号下是否还存在副泵
         long count = infusionService.count(new QueryWrapper<BusInfusionHistoryEntity>().lambda()
                 .eq(BusInfusionHistoryEntity::getClinicId, operator.getClinicId())

+ 2 - 2
nb-system/src/main/java/com/nb/bus/controller/vo/MonitorFinishedVo.java

@@ -18,8 +18,8 @@ import java.util.List;
 @ApiModel("监控结束")
 @Data
 public class MonitorFinishedVo {
-    @ApiModelProperty("结束监控的病号-临床监护必填")
-    private List<String> patientCodes;
+    @ApiModelProperty("结束监控的病号id-临床监护必填")
+    private List<String> patientIds;
 
     @ApiModelProperty("结束监控的临床号-无泵管理必填")
     private List<String> clinicIds;

+ 2 - 0
nb-system/src/main/java/com/nb/bus/entity/PatientDeviceRepeatDomain.java

@@ -21,6 +21,8 @@ import java.util.Date;
 @ApiModel("病人临床设备重复报警详情")
 @Data
 public class PatientDeviceRepeatDomain {
+    @ApiModelProperty("病人id")
+    private String patientId;
     @ApiModelProperty("病患名称")
     private String name;
     @ApiModelProperty("病患性别")

+ 0 - 3
nb-system/src/main/java/com/nb/bus/entity/common/DeviceProperties.java

@@ -41,9 +41,6 @@ public class DeviceProperties<K,T>  extends TenantGenericEntity<K,T> {
     @ApiModelProperty(value = "设备上传住院号")
     private String patientCode;
 
-    @ApiModelProperty(value = "设备住院号所绑定id")
-    private String patientId;
-
     @ApiModelProperty(value = "病区")
     private String ward;
 

+ 1 - 1
nb-system/src/main/java/com/nb/bus/hospital/config/handler/ClinicAutoFinishMonitorHandler.java

@@ -62,7 +62,7 @@ public class ClinicAutoFinishMonitorHandler implements DelayMessageHandler {
                 manualUndoConfig.setUndo(config);
                 manualUndoConfig.setMonitorType(true);
                 manualUndoConfig.setClinicId(patient.getClinicId());
-                manualUndoConfig.setPatientCode(patient.getCode());
+                manualUndoConfig.setPatientId(patient.getId());
                 manualUndoConfig.setInfusionIds(Collections.singletonList(source.getInfusionId()));
                 infusionHistoryService.undo(manualUndoConfig,true);
             }

+ 2 - 3
nb-system/src/main/java/com/nb/bus/hospital/config/handler/DeputyDeviceAutoUndoHandler.java

@@ -50,15 +50,14 @@ public class DeputyDeviceAutoUndoHandler implements DelayMessageHandler {
             return;
         }
         String infusionId = source.getInfusionId();
-        BusPatientEntity patient = patientService.getOne(new QueryWrapper<BusPatientEntity>().lambda().eq(BusPatientEntity::getId, source.getPatientId())
-                .eq(BusPatientEntity::getTenantId, source.getTenantId()));
+        BusPatientEntity patient = patientService.getById(source.getPatientId());
         if (!infusionId.equals(patient.getInfusionId())) {
             //只有副泵会自动撤泵
             BusInfusionHistoryEntity infusionHistory = infusionHistoryService.getById(infusionId);
             if(ObjectUtil.equal(infusionHistory.getLastUploadTime(),source.getUploadTime())){
                 ManualUndoConfig manualUndoConfig = new ManualUndoConfig();
                 manualUndoConfig.setInfusionIds(Collections.singletonList(source.getInfusionId()));
-                manualUndoConfig.setPatientCode(patient.getCode());
+                manualUndoConfig.setPatientId(patient.getId());
                 manualUndoConfig.setClinicId(source.getClinicId());
                 manualUndoConfig.setMonitorType(true);
                 manualUndoConfig.setUndo(source.getConfig());

+ 3 - 5
nb-system/src/main/java/com/nb/bus/service/LocalBusInfusionHistoryService.java

@@ -237,11 +237,9 @@ public class LocalBusInfusionHistoryService extends BaseService<BusInfusionHisto
             infusionIds =deviceIds.stream().map(deviceRegistry::getOperator).map(DeviceOperator::getInfusionId).collect(Collectors.toList());
         }
         if(!finishClinic){
-            //无泵监护,不需要监护输注数据
             if(Boolean.TRUE.equals(manualUndoConfig.getMonitorType())){
                 BusPatientEntity patient = patientService.getOne(new QueryWrapper<BusPatientEntity>().lambda()
-                        .eq(BusPatientEntity::getCode, manualUndoConfig.getPatientCode())
-                        .eq(StrUtil.isNotEmpty(manualUndoConfig.getTenantId()), BusPatientEntity::getTenantId, manualUndoConfig.getTenantId()));
+                        .eq(BusPatientEntity::getCode, manualUndoConfig.getPatientId()));
                 //去除主输注id
                 infusionIds=infusionIds.stream().filter(id->!id.equals(patient.getInfusionId())).collect(Collectors.toList());
                 //输注结束,更新撤泵信息
@@ -258,13 +256,13 @@ public class LocalBusInfusionHistoryService extends BaseService<BusInfusionHisto
             }
 
         } else {
-            //结束临床
+            //结束临床 ,无泵监护不需要监护输注数据
             UndoDeviceConfig undo = manualUndoConfig.getUndo();
             if(Boolean.TRUE.equals(manualUndoConfig.getMonitorType())){
                 this.update(new UpdateWrapper<BusInfusionHistoryEntity>()
                         .lambda()
                         .eq(BusInfusionHistoryEntity::getFinished,false)
-                        .eq(BusInfusionHistoryEntity::getPatientCode,manualUndoConfig.getPatientCode())
+                        .eq(BusInfusionHistoryEntity::getPatientId,manualUndoConfig.getPatientId())
                         .eq(StrUtil.isNotEmpty(manualUndoConfig.getTenantId()),BusInfusionHistoryEntity::getTenantId,manualUndoConfig.getTenantId())
                         .set(BusInfusionHistoryEntity::getIsUndo,true)
                         .set(BusInfusionHistoryEntity::getUndoBy,undo.getUndoBy())

+ 2 - 0
nb-system/src/main/java/com/nb/bus/service/dto/CombineResult.java

@@ -51,6 +51,8 @@ public class CombineResult extends CommonDeviceParam<String,String> {
     @ApiModelProperty(value = "该次输注是否已结束")
     private Boolean infusionFinished;
 
+    @ApiModelProperty(value = "设备住院号所绑定id")
+    private String patientId;
 
     @ApiModelProperty(value = "临床手术名称")
     @Length(max = 255,message = "临床手术名称长度不得超过255个字节")

+ 4 - 6
nb-system/src/main/java/com/nb/bus/service/dto/ManualUndoConfig.java

@@ -32,10 +32,8 @@ public class ManualUndoConfig implements Serializable {
     @JsonIgnore
     private List<String> infusionIds;
 
-    @ApiModelProperty("撤泵病号")
-    @Deprecated
-    private String patientCode;
-
+    @ApiModelProperty("撤泵病号Id")
+    private String patientId;
 
     @ApiModelProperty(value = "临床id",hidden = true)
     @JsonIgnore
@@ -52,7 +50,7 @@ public class ManualUndoConfig implements Serializable {
     @NotNull(message = "撤泵配置不能为空")
     private UndoDeviceConfig undo;
 
-    public static ManualUndoConfig of(List<String> infusionIds, String patientCode,String clinicId,String tenantId,Boolean monitorType,UndoDeviceConfig undo){
-        return new ManualUndoConfig(null,infusionIds,patientCode,clinicId,tenantId,monitorType,undo);
+    public static ManualUndoConfig of(List<String> infusionIds, String patientId,String clinicId,String tenantId,Boolean monitorType,UndoDeviceConfig undo){
+        return new ManualUndoConfig(null,infusionIds,patientId,clinicId,tenantId,monitorType,undo);
     }
 }

+ 2 - 0
nb-system/src/main/java/com/nb/bus/service/dto/PatientDeviceNoneResult.java

@@ -17,6 +17,8 @@ import java.io.Serializable;
 @Data
 @ApiModel("病人无设备返回数据")
 public class PatientDeviceNoneResult  implements Serializable {
+    @ApiModelProperty("病号id")
+    private String patientId;
     @ApiModelProperty("临床id")
     private String clinicId;
 

+ 1 - 1
nb-system/src/main/resources/mapper/bus/BusInfusionHistoryMapper.xml

@@ -4,7 +4,7 @@
 
     <resultMap id="combineResult" type="com.nb.bus.service.dto.CombineResult">
         <result column="infusion_id" property="id"/>
-        <result column="patient_id" property="patientCode"/>
+        <result column="patient_id" property="patientId"/>
         <result column="device_id" property="deviceId"/>
         <result column="classification" property="classification"/>
         <result column="data_num" property="dataNumber"/>

+ 4 - 0
nb-system/src/main/resources/mapper/bus/BusPatientMapper.xml

@@ -3,6 +3,7 @@
 <mapper namespace="com.nb.bus.mapper.BusPatientMapper">
 
     <resultMap id="repeatDeviceResult" type="com.nb.bus.entity.PatientDeviceRepeatDomain">
+        <result column="patient_id" property="patientId"/>
         <result column="name" property="name"/>
         <result column="gender" property="gender"/>
         <result column="code" property="code"/>
@@ -81,6 +82,7 @@
     </resultMap>
 
     <resultMap id="deviceNone" type="com.nb.bus.service.dto.PatientDeviceNoneResult">
+        <result column="patient_id" property="patientId"/>
         <result column="clinic_id" property="clinicId"/>
         <result column="name" property="name"/>
         <result column="gender" property="gender"/>
@@ -102,6 +104,7 @@
     </resultMap>
     <select id="selectRepeatDevice" resultMap="repeatDeviceResult">
                      SELECT
+                     p.id as patient_id,
              p.code as code,
              p.infusion_id as master_infusion_id,
              c.patient_gender  as gender,
@@ -125,6 +128,7 @@
 
     <select id="selectNoneDevice" resultMap="deviceNone">
             SELECT
+             p.id as patient_id,
              p.code as code,
              c.id as clinic_id,
              c.patient_gender as gender,