Kaynağa Gözat

update
添加泵获取泵报警信息接口

wangzl 4 ay önce
ebeveyn
işleme
5374378361

+ 9 - 0
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/common/mapper/BizDeviceAlarmMapper.java

@@ -3,11 +3,14 @@ package cn.tr.module.smart.common.mapper;
 
 import cn.tr.module.smart.common.po.BizDeviceAlarmPO;
 import cn.tr.module.smart.common.po.BizInfusionHistoryPO;
+import cn.tr.module.smart.web.dto.BizDeviceAlarmInfoDTO;
 import org.mapstruct.Mapper;
 import org.mapstruct.Mapping;
 import org.mapstruct.Mappings;
 import org.mapstruct.factory.Mappers;
 
+import java.util.List;
+
 /**
 * 设备-设备报警表映射工具
 *
@@ -35,4 +38,10 @@ public interface BizDeviceAlarmMapper {
             @Mapping(target = "tenantId", ignore = true)
     })
     BizDeviceAlarmPO convertInfusionToPO(BizInfusionHistoryPO source);
+
+
+    BizDeviceAlarmInfoDTO convertAlarmInfoDTO(BizDeviceAlarmPO  source);
+    List<BizDeviceAlarmInfoDTO> convertAlarmInfoDtoList(List<BizDeviceAlarmPO> source);
+
+
 }

+ 12 - 1
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/common/service/IBizDeviceService.java

@@ -2,6 +2,7 @@ package cn.tr.module.smart.common.service;
 
 import cn.tr.module.smart.common.dto.BizDeviceDTO;
 import cn.tr.module.smart.common.dto.BizDeviceQueryDTO;
+import cn.tr.module.smart.web.dto.BizDeviceAlarmInfoDTO;
 import cn.tr.module.smart.web.vo.BizDeviceDetailVO;
 
 import java.util.List;
@@ -26,6 +27,16 @@ public interface IBizDeviceService {
      * @date 2025/8/7
      */
     BizDeviceDetailVO queryDeviceDetail(String deviceId);
-
+    /**
+     * @description: 根据手术Id查询输注详情
+     * @author wangzl
+     * @date 2025/8/11
+     */
     BizDeviceDetailVO queryDeviceDetailByClinicId(String clinicId);
+    /**
+     * @description: 根据输注ID查询泵设备报警信息
+     * @author wangzl
+     * @date 2025/8/11
+     */
+    List<BizDeviceAlarmInfoDTO> queryAlarmInfo(String infusionId);
 }

+ 17 - 4
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/common/service/impl/BizDeviceServiceImpl.java

@@ -5,14 +5,18 @@ import cn.tr.core.exception.ServiceException;
 import cn.tr.core.exception.TRExcCode;
 import cn.tr.module.smart.common.dto.BizDeviceDTO;
 import cn.tr.module.smart.common.dto.BizDeviceQueryDTO;
+import cn.tr.module.smart.common.mapper.BizDeviceAlarmMapper;
 import cn.tr.module.smart.common.mapper.BizInfusionHistoryMapper;
+import cn.tr.module.smart.common.po.BizDeviceAlarmPO;
 import cn.tr.module.smart.common.po.BizDevicePO;
 import cn.tr.module.smart.common.po.BizInfusionClinicPO;
 import cn.tr.module.smart.common.po.BizInfusionHistoryPO;
+import cn.tr.module.smart.common.repository.BizDeviceAlarmRepository;
 import cn.tr.module.smart.common.repository.BizDeviceRepository;
 import cn.tr.module.smart.common.repository.BizInfusionClinicRepository;
 import cn.tr.module.smart.common.repository.BizInfusionHistoryRepository;
 import cn.tr.module.smart.common.service.IBizDeviceService;
+import cn.tr.module.smart.web.dto.BizDeviceAlarmInfoDTO;
 import cn.tr.module.smart.web.dto.BizDeviceAndClinicDetailQueryDTO;
 import cn.tr.module.smart.web.vo.BizDeviceAndClinicDetailVO;
 import cn.tr.module.smart.web.vo.BizDeviceDetailVO;
@@ -36,10 +40,7 @@ public class BizDeviceServiceImpl implements IBizDeviceService {
     private BizDeviceRepository bizDeviceRepository;
 
     @Autowired
-    private BizInfusionHistoryRepository bizInfusionHistoryRepository;
-    @Autowired
-    private BizInfusionClinicRepository bizInfusionClinicRepository;
-
+    private BizDeviceAlarmRepository bizDeviceAlarmRepository;
     /**
      * @param query 查询参数
      * @description: 根据条件查询泵设备列表
@@ -95,5 +96,17 @@ public class BizDeviceServiceImpl implements IBizDeviceService {
         return bizDeviceDetailVO;
     }
 
+    /**
+     * @param infusionId
+     * @description: 根据输注ID查询泵设备报警信息
+     * @author wangzl
+     * @date 2025/8/11
+     */
+    @Override
+    public List<BizDeviceAlarmInfoDTO> queryAlarmInfo(String infusionId) {
+        List<BizDeviceAlarmPO> bizDeviceAlarmPOS = bizDeviceAlarmRepository.selectList(new LambdaQueryWrapper<BizDeviceAlarmPO>()
+                .eq(BizDeviceAlarmPO::getInfusionId, infusionId).orderByDesc(BizDeviceAlarmPO::getUploadTime));
+        return BizDeviceAlarmMapper.INSTANCE.convertAlarmInfoDtoList(bizDeviceAlarmPOS);
+    }
 
 }

+ 5 - 2
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/web/controller/BizDeviceController.java

@@ -7,6 +7,7 @@ import cn.tr.core.pojo.TableDataInfo;
 import cn.tr.module.smart.common.dto.BizDeviceDTO;
 import cn.tr.module.smart.common.dto.BizDeviceQueryDTO;
 import cn.tr.module.smart.common.service.IBizDeviceService;
+import cn.tr.module.smart.web.dto.BizDeviceAlarmInfoDTO;
 import cn.tr.module.smart.web.vo.BizDeviceAndClinicDetailVO;
 import cn.tr.module.smart.web.vo.BizDeviceDetailVO;
 import cn.tr.module.sys.oauth2.LoginTypeConstant;
@@ -19,6 +20,8 @@ import lombok.AllArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 /**
  * @author wangzl
  * @description: TODO
@@ -58,8 +61,8 @@ public class BizDeviceController extends BaseController {
     @ApiOperationSupport(author = "wangzl", order = 4)
     @ApiOperation(value = "查询报警信息", notes = "权限: 无")
     @GetMapping("/alarm/{infusionId}")
-    public CommonResult<String> queryAlarm(@PathVariable String infusionId) {
-        return CommonResult.success(null);
+    public CommonResult<List<BizDeviceAlarmInfoDTO>> queryAlarmInfo(@PathVariable String infusionId) {
+        return CommonResult.success(bizDeviceService.queryAlarmInfo(infusionId));
     }
     @ApiOperationSupport(author = "wangzl", order = 5)
     @ApiOperation(value = "查询输注折线图", notes = "权限: 无")

+ 121 - 0
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/web/dto/BizDeviceAlarmInfoDTO.java

@@ -0,0 +1,121 @@
+package cn.tr.module.smart.web.dto;
+
+import cn.hutool.core.text.CharSequenceUtil;
+import cn.hutool.core.util.EnumUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.tr.module.smart.common.enums.FlowStatusEnum;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author wangzl
+ * @description: TODO
+ * @date 2025/8/11 8:01
+ */
+
+@Data
+@ApiModel("泵表报警信息")
+public class BizDeviceAlarmInfoDTO {
+
+    @ApiModelProperty(value = "泵id", position = 1)
+    private String deviceId;
+
+    @ApiModelProperty(value = "输注记录id", position = 2)
+    private String infusionId;
+
+    @ApiModelProperty(value = "上传时间", position = 3)
+    private Date uploadTime;
+
+    @ApiModelProperty(value = "是否报警", position = 4)
+    private Boolean alarm;
+
+    @ApiModelProperty("设备报警状态")
+    private String alarmState;
+
+    @ApiModelProperty(value = "报警信息", position = 5)
+    private String warns;
+
+    @ApiModelProperty(value = "输注即将结束提醒", position = 6, hidden = true)
+    @JsonIgnore
+    private Boolean warnWillFinished;
+
+    @ApiModelProperty(value = "镇痛不足提醒", position = 7, hidden = true)
+    @JsonIgnore
+    private Boolean warnAnalgesicPoor;
+
+    @ApiModelProperty(value = "电量偏低提醒", position = 8, hidden = true)
+    @JsonIgnore
+    private Boolean warnLowBattery;
+
+    @ApiModelProperty(value = "加减档提示", position = 9, hidden = true)
+    @JsonIgnore
+    private String warnFlow;
+
+    private void judgeWarnWillFinished() {
+        if (!Boolean.TRUE.equals(this.warnWillFinished)) {
+            return;
+        }
+        if (CharSequenceUtil.isEmpty(this.warns)) {
+            this.warns = "输注即将结束;";
+        } else {
+            this.warns = this.warns + "输注即将结束;";
+        }
+    }
+
+    private void judgeWarnAnalgesicPoor() {
+        if (!Boolean.TRUE.equals(this.warnAnalgesicPoor)) {
+            return;
+        }
+        if (CharSequenceUtil.isEmpty(this.warns)) {
+            this.warns = "镇痛不足;";
+        } else {
+            this.warns = this.warns + "镇痛不足;";
+        }
+    }
+
+    private void judgeWarnLowBattery() {
+        if (!Boolean.TRUE.equals(this.warnLowBattery)) {
+            return;
+        }
+        if (CharSequenceUtil.isEmpty(this.warns)) {
+            this.warns = "电量偏低;";
+        } else {
+            this.warns = this.warns + "电量偏低;";
+        }
+    }
+
+    private void judgeWarnFlow() {
+        if (this.warnFlow == null) {
+            return;
+        }
+        FlowStatusEnum flow = EnumUtil.likeValueOf(FlowStatusEnum.class, this.warns);
+        if (ObjectUtil.isNull(flow)) {
+            return;
+        }
+        if (CharSequenceUtil.isEmpty(this.warns)) {
+            this.warns = flow.getText() + ";";
+        } else {
+            this.warns = this.warns + flow.getText() + ";";
+        }
+    }
+
+    public void handleWarn() {
+        judgeWarnAnalgesicPoor();
+        judgeWarnFlow();
+        judgeWarnLowBattery();
+        judgeWarnWillFinished();
+    }
+
+    public String getWarns() {
+        handleWarn();
+        if (StrUtil.isNotEmpty(warns)) {
+            return warns.endsWith(";") ? warns.substring(0, warns.length() - 1) : warns;
+        }
+        return warns;
+    }
+}

+ 0 - 1
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/web/vo/BizDeviceInfoVO.java

@@ -116,7 +116,6 @@ public class BizDeviceInfoVO implements Serializable {
             return warns.endsWith(";") ? warns.substring(0, warns.length() - 1) : warns;
         }
         return warns;
-
     }
 
 }