Selaa lähdekoodia

泵详情查询接口提交

wangzl 4 kuukautta sitten
vanhempi
commit
f7b11febee

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

@@ -2,6 +2,9 @@ package cn.tr.module.smart.common.mapper;
 
 import cn.tr.module.smart.common.dto.NbPumpInfusionDTO;
 import cn.tr.module.smart.common.po.BizInfusionHistoryPO;
+import cn.tr.module.smart.web.vo.BizDeviceAndClinicDetailVO;
+import cn.tr.module.smart.web.vo.BizDeviceInfoVO;
+import cn.tr.module.smart.web.vo.BizInfusionInfoVO;
 import org.mapstruct.Mapper;
 import org.mapstruct.Mapping;
 import org.mapstruct.Mappings;
@@ -26,4 +29,11 @@ public interface BizInfusionHistoryMapper {
     BizInfusionHistoryPO convertPO(NbPumpInfusionDTO source);
 
 
+    BizDeviceInfoVO convertDeviceInfoVO(BizDeviceAndClinicDetailVO source);
+
+    @Mappings({
+            @Mapping(target = "infusionId",source = "id"),
+    })
+    BizInfusionInfoVO convertInfusionInfoVo(BizDeviceAndClinicDetailVO source);
+
 }

+ 6 - 0
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/common/repository/BizDeviceRepository.java

@@ -3,12 +3,15 @@ package cn.tr.module.smart.common.repository;
 import cn.tr.module.smart.common.dto.BizDeviceDTO;
 import cn.tr.module.smart.common.dto.BizDeviceQueryDTO;
 import cn.tr.module.smart.common.po.BizDevicePO;
+import cn.tr.module.smart.web.dto.BizDeviceAndClinicDetailQueryDTO;
+import cn.tr.module.smart.web.vo.BizDeviceAndClinicDetailVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 患者信息Mapper接口
@@ -21,4 +24,7 @@ import java.util.List;
 public interface BizDeviceRepository extends BaseMapper<BizDevicePO> {
 
     List<BizDeviceDTO> selectDeviceList(@Param("query") BizDeviceQueryDTO query);
+
+
+    List<BizDeviceAndClinicDetailVO> selectDeviceDetailAndClinicList(@Param("query")BizDeviceAndClinicDetailQueryDTO queryDTO);
 }

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

@@ -2,6 +2,8 @@ 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.vo.BizDeviceAndClinicDetailVO;
+import cn.tr.module.smart.web.vo.BizDeviceDetailVO;
 
 import java.util.List;
 
@@ -18,4 +20,13 @@ public interface IBizDeviceService {
      * @date 2025/8/6
      */
     List<BizDeviceDTO> selectList(BizDeviceQueryDTO query);
+
+    /**
+     * @description: 泵详情
+     * @author wangzl
+     * @date 2025/8/7
+     */
+    BizDeviceDetailVO queryDeviceDetail(String deviceId);
+
+    BizDeviceDetailVO queryDeviceDetailByClinicId(String clinicId);
 }

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

@@ -1,9 +1,24 @@
 package cn.tr.module.smart.common.service.impl;
 
+import cn.hutool.core.util.ObjectUtil;
+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.BizInfusionHistoryMapper;
+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.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.BizDeviceAndClinicDetailQueryDTO;
+import cn.tr.module.smart.web.vo.BizDeviceAndClinicDetailVO;
+import cn.tr.module.smart.web.vo.BizDeviceDetailVO;
+import cn.tr.module.smart.web.vo.BizDeviceInfoVO;
+import cn.tr.module.smart.web.vo.BizInfusionInfoVO;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -20,6 +35,11 @@ public class BizDeviceServiceImpl implements IBizDeviceService {
     @Autowired
     private BizDeviceRepository bizDeviceRepository;
 
+    @Autowired
+    private BizInfusionHistoryRepository bizInfusionHistoryRepository;
+    @Autowired
+    private BizInfusionClinicRepository bizInfusionClinicRepository;
+
     /**
      * @param query 查询参数
      * @description: 根据条件查询泵设备列表
@@ -30,4 +50,50 @@ public class BizDeviceServiceImpl implements IBizDeviceService {
     public List<BizDeviceDTO> selectList(BizDeviceQueryDTO query) {
         return bizDeviceRepository.selectDeviceList(query);
     }
+
+    /**
+     * @param deviceId
+     * @description: 泵详情
+     * @author wangzl
+     * @date 2025/8/7
+     */
+    @Override
+    public BizDeviceDetailVO queryDeviceDetail(String deviceId) {
+        BizDeviceAndClinicDetailQueryDTO query = new BizDeviceAndClinicDetailQueryDTO();
+        query.setDeviceId(deviceId);
+        List<BizDeviceAndClinicDetailVO> bizDeviceAndClinicDetailVOS = bizDeviceRepository.selectDeviceDetailAndClinicList(query);
+        if(ObjectUtil.isNull(bizDeviceAndClinicDetailVOS)){
+            throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001, "泵信息不存在");
+        }
+        //因为一一对应所以数据只会有一条
+        BizDeviceAndClinicDetailVO bizDeviceAndClinicDetailVO = bizDeviceAndClinicDetailVOS.get(0);
+        BizDeviceDetailVO bizDeviceDetailVO = new BizDeviceDetailVO();
+        bizDeviceDetailVO.setClinicId(bizDeviceAndClinicDetailVO.getClinicRoomId());
+        BizDeviceInfoVO bizDeviceInfoVO = BizInfusionHistoryMapper.INSTANCE.convertDeviceInfoVO(bizDeviceAndClinicDetailVO);
+        bizDeviceDetailVO.setDeviceInfo(bizDeviceInfoVO);
+        BizInfusionInfoVO bizInfusionInfoVO = BizInfusionHistoryMapper.INSTANCE.convertInfusionInfoVo(bizDeviceAndClinicDetailVO);
+        bizDeviceDetailVO.setInfusionInfo(bizInfusionInfoVO);
+        return bizDeviceDetailVO;
+    }
+
+    @Override
+    public BizDeviceDetailVO queryDeviceDetailByClinicId(String clinicId) {
+        BizDeviceAndClinicDetailQueryDTO query = new BizDeviceAndClinicDetailQueryDTO();
+        query.setClinicId(clinicId);
+        List<BizDeviceAndClinicDetailVO> bizDeviceAndClinicDetailVOS = bizDeviceRepository.selectDeviceDetailAndClinicList(query);
+        if(ObjectUtil.isNull(bizDeviceAndClinicDetailVOS)){
+            throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001, "泵信息不存在");
+        }
+        //因为一一对应所以数据只会有一条
+        BizDeviceAndClinicDetailVO bizDeviceAndClinicDetailVO = bizDeviceAndClinicDetailVOS.get(0);
+        BizDeviceDetailVO bizDeviceDetailVO = new BizDeviceDetailVO();
+        bizDeviceDetailVO.setClinicId(bizDeviceAndClinicDetailVO.getClinicRoomId());
+        BizDeviceInfoVO bizDeviceInfoVO = BizInfusionHistoryMapper.INSTANCE.convertDeviceInfoVO(bizDeviceAndClinicDetailVO);
+        bizDeviceDetailVO.setDeviceInfo(bizDeviceInfoVO);
+        BizInfusionInfoVO bizInfusionInfoVO = BizInfusionHistoryMapper.INSTANCE.convertInfusionInfoVo(bizDeviceAndClinicDetailVO);
+        bizDeviceDetailVO.setInfusionInfo(bizInfusionInfoVO);
+        return bizDeviceDetailVO;
+    }
+
+
 }

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

@@ -2,21 +2,22 @@ package cn.tr.module.smart.web.controller;
 
 import cn.dev33.satoken.annotation.SaCheckLogin;
 import cn.dev33.satoken.annotation.SaIgnore;
+import cn.tr.core.pojo.CommonResult;
 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.vo.BizDeviceAndClinicDetailVO;
+import cn.tr.module.smart.web.vo.BizDeviceDetailVO;
 import cn.tr.module.sys.oauth2.LoginTypeConstant;
 import cn.tr.plugin.mybatis.base.BaseController;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.sun.jna.platform.unix.solaris.LibKstat;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * @author wangzl
@@ -27,17 +28,45 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequestMapping("/web/device")
 @AllArgsConstructor
-//@SaCheckLogin(type = LoginTypeConstant.WEB)
+@SaCheckLogin(type = LoginTypeConstant.WEB)
 public class BizDeviceController extends BaseController {
 
     @Autowired
     private IBizDeviceService bizDeviceService;
 
-    @ApiOperationSupport(author = "wangzl",order = 1)
-    @ApiOperation(value="查询泵设备列表",notes = "权限: 无")
+    @ApiOperationSupport(author = "wangzl", order = 1)
+    @ApiOperation(value = "查询泵设备列表", notes = "权限: 无")
     @PostMapping("/query/page")
-    public TableDataInfo<BizDeviceDTO> selectList(@RequestBody BizDeviceQueryDTO query){
+    public TableDataInfo<BizDeviceDTO> selectList(@RequestBody BizDeviceQueryDTO query) {
         startPage();
         return getDataTable(bizDeviceService.selectList(query));
     }
+
+    @ApiOperationSupport(author = "wangzl", order = 2)
+    @ApiOperation(value = "根据泵ID查询设备详情", notes = "权限: 无")
+    @GetMapping("/detail/{deviceId}")
+    public CommonResult<BizDeviceDetailVO> queryDeviceDetail(@PathVariable String deviceId) {
+        return CommonResult.success(bizDeviceService.queryDeviceDetail(deviceId));
+    }
+    @ApiOperationSupport(author = "wangzl", order = 3)
+    @ApiOperation(value = "根据手术ID查询设备详情", notes = "权限: 无")
+    @GetMapping("/detail/{clinicId}")
+    public CommonResult<BizDeviceDetailVO> queryDeviceDetailByClinicId(@PathVariable String clinicId) {
+        return CommonResult.success(bizDeviceService.queryDeviceDetailByClinicId(clinicId));
+    }
+
+    @ApiOperationSupport(author = "wangzl", order = 4)
+    @ApiOperation(value = "查询报警信息", notes = "权限: 无")
+    @GetMapping("/alarm/{deviceId}")
+    public CommonResult<String> queryAlarm(@PathVariable String deviceId) {
+        return CommonResult.success(null);
+    }
+    @ApiOperationSupport(author = "wangzl", order = 5)
+    @ApiOperation(value = "查询输注折线图", notes = "权限: 无")
+    @GetMapping("/infusion/graph/{deviceId}")
+    public CommonResult<String> infusionGraph(@PathVariable String deviceId) {
+        return CommonResult.success(null);
+    }
+
+
 }

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

@@ -0,0 +1,23 @@
+package cn.tr.module.smart.web.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author wangzl
+ * @description: TODO
+ * @date 2025/8/7 10:52
+ */
+@Data
+@ApiModel("泵和手术详情查询")
+public class BizDeviceAndClinicDetailQueryDTO implements Serializable {
+
+    @ApiModelProperty(value = "泵id", position = 1)
+    private String deviceId;
+
+    @ApiModelProperty(value = "手术id", position = 2)
+    private String clinicId;
+}

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

@@ -0,0 +1,42 @@
+package cn.tr.module.smart.web.vo;
+
+import cn.tr.module.smart.common.po.BizInfusionHistoryPO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+
+/**
+ * @author wangzl
+ * @description: TODO
+ * @date 2025/8/7 10:16
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel("泵详情")
+public class BizDeviceAndClinicDetailVO extends BizInfusionHistoryPO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "泵别名")
+    private String alias;
+
+    @ApiModelProperty(value = "手术ID")
+    private String clinicRoomId;
+
+    @ApiModelProperty("患者ID")
+    private String patientId;
+
+    @ApiModelProperty("患者姓名")
+    private String patientName;
+
+    @ApiModelProperty("患者性别")
+    private String patientGender;
+
+    @ApiModelProperty("患者年龄")
+    private Integer patientAge;
+
+    @ApiModelProperty("患者头像")
+    private String imageUrl;
+}

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

@@ -0,0 +1,25 @@
+package cn.tr.module.smart.web.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author wangzl
+ * @description: 泵信息详情
+ * @date 2025/8/7 7:51
+ */
+@Data
+@ApiModel("泵信息详情")
+public class BizDeviceDetailVO {
+
+    @ApiModelProperty(value = "手术ID", position = 1)
+    private String clinicId;
+
+    @ApiModelProperty(value = "泵信息", position = 2)
+    private BizDeviceInfoVO deviceInfo;
+
+    @ApiModelProperty(value = "输注信息", position = 3)
+    private BizInfusionInfoVO infusionInfo;
+
+}

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

@@ -0,0 +1,122 @@
+package cn.tr.module.smart.web.vo;
+
+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 io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author wangzl
+ * @description: TODO
+ * @date 2025/8/7 7:53
+ */
+@Data
+@ApiModel("泵信息")
+public class BizDeviceInfoVO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "泵id",position = 1)
+    private String deviceId;
+
+    @ApiModelProperty(value = "泵类型",position = 2)
+    private String deviceType;
+
+    @ApiModelProperty(value = "泵别名",position = 3)
+    private String alias;
+
+    @ApiModelProperty(value = "报警信息",position = 4)
+    private String deviceAlarm;
+
+    @ApiModelProperty(value = "电量",position = 5)
+    private Integer electricQuantity;
+
+    @ApiModelProperty(value = "泵运行状态",position = 6)
+    private String deviceRunState;
+
+    @ApiModelProperty(value = "提醒字段",position = 7)
+    private String warns;
+
+    @ApiModelProperty(value = "输注即将结束提醒",position = 8)
+    private Boolean warnWillFinished;
+
+    @ApiModelProperty(value = "镇痛不足提醒",position = 9)
+    private Boolean warnAnalgesicPoor;
+
+    @ApiModelProperty(value = "电量偏低提醒",position = 10)
+    private Boolean warnLowBattery;
+
+    @ApiModelProperty(value = "加减档提示", position = 11)
+    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;
+
+    }
+
+}

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

@@ -0,0 +1,75 @@
+package cn.tr.module.smart.web.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @author wangzl
+ * @description: TODO
+ * @date 2025/8/7 7:53
+ */
+@Data
+@ApiModel("输注信息")
+public class BizInfusionInfoVO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+
+    @ApiModelProperty(value = "总量", position = 1)
+    private Integer totalDose;
+
+    @ApiModelProperty(value = "公共参数-首次量", position = 2)
+    private Integer firstDose;
+
+    @ApiModelProperty(value = "公共参数-剩余量", position = 3)
+    private BigDecimal remainDose;
+
+    @ApiModelProperty(value = "公共参数-已输入量", position = 4)
+    private BigDecimal inputDose;
+
+    @ApiModelProperty(value = "持续泵参数-持续量", position = 5)
+    private BigDecimal continueDose;
+
+    @ApiModelProperty(value = "公共参数-追加量", position = 6)
+    private BigDecimal appendDose;
+
+    @ApiModelProperty(value = "公共参数-极限量", position = 7)
+    private BigDecimal maxDose;
+
+    @ApiModelProperty(value = "公共参数-自控锁时", position = 8)
+    private BigDecimal selfControlLockTime;
+
+    @ApiModelProperty(value = "公共参数-pca有效次数", position = 9)
+    private Integer pcaValidCount;
+
+    @ApiModelProperty(value = "公共参数-pca无效次数", position = 10)
+    private Integer pcaInvalidCount;
+
+    @ApiModelProperty(value = "公共参数-pca总按次数", position = 11)
+    private Integer pcaTotalCount;
+
+    @ApiModelProperty(value = "智能泵参数-加档周期", position = 12)
+    private BigDecimal flowUpCycle;
+
+    @ApiModelProperty(value = "智能泵参数-减档周期", position = 13)
+    private BigDecimal flowDownCycle;
+
+    @ApiModelProperty(value = "智能泵参数-计次", position = 14)
+    private Integer flowCount;
+
+    @ApiModelProperty(value = "智能泵参数-上限", position = 15)
+    private BigDecimal flowUpLimit;
+
+    @ApiModelProperty(value = "智能泵参数-下限", position = 16)
+    private BigDecimal flowDownLimit;
+
+    @ApiModelProperty(value = "智能泵参数-自调比例", position = 17)
+    private BigDecimal flowAdjustRate;
+
+    @ApiModelProperty(value = "输注id", position = 18)
+    private String infusionId;
+}

+ 90 - 0
tr-modules/tr-module-smartFollowUp/src/main/resources/mapper/smart/BizDeviceMapper.xml

@@ -16,6 +16,68 @@
         <result property="electricQuantity" column="electric_quantity"/>
     </resultMap>
 
+    <resultMap id="deviceDetail" type="cn.tr.module.smart.web.vo.BizDeviceAndClinicDetailVO">
+        <result property="alias" column="alias"/>
+        <result property="clinicRoomId" column="clinic_room_id"/>
+        <result property="patientId" column="patient_id"/>
+        <result property="patientName" column="patient_name"/>
+        <result property="patientName" column="patient_gender"/>
+        <result property="patientAge" column="patient_age"/>
+        <result property="imageUrl" column="image_url"/>
+        <result property="id" column="id"/>
+        <result property="deviceId" column="device_id"/>
+        <result property="classification" column="classification"/>
+        <result property="dataNum" column="data_num"/>
+        <result property="patientCode" column="patient_code"/>
+        <result property="totalDose" column="total_dose"/>
+        <result property="firstDose" column="first_dose"/>
+        <result property="remainDose" column="remain_dose"/>
+        <result property="inputDose" column="input_dose"/>
+        <result property="appendDose" column="append_dose"/>
+        <result property="appendLockTime" column="append_lock_time"/>
+        <result property="maxDose" column="max_dose"/>
+        <result property="selfControlCount" column="self_control_count"/>
+        <result property="selfControlLockTime" column="self_control_lock_time"/>
+        <result property="pcaValidCount" column="pca_valid_count"/>
+        <result property="pcaInvalidCount" column="pca_invalid_count"/>
+        <result property="pcaTotalCount" column="pca_total_count"/>
+        <result property="continueDose" column="continue_dose"/>
+        <result property="pulseDose" column="pulse_dose"/>
+        <result property="pulseLockTime" column="pulse_lock_time"/>
+        <result property="pulseFirstLockTime" column="pulse_first_lock_time"/>
+        <result property="flowUpCycle" column="flow_up_cycle"/>
+        <result property="flowDownCycle" column="flow_down_cycle"/>
+        <result property="flowCount" column="flow_count"/>
+        <result property="flowUpLimit" column="flow_up_limit"/>
+        <result property="flowDownLimit" column="flow_down_limit"/>
+        <result property="flowAdjustRate" column="flow_adjust_rate"/>
+        <result property="flowRestricted" column="flow_restricted"/>
+        <result property="warnFlow" column="warn_flow"/>
+        <result property="electricQuantity" column="electric_quantity"/>
+        <result property="deviceRunState" column="device_run_state"/>
+        <result property="deviceAlarm" column="device_alarm"/>
+        <result property="infusionStartTime" column="infusion_start_time"/>
+        <result property="lastUploadTime" column="last_upload_time"/>
+        <result property="deviceType" column="device_type"/>
+        <result property="tenantId" column="tenant_id"/>
+        <result property="hospitalCode" column="hospital_code"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="createBy" column="create_by"/>
+        <result property="warnWillFinished" column="warn_will_finished"/>
+        <result property="warnAnalgesicPoor" column="warn_analgesic_poor"/>
+        <result property="warnLowBattery" column="warn_low_battery"/>
+    </resultMap>
+    <sql id="InfusionColumn">
+        bih.id,bih.device_id,bih.classification,bih.data_num,bih.patient_code,bih.total_dose,bih.first_dose,bih.remain_dose,
+    bih.input_dose,bih.append_dose,bih.append_lock_time,bih.max_dose,bih.self_control_count,bih.self_control_lock_time,
+    bih.pca_valid_count,bih.pca_invalid_count,bih.pca_total_count,bih.continue_dose,bih.pulse_dose,bih.pulse_lock_time,
+    bih.pulse_first_lock_time,bih.flow_up_cycle,bih.flow_down_cycle,bih.flow_count,bih.flow_up_limit,bih.flow_down_limit,
+    bih.flow_adjust_rate,bih.flow_restricted,bih.warn_flow,bih.electric_quantity,bih.device_run_state,bih.device_alarm,
+    bih.infusion_start_time,bih.last_upload_time,bih.device_type,bih.tenant_id,bih.hospital_code,bih.create_time,
+    bih.update_time,bih.update_by,bih.create_by,bih.warn_will_finished,bih.warn_analgesic_poor,bih.warn_low_battery
+    </sql>
     <select id="selectDeviceList" resultMap="deviceDto">
         SELECT
         bd.device_id,
@@ -43,4 +105,32 @@
         </where>
         order by bih.last_upload_time desc
     </select>
+
+    <select id="selectDeviceDetailAndClinicList" resultMap="deviceDetail">
+        SELECT
+        bd.alias,
+        bcr.id as clinic_room_id,
+        bcr.patient_id,
+        bcr.patient_name,
+        bcr.patient_gender,
+        bcr.patient_age,
+        bcr.image_url,
+        <include refid="InfusionColumn"/>
+        FROM
+        biz_device bd
+        JOIN biz_infusion_history bih ON bd.infusion_id = bih.ID
+        LEFT JOIN biz_infusion_clinic bic ON bih.ID = bic.infusion_id
+        LEFT JOIN biz_clinic_room bcr ON bic.clinic_id = bcr.ID
+        <where>
+            <if test="query.deviceId != null and query.deviceId != ''">
+                and bd.device_id = #{query.deviceId}
+            </if>
+            <if test="query.clinicId != null and query.clinicId != ''">
+                and bcr.id = #{query.clinicId}
+            </if>
+        </where>
+        order by bih.last_upload_time desc
+    </select>
+
+
 </mapper>