Bladeren bron

add
平板技改项目

18339543638 8 maanden geleden
bovenliggende
commit
9f237e2ff4

+ 3 - 0
nb-service-api/web-service-api/src/main/java/com/nb/web/api/feign/IPatientClient.java

@@ -3,6 +3,7 @@ package com.nb.web.api.feign;
 import com.nb.core.result.R;
 import com.nb.web.api.entity.BusClinicEntity;
 import com.nb.web.api.enums.ClinicManageEnum;
+import com.nb.web.api.feign.query.DoctorPatientMonitorQuery;
 import com.nb.web.api.feign.query.PatientMonitorQuery;
 import com.nb.web.api.feign.result.*;
 import org.springframework.web.context.request.async.DeferredResult;
@@ -110,4 +111,6 @@ public interface IPatientClient {
     boolean setClinic(BusClinicEntity busClinic);
 
 
+
+    List<DoctorPatientMonitorResult> doctorSelectPatientList(DoctorPatientMonitorQuery query);
 }

+ 88 - 0
nb-service-api/web-service-api/src/main/java/com/nb/web/api/feign/query/DoctorPatientMonitorQuery.java

@@ -0,0 +1,88 @@
+package com.nb.web.api.feign.query;
+
+import cn.hutool.core.collection.CollectionUtil;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.nb.web.api.enums.DeviceAlarmEnum;
+import com.nb.web.api.enums.DeviceStatusEnum;
+import com.nb.web.api.enums.DeviceTypeEnum;
+import com.nb.web.api.enums.WarnEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+import java.util.*;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName PatientMonitorQuery.java
+ * @Description TODO
+ * @createTime 2022年04月22日 08:50:00
+ */
+@Data
+@ApiModel("病人监控查询参数")
+public class DoctorPatientMonitorQuery implements Serializable {
+    @ApiModelProperty("是否为咨询模式")
+    private Boolean consult=false;
+
+    @ApiModelProperty("住院号")
+    private String patientCode;
+
+    @ApiModelProperty("病区查询集合")
+    private List<String> wards;
+
+    @ApiModelProperty("床号")
+    private String bedNo;
+
+    @ApiModelProperty("患者姓名")
+    private String patientName;
+
+    @ApiModelProperty("麻醉医生")
+    private String anaDoctor;
+
+    @ApiModelProperty("手术名称")
+    private String surgeName;
+
+    @ApiModelProperty("麻醉方式")
+    private String anaType;
+
+    @ApiModelProperty("评价状态 1、已评价 2、待评价 3、未评价")
+    private Integer evaluate;
+
+    @ApiModelProperty("患者是否异常")
+    private Boolean abnormal;
+
+    /**
+     * @see  DeviceTypeEnum #value
+     */
+    @ApiModelProperty("设备类型查询,1、网络泵、 2、智能泵  3、脉冲泵  4、化疗泵")
+    private List<Integer> types;
+
+    /**
+     * @see  DeviceStatusEnum #value
+     */
+    @ApiModelProperty("运行状态  1、正在输注 2、不在服务区 3、待机 4、其他")
+    private List<Integer> deviceStatus;
+
+    @ApiModelProperty("是否有报警")
+    private Boolean alarm;
+
+    @ApiModelProperty("是否有提醒")
+    private Boolean warn;
+
+    @ApiModelProperty("查询时间区间")
+    private List<Date> timeRange;
+
+    @ApiModelProperty(value = "管理类型",allowableValues = "0、院内管理;1、居家管理")
+    private Integer manageType;
+
+    @ApiModelProperty("排序方式 0、默认按照输注开始时间排序 1、按照床号排序")
+    private Integer orderType;
+
+    @ApiModelProperty(value = "医院id",hidden = true)
+    @JsonIgnore
+    private String tenantId;
+
+}

+ 225 - 0
nb-service-api/web-service-api/src/main/java/com/nb/web/api/feign/result/DoctorPatientMonitorResult.java

@@ -0,0 +1,225 @@
+package com.nb.web.api.feign.result;
+
+import cn.hutool.core.text.CharSequenceUtil;
+import cn.hutool.core.util.StrUtil;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.nb.core.enums.SexEnum;
+import com.nb.web.api.enums.*;
+import com.nb.web.api.feign.result.PatientMonitorResult;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName PatientMonitorConsultResult.java
+ * @Description 病人监护咨询模式
+ * @createTime 2022年08月13日 17:06:00
+ */
+@Data
+@ApiModel("病人监护咨询模式")
+public class DoctorPatientMonitorResult implements Serializable {
+    @ApiModelProperty(value = "病人id")
+    private String patientId;
+
+    @ApiModelProperty(value = "格式化后的病号")
+    private String patientCode;
+
+    @ApiModelProperty(value = "病人名称")
+    private String patientName;
+
+    @ApiModelProperty(value = "病人年龄")
+    private String patientAge;
+
+    @ApiModelProperty(value = "性别")
+    private SexEnum gender;
+
+    @ApiModelProperty(value = "病人报警信息",example = "泵重复,无泵")
+    private PatientAlarmEnum patientAlarm;
+
+    @ApiModelProperty(value = "设备id")
+    private String deviceId;
+
+    @ApiModelProperty(value = "泵别名")
+    private String deviceAlias;
+
+    @ApiModelProperty(value = "临床id")
+    private String clinicId;
+
+    @ApiModelProperty(value = "病区")
+    private String ward;
+
+    @ApiModelProperty(value = "床号")
+    private String bedNo;
+
+    @ApiModelProperty(value = "总量")
+    private Integer totalDose;
+
+    @ApiModelProperty(value = "公共参数-首次量")
+    private Integer firstDose;
+
+    @ApiModelProperty(value = "公共参数-电量",readOnly = true)
+    private Integer electricQuantity;
+
+    @ApiModelProperty(value = "公共参数-剩余量")
+    private BigDecimal remainDose;
+
+    @ApiModelProperty(value = "公共参数-已输入量")
+    private BigDecimal inputDose;
+
+    @ApiModelProperty(value = "公共参数-追加量")
+    private BigDecimal appendDose;
+
+    @ApiModelProperty(value = "公共参数-追加锁时")
+    private BigDecimal appendLockTime;
+
+    @ApiModelProperty(value = "公共参数-极限量")
+    private BigDecimal maxDose;
+
+    @ApiModelProperty(value = "公共参数-自控锁时")
+    private BigDecimal selfControlLockTime;
+
+    @ApiModelProperty(value = "公共参数-pca有效次数")
+    private Integer pcaValidCount;
+
+    @ApiModelProperty(value = "公共参数-pca无效次数")
+    private Integer pcaInvalidCount;
+
+    @ApiModelProperty(value = "公共参数-pca总按次数")
+    private Integer pcaTotalCount;
+
+    @ApiModelProperty(value = "持续泵参数-持续量")
+    private BigDecimal continueDose;
+
+    @ApiModelProperty(value = "脉冲泵参数-脉冲量")
+    private Integer pulseDose;
+
+    @ApiModelProperty(value = "脉冲泵参数-脉冲锁时")
+    private Integer pulseLockTime;
+
+    @ApiModelProperty(value = "脉冲泵参数-脉冲首次锁时")
+    private Integer pulseFirstLockTime;
+
+    @ApiModelProperty(value = "智能泵参数-加档周期")
+    private BigDecimal flowUpCycle;
+
+    @ApiModelProperty(value = "智能泵参数-减档周期")
+    private BigDecimal flowDownCycle;
+
+    @ApiModelProperty(value = "智能泵参数-计次")
+    private BigDecimal flowCount;
+
+    @ApiModelProperty(value = "智能泵参数-上限")
+    private BigDecimal flowUpLimit;
+
+    @ApiModelProperty(value = "智能泵参数-下限")
+    private BigDecimal flowDownLimit;
+
+    @ApiModelProperty(value = "智能泵参数-自调比例")
+    private BigDecimal flowAdjustRate;
+
+    @ApiModelProperty(value = "泵运行状态")
+    private DeviceStatusEnum deviceRunState;
+
+    @ApiModelProperty(value = "报警信息")
+    private DeviceAlarmEnum deviceAlarm;
+
+    @ApiModelProperty(value = "输注开始时间,即本次运行开机时间")
+    private Date infusionStartTime;
+
+    @ApiModelProperty(value = "泵类型")
+    private DeviceTypeEnum deviceType;
+
+    @ApiModelProperty("该临床的最后一次评价时间")
+    private Date evalTime;
+
+    @ApiModelProperty(value = "输注即将结束提醒",hidden = true)
+    @JsonIgnore
+    private Boolean warnWillFinished;
+
+    @ApiModelProperty(value = "镇痛不足提醒",hidden = true)
+    @JsonIgnore
+    private Boolean warnAnalgesicPoor;
+
+    @ApiModelProperty(value = "电量偏低提醒",hidden = true)
+    @JsonIgnore
+    private Boolean warnLowBattery;
+
+    @ApiModelProperty(value = "加减档提示",accessMode = ApiModelProperty.AccessMode.READ_ONLY)
+    @JsonIgnore
+    private FlowStatusEnum warnFlow;
+
+    @ApiModelProperty(value = "管理类型",example = "0、院内管理 1、居家管理")
+    private ClinicManageEnum manageType;
+
+    @ApiModelProperty("提醒字段")
+    private String warns;
+
+    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;
+        }
+        if (CharSequenceUtil.isEmpty(this.warns)) {
+            this.warns=warnFlow.getText()+";";
+        }else {
+            this.warns=this.warns+warnFlow.getText()+";";
+        }
+    }
+
+    public void handleWarn(){
+        judgeWarnAnalgesicPoor();
+        judgeWarnFlow();
+        judgeWarnLowBattery();
+        judgeWarnWillFinished();
+    }
+
+    public String getWarns() {
+        if (StrUtil.isNotEmpty(warns)) {
+            return warns.endsWith(";")?warns.substring(0,warns.length()-1):warns;
+        }
+        return warns;
+
+    }
+    @ApiModelProperty("看护人id")
+    private String assistId;
+    @ApiModelProperty("看护人昵称")
+    private String assistNickname;
+}

+ 17 - 3
nb-service/app-doctor/src/main/java/com/nb/app/doctor/controller/PatientMonitorController.java

@@ -18,8 +18,12 @@ import com.nb.app.assistant.api.feign.result.UpdateBindPatientParam;
 import com.nb.app.doctor.api.feign.IAppDoctorUserClient;
 import com.nb.app.doctor.api.feign.IAppUserConsultConfigClient;
 import com.nb.app.doctor.controller.vo.*;
+import com.nb.app.doctor.controller.vo.ChangeManageVo;
+import com.nb.app.doctor.controller.vo.InviteCodeVo;
+import com.nb.app.doctor.controller.vo.UpdateBindPatientVo;
+import com.nb.web.api.feign.query.DoctorPatientMonitorQuery;
+import com.nb.web.api.feign.result.DoctorPatientMonitorResult;
 import com.nb.app.doctor.service.dto.PatientMonitorConsultResult;
-import com.nb.auth.bean.LoginUser;
 import com.nb.auth.utils.SecurityUtil;
 import com.nb.common.lock.annotation.DistributeLock;
 import com.nb.common.websocket.WebSocketSessionLifeCycleManage;
@@ -47,13 +51,15 @@ import com.nb.web.service.bus.service.dto.DeviceHistoryQuery;
 import com.nb.web.service.bus.service.dto.ManualUndoConfig;
 import com.nb.web.service.bus.utils.WsPublishUtils;
 import io.swagger.annotations.*;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.dao.DuplicateKeyException;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.context.request.async.DeferredResult;
 
 import java.io.Serializable;
 import java.util.*;
@@ -110,8 +116,8 @@ public class PatientMonitorController {
 
 
     @PostMapping("/monitor/{consult}/no_page")
-    @Log(title = "医生端获取病人输注列表")
     @ApiOperation(value = "输注监控列表")
+    @Deprecated
     public R<List<PatientMonitorConsultResult>> selectPagePatient(@PathVariable("consult") @ApiParam("是否为咨询模式") boolean consult, @RequestBody PatientMonitorQuery query) {
         log.info("医生查看输注监控列表,【{}】", JSONUtil.toJsonStr(query));
         List<PatientMonitorConsultResult> results = BeanUtil.copyToList(patientClient.selectAll(query), PatientMonitorConsultResult.class);
@@ -144,6 +150,14 @@ public class PatientMonitorController {
         return R.success(results);
     }
 
+    @PostMapping("/monitor/no_page")
+    @Log(title = "输注列表(平板技改)")
+    @ApiOperation(value = "输注列表(平板技改)")
+    public R<List<DoctorPatientMonitorResult>> doctorSelectPatientList(@RequestBody DoctorPatientMonitorQuery query) {
+        query.setTenantId(SecurityUtil.getTenantId());
+        return R.success(patientClient.doctorSelectPatientList(query));
+    }
+
     @ApiOperation("修改看护位置")
     @PostMapping("/edit/manage")
     @DistributeLock(value = "#vo.clinicId", waitTime = 0)

+ 4 - 0
nb-service/web-service/src/main/java/com/nb/web/service/bus/mapper/BusPatientMapper.java

@@ -2,6 +2,8 @@ package com.nb.web.service.bus.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.nb.web.api.feign.query.DoctorPatientMonitorQuery;
+import com.nb.web.api.feign.result.DoctorPatientMonitorResult;
 import com.nb.web.service.bus.entity.BusPatientEntity;
 import com.nb.web.service.bus.entity.PatientDeviceRepeatDomain;
 import com.nb.web.api.feign.result.PatientMonitorResult;
@@ -65,4 +67,6 @@ public interface BusPatientMapper extends BaseMapper<BusPatientEntity> {
 
     @Deprecated
     long monitorTotalCount(@Param("tenantId") String tenantId);
+
+    List<DoctorPatientMonitorResult> doctorSelectPatientList(@Param("query") DoctorPatientMonitorQuery query);
 }

+ 7 - 0
nb-service/web-service/src/main/java/com/nb/web/service/bus/service/LocalBusPatientService.java

@@ -25,6 +25,7 @@ import com.nb.web.api.entity.BusInfusionHistoryEntity;
 import com.nb.web.api.enums.ClinicManageEnum;
 import com.nb.web.api.event.ClinicManageEvent;
 import com.nb.web.api.feign.IPatientClient;
+import com.nb.web.api.feign.query.DoctorPatientMonitorQuery;
 import com.nb.web.api.feign.result.*;
 import com.nb.web.api.feign.query.PatientMonitorQuery;
 import com.nb.web.service.bus.entity.*;
@@ -66,6 +67,7 @@ import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collector;
 import java.util.stream.Collectors;
 
 /**
@@ -786,4 +788,9 @@ public class LocalBusPatientService extends BaseService<BusPatientMapper, BusPat
         return false;
 
     }
+
+    @Override
+    public List<DoctorPatientMonitorResult> doctorSelectPatientList(DoctorPatientMonitorQuery query) {
+        return baseMapper.doctorSelectPatientList(query);
+    }
 }

+ 178 - 1
nb-service/web-service/src/main/resources/mapper/bus/BusPatientMapper.xml

@@ -184,7 +184,7 @@
     <select id="selectMonitor" resultMap="monitorResult" parameterType="com.nb.web.api.feign.query.PatientMonitorQuery">
         select
         p.id as patient_id,
-        p.`code` as patient_code,
+        p.code as patient_code,
         p.alarm as patient_alarm,
         i.id as infusion_id,
         i.device_id as device_id,
@@ -500,4 +500,181 @@
         select count(1) from (select * from bus_patient where tenant_id=#{tenantId}) as p JOIN (select * from bus_clinic where finished=0 and tenant_id=#{tenantId}) as c on p.clinic_id=c.id
     </select>
 
+
+    <resultMap id="doctorMonitorResult" type="com.nb.web.api.feign.result.DoctorPatientMonitorResult">
+        <result column="patient_id" property="patientId"/>
+        <result column="patient_name" property="patientName"/>
+        <result column="patient_code" property="patientCode"/>
+        <result column="patient_age" property="patientAge"/>
+        <result column="gender" property="gender"/>
+        <result column="patient_alarm" property="patientAlarm"/>
+        <result column="device_id" property="deviceId"/>
+        <result column="device_alias" property="deviceAlias"/>
+        <result column="clinic_id" property="clinicId"/>
+        <result column="patient_gender" property="gender"/>
+        <result column="ward" property="ward"/>
+        <result column="bed_no" property="bedNo"/>
+        <result column="total_dose" property="totalDose"/>
+        <result column="first_dose" property="firstDose"/>
+        <result column="electric_quantity" property="electricQuantity"/>
+        <result column="remain_dose" property="remainDose"/>
+        <result column="input_dose" property="inputDose"/>
+        <result column="append_dose" property="appendDose"/>
+        <result column="append_lock_time" property="appendLockTime"/>
+        <result column="max_dose" property="maxDose"/>
+        <result column="self_control_lock_time" property="selfControlLockTime"/>
+        <result column="pca_valid_count" property="pcaValidCount"/>
+        <result column="pca_invalid_count" property="pcaInvalidCount"/>
+        <result column="pca_total_count" property="pcaTotalCount"/>
+        <result column="continue_dose" property="continueDose"/>
+        <result column="pulse_dose" property="pulseDose"/>
+        <result column="pulse_first_lock_time" property="pulseFirstLockTime"/>
+        <result column="pulse_lock_time" property="pulseLockTime"/>
+        <result column="flow_up_cycle" property="flowUpCycle"/>
+        <result column="flow_down_cycle" property="flowDownCycle"/>
+        <result column="flow_count" property="flowCount"/>
+        <result column="flow_up_limit" property="flowUpLimit"/>
+        <result column="flow_down_limit" property="flowDownLimit"/>
+        <result column="flow_adjust_rate" property="flowAdjustRate"/>
+        <result column="run_state" property="deviceRunState"/>
+        <result column="device_alarm" property="deviceAlarm"/>
+        <result column="infusion_start_time" property="infusionStartTime"/>
+        <result column="device_type" property="deviceType"/>
+        <result column="eval_time" property="evalTime"/>
+        <result column="warn_flow" property="warnFlow"/>
+        <result column="warn_analgesic_poor" property="warnAnalgesicPoor"/>
+        <result column="warn_low_battery" property="warnLowBattery"/>
+        <result column="warn_will_finished" property="warnWillFinished"/>
+        <result column="manage_type" property="manageType"/>
+    </resultMap>
+    <select id="doctorSelectPatientList" resultMap="doctorMonitorResult">
+        SELECT
+        <!-- 患者基础信息 -->
+        c.patient_id AS patient_id,
+        c.patient_code AS patient_code,
+        c.patient_age AS patient_age,          <!-- 补充:假设 patient_age 对应实体类中的年龄字段(result 中有 patient_age) -->
+        c.patient_gender AS gender,     <!-- 注意:patient_gender 映射到实体类的 gender 属性(可能存在冗余,需确认表结构) -->
+        <!-- 临床信息 -->
+        c.patient_name AS patient_name,
+        c.ward AS ward,
+        c.bed_no AS bed_no,
+        c.ana_doctor AS anaDoctor,
+        c.surgery_name AS surgeName,
+        c.ana_type AS anaType,
+        c.eval_time AS evalTime,        <!-- 评价时间 -->
+        c.manage_type AS manageType,
+        <!-- 设备与输注信息 -->
+        i.device_id AS deviceId,
+        d.alias AS deviceAlias,   <!-- 假设来自设备表,若未关联需调整 -->
+        i.clinic_id AS clinicId,
+        i.total_dose AS totalDose,
+        i.first_dose AS firstDose,
+        i.remain_dose AS remainDose,
+        i.input_dose AS inputDose,
+        i.append_dose AS appendDose,
+        i.append_lock_time AS appendLockTime,
+        i.max_dose AS maxDose,
+        i.self_control_lock_time AS selfControlLockTime,
+        i.pca_valid_count AS pcaValidCount,
+        i.pca_invalid_count AS pcaInvalidCount,
+        i.pca_total_count AS pcaTotalCount,
+        i.continue_dose AS continueDose,
+        i.pulse_dose AS pulseDose,
+        i.pulse_first_lock_time AS pulseFirstLockTime,
+        i.pulse_lock_time AS pulseLockTime,
+        i.flow_up_cycle AS flowUpCycle,
+        i.flow_down_cycle AS flowDownCycle,
+        i.flow_count AS flowCount,
+        i.flow_up_limit AS flowUpLimit,
+        i.flow_down_limit AS flowDownLimit,
+        i.flow_adjust_rate AS flowAdjustRate,
+        i.run_state AS deviceRunState,
+        i.alarm AS deviceAlarm,
+        i.start_time AS infusionStartTime,
+        i.type AS deviceType,
+        i.warn_flow AS warnFlow,
+        i.warn_analgesic_poor AS warnAnalgesicPoor,
+        i.warn_low_battery AS warnLowBattery,
+        i.warn_will_finished AS warnWillFinished
+        FROM
+        bus_patient p
+        JOIN bus_clinic c ON p.clinic_id = c.id          <!-- 患者与临床信息关联 -->
+        JOIN bus_infusion_history i ON p.infusion_id = i.id  <!-- 患者与输注记录关联 -->
+        <!-- 设备表左连接(若 device_alias 来自设备表) -->
+        LEFT JOIN bus_device d ON i.device_id = d.id
+        <where>
+            i.is_undo='0' and c.finished=0
+            <!-- 租户过滤(必选) -->
+            <if test="query.tenantId != null">
+                AND p.tenant_id = #{query.tenantId}
+            </if>
+            <!-- 患者基础条件 -->
+            <if test="query.patientCode != null">
+                AND p.code LIKE CONCAT('%', #{query.patientCode}, '%')
+            </if>
+            <if test="query.patientName != null">
+                AND c.patient_name LIKE CONCAT('%', #{query.patientName}, '%')
+            </if>
+            <if test="query.abnormal != null">
+                AND p.patient_abnormal = #{query.abnormal}  <!-- 假设患者异常字段为 patient_abnormal -->
+            </if>
+            <!-- 临床与病区条件 -->
+            <if test="query.wards != null and query.wards.size > 0">
+                AND c.ward IN
+                <foreach item="ward" collection="query.wards" open="(" separator="," close=")">
+                    #{ward}
+                </foreach>
+            </if>
+            <if test="query.bedNo != null">
+                AND c.bed_no = #{query.bedNo}
+            </if>
+            <if test="query.anaDoctor != null">
+                AND c.ana_doctor LIKE CONCAT('%', #{query.anaDoctor}, '%')
+            </if>
+            <if test="query.surgeName != null">
+                AND c.surgery_name LIKE CONCAT('%', #{query.surgeName}, '%')
+            </if>
+            <if test="query.anaType != null">
+                AND c.ana_type = #{query.anaType}
+            </if>
+            <!-- 设备与输注条件 -->
+            <if test="query.types != null and types.size > 0">
+                AND i.device_type IN
+                <foreach item="type" collection="types" open="(" separator="," close=")">
+                    #{type}
+                </foreach>
+            </if>
+            <if test="query.deviceStatus != null and query.deviceStatus.size > 0">
+                AND i.run_state IN
+                <foreach item="status" collection="query.deviceStatus" open="(" separator="," close=")">
+                    #{status}
+                </foreach>
+            </if>
+            <if test="query.alarm != null">
+                AND i.device_alarm = #{query.alarm}  <!-- 是否有报警 -->
+            </if>
+            <if test="query.warn != null">
+                <!-- 简化提醒条件,可根据实际字段扩展 -->
+                AND (i.warn_flow = 1 OR i.warn_low_battery = 1)
+            </if>
+            <if test="query.timeRange != null and query.timeRange.size == 1">
+                AND c.monitor_start_time &gt;= #{query.timeRange[0]}
+            </if>
+            <!-- 时间区间查询 -->
+            <if test="query.timeRange != null and query.timeRange.size > 1">
+                AND c.monitor_start_time &lt;= #{query.timeRange[1]}
+            </if>
+            <!-- 管理类型 -->
+            <if test="query.manageType != null">
+                AND c.manage_type = #{query.manageType}
+            </if>
+        </where>
+        <!-- 排序逻辑 -->
+        <if test="query.orderType == 0">
+            order by i.infusion_start_time DESC  <!-- 默认按输注开始时间倒序 -->
+        </if>
+        <if test="query.orderType == 1">
+            order by c.ward ASC, c.bed_no ASC  <!-- 按病区和床号升序 -->
+        </if>
+    </select>
 </mapper>