|
|
@@ -1,104 +1,104 @@
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
- <mapper namespace="com.coffee.bus.mapper.BusPatientMapper">
|
|
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+<mapper namespace="com.coffee.bus.mapper.BusPatientMapper">
|
|
|
|
|
|
- <resultMap id="repeatDeviceResult" type="com.coffee.bus.entity.PatientDeviceRepeatDomain">
|
|
|
- <result column="name" property="name"/>
|
|
|
- <result column="gender" property="gender"/>
|
|
|
- <result column="code" property="code"/>
|
|
|
- <result column="age" property="age"/>
|
|
|
- <result column="ward" property="ward"/>
|
|
|
- <result column="bed_no" property="bedNo"/>
|
|
|
- <result column="clinic_name" property="clinicName"/>
|
|
|
- <result column="device_id" property="deviceId"/>
|
|
|
- <result column="device_alias" property="deviceAlias"/>
|
|
|
- <result column="device_run_state" property="deviceRunState"/>
|
|
|
- <result column="clinic_id" property="clinicId"/>
|
|
|
- <result column="device_alarm" property="deviceAlarm" />
|
|
|
- <result column="infusion_start_time" property="infusionStartTime"/>
|
|
|
- <result column="infusion_id" property="infusionId"/>
|
|
|
- <result column="master_infusion_id" property="masterInfusionId"/>
|
|
|
- </resultMap>
|
|
|
+ <resultMap id="repeatDeviceResult" type="com.coffee.bus.entity.PatientDeviceRepeatDomain">
|
|
|
+ <result column="name" property="name"/>
|
|
|
+ <result column="gender" property="gender"/>
|
|
|
+ <result column="code" property="code"/>
|
|
|
+ <result column="age" property="age"/>
|
|
|
+ <result column="ward" property="ward"/>
|
|
|
+ <result column="bed_no" property="bedNo"/>
|
|
|
+ <result column="clinic_name" property="clinicName"/>
|
|
|
+ <result column="device_id" property="deviceId"/>
|
|
|
+ <result column="device_alias" property="deviceAlias"/>
|
|
|
+ <result column="device_run_state" property="deviceRunState"/>
|
|
|
+ <result column="clinic_id" property="clinicId"/>
|
|
|
+ <result column="device_alarm" property="deviceAlarm" />
|
|
|
+ <result column="infusion_start_time" property="infusionStartTime"/>
|
|
|
+ <result column="infusion_id" property="infusionId"/>
|
|
|
+ <result column="master_infusion_id" property="masterInfusionId"/>
|
|
|
+ </resultMap>
|
|
|
|
|
|
- <resultMap id="monitorResult" type="com.coffee.bus.service.dto.PatientMonitorResult">
|
|
|
- <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="infusion_id" property="infusionId"/>
|
|
|
- <result column="patient_alarm" property="patientAlarm"/>
|
|
|
- <result column="classification" property="classification"/>
|
|
|
- <result column="data_num" property="dataNum"/>
|
|
|
- <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="infusion_finished" property="infusionFinished"/>
|
|
|
- <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="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_count" property="selfControlCount"/>
|
|
|
- <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="electric_quantity" property="electricQuantity"/>
|
|
|
- <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="device_alarm" property="deviceAlarm"/>
|
|
|
- <result column="infusion_start_time" property="infusionStartTime"/>
|
|
|
- <result column="remark" property="remark"/>
|
|
|
- <result column="device_type" property="deviceType"/>
|
|
|
- <result column="anal_type" property="analType"/>
|
|
|
- <result column="ana_doctor" property="anaDoctor"/>
|
|
|
- <result column="ana_type" property="anaType"/>
|
|
|
- <result column="surgery_doctor" property="surgeryDoctor"/>
|
|
|
- <result column="surgery_name" property="surgeryName"/>
|
|
|
- <result column="finished" property="clinicFinished"/>
|
|
|
- <result column="monitor_end_time" property="monitorEndTime"/>
|
|
|
- <result column="monitor_start_time" property="monitorStartTime"/>
|
|
|
- </resultMap>
|
|
|
+ <resultMap id="monitorResult" type="com.coffee.bus.service.dto.PatientMonitorResult">
|
|
|
+ <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="infusion_id" property="infusionId"/>
|
|
|
+ <result column="patient_alarm" property="patientAlarm"/>
|
|
|
+ <result column="classification" property="classification"/>
|
|
|
+ <result column="data_num" property="dataNum"/>
|
|
|
+ <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="infusion_finished" property="infusionFinished"/>
|
|
|
+ <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="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_count" property="selfControlCount"/>
|
|
|
+ <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="electric_quantity" property="electricQuantity"/>
|
|
|
+ <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="device_alarm" property="deviceAlarm"/>
|
|
|
+ <result column="infusion_start_time" property="infusionStartTime"/>
|
|
|
+ <result column="remark" property="remark"/>
|
|
|
+ <result column="device_type" property="deviceType"/>
|
|
|
+ <result column="anal_type" property="analType"/>
|
|
|
+ <result column="ana_doctor" property="anaDoctor"/>
|
|
|
+ <result column="ana_type" property="anaType"/>
|
|
|
+ <result column="surgery_doctor" property="surgeryDoctor"/>
|
|
|
+ <result column="surgery_name" property="surgeryName"/>
|
|
|
+ <result column="finished" property="clinicFinished"/>
|
|
|
+ <result column="monitor_end_time" property="monitorEndTime"/>
|
|
|
+ <result column="monitor_start_time" property="monitorStartTime"/>
|
|
|
+ </resultMap>
|
|
|
|
|
|
- <resultMap id="deviceNone" type="com.coffee.bus.service.dto.PatientDeviceNoneResult">
|
|
|
- <result column="clinic_id" property="clinicId"/>
|
|
|
- <result column="name" property="name"/>
|
|
|
- <result column="gender" property="gender"/>
|
|
|
- <result column="code" property="code"/>
|
|
|
- <result column="age" property="age"/>
|
|
|
- <result column="ward" property="ward"/>
|
|
|
- <result column="bed_no" property="bedNo"/>
|
|
|
- <result column="surgery_name" property="surgeryName"/>
|
|
|
- <result column="weight" property="weight"/>
|
|
|
- <result column="height" property="height"/>
|
|
|
- <result column="ana_doctor" property="anaDoctor"/>
|
|
|
- <result column="ana_type" property="anaType"/>
|
|
|
- <result column="anal_type" property="analType"/>
|
|
|
- <result column="surgery_doctor" property="surgeryDoctor"/>
|
|
|
- <result column="asa" property="asa"/>
|
|
|
- <result column="formula" property="formula" typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
|
|
|
- <result column="finished" property="finished"/>
|
|
|
- <result column="config_person" property="configPerson"/>
|
|
|
- </resultMap>
|
|
|
- <select id="selectRepeatDevice" resultMap="repeatDeviceResult">
|
|
|
+ <resultMap id="deviceNone" type="com.coffee.bus.service.dto.PatientDeviceNoneResult">
|
|
|
+ <result column="clinic_id" property="clinicId"/>
|
|
|
+ <result column="name" property="name"/>
|
|
|
+ <result column="gender" property="gender"/>
|
|
|
+ <result column="code" property="code"/>
|
|
|
+ <result column="age" property="age"/>
|
|
|
+ <result column="ward" property="ward"/>
|
|
|
+ <result column="bed_no" property="bedNo"/>
|
|
|
+ <result column="surgery_name" property="surgeryName"/>
|
|
|
+ <result column="weight" property="weight"/>
|
|
|
+ <result column="height" property="height"/>
|
|
|
+ <result column="ana_doctor" property="anaDoctor"/>
|
|
|
+ <result column="ana_type" property="anaType"/>
|
|
|
+ <result column="anal_type" property="analType"/>
|
|
|
+ <result column="surgery_doctor" property="surgeryDoctor"/>
|
|
|
+ <result column="asa" property="asa"/>
|
|
|
+ <result column="formula" property="formula" typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
|
|
|
+ <result column="finished" property="finished"/>
|
|
|
+ <result column="config_person" property="configPerson"/>
|
|
|
+ </resultMap>
|
|
|
+ <select id="selectRepeatDevice" resultMap="repeatDeviceResult">
|
|
|
SELECT
|
|
|
p.code as code,
|
|
|
p.infusion_id as master_infusion_id,
|
|
|
@@ -121,7 +121,7 @@
|
|
|
join (SELECT * FROM bus_clinic WHERE finished=0 ) AS c ON c.`patient_code`=p.code;
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectNoneDevice" resultMap="deviceNone">
|
|
|
+ <select id="selectNoneDevice" resultMap="deviceNone">
|
|
|
SELECT
|
|
|
p.code as code,
|
|
|
c.id as clinic_id,
|
|
|
@@ -147,267 +147,276 @@
|
|
|
order by c.monitor_start_time desc;
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectMonitor" resultMap="monitorResult" parameterType="com.coffee.bus.service.dto.PatientMonitorQuery">
|
|
|
- select
|
|
|
- p.`code` as patient_code,
|
|
|
- p.alarm as patient_alarm,
|
|
|
- i.id as infusion_id,
|
|
|
- i.device_id as device_id,
|
|
|
- i.clinic_id as clinic_id,
|
|
|
- i.classification as classification,
|
|
|
- i.data_number as data_number,
|
|
|
- i.total_dose as total_dose,
|
|
|
- i.first_dose as first_dose,
|
|
|
- i.remain_dose as remain_dose,
|
|
|
- i.input_dose as input_dose,
|
|
|
- i.append_dose as append_dose,
|
|
|
- i.append_lock_time as append_lock_time,
|
|
|
- i.max_dose as max_dose,
|
|
|
- i.finished as infusion_finished,
|
|
|
- i.electric_quantity as electric_quantity,
|
|
|
- i.warn_flow as warn_flow,
|
|
|
- i.self_control_count as self_control_count,
|
|
|
- i.self_control_lock_time as self_control_lock_time,
|
|
|
- i.pca_valid_count as pca_valid_count,
|
|
|
- i.pca_invalid_count as pca_invalid_count,
|
|
|
- i.pca_total_count as pca_total_count,
|
|
|
- i.continue_dose as continue_dose,
|
|
|
- i.pulse_dose as pulse_dose,
|
|
|
- i.pulse_lock_time as pulse_lock_time,
|
|
|
- i.pulse_first_lock_time as pulse_first_lock_time,
|
|
|
- i.flow_up_cycle as flow_up_cycle,
|
|
|
- i.flow_down_cycle as flow_down_cycle,
|
|
|
- i.flow_count as flow_count,
|
|
|
- i.flow_up_limit as flow_up_limit,
|
|
|
- i.flow_down_limit as flow_down_limit,
|
|
|
- i.flow_adjust_rate as flow_adjust_rate,
|
|
|
- i.run_state as run_state,
|
|
|
- i.warn_will_finished as warn_will_finished,
|
|
|
- i.warn_analgesic_poor as warn_analgesic_poor,
|
|
|
- i.warn_low_battery as warn_low_battery,
|
|
|
- i.alarm as device_alarm,
|
|
|
- i.start_time as infusion_start_time,
|
|
|
- i.remark as remark,
|
|
|
- i.type as device_type,
|
|
|
- d.alias as device_alias,
|
|
|
- c.patient_gender as patient_gender,
|
|
|
- c.`patient_name` as patient_name,
|
|
|
- c.finished as finished,
|
|
|
- c.monitor_start_time as monitor_start_time,
|
|
|
- c.end_time as monitor_end_time,
|
|
|
- c.ana_doctor as ana_doctor,
|
|
|
- c.patient_age as patient_age,
|
|
|
- c.ana_type as ana_type,
|
|
|
- c.anal_type as anal_type,
|
|
|
- c.surgery_doctor as surgery_doctor,
|
|
|
- c.surgery_name as surgery_name,
|
|
|
- c.ward as ward,
|
|
|
- c.bed_no as bed_no
|
|
|
- from
|
|
|
- (select * from bus_patient
|
|
|
- <where>
|
|
|
- <if test="query.tenantId!=null">
|
|
|
- and tenant_id=#{query.tenantId}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- )
|
|
|
- as p
|
|
|
- join
|
|
|
- (select * from bus_infusion_history
|
|
|
- <where>
|
|
|
- is_undo='0'
|
|
|
- <if test="query.wards != null and query.wards.size > 0">
|
|
|
- and ward in
|
|
|
- <foreach item="ward" index="index" collection="query.wards" open="(" separator="," close=")">
|
|
|
- #{ward, jdbcType=VARCHAR}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="query.types != null and query.types.size > 0">
|
|
|
- and type in
|
|
|
- <foreach item="type" index="index" collection="query.types" open="(" separator="," close=")">
|
|
|
- #{type, jdbcType=VARCHAR}
|
|
|
+ <select id="selectMonitor" resultMap="monitorResult" parameterType="com.coffee.bus.service.dto.PatientMonitorQuery">
|
|
|
+ select
|
|
|
+ p.`code` as patient_code,
|
|
|
+ p.alarm as patient_alarm,
|
|
|
+ i.id as infusion_id,
|
|
|
+ i.device_id as device_id,
|
|
|
+ i.clinic_id as clinic_id,
|
|
|
+ i.classification as classification,
|
|
|
+ i.data_number as data_number,
|
|
|
+ i.total_dose as total_dose,
|
|
|
+ i.first_dose as first_dose,
|
|
|
+ i.remain_dose as remain_dose,
|
|
|
+ i.input_dose as input_dose,
|
|
|
+ i.append_dose as append_dose,
|
|
|
+ i.append_lock_time as append_lock_time,
|
|
|
+ i.max_dose as max_dose,
|
|
|
+ i.finished as infusion_finished,
|
|
|
+ i.electric_quantity as electric_quantity,
|
|
|
+ i.warn_flow as warn_flow,
|
|
|
+ i.self_control_count as self_control_count,
|
|
|
+ i.self_control_lock_time as self_control_lock_time,
|
|
|
+ i.pca_valid_count as pca_valid_count,
|
|
|
+ i.pca_invalid_count as pca_invalid_count,
|
|
|
+ i.pca_total_count as pca_total_count,
|
|
|
+ i.continue_dose as continue_dose,
|
|
|
+ i.pulse_dose as pulse_dose,
|
|
|
+ i.pulse_lock_time as pulse_lock_time,
|
|
|
+ i.pulse_first_lock_time as pulse_first_lock_time,
|
|
|
+ i.flow_up_cycle as flow_up_cycle,
|
|
|
+ i.flow_down_cycle as flow_down_cycle,
|
|
|
+ i.flow_count as flow_count,
|
|
|
+ i.flow_up_limit as flow_up_limit,
|
|
|
+ i.flow_down_limit as flow_down_limit,
|
|
|
+ i.flow_adjust_rate as flow_adjust_rate,
|
|
|
+ i.run_state as run_state,
|
|
|
+ i.warn_will_finished as warn_will_finished,
|
|
|
+ i.warn_analgesic_poor as warn_analgesic_poor,
|
|
|
+ i.warn_low_battery as warn_low_battery,
|
|
|
+ i.alarm as device_alarm,
|
|
|
+ i.start_time as infusion_start_time,
|
|
|
+ i.remark as remark,
|
|
|
+ i.type as device_type,
|
|
|
+ d.alias as device_alias,
|
|
|
+ c.patient_gender as patient_gender,
|
|
|
+ c.`patient_name` as patient_name,
|
|
|
+ c.finished as finished,
|
|
|
+ c.monitor_start_time as monitor_start_time,
|
|
|
+ c.end_time as monitor_end_time,
|
|
|
+ c.ana_doctor as ana_doctor,
|
|
|
+ c.patient_age as patient_age,
|
|
|
+ c.ana_type as ana_type,
|
|
|
+ c.anal_type as anal_type,
|
|
|
+ c.surgery_doctor as surgery_doctor,
|
|
|
+ c.surgery_name as surgery_name,
|
|
|
+ c.ward as ward,
|
|
|
+ c.bed_no as bed_no
|
|
|
+ from
|
|
|
+ (select * from bus_patient
|
|
|
+ <where>
|
|
|
+ <if test="query.tenantId!=null">
|
|
|
+ and tenant_id=#{query.tenantId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ )
|
|
|
+ as p
|
|
|
+ join
|
|
|
+ (select * from bus_infusion_history
|
|
|
+ <where>
|
|
|
+ is_undo='0'
|
|
|
+ <if test="query.wards != null and query.wards.size > 0">
|
|
|
+ and ward in
|
|
|
+ <foreach item="ward" index="index" collection="query.wards" open="(" separator="," close=")">
|
|
|
+ #{ward, jdbcType=VARCHAR}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="query.types != null and query.types.size > 0">
|
|
|
+ and type in
|
|
|
+ <foreach item="type" index="index" collection="query.types" open="(" separator="," close=")">
|
|
|
+ #{type, jdbcType=VARCHAR}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <choose>
|
|
|
+ <when test="query.deviceStatus != null and query.deviceStatus.size > 0">
|
|
|
+ and (
|
|
|
+ run_state in
|
|
|
+ <foreach item="status" index="index" collection="query.deviceStatus" open="(" separator=","
|
|
|
+ close=")">
|
|
|
+ #{status, jdbcType=VARCHAR}
|
|
|
</foreach>
|
|
|
- </if>
|
|
|
- <choose>
|
|
|
- <when test="query.deviceStatus != null and query.deviceStatus.size > 0">
|
|
|
- and (
|
|
|
- run_state in
|
|
|
- <foreach item="status" index="index" collection="query.deviceStatus" open="(" separator=","
|
|
|
+ <if test="query.deviceAlarms != null and query.deviceAlarms.size > 0">
|
|
|
+ or alarm in
|
|
|
+ <foreach item="alarm" index="index" collection="query.deviceAlarms" open="(" separator=","
|
|
|
close=")">
|
|
|
- #{status, jdbcType=VARCHAR}
|
|
|
+ #{alarm, jdbcType=VARCHAR}
|
|
|
</foreach>
|
|
|
- <if test="query.deviceAlarms != null and query.deviceAlarms.size > 0">
|
|
|
- or alarm in
|
|
|
- <foreach item="alarm" index="index" collection="query.deviceAlarms" open="(" separator=","
|
|
|
- close=")">
|
|
|
- #{alarm, jdbcType=VARCHAR}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="query.infusionFinished == true">
|
|
|
- or finished=#{query.infusionFinished}
|
|
|
- </if>
|
|
|
- )
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- <if test="query.deviceAlarms != null and query.deviceAlarms.size > 0">
|
|
|
- and alarm in
|
|
|
- <foreach item="alarm" index="index" collection="query.deviceAlarms" open="(" separator="," close=")">
|
|
|
- #{alarm, jdbcType=VARCHAR}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
- <choose>
|
|
|
- <when test="query.warnWillFinished != false or query.warnAnalgesicPoor != false or query.warnLowBattery != false">
|
|
|
- and (
|
|
|
- <choose>
|
|
|
- <when test="query.warnWillFinished != false">warn_will_finished=1</when>
|
|
|
- <otherwise>warn_will_finished!=1</otherwise>
|
|
|
- </choose>
|
|
|
- <if test="query.warnAnalgesicPoor != false">or warn_analgesic_poor=1 </if>
|
|
|
- <if test="query.warnLowBattery != false"> or warn_low_battery=1 </if>
|
|
|
- <if test="query.warnFlow !=null">
|
|
|
- or warn_flow= #{query.warnFlow}
|
|
|
- </if>
|
|
|
- )
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- <if test="query.warnFlow !=null">
|
|
|
- and warn_flow= #{query.warnFlow}
|
|
|
- </if>
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
- </where>
|
|
|
- ) as i on p.infusion_id=i.id
|
|
|
- left join (select device_id,alias from bus_device) as d on d.device_id=i.device_id
|
|
|
- join (select * from bus_clinic
|
|
|
- <where>
|
|
|
- finished=0
|
|
|
- <if test="query.timeRange != null and query.timeRange.size >0">
|
|
|
- and monitor_start_time > #{query.timeRange[0]} and monitor_start_time < #{query.timeRange[1]}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- ) c on p.clinic_id=c.id
|
|
|
- <if test="query.bedNo!=null || query.name!=null || query.code!=null || query.anaDoctor!=null || query.surgeName!=null ||query.gender!=null ||query.anaType!=null">
|
|
|
- <where>
|
|
|
- (1=0
|
|
|
- <if test="query.bedNo!=null">
|
|
|
- or i.bed_no LIKE concat('%', #{query.bedNo}, '%')
|
|
|
</if>
|
|
|
- <if test="query.name!=null">
|
|
|
- or c.`name` LIKE concat('%', #{query.name}, '%')
|
|
|
+ <if test="query.infusionFinished == true">
|
|
|
+ or finished=#{query.infusionFinished}
|
|
|
</if>
|
|
|
- <if test="query.code!=null">
|
|
|
- or p.`code` LIKE concat('%', #{query.code}, '%')
|
|
|
- </if>
|
|
|
- <if test="query.anaDoctor!=null">
|
|
|
- or c.`ana_doctor` like concat('%', #{query.anaDoctor}, '%')
|
|
|
+ )
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <if test="query.deviceAlarms != null and query.deviceAlarms.size > 0">
|
|
|
+ and alarm in
|
|
|
+ <foreach item="alarm" index="index" collection="query.deviceAlarms" open="(" separator="," close=")">
|
|
|
+ #{alarm, jdbcType=VARCHAR}
|
|
|
+ </foreach>
|
|
|
</if>
|
|
|
- <if test="query.surgeName!=null">
|
|
|
- or c.`surgery_name` like concat('%',#{query.surgeName}, '%')
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <choose>
|
|
|
+ <when test="query.warnWillFinished != false or query.warnAnalgesicPoor != false or query.warnLowBattery != false">
|
|
|
+ and (
|
|
|
+ <choose>
|
|
|
+ <when test="query.warnWillFinished != false">warn_will_finished=1</when>
|
|
|
+ <otherwise>warn_will_finished!=1</otherwise>
|
|
|
+ </choose>
|
|
|
+ <if test="query.warnAnalgesicPoor != false">or warn_analgesic_poor=1 </if>
|
|
|
+ <if test="query.warnLowBattery != false"> or warn_low_battery=1 </if>
|
|
|
+ <if test="query.warnFlow !=null">
|
|
|
+ or warn_flow= #{query.warnFlow}
|
|
|
</if>
|
|
|
- <if test="query.gender!=null">
|
|
|
- or c.gender LIKE concat('%', #{query.gender}, '%')
|
|
|
+ )
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <if test="query.warnFlow !=null">
|
|
|
+ and warn_flow= #{query.warnFlow}
|
|
|
</if>
|
|
|
- <if test="query.anaType!=null">
|
|
|
- or c.ana_type LIKE concat('%', #{query.anaType}, '%')
|
|
|
- </if>)
|
|
|
- </where>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </where>
|
|
|
+ ) as i on p.infusion_id=i.id
|
|
|
+ left join (select device_id,alias from bus_device) as d on d.device_id=i.device_id
|
|
|
+ join (select * from bus_clinic
|
|
|
+ <where>
|
|
|
+ finished=0
|
|
|
+ <if test="query.timeRange != null and query.timeRange.size >0">
|
|
|
+ and monitor_start_time > #{query.timeRange[0]} and monitor_start_time < #{query.timeRange[1]}
|
|
|
</if>
|
|
|
- order by c.monitor_start_time desc
|
|
|
- </select>
|
|
|
-
|
|
|
-
|
|
|
- <select id="findByPatientCode" resultMap="monitorResult">
|
|
|
- select
|
|
|
- p.alarm as patient_alarm,
|
|
|
- p.`code` as patient_code,
|
|
|
- i.device_id as device_id,
|
|
|
- i.clinic_id as clinic_id,
|
|
|
- i.classification as classification,
|
|
|
- i.total_dose as total_dose,
|
|
|
- i.first_dose as first_dose,
|
|
|
- i.remain_dose as remain_dose,
|
|
|
- i.input_dose as input_dose,
|
|
|
- i.append_dose as append_dose,
|
|
|
- i.append_lock_time as append_lock_time,
|
|
|
- i.max_dose as max_dose,
|
|
|
- i.electric_quantity as electric_quantity,
|
|
|
- i.warn_flow as warn_flow,
|
|
|
- i.self_control_count as self_control_count,
|
|
|
- i.self_control_lock_time as self_control_lock_time,
|
|
|
- i.pca_valid_count as pca_valid_count,
|
|
|
- i.pca_invalid_count as pca_invalid_count,
|
|
|
- i.pca_total_count as pca_total_count,
|
|
|
- i.continue_dose as continue_dose,
|
|
|
- i.pulse_dose as pulse_dose,
|
|
|
- i.pulse_lock_time as pulse_lock_time,
|
|
|
- i.pulse_first_lock_time as pulse_first_lock_time,
|
|
|
- i.flow_up_cycle as flow_up_cycle,
|
|
|
- i.flow_down_cycle as flow_down_cycle,
|
|
|
- i.flow_count as flow_count,
|
|
|
- i.flow_up_limit as flow_up_limit,
|
|
|
- i.flow_down_limit as flow_down_limit,
|
|
|
- i.flow_adjust_rate as flow_adjust_rate,
|
|
|
- i.run_state as run_state,
|
|
|
- i.warn_will_finished as warn_will_finished,
|
|
|
- i.warn_analgesic_poor as warn_analgesic_poor,
|
|
|
- i.warn_low_battery as warn_low_battery,
|
|
|
- i.alarm as device_alarm,
|
|
|
- i.start_time as infusion_start_time,
|
|
|
- i.remark as remark,
|
|
|
- i.type as device_type,
|
|
|
- d.alias as device_alias,
|
|
|
- c.ward as ward,
|
|
|
- c.bed_no as bed_no,
|
|
|
- c.finished as finished,
|
|
|
- c.`patient_name` as patient_name,
|
|
|
- c.patient_gender as gender,
|
|
|
- c.monitor_start_time as monitor_start_time,
|
|
|
- c.end_time as monitor_end_time,
|
|
|
- c.ana_doctor as ana_doctor,
|
|
|
- c.patient_age as patient_age,
|
|
|
- c.ana_type as ana_type,
|
|
|
- c.anal_type as anal_type,
|
|
|
- c.surgery_doctor as surgery_doctor,
|
|
|
- c.surgery_name as surgery_name
|
|
|
- from
|
|
|
- (select * from bus_patient
|
|
|
+ <if test="query.tenantId!=null">
|
|
|
+ and tenant_id=#{query.tenantId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) c on p.clinic_id=c.id
|
|
|
+ <if test="query.bedNo!=null || query.name!=null || query.code!=null || query.anaDoctor!=null || query.surgeName!=null ||query.gender!=null ||query.anaType!=null">
|
|
|
<where>
|
|
|
- <if test="tenantId!=null">
|
|
|
- and tenant_id=#{tenantId}
|
|
|
+ (1=0
|
|
|
+ <if test="query.bedNo!=null">
|
|
|
+ or i.bed_no LIKE concat('%', #{query.bedNo}, '%')
|
|
|
</if>
|
|
|
- <if test="patientCode!=null">
|
|
|
- and code=#{patientCode}
|
|
|
+ <if test="query.name!=null">
|
|
|
+ or c.`patient_name` LIKE concat('%', #{query.name}, '%')
|
|
|
</if>
|
|
|
- </where>
|
|
|
- )
|
|
|
- as p
|
|
|
- join
|
|
|
- bus_infusion_history as i on p.infusion_id=i.id
|
|
|
- join (select device_id,alias from bus_device) as d on d.device_id=i.device_id
|
|
|
- left join bus_clinic c on p.clinic_id=c.id
|
|
|
- limit 1
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="selectAlarmCount" resultType="long">
|
|
|
- select count(1) from bus_patient as p
|
|
|
- join (select * from bus_clinic
|
|
|
- <where>
|
|
|
- finished=0
|
|
|
- <if test="tenantId!=null">
|
|
|
- and tenant_id=#{tenantId}
|
|
|
+ <if test="query.code!=null">
|
|
|
+ or p.`code` LIKE concat('%', #{query.code}, '%')
|
|
|
</if>
|
|
|
- </where>
|
|
|
- ) as c on p.code=c.patient_code
|
|
|
- <where>
|
|
|
- <if test="alarmValue!=null">
|
|
|
- and p.alarm=#{alarmValue}
|
|
|
+ <if test="query.anaDoctor!=null">
|
|
|
+ or c.`ana_doctor` like concat('%', #{query.anaDoctor}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="query.surgeName!=null">
|
|
|
+ or c.`surgery_name` like concat('%',#{query.surgeName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="query.gender!=null">
|
|
|
+ or c.gender LIKE concat('%', #{query.gender}, '%')
|
|
|
</if>
|
|
|
+ <if test="query.anaType!=null">
|
|
|
+ or c.ana_type LIKE concat('%', #{query.anaType}, '%')
|
|
|
+ </if>)
|
|
|
</where>
|
|
|
- </select>
|
|
|
+ </if>
|
|
|
+ order by c.monitor_start_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="findByPatientCode" resultMap="monitorResult">
|
|
|
+ select
|
|
|
+ p.alarm as patient_alarm,
|
|
|
+ p.`code` as patient_code,
|
|
|
+ i.device_id as device_id,
|
|
|
+ i.clinic_id as clinic_id,
|
|
|
+ i.classification as classification,
|
|
|
+ i.total_dose as total_dose,
|
|
|
+ i.first_dose as first_dose,
|
|
|
+ i.remain_dose as remain_dose,
|
|
|
+ i.input_dose as input_dose,
|
|
|
+ i.append_dose as append_dose,
|
|
|
+ i.append_lock_time as append_lock_time,
|
|
|
+ i.max_dose as max_dose,
|
|
|
+ i.electric_quantity as electric_quantity,
|
|
|
+ i.warn_flow as warn_flow,
|
|
|
+ i.self_control_count as self_control_count,
|
|
|
+ i.self_control_lock_time as self_control_lock_time,
|
|
|
+ i.pca_valid_count as pca_valid_count,
|
|
|
+ i.pca_invalid_count as pca_invalid_count,
|
|
|
+ i.pca_total_count as pca_total_count,
|
|
|
+ i.continue_dose as continue_dose,
|
|
|
+ i.pulse_dose as pulse_dose,
|
|
|
+ i.pulse_lock_time as pulse_lock_time,
|
|
|
+ i.pulse_first_lock_time as pulse_first_lock_time,
|
|
|
+ i.flow_up_cycle as flow_up_cycle,
|
|
|
+ i.flow_down_cycle as flow_down_cycle,
|
|
|
+ i.flow_count as flow_count,
|
|
|
+ i.flow_up_limit as flow_up_limit,
|
|
|
+ i.flow_down_limit as flow_down_limit,
|
|
|
+ i.flow_adjust_rate as flow_adjust_rate,
|
|
|
+ i.run_state as run_state,
|
|
|
+ i.warn_will_finished as warn_will_finished,
|
|
|
+ i.warn_analgesic_poor as warn_analgesic_poor,
|
|
|
+ i.warn_low_battery as warn_low_battery,
|
|
|
+ i.alarm as device_alarm,
|
|
|
+ i.start_time as infusion_start_time,
|
|
|
+ i.remark as remark,
|
|
|
+ i.type as device_type,
|
|
|
+ d.alias as device_alias,
|
|
|
+ c.ward as ward,
|
|
|
+ c.bed_no as bed_no,
|
|
|
+ c.finished as finished,
|
|
|
+ c.`patient_name` as patient_name,
|
|
|
+ c.patient_gender as gender,
|
|
|
+ c.monitor_start_time as monitor_start_time,
|
|
|
+ c.end_time as monitor_end_time,
|
|
|
+ c.ana_doctor as ana_doctor,
|
|
|
+ c.patient_age as patient_age,
|
|
|
+ c.ana_type as ana_type,
|
|
|
+ c.anal_type as anal_type,
|
|
|
+ c.surgery_doctor as surgery_doctor,
|
|
|
+ c.surgery_name as surgery_name
|
|
|
+ from
|
|
|
+ (select * from bus_patient
|
|
|
+ <where>
|
|
|
+ <if test="tenantId!=null">
|
|
|
+ and tenant_id=#{tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="patientCode!=null">
|
|
|
+ and code=#{patientCode}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ )
|
|
|
+ as p
|
|
|
+ join
|
|
|
+ bus_infusion_history as i on p.infusion_id=i.id
|
|
|
+ join (select device_id,alias from bus_device) as d on d.device_id=i.device_id
|
|
|
+ left join bus_clinic c on p.clinic_id=c.id
|
|
|
+ limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectAlarmCount" resultType="long">
|
|
|
+ select count(1) from (select * from bus_patient
|
|
|
+ <where>
|
|
|
+ <if test="tenantId!=null">
|
|
|
+ and tenant_id=#{tenantId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) as p
|
|
|
+ join (select * from bus_clinic
|
|
|
+ <where>
|
|
|
+ finished=0
|
|
|
+ <if test="tenantId!=null">
|
|
|
+ and tenant_id=#{tenantId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) as c on p.code=c.patient_code
|
|
|
+ <where>
|
|
|
+ <if test="alarmValue!=null">
|
|
|
+ and p.alarm=#{alarmValue}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
|
|
|
<select id="monitorTotalCount" resultType="long">
|
|
|
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>
|
|
|
- </mapper>
|
|
|
+</mapper>
|