|
|
@@ -4,6 +4,8 @@
|
|
|
|
|
|
<resultMap id="combineResult" type="com.nb.bus.service.dto.CombineResult">
|
|
|
<result column="infusion_id" property="id"/>
|
|
|
+ <result column="clinic_start_time" property="clinicStartTime"/>
|
|
|
+ <result column="clinic_end_time" property="clinicEndTime"/>
|
|
|
<result column="patient_id" property="patientId"/>
|
|
|
<result column="device_id" property="deviceId"/>
|
|
|
<result column="classification" property="classification"/>
|
|
|
@@ -71,6 +73,7 @@
|
|
|
|
|
|
<resultMap id="combineAlarmResult" type="com.nb.bus.service.dto.CombineAlarmResult">
|
|
|
<result column="device_type" property="type"/>
|
|
|
+ <result column="alarm_time" property="alarmTime"/>
|
|
|
<result column="infusion_id" property="id"/>
|
|
|
<result column="infusion_start_time" property="infusionStartTime"/>
|
|
|
<result column="cause" property="cause"/>
|
|
|
@@ -86,6 +89,7 @@
|
|
|
<resultMap id="combineEvalResult" type="com.nb.bus.service.dto.CombineEvalResult">
|
|
|
<result column="evaluate_time" property="evalTime"/>
|
|
|
<result column="infusion_id" property="id"/>
|
|
|
+ <result column="last_upload_time" property="lastUploadTime"/>
|
|
|
<result column="eval_id" property="evalId"/>
|
|
|
<result column="infusion_start_time" property="infusionStartTime"/>
|
|
|
<result column="statics" property="statics"/>
|
|
|
@@ -112,6 +116,25 @@
|
|
|
<result column="blood_oxygen_saturation" property="bloodOxygenSaturation"/>
|
|
|
</resultMap>
|
|
|
|
|
|
+ <resultMap id="queryStatsHistory" type="com.nb.bus.service.dto.CombineHistoryResult">
|
|
|
+ <result column="infusion_id" property="id"/>
|
|
|
+ <result column="patient_id" property="patientId"/>
|
|
|
+ <result column="device_id" property="deviceId"/>
|
|
|
+ <result column="clinic_id" property="clinicId"/>
|
|
|
+ <result column="history_id" property="historyId"/>
|
|
|
+ <result column="device_type" property="type"/>
|
|
|
+ <result column="total_append_dose" property="totalAppendDose"/>
|
|
|
+ <result column="input_dose" property="inputDose"/>
|
|
|
+ <result column="continue_dose" property="continueDose"/>
|
|
|
+ <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="upload_time" property="uploadTime"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
<select id="currentInClinic" resultType="com.nb.bus.entity.BusInfusionHistoryEntity">
|
|
|
select d.alias,i.* from
|
|
|
(select * from bus_infusion_history where clinic_id=#{clinicId} ORDER BY start_time desc limit 1) as i
|
|
|
@@ -197,12 +220,18 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
) as p on p.id = c.patient_id
|
|
|
+ <if test="query.warns != null or query.deviceAlarm != null">
|
|
|
+ JOIN (
|
|
|
+ <include refid="commonDeviceAlarmQuery"/>
|
|
|
+ ) as a
|
|
|
+ on a.infusion_id = i.id
|
|
|
+ </if>
|
|
|
<if test="(query.orderByDesc!=null and query.orderByDesc.size > 0) or (query.orderByAsc!=null and query.orderByAsc.size > 0)">
|
|
|
order by
|
|
|
</if>
|
|
|
<if test="query.orderByDesc!=null and query.orderByDesc.size > 0">
|
|
|
<foreach item="descItem" index="index" collection="query.orderByDesc" open="" separator="," close="">
|
|
|
--- !!!!这里使用$不要使用#,否自只是对列名(字符串)进行排序,而不是进行列排序
|
|
|
+ -- !!!!这里使用$不要使用#,否自只是对列名(字符串)进行排序,而不是进行列排序
|
|
|
${descItem} desc
|
|
|
</foreach>
|
|
|
</if>
|
|
|
@@ -225,6 +254,7 @@
|
|
|
i.start_time as infusion_start_time,
|
|
|
a.cause as cause,
|
|
|
i.patient_code as patient_code,
|
|
|
+ a.upload_time as alarm_time,
|
|
|
a.alarm as alarm,
|
|
|
a.run_state as run_state,
|
|
|
a.alarm_state as alarm_state,
|
|
|
@@ -239,10 +269,13 @@
|
|
|
<include refid="commonClinicQuery"/>
|
|
|
) as c
|
|
|
on i.clinic_id=c.id
|
|
|
- JOIN bus_device_alarm a on a.infusion_id = i.id
|
|
|
+ JOIN(
|
|
|
+ <include refid="commonDeviceAlarmQuery"/>
|
|
|
+ ) as a
|
|
|
+ on a.infusion_id = i.id
|
|
|
</select>
|
|
|
|
|
|
- <select id="queryStatsAnal" resultMap="combineResult">
|
|
|
+ <select id="queryStatsCommon" resultMap="combineResult">
|
|
|
select
|
|
|
i.id as infusion_id,
|
|
|
i.device_id as device_id,
|
|
|
@@ -255,6 +288,8 @@
|
|
|
i.append_dose as append_dose,
|
|
|
i.self_control_lock_time as self_control_lock_time,
|
|
|
i.patient_code as patient_code,
|
|
|
+ c.monitor_start_time as clinic_start_time,
|
|
|
+ c.end_time as clinic_end_time,
|
|
|
c.id as clinic_id,
|
|
|
c.asa as asa,
|
|
|
c.patient_gender as patient_gender,
|
|
|
@@ -269,12 +304,19 @@
|
|
|
<include refid="commonClinicQuery"/>
|
|
|
) as c
|
|
|
on i.clinic_id=c.id
|
|
|
+ <if test="query.warns != null or query.deviceAlarm != null">
|
|
|
+ JOIN (
|
|
|
+ <include refid="commonDeviceAlarmQuery"/>
|
|
|
+ ) as a
|
|
|
+ on a.infusion_id = i.id
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<select id="queryStatsEval" resultMap="combineEvalResult">
|
|
|
select
|
|
|
i.id as infusion_id,
|
|
|
+ i.last_upload_time as last_upload_time,
|
|
|
i.start_time as infusion_start_time,
|
|
|
e.evaluate_time as evaluate_time,
|
|
|
e.statics as statics,
|
|
|
@@ -309,8 +351,53 @@
|
|
|
on i.clinic_id=c.id
|
|
|
left join (select * from bus_evaluation) as e
|
|
|
on e.infusion_id=i.id
|
|
|
+ <if test="query.warns != null or query.deviceAlarm != null">
|
|
|
+ JOIN (
|
|
|
+ <include refid="commonDeviceAlarmQuery"/>
|
|
|
+ ) as a
|
|
|
+ on a.infusion_id = i.id
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryStatsHistory" resultMap="queryStatsHistory">
|
|
|
+ select
|
|
|
+ i.id as infusion_id,
|
|
|
+ i.device_id as device_id,
|
|
|
+ i.clinic_id as clinic_id,
|
|
|
+ p.id as patient_id,
|
|
|
+ h.id as history_id,
|
|
|
+ h.total_append_dose as total_append_dose,
|
|
|
+ h.input_dose as input_dose,
|
|
|
+ h.continue_dose as continue_dose,
|
|
|
+ h.self_control_lock_time as self_control_lock_time,
|
|
|
+ h.pca_valid_count as pca_valid_count,
|
|
|
+ h.pca_invalid_count as pca_invalid_count,
|
|
|
+ h.pca_total_count as pca_total_count,
|
|
|
+ h.upload_time as upload_time
|
|
|
+ from (
|
|
|
+ <include refid="commonInfusionQuery"/>
|
|
|
+ ) as i
|
|
|
+ <if test="query.warns != null or query.deviceAlarm != null">
|
|
|
+ JOIN (
|
|
|
+ <include refid="commonDeviceAlarmQuery"/>
|
|
|
+ ) as a
|
|
|
+ on a.infusion_id = i.id
|
|
|
+ </if>
|
|
|
+ JOIN (
|
|
|
+ <include refid="commonClinicQuery"/>
|
|
|
+ ) as c
|
|
|
+ on i.clinic_id=c.id
|
|
|
+ join (select * from bus_patient
|
|
|
+ <where>
|
|
|
+ <if test="query.patientCode != null">
|
|
|
+ and code like concat('%',#{query.patientCode},'%')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) as p on p.id = c.patient_id
|
|
|
+ join bus_device_history as h on h.infusion_id=i.id
|
|
|
</select>
|
|
|
|
|
|
+
|
|
|
<sql id="commonInfusionQuery">
|
|
|
select * from bus_infusion_history
|
|
|
<where>
|
|
|
@@ -335,11 +422,8 @@
|
|
|
<if test="query.finished != null">
|
|
|
and finished =#{query.finished}
|
|
|
</if>
|
|
|
- <if test="query.deviceRunState != null">
|
|
|
- and run_state = #{query.deviceRunState}
|
|
|
- </if>
|
|
|
- <if test="query.deviceAlarm != null">
|
|
|
- and alarm = #{query.deviceAlarm}
|
|
|
+ <if test="query.isUndo != null">
|
|
|
+ and is_undo =#{query.isUndo}
|
|
|
</if>
|
|
|
<if test="query.validPcaCountRange != null and query.validPcaCountRange.size > 0">
|
|
|
and pca_valid_count >= #{query.validPcaCountRange[0]}
|
|
|
@@ -353,26 +437,20 @@
|
|
|
and pca_invalid_count <= #{query.inValidPcaCountRange[1]}
|
|
|
</if>
|
|
|
</if>
|
|
|
- <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>0=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>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <sql id="commonDeviceAlarmQuery">
|
|
|
+ select * from bus_device_alarm
|
|
|
+ <where>
|
|
|
+ <if test="query.warnAnalgesicPoor == true">and warn_analgesic_poor=1 </if>
|
|
|
+ <if test="query.warnLowBattery == true"> and warn_low_battery=1 </if>
|
|
|
+ <if test="query.warnFlow !=null">
|
|
|
+ and warn_flow= #{query.warnFlow}
|
|
|
+ </if>
|
|
|
+ <if test="query.deviceAlarm != null">
|
|
|
+ and alarm = #{query.deviceAlarm}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</sql>
|
|
|
|
|
|
@@ -448,6 +526,19 @@
|
|
|
<if test="query.surgeryName != null">
|
|
|
and surgery_name like concat('%',#{query.surgeryName},'%')
|
|
|
</if>
|
|
|
+
|
|
|
+ <if test="query.clinicStartTimeRange != null and query.clinicStartTimeRange.size > 0">
|
|
|
+ and monitor_start_time >= #{query.clinicStartTimeRange[0]}
|
|
|
+ <if test="query.startTimeRange.size >1 ">
|
|
|
+ and monitor_start_time <= #{query.clinicStartTimeRange[1]}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="query.clinicEndTimeRange != null and query.clinicEndTimeRange.size > 0">
|
|
|
+ and finished =1 and end_time >= #{query.clinicEndTimeRange[0]}
|
|
|
+ <if test="query.clinicEndTimeRange.size >1 ">
|
|
|
+ and end_time <= #{query.clinicEndTimeRange[1]}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</sql>
|
|
|
</mapper>
|