|
|
@@ -11,39 +11,81 @@
|
|
|
<result column="upload_time" property="uploadTime"/>
|
|
|
</resultMap>
|
|
|
|
|
|
+ <resultMap id="queryResult" type="com.coffee.bus.service.dto.ClinicResult">
|
|
|
+ <result column="clinic_id" property="clinicId"/>
|
|
|
+ <result column="patient_code" property="patientCode"/>
|
|
|
+ <result column="patient_name" property="patientName"/>
|
|
|
+ <result column="ward" property="ward"/>
|
|
|
+ <result column="bed_no" property="bedNo"/>
|
|
|
+ <result column="surgery_name" property="surgeryName"/>
|
|
|
+ <result column="surgery_doctor" property="surgeryDoctor"/>
|
|
|
+ <result column="ana_doctor" property="anaDoctor"/>
|
|
|
+ <result column="monitor_type" property="monitorType"/>
|
|
|
+ <result column="finished" property="finished"/>
|
|
|
+ <result column="clinic_start_time" property="clinicStartTime"/>
|
|
|
+ <result column="monitor_start_time" property="monitorStartTime"/>
|
|
|
+ <result column="monitor_end_time" property="monitorEndTime"/>
|
|
|
+ <result column="monitor_alarm" property="monitorAlarm"/>
|
|
|
+ <result column="infusion_count" property="infusionCount"/>
|
|
|
+ <result column="eval_count" property="evalCount"/>
|
|
|
+
|
|
|
+ </resultMap>
|
|
|
<select id="stats" resultMap="stats">
|
|
|
- SELECT
|
|
|
- <if test="query.continueDose!=false">
|
|
|
- h.continue_dose as continue_dose,
|
|
|
- </if>
|
|
|
- <if test="query.appendDose!=false">
|
|
|
- h.append_dose as append_dose,
|
|
|
+ SELECT
|
|
|
+ <if test="query.continueDose!=false">
|
|
|
+ h.continue_dose as continue_dose,
|
|
|
+ </if>
|
|
|
+ <if test="query.appendDose!=false">
|
|
|
+ h.append_dose as append_dose,
|
|
|
+ </if>
|
|
|
+ <if test="query.inputDose!=false">
|
|
|
+ h.input_dose as input_dose,
|
|
|
+ </if>
|
|
|
+ <if test="query.validCount!=false">
|
|
|
+ h.pca_valid_count as valid_count,
|
|
|
+ </if>
|
|
|
+ <if test="query.inValidCount!=false">
|
|
|
+ h.pca_invalid_count as invalid_count,
|
|
|
+ </if>
|
|
|
+ h.upload_time
|
|
|
+ FROM
|
|
|
+ (select id from bus_infusion_history
|
|
|
+ <where>
|
|
|
+ <if test="query.clinicId!=null">
|
|
|
+ and clinic_id = #{query.clinicId}
|
|
|
</if>
|
|
|
- <if test="query.inputDose!=false">
|
|
|
- h.input_dose as input_dose,
|
|
|
+ <if test="query.infusionId!=null">
|
|
|
+ and id = #{query.infusionId}
|
|
|
</if>
|
|
|
- <if test="query.validCount!=false">
|
|
|
- h.pca_valid_count as valid_count,
|
|
|
+ <if test="query.deviceId!=null">
|
|
|
+ and device_id = #{query.deviceId}
|
|
|
</if>
|
|
|
- <if test="query.inValidCount!=false">
|
|
|
- h.pca_invalid_count as invalid_count,
|
|
|
- </if>
|
|
|
- h.upload_time
|
|
|
- FROM
|
|
|
- (select id from bus_infusion_history
|
|
|
- <where>
|
|
|
- <if test="query.clinicId!=null">
|
|
|
- and clinic_id = #{query.clinicId}
|
|
|
- </if>
|
|
|
- <if test="query.infusionId!=null">
|
|
|
- and id = #{query.infusionId}
|
|
|
- </if>
|
|
|
- <if test="query.deviceId!=null">
|
|
|
- and device_id = #{query.deviceId}
|
|
|
- </if>
|
|
|
- </where>)
|
|
|
- as i
|
|
|
- left JOIN (select * from bus_device_history) as h on h.infusion_id=i.id
|
|
|
- order by h.upload_time asc
|
|
|
+ </where>)
|
|
|
+ as i
|
|
|
+ left JOIN (select * from bus_device_history) as h on h.infusion_id=i.id
|
|
|
+ order by h.upload_time asc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="pageQuery" resultMap="queryResult">
|
|
|
+ select
|
|
|
+ c.id as clinic_id,
|
|
|
+ c.patient_code as patient_code,
|
|
|
+ c.patient_name as patient_name,
|
|
|
+ c.ward as ward,
|
|
|
+ c.bed_no as bed_no,
|
|
|
+ c.`name` as surgery_name,
|
|
|
+ c.surgery_doctor as surgery_doctor,
|
|
|
+ c.ana_doctor as ana_doctor,
|
|
|
+ c.monitor_type as monitor_type,
|
|
|
+ c.finished as finished,
|
|
|
+ c.start_time as clinic_start_time,
|
|
|
+ c.monitor_start_time as monitor_start_time,
|
|
|
+ c.end_time as monitor_end_time,
|
|
|
+ i.infusion_count as infusion_count,
|
|
|
+ eval.eval_count as eval_count
|
|
|
+ from bus_clinic as c
|
|
|
+ left join bus_patient as p on c.id=p.clinic_id
|
|
|
+ left join (select clinic_id,count(1) as infusion_count from bus_infusion_history GROUP BY clinic_id) as i on i.clinic_id=c.id
|
|
|
+ left join (select clinic_id,count(1) as eval_count from bus_evaluation GROUP BY clinic_id) as eval on eval.clinic_id=c.id
|
|
|
</select>
|
|
|
</mapper>
|