|
|
@@ -102,61 +102,50 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="pageQuery" resultMap="queryResult" parameterType="com.nb.web.service.bus.service.dto.ClinicQuery">
|
|
|
- select
|
|
|
- tmp.*,
|
|
|
- i.infusion_count as infusion_count,
|
|
|
- eval.eval_count as eval_count
|
|
|
- from (select p.id as patient_id,
|
|
|
- c.id as clinic_id,
|
|
|
- if(c.monitor_type=1,p.code,c.patient_code) as patient_code,
|
|
|
- c.patient_name as patient_name,
|
|
|
- c.ward as ward,
|
|
|
- c.bed_no as bed_no,
|
|
|
- c.`surgery_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
|
|
|
- from
|
|
|
- (select * from bus_clinic
|
|
|
- <where>
|
|
|
- <if test="query.monitorType!=null">
|
|
|
- and monitor_type=#{query.monitorType}
|
|
|
- </if>
|
|
|
- <if test="query.finished!=null">
|
|
|
- and finished=#{query.finished}
|
|
|
- </if>
|
|
|
- <if test="query.surgeryName!=null">
|
|
|
- and surgery_name like concat('%',#{query.surgeryName},'%')
|
|
|
- </if>
|
|
|
- <if test="query.patientName!=null">
|
|
|
- and patient_name like concat('%',#{query.patientName},'%')
|
|
|
- </if>
|
|
|
- <if test="query.ward != null and query.ward.size > 0">
|
|
|
- and ward in
|
|
|
- <foreach item="w" index="index" collection="query.ward" open="(" separator="," close=")">
|
|
|
- #{w, jdbcType=VARCHAR}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="query.bedNo!=null">
|
|
|
- and bed_no like concat('%',#{query.bedNo},'%')
|
|
|
- </if>
|
|
|
- <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>
|
|
|
- ) as c
|
|
|
- left join (select * from bus_patient)
|
|
|
- as p on c.patient_id = p.id
|
|
|
- ) as tmp
|
|
|
- left join (select clinic_id,count(1) as infusion_count from bus_infusion_history GROUP BY clinic_id) as i on i.clinic_id=tmp.clinic_id
|
|
|
- left join (select clinic_id,count(1) as eval_count from bus_evaluation GROUP BY clinic_id) as eval on eval.clinic_id=tmp.clinic_id
|
|
|
+ select p.id as patient_id,
|
|
|
+ c.id as clinic_id,
|
|
|
+ if(c.monitor_type=1,p.code,c.patient_code) as patient_code,
|
|
|
+ c.patient_name as patient_name,
|
|
|
+ c.ward as ward,
|
|
|
+ c.bed_no as bed_no,
|
|
|
+ c.`surgery_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
|
|
|
+ from bus_clinic as c
|
|
|
+ left join bus_patient
|
|
|
+ as p on c.patient_id = p.id
|
|
|
<where>
|
|
|
+ <if test="query.monitorType!=null">
|
|
|
+ and c.monitor_type=#{query.monitorType}
|
|
|
+ </if>
|
|
|
+ <if test="query.finished!=null">
|
|
|
+ and c.finished=#{query.finished}
|
|
|
+ </if>
|
|
|
+ <if test="query.surgeryName!=null">
|
|
|
+ and c.surgery_name like concat('%',#{query.surgeryName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="query.patientName!=null">
|
|
|
+ and c.patient_name like concat('%',#{query.patientName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="query.ward != null and query.ward.size > 0">
|
|
|
+ and c.ward in
|
|
|
+ <foreach item="w" index="index" collection="query.ward" open="(" separator="," close=")">
|
|
|
+ #{w, jdbcType=VARCHAR}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="query.bedNo!=null">
|
|
|
+ and c.bed_no like concat('%',#{query.bedNo},'%')
|
|
|
+ </if>
|
|
|
+ <if test="query.timeRange != null and query.timeRange.size >0">
|
|
|
+ and c.monitor_start_time > #{query.timeRange[0]} and c.monitor_start_time < #{query.timeRange[1]}
|
|
|
+ </if>
|
|
|
<if test="query.patientCode!=null">
|
|
|
- patient_code like concat('%',#{query.patientCode},'%')
|
|
|
+ and c.patient_code like concat('%',#{query.patientCode},'%')
|
|
|
</if>
|
|
|
</where>
|
|
|
<if test="(query.orderByDesc!=null and query.orderByDesc.size > 0 ) or (query.orderByAsc!=null and query.orderByAsc.size > 0)">
|