|
|
@@ -145,4 +145,79 @@
|
|
|
</foreach>
|
|
|
</if>
|
|
|
</select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="latestQueryPage" resultMap="queryResult" parameterType="com.coffee.bus.service.dto.ClinicQuery">
|
|
|
+ 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.`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,
|
|
|
+ i.infusion_count as infusion_count,
|
|
|
+ eval.eval_count as eval_count
|
|
|
+ from
|
|
|
+ (select * from bus_patient
|
|
|
+ <if test="query.patientCode!=null">
|
|
|
+ and patient_code like concat('%',#{query.patientCode},'%')
|
|
|
+ </if>
|
|
|
+ )as p
|
|
|
+ left join
|
|
|
+ (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 on p.clinic_id=c.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
|
|
|
+ <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>
|
|
|
+ <if test="query.orderByAsc!=null and query.orderByAsc.size > 0">
|
|
|
+ <if test="query.orderByDesc!=null and query.orderByDesc.size > 0">
|
|
|
+ ,
|
|
|
+ </if>
|
|
|
+ <foreach item="ascItem" index="index" collection="query.orderByAsc" open="" separator="," close="">
|
|
|
+ ${ascItem} asc
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|