| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380 |
- <?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.nb.web.service.bus.mapper.BusClinicMapper">
- <resultMap id="stats" type="com.nb.web.service.bus.service.dto.ClinicStatsQueryResult">
- <result column="continue_dose" property="continueDose"/>
- <result column="append_dose" property="appendDose"/>
- <result column="input_dose" property="inputDose"/>
- <result column="valid_count" property="validCount"/>
- <result column="single_append_dose" property="singleAppendDose"/>
- <result column="invalid_count" property="inValidCount"/>
- <result column="upload_time" property="uploadTime"/>
- <result column="infusion_id" property="infusionId"/>
- <result column="electric_quantity" property="electricQuantity"/>
- <result column="block1" property="block1"/>
- <result column="block2" property="block2"/>
- </resultMap>
- <resultMap id="queryResult" type="com.nb.web.service.bus.service.dto.ClinicResult">
- <result column="clinic_id" property="clinicId"/>
- <result column="patient_id" property="patientId"/>
- <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"/>
- <result column="liquid_executor" property="liquidExecutor"/>
- <result column="liquid_checker" property="liquidChecker"/>
- <result column="liquid_remark" property="liquidRemark"/>
- <result column="liquid_time" property="liquidTime"/>
- <result column="liquid_method" property="liquidMethod"/>
- </resultMap>
- <select id="stats" resultMap="stats">
- SELECT
- <if test="query.continueDose!=false">
- h.continue_dose as continue_dose,
- </if>
- <if test="query.electricQuantity!=false">
- h.electric_quantity as electric_quantity,
- </if>
- <if test="query.appendDose!=false">
- h.total_append_dose as append_dose,
- </if>
- <if test="query.inputDose!=false">
- h.input_dose as input_dose,
- </if>
- <if test="query.singleAppendDose!=false">
- h.append_dose as single_append_dose,
- h.pca_valid_count as valid_count,
- </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>
- <if test="query.snr!=false">
- h.snr as snr,
- </if>
- <if test="query.rssi!=false">
- h.rssi as rssi,
- </if>
- <if test="query.rsrq!=false">
- h.rsrq as rsrq,
- </if>
- <if test="query.rsrp!=false">
- h.rsrp as rsrp,
- </if>
- h.block1 as block1,
- h.block2 as block2,
- h.upload_time,
- h.infusion_id
- FROM
- (select id from bus_infusion_history
- <where>
- -- 不统计开机数据
- run_state!=1
- <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
- JOIN (select * from bus_device_history
- <where>
- <if test="query.infusionModifyIds != null and query.infusionModifyIds.size > 0">
- and infusion_modify_id in
- <foreach item="infusionModifyId" index="index" collection="query.infusionModifyIds" open="(" separator="," close=")">
- #{infusionModifyId, jdbcType=VARCHAR}
- </foreach>
- </if>
- </where>
- ) as h on h.infusion_id=i.id
- order by h.upload_time asc
- </select>
- <select id="pageQuery" resultMap="queryResult" parameterType="com.nb.web.service.bus.service.dto.ClinicQuery">
- select p.id as patient_id,
- c.id as clinic_id,
- c.patient_code as patient_code,
- c.patient_name as patient_name,
- c.ward as ward,
- CASE
- WHEN c.manual_bedno IS NOT NULL AND c.manual_bedno != '' THEN c.manual_bedno
- ELSE c.bed_no
- END 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,
- c.liquid_method as liquid_method,
- c.liquid_executor as liquid_executor,
- c.liquid_checker as liquid_checker,
- c.liquid_remark as liquid_remark,
- c.liquid_time as liquid_time
- from bus_clinic as c
- <where>
- p.infusion_id is not null
- <if test="query.liquid!=null and query.liquid == true">
- and c.finished= 1
- </if>
- <if test="query.monitorType!=null and query.monitorType!=''">
- and c.monitor_type=#{query.monitorType}
- </if>
- <if test="query.finished!=null">
- and c.finished=#{query.finished}
- </if>
- <if test="query.surgeryName!=null and query.surgeryName!=''">
- and c.surgery_name like concat('%',#{query.surgeryName},'%')
- </if>
- <if test="query.patientName!=null and query.patientName!=''">
- 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 query.bedNo!=''">
- and 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 and 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)">
- 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>
- <select id="latestQueryPage" resultMap="queryResult" parameterType="com.nb.web.service.bus.service.dto.ClinicQuery">
- select
- c.id as clinic_id,
- p.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.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
- <where>
- <if test="query.patientCode!=null">
- and code like concat('%',#{query.patientCode},'%')
- </if>
- </where>
- )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>
- <resultMap id="stdLiquidResult" type="com.nb.web.service.bus.controller.vo.BusLiquidListVO">
- <result property="clinicId" column="clinic_id"/>
- <result property="clinicName" column="clinic_name"/>
- <result property="patientId" column="patient_id"/>
- <result property="patientCode" column="patient_code"/>
- <result property="patientName" column="patient_name"/>
- <result property="ward" column="ward"/>
- <result property="bedNo" column="bed_no"/>
- <result property="deviceId" column="device_id"/>
- <result property="clinicStartTime" column="clinic_start_time"/>
- <result property="undoTime" column="undo_time"/>
- <result property="formula" column="formula" typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
- <result property="totalDose" column="total_dose"/>
- <result property="remainDose" column="remain_dose"/>
- <result property="liquidExecutor" column="liquid_executor"/>
- <result property="liquidChecker" column="liquid_checker"/>
- <result property="liquidRemark" column="liquid_remark"/>
- <result property="liquidTime" column="liquid_time"/>
- <result property="liquidMethod" column="liquid_method"/>
- </resultMap>
- <select id="selectLiquidPage" resultMap="stdLiquidResult">
- select
- c.id as clinic_id,
- c.patient_id as patient_id,
- c.patient_code as patient_code,
- c.patient_name as patient_name,
- c.ward as ward,
- CASE
- WHEN c.manual_bedno IS NOT NULL AND c.manual_bedno != '' THEN c.manual_bedno
- ELSE c.bed_no
- END as bed_no,
- c.surgery_name as clinic_name,
- i.device_id as device_id,
- c.monitor_start_time as clinic_start_time,
- i.undo_time as undo_time,
- c.formula as formula,
- i.total_dose as total_dose,
- i.remain_dose as remain_dose,
- c.liquid_executor as liquid_executor,
- c.liquid_checker as liquid_checker,
- c.liquid_remark as liquid_remark,
- c.liquid_time as liquid_time,
- c.liquid_method as liquid_method
- from bus_clinic as c
- join bus_patient as p on c.patient_id = p.id
- join bus_infusion_history as i on p.infusion_id = i.id
- <where>
- c.finished = 1
- <if test="query.undoTime != null and query.undoTime.size ==1">
- and undo_time > #{query.undoTime[0]}
- </if>
- <if test="query.undoTime != null and query.undoTime.size > 1">
- and undo_time > #{query.undoTime[0]} and c.undo_time < #{query.undoTime[1]}
- </if>
- <if test="query.patientCode!=null and query.patientCode!=''">
- and c.patient_code like concat('%',#{query.patientCode},'%')
- </if>
- <if test="query.bedNo!=null and query.bedNo!=''">
- and bed_no like concat('%',#{query.bedNo},'%')
- </if>
- <if test="query.wards != null and query.wards.size > 0">
- and c.ward in
- <foreach item="w" index="index" collection="query.wards" open="(" separator="," close=")">
- #{w, jdbcType=VARCHAR}
- </foreach>
- </if>
- <if test="query.patientName!=null and query.patientName!=''">
- and patient_name like concat('%',#{query.patientName},'%')
- </if>
- <if test="query.surgeryName!=null and query.surgeryName!=''">
- and c.surgery_name like concat('%',#{query.surgeryName},'%')
- </if>
- <if test="query.liquidType!=null and query.liquidType == false">
- and liquid_checker is null
- </if>
- <if test="query.liquidType!=null and query.liquidType == true">
- and liquid_checker is not null
- </if>
- </where>
- order by clinic_start_time desc
- </select>
- <select id="selectLiquidByIds" resultMap="stdLiquidResult">
- select
- c.id as clinic_id,
- c.patient_id as patient_id,
- c.patient_code as patient_code,
- c.patient_name as patient_name,
- c.ward as ward,
- CASE
- WHEN c.manual_bedno IS NOT NULL AND c.manual_bedno != '' THEN c.manual_bedno
- ELSE c.bed_no
- END as bed_no,
- c.surgery_name as clinic_name,
- i.device_id as device_id,
- c.monitor_start_time as clinic_start_time,
- i.undo_time as undo_time,
- c.formula as formula,
- i.total_dose as total_dose,
- i.remain_dose as remain_dose,
- c.liquid_executor as liquid_executor,
- c.liquid_checker as liquid_checker,
- c.liquid_remark as liquid_remark,
- c.liquid_method as liquid_method,
- c.liquid_time as liquid_time
- from bus_clinic as c
- left join bus_patient as p on c.patient_id = p.id
- left join bus_infusion_history as i on p.infusion_id = i.id
- <where>
- and c.id in
- <foreach item="w" index="index" collection="ids" open="(" separator="," close=")">
- #{w, jdbcType=VARCHAR}
- </foreach>
- </where>
- </select>
- </mapper>
|