From 9526971c403417c1c007804f24884c443b9e6cd7 Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期三, 04 九月 2024 00:34:40 +0800 Subject: [PATCH] 代码提交 --- smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml | 303 +++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 239 insertions(+), 64 deletions(-) diff --git a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml index 811c5e4..373f395 100644 --- a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml +++ b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml @@ -1,73 +1,138 @@ <?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"> + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.smartor.mapper.PatMedInhospMapper"> - - <resultMap type="PatMedInhosp" id="PatMedInhospResult"> - <result property="inhospid" column="inhospid" /> - <result property="serialnum" column="serialnum" /> - <result property="hospitalname" column="hospitalname" /> - <result property="hospitalcode" column="hospitalcode" /> - <result property="hospitaldistrictcode" column="hospitaldistrictcode" /> - <result property="hospitaldistrictname" column="hospitaldistrictname" /> - <result property="icd10code" column="icd10code" /> - <result property="diagname" column="diagname" /> - <result property="starttime" column="starttime" /> - <result property="endtime" column="endtime" /> - <result property="deptcode" column="deptcode" /> - <result property="deptname" column="deptname" /> - <result property="roomno" column="roomno" /> - <result property="bedno" column="bedno" /> - <result property="orgid" column="orgid" /> - <result property="delFlag" column="del_flag" /> - <result property="updateBy" column="update_by" /> - <result property="updateTime" column="update_time" /> - <result property="createBy" column="create_by" /> - <result property="createTime" column="create_time" /> - <result property="isupload" column="isupload" /> - <result property="uploadTime" column="upload_time" /> - <result property="patid" column="patid" /> - <result property="leavediagname" column="leavediagname" /> - <result property="leaveicd10code" column="leaveicd10code" /> - <result property="drcode" column="drcode" /> - <result property="drname" column="drname" /> - <result property="schemestatus" column="schemestatus" /> - <result property="generalschemestatus" column="generalschemestatus" /> - <result property="leaveldeptcode" column="leaveldeptcode" /> - <result property="leaveldeptname" column="leaveldeptname" /> - <result property="hospitaldistrictid" column="hospitaldistrictid" /> - <result property="leavehospitaldistrictcode" column="leavehospitaldistrictcode" /> - <result property="leavehospitaldistrictname" column="leavehospitaldistrictname" /> - <result property="leavehospitaldistrictid" column="leavehospitaldistrictid" /> - <result property="deptid" column="deptid" /> - <result property="leaveldeptid" column="leaveldeptid" /> - <result property="schemetime" column="schemetime" /> + + <resultMap type="com.smartor.domain.PatMedInhosp" id="PatMedInhospResult"> + <result property="inhospid" column="inhospid"/> + <result property="inhospno" column="inhospno"/> + <result property="serialnum" column="serialnum"/> + <result property="hospitalname" column="hospitalname"/> + <result property="hospitalcode" column="hospitalcode"/> + <result property="hospitaldistrictcode" column="hospitaldistrictcode"/> + <result property="hospitaldistrictname" column="hospitaldistrictname"/> + <result property="icd10code" column="icd10code"/> + <result property="diagname" column="diagname"/> + <result property="starttime" column="starttime"/> + <result property="endtime" column="endtime"/> + <result property="deptcode" column="deptcode"/> + <result property="deptname" column="deptname"/> + <result property="roomno" column="roomno"/> + <result property="bedNo" column="bed_no"/> + <result property="orgid" column="orgid"/> + <result property="delFlag" column="del_flag"/> + <result property="updateBy" column="update_by"/> + <result property="updateTime" column="update_time"/> + <result property="createBy" column="create_by"/> + <result property="createTime" column="create_time"/> + <result property="isupload" column="isupload"/> + <result property="uploadTime" column="upload_time"/> + <result property="patid" column="patid"/> + <result property="leavediagname" column="leavediagname"/> + <result property="leaveicd10code" column="leaveicd10code"/> + <result property="drcode" column="drcode"/> + <result property="drname" column="drname"/> + <result property="schemestatus" column="schemestatus"/> + <result property="generalschemestatus" column="generalschemestatus"/> + <result property="leaveldeptcode" column="leaveldeptcode"/> + <result property="leaveldeptname" column="leaveldeptname"/> + <result property="hospitaldistrictid" column="hospitaldistrictid"/> + <result property="leavehospitaldistrictcode" column="leavehospitaldistrictcode"/> + <result property="leavehospitaldistrictname" column="leavehospitaldistrictname"/> + <result property="leavehospitaldistrictid" column="leavehospitaldistrictid"/> + <result property="deptid" column="deptid"/> + <result property="leaveldeptid" column="leaveldeptid"/> + <result property="schemetime" column="schemetime"/> + <result property="patname" column="patname"/> + <result property="patno" column="patno"/> + <result property="inhospstate" column="inhospstate"/> + <result property="checkFlag" column="check_flag"/> </resultMap> <sql id="selectPatMedInhospVo"> - select inhospid, serialnum, hospitalname, hospitalcode, hospitaldistrictcode, hospitaldistrictname, icd10code, diagname, starttime, endtime, deptcode, deptname, roomno, bedno, orgid, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, patid, leavediagname, leaveicd10code, drcode, drname, schemestatus, generalschemestatus, leaveldeptcode, leaveldeptname, hospitaldistrictid, leavehospitaldistrictcode, leavehospitaldistrictname, leavehospitaldistrictid, deptid, leaveldeptid, schemetime from pat_med_inhosp + select inhospid, + patname, + check_flag, + inhospstate, + patno, + inhospno, + serialnum, + hospitalname, + hospitalcode, + hospitaldistrictcode, + hospitaldistrictname, + icd10code, + diagname, + starttime, + endtime, + deptcode, + deptname, + roomno, + bed_no, + orgid, + del_flag, + update_by, + update_time, + create_by, + create_time, + isupload, + upload_time, + patid, + leavediagname, + leaveicd10code, + drcode, + drname, + schemestatus, + generalschemestatus, + leaveldeptcode, + leaveldeptname, + hospitaldistrictid, + leavehospitaldistrictcode, + leavehospitaldistrictname, + leavehospitaldistrictid, + deptid, + leaveldeptid, + schemetime + from pat_med_inhosp </sql> - <select id="selectPatMedInhospList" parameterType="PatMedInhosp" resultMap="PatMedInhospResult"> + <select id="selectPatMedInhospList" parameterType="com.smartor.domain.PatMedInhosp" resultMap="PatMedInhospResult"> <include refid="selectPatMedInhospVo"/> - <where> - <if test="hospitalname != null and hospitalname != ''"> and hospitalname like concat('%', #{hospitalname}, '%')</if> - <if test="hospitaldistrictname != null and hospitaldistrictname != ''"> and hospitaldistrictname like concat('%', #{hospitaldistrictname}, '%')</if> - <if test="endtime != null "> and endtime = #{endtime}</if> - <if test="leavediagname != null and leavediagname != ''"> and leavediagname like concat('%', #{leavediagname}, '%')</if> - <if test="drname != null and drname != ''"> and drname like concat('%', #{drname}, '%')</if> - <if test="leaveldeptname != null and leaveldeptname != ''"> and leaveldeptname like concat('%', #{leaveldeptname}, '%')</if> - <if test="leavehospitaldistrictname != null and leavehospitaldistrictname != ''"> and leavehospitaldistrictname like concat('%', #{leavehospitaldistrictname}, '%')</if> + <where> + <if test="hospitalname != null and hospitalname != ''">and hospitalname like concat('%', #{hospitalname}, + '%') + </if> + <if test="patname != null and patname != ''">and patname like concat('%', #{patname}, '%')</if> + <if test="hospitaldistrictname != null and hospitaldistrictname != ''">and hospitaldistrictname like + concat('%', #{hospitaldistrictname}, '%') + </if> + <if test="endtime != null ">and endtime = #{endtime}</if> + <if test="patno != null ">and patno = #{patno}</if> + <if test="checkFlag != null ">and check_flag = #{checkFlag}</if> + <if test="inhospstate != null ">and inhospstate = #{inhospstate}</if> + <if test="schemestatus != null ">and schemestatus = #{schemestatus}</if> + <if test="leavediagname != null and leavediagname != ''">and leavediagname like concat('%', + #{leavediagname}, '%') + </if> + <if test="drname != null and drname != ''">and drname like concat('%', #{drname}, '%')</if> + <if test="leaveldeptname != null and leaveldeptname != ''">and leaveldeptname like concat('%', + #{leaveldeptname}, '%') + </if> + <if test="leavehospitaldistrictname != null and leavehospitaldistrictname != ''">and + leavehospitaldistrictname like concat('%', #{leavehospitaldistrictname}, '%') + </if> </where> + order by update_time desc </select> - + <select id="selectPatMedInhospByInhospid" parameterType="Long" resultMap="PatMedInhospResult"> <include refid="selectPatMedInhospVo"/> where inhospid = #{inhospid} </select> - - <insert id="insertPatMedInhosp" parameterType="PatMedInhosp" useGeneratedKeys="true" keyProperty="inhospid"> + + <insert id="insertPatMedInhosp" parameterType="com.smartor.domain.PatMedInhosp" useGeneratedKeys="true" + keyProperty="inhospid"> insert into pat_med_inhosp <trim prefix="(" suffix=")" suffixOverrides=","> <if test="serialnum != null">serialnum,</if> @@ -82,7 +147,7 @@ <if test="deptcode != null">deptcode,</if> <if test="deptname != null">deptname,</if> <if test="roomno != null">roomno,</if> - <if test="bedno != null">bedno,</if> + <if test="bedNo != null">bed_no,</if> <if test="orgid != null">orgid,</if> <if test="delFlag != null and delFlag != ''">del_flag,</if> <if test="updateBy != null">update_by,</if> @@ -107,7 +172,11 @@ <if test="deptid != null">deptid,</if> <if test="leaveldeptid != null">leaveldeptid,</if> <if test="schemetime != null">schemetime,</if> - </trim> + <if test="patname!= null">patname,</if> + <if test="patno != null">patno,</if> + <if test="inhospstate != null">inhospstate,</if> + <if test="checkFlag != null">check_flag,</if> + </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="serialnum != null">#{serialnum},</if> <if test="hospitalname != null">#{hospitalname},</if> @@ -121,7 +190,7 @@ <if test="deptcode != null">#{deptcode},</if> <if test="deptname != null">#{deptname},</if> <if test="roomno != null">#{roomno},</if> - <if test="bedno != null">#{bedno},</if> + <if test="bedNo != null">#{bedNo},</if> <if test="orgid != null">#{orgid},</if> <if test="delFlag != null and delFlag != ''">#{delFlag},</if> <if test="updateBy != null">#{updateBy},</if> @@ -146,10 +215,14 @@ <if test="deptid != null">#{deptid},</if> <if test="leaveldeptid != null">#{leaveldeptid},</if> <if test="schemetime != null">#{schemetime},</if> - </trim> + <if test="patname!= null">#{patname},</if> + <if test="patno != null">#{patno},</if> + <if test="inhospstate != null">#{inhospstate},</if> + <if test="checkFlag != null">#{checkFlag},</if> + </trim> </insert> - <update id="updatePatMedInhosp" parameterType="PatMedInhosp"> + <update id="updatePatMedInhosp" parameterType="com.smartor.domain.PatMedInhosp"> update pat_med_inhosp <trim prefix="SET" suffixOverrides=","> <if test="serialnum != null">serialnum = #{serialnum},</if> @@ -164,7 +237,7 @@ <if test="deptcode != null">deptcode = #{deptcode},</if> <if test="deptname != null">deptname = #{deptname},</if> <if test="roomno != null">roomno = #{roomno},</if> - <if test="bedno != null">bedno = #{bedno},</if> + <if test="bedNo != null">bed_no = #{bedNo},</if> <if test="orgid != null">orgid = #{orgid},</if> <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if> <if test="updateBy != null">update_by = #{updateBy},</if> @@ -189,18 +262,120 @@ <if test="deptid != null">deptid = #{deptid},</if> <if test="leaveldeptid != null">leaveldeptid = #{leaveldeptid},</if> <if test="schemetime != null">schemetime = #{schemetime},</if> + <if test="patname!= null">patname = #{patname},</if> + <if test="patno != null">patno = #{patno},</if> + <if test="inhospstate != null">inhospstate = #{inhospstate},</if> + <if test="checkFlag != null">check_flag = #{checkFlag},</if> </trim> where inhospid = #{inhospid} </update> <delete id="deletePatMedInhospByInhospid" parameterType="Long"> - delete from pat_med_inhosp where inhospid = #{inhospid} + delete + from pat_med_inhosp + where inhospid = #{inhospid} </delete> <delete id="deletePatMedInhospByInhospids" parameterType="String"> - delete from pat_med_inhosp where inhospid in + delete from pat_med_inhosp where inhospid in <foreach item="inhospid" collection="array" open="(" separator="," close=")"> #{inhospid} </foreach> </delete> -</mapper> \ No newline at end of file + + <select id="getDeptRanking" parameterType="com.smartor.domain.PatMedReq" resultType="com.smartor.domain.PatMedRes"> + SELECT deptname, COUNT(1) AS rc + FROM ( + <if test="mz != null"> + SELECT deptname + FROM pat_med_outhosp + <where> + del_flag=0 + <if test="deptcodeList != null"> + and deptcode in + <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")"> + #{deptcode} + </foreach> + </if> + </where> + </if> + <if test="mz != null and zy != null"> + UNION ALL + </if> + <if test="zy != null"> + SELECT deptname + FROM pat_med_inhosp + <where> + del_flag=0 + and inhospstate=0 + <if test="deptcodeList != null"> + and deptcode in + <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")"> + #{deptcode} + </foreach> + </if> + </where> + </if> + <if test="cy != null and zy != null"> + UNION ALL + SELECT deptname + FROM pat_med_inhosp + <where> + del_flag=0 + and inhospstate=1 + <if test="deptcodeList != null"> + and deptcode in + <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")"> + #{deptcode} + </foreach> + </if> + </where> + </if> + <if test="mz != null and zy != null and cy==null"> + UNION ALL + SELECT deptname + FROM pat_med_inhosp + <where> + del_flag=0 + and inhospstate=1 + <if test="deptcodeList != null"> + and deptcode in + <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")"> + #{deptcode} + </foreach> + </if> + </where> + </if> + ) AS combined + GROUP BY deptname; + + + </select> + <select id="selectPatMedInhospCount" parameterType="com.smartor.domain.PatMedReq" + resultType="com.smartor.domain.PatMedRes"> + SELECT + COUNT(1) AS rc, + COUNT(DISTINCT patid) AS rs + FROM + pat_med_inhosp + <where> + del_flag=0 + <if test="zy != null"> + and inhospstate=0 + and date_format(starttime,'%y%m%d') >= date_format(#{startDate},'%y%m%d') + and date_format(starttime,'%y%m%d') <= date_format(#{endDate},'%y%m%d') + </if> + <if test="cy != null"> + and inhospstate=1 + and date_format(endtime,'%y%m%d') >= date_format(#{startDate},'%y%m%d') + and date_format(endtime,'%y%m%d') <= date_format(#{endDate},'%y%m%d') + </if> + <if test="deptcodeList != null"> + and deptcode in + <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")"> + #{deptcode} + </foreach> + </if> + </where> + </select> +</mapper> -- Gitblit v1.9.3