| | |
| | | </resultMap> |
| | | |
| | | <sql id="selectPatMedInhospVo"> |
| | | 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 |
| | | 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="com.smartor.domain.PatMedInhosp" resultMap="PatMedInhospResult"> |
| | | <include refid="selectPatMedInhospVo"/> |
| | | <where> |
| | | <if test="hospitalname != null and hospitalname != ''"> and hospitalname like concat('%', #{hospitalname}, '%')</if> |
| | | <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="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="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> |
| | | <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> |
| | |
| | | where inhospid = #{inhospid} |
| | | </select> |
| | | |
| | | <insert id="insertPatMedInhosp" parameterType="com.smartor.domain.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> |
| | |
| | | </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"> |
| | |
| | | #{inhospid} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <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> |