<?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.smartor.mapper.PatMedInhospMapper">
|
|
<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="deptcheckFlag" column="deptcheck_flag"/>
|
<result property="wardcheckFlag" column="wardcheck_flag"/>
|
<result property="diagcheckFlag" column="diagcheck_flag"/>
|
<result property="age" column="age"/>
|
<result property="sex" column="sex"/>
|
<result property="telcode" column="telcode"/>
|
<result property="longTaskReason" column="long_task_reason"/>
|
<result property="nurseId" column="nurse_id"/>
|
<result property="nurseName" column="nurse_name"/>
|
<result property="outWayId" column="out_way_id"/>
|
<result property="outWayName" column="out_way_name"/>
|
<result property="guid" column="guid"/>
|
<result property="operator" column="operator"/>
|
<result property="operatorId" column="operator_id"/>
|
<result property="remark" column="remark"/>
|
<result property="tagname" column="tagname"/>
|
<result property="fuflag" column="fuflag"/>
|
<result property="fudate" column="fudate"/>
|
<result property="fuperiod" column="fuperiod"/>
|
<result property="futypecode" column="futypecode"/>
|
<result property="futypedesc" column="futypedesc"/>
|
<result property="fuadvice" column="fuadvice"/>
|
<result property="fuspecialadvice" column="fuspecialadvice"/>
|
</resultMap>
|
|
<sql id="selectPatMedInhospVo">
|
select inhospid,
|
patname,
|
fuflag,
|
fudate,
|
fuperiod,
|
futypecode,
|
futypedesc,
|
fuadvice,
|
fuspecialadvice,
|
remark,
|
guid,
|
operator,
|
operator_id,
|
out_way_id,
|
out_way_name,
|
nurse_id,
|
nurse_name,
|
deptcheck_flag,
|
wardcheck_flag,
|
diagcheck_flag,
|
inhospstate,
|
patno,
|
long_task_reason,
|
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">
|
select CONCAT( a.age, a.age_unit ) AS age,
|
a.telcode as telcode,
|
a.sex,
|
b.inhospid,
|
b.nurse_id,
|
b.nurse_name,
|
b.patname,
|
b.out_way_id,
|
b.out_way_name,
|
b.deptcheck_flag,
|
b.wardcheck_flag,
|
b.diagcheck_flag,
|
b.inhospstate,
|
b.patno,
|
b.inhospno,
|
b.serialnum,
|
b.hospitalname,
|
b.hospitalcode,
|
b.hospitaldistrictcode,
|
b.hospitaldistrictname,
|
b.icd10code,
|
b.diagname,
|
b.starttime,
|
b.endtime,
|
b.deptcode,
|
b.deptname,
|
b.roomno,
|
b.bed_no,
|
b.orgid,
|
b.del_flag,
|
b.update_by,
|
b.update_time,
|
b.create_by,
|
b.create_time,
|
b.isupload,
|
b.upload_time,
|
b.patid,
|
b.leavediagname,
|
b.leaveicd10code,
|
b.drcode,
|
b.drname,
|
b.schemestatus,
|
b.generalschemestatus,
|
b.leaveldeptcode,
|
b.leaveldeptname,
|
b.hospitaldistrictid,
|
b.leavehospitaldistrictcode,
|
b.leavehospitaldistrictname,
|
b.leavehospitaldistrictid,
|
b.deptid,
|
b.leaveldeptid,
|
b.long_task_reason,
|
b.schemetime,
|
b.fuflag,
|
b.fudate,
|
b.fuperiod,
|
b.futypecode,
|
b.futypedesc,
|
b.fuadvice,
|
b.fuspecialadvice,
|
a.idcardno
|
FROM
|
pat_med_inhosp b
|
JOIN
|
pat_archive a ON a.id = b.patid
|
LEFT JOIN
|
pat_archivetag c ON c.patid = a.id AND (C.del_flag = 0 OR C.del_flag IS NULL)
|
<where>
|
a.del_flag = 0
|
AND b.del_flag = 0
|
AND a.idcardno IS NOT NULL
|
<!--<if test="startOutHospTime != null">
|
AND STR_TO_DATE(b.endtime,'%Y-%m-%d') >= STR_TO_DATE(#{startOutHospTime},'%Y-%m-%d')
|
</if>
|
<if test="endOutHospTime != null">
|
AND STR_TO_DATE(b.endtime,'%Y-%m-%d') <= STR_TO_DATE(#{endOutHospTime},'%Y-%m-%d')
|
</if>
|
<if test="tagname != null and tagname != ''">and c.tagname like concat('%', #{tagname}, '%')</if>
|
|
<if test="startInHospTime != null">
|
AND STR_TO_DATE(b.starttime, '%Y-%m-%d') >= STR_TO_DATE(#{startInHospTime}, '%Y-%m-%d')
|
</if>
|
<if test="endInHospTime != null">
|
AND STR_TO_DATE(b.starttime, '%Y-%m-%d') <= STR_TO_DATE(#{startInHospTime}, '%Y-%m-%d')
|
</if>-->
|
<if test="startOutHospTime != null ">and date_format(b.endtime,'%y%m%d') >=
|
date_format(#{startOutHospTime},'%y%m%d')
|
</if>
|
<if test="endOutHospTime != null ">and date_format(b.endtime,'%y%m%d') <=
|
date_format(#{endOutHospTime},'%y%m%d')
|
</if>
|
<if test="startInHospTime != null ">and date_format(b.starttime,'%y%m%d') >=
|
date_format(#{startInHospTime},'%y%m%d')
|
</if>
|
<if test="endInHospTime != null ">and date_format(b.starttime,'%y%m%d') <=
|
date_format(#{endInHospTime},'%y%m%d')
|
</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="endtime != null ">and b.endtime = #{endtime}</if>
|
<if test="inhospno != null ">and b.inhospno = #{inhospno}</if>
|
<if test="fuflag != null ">and b.fuflag = #{fuflag}</if>
|
<if test="serialnum != null ">and b.serialnum = #{serialnum}</if>
|
<if test="endtime != null ">and b.endtime = #{endtime}</if>
|
<if test="patno != null ">and b.patno = #{patno}</if>
|
<if test="nurseId != null ">and b.nurse_id = #{nurseId}</if>
|
<if test="nurseName != null and nurseName != ''">and b.nurse_name = #{nurseName}</if>
|
<if test="deptcheckFlag != null ">and b.deptcheck_flag = #{deptcheckFlag}</if>
|
<if test="wardcheckFlag != null ">and b.wardcheck_flag = #{wardcheckFlag}</if>
|
<if test="diagcheckFlag != null ">and b.diagcheck_flag = #{diagcheckFlag}</if>
|
<if test="cry != null and cry == 0 ">and b.endtime is null</if>
|
<if test="cry != null and cry == 1 ">and b.endtime is not null</if>
|
<if test="inhospstate != null ">and b.inhospstate = #{inhospstate}</if>
|
<if test="schemestatus != null ">and b.schemestatus = #{schemestatus}</if>
|
<if test="outWayId != null ">and b.out_way_id = #{outWayId}</if>
|
<if test="outWayName != null ">and b.out_way_name = #{outWayName}</if>
|
<if test="leavediagname != null and leavediagname != ''">and b.leavediagname like concat('%',
|
#{leavediagname}, '%')
|
</if>
|
<if test="drname != null and drname != ''">and b.drname like concat('%', #{drname}, '%')</if>
|
<if test="leaveldeptname != null and leaveldeptname != ''">and b.leaveldeptname like concat('%',
|
#{leaveldeptname}, '%')
|
</if>
|
<if test="patid != null and patid != ''">and a.id =#{patid}
|
</if>
|
<if test="leavehospitaldistrictname != null and leavehospitaldistrictname != ''">and
|
b.leavehospitaldistrictname like concat('%', #{leavehospitaldistrictname}, '%')
|
</if>
|
|
<if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size()>0">
|
AND b.leavehospitaldistrictcode IN
|
<foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
|
close=")">
|
#{leavehospitaldistrictcode}
|
</foreach>
|
</if>
|
<if test="leaveldeptcodes != null and leaveldeptcodes.size()>0">
|
AND b.leaveldeptcode IN
|
<foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
|
close=")">
|
#{leaveldeptcode}
|
</foreach>
|
</if>
|
</where>
|
GROUP BY
|
b.inhospid,
|
a.age,
|
a.age_unit,
|
a.telcode,
|
a.id,
|
a.sex
|
<if test="cry==1">
|
order by b.endtime desc
|
</if>
|
<if test="cry==0">
|
order by b.starttime desc
|
</if>
|
</select>
|
<select id="selectPatMedInhospListByCondition" parameterType="com.smartor.domain.PatMedInhospVO"
|
resultMap="PatMedInhospResult">
|
select CONCAT( a.age, a.age_unit ) AS age,
|
a.telcode as telcode,
|
b.inhospid,
|
b.patname,
|
b.operator_id,
|
b.operator,
|
b.remark,
|
b.out_way_id,
|
b.out_way_name,
|
b.nurse_id,
|
b.nurse_name,
|
b.deptcheckFlag,
|
b.diagcheckFlag,
|
b.wardcheckFlag,
|
b.inhospstate,
|
b.patno,
|
b.inhospno,
|
b.serialnum,
|
b.hospitalname,
|
b.hospitalcode,
|
b.hospitaldistrictcode,
|
b.hospitaldistrictname,
|
b.icd10code,
|
b.diagname,
|
b.starttime,
|
b.endtime,
|
b.deptcode,
|
b.deptname,
|
b.roomno,
|
b.bed_no,
|
b.orgid,
|
b.del_flag,
|
b.update_by,
|
b.update_time,
|
b.create_by,
|
b.create_time,
|
b.isupload,
|
b.upload_time,
|
b.patid,
|
b.leavediagname,
|
b.leaveicd10code,
|
b.drcode,
|
b.drname,
|
b.schemestatus,
|
b.generalschemestatus,
|
b.leaveldeptcode,
|
b.leaveldeptname,
|
b.hospitaldistrictid,
|
b.leavehospitaldistrictcode,
|
b.leavehospitaldistrictname,
|
b.leavehospitaldistrictid,
|
b.deptid,
|
b.leaveldeptid,
|
b.long_task_reason,
|
b.fuflag,
|
b.fudate,
|
b.fuperiod,
|
b.futypecode,
|
b.futypedesc,
|
b.fuadvice,
|
b.fuspecialadvice
|
b.schemetime
|
FROM
|
pat_med_inhosp b,
|
pat_archive a
|
<where>
|
a.del_flag=0
|
and b.del_flag=0
|
and a.id = b.patid
|
AND a.idcardno != ''
|
<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 b.endtime = #{endtime}</if>
|
<if test="fuflag != null ">and b.fuflag = #{fuflag}</if>
|
<if test="nurseId != null ">and b.nurse_id = #{nurseId}</if>
|
<if test="nurseName != null ">and b.nurse_name = #{nurseName}</if>
|
<if test="patno != null ">and b.patno = #{patno}</if>
|
<if test="diagcheckFlag != null ">and b.diagcheck_flag = #{diagcheckFlag}</if>
|
<if test="deptcheckFlag != null ">and b.deptcheck_flag = #{deptcheckFlag}</if>
|
<if test="wardcheckFlag != null ">and b.wardcheck_flag = #{wardcheckFlag}</if>
|
<if test="inhospstate != null ">and b.inhospstate = #{inhospstate}</if>
|
<if test="schemestatus != null ">and b.schemestatus = #{schemestatus}</if>
|
<if test="leavediagname != null and leavediagname != ''">and b.leavediagname like concat('%',
|
#{leavediagname}, '%')
|
</if>
|
<if test="drname != null and drname != ''">and b.drname like concat('%', #{drname}, '%')</if>
|
<if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size()>0">
|
AND b.leavehospitaldistrictcode IN
|
<foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
|
close=")">
|
#{leavehospitaldistrictcode}
|
</foreach>
|
</if>
|
<if test="leaveldeptcodes != null and leaveldeptcodes.size()>0">
|
AND b.leaveldeptcode IN
|
<foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
|
close=")">
|
#{leaveldeptcode}
|
</foreach>
|
</if>
|
</where>
|
order by b.inhospid desc
|
</select>
|
|
<select id="getTagnameBypatid" parameterType="Long" resultType="string">
|
SELECT GROUP_CONCAT(d.tagname, ', ')
|
FROM pat_archivetag d
|
WHERE d.patid = #{patid}
|
AND d.del_flag = 0
|
</select>
|
|
|
<select id="selectPatMedInhospByInhospid" parameterType="Long" resultMap="PatMedInhospResult">
|
<include refid="selectPatMedInhospVo"/>
|
where inhospid = #{inhospid}
|
</select>
|
|
<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>
|
<if test="hospitalname != null">hospitalname,</if>
|
<if test="hospitalcode != null">hospitalcode,</if>
|
<if test="hospitaldistrictcode != null">hospitaldistrictcode,</if>
|
<if test="hospitaldistrictname != null">hospitaldistrictname,</if>
|
<if test="icd10code != null">icd10code,</if>
|
<if test="diagname != null">diagname,</if>
|
<if test="starttime != null">starttime,</if>
|
<if test="endtime != null">endtime,</if>
|
<if test="deptcode != null">deptcode,</if>
|
<if test="deptname != null">deptname,</if>
|
<if test="roomno != null">roomno,</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>
|
<if test="updateTime != null">update_time,</if>
|
<if test="createBy != null">create_by,</if>
|
<if test="createTime != null">create_time,</if>
|
<if test="isupload != null">isupload,</if>
|
<if test="uploadTime != null">upload_time,</if>
|
<if test="patid != null">patid,</if>
|
<if test="leavediagname != null">leavediagname,</if>
|
<if test="leaveicd10code != null">leaveicd10code,</if>
|
<if test="drcode != null">drcode,</if>
|
<if test="drname != null">drname,</if>
|
<if test="schemestatus != null">schemestatus,</if>
|
<if test="generalschemestatus != null">generalschemestatus,</if>
|
<if test="leaveldeptcode != null">leaveldeptcode,</if>
|
<if test="leaveldeptname != null">leaveldeptname,</if>
|
<if test="hospitaldistrictid != null">hospitaldistrictid,</if>
|
<if test="leavehospitaldistrictcode != null">leavehospitaldistrictcode,</if>
|
<if test="leavehospitaldistrictname != null">leavehospitaldistrictname,</if>
|
<if test="leavehospitaldistrictid != null">leavehospitaldistrictid,</if>
|
<if test="deptid != null">deptid,</if>
|
<if test="leaveldeptid != null">leaveldeptid,</if>
|
<if test="schemetime != null">schemetime,</if>
|
<if test="patname!= null">patname,</if>
|
<if test="patno != null">patno,</if>
|
<if test="inhospstate != null">inhospstate,</if>
|
<if test="deptcheckFlag != null">deptcheck_flag,</if>
|
<if test="wardcheckFlag != null">wardcheck_flag,</if>
|
<if test="diagcheckFlag != null">diagcheck_flag,</if>
|
<if test="longTaskReason != null">long_task_reason,</if>
|
<if test="nurseId != null ">nurse_id,</if>
|
<if test="nurseName != null ">nurse_name,</if>
|
<if test="outWayId != null ">out_way_id,</if>
|
<if test="outWayName != null ">out_way_name,</if>
|
<if test="guid != null ">guid,</if>
|
<if test="operator != null ">operator,</if>
|
<if test="operatorId != null ">operator_id,</if>
|
<if test="inhospno != null ">inhospno,</if>
|
<if test="remark != null ">remark,</if>
|
<if test="fuflag != null ">fuflag,</if>
|
<if test="fudate != null ">fudate,</if>
|
<if test="fuperiod != null ">fuperiod,</if>
|
<if test="futypecode != null ">futypecode,</if>
|
<if test="futypedesc != null ">futypedesc,</if>
|
<if test="fuadvice != null ">fuadvice,</if>
|
<if test="fuspecialadvice != null ">fuspecialadvice,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="serialnum != null">#{serialnum},</if>
|
<if test="hospitalname != null">#{hospitalname},</if>
|
<if test="hospitalcode != null">#{hospitalcode},</if>
|
<if test="hospitaldistrictcode != null">#{hospitaldistrictcode},</if>
|
<if test="hospitaldistrictname != null">#{hospitaldistrictname},</if>
|
<if test="icd10code != null">#{icd10code},</if>
|
<if test="diagname != null">#{diagname},</if>
|
<if test="starttime != null">#{starttime},</if>
|
<if test="endtime != null">#{endtime},</if>
|
<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="orgid != null">#{orgid},</if>
|
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
<if test="createBy != null">#{createBy},</if>
|
<if test="createTime != null">#{createTime},</if>
|
<if test="isupload != null">#{isupload},</if>
|
<if test="uploadTime != null">#{uploadTime},</if>
|
<if test="patid != null">#{patid},</if>
|
<if test="leavediagname != null">#{leavediagname},</if>
|
<if test="leaveicd10code != null">#{leaveicd10code},</if>
|
<if test="drcode != null">#{drcode},</if>
|
<if test="drname != null">#{drname},</if>
|
<if test="schemestatus != null">#{schemestatus},</if>
|
<if test="generalschemestatus != null">#{generalschemestatus},</if>
|
<if test="leaveldeptcode != null">#{leaveldeptcode},</if>
|
<if test="leaveldeptname != null">#{leaveldeptname},</if>
|
<if test="hospitaldistrictid != null">#{hospitaldistrictid},</if>
|
<if test="leavehospitaldistrictcode != null">#{leavehospitaldistrictcode},</if>
|
<if test="leavehospitaldistrictname != null">#{leavehospitaldistrictname},</if>
|
<if test="leavehospitaldistrictid != null">#{leavehospitaldistrictid},</if>
|
<if test="deptid != null">#{deptid},</if>
|
<if test="leaveldeptid != null">#{leaveldeptid},</if>
|
<if test="schemetime != null">#{schemetime},</if>
|
<if test="patname!= null">#{patname},</if>
|
<if test="patno != null">#{patno},</if>
|
<if test="inhospstate != null">#{inhospstate},</if>
|
<if test="deptcheckFlag != null">#{deptcheckFlag},</if>
|
<if test="wardcheckFlag != null">#{wardcheckFlag},</if>
|
<if test="diagcheckFlag != null">#{diagcheckFlag},</if>
|
<if test="longTaskReason != null">#{longTaskReason},</if>
|
<if test="nurseId != null ">#{nurseId},</if>
|
<if test="nurseName != null ">#{nurseName},</if>
|
<if test="outWayId != null ">#{outWayId},</if>
|
<if test="outWayName != null ">#{outWayName},</if>
|
<if test="guid != null ">#{guid},</if>
|
<if test="operator != null ">#{operator},</if>
|
<if test="operatorId != null ">#{operatorId},</if>
|
<if test="inhospno != null ">#{inhospno},</if>
|
<if test="remark != null ">#{remark},</if>
|
<if test="fuflag != null ">#{fuflag},</if>
|
<if test="fudate != null ">#{fudate},</if>
|
<if test="fuperiod != null ">#{fuperiod},</if>
|
<if test="futypecode != null ">#{futypecode},</if>
|
<if test="futypedesc != null ">#{futypedesc},</if>
|
<if test="fuadvice != null ">#{fuadvice},</if>
|
<if test="fuspecialadvice != null ">#{fuspecialadvice},</if>
|
</trim>
|
</insert>
|
|
<update id="updatePatMedInhosp" parameterType="com.smartor.domain.PatMedInhosp">
|
update pat_med_inhosp
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="serialnum != null">serialnum = #{serialnum},</if>
|
<if test="hospitalname != null">hospitalname = #{hospitalname},</if>
|
<if test="hospitalcode != null">hospitalcode = #{hospitalcode},</if>
|
<if test="hospitaldistrictcode != null">hospitaldistrictcode = #{hospitaldistrictcode},</if>
|
<if test="hospitaldistrictname != null">hospitaldistrictname = #{hospitaldistrictname},</if>
|
<if test="icd10code != null">icd10code = #{icd10code},</if>
|
<if test="diagname != null">diagname = #{diagname},</if>
|
<if test="starttime != null">starttime = #{starttime},</if>
|
<if test="endtime != null">endtime = #{endtime},</if>
|
<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">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>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="isupload != null">isupload = #{isupload},</if>
|
<if test="uploadTime != null">upload_time = #{uploadTime},</if>
|
<if test="patid != null">patid = #{patid},</if>
|
<if test="leavediagname != null">leavediagname = #{leavediagname},</if>
|
<if test="leaveicd10code != null">leaveicd10code = #{leaveicd10code},</if>
|
<if test="drcode != null">drcode = #{drcode},</if>
|
<if test="drname != null">drname = #{drname},</if>
|
<if test="schemestatus != null">schemestatus = #{schemestatus},</if>
|
<if test="generalschemestatus != null">generalschemestatus = #{generalschemestatus},</if>
|
<if test="leaveldeptcode != null">leaveldeptcode = #{leaveldeptcode},</if>
|
<if test="leaveldeptname != null">leaveldeptname = #{leaveldeptname},</if>
|
<if test="hospitaldistrictid != null">hospitaldistrictid = #{hospitaldistrictid},</if>
|
<if test="leavehospitaldistrictcode != null">leavehospitaldistrictcode = #{leavehospitaldistrictcode},</if>
|
<if test="leavehospitaldistrictname != null">leavehospitaldistrictname = #{leavehospitaldistrictname},</if>
|
<if test="leavehospitaldistrictid != null">leavehospitaldistrictid = #{leavehospitaldistrictid},</if>
|
<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="deptcheckFlag != null">deptcheck_flag = #{deptcheckFlag},</if>
|
<if test="wardcheckFlag != null">wardcheck_flag = #{wardcheckFlag},</if>
|
<if test="diagcheckFlag != null">diagcheck_flag = #{diagcheckFlag},</if>
|
<if test="longTaskReason != null">long_task_reason = #{longTaskReason},</if>
|
<if test="nurseId != null ">nurse_id = #{nurseId},</if>
|
<if test="nurseName != null ">nurse_name = #{nurseName},</if>
|
<if test="outWayId != null ">out_way_id = #{outWayId},</if>
|
<if test="outWayName != null ">out_way_name = #{outWayName},</if>
|
<if test="guid != null ">guid = #{guid},</if>
|
<if test="operator != null ">operator = #{operator},</if>
|
<if test="operatorId != null ">operator_id = #{operatorId},</if>
|
<if test="remark != null ">remark = #{remark},</if>
|
<if test="fuflag != null ">fuflag = #{fuflag},</if>
|
<if test="fudate != null ">fudate = #{fudate},</if>
|
<if test="fuperiod != null ">fuperiod = #{fuperiod},</if>
|
<if test="futypecode != null ">futypecode = #{futypecode},</if>
|
<if test="futypedesc != null ">futypedesc = #{futypedesc},</if>
|
<if test="fuadvice != null ">fuadvice = #{fuadvice},</if>
|
<if test="fuspecialadvice != null ">fuspecialadvice = #{fuspecialadvice},</if>
|
</trim>
|
where inhospid = #{inhospid}
|
</update>
|
|
<delete id="deletePatMedInhospByInhospid" parameterType="Long">
|
update pat_med_inhosp
|
<trim prefix="SET" suffixOverrides=",">
|
del_flag =1
|
</trim>
|
where inhospid = #{inhospid}
|
</delete>
|
|
<delete id="deletePatMedInhospByInhospno" parameterType="String">
|
update pat_med_inhosp
|
<trim prefix="SET" suffixOverrides=",">
|
del_flag =1
|
</trim>
|
where inhospno = #{inhospno}
|
</delete>
|
|
<delete id="deletePatMedInhospByInhospids" parameterType="String">
|
delete from pat_med_inhosp where inhospid in
|
<foreach item="inhospid" collection="array" open="(" separator="," close=")">
|
#{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 deptcodeList.size() > 0">
|
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 deptcodeList.size() > 0">
|
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 deptcodeList.size() > 0">
|
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 deptcodeList.size() > 0">
|
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 deptcodeList.size() > 0">
|
and deptcode in
|
<foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
|
#{deptcode}
|
</foreach>
|
</if>
|
</where>
|
</select>
|
</mapper>
|