<?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.PatArchiveOutMapper">
|
|
<resultMap type="com.smartor.domain.PatArchiveOut" id="PatArchiveOutResult">
|
<result property="patid" column="patid"/>
|
<result property="patientno" column="patientno"/>
|
<result property="pattype" column="pattype"/>
|
<result property="name" column="name"/>
|
<result property="sex" column="sex"/>
|
<result property="nation" column="nation"/>
|
<result property="nativePlace" column="native_place"/>
|
<result property="placeOfResidence" column="place_of_residence"/>
|
<result property="birthplace" column="birthplace"/>
|
<result property="idcardno" column="idcardno"/>
|
<result property="birthdate" column="birthdate"/>
|
<result property="age" column="age"/>
|
<result property="archivetime" column="archivetime"/>
|
<result property="archiveby" column="archiveby"/>
|
<result property="telcode" column="telcode"/>
|
<result property="relativetelcode" column="relativetelcode"/>
|
<result property="idcardtype" column="idcardtype"/>
|
<result property="orgid" column="orgid"/>
|
<result property="openid" column="openid"/>
|
<result property="dduserid" column="dduserid"/>
|
<result property="delFlag" column="del_flag"/>
|
<result property="source" column="source"/>
|
<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="pid" column="pid"/>
|
<result property="guid" column="guid"/>
|
<result property="membertype" column="membertype"/>
|
</resultMap>
|
|
<sql id="selectPatArchiveOutVo">
|
select patid,
|
patientno,
|
pattype,
|
name,
|
sex,
|
nation,
|
native_place,
|
place_of_residence,
|
birthplace,
|
idcardno,
|
birthdate,
|
age,
|
archivetime,
|
archiveby,
|
telcode,
|
relativetelcode,
|
idcardtype,
|
orgid,
|
openid,
|
dduserid,
|
del_flag,
|
source,
|
update_by,
|
update_time,
|
create_by,
|
create_time,
|
isupload,
|
upload_time,
|
pid,
|
guid,
|
membertype
|
from pat_archive_out
|
</sql>
|
|
<select id="selectPatArchiveOutList" parameterType="com.smartor.domain.PatArchiveOut"
|
resultMap="PatArchiveOutResult">
|
<include refid="selectPatArchiveOutVo"/>
|
<where>
|
<if test="patientno != null and patientno != ''">and patientno = #{patientno}</if>
|
<if test="pattype != null and pattype != ''">and pattype = #{pattype}</if>
|
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
<if test="sex != null ">and sex = #{sex}</if>
|
<if test="nation != null and nation != ''">and nation = #{nation}</if>
|
<if test="nativePlace != null and nativePlace != ''">and native_place = #{nativePlace}</if>
|
<if test="placeOfResidence != null and placeOfResidence != ''">and place_of_residence =
|
#{placeOfResidence}
|
</if>
|
<if test="birthplace != null and birthplace != ''">and birthplace = #{birthplace}</if>
|
<if test="idcardno != null and idcardno != ''">and idcardno = #{idcardno}</if>
|
<if test="birthdate != null ">and birthdate = #{birthdate}</if>
|
<if test="age != null ">and age = #{age}</if>
|
<if test="archivetime != null ">and archivetime = #{archivetime}</if>
|
<if test="archiveby != null and archiveby != ''">and archiveby = #{archiveby}</if>
|
<if test="telcode != null and telcode != ''">and telcode = #{telcode}</if>
|
<if test="relativetelcode != null and relativetelcode != ''">and relativetelcode = #{relativetelcode}</if>
|
<if test="idcardtype != null and idcardtype != ''">and idcardtype = #{idcardtype}</if>
|
<if test="orgid != null and orgid != ''">and orgid = #{orgid}</if>
|
<if test="openid != null and openid != ''">and openid = #{openid}</if>
|
<if test="dduserid != null and dduserid != ''">and dduserid = #{dduserid}</if>
|
<if test="source != null ">and source = #{source}</if>
|
<if test="isupload != null ">and isupload = #{isupload}</if>
|
<if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
|
<if test="pid != null ">and pid = #{pid}</if>
|
<if test="guid != null and guid != ''">and guid = #{guid}</if>
|
<if test="membertype != null and membertype != ''">and membertype = #{membertype}</if>
|
</where>
|
</select>
|
|
<select id="selectPatArchiveOutByPatid" parameterType="Long" resultMap="PatArchiveOutResult">
|
<include refid="selectPatArchiveOutVo"/>
|
where patid = #{patid}
|
</select>
|
|
<select id="selectPatArchiveCount" parameterType="Long" resultType="com.smartor.domain.PerSonWorkbenchDto">
|
select aa.name1 as name, aa.count as count
|
from (
|
SELECT "住院" as name1, count(1) as count FROM `pat_med_inhosp`
|
<where>
|
del_flag = 0 and endtime = null
|
<if test="deptIds != null ">and deptId in
|
<foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
|
#{deptId}
|
</foreach>
|
</if>
|
<if test="drCodes != null ">and drcode in
|
<foreach collection="drCodes" item="drCode" open="(" separator="," close=")">
|
#{drCode}
|
</foreach>
|
</if>
|
</where>
|
union
|
select "出院" name1, count(1) as count FROM `pat_med_inhosp`
|
<where>
|
del_flag=0 and endtime != null
|
<if test="deptIds != null ">and deptId in
|
<foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
|
#{deptId}
|
</foreach>
|
</if>
|
<if test="drCodes != null ">and drcode in
|
<foreach collection="drCodes" item="drCode" open="(" separator="," close=")">
|
#{drCode}
|
</foreach>
|
</if>
|
</where>
|
union
|
select "门诊" name1, count(1) as count FROM `pat_med_outhosp`
|
where del_flag=0
|
) aa
|
|
</select>
|
|
<insert id="insertPatArchiveOut" parameterType="com.smartor.domain.PatArchiveOut" useGeneratedKeys="true"
|
keyProperty="patid">
|
insert into pat_archive_out
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="patientno != null">patientno,</if>
|
<if test="pattype != null">pattype,</if>
|
<if test="name != null">name,</if>
|
<if test="sex != null">sex,</if>
|
<if test="nation != null">nation,</if>
|
<if test="nativePlace != null">native_place,</if>
|
<if test="placeOfResidence != null">place_of_residence,</if>
|
<if test="birthplace != null">birthplace,</if>
|
<if test="idcardno != null">idcardno,</if>
|
<if test="birthdate != null">birthdate,</if>
|
<if test="age != null">age,</if>
|
<if test="archivetime != null">archivetime,</if>
|
<if test="archiveby != null">archiveby,</if>
|
<if test="telcode != null">telcode,</if>
|
<if test="relativetelcode != null">relativetelcode,</if>
|
<if test="idcardtype != null">idcardtype,</if>
|
<if test="orgid != null">orgid,</if>
|
<if test="openid != null">openid,</if>
|
<if test="dduserid != null">dduserid,</if>
|
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
<if test="source != null">source,</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="pid != null">pid,</if>
|
<if test="guid != null">guid,</if>
|
<if test="membertype != null">membertype,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="patientno != null">#{patientno},</if>
|
<if test="pattype != null">#{pattype},</if>
|
<if test="name != null">#{name},</if>
|
<if test="sex != null">#{sex},</if>
|
<if test="nation != null">#{nation},</if>
|
<if test="nativePlace != null">#{nativePlace},</if>
|
<if test="placeOfResidence != null">#{placeOfResidence},</if>
|
<if test="birthplace != null">#{birthplace},</if>
|
<if test="idcardno != null">#{idcardno},</if>
|
<if test="birthdate != null">#{birthdate},</if>
|
<if test="age != null">#{age},</if>
|
<if test="archivetime != null">#{archivetime},</if>
|
<if test="archiveby != null">#{archiveby},</if>
|
<if test="telcode != null">#{telcode},</if>
|
<if test="relativetelcode != null">#{relativetelcode},</if>
|
<if test="idcardtype != null">#{idcardtype},</if>
|
<if test="orgid != null">#{orgid},</if>
|
<if test="openid != null">#{openid},</if>
|
<if test="dduserid != null">#{dduserid},</if>
|
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
<if test="source != null">#{source},</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="pid != null">#{pid},</if>
|
<if test="guid != null">#{guid},</if>
|
<if test="membertype != null">#{membertype},</if>
|
</trim>
|
</insert>
|
|
<update id="updatePatArchiveOut" parameterType="com.smartor.domain.PatArchiveOut">
|
update pat_archive_out
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="patientno != null">patientno = #{patientno},</if>
|
<if test="pattype != null">pattype = #{pattype},</if>
|
<if test="name != null">name = #{name},</if>
|
<if test="sex != null">sex = #{sex},</if>
|
<if test="nation != null">nation = #{nation},</if>
|
<if test="nativePlace != null">native_place = #{nativePlace},</if>
|
<if test="placeOfResidence != null">place_of_residence = #{placeOfResidence},</if>
|
<if test="birthplace != null">birthplace = #{birthplace},</if>
|
<if test="idcardno != null">idcardno = #{idcardno},</if>
|
<if test="birthdate != null">birthdate = #{birthdate},</if>
|
<if test="age != null">age = #{age},</if>
|
<if test="archivetime != null">archivetime = #{archivetime},</if>
|
<if test="archiveby != null">archiveby = #{archiveby},</if>
|
<if test="telcode != null">telcode = #{telcode},</if>
|
<if test="relativetelcode != null">relativetelcode = #{relativetelcode},</if>
|
<if test="idcardtype != null">idcardtype = #{idcardtype},</if>
|
<if test="orgid != null">orgid = #{orgid},</if>
|
<if test="openid != null">openid = #{openid},</if>
|
<if test="dduserid != null">dduserid = #{dduserid},</if>
|
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
<if test="source != null">source = #{source},</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="pid != null">pid = #{pid},</if>
|
<if test="guid != null">guid = #{guid},</if>
|
<if test="membertype != null">membertype = #{membertype},</if>
|
</trim>
|
where patid = #{patid}
|
</update>
|
|
<update id="deletePatArchiveOutByPatid" parameterType="Long">
|
update pat_archive_out
|
<trim prefix="SET" suffixOverrides=",">
|
del_flag =1
|
</trim>
|
where patid = #{patid}
|
</update>
|
|
|
</mapper>
|