liusheng
昨天 43e7dc349b8bc1515911e64fb12ea820afd1b0d2
smartor/src/main/resources/mapper/smartor/PatArchiveOutMapper.xml
@@ -76,35 +76,34 @@
    <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>
        where 1=1
        <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>
    </select>
    <select id="selectPatArchiveOutByPatid" parameterType="Long" resultMap="PatArchiveOutResult">
@@ -116,37 +115,38 @@
        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>
        where 1=1
        and del_flag = 0 and endtime = null
        <if test="orgid != null and orgid != ''">
            AND orgid = #{orgid}
        </if>
        <if test="deptcodes != null ">and deptcode in
            <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
                #{deptcode}
            </foreach>
        </if>
        <if test="drCodes != null ">and drcode in
            <foreach collection="drCodes" item="drCode" open="(" separator="," close=")">
                #{drCode}
            </foreach>
        </if>
        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
        where 1=1
        and del_flag = 0 and endtime != null
        <if test="orgid != null and orgid != ''">
            AND orgid = #{orgid}
        </if>
        <if test="deptcodes != null ">and leaveldeptcode in
            <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
                #{deptcode}
            </foreach>
        </if>
        <if test="drCodes != null ">and drcode in
            <foreach collection="drCodes" item="drCode" open="(" separator="," close=")">
                #{drCode}
            </foreach>
        </if>
        ) aa
    </select>