陈昶聿
3 天以前 d7e3192804fca756d881af360ffd5eea157ef9ad
smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -28,6 +28,7 @@
        <result property="archivetime" column="archivetime"/>
        <result property="archiveby" column="archiveby"/>
        <result property="telcode" column="telcode"/>
        <result property="telshortcode" column="telshortcode"/>
        <result property="relativetelcode" column="relativetelcode"/>
        <result property="idcardtype" column="idcardtype"/>
        <result property="orgid" column="orgid"/>
@@ -90,6 +91,7 @@
        <result property="archivetime" column="archivetime"/>
        <result property="archiveby" column="archiveby"/>
        <result property="telcode" column="telcode"/>
        <result property="telshortcode" column="telshortcode"/>
        <result property="relativetelcode" column="relativetelcode"/>
        <result property="idcardtype" column="idcardtype"/>
        <result property="orgid" column="orgid"/>
@@ -153,6 +155,7 @@
               archivetime,
               archiveby,
               telcode,
               telshortcode,
               relativetelcode,
               idcardtype,
               orgid,
@@ -182,11 +185,11 @@
        <include refid="selectPatArchiveVo"/>
        where 1=1
            and del_flag = 0
            <if test="orgid != null and orgid != ''"> and orgid = #{orgid}</if>
            <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if>
            <if test="idcardno != null  and idcardno != ''">and idcardno = #{idcardno}</if>
            <if test="sourcefrom != null ">and sourcefrom = #{sourcefrom}</if>
            <if test="telcode != null  and telcode != ''">and telcode = #{telcode}</if>
            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
            <if test="id != null  and id != ''">and id = #{id}</if>
            <if test="isupload != null ">and isupload = #{isupload}</if>
            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
@@ -211,7 +214,13 @@
            <if test="casePersonAge != null ">and case_person_age = #{casePersonAge}</if>
            <if test="filterDrname != null ">and filter_drname = #{filterDrname}</if>
            <if test="filterDrcode != null ">and filter_drcode = #{filterDrcode}</if>
            <if test="campusid != null ">and campusid = #{campusid}</if>
            <if test="createTimeStart != null">
                AND create_time &gt;= date(#{createTimeStart})
            </if>
            <if test="createTimeEnd != null">
                AND create_time &lt; date(#{createTimeEnd}) + interval 1 day
            </if>
        <if test="pageSize != null  and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
    </select>
@@ -259,6 +268,12 @@
            <if test="idcardno != null  and idcardno != ''">and idcardno = #{idcardno}</if>
            <if test="telcode != null  and telcode != ''">and telcode = #{telcode}</if>
            <if test="campusid != null  and campusid != ''">and campusid = #{campusid}</if>
            <if test="createTimeStart != null">
                AND a.create_time &gt;= date(#{createTimeStart})
            </if>
            <if test="createTimeEnd != null">
                AND a.create_time &lt; date(#{createTimeEnd}) + interval 1 day
            </if>
            <if test="tagIds != null  and tagIds != ''">and c.tagid in
                <foreach collection="tagIds" item="tagId" open="(" separator="," close=")">
                    #{tagId}
@@ -277,6 +292,15 @@
        WHERE patientno IN
        <foreach item="patno" collection="patnos" open="(" separator="," close=")">
            #{patno}
        </foreach>
    </select>
    <select id="selectPatArchiveByPatidHiss" resultMap="PatArchiveResult">
        SELECT id, patid_his
        FROM pat_archive
        WHERE patid_his IN
        <foreach item="patidHis" collection="patidHiss" open="(" separator="," close=")">
            #{patidHis}
        </foreach>
    </select>
@@ -306,6 +330,7 @@
            <if test="archivetime != null">archivetime,</if>
            <if test="archiveby != null">archiveby,</if>
            <if test="telcode != null">telcode,</if>
            <if test="telshortcode != null">telshortcode,</if>
            <if test="relativetelcode != null">relativetelcode,</if>
            <if test="idcardtype != null">idcardtype,</if>
            <if test="orgid != null">orgid,</if>
@@ -356,6 +381,7 @@
            <if test="archivetime != null">#{archivetime},</if>
            <if test="archiveby != null">#{archiveby},</if>
            <if test="telcode != null">#{telcode},</if>
            <if test="telshortcode != null">#{telshortcode},</if>
            <if test="relativetelcode != null">#{relativetelcode},</if>
            <if test="idcardtype != null">#{idcardtype},</if>
            <if test="orgid != null">#{orgid},</if>
@@ -415,6 +441,7 @@
            <if test="archivetime != null">archivetime = #{archivetime},</if>
            <if test="archiveby != null">archiveby = #{archiveby},</if>
            <if test="telcode != null">telcode = #{telcode},</if>
            <if test="telshortcode != null">telshortcode = #{telshortcode},</if>
            <if test="relativetelcode != null">relativetelcode = #{relativetelcode},</if>
            <if test="idcardtype != null">idcardtype = #{idcardtype},</if>
            <if test="orgid != null">orgid = #{orgid},</if>
@@ -491,6 +518,7 @@
        a.archivetime,
        a.archiveby,
        a.telcode,
        a.telshortcode,
        a.relativetelcode,
        a.idcardtype,
        a.orgid,
@@ -526,6 +554,12 @@
                <foreach collection="tagIds" item="tagId" open="(" separator="," close=")">
                    #{tagId}
                </foreach>
            </if>
            <if test="createTimeStart != null">
                AND a.create_time &gt;= date(#{createTimeStart})
            </if>
            <if test="createTimeEnd != null">
                AND a.create_time &lt; date(#{createTimeEnd}) + interval 1 day
            </if>
        order by a.update_time desc
        <if test="pn != null  and ps != null">limit ${pn},${ps}</if>
@@ -564,6 +598,7 @@
        a.archivetime,
        a.archiveby,
        a.telcode,
        a.telshortcode,
        a.relativetelcode,
        a.idcardtype,
        a.orgid,
@@ -596,7 +631,7 @@
            and d.orgid = #{orgid}
            <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
            <if test="idcardno != null  and idcardno != ''">and a.idcardno = #{idcardno}</if>
            <if test="pid != null  and pid != ''">and a.id = #{id}</if>
            <if test="pid != null  and pid != ''">and a.id = #{pid}</if>
            <if test="campusid != null  and campusid != ''">and a.campusid = #{campusid}</if>
            <if test="telcode != null  and telcode != ''">and a.telcode = #{telcode}</if>
            <if test="notrequiredFlag != null  and notrequiredFlag != ''">and a.notrequired_flag = #{notrequiredFlag}
@@ -702,6 +737,7 @@
        a.archivetime,
        a.archiveby,
        a.telcode,
        a.telshortcode,
        a.relativetelcode,
        a.idcardtype,
        a.orgid,
@@ -756,6 +792,12 @@
                    #{pid}
                </foreach>
            </if>
            <if test="createTimeStart != null">
                AND a.create_time &gt;= date(#{createTimeStart})
            </if>
            <if test="createTimeEnd != null">
                AND a.create_time &lt; date(#{createTimeEnd}) + interval 1 day
            </if>
            <if test="isFilter == true">
                AND NOT exists ( SELECT 1 FROM pat_filterlist f where d.patid=f.patid)
            </if>
@@ -795,6 +837,7 @@
        a.archivetime,
        a.archiveby,
        a.telcode,
        a.telshortcode,
        a.relativetelcode,
        a.idcardtype,
        a.orgid,
@@ -846,6 +889,12 @@
                    #{pid}
                </foreach>
            </if>
            <if test="createTimeStart != null">
                AND a.create_time &gt;= date(#{createTimeStart})
            </if>
            <if test="createTimeEnd != null">
                AND a.create_time &lt; date(#{createTimeEnd}) + interval 1 day
            </if>
            <if test="isFilter == true">
                AND NOT exists ( SELECT 1 FROM pat_filterlist f where d.patid=f.patid)
            </if>
@@ -887,6 +936,7 @@
        a.archivetime,
        a.archiveby,
        a.telcode,
        a.telshortcode,
        a.relativetelcode,
        a.idcardtype,
        a.orgid,
@@ -912,16 +962,21 @@
        d.leavehospitaldistrictcode AS leavehospitaldistrictcode
        FROM
        pat_med_inhosp d
        JOIN pat_archive a ON a.id = d.patid
        LEFT JOIN pat_archive a ON a.id = d.patid
        where 1=1
            and d.del_flag != 1
            AND a.del_flag != 1
            and d.orgid = #{orgid}
            <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
            <if test="idcardno != null  and idcardno != ''">and a.idcardno = #{idcardno}</if>
            <if test="pid != null  and pid != ''">and a.id = #{id}</if>
            <if test="pid != null  and pid != ''">and a.id = #{pid}</if>
            <if test="telcode != null  and telcode != ''">and a.telcode = #{telcode}</if>
            <if test="notrequiredFlag != null  and notrequiredFlag != ''">and a.notrequired_flag = #{notrequiredFlag}
            </if>
            <if test="createTimeStart != null">
                AND a.create_time &gt;= date(#{createTimeStart})
            </if>
            <if test="createTimeEnd != null">
                AND a.create_time &lt; date(#{createTimeEnd}) + interval 1 day
            </if>
            <if test="hospitalname != null and hospitalname != ''">
                AND d.hospitalname = #{hospitalname}
@@ -985,7 +1040,7 @@
            </if>
            <if test="pids != null">
                AND a.id NOT IN
                AND d.patid NOT IN
                <foreach collection="pids" item="pid" open="(" separator="," close=")">
                    #{pid}
                </foreach>
@@ -1122,6 +1177,7 @@
        a.archivetime,
        a.archiveby,
        a.telcode,
        a.telshortcode,
        a.relativetelcode,
        a.idcardtype,
        a.orgid,
@@ -1171,6 +1227,12 @@
                    #{pid}
                </foreach>
            </if>
            <if test="createTimeStart != null">
                AND a.create_time &gt;= date(#{createTimeStart})
            </if>
            <if test="createTimeEnd != null">
                AND a.create_time &lt; date(#{createTimeEnd}) + interval 1 day
            </if>
            <if test="isFilter == true">
                AND NOT exists ( SELECT 1 FROM pat_filterlist f where d.patid=f.patid)
            </if>
@@ -1180,18 +1242,11 @@
    <!-- 住院患者总数统计(去重) -->
    <select id="countPatArchiveInfoByInhospQC" parameterType="com.smartor.domain.PatArchiveReq" resultType="long">
        SELECT COUNT(DISTINCT a.id)
        SELECT COUNT(DISTINCT d.patid)
        FROM pat_med_inhosp d
        JOIN pat_archive a ON a.id = d.patid
        WHERE 1=1
            AND d.del_flag != 1
            AND a.del_flag != 1
            AND d.orgid = #{orgid}
            <if test="name != null  and name != ''">AND a.name like concat('%', #{name}, '%')</if>
            <if test="idcardno != null  and idcardno != ''">AND a.idcardno = #{idcardno}</if>
            <if test="pid != null  and pid != ''">AND a.id = #{id}</if>
            <if test="telcode != null  and telcode != ''">AND a.telcode = #{telcode}</if>
            <if test="notrequiredFlag != null  and notrequiredFlag != ''">AND a.notrequired_flag = #{notrequiredFlag}</if>
            <if test="hospitalname != null and hospitalname != ''">AND d.hospitalname = #{hospitalname}</if>
            <if test="hospitaldistrictname != null and hospitaldistrictname != ''">AND d.hospitaldistrictname LIKE concat('%',#{hospitaldistrictname}, '%')</if>
            <if test="leaveicd10code != null and leaveicd10code != ''">AND d.leaveicd10code LIKE concat('%',#{leaveicd10code}, '%')</if>
@@ -1229,7 +1284,7 @@
                </foreach>
            </if>
            <if test="pids != null">
                AND a.id NOT IN
                AND d.patid NOT IN
                <foreach collection="pids" item="pid" open="(" separator="," close=")">
                    #{pid}
                </foreach>