liusheng
2024-08-02 57ae7faf87e490576141ff19727057d2f7ad1840
smartor/src/main/resources/mapper/smartor/PatArchiveOutMapper.xml
@@ -112,6 +112,45 @@
        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