sinake
2025-09-24 b0e0b4c0e342865daefb31eb3b956129fe722c8c
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -175,7 +175,9 @@
               leavediagname,
               leaveicd10code,
               orgid,
               visit_type
               visit_type,
               management_doctor,
               management_doctor_code
        from service_subtask
    </sql>
@@ -336,6 +338,8 @@
        <if test="sort != null  and sort==3">order by long_send_time desc</if>
        <if test="sort != null  and sort==5">order by admindate asc</if>
        <if test="sort != null  and sort==6">order by admindate desc</if>
        <if test="sort != null  and sort==7">order by visit_time asc</if>
        <if test="sort != null  and sort==8">order by visit_time desc</if>
        <!-- order by update_time desc,id desc -->
    </select>
@@ -1227,8 +1231,12 @@
        0 AS pmiCount,
        0 AS pmoCount
        FROM service_subtask
        WHERE visit_time BETWEEN #{startDate} AND #{endDate}
        AND del_flag = '0'
        WHERE
        del_flag = '0'
        <if test="startDate != null and endDate != null">
            and date_format(visit_time,'%y%m%d') &gt;= date_format(#{startDate},'%y%m%d')
            and date_format(visit_time,'%y%m%d') &lt;= date_format(#{endDate},'%y%m%d')
        </if>
        <if test="orgid != null">
            AND orgid = #{orgid}
@@ -1297,12 +1305,16 @@
        </choose>
        0 AS dischargeFollowCount,
        0 AS outpatientFollowCount,
        COUNT(DISTINCT patid) AS pmiCount,
        COUNT( patid) AS pmiCount,
        0 AS pmoCount
        FROM pat_med_inhosp
        WHERE endtime BETWEEN #{startDate} AND #{endDate}
        AND del_flag = '0'
        WHERE del_flag = '0'
        <if test="startDate != null and endDate != null">
            and date_format(endtime,'%y%m%d') &gt;= date_format(#{startDate},'%y%m%d')
            and date_format(endtime,'%y%m%d') &lt;= date_format(#{endDate},'%y%m%d')
        </if>
        AND inhospstate=1
        <if test="orgid != null">
            AND orgid = #{orgid}
        </if>
@@ -1364,11 +1376,13 @@
        0 AS dischargeFollowCount,
        0 AS outpatientFollowCount,
        0 AS pmiCount,
        COUNT(DISTINCT patid) AS pmoCount
        COUNT( patid) AS pmoCount
        FROM pat_med_outhosp
        WHERE admitdate BETWEEN #{startDate} AND #{endDate}
        AND del_flag = '0'
        WHERE del_flag = '0'
        <if test="startDate != null and endDate != null">
            and date_format(admitdate,'%y%m%d') &gt;= date_format(#{startDate},'%y%m%d')
            and date_format(admitdate,'%y%m%d') &lt;= date_format(#{endDate},'%y%m%d')
        </if>
        <if test="orgid != null">
            AND orgid = #{orgid}
        </if>