From e6456d2196b3e57bd06be0fbc74dd3e0fc28fdeb Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 22 七月 2025 19:17:55 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 72dba4f..b043a6b 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -170,6 +170,7 @@
                leavehospitaldistrictname,
                leavediagname,
                leaveicd10code,
+               orgid,
                visit_type
         from service_subtask
     </sql>
@@ -414,6 +415,63 @@
           and b.patid = #{patid}
     </select>
 
+    <select id="selectTimelyRate" parameterType="com.smartor.domain.ServiceSubtask" resultType="double">
+        SELECT sum( a.finished )/ sum( 1 ) FROM
+        (SELECT id, visit_time, finishtime,
+        (CASE WHEN ( DATE_FORMAT( visit_time, '%y%m%d' )&lt; DATE_FORMAT( IF ( ISNULL( finishtime ), NOW(), finishtime
+        ), '%y%m%d' ) )
+        THEN 1 ELSE 0 END ) finished,1 AS tasknumber FROM service_subtask
+        WHERE del_flag=0
+        <if test="starttime == null and endtime==null">
+            AND visit_time &lt; NOW()
+        </if>
+        <if test="starttime != null and endtime!=null">
+            AND date_format(visit_time,'%y%m%d') >= date_format(#{starttime},'%y%m%d')
+            AND date_format(visit_time,'%y%m%d') &lt;= date_format(#{endtime},'%y%m%d')
+        </if>
+        <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
+        <if test="deptcode != null  and deptcode != ''">and deptcode = #{deptcode}</if>
+        <if test="deptname != null  and deptname != ''">and deptname = #{deptname}</if>
+        <if test="leavehospitaldistrictcode != null  and leavehospitaldistrictcode != ''">and
+            leavehospitaldistrictcode = #{leavehospitaldistrictcode}
+        </if>
+        <if test="leavehospitaldistrictname != null  and leavehospitaldistrictname != ''">and
+            leavehospitaldistrictname = #{leavehospitaldistrictname}
+        </if>
+        ) a
+    </select>
+
+    <select id="selectTimelyRateDetail" parameterType="com.smartor.domain.ServiceSubtask"
+            resultMap="ServiceSubtaskResult">
+        <include refid="selectServiceSubtaskVo"/>
+        <where>
+            id in (
+            SELECT id FROM
+            (SELECT id, visit_time, finishtime,
+            (CASE WHEN ( DATE_FORMAT( visit_time, '%y%m%d' ) &lt; DATE_FORMAT( IF ( ISNULL( finishtime ), NOW(),
+            finishtime
+            ), '%y%m%d' ) )
+            THEN 1 ELSE 0 END ) finished,1 AS tasknumber FROM service_subtask
+            WHERE del_flag=0
+            -- AND visit_time &lt; NOW()
+            <if test="starttime != null and endtime!=null">
+                AND date_format(visit_time,'%y%m%d') >= date_format(#{starttime},'%y%m%d')
+                AND date_format(visit_time,'%y%m%d') &lt;= date_format(#{endtime},'%y%m%d')
+            </if>
+            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
+            <if test="deptcode != null  and deptcode != ''">and deptcode = #{deptcode}</if>
+            <if test="deptname != null  and deptname != ''">and deptname = #{deptname}</if>
+            <if test="leavehospitaldistrictcode != null  and leavehospitaldistrictcode != ''">and
+                leavehospitaldistrictcode = #{leavehospitaldistrictcode}
+            </if>
+            <if test="leavehospitaldistrictname != null  and leavehospitaldistrictname != ''">and
+                leavehospitaldistrictname = #{leavehospitaldistrictname}
+            </if>
+
+            ) a where a.finished =1)
+        </where>
+    </select>
+
     <select id="selectServiceSubtaskById" parameterType="Long" resultMap="ServiceSubtaskResult">
         <include refid="selectServiceSubtaskVo"/>
         where id = #{id}

--
Gitblit v1.9.3