From 9b96619ab91dce35b606faa3f4e0468ec702fd69 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期四, 22 一月 2026 15:25:11 +0800
Subject: [PATCH] 【丽水】getSfStatisticsScript 优化
---
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml | 49 ++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 44 insertions(+), 5 deletions(-)
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 1e884f0..30e4c15 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -561,6 +561,45 @@
) a
</select>
+ <select id="selectTimelyRateBatch" parameterType="com.smartor.domain.ServiceSubtask" resultType="map">
+ SELECT
+ <if test="groupKey != null and groupKey != ''">
+ ${groupKey} as groupKey,
+ </if>
+ SUM(CASE WHEN DATE(visit_time) < DATE(IFNULL(finishtime, NOW())) THEN 1 ELSE 0 END) / COUNT(*) as rate
+ FROM service_subtask
+ WHERE del_flag = 0
+ <if test="orgid != null">AND orgid = #{orgid}</if>
+ <if test="starttime == null and endtime==null">
+ AND visit_time < NOW()
+ </if>
+ <if test="starttime != null and endtime!=null">
+ AND visit_time >= #{starttime}
+ AND visit_time < DATE_ADD(#{endtime}, INTERVAL 1 DAY)
+ </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="isabnormal != null">and isabnormal = #{isabnormal}</if>
+ <if test="leavehospitaldistrictcode != null and leavehospitaldistrictcode != ''">and
+ leavehospitaldistrictcode = #{leavehospitaldistrictcode}
+ </if>
+ <if test="leavehospitaldistrictname != null and leavehospitaldistrictname != ''">and
+ leavehospitaldistrictname = #{leavehospitaldistrictname}
+ </if>
+ <if test="managementDoctorCode != null">and management_doctor_code = #{managementDoctorCode}</if>
+ <if test="managementDoctor != null">and management_doctor like concat('%',#{managementDoctor}, '%')</if>
+ <if test="groupKey != null and groupKey != ''">
+ AND ${groupKey} IN
+ <foreach collection="groupKeyList" item="key" open="(" separator=","
+ close=")">
+ #{key}
+ </foreach>
+ GROUP BY ${groupKey}
+ </if>
+ </select>
+
+
<select id="selectTimelyRateDetail" parameterType="com.smartor.domain.ServiceSubtask"
resultMap="ServiceSubtaskResult">
<include refid="selectServiceSubtaskVo"/>
@@ -1206,11 +1245,11 @@
#{serviceType}
</foreach>
</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') <= date_format(#{endTime},'%y%m%d')
- </if>
- <if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
+ <if test="startTime != null and endTime!=null">
+ AND visit_time >= DATE(#{startTime})
+ AND visit_time < DATE_ADD(DATE(#{endTime}), INTERVAL 1 DAY)
+ </if>
+ <if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
<if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if>
<if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
<!-- 鐩墠鍙粺璁¤闊冲拰闂嵎 -->
--
Gitblit v1.9.3