From 562abd91fccfa2e73c1fb0d85fbd986ce1bf6dd6 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期一, 26 一月 2026 16:00:00 +0800
Subject: [PATCH] 【丽水】新增参数followUpCountStyle控制随访统计方式 1-默认统计方式 2-统计时算上不发送的
---
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml | 142 ++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 138 insertions(+), 4 deletions(-)
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 06bb5ab..64cc180 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -278,6 +278,14 @@
<if test="senderdetail != null and senderdetail != ''">and senderdetail = #{senderdetail}</if>
<if test="type != null and type != ''">and type = #{type}</if>
<if test="taskid != null ">and taskid = #{taskid}</if>
+ <!-- taskIds绛涢�� -->
+ <if test="taskIds != null and taskIds.size() > 0">
+ AND taskid IN
+ <foreach collection="taskIds" item="itemTaskId" open="(" separator=","
+ close=")">
+ #{itemTaskId}
+ </foreach>
+ </if>
<if test="templateid != null and templateid != ''">and templateid = #{templateid}</if>
<if test="templatename != null and templatename != ''">and templatename like concat('%', #{templatename},
'%')
@@ -552,6 +560,45 @@
<if test="managementDoctor != null">and management_doctor like concat('%',#{managementDoctor}, '%')</if>
) 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">
@@ -1171,7 +1218,39 @@
<select id="getSfStatistics" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
resultMap="ServiceSubtaskResult">
- <include refid="selectServiceSubtaskVo"/>
+ select id,
+ visit_count,
+ is_visit_again,
+ type,
+ orgid,
+ drcode,
+ drname,
+ leavehospitaldistrictcode,
+ leavehospitaldistrictname,
+ deptcode,
+ deptname,
+ sendstate,
+ preachform,
+ excep,
+ nurse_id,
+ nurse_name,
+ taskid,
+ task_name,
+ visit_time,
+ finishtime,
+ endtime,
+ senddate,
+ suggest,
+ result,
+ templateid,
+ templatename,
+ patid,
+ sendname,
+ send_type,
+ recordid,
+ exrecallcount,
+ task_situation
+ from service_subtask
where 1=1
and del_flag = 0
<if test="orgid != null and orgid != ''">
@@ -1198,16 +1277,71 @@
#{serviceType}
</foreach>
</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>
+ <!-- 鐩墠鍙粺璁¤闊冲拰闂嵎 -->
+ <if test="type != null">
+ and type = #{type}
+ </if>
+ <if test="groupKey != null and groupKey != '' and groupKeyList != null and groupKeyList.size>0">
+ AND ${groupKey} IN
+ <foreach collection="groupKeyList" item="key" open="(" separator=","
+ close=")">
+ #{key}
+ </foreach>
+ </if>
+ </select>
+ <select id="getSfStatisticsGroupKey" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
+ resultType="String">
+ select
+ <if test="groupKey != null and groupKey != ''">
+ ${groupKey} as groupKey
+ </if>
+ from service_subtask
+ where 1=1
+ and del_flag = 0
+ <if test="orgid != null and orgid != ''">
+ and orgid = #{orgid}
+ </if>
+ <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
+ AND leavehospitaldistrictcode IN
+ <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
+ close=")">
+ #{leavehospitaldistrictcode}
+ </foreach>
+ </if>
+ <if test="deptcodes != null and deptcodes.size() > 0">
+ AND deptcode IN
+ <foreach collection="deptcodes" item="deptcode" open="(" separator=","
+ close=")">
+ #{deptcode}
+ </foreach>
+ </if>
+ <if test="serviceType != null and serviceType.size() > 0">
+ AND service_type IN
+ <foreach collection="serviceType" item="serviceType" open="(" separator=","
+ close=")">
+ #{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')
+ 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>
<!-- 鐩墠鍙粺璁¤闊冲拰闂嵎 -->
<if test="type != null">
- and type = #{type}
+ and type = #{type}
+ </if>
+ <if test="groupKey != null and groupKey != ''">
+ group by ${groupKey}
</if>
<if test="pageSize != null and pageNum != null">
limit ${pageSize} OFFSET ${pageNum}
--
Gitblit v1.9.3