From 2d42d335a0abdabf02601b63b85dda82f5b0781b Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期一, 02 十一月 2026 16:51:05 +0800
Subject: [PATCH] 【丽水】新增再次随访 回院复诊复查 统计
---
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml | 61 ++++++++++++++++++++++--------
1 files changed, 45 insertions(+), 16 deletions(-)
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 53aefec..a420116 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -573,7 +573,7 @@
<if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
<if test="pid != null ">and pid = #{pid}</if>
<if test="preachform != null ">and preachform = #{preachform}</if>
- <if test="currentPreachform != null ">and current_preachform = #{currentPreachform}</if>
+ <if test="currentPreachform != null and currentPreachform != '' ">and current_preachform = #{currentPreachform}</if>
<if test="currentPreachforms != null and currentPreachforms != ''">
and FIND_IN_SET(<include refid="effectiveCurrentPreachformExpr"/>, #{currentPreachforms})
</if>
@@ -723,7 +723,7 @@
<if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if>
<if test="managementDoctorCode != null">and management_doctor_code = #{managementDoctorCode}</if>
<if test="managementDoctor != null">and management_doctor = #{managementDoctor}</if>
- <if test="currentPreachform != null">and current_preachform = #{currentPreachform}</if>
+ <if test="currentPreachform != null and currentPreachform != '' ">and current_preachform = #{currentPreachform}</if>
<if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
<if test="continueFlag != null ">and continue_flag = #{continueFlag}</if>
<if test="continueTimeNow != null ">and continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP}</if>
@@ -783,7 +783,7 @@
<if test="visitTime != null ">and visit_time = #{visitTime}</if>
<if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
<if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if>
- <if test="currentPreachform != null">and current_preachform = #{currentPreachform}</if>
+ <if test="currentPreachform != null and currentPreachform != '' ">and current_preachform = #{currentPreachform}</if>
<if test="managementDoctorCode != null">and management_doctor_code = #{managementDoctorCode}</if>
<if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
<if test="managementDoctor != null">and management_doctor like concat('%',#{managementDoctor}, '%')</if>
@@ -1087,7 +1087,7 @@
<if test="visitDeptName != null">visit_dept_name,</if>
<if test="managementDoctorCode != null">management_doctor_code,</if>
<if test="managementDoctor != null">management_doctor,</if>
- <if test="currentPreachform != null">current_preachform,</if>
+ <if test="currentPreachform != null and currentPreachform != '' ">current_preachform,</if>
<if test="taskSituation != null">task_situation,</if>
<if test="isabnormal != null">isabnormal,</if>
<if test="continueFlag != null ">continue_flag,</if>
@@ -1187,7 +1187,7 @@
<if test="visitDeptName != null">#{visitDeptName},</if>
<if test="managementDoctorCode != null">#{managementDoctorCode},</if>
<if test="managementDoctor != null">#{managementDoctor},</if>
- <if test="currentPreachform != null">#{currentPreachform},</if>
+ <if test="currentPreachform != null and currentPreachform != '' ">#{currentPreachform},</if>
<if test="taskSituation != null">#{taskSituation},</if>
<if test="isabnormal != null">#{isabnormal},</if>
<if test="continueFlag != null ">#{continueFlag},</if>
@@ -1301,7 +1301,7 @@
<if test="visitDeptName != null">visit_dept_name = #{visitDeptName},</if>
<if test="managementDoctorCode != null">management_doctor_code = #{managementDoctorCode},</if>
<if test="managementDoctor != null">management_doctor=#{managementDoctor},</if>
- <if test="currentPreachform != null">current_preachform=#{currentPreachform},</if>
+ <if test="currentPreachform != null and currentPreachform != '' ">current_preachform=#{currentPreachform},</if>
<if test="taskSituation != null">task_situation=#{taskSituation},</if>
<if test="isabnormal != null">isabnormal=#{isabnormal},</if>
<if test="continueFlag != null ">continue_flag = #{continueFlag},</if>
@@ -1407,7 +1407,7 @@
<if test="visitDeptName != null">visit_dept_name = #{visitDeptName},</if>
<if test="managementDoctorCode != null">management_doctor_code = #{managementDoctorCode},</if>
<if test="managementDoctor != null">management_doctor=#{managementDoctor},</if>
- <if test="currentPreachform != null">current_preachform=#{currentPreachform},</if>
+ <if test="currentPreachform != null and currentPreachform != '' ">current_preachform=#{currentPreachform},</if>
<if test="taskSituation != null">task_situation=#{taskSituation},</if>
<if test="isabnormal != null">isabnormal=#{isabnormal},</if>
<if test="continueFlag != null ">continue_flag = #{continueFlag},</if>
@@ -1512,7 +1512,7 @@
<if test="visitDeptName != null">visit_dept_name = #{visitDeptName},</if>
<if test="managementDoctorCode != null">management_doctor_code = #{managementDoctorCode},</if>
<if test="managementDoctor != null">management_doctor=#{managementDoctor},</if>
- <if test="currentPreachform != null">current_preachform=#{currentPreachform},</if>
+ <if test="currentPreachform != null and currentPreachform != '' ">current_preachform=#{currentPreachform},</if>
<if test="taskSituation != null">task_situation=#{taskSituation},</if>
<if test="isabnormal != null">isabnormal=#{isabnormal},</if>
<if test="continueFlag != null ">continue_flag = #{continueFlag},</if>
@@ -1625,7 +1625,7 @@
<if test="visitDeptName != null">visit_dept_name = #{visitDeptName},</if>
<if test="managementDoctorCode != null">management_doctor_code = #{managementDoctorCode},</if>
<if test="managementDoctor != null">management_doctor=#{managementDoctor},</if>
- <if test="currentPreachform != null">current_preachform=#{currentPreachform},</if>
+ <if test="currentPreachform != null and currentPreachform != '' ">current_preachform=#{currentPreachform},</if>
<if test="taskSituation != null">task_situation=#{taskSituation},</if>
<if test="isabnormal != null">isabnormal=#{isabnormal},</if>
<if test="continueFlag != null ">continue_flag = #{continueFlag},</if>
@@ -1655,6 +1655,35 @@
where patid = #{patid} and taskid = #{taskid}
</update>
+ <!-- 浜哄伐闅忚锛氳蒋鍒犻櫎鎮h�呭嚭闄㈣褰曞搴旂殑鏈畬鎴愰殢璁夸换鍔� -->
+ <update id="deleteUnfinishedServiceSubtaskByInhospids">
+ update service_subtask
+ set del_flag = 1
+ where del_flag = 0
+ and patid = #{patid}
+ and sendstate in
+ <foreach collection="sendstates" item="sendstate" open="(" separator="," close=")">
+ #{sendstate}
+ </foreach>
+ and inhospid in
+ <foreach collection="inhospids" item="inhospid" open="(" separator="," close=")">
+ #{inhospid}
+ </foreach>
+ </update>
+
+ <!-- 浜哄伐闅忚閲嶅鏍¢獙锛氬悓涓�鎮h�呭悓涓�浠诲姟涓嬫槸鍚﹀凡鏈夋湭瀹屾垚闅忚浠诲姟 -->
+ <select id="countUnfinishedServiceSubtaskByPatidAndTaskid" resultType="int">
+ select count(1)
+ from service_subtask
+ where del_flag = 0
+ and patid = #{patid}
+ and taskid = #{taskid}
+ and sendstate in
+ <foreach collection="sendstates" item="sendstate" open="(" separator="," close=")">
+ #{sendstate}
+ </foreach>
+ </select>
+
<select id="getSfStatistics" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
resultMap="ServiceSubtaskResult">
select id,
@@ -1672,7 +1701,7 @@
deptname,
sendstate,
preachform,
- current_preachform,
+ <include refid="effectiveCurrentPreachformExpr"/> AS current_preachform,
excep,
nurse_id,
nurse_name,
@@ -1941,9 +1970,6 @@
<if test="groupKey != null and groupKey != ''">
group by ${groupKey}
</if>
- <if test="pageSize != null and pageNum != null">
- limit ${pageSize} OFFSET ${pageNum}
- </if>
</select>
<select id="getSfStatisticsHyperlink" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
@@ -1961,7 +1987,7 @@
deptname,
sendstate,
preachform,
- current_preachform,
+ <include refid="effectiveCurrentPreachformExpr"/> AS current_preachform,
excep,
nurse_id,
nurse_name,
@@ -2061,8 +2087,8 @@
#{state}
</foreach>
</if>
- <if test="currentPreachform != null">
- AND current_preachform = #{currentPreachform}
+ <if test="currentPreachform != null and currentPreachform != '' ">
+ AND <include refid="effectiveCurrentPreachformExpr"/> = #{currentPreachform}
<if test="followUpCountStyle != null and followUpCountStyle = '1'">
AND sendstate != 4
</if>
@@ -2088,6 +2114,9 @@
<if test="isManuallyCalled != null">
AND is_manually_called = #{isManuallyCalled}
</if>
+ <if test="suggest != null and suggest != ''">
+ AND TRIM(suggest) = #{suggest}
+ </if>
order by endtime desc
<if test="pageSize != null and pageNum != null">
limit ${pageSize} OFFSET ${pageNum}
--
Gitblit v1.9.3