From 43e807c405e8cf5b725d1ced5490128da191eb98 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期五, 30 十月 2026 11:34:38 +0800
Subject: [PATCH] 【丽水】/smartor/patinhosp/addManualVisit 人工处理,接口完成删除未完成的任务,再次生成随访任务

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

diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 2de4dec..5ea51de 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -303,6 +303,11 @@
         END
     </sql>
 
+    <!-- 褰撳墠鎵ц鏂瑰紡锛氶娆¢殢璁� current_preachform 涓虹┖鏃讹紝鍙� preachform 鐨勭涓�涓墽琛屾柟寮忓厹搴� -->
+    <sql id="effectiveCurrentPreachformExpr">
+        COALESCE(NULLIF(TRIM(current_preachform), ''), TRIM(SUBSTRING_INDEX(preachform, ',', 1)))
+    </sql>
+
     <select id="selectServiceSubtaskBySendstate" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
             resultMap="ServiceSubtaskResult">
         <include refid="selectServiceSubtaskVo"/>
@@ -569,6 +574,9 @@
         <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="currentPreachforms != null and currentPreachforms != ''">
+            and FIND_IN_SET(<include refid="effectiveCurrentPreachformExpr"/>, #{currentPreachforms})
+        </if>
         <if test="guid != null  and guid != ''">and guid = #{guid}</if>
         <if test="textParam != null  and textParam != ''">and text_param = #{textParam}</if>
         <if test="bedNo != null">and bed_no = #{bedNo}</if>
@@ -1647,6 +1655,22 @@
         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>
+
     <select id="getSfStatistics" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
             resultMap="ServiceSubtaskResult">
         select id,
@@ -1671,6 +1695,7 @@
         taskid,
         task_name,
         visit_time,
+        visit_dept_code,
         finishtime,
         endtime,
         senddate,
@@ -1959,6 +1984,8 @@
         taskid,
         task_name,
         visit_time,
+        visit_dept_code,
+        visit_dept_name,
         finishtime,
         endtime,
         senddate,
@@ -2919,6 +2946,9 @@
                 #{state}
             </foreach>
         </if>
+        <if test="currentPreachforms != null and currentPreachforms != ''">
+            AND FIND_IN_SET(<include refid="effectiveCurrentPreachformExpr"/>, #{currentPreachforms})
+        </if>
         <if test="orgid != null and orgid != ''">
             AND orgid = #{orgid}
         </if>

--
Gitblit v1.9.3