From df0c3a49e3ff31e59506a95964b513b2fe3d86a1 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期四, 20 八月 2026 17:04:39 +0800
Subject: [PATCH] 【丽水】出院手术随访

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

diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
index f661975..7054aae 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
@@ -240,6 +240,13 @@
                 #{scriptId}
             </foreach>
         </if>
+        <if test="isFilled != null and isFilled != '0'">
+            AND IFNULL(ssd.matchedtext,ssd.asrtext) is not null
+            AND IFNULL(ssd.matchedtext,ssd.asrtext) != ''
+        </if>
+        <if test="configValue != null and configValue != ''">
+            AND ssd.categoryid IN (${configValue})
+        </if>
         order by ssd.sub_id desc, ssd.id desc
     </select>
     <select id="selectServiceSubtaskDetailByCalldetailid" parameterType="String" resultMap="ServiceSubtaskDetailResult">
@@ -539,4 +546,34 @@
             ivr_liba_target.targetname,
             service_subtask_detail.matchedtext
     </select>
+
+    <select id="selectRepeatDetailIds" resultType="Long">
+        SELECT d1.id
+        FROM service_subtask_detail d1
+        INNER JOIN (
+            SELECT sub_id, questiontext,
+                   MAX(create_time) AS max_create_time,
+                   MAX(id) AS keep_id
+            FROM service_subtask_detail
+            WHERE del_flag = 0
+            GROUP BY sub_id, questiontext
+            HAVING COUNT(*) &gt; 1
+        ) d2 ON d1.sub_id = d2.sub_id
+            AND d1.questiontext = d2.questiontext
+            AND (
+                d1.create_time &lt; d2.max_create_time
+                OR (d1.create_time = d2.max_create_time AND d1.id &lt; d2.keep_id)
+            )
+        WHERE d1.del_flag = 0
+    </select>
+
+    <update id="deleteRepeatDetailByIds">
+        UPDATE service_subtask_detail
+        SET del_flag = 1
+        WHERE del_flag = 0
+        AND id IN
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
 </mapper>

--
Gitblit v1.9.3