From 85a5ca43ff5a05dcb34d4e90b9c96fd0dd16aa2f Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期五, 22 五月 2026 16:00:43 +0800
Subject: [PATCH] 【丽水】暂时不加 campusid

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

diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
index bec2bd9..0591b17 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
@@ -18,6 +18,7 @@
         <result property="assigntime" column="assigntime"/>
         <result property="starttime" column="starttime"/>
         <result property="answertime" column="answertime"/>
+
         <result property="silent" column="silent"/>
         <result property="dtmfKey" column="dtmf_key"/>
         <result property="musicpath" column="musicpath"/>
@@ -35,6 +36,7 @@
         <result property="questiontext" column="questiontext"/>
         <result property="questionvoice" column="questionvoice"/>
         <result property="categoryname" column="categoryname"/>
+        <result property="categoryid" column="categoryid"/>
         <result property="targetoptions" column="targetoptions"/>
         <result property="targetvalue" column="targetvalue"/>
         <result property="matchedtext" column="matchedtext"/>
@@ -54,7 +56,9 @@
         <result property="patid" column="patid"/>
         <result property="guid" column="guid"/>
         <result property="extemplateText" column="extemplate_text"/>
-        <result property="answerps" column="answerps"/>
+        <result property="templateType" column="template_type"/>
+        <result property="libTemplateid" column="lib_templateid"/>
+        <result property="score" column="score"/>
     </resultMap>
     <resultMap type="com.smartor.domain.ServiceSubtaskDetailTarget" id="ServiceSubtaskDetailTargetResult">
         <result property="targetid" column="targetid"/>
@@ -66,6 +70,7 @@
     <sql id="selectServiceSubtaskDetailVo">
         select id,
                sub_id,
+               lib_templateid,
                targetid,
                answerps,
                scriptid,
@@ -100,6 +105,7 @@
                questiontext,
                questionvoice,
                categoryname,
+               categoryid,
                targetoptions,
                targetvalue,
                matchedtext,
@@ -112,68 +118,147 @@
                update_by,
                update_time,
                value_type,
-               create_by,
-               answerps
+               template_type,
+               score,
+               create_by
         from service_subtask_detail
     </sql>
 
     <select id="selectServiceSubtaskDetailList" parameterType="com.smartor.domain.ServiceSubtaskDetail"
             resultMap="ServiceSubtaskDetailResult">
         <include refid="selectServiceSubtaskDetailVo"/>
-        <where>
-            <if test="subId != null">and sub_id = #{subId}</if>
-            <if test="targetid != null">and targetid = #{targetid}</if>
-            <if test="extemplateText != null">and extemplate_text = #{extemplateText}</if>
-            <if test="taskid != null">and taskid = #{taskid}</if>
-            <if test="uuid != null  and uuid != ''">and uuid = #{uuid}</if>
-            <if test="phone != null  and phone != ''">and phone = #{phone}</if>
-            <if test="operate != null  and operate != ''">and operate = #{operate}</if>
-            <if test="displayno != null  and displayno != ''">and displayno = #{displayno}</if>
-            <if test="inbound != null ">and inbound = #{inbound}</if>
-            <if test="incoming != null ">and incoming = #{incoming}</if>
-            <if test="assigntime != null ">and assigntime = #{assigntime}</if>
-            <if test="starttime != null ">and starttime = #{starttime}</if>
-            <if test="answertime != null ">and answertime = #{answertime}</if>
-            <if test="silent != null ">and silent = #{silent}</if>
-            <if test="dtmfKey != null  and dtmfKey != ''">and dtmf_key = #{dtmfKey}</if>
-            <if test="musicpath != null  and musicpath != ''">and musicpath = #{musicpath}</if>
-            <if test="sentIndex != null ">and sent_index = #{sentIndex}</if>
-            <if test="sentBegin != null ">and sent_begin = #{sentBegin}</if>
-            <if test="asrtext != null  and asrtext != ''">and asrtext = #{asrtext}</if>
-            <if test="beginTime != null ">and begin_time = #{beginTime}</if>
-            <if test="endTime != null ">and end_time = #{endTime}</if>
-            <if test="sentEnd != null ">and sent_end = #{sentEnd}</if>
-            <if test="recordpath != null  and recordpath != ''">and recordpath = #{recordpath}</if>
-            <if test="recordurl != null  and recordurl != ''">and recordurl = #{recordurl}</if>
-            <if test="templateid != null  and templateid != ''">and templateid = #{templateid}</if>
-            <if test="templatequestionnum != null ">and templatequestionnum = #{templatequestionnum}</if>
-            <if test="switchid != null ">and switchid = #{switchid}</if>
-            <if test="questiontext != null  and questiontext != ''">and questiontext = #{questiontext}</if>
-            <if test="questionvoice != null  and questionvoice != ''">and questionvoice = #{questionvoice}</if>
-            <if test="categoryname != null  and categoryname != ''">and categoryname like concat('%', #{categoryname},
-                '%')
-            </if>
-            <if test="targetoptions != null  and targetoptions != ''">and targetoptions = #{targetoptions}</if>
-            <if test="targetvalue != null  and targetvalue != ''">and targetvalue = #{targetvalue}</if>
-            <if test="matchedtext != null  and matchedtext != ''">and matchedtext = #{matchedtext}</if>
-            <if test="addtime != null ">and addtime = #{addtime}</if>
-            <if test="isupload != null ">and isupload = #{isupload}</if>
-            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
-            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
-            <if test="valueType != null  and valueType != ''">and value_type = #{valueType}</if>
-            <if test="answerps != null  and answerps != ''">and answerps = #{answerps}</if>
-            <if test="comment != null  and comment != ''">and comment = #{comment}</if>
-            <if test="scriptid != null ">and scriptid = #{scriptid}</if>
-            <if test=" patid != null">and patid = #{patid}</if>
-        </where>
+        where 1=1
+        <if test="subId != null">and sub_id = #{subId}</if>
+        <if test="templateType != null">and template_type = #{templateType}</if>
+        <if test="libTemplateid != null">and lib_templateid = #{libTemplateid}</if>
+        <if test="targetid != null">and targetid = #{targetid}</if>
+        <if test="extemplateText != null">and extemplate_text = #{extemplateText}</if>
+        <if test="taskid != null">and taskid = #{taskid}</if>
+        <if test="uuid != null  and uuid != ''">and uuid = #{uuid}</if>
+        <if test="phone != null  and phone != ''">and phone = #{phone}</if>
+        <if test="operate != null  and operate != ''">and operate = #{operate}</if>
+        <if test="displayno != null  and displayno != ''">and displayno = #{displayno}</if>
+        <if test="inbound != null ">and inbound = #{inbound}</if>
+        <if test="incoming != null ">and incoming = #{incoming}</if>
+        <if test="assigntime != null ">and assigntime = #{assigntime}</if>
+        <if test="starttime != null ">and starttime = #{starttime}</if>
+        <if test="answertime != null ">and answertime = #{answertime}</if>
+        <if test="silent != null ">and silent = #{silent}</if>
+        <if test="dtmfKey != null  and dtmfKey != ''">and dtmf_key = #{dtmfKey}</if>
+        <if test="musicpath != null  and musicpath != ''">and musicpath = #{musicpath}</if>
+        <if test="sentIndex != null ">and sent_index = #{sentIndex}</if>
+        <if test="sentBegin != null ">and sent_begin = #{sentBegin}</if>
+        <if test="asrtext != null  and asrtext != ''">and asrtext = #{asrtext}</if>
+        <if test="beginTime != null ">and begin_time = #{beginTime}</if>
+        <if test="endTime != null ">and end_time = #{endTime}</if>
+        <if test="sentEnd != null ">and sent_end = #{sentEnd}</if>
+        <if test="recordpath != null  and recordpath != ''">and recordpath = #{recordpath}</if>
+        <if test="recordurl != null  and recordurl != ''">and recordurl = #{recordurl}</if>
+        <if test="templateid != null  and templateid != ''">and templateid = #{templateid}</if>
+        <if test="templatequestionnum != null ">and templatequestionnum = #{templatequestionnum}</if>
+        <if test="switchid != null ">and switchid = #{switchid}</if>
+        <if test="categoryid != null ">and categoryid = #{categoryid}</if>
+        <if test="questiontext != null  and questiontext != ''">and questiontext = #{questiontext}</if>
+        <if test="questionvoice != null  and questionvoice != ''">and questionvoice = #{questionvoice}</if>
+        <if test="categoryname != null  and categoryname != ''">and categoryname like concat('%', #{categoryname},
+            '%')
+        </if>
+        <if test="targetoptions != null  and targetoptions != ''">and targetoptions = #{targetoptions}</if>
+        <if test="targetvalue != null  and targetvalue != ''">and targetvalue = #{targetvalue}</if>
+        <if test="matchedtext != null  and matchedtext != ''">and matchedtext = #{matchedtext}</if>
+        <if test="addtime != null ">and addtime = #{addtime}</if>
+        <if test="isupload != null ">and isupload = #{isupload}</if>
+        <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
+        <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
+        <if test="valueType != null  and valueType != ''">and value_type = #{valueType}</if>
+        <if test="answerps != null  and answerps != ''">and answerps = #{answerps}</if>
+        <if test="comment != null  and comment != ''">and comment = #{comment}</if>
+        <if test="scriptid != null ">and scriptid = #{scriptid}</if>
+        <if test="patid != null">and patid = #{patid}</if>
+        <if test="score != null">and score = #{score}</if>
+
     </select>
 
+    <select id="getServiceSubtaskDetails" parameterType="com.smartor.domain.ServiceSubtaskDetailVO"
+            resultType="java.util.HashMap">
+        select
+            ssd.sub_id,
+            ssd.taskid,
+            ssd.patid,
+            sd.sendname,
+            ssd.questiontext,
+            ssd.matchedtext,
+            ssd.asrtext,
+            ssd.scriptid,
+            ssd.targetid,
+            ssd.template_type,
+            ssd.lib_templateid,
+            sd.deptcode,
+            sd.deptname,
+            sd.leavehospitaldistrictcode,
+            sd.leavehospitaldistrictname
+        from service_subtask_detail ssd
+        inner join service_subtask sd on ssd.sub_id = sd.id
+        where ssd.del_flag = '0'
+        and sd.del_flag = '0'
+        <if test="orgid != null and orgid != ''">and ssd.orgid = #{orgid}</if>
+        <if test="subId != null">and ssd.sub_id = #{subId}</if>
+        <if test="taskid != null">and ssd.taskid = #{taskid}</if>
+        <if test="questiontext != null and questiontext != ''">and ssd.questiontext = #{questiontext}</if>
+        <if test="matchedtext != null and matchedtext != ''">and ssd.matchedtext = #{matchedtext}</if>
+        <if test="asrtext != null and asrtext != ''">and ssd.asrtext = #{asrtext}</if>
+        <if test="scriptid != null">and ssd.scriptid = #{scriptid}</if>
+        <if test="patid != null">and ssd.patid = #{patid}</if>
+        <if test="templateType != null">and ssd.template_type = #{templateType}</if>
+        <if test="libTemplateid != null">and ssd.lib_templateid = #{libTemplateid}</if>
+        <if test="targetid != null">and ssd.targetid = #{targetid}</if>
+        <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
+            and sd.leavehospitaldistrictcode in
+            <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator="," close=")">
+                #{leavehospitaldistrictcode}
+            </foreach>
+        </if>
+        <if test="leaveldeptcodes != null and leaveldeptcodes.size() > 0">
+            and sd.deptcode in
+            <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator="," close=")">
+                #{leaveldeptcode}
+            </foreach>
+        </if>
+        <if test="scriptIds != null and scriptIds.size() > 0">
+            and ssd.scriptid in
+            <foreach collection="scriptIds" item="scriptId" open="(" separator="," close=")">
+                #{scriptId}
+            </foreach>
+        </if>
+        order by ssd.sub_id desc, ssd.id desc
+    </select>
     <select id="selectServiceSubtaskDetailByCalldetailid" parameterType="String" resultMap="ServiceSubtaskDetailResult">
         <include refid="selectServiceSubtaskDetailVo"/>
         where id = #{id}
     </select>
 
-    <insert id="insertServiceSubtaskDetail" parameterType="com.smartor.domain.ServiceSubtaskDetail">
+    <select id="queryFillCount" resultType="com.smartor.domain.DTO.ServiceSubtaskDetailDTO">
+        select id,questiontext,matchedtext,targetvalue,score
+        from service_subtask_detail
+        where del_flag = 0
+        and sub_id in
+        <foreach item="subid" collection="subids" open="(" separator="," close=")">
+            #{subid}
+        </foreach>
+        <if test="questiontext != null">and questiontext = #{questiontext}</if>
+    </select>
+
+    <select id="isExistServiceSubtaskDetail" resultType="com.smartor.domain.DTO.ServiceSubtaskDetailDTO">
+        select id, questiontext, matchedtext, score
+        from service_subtask_detail
+        where del_flag = 0
+        <if test="subid != null ">and sub_id = #{subid}</if>
+        <if test="scriptid != null">and scriptid = #{scriptid}</if>
+    </select>
+
+    <insert id="insertServiceSubtaskDetail" parameterType="com.smartor.domain.ServiceSubtaskDetail"
+            useGeneratedKeys="true"
+            keyProperty="id">
         insert into service_subtask_detail
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="id != null">id,</if>
@@ -225,6 +310,10 @@
             <if test=" patid != null">patid,</if>
             <if test=" extemplateText != null">extemplate_text,</if>
             <if test=" guid != null">guid,</if>
+            <if test=" categoryid != null">categoryid,</if>
+            <if test="templateType != null">template_type,</if>
+            <if test="libTemplateid != null">lib_templateid,</if>
+            <if test="score != null">score,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
@@ -276,6 +365,10 @@
             <if test="patid != null">#{patid},</if>
             <if test="extemplateText != null">#{extemplateText},</if>
             <if test="guid != null">#{guid},</if>
+            <if test="categoryid != null">#{categoryid},</if>
+            <if test="templateType != null">#{templateType},</if>
+            <if test="libTemplateid != null">#{libTemplateid},</if>
+            <if test="score != null">#{score},</if>
         </trim>
     </insert>
 
@@ -329,7 +422,11 @@
             <if test="scriptid != null ">scriptid = #{scriptid},</if>
             <if test=" patid != null">patid = #{patid},</if>
             <if test=" extemplateText != null">extemplate_text = #{extemplateText},</if>
+            <if test="libTemplateid != null">lib_templateid = #{libTemplateid},</if>
             <if test=" guid != null">guid = #{guid},</if>
+            <if test=" categoryid != null">categoryid = #{categoryid},</if>
+            <if test="templateType != null">template_type = #{templateType},</if>
+            <if test="score != null">score = #{score},</if>
         </trim>
         where id = #{id}
     </update>
@@ -386,6 +483,10 @@
             <if test=" patid != null">patid = #{patid},</if>
             <if test=" extemplateText != null">extemplate_text = #{extemplateText},</if>
             <if test=" guid != null">guid = #{guid},</if>
+            <if test=" categoryid != null">categoryid = #{categoryid},</if>
+            <if test="templateType != null">template_type = #{templateType},</if>
+            <if test="libTemplateid != null">lib_templateid = #{libTemplateid},</if>
+            <if test="score != null">score = #{score},</if>
         </trim>
         where patid = #{patid} and scriptid = #{scriptid} and sub_id = #{subId}
     </update>

--
Gitblit v1.9.3