From 9fc52256df321e14a179811eda954491f5b71fea Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期五, 09 一月 2026 17:55:19 +0800
Subject: [PATCH] 【市一】问题统计接口调整

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

diff --git a/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml b/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml
index 57dba35..2fc9ce7 100644
--- a/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml
@@ -48,6 +48,21 @@
 
     </resultMap>
 
+    <resultMap type="com.smartor.domain.ServiceSubtaskScriptCount" id="ServiceSubtaskScriptCountResult">
+        <result property="scriptid" column="scriptid"/>
+        <result property="templateid" column="templateid"/>
+        <result property="scriptType" column="script_type"/>
+        <result property="scriptContent" column="script_content"/>
+        <result property="subtaskType" column="subtask_type"/>
+        <result property="completedQuantity" column="completed_quantity"/>
+        <result property="allQuantity" column="all_quantity"/>
+        <result property="completedPercentage" column="completed_percentage"/>
+        <result property="optionText" column="option_text"/>
+        <result property="chosenQuantity" column="chosen_quantity"/>
+        <result property="chosenPercentage" column="chosen_percentage"/>
+        <result property="options" column="options"/>
+    </resultMap>
+
     <sql id="selectSvyTaskTemplateScriptVo">
         select id,
                sort,
@@ -264,4 +279,61 @@
             #{id}
         </foreach>
     </delete>
+
+    <select id="getSvyTemplateScriptListForSubtaskCount" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
+            resultMap="ServiceSubtaskScriptCountResult">
+        SELECT
+        ss.templateid,
+        ssd.scriptid,
+        task_script.script_type,
+        task_script.script_content,
+        task_targetoption.optioncontent AS option_text
+        FROM
+        service_subtask_detail ssd
+        INNER JOIN service_subtask ss ON ssd.sub_id = ss.id
+        INNER JOIN svy_task_template_script task_script
+        ON task_script.id = ssd.scriptid
+        INNER JOIN svy_task_template_targetoption task_targetoption
+        ON task_targetoption.scriptid = task_script.id
+        where 1=1
+        and ss.del_flag=0
+        <if test="orgid != null and orgid != ''">
+            and ss.orgid = #{orgid}
+        </if>
+        <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
+            AND ss.leavehospitaldistrictcode IN
+            <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
+                     close=")">
+                #{leavehospitaldistrictcode}
+            </foreach>
+        </if>
+        <if test="deptcodes != null and deptcodes.size() > 0">
+            AND ss.deptcode IN
+            <foreach collection="deptcodes" item="deptcode" open="(" separator=","
+                     close=")">
+                #{deptcode}
+            </foreach>
+        </if>
+        <if test="serviceType != null and serviceType.size() > 0">
+            AND ss.service_type IN
+            <foreach collection="serviceType" item="serviceType" open="(" separator=","
+                     close=")">
+                #{serviceType}
+            </foreach>
+        </if>
+        <if test="startTime != null and endTime!=null">
+            AND date_format(ss.visit_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d')
+            AND date_format(ss.visit_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
+        </if>
+        <!-- 鐩墠鍙粺璁¤闊冲拰闂嵎 -->
+        <if test="type != null">
+            and ss.type = #{type}
+        </if>
+        <if test="configValue != null and configValue != ''">
+            AND ssd.categoryid IN (${configValue})
+        </if>
+        group by ss.templateid, ssd.scriptid,
+                 task_script.script_type, task_script.script_content,
+                 task_targetoption.optioncontent
+    </select>
 </mapper>

--
Gitblit v1.9.3