From 665cb08f5e74996d417f26ab2bad6d7fe210ea2b Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 22 九月 2026 14:05:16 +0800
Subject: [PATCH] 1.修改省立同德满意度统计接口

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

diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index f902060..1603d17 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -3329,6 +3329,14 @@
         service_task t
         INNER JOIN service_subtask s ON s.taskid = t.taskid
         INNER JOIN service_subtask_detail d ON d.sub_id = s.id
+        <!-- 鍘婚噸锛氬悓涓�瀛愪换鍔″悓涓�棰樼洰鍙繚鐣欐渶鏂颁竴鏉★紝閬垮厤閲嶇瓟/閲嶅鍥炶皟鎶婂悓涓�閬撻閲嶅璁″叆椤规暟锛堜笌 mzMydScoreRank 鍙e緞涓�鑷达級 -->
+        AND d.id = (
+        SELECT MAX(d2.id)
+        FROM service_subtask_detail d2
+        WHERE d2.sub_id = d.sub_id
+        AND d2.questiontext &lt;=&gt; d.questiontext
+        AND d2.del_flag = '0'
+        )
         INNER JOIN (
         SELECT
         d.questiontext,
@@ -3337,6 +3345,14 @@
         service_task t
         INNER JOIN service_subtask s ON s.taskid = t.taskid
         INNER JOIN service_subtask_detail d ON d.sub_id = s.id
+        <!-- 鍘婚噸锛氬垎姣嶏紙璇ラ鏈夋晥绛斿嵎鎬绘暟锛変笌鏄庣粏鍙e緞淇濇寔涓�鑷达紝淇濊瘉鍚勯�夐」姣斾緥鍚堣 100% -->
+        AND d.id = (
+        SELECT MAX(d4.id)
+        FROM service_subtask_detail d4
+        WHERE d4.sub_id = d.sub_id
+        AND d4.questiontext &lt;=&gt; d.questiontext
+        AND d4.del_flag = '0'
+        )
         WHERE 1=1
         <if test="subtaskIds != null and subtaskIds.size() > 0">
             AND s.id IN
@@ -3345,16 +3361,37 @@
             </foreach>
         </if>
         <if test="valueType != null">AND d.value_type &gt;= #{valueType}</if>
-        <if test="scoreStart != null">AND d.score = #{scoreStart}</if>
+        <if test="scoreStart != null">AND d.score &gt;= #{scoreStart}</if>
         <if test="scoreEnd != null">AND d.score &lt;= #{scoreEnd}</if>
         <if test="questiontext != null  and questiontext != ''">and d.questiontext like concat('%', #{questiontext},
             '%')
         </if>
         AND s.sendstate = 6
         AND d.del_flag=0
+        <!-- 鍒嗘瘝涓庢槑缁嗙敤鍚屼竴濂楁椂闂存潯浠讹紝鍚﹀垯閫変簡鏃ユ湡鍖洪棿鍚庡悇閫夐」姣斾緥鍚堣涓嶅埌 100% -->
+        <if test="startOutHospTime != null">
+            AND date_format(s.endtime,'%y%m%d') &gt;= date_format(#{startOutHospTime},'%y%m%d')
+        </if>
+        <if test="endOutHospTime != null">
+            AND date_format(s.endtime,'%y%m%d') &lt;= date_format(#{endOutHospTime},'%y%m%d')
+        </if>
+        <if test="startFinishTime != null">
+            AND date_format(s.finishtime,'%y%m%d') &gt;= date_format(#{startFinishTime},'%y%m%d')
+        </if>
+        <if test="endFinishTime != null">
+            AND date_format(s.finishtime,'%y%m%d') &lt;= date_format(#{endFinishTime},'%y%m%d')
+        </if>
         GROUP BY d.questiontext
         ) t2 ON t2.questiontext = d.questiontext
         WHERE 1=1
+        <!-- 鍘婚噸锛氭槑缁嗚鍚屼竴瀛愪换鍔″悓涓�棰樼洰鍙繚鐣欐渶鏂颁竴鏉★紝閲嶇瓟涓嶉噸澶嶈鍏ラ」鏁� -->
+        AND d.id = (
+        SELECT MAX(d3.id)
+        FROM service_subtask_detail d3
+        WHERE d3.sub_id = d.sub_id
+        AND d3.questiontext &lt;=&gt; d.questiontext
+        AND d3.del_flag = '0'
+        )
         <if test="subtaskIds != null and subtaskIds.size() > 0">
             AND s.id IN
             <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")">

--
Gitblit v1.9.3