From b25c3b5188e402695f3792ad7da53e452682cd80 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期一, 12 十月 2026 19:43:07 +0800
Subject: [PATCH] 满意度统计BUG修改

---
 ruoyi-satisfaction/src/main/resources/mapper/satisfaction/SatisfactionMapper.xml |   66 +++++++++++++++++++++++++++++++++
 1 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/ruoyi-satisfaction/src/main/resources/mapper/satisfaction/SatisfactionMapper.xml b/ruoyi-satisfaction/src/main/resources/mapper/satisfaction/SatisfactionMapper.xml
index dcf5555..e17a7b9 100644
--- a/ruoyi-satisfaction/src/main/resources/mapper/satisfaction/SatisfactionMapper.xml
+++ b/ruoyi-satisfaction/src/main/resources/mapper/satisfaction/SatisfactionMapper.xml
@@ -801,6 +801,72 @@
         </if>
         group by ss.libtemplateid
     </select>
+
+    <!-- ================================================
+         銆屾寜 妯℃澘 + 闂銆嶇殑绛旈銆愪汉鏁般�戯紙distinct sub_id锛�
+
+         涓轰粈涔堥渶瑕佸畠锛�/statistics 鐨勩�岀瓟棰樹汉鏁� / 鏈瓟棰樹汉鏁般�嶅繀椤讳笌銆屽彂閫佷汉鏁般�嶅悓鍙e緞锛堥兘鏄�愪汉銆戯級銆�
+         鍘熷疄鐜版妸銆岀瓟棰樹汉鏁般�嶅彇鎴愪簡 selectSatisfactionFillStatByMatchedtext 鐨� count(*)锛堛�愭槑缁嗚鏁般�戯級锛�
+         鑰屽悓涓�鏉� (sub_id, questiontext) 鍙兘瀵瑰簲澶氳鏄庣粏锛堝閫夐」 / 閲嶅鏄庣粏锛夛紝
+         浜庢槸銆屾湭绛旈浜烘暟 = 鍙戦�佷汉鏁� 鈭� 鏄庣粏琛屾暟銆嶄細绠楁垚璐熸暟锛堝疄娴� -120 = 15 鈭� 135锛夈��
+         杩欓噷琛ヤ竴鏉℃寜闂鑱氬悎鐨� distinct 浜烘暟鏌ヨ锛屼笓渚涖�岀瓟棰樹汉鏁� / 鏈瓟棰樹汉鏁� / 绛旈鐜囥�嶄娇鐢紱
+         骞冲潎鍒� / 鏈�楂樺垎 / 鏈�浣庡垎 / 鍚勯�夐」鍗犳瘮浠嶆寜鏄庣粏琛屾暟缁熻锛堥偅浜涘彛寰勬湰鏉ュ氨鏄寜琛岃锛屾湭鏀瑰姩锛夈��
+         闄よ仛鍚堥敭涓� distinct 涔嬪锛宖rom/where 涓� selectSatisfactionFillStatByMatchedtext 瀹屽叏涓�鑷达紝
+         淇濊瘉涓よ�呯粺璁$殑鏄悓涓�鎵规暟鎹��
+         ================================================ -->
+    <select id="selectSatisfactionFillPersonCountByQuestion"
+            parameterType="com.ruoyi.satisfaction.domain.entity.SatisfactionStatQuery"
+            resultType="java.util.Map">
+        select ss.libtemplateid as libtemplateid,
+               ssd.questiontext as questiontext,
+               count(distinct ssd.sub_id) as cnt
+        from service_subtask_detail ssd
+        join service_subtask ss on ss.id = ssd.sub_id
+        where ssd.del_flag = 0
+        and ss.del_flag = 0
+        <if test="orgid != null and orgid != ''">
+            and ss.orgid = #{orgid}
+        </if>
+        <if test="campusid != null and campusid != ''">
+            and ss.campusid = #{campusid}
+        </if>
+        <if test="type != null and type != ''">and ss.type = #{type}</if>
+        <if test="startTime != null">
+            and ss.visit_time &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+            and ss.visit_time &lt; date_add(#{endTime}, interval 1 day)
+        </if>
+        <if test="libTemplateIds != null and libTemplateIds.size() > 0">
+            and ss.libtemplateid IN
+            <foreach collection="libTemplateIds" item="libTemplateId" open="(" separator="," close=")">
+                #{libTemplateId}
+            </foreach>
+        </if>
+        <if test="(hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0) or (deptcodes != null and deptcodes.size() > 0)">
+            AND (
+            <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0">
+                ss.leavehospitaldistrictcode IN
+                <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="("
+                         separator=","
+                         close=")">
+                    #{hospitaldistrictcode}
+                </foreach>
+            </if>
+            <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0 and deptcodes != null and deptcodes.size() > 0">
+                OR
+            </if>
+            <if test="deptcodes != null and deptcodes.size() > 0">
+                ss.deptcode IN
+                <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
+                    #{deptcode}
+                </foreach>
+            </if>
+            )
+        </if>
+        group by ss.libtemplateid, ssd.questiontext
+    </select>
+
     <!-- ================================================ 閲嶅鏄庣粏娓呯悊锛堟弧鎰忓害缁熻鍓嶇疆锛�
          鍘熷睘 ServiceSubtaskDetailMapper.xml锛屽彧鏈夋弧鎰忓害缁熻璋冪敤锛堝凡鏍稿疄锛夛紝鏁呬竴骞舵惉鍏ャ��
          娉ㄦ剰 deleteRepeatDetailByIds 鏄�愬啓鎿嶄綔銆戯細鎸� id 閫昏緫鍒犻櫎閲嶅鏄庣粏锛坉el_flag=1锛夈�� -->

--
Gitblit v1.9.3