From 93078044580c2781cb8cf3ac18d2ab90513267de Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期一, 28 九月 2026 17:13:36 +0800
Subject: [PATCH] 处理患者再入院状态代码提交

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

diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 71d8a36..fc3e5da 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -571,6 +571,43 @@
             AND date_format(visit_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
         </if>
     </select>
+    <!--
+        婊℃剰搴︾粺璁★細鍙煡鏈鏉′欢涓嬪疄闄呭瓨鍦ㄥ摢浜� type銆�
+        杩囨护鏉′欢涓� selectSatisfactionSubtaskList 瀹屽叏涓�鑷达紝鍙槸锛�
+          1) 鍙� select distinct type锛堝師鏉ユ槸鎶婁笂鐧句釜瀛楁鍏ㄦ煡鍥炴潵锛夛紱
+          2) visit_time 鏀规垚鍙蛋绱㈠紩鐨勮寖鍥存潯浠讹紙鍘熸潵瀵瑰垪濂� date_format锛岀储寮曠敤涓嶄笂锛夈��
+    -->
+    <select id="selectSatisfactionSubtaskTypes" parameterType="com.smartor.domain.VO.PatSatisfactionReqVO"
+            resultType="java.lang.String">
+        select distinct type
+        from service_subtask
+        where del_flag = 0
+        <if test="questionType != null">and type = #{questionType}</if>
+        <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0">
+            AND leavehospitaldistrictcode IN
+            <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" separator=","
+                     close=")">
+                #{hospitaldistrictcode}
+            </foreach>
+        </if>
+        <if test="deptcodes != null and deptcodes.size() > 0">
+            AND deptcode IN
+            <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
+                #{deptcode}
+            </foreach>
+        </if>
+        <if test="serviceTypes != null and serviceTypes.size() > 0">
+            AND service_type IN
+            <foreach collection="serviceTypes" item="serviceType" open="(" separator="," close=")">
+                #{serviceType}
+            </foreach>
+        </if>
+        <if test="startTime != null and endTime != null">
+            AND visit_time &gt;= #{startTime}
+            AND visit_time &lt; date_add(#{endTime}, interval 1 day)
+        </if>
+    </select>
+
     <select id="getCompensateServiceSubtaskList" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
             resultMap="ServiceSubtaskResult">
         <include refid="selectServiceSubtaskVo"/>
@@ -2896,6 +2933,60 @@
     </select>
 
     <!--
+        婊℃剰搴︽煴鐘跺浘锛氫竴娆℃�х粺璁℃湰娆¤姹傚叏閮ㄦā鏉跨殑鍙戦�侀噺銆�
+        涓� querySendCount 鐨勮繃婊ゆ潯浠跺畬鍏ㄤ竴鑷达紝鍖哄埆鏄細
+          1) 鎸� libtemplateid 鍒嗙粍锛屼竴娆¤繑鍥炴墍鏈夋ā鏉匡紙鏇夸唬閫愪釜妯℃澘鏌ヨ锛夛紱
+          2) visit_time 鏀规垚鍙蛋绱㈠紩鐨勮寖鍥存潯浠讹紙鍘熸潵瀵瑰垪濂� date_format锛岀储寮曠敤涓嶄笂锛夈��
+    -->
+    <select id="selectSatisfactionSendCount" parameterType="com.smartor.domain.entity.SatisfactionStatQuery"
+            resultType="java.util.Map">
+        select libtemplateid as libtemplateid, count(distinct id) as cnt
+        from service_subtask
+        where del_flag = 0
+        <if test="orgid != null and orgid != ''">
+            and orgid = #{orgid}
+        </if>
+        <if test="campusid != null and campusid != ''">
+            and campusid = #{campusid}
+        </if>
+        <if test="type != null and type != ''">and type = #{type}</if>
+        <if test="startTime != null">
+            and visit_time &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+            and visit_time &lt; date_add(#{endTime}, interval 1 day)
+        </if>
+        <if test="libTemplateIds != null and libTemplateIds.size() > 0">
+            and 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">
+                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">
+                deptcode IN
+                <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
+                    #{deptcode}
+                </foreach>
+            </if>
+            )
+        </if>
+        group by libtemplateid
+    </select>
+
+    <!--
         鎸夌梾鍖烘垨绉戝鍒嗙粍缁熻 continue_flag 鏁伴噺
         浼犱簡 leavehospitaldistrictcodes 鈫� 鎸夌梾鍖虹淮搴�
         浼犱簡 deptcodes              鈫� 鎸夌瀹ょ淮搴�

--
Gitblit v1.9.3