From a1e256f64930865ae2d170e333ee3f1a773c6c49 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期五, 16 十月 2026 11:04:29 +0800
Subject: [PATCH] 出入院模块、门急诊模块、模块模块、宣教模块

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

diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index fc3e5da..9255317 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -291,7 +291,6 @@
         <if test="continueTimeNext != null ">and continue_time_next = #{continueTimeNext}</if>
     </select>
 
-
     <select id="selectServiceSubtaskList" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
             resultMap="ServiceSubtaskResult">
         <include refid="selectServiceSubtaskVo"/>
@@ -537,78 +536,7 @@
         <if test="pageSize != null  and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
     </select>
 
-    <select id="selectSatisfactionSubtaskList" parameterType="com.smartor.domain.VO.PatSatisfactionReqVO"
-            resultMap="ServiceSubtaskResult">
-        <include refid="selectServiceSubtaskVo"/>
-        where 1=1
-        and 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 date_format(visit_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d')
-            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"
+            <select id="getCompensateServiceSubtaskList" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
             resultMap="ServiceSubtaskResult">
         <include refid="selectServiceSubtaskVo"/>
         where del_flag = 0
@@ -669,7 +597,6 @@
         <if test="continueTimeNext != null ">and continue_time_next = #{continueTimeNext}</if>
 
     </select>
-
 
     <select id="selectServiceSubtaskListAgain" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
             resultMap="ServiceSubtaskResult">
@@ -775,6 +702,12 @@
         </if>
         <if test="managementDoctorCode != null">and management_doctor_code = #{managementDoctorCode}</if>
         <if test="managementDoctor != null">and management_doctor like concat('%',#{managementDoctor}, '%')</if>
+        <if test="startOutHospTime != null">
+            AND date_format(endtime,'%y%m%d') &gt;= date_format(#{startOutHospTime},'%y%m%d')
+        </if>
+        <if test="endOutHospTime != null">
+            AND date_format(endtime,'%y%m%d') &lt;= date_format(#{endOutHospTime},'%y%m%d')
+        </if>
         ) a
     </select>
 
@@ -807,6 +740,7 @@
         </if>
         WHERE ss.del_flag = 0
         AND ss.visit_time IS NOT NULL
+        AND ss.sendstate != 4
         <if test="starttime == null and endtime==null">
             AND DATE(ss.visit_time) &lt; DATE(NOW())
         </if>
@@ -840,6 +774,12 @@
                 #{serviceType}
             </foreach>
         </if>
+        <if test="startOutHospTime != null">
+            AND date_format(ss.endtime,'%y%m%d') &gt;= date_format(#{startOutHospTime},'%y%m%d')
+        </if>
+        <if test="endOutHospTime != null">
+            AND date_format(ss.endtime,'%y%m%d') &lt;= date_format(#{endOutHospTime},'%y%m%d')
+        </if>
         <if test="groupKey != null and groupKey != ''">
             AND ss.${groupKey} IN
             <foreach collection="groupKeyList" item="key" open="(" separator=","
@@ -849,7 +789,6 @@
             GROUP BY ss.${groupKey}
         </if>
     </select>
-
 
     <select id="selectTimelyRateDetail" parameterType="com.smartor.domain.ServiceSubtask"
             resultMap="ServiceSubtaskResult">
@@ -1320,6 +1259,7 @@
         </trim>
         where 1=1
         <if test="patid != null ">and patid = #{patid}</if>
+        <if test="id != null ">and id = #{id}</if>
         <if test="taskid != null ">and taskid = #{taskid}</if>
         <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if>
         <if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
@@ -1534,7 +1474,6 @@
         </trim>
         where task_guid = #{taskGuid} and task_name = #{taskName}
     </update>
-
 
     <update id="deleteServiceSubtaskById" parameterType="Long">
         update service_subtask
@@ -2423,7 +2362,7 @@
             month, st.service_type, st.id;
     </select>
 
-    <select id="getDeptRanking" parameterType="com.smartor.domain.PatMedReq" resultType="com.smartor.domain.PatMedRes">
+    <select id="getDeptRanking" parameterType="com.ruoyi.common.core.service.dto.PatMedReq" resultType="com.ruoyi.common.core.service.dto.PatMedRes">
         SELECT deptname,
         count(1) AS rc
         FROM service_subtask
@@ -2817,9 +2756,8 @@
         </if>
     </select>
 
-
-    <select id="selectVisitCount" parameterType="com.smartor.domain.PatMedReq"
-            resultType="com.smartor.domain.PatMedRes">
+    <select id="selectVisitCount" parameterType="com.ruoyi.common.core.service.dto.PatMedReq"
+            resultType="com.ruoyi.common.core.service.dto.PatMedRes">
         select
         0 AS rc,
         count(1) AS rs
@@ -2884,109 +2822,7 @@
         </if>
     </select>
 
-    <select id="querySendCount" parameterType="com.smartor.domain.entity.ServiceSubtaskSatisfactionEntity"
-            resultType="Long">
-        select distinct id 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 = #{type}</if>
-        <if test="startTime != null">
-            AND date_format(visit_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d')
-        </if>
-        <if test="endTime != null">
-            AND date_format(visit_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
-        </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>
-    </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              鈫� 鎸夌瀹ょ淮搴�
@@ -3051,7 +2887,7 @@
     </select>
 
     <!-- 瀹f暀缁熻锛氭寜鐥呭尯鎴栫瀹ゅ垎缁勶紝缁熻鍙戦�佹�婚噺銆佸彂閫佹垚鍔熼噺锛坰endstate=6锛夈�佸凡璇婚噺锛坒inishtime涓嶄负绌猴級 -->
-    <select id="getHeLibraryCount" parameterType="com.smartor.domain.VO.HeLibraryCountVO" resultType="map">
+    <select id="getHeLibraryCount" parameterType="com.ruoyi.template.domain.VO.HeLibraryCountVO" resultType="map">
         SELECT
         <choose>
             <when test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0">
@@ -3118,118 +2954,7 @@
           and sendstate in (1, 2, 3)
     </select>
 
-    <select id="mydTrend" resultType="com.smartor.domain.DTO.MydTrendReqDTO">
-        SELECT CASE #{type}
-                   WHEN 'year' THEN DATE_FORMAT(d.create_time, '%Y')
-                   WHEN 'quarter' THEN CONCAT(YEAR(d.create_time), '-Q', QUARTER(d.create_time))
-                   WHEN 'month' THEN DATE_FORMAT(d.create_time, '%Y-%m')
-                   WHEN 'week' THEN FLOOR(DATEDIFF(d.create_time, #{startFinishTime}) / 7) + 1
-                   ELSE DATE_FORMAT(d.create_time, '%Y-%m-%d')
-                   END                AS period,
-               ROUND(avg(d.score), 2) AS totalScore
-        FROM service_subtask_detail d
-                 JOIN service_task t ON d.taskid = t.taskid
-        WHERE t.service_type IN (14)
-          AND t.del_flag = 0
-          AND d.del_flag = 0
-          AND d.create_time >= #{startFinishTime}
-          AND d.create_time &lt; DATE_ADD(#{endFinishTime}, INTERVAL 1 DAY)
-        GROUP BY period
-        ORDER BY period;
-    </select>
-
-    <select id="sltdMydTotalByDimension" resultType="com.smartor.domain.DTO.MydTrendReqDTO">
-        SELECT
-        p.period,
-        dim.dimension,
-        IFNULL(ROUND(SUM(d.score), 2), 0) AS totalScore
-        FROM (
-        <!-- 鐢熸垚鏌ヨ鑼冨洿鍐呭疄闄呭嚭鐜拌繃鐨勬椂闂存 -->
-        SELECT DISTINCT
-        CASE #{type}
-        WHEN 'year' THEN DATE_FORMAT(d.create_time, '%Y')
-        WHEN 'quarter' THEN CONCAT(YEAR(d.create_time), '-Q', QUARTER(d.create_time))
-        WHEN 'month' THEN DATE_FORMAT(d.create_time, '%Y-%m')
-        WHEN 'week' THEN FLOOR(DATEDIFF(d.create_time, #{startFinishTime}) / 7) + 1
-        ELSE DATE_FORMAT(d.create_time, '%Y-%m-%d')
-        END AS period
-        FROM service_subtask_detail d
-        WHERE d.del_flag = 0
-        AND d.create_time >= #{startFinishTime}
-        AND d.create_time &lt; #{endFinishTime}
-        ) p
-        CROSS JOIN (
-        <!-- 鎵�鏈夐渶瑕佸睍绀虹殑 dimension -->
-        SELECT DISTINCT dimension
-        FROM service_subtask_detail
-        WHERE del_flag = 0
-        AND dimension IS NOT NULL
-        ) dim
-        LEFT JOIN service_task t
-        ON t.service_type IN (6, 14)
-        AND t.del_flag = 0
-        LEFT JOIN service_subtask_detail d
-        ON d.taskid = t.taskid
-        AND d.del_flag = 0
-        AND d.dimension = dim.dimension
-        AND CASE #{type}
-        WHEN 'year' THEN DATE_FORMAT(d.create_time, '%Y')
-        WHEN 'quarter' THEN CONCAT(YEAR(d.create_time), '-Q', QUARTER(d.create_time))
-        WHEN 'month' THEN DATE_FORMAT(d.create_time, '%Y-%m')
-        WHEN 'week' THEN FLOOR(DATEDIFF(d.create_time, #{startFinishTime}) / 7) + 1
-        ELSE DATE_FORMAT(d.create_time, '%Y-%m-%d')
-        END = p.period
-        AND d.create_time >= #{startFinishTime}
-        AND d.create_time &lt; #{endFinishTime}
-        GROUP BY p.period, dim.dimension
-        ORDER BY p.period, dim.dimension
-    </select>
-
-    <select id="sltdMydTotalByYQ" resultType="com.smartor.domain.DTO.MydTrendReqDTO">
-        SELECT p.period,
-               c.campusid,
-               IFNULL(ROUND(AVG(d.score), 2), 0) AS totalScore
-        FROM (
-                 -- 鐢熸垚鏌ヨ鑼冨洿鍐呭疄闄呭嚭鐜拌繃鐨勬椂闂存
-                 SELECT DISTINCT CASE #{type}
-                                     WHEN 'year' THEN DATE_FORMAT(d.create_time, '%Y')
-                                     WHEN 'quarter' THEN CONCAT(YEAR(d.create_time), '-Q', QUARTER(d.create_time))
-                                     WHEN 'month' THEN DATE_FORMAT(d.create_time, '%Y-%m')
-                                     WHEN 'week' THEN FLOOR(DATEDIFF(d.create_time, #{startFinishTime}) / 7) + 1
-                                     ELSE DATE_FORMAT(d.create_time, '%Y-%m-%d')
-                                     END AS period
-                 FROM service_subtask_detail d
-                 WHERE d.del_flag = 0
-                   AND d.create_time >= #{startFinishTime}
-                   AND d.create_time &lt; #{endFinishTime}) p
-                 CROSS JOIN (
-            -- 鎵�鏈夐渶瑕佸睍绀虹殑闄㈠尯
-            SELECT DISTINCT campusid
-            FROM service_task
-            WHERE service_type IN (6, 14)
-              AND del_flag = 0
-              AND campusid IS NOT NULL) c
-                 LEFT JOIN service_task t
-                           ON t.campusid = c.campusid
-                               AND t.service_type IN (6, 14)
-                               AND t.del_flag = 0
-                 LEFT JOIN service_subtask_detail d
-                           ON d.taskid = t.taskid
-                               AND d.del_flag = 0
-                               AND CASE #{type}
-                                       WHEN 'year' THEN DATE_FORMAT(d.create_time, '%Y')
-                                       WHEN 'quarter' THEN CONCAT(YEAR(d.create_time), '-Q', QUARTER(d.create_time))
-                                       WHEN 'month' THEN DATE_FORMAT(d.create_time, '%Y-%m')
-                                       WHEN 'week' THEN FLOOR(DATEDIFF(d.create_time, #{startFinishTime}) / 7) + 1
-                                       ELSE DATE_FORMAT(d.create_time, '%Y-%m-%d')
-                                       END = p.period
-                               AND d.create_time >= #{startFinishTime}
-                               AND d.create_time &lt; #{endFinishTime}
-        GROUP BY p.period, c.campusid
-        ORDER BY p.period, c.campusid;
-    </select>
-
-    <!-- 浠诲姟缁勶紙appltype=5锛夋粴鍔ㄨ皟搴︾敤锛氭媺鏈疆鍏ㄩ噺 subtask锛屼綔涓轰笅涓�杞殑鍏嬮殕妯℃澘 -->
+                <!-- 浠诲姟缁勶紙appltype=5锛夋粴鍔ㄨ皟搴︾敤锛氭媺鏈疆鍏ㄩ噺 subtask锛屼綔涓轰笅涓�杞殑鍏嬮殕妯℃澘 -->
     <select id="selectByScheduleIdAndLoop" resultMap="ServiceSubtaskResult">
         <include refid="selectServiceSubtaskVo"/>
         where schedule_id = #{scheduleId}
@@ -3238,7 +2963,7 @@
         order by schedule_seq asc, id asc
     </select>
 
-    <select id="gethelibraryCountHyperlink" parameterType="com.smartor.domain.VO.HeLibraryCountVO"
+    <select id="gethelibraryCountHyperlink" parameterType="com.ruoyi.template.domain.VO.HeLibraryCountVO"
             resultMap="ServiceSubtaskResult">
         select id,
         visit_count,
@@ -3320,367 +3045,7 @@
         </if>
     </select>
 
-    <select id="statQuestionOption" resultType="com.smartor.domain.ServiceSubtaskDetailRatioExport">
-        SELECT
-        d.questiontext AS questiontext,
-        t.taskid AS taskid,
-        t.task_name AS taskName,
-        d.asrtext AS optionresult,
-        d.score AS score,
-        d.targetvalue AS targetvalue,
-        d.value_type AS valueType,
-        COUNT(*) AS count,
-        CONCAT(ROUND(COUNT(*) * 100.0 / t2.total_count, 2), '%') AS ratio
-        FROM
-        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
-        INNER JOIN (
-        SELECT
-        t.taskid,
-        d.questiontext,
-        COUNT(*) AS total_count
-        FROM
-        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
-        WHERE 1=1
-        <if test="taskIds != null and taskIds.size() > 0">
-            AND t.taskid IN
-            <foreach collection="taskIds" item="taskId" open="(" separator="," close=")">
-                #{taskId}
-            </foreach>
-        </if>
-        <!-- 浼犱簡 subtaskIds 鍙粺璁¤繖鎵瑰瓙浠诲姟锛堟湰娆″鍑虹殑鎮h�咃級 -->
-        <if test="subtaskIds != null and subtaskIds.size() > 0">
-            AND s.id IN
-            <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")">
-                #{subtaskId}
-            </foreach>
-        </if>
-        <if test="valueType != null">AND d.value_type = #{valueType}</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
-        <!-- 鍒嗘瘝蹇呴』鍜屾槑缁嗙敤鍚屼竴濂楁椂闂存潯浠讹紝鍚﹀垯閫変簡鏃堕棿鑼冨洿鍚庢瘮渚嬩細鎸夊叏閲忓巻鍙茶绋�閲� -->
-        <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
-        t.taskid,
-        d.questiontext
-        ) t2 ON t2.taskid = t.taskid AND t2.questiontext = d.questiontext
-        WHERE 1=1
-        <if test="taskIds != null and taskIds.size() > 0">
-            AND t.taskid IN
-            <foreach collection="taskIds" item="taskId" open="(" separator="," close=")">
-                #{taskId}
-            </foreach>
-        </if>
-        <if test="subtaskIds != null and subtaskIds.size() > 0">
-            AND s.id IN
-            <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")">
-                #{subtaskId}
-            </foreach>
-        </if>
-        <if test="valueType != null">AND d.value_type = #{valueType}</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
-        <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
-        t.taskid,
-        d.questiontext,
-        d.score,
-        d.targetvalue,
-        d.asrtext,
-        d.value_type
-        ORDER BY
-        d.questiontext,
-        t.taskid
-    </select>
-
-    <!--
-      瀵煎嚭銆岄棶棰樿鎯呭崰姣斻�嶄笓鐢ㄧ粺璁★紙鍙粺璁℃湰娆″鍑虹殑杩欐壒鎮h�咃級
-      鏁伴噺 = 閫夋嫨璇ラ�夐」鐨勬偅鑰呮暟锛圕OUNT(DISTINCT s.id)锛屽苟鐢� MAX(id) 淇濊瘉鍚屼竴鎮h�呭悓涓�棰樺彧绠楁渶鏂颁竴鏉★級
-      鍒嗘暟 = 璇ラ�夐」鏄庣粏鐨� score 涔嬪拰
-      姣斾緥 = 鏁伴噺 / 璇ラ浣滅瓟鎮h�呮暟锛屽湪 Java 渚х粺涓�璁$畻锛屽洜姝ゃ�屽崟棰樺悇閫夐」鏁伴噺涔嬪拰 = 璇ラ浣滅瓟鎮h�呮暟銆�
-    -->
-    <select id="statMydQuestionOptionForExport" resultType="com.smartor.domain.DTO.ServiceSubtaskOptionStatDTO">
-        SELECT
-        t.taskid AS taskid,
-        t.task_name AS taskName,
-        d.questiontext AS questiontext,
-        d.asrtext AS optionresult,
-        d.targetvalue AS targetvalue,
-        d.value_type AS valueType,
-        COUNT(DISTINCT s.id) AS patientCount,
-        SUM(COALESCE(CAST(d.score AS DECIMAL(18,2)), 0)) AS scoreSum
-        FROM
-        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
-        WHERE 1=1
-        AND s.del_flag = '0'
-        AND d.del_flag = 0
-        <if test="subtaskIds != null and subtaskIds.size() > 0">
-            AND s.id IN
-            <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")">
-                #{subtaskId}
-            </foreach>
-        </if>
-        <!-- 涓嶄紶瀛愪换鍔℃椂鐩存帴鏌ヤ笉鍒版暟鎹紝閬垮厤璇粺璁″叏閲� -->
-        <if test="subtaskIds == null or subtaskIds.size() == 0">
-            AND 1 = 0
-        </if>
-        <if test="questiontext != null and questiontext != ''">
-            AND d.questiontext LIKE CONCAT('%', #{questiontext}, '%')
-        </if>
-        <!-- 鍚屼竴鎮h�呭悓涓�棰樼洰鍙繚鐣欐渶鏂颁竴鏉★紝閲嶇瓟涓嶉噸澶嶈鍏ユ暟閲� -->
-        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'
-        )
-        GROUP BY
-        t.taskid,
-        t.task_name,
-        d.questiontext,
-        d.asrtext,
-        d.targetvalue,
-        d.value_type
-        <!-- 鎸変换鍔″悕绉板垎缁勫睍绀猴細鍏堜换鍔″悕绉般�佸啀浠诲姟缂栧彿锛屽悓涓�浠诲姟鐨勯鐩�/閫夐」杩炵画鎺掑垪 -->
-        ORDER BY
-        t.task_name,
-        t.taskid,
-        d.questiontext
-    </select>
-
-    <!-- 鏂版柟娉曪細鏍规嵁瀛愪换鍔� ID 缁熻闂閫夐」鐧惧垎姣� (鐢ㄤ簬婊℃剰搴︾粺璁� serviceType=6) -->
-    <select id="statQuestionOptionBySubtaskIds" resultType="com.smartor.domain.ServiceSubtaskDetailRatioExport">
-        SELECT
-        d.questiontext AS questiontext,
-        <!-- 鏄庣粏宸叉寜銆岄鐩� + 閫夐」銆嶆眹鎬伙紝浠诲姟/绉戝/鐥呭尯鍙槸闄勫甫淇℃伅锛屽繀椤荤敤鑱氬悎鍑芥暟鍙栧�硷紙MySQL ONLY_FULL_GROUP_BY锛� -->
-        MAX(t.taskid) AS taskid,
-        MAX(t.task_name) AS taskName,
-        d.asrtext AS optionresult,
-        d.score AS score,
-        MAX(s.deptcode) AS deptcode,
-        MAX(s.deptname) AS deptname,
-        MAX(s.leavehospitaldistrictcode) AS leavehospitaldistrictcode,
-        MAX(s.leavehospitaldistrictname) AS leavehospitaldistrictname,
-        d.targetvalue AS targetvalue,
-        d.value_type AS valueType,
-        COUNT(*) AS count,
-        CONCAT(ROUND(COUNT(*) * 100.0 / t2.total_count, 2), '%') AS ratio
-        FROM
-        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 (
-        <!-- 鍒嗘瘝 = 璇ラ鍚勯�夐」椤规暟涔嬪拰锛堟湭浣滅瓟鐨勭┖ asrtext 涓嶈繘鍒嗘瘝锛夛紝杩欐牱涓�閬撻鍚勯�夐」姣斾緥鍚堣鎵嶆槸 100% -->
-        SELECT
-        x.questiontext AS questiontext,
-        SUM(x.option_count) AS total_count
-        FROM (
-        SELECT
-        d.questiontext,
-        d.asrtext,
-        COUNT(*) AS option_count
-        FROM
-        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
-            <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")">
-                #{subtaskId}
-            </foreach>
-        </if>
-        <if test="valueType != null">AND d.value_type &gt;= #{valueType}</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>
-        <!-- 鏈綔绛旓紙asrtext 涓虹┖锛夌殑鏄庣粏涓嶈鍏ュ垎姣� -->
-        AND d.asrtext IS NOT NULL AND TRIM(d.asrtext) &lt;&gt; ''
-        GROUP BY d.questiontext, d.asrtext
-        ) x
-        GROUP BY x.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=")">
-                #{subtaskId}
-            </foreach>
-        </if>
-        AND s.sendstate = 6
-        AND d.del_flag=0
-        <!-- 鏈綔绛旓紙asrtext 涓虹┖锛変笉绠椾换浣曢�夐」锛屾槑缁嗛噷鐩存帴鎺掗櫎锛岄伩鍏嶅嚭鐜扮┖閫夐」琛� -->
-        AND d.asrtext IS NOT NULL AND TRIM(d.asrtext) &lt;&gt; ''
-        <if test="valueType != null">AND d.value_type &gt;= #{valueType}</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>
-        <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 甯︿笂 taskid/绉戝/鐥呭尯锛屽悓涓�涓�夐」琚媶鎴愬琛屻�佹瘡琛屾暟閲忛兘鏄� 1锛�
-             鍓嶇/瀵煎嚭鎷垮埌鐨勩�屾暟閲忋�嶅氨姘歌繙鍋氫笉浜嗙疮鍔� -->
-        GROUP BY
-        d.questiontext,
-        d.asrtext,
-        d.score,
-        d.targetvalue,
-        d.value_type
-        ORDER BY
-        d.questiontext,
-        MIN(t.taskid)
-    </select>
-
-    <select id="statQuestionOptionByKsOrBq" resultType="com.smartor.domain.DTO.QuestionCountKsOrBqDTO"
-            parameterType="com.smartor.domain.VO.QuestionCountKsOrBqVO">
-        SELECT
-        s.deptname AS deptname,
-        s.leavehospitaldistrictname AS leavehospitaldistrictname,
-        d.questiontext AS questionText,
-        d.targetvalue AS targetvalue, -- 鎵�鏈夐�夐」鎷兼帴
-        d.asrtext AS asrtext, -- 鐢ㄦ埛瀹為檯閫変腑鐨勯�夐」
-        d.score AS singleScore -- 鍗曟潯璁板綍鐨勫垎鏁�
-        FROM service_subtask_detail d
-        JOIN service_subtask s ON d.sub_id = s.id
-        WHERE s.del_flag = 0
-        AND d.del_flag = 0
-        AND s.service_type IN ('6', '14')
-        <if test="taskTemplateid != null">
-            AND s.templateid = #{taskTemplateid}
-        </if>
-        <if test="endFinishTime != null">
-            AND d.create_time &lt; #{endFinishTime}
-        </if>
-        <if test="startFinishTime != null">
-            AND d.create_time &gt;= #{startFinishTime}
-        </if>
-        <if test="deptOrDistrict ==1">
-            <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
-                AND leavehospitaldistrictcode IN
-                <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="("
-                         separator=","
-                         close=")">
-                    #{leavehospitaldistrictcode}
-                </foreach>
-            </if>
-            <if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0">
-                AND deptcode IN
-                <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
-                         close=")">
-                    #{leaveldeptcode}
-                </foreach>
-            </if>
-        </if>
-        <if test="deptOrDistrict ==2">
-            <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
-                AND leavehospitaldistrictcode IN
-                <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="("
-                         separator=","
-                         close=")">
-                    #{leavehospitaldistrictcode}
-                </foreach>
-            </if>
-            <if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0">
-                OR deptcode IN
-                <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
-                         close=")">
-                    #{leaveldeptcode}
-                </foreach>
-            </if>
-        </if>
-    </select>
-
-    <select id="selectServiceSubtaskListDeadLine" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
+                    <select id="selectServiceSubtaskListDeadLine" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
             resultMap="ServiceSubtaskResult">
         <include refid="selectServiceSubtaskVo"/>
         where 1=1
@@ -3690,95 +3055,5 @@
     </select>
 
     <!-- 闂ㄨ瘖婊℃剰搴︾患鍚堝緱鍒嗘帓鍚嶏紙鎸夌瀹ゆ垨鐥呭尯锛� -->
-    <!-- 缁煎悎婊℃剰搴� = 危(璇勫垎鏄庣粏鏉冮噸) / 璇勫垎鏄庣粏鏉℃暟 脳 100%锛屾潈閲嶅彧鍙� 1銆�0.8銆�0.6銆�0.4銆�0.2 浜旀。 -->
-    <select id="selectMzMydScoreRank" parameterType="com.smartor.domain.VO.MzMydScoreRankVO"
-            resultType="com.smartor.domain.DTO.MzMydScoreRankDTO">
-        SELECT
-        t.code                   AS code,
-        t.name                   AS name,
-        ROUND(AVG(t.w) * 100, 2) AS score,
-        COUNT(*)                 AS itemCount
-        FROM (
-        SELECT
-        <choose>
-            <when test='dimensionType == "2"'>
-                s.leavehospitaldistrictcode AS code,
-                s.leavehospitaldistrictname AS name,
-            </when>
-            <otherwise>
-                s.deptcode AS code,
-                s.deptname AS name,
-            </otherwise>
-        </choose>
-        CAST(d.score AS DECIMAL(10,4)) AS w
-        FROM service_subtask s
-        INNER JOIN service_subtask_detail d ON d.sub_id = s.id
-        WHERE s.del_flag = '0'
-        AND d.del_flag = '0'
-        AND s.sendstate = 6
-        <if test="serviceTypes != null and serviceTypes.size() > 0">
-            AND service_type IN
-            <foreach collection="serviceTypes" item="serviceType" open="(" separator=","
-                     close=")">
-                #{serviceType}
-            </foreach>
-        </if>
-<!--        &lt;!&ndash; 鍙彇鍏紡閲岀殑浜旀。鏉冮噸锛岀┖鍊�/0/鏈瓟绛夋棦涓嶈繘鍒嗗瓙涔熶笉杩涘垎姣� &ndash;&gt;-->
-<!--        AND CAST(d.score AS DECIMAL(10,4)) IN (1, 0.8, 0.6, 0.4, 0.2)-->
-        <!-- 鍚屼竴瀛愪换鍔″悓涓�棰樼洰鍙繚鐣欐渶鏂颁竴鏉★紝閬垮厤閲嶇瓟琚噸澶嶈鍏ラ」鏁� -->
-        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'
-        )
-        <if test="orgid != null and orgid != ''">
-            AND s.orgid = #{orgid}
-        </if>
-        <if test="campusid != null and campusid != ''">
-            AND s.campusid = #{campusid}
-        </if>
-        <if test="startFinishTime != null">
-            AND s.finishtime &gt;= #{startFinishTime}
-        </if>
-        <if test="endFinishTime != null">
-            AND s.finishtime &lt; DATE_ADD(#{endFinishTime}, INTERVAL 1 DAY)
-        </if>
-        <if test="questionText != null  and questionText != ''">and d.questiontext like concat('%', #{questionText},
-            '%')
-        </if>
-        <choose>
-            <when test='dimensionType == "2"'>
-                AND s.leavehospitaldistrictcode IS NOT NULL AND s.leavehospitaldistrictcode &lt;&gt; ''
-                AND s.leavehospitaldistrictname IS NOT NULL AND s.leavehospitaldistrictname &lt;&gt; ''
-                <if test="districtCodes != null and districtCodes.size() > 0">
-                    AND s.leavehospitaldistrictcode IN
-                    <foreach collection="districtCodes" item="districtCode" open="(" separator="," close=")">
-                        #{districtCode}
-                    </foreach>
-                </if>
-            </when>
-            <otherwise>
-                AND s.deptcode IS NOT NULL AND s.deptcode &lt;&gt; ''
-                AND s.deptname IS NOT NULL AND s.deptname &lt;&gt; ''
-                <if test="deptCodes != null and deptCodes.size() > 0">
-                    AND s.deptcode IN
-                    <foreach collection="deptCodes" item="deptCode" open="(" separator="," close=")">
-                        #{deptCode}
-                    </foreach>
-                </if>
-            </otherwise>
-        </choose>
-        ) t
-        GROUP BY t.code, t.name
-        ORDER BY AVG(t.w) DESC, COUNT(*) DESC
-        <if test="limit != null and limit > 0">
-            LIMIT #{limit}
-        </if>
-    </select>
-
-
-
-</mapper>
+    </mapper>
 

--
Gitblit v1.9.3