liusheng
2026-10-12 26d1f59f0266672398975ba0337bb3d8267c2d95
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -98,6 +98,7 @@
        <result property="scheduleDetailId" column="schedule_detail_id"/>
        <result property="scheduleSeq" column="schedule_seq"/>
        <result property="loopCount" column="loop_count"/>
        <result property="isManuallyCalled" column="is_manually_called"/>
        <result property="campusid" column="campusid"/>
    </resultMap>
@@ -213,7 +214,6 @@
               create_time,
               isupload,
               upload_time,
               orgid,
               pid,
               guid,
               text_param,
@@ -236,8 +236,6 @@
               leaveicd10code,
               orgid,
               visit_type,
               management_doctor,
               management_doctor_code,
               continue_flag,
               continue_time_now,
               continue_content,
@@ -248,7 +246,8 @@
               schedule_detail_id,
               schedule_seq,
               loop_count,
               task_situation
               task_situation,
               is_manually_called
        from service_subtask
    </sql>
@@ -257,9 +256,8 @@
        <include refid="selectServiceSubtaskVo"/>
        where 1=1
        and del_flag = 0
        <if test="orgid != null and orgid != ''">
            and orgid = #{orgid}
        </if>
        <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if>
        <if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
        <if test="taskid != null ">and taskid = #{taskid}</if>
        <if test="continueFlag != null ">and continue_flag = #{continueFlag}</if>
        <if test="continueTimeNow != null ">and continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP}</if>
@@ -281,23 +279,17 @@
        <include refid="selectServiceSubtaskVo"/>
        where 1=1
        and del_flag = 0
        <if test="orgid != null and orgid != ''">
            and orgid = #{orgid}
        </if>
        <if test="subId != null">
            AND id = #{subId}
        </if>
        <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if>
        <if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
        <if test="subId != null">and id = #{subId}</if>
        <if test="taskid != null ">and taskid = #{taskid}</if>
        <if test="visitTime != null">
            AND date_format(visit_time,'%y%m%d') &lt;= date_format(#{visitTime},'%y%m%d')
        </if>
        <if test="visitTime != null">and date_format(visit_time,'%y%m%d') &lt;= date_format(#{visitTime},'%y%m%d')</if>
        <if test="sendstate != null ">and sendstate = #{sendstate}</if>
        <if test="continueFlag != null ">and continue_flag = #{continueFlag}</if>
        <if test="continueTimeNow != null ">and continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP}</if>
        <if test="continueCount != null ">and continue_count = #{continueCount}</if>
        <if test="continueTimeNext != null ">and continue_time_next = #{continueTimeNext}</if>
    </select>
    <select id="selectServiceSubtaskList" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
            resultMap="ServiceSubtaskResult">
@@ -364,6 +356,12 @@
                #{operationItemIdItem}
            </foreach>
        </if>
        <if test="inhospids != null and inhospids.size() > 0">
            AND inhospid IN
            <foreach collection="inhospids" item="inhospidItem" open="(" separator="," close=")">
                #{inhospidItem}
            </foreach>
        </if>
        <if test="templateid != null  and templateid != ''">and templateid = #{templateid}</if>
        <if test="templatename != null  and templatename != ''">and templatename like concat('%', #{templatename},
            '%')
@@ -379,6 +377,12 @@
        </if>
        <if test="endSendDateTime != null">
            AND date_format(visit_time,'%y%m%d') &lt;= date_format(#{endSendDateTime},'%y%m%d')
        </if>
        <if test="finishtimeStart != null">
            AND date_format(finishtime,'%y%m%d') &gt;= date_format(#{finishtimeStart},'%y%m%d')
        </if>
        <if test="finishtimeEnd != null">
            AND date_format(finishtime,'%y%m%d') &lt;= date_format(#{finishtimeEnd},'%y%m%d')
        </if>
        <if test="longSendTime != null">
            AND date_format(long_send_time,'%y%m%d') &lt;= date_format(#{longSendTime},'%y%m%d')
@@ -510,6 +514,7 @@
        <if test="createBy != null">and create_by = #{createBy}</if>
        <if test="taskGuid != null">and task_guid = #{taskGuid}</if>
        <if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
        <if test="isManuallyCalled != null">and is_manually_called = #{isManuallyCalled}</if>
        <if test="isVisitAgain != null">and is_visit_again = #{isVisitAgain}</if>
        <if test="visitCount != null and visitCount > 1 and visitDeptCodes != null and visitDeptCodes.size() > 0">
            AND visit_dept_code IN
@@ -531,54 +536,15 @@
        <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>
    <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
        and sendstate != 5
        <if test="orgid != null and orgid != ''">
            and orgid = #{orgid}
        </if>
        <if test="visitTime != null">
            AND date_format(visit_time,'%y%m%d') &lt;= date_format(#{visitTime},'%y%m%d')
        </if>
        <if test="subId != null">
            AND id = #{subId}
        </if>
        <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if>
        <if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
        <if test="visitTime != null">and date_format(visit_time,'%y%m%d') &lt;= date_format(#{visitTime},'%y%m%d') </if>
        <if test="subId != null">and id = #{subId} </if>
        <if test="sendstate != null ">and sendstate = #{sendstate}</if>
        <if test="continueFlag != null ">and continue_flag = #{continueFlag}</if>
        <if test="continueTimeNow != null ">and continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP}</if>
@@ -588,9 +554,8 @@
        <include refid="selectServiceSubtaskVo"/>
        where del_flag = 0
        and sendstate = 5
        <if test="orgid != null and orgid != ''">
            and orgid = #{orgid}
        </if>
        <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if>
        <if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
        <if test="visitTime != null">
            AND date_format(visit_time,'%y%m%d') &lt;= date_format(DATE_ADD(#{visitTime}, INTERVAL 1 DAY),'%y%m%d')
        </if>
@@ -608,9 +573,8 @@
            resultMap="ServiceSubtaskResult">
        <include refid="selectServiceSubtaskVo"/>
        where del_flag = 0
        <if test="orgid != null and orgid != ''">
            and orgid = #{orgid}
        </if>
        <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if>
        <if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
        <if test="createStartTime != null  and createEndTime != null">and create_time BETWEEN #{createStartTime} AND
            #{createEndTime}
        </if>
@@ -634,7 +598,6 @@
    </select>
    <select id="selectServiceSubtaskListAgain" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
            resultMap="ServiceSubtaskResult">
        <include refid="selectServiceSubtaskVo"/>
@@ -657,7 +620,8 @@
        <if test="labelstatus != null ">and labelstatus = #{labelstatus}</if>
        <if test="isupload != null ">and isupload = #{isupload}</if>
        <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
        <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
        <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if>
        <if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
        <if test="pid != null ">and pid = #{pid}</if>
        <if test="preachform != null ">and preachform = #{preachform}</if>
        <if test="guid != null  and guid != ''">and guid = #{guid}</if>
@@ -705,9 +669,8 @@
            DATE_FORMAT(b.create_time, '%Y-%m-%d') LIKE CONCAT(#{createTimeNew}, '%')
        </if>
        <if test="sendstate != null ">and b.sendstate = #{sendstate}</if>
        <if test="orgid != null and orgid != ''">
            and b.orgid = #{orgid}
        </if>
        <if test="orgid != null and orgid != ''">and b.orgid = #{orgid}</if>
        <if test="campusid != null and campusid != ''">and b.campusid = #{campusid}</if>
    </select>
    <select id="selectTimelyRate" parameterType="com.smartor.domain.ServiceSubtask" resultType="double">
@@ -724,7 +687,8 @@
            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>
        <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
        <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if>
        <if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
        <if test="serviceType != null and serviceType != ''">and service_type = #{serviceType}</if>
        <if test="serviceTypes != null and serviceTypes != ''">and service_type IN (#{serviceTypes})</if>
        <if test="deptcode != null  and deptcode != ''">and deptcode = #{deptcode}</if>
@@ -738,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>
@@ -746,7 +716,8 @@
        <if test="groupKey != null and groupKey != ''">
            ss.${groupKey} as groupKey,
        </if>
        SUM(CASE WHEN ss.finishtime IS NOT NULL AND DATE(ss.visit_time) &lt;= DATE(ss.finishtime) THEN 1 ELSE 0 END) / COUNT(*) AS finishRate,
        SUM(CASE WHEN ss.finishtime IS NOT NULL AND DATE(ss.visit_time) &lt;= DATE(ss.finishtime) THEN 1 ELSE 0 END) /
        COUNT(*) AS finishRate,
        <if test="rateDay != null">
            SUM(CASE WHEN ss.finishtime IS NOT NULL
            AND DATEDIFF(ss.finishtime, ss.endtime) &lt;= #{rateDay} + COALESCE(cp.compensate_days, 0)
@@ -769,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>
@@ -777,6 +749,7 @@
            AND ss.visit_time &lt; DATE_ADD(#{endtime}, INTERVAL 1 DAY)
        </if>
        <if test="orgid != null and orgid != ''">AND ss.orgid = #{orgid}</if>
        <if test="campusid != null and campusid != ''">and ss.campusid = #{campusid}</if>
        <if test="deptcode != null  and deptcode != ''">and ss.deptcode = #{deptcode}</if>
        <if test="deptname != null  and deptname != ''">and ss.deptname = #{deptname}</if>
        <if test="isabnormal != null">and ss.isabnormal = #{isabnormal}</if>
@@ -801,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=","
@@ -810,7 +789,6 @@
            GROUP BY ss.${groupKey}
        </if>
    </select>
    <select id="selectTimelyRateDetail" parameterType="com.smartor.domain.ServiceSubtask"
            resultMap="ServiceSubtaskResult">
@@ -830,6 +808,7 @@
            AND date_format(visit_time,'%y%m%d') &lt;= date_format(#{endtime},'%y%m%d')
        </if>
        <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
        <if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
        <if test="serviceType != null and serviceType != ''">and service_type = #{serviceType}</if>
        <if test="serviceTypes != null and serviceTypes != ''">and service_type IN (#{serviceTypes})</if>
        <if test="isabnormal != null ">and isabnormal = #{isabnormal}</if>
@@ -860,7 +839,8 @@
        <if test="sendname != null">and sendname like concat('%',#{sendname}, '%')</if>
        <if test="taskName != null">and task_name like concat('%',#{taskName}, '%')</if>
        <if test="sendstate != null">and sendstate = #{sendstate}</if>
        <if test="orgid != null">and orgid =#{orgid}</if>
        <if test="orgid != null and orgid != ''">and orgid = #{orgid} </if>
        <if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
        <if test="continueFlag != null ">and continue_flag = #{continueFlag}</if>
        <if test="continueTimeNow != null ">and continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP}</if>
        <if test="continueCount != null ">and continue_count = #{continueCount}</if>
@@ -906,7 +886,8 @@
            <if test="createTime != null">create_time,</if>
            <if test="isupload != null">isupload,</if>
            <if test="uploadTime != null">upload_time,</if>
            <if test="orgid != null">orgid,</if>
            <if test="orgid != null and orgid != ''">orgid,</if>
            <if test="campusid != null and campusid != ''">campusid,</if>
            <if test="pid != null">pid,</if>
            <if test="guid != null">guid,</if>
            <if test="textParam != null">text_param,</if>
@@ -970,11 +951,11 @@
            <if test="continueTimeNext != null ">continue_time_next,</if>
            <if test="continueContent != null ">continue_content,</if>
            <if test="operationItemId != null ">operation_item_id,</if>
            <if test="campusid != null">campusid,</if>
            <if test="scheduleId != null ">schedule_id,</if>
            <if test="scheduleDetailId != null ">schedule_detail_id,</if>
            <if test="scheduleSeq != null ">schedule_seq,</if>
            <if test="loopCount != null ">loop_count,</if>
            <if test="isManuallyCalled != null ">is_manually_called,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="sendname != null">#{sendname},</if>
@@ -1003,7 +984,8 @@
            <if test="createTime != null">#{createTime},</if>
            <if test="isupload != null">#{isupload},</if>
            <if test="uploadTime != null">#{uploadTime},</if>
            <if test="orgid != null">#{orgid},</if>
            <if test="orgid != null and orgid != ''">#{orgid},</if>
            <if test="campusid != null and campusid != ''">#{campusid},</if>
            <if test="pid != null">#{pid},</if>
            <if test="guid != null">#{guid},</if>
            <if test="textParam != null">#{textParam},</if>
@@ -1067,11 +1049,11 @@
            <if test="continueTimeNext != null ">#{continueTimeNext,jdbcType=TIMESTAMP},</if>
            <if test="continueContent != null ">#{continueContent},</if>
            <if test="operationItemId != null ">#{operationItemId},</if>
            <if test="campusid != null">#{campusid},</if>
            <if test="scheduleId != null ">#{scheduleId},</if>
            <if test="scheduleDetailId != null ">#{scheduleDetailId},</if>
            <if test="scheduleSeq != null ">#{scheduleSeq},</if>
            <if test="loopCount != null ">#{loopCount},</if>
            <if test="isManuallyCalled != null ">#{isManuallyCalled},</if>
        </trim>
    </insert>
@@ -1105,7 +1087,8 @@
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="isupload != null">isupload = #{isupload},</if>
            <if test="uploadTime != null">upload_time = #{uploadTime},</if>
            <if test="orgid != null">orgid = #{orgid},</if>
            <if test="orgid != null and orgid != ''">orgid = #{orgid},</if>
            <if test="campusid != null and campusid != ''">campusid = #{campusid},</if>
            <if test="pid != null">pid = #{pid},</if>
            <if test="guid != null">guid = #{guid},</if>
            <if test="textParam != null">text_param = #{textParam},</if>
@@ -1169,11 +1152,11 @@
            <if test="continueTimeNext != null ">continue_time_next = #{continueTimeNext,jdbcType=TIMESTAMP},</if>
            <if test="continueContent != null ">continue_content = #{continueContent},</if>
            <if test="operationItemId != null ">operation_item_id = #{operationItemId},</if>
            <if test="campusid != null">campusid=#{campusid},</if>
            <if test="scheduleId != null ">schedule_id = #{scheduleId},</if>
            <if test="scheduleDetailId != null ">schedule_detail_id = #{scheduleDetailId},</if>
            <if test="scheduleSeq != null ">schedule_seq = #{scheduleSeq},</if>
            <if test="loopCount != null ">loop_count = #{loopCount},</if>
            <if test="isManuallyCalled != null ">is_manually_called = #{isManuallyCalled},</if>
        </trim>
        where id = #{id}
    </update>
@@ -1208,7 +1191,8 @@
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="isupload != null">isupload = #{isupload},</if>
            <if test="uploadTime != null">upload_time = #{uploadTime},</if>
            <if test="orgid != null">orgid = #{orgid},</if>
            <if test="orgid != null and orgid != ''">orgid = #{orgid},</if>
            <if test="campusid != null and campusid != ''">campusid = #{campusid},</if>
            <if test="pid != null">pid = #{pid},</if>
            <if test="guid != null">guid = #{guid},</if>
            <if test="textParam != null">text_param = #{textParam},</if>
@@ -1271,13 +1255,14 @@
            <if test="continueCount != null ">continue_count = #{continueCount},</if>
            <if test="continueTimeNext != null ">continue_time_next = #{continueTimeNext,jdbcType=TIMESTAMP},</if>
            <if test="continueContent != null ">continue_content = #{continueContent},</if>
            <if test="isManuallyCalled != null ">is_manually_called = #{isManuallyCalled},</if>
        </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="orgid != null and orgid != ''">and orgid = #{orgid}</if>
        <if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
    </update>
    <update id="updateServiceSubtaskByCondition" parameterType="com.smartor.domain.ServiceSubtask">
@@ -1311,7 +1296,8 @@
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="isupload != null">isupload = #{isupload},</if>
            <if test="uploadTime != null">upload_time = #{uploadTime},</if>
            <if test="orgid != null">orgid = #{orgid},</if>
            <if test="orgid != null and orgid != ''">orgid = #{orgid},</if>
            <if test="campusid != null and campusid != ''">campusid = #{campusid},</if>
            <if test="pid != null">pid = #{pid},</if>
            <if test="guid != null">guid = #{guid},</if>
            <if test="visitCount != null">visit_count = #{visitCount},</if>
@@ -1373,6 +1359,7 @@
            <if test="continueCount != null ">continue_count = #{continueCount},</if>
            <if test="continueTimeNext != null ">continue_time_next = #{continueTimeNext,jdbcType=TIMESTAMP},</if>
            <if test="continueContent != null ">continue_content = #{continueContent},</if>
            <if test="isManuallyCalled != null ">is_manually_called = #{isManuallyCalled},</if>
        </trim>
        <where>
            <if test="patid != null ">
@@ -1383,6 +1370,9 @@
            </if>
            <if test="id != null ">
                and id = #{id}
            </if>
            <if test="inhospid != null ">
                and inhospid = #{inhospid}
            </if>
        </where>
    </update>
@@ -1417,7 +1407,8 @@
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="isupload != null">isupload = #{isupload},</if>
            <if test="uploadTime != null">upload_time = #{uploadTime},</if>
            <if test="orgid != null">orgid = #{orgid},</if>
            <if test="orgid != null and orgid != ''">orgid = #{orgid},</if>
            <if test="campusid != null and campusid != ''">campusid = #{campusid},</if>
            <if test="pid != null">pid = #{pid},</if>
            <if test="guid != null">guid = #{guid},</if>
            <if test="textParam != null">text_param = #{textParam},</if>
@@ -1479,10 +1470,10 @@
            <if test="continueCount != null ">continue_count = #{continueCount},</if>
            <if test="continueTimeNext != null ">continue_time_next = #{continueTimeNext,jdbcType=TIMESTAMP},</if>
            <if test="continueContent != null ">continue_content = #{continueContent},</if>
            <if test="isManuallyCalled != null ">is_manually_called = #{isManuallyCalled},</if>
        </trim>
        where task_guid = #{taskGuid} and task_name = #{taskName}
    </update>
    <update id="deleteServiceSubtaskById" parameterType="Long">
        update service_subtask
@@ -1547,6 +1538,9 @@
        and 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="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
            AND leavehospitaldistrictcode IN
@@ -1636,12 +1630,9 @@
        and a.del_flag = '0'
        and b.del_flag = '0'
        and a.appltype = '3'
        <if test="orgid != null and orgid != ''">
            and a.orgid = #{orgid}
        </if>
        <if test="taskId != null">
            and a.task_id = #{taskId}
        </if>
        <if test="orgid != null and orgid != ''">and a.orgid = #{orgid}</if>
        <if test="campusid != null and campusid != ''">and b.campusid = #{campusid}</if>
        <if test="taskId != null">and a.task_id = #{taskId}</if>
        <if test="taskName != null and taskName != ''">
            and a.task_name like concat('%', #{taskName}, '%')
        </if>
@@ -1731,6 +1722,9 @@
        <if test="orgid != null and orgid != ''">
            and orgid = #{orgid}
        </if>
        <if test="campusid != null and campusid != ''">
            and campusid = #{campusid}
        </if>
        <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
            AND leavehospitaldistrictcode IN
            <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
@@ -1787,132 +1781,135 @@
    <select id="getSfStatisticsHyperlink" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
            resultMap="ServiceSubtaskResult">
            select id,
            visit_count,
            is_visit_again,
            type,
            orgid,
            drcode,
            drname,
            leavehospitaldistrictcode,
            leavehospitaldistrictname,
            deptcode,
            deptname,
            sendstate,
            preachform,
            current_preachform,
            excep,
            nurse_id,
            nurse_name,
            taskid,
            task_name,
            visit_time,
            finishtime,
            endtime,
            senddate,
            suggest,
            result,
            templateid,
            templatename,
            patid,
            sendname,
            send_type,
            recordid,
            exrecallcount,
            continue_flag,
            continue_time_now,
            continue_content,
            continue_count,
            continue_time_next,
            task_situation,
            remark
            from service_subtask
            where 1=1
            and del_flag = 0
            <if test="orgid != null and orgid != ''">
                and orgid = #{orgid}
        select id,
        visit_count,
        is_visit_again,
        type,
        orgid,
        drcode,
        drname,
        leavehospitaldistrictcode,
        leavehospitaldistrictname,
        deptcode,
        deptname,
        sendstate,
        preachform,
        current_preachform,
        excep,
        nurse_id,
        nurse_name,
        taskid,
        task_name,
        visit_time,
        finishtime,
        endtime,
        senddate,
        suggest,
        result,
        templateid,
        templatename,
        patid,
        sendname,
        send_type,
        recordid,
        exrecallcount,
        continue_flag,
        continue_time_now,
        continue_content,
        continue_count,
        continue_time_next,
        task_situation,
        remark
        from service_subtask
        where 1=1
        and 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="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
            AND leavehospitaldistrictcode IN
            <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
                     close=")">
                #{leavehospitaldistrictcode}
            </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="serviceType != null and serviceType.size() > 0">
            AND service_type IN
            <foreach collection="serviceType" item="serviceType" open="(" separator=","
                     close=")">
                #{serviceType}
            </foreach>
        </if>
        <if test="startTime != null and endTime!=null">
            AND visit_time >= DATE(#{startTime})
            AND visit_time &lt; DATE_ADD(DATE(#{endTime}), INTERVAL 1 DAY)
        </if>
        <if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
        <if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if>
        <if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
        <if test="continueFlag != null ">and continue_flag = #{continueFlag}</if>
        <if test="continueTimeNow != null ">and continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP}</if>
        <if test="continueCount != null ">and continue_count = #{continueCount}</if>
        <if test="continueTimeNext != null ">and continue_time_next = #{continueTimeNext,jdbcType=TIMESTAMP}</if>
        <!-- 目前只统计语音和问卷 -->
        <if test="type != null">
            and type = #{type}
        </if>
        <if test="visitCount != null and visitCount == 1">
            AND visit_count = 1
        </if>
        <if test="visitCount != null and visitCount > 1">
            AND visit_count > 1
        </if>
        <if test="groupKey != null and groupKey != '' and groupKeyList != null and groupKeyList.size>0">
            AND ${groupKey} IN
            <foreach collection="groupKeyList" item="key" open="(" separator=","
                     close=")">
                #{key}
            </foreach>
        </if>
        AND sendstate IS NOT NULL
        <if test="sendstates != null and sendstates.size() > 0">
            AND sendstate IN
            <foreach collection="sendstates" item="state" open="(" separator="," close=")">
                #{state}
            </foreach>
        </if>
        <if test="currentPreachform != null">
            AND current_preachform = #{currentPreachform}
            <if test="followUpCountStyle != null and followUpCountStyle = '1'">
                AND sendstate != 4
            </if>
            <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
                AND leavehospitaldistrictcode IN
                <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
                         close=")">
                    #{leavehospitaldistrictcode}
                </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="serviceType != null and serviceType.size() > 0">
                AND service_type IN
                <foreach collection="serviceType" item="serviceType" open="(" separator=","
                         close=")">
                    #{serviceType}
                </foreach>
            </if>
            <if test="startTime != null and endTime!=null">
                AND visit_time >= DATE(#{startTime})
                AND visit_time &lt; DATE_ADD(DATE(#{endTime}), INTERVAL 1 DAY)
            </if>
            <if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
            <if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if>
            <if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
            <if test="continueFlag != null ">and continue_flag = #{continueFlag}</if>
            <if test="continueTimeNow != null ">and continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP}</if>
            <if test="continueCount != null ">and continue_count = #{continueCount}</if>
            <if test="continueTimeNext != null ">and continue_time_next = #{continueTimeNext,jdbcType=TIMESTAMP}</if>
            <!-- 目前只统计语音和问卷 -->
            <if test="type != null">
                and type = #{type}
            </if>
            <if test="visitCount != null and visitCount == 1">
                AND visit_count = 1
            </if>
            <if test="visitCount != null and visitCount > 1">
                AND visit_count > 1
            </if>
            <if test="groupKey != null and groupKey != '' and groupKeyList != null and groupKeyList.size>0">
                AND ${groupKey} IN
                <foreach collection="groupKeyList" item="key" open="(" separator=","
                         close=")">
                    #{key}
                </foreach>
            </if>
            AND sendstate IS NOT NULL
            <if test="sendstates != null and sendstates.size() > 0">
                AND sendstate IN
                <foreach collection="sendstates" item="state" open="(" separator="," close=")">
                    #{state}
                </foreach>
            </if>
            <if test="currentPreachform != null">
                AND current_preachform = #{currentPreachform}
                <if test="followUpCountStyle != null and followUpCountStyle = '1'">
                    AND sendstate != 4
                </if>
            </if>
            <if test="excep != null and excep != ''">
                AND excep = #{excep}
            </if>
            <if test="taskSituation != null">
                AND task_situation = #{taskSituation}
            </if>
            <if test="drcode != null and drcode != ''">
                AND drcode = #{drcode}
            </if>
            <if test="leavehospitaldistrictcode != null and leavehospitaldistrictcode != ''">
                AND leavehospitaldistrictcode = #{leavehospitaldistrictcode}
            </if>
            <if test="deptcode != null and deptcode != ''">
                AND deptcode = #{deptcode}
            </if>
            order by endtime desc
            <if test="pageSize != null  and pageNum != null">
                limit ${pageSize} OFFSET ${pageNum}
            </if>
        </if>
        <if test="excep != null and excep != ''">
            AND excep = #{excep}
        </if>
        <if test="taskSituation != null">
            AND task_situation = #{taskSituation}
        </if>
        <if test="drcode != null and drcode != ''">
            AND drcode = #{drcode}
        </if>
        <if test="leavehospitaldistrictcode != null and leavehospitaldistrictcode != ''">
            AND leavehospitaldistrictcode = #{leavehospitaldistrictcode}
        </if>
        <if test="deptcode != null and deptcode != ''">
            AND deptcode = #{deptcode}
        </if>
        order by endtime desc
        <if test="pageSize != null  and pageNum != null">
            limit ${pageSize} OFFSET ${pageNum}
        </if>
    </select>
    <select id="getSfStatisticsJoy" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
@@ -1926,6 +1923,9 @@
        and 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="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
            AND leavehospitaldistrictcode IN
@@ -1971,6 +1971,9 @@
        <if test="orgid != null and orgid != ''">
            and orgid = #{orgid}
        </if>
        <if test="campusid != null and campusid != ''">
            and campusid = #{campusid}
        </if>
        <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
            AND leavehospitaldistrictcode IN
            <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
@@ -2002,6 +2005,9 @@
        and 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="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">AND
            leavehospitaldistrictcode IN
@@ -2057,6 +2063,9 @@
        AND t.del_flag=0
        <if test="orgid != null and orgid != ''">
            and t.orgid = #{orgid}
        </if>
        <if test="campusid != null and campusid != ''">
            and t.campusid = #{campusid}
        </if>
        <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
            AND t.leavehospitaldistrictcode IN
@@ -2141,6 +2150,9 @@
        <if test="orgid != null and orgid != ''">
            AND ss.orgid = #{orgid}
        </if>
        <if test="campusid != null and campusid != ''">
            AND ss.campusid = #{campusid}
        </if>
        <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
            AND ss.leavehospitaldistrictcode IN
            <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
@@ -2197,6 +2209,9 @@
        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="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
            AND ss.leavehospitaldistrictcode IN
@@ -2355,8 +2370,11 @@
        AND DATE_FORMAT(visit_time, '%Y-%m-%d') &lt;= #{endDate}
        AND service_type IN (2, 13)
        AND del_flag = '0'
        <if test="orgid != null">
        <if test="orgid != null and orgid != ''">
            AND orgid = #{orgid}
        </if>
        <if test="campusid != null and campusid != ''">
            AND campusid = #{campusid}
        </if>
        GROUP BY deptname
    </select>
@@ -2402,10 +2420,12 @@
            AND visit_time &lt;= DATE_ADD(#{endDate}, INTERVAL 1 DAY)
        </if>
        <if test="orgid != null">
        <if test="orgid != null and orgid != ''">
            AND orgid = #{orgid}
        </if>
        <if test="campusid != null and campusid != ''">
            AND campusid = #{campusid}
        </if>
        <if test="deptcodes != null and deptcodes.size() > 0">
            AND deptcode IN
            <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
@@ -2459,10 +2479,12 @@
            AND endtime &lt;= DATE_ADD(#{endDate}, INTERVAL 1 DAY)
        </if>
        AND inhospstate=1
        <if test="orgid != null">
        <if test="orgid != null and orgid != ''">
            AND orgid = #{orgid}
        </if>
        <if test="campusid != null and campusid != ''">
            AND campusid = #{campusid}
        </if>
        <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
            AND leavehospitaldistrictcode IN
            <foreach collection="leavehospitaldistrictcodes" item="districtcode" open="(" separator="," close=")">
@@ -2509,9 +2531,11 @@
        <!--            AND admitdate &lt;= DATE_ADD(#{endDate}, INTERVAL 1 DAY)-->
        <!--        </if>-->
        <!--        <if test="orgid != null">-->
        <!--            AND orgid = #{orgid}-->
        <!--             AND orgid = #{orgid}-->
        <!--        </if>-->
        <!--        <if test="campusid != null">-->
        <!--             AND campusid = #{campusid}-->
        <!--        </if>-->
        <!--        <if test="deptcodes != null and deptcodes.size() > 0">-->
        <!--            AND deptcode IN-->
        <!--            <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">-->
@@ -2536,6 +2560,8 @@
        SUM(CASE WHEN sendstate != 4 THEN 1 ELSE 0 END) AS xsf,
        SUM(CASE WHEN (sendstate = 1 OR sendstate = 2 OR sendstate = 3 OR sendstate = 5 OR sendstate = 7 ) THEN 1 ELSE 0
        END) AS dsf,
        SUM(CASE WHEN sendstate != 2 THEN 1 ELSE 0 END) AS yfs,
        SUM(CASE WHEN sendstate = 2 THEN 1 ELSE 0 END) AS wfs,
        SUM(CASE WHEN sendstate = 6 THEN 1 ELSE 0 END) AS ywc,
        SUM(CASE WHEN excep IS NOT NULL AND excep = '1' THEN 1 ELSE 0 END) AS yc,
        SUM(CASE WHEN excep IS NOT NULL AND excep = '2' THEN 1 ELSE 0 END) AS jg,
@@ -2548,6 +2574,12 @@
        </if>
        <if test="phone != null and phone != ''">
            AND phone = #{phone}
        </if>
        <if test="finishtimeStart != null">
            AND date_format(finishtime,'%y%m%d') &gt;= date_format(#{finishtimeStart},'%y%m%d')
        </if>
        <if test="finishtimeEnd != null">
            AND date_format(finishtime,'%y%m%d') &lt;= date_format(#{finishtimeEnd},'%y%m%d')
        </if>
        <if test="deptOrDistrict==1">
            <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
@@ -2724,7 +2756,6 @@
        </if>
    </select>
    <select id="selectVisitCount" parameterType="com.smartor.domain.PatMedReq"
            resultType="com.smartor.domain.PatMedRes">
        select
@@ -2735,8 +2766,11 @@
        where 1=1
        and del_flag = 0
        and service_type=3
        <if test="orgid != null">
            and orgid = #{orgid}
        <if test="orgid != null and orgid != ''">
            AND orgid = #{orgid}
        </if>
        <if test="campusid != null and campusid != ''">
            AND campusid = #{campusid}
        </if>
        <if test="startDate != null">
            AND date_format( visit_time, '%y%m%d' ) &gt;= date_format( #{startDate}, '%y%m%d' )
@@ -2768,6 +2802,9 @@
        <if test="orgid != null and orgid != ''">
            AND orgid = #{orgid}
        </if>
        <if test="campusid != null and campusid != ''">
            and campusid = #{campusid}
        </if>
        <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
            AND leavehospitaldistrictcode IN
            <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="("
@@ -2785,55 +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>
    <!--
            <!--
        按病区或科室分组统计 continue_flag 数量
        传了 leavehospitaldistrictcodes → 按病区维度
        传了 deptcodes              → 按科室维度
@@ -2854,6 +2843,9 @@
        AND leavehospitaldistrictcode IS NOT NULL AND leavehospitaldistrictcode != ''
        <if test="orgid != null and orgid != ''">
            AND orgid = #{orgid}
        </if>
        <if test="campusid != null and campusid != ''">
            AND campusid = #{campusid}
        </if>
        <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
            AND leavehospitaldistrictcode IN
@@ -2880,6 +2872,9 @@
        AND deptcode IS NOT NULL AND deptcode != ''
        <if test="orgid != null and orgid != ''">
            AND orgid = #{orgid}
        </if>
        <if test="campusid != null and campusid != ''">
            AND campusid = #{campusid}
        </if>
        <if test="deptcodes != null and deptcodes.size() > 0">
            AND deptcode IN
@@ -2912,6 +2907,9 @@
        AND service_type = 4
        <if test="orgid != null and orgid != ''">
            and orgid = #{orgid}
        </if>
        <if test="campusid != null and campusid != ''">
            and campusid = #{campusid}
        </if>
        <if test="sendstate != null">
            AND sendstate = #{sendstate}
@@ -2956,12 +2954,12 @@
          and sendstate in (1, 2, 3)
    </select>
    <!-- 任务组(appltype=5)滚动调度用:拉本轮全量 subtask,作为下一轮的克隆模板 -->
                <!-- 任务组(appltype=5)滚动调度用:拉本轮全量 subtask,作为下一轮的克隆模板 -->
    <select id="selectByScheduleIdAndLoop" resultMap="ServiceSubtaskResult">
        <include refid="selectServiceSubtaskVo"/>
        where schedule_id = #{scheduleId}
          and loop_count = #{loopCount}
          and (del_flag is null or del_flag = '0')
        and loop_count = #{loopCount}
        and (del_flag is null or del_flag = '0')
        order by schedule_seq asc, id asc
    </select>
@@ -3013,6 +3011,9 @@
        <if test="orgid != null and orgid != ''">
            and orgid = #{orgid}
        </if>
        <if test="campusid != null and campusid != ''">
            and campusid = #{campusid}
        </if>
        <if test="sendstate != null">
            AND sendstate = #{sendstate}
        </if>
@@ -3044,109 +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,
        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 t.taskid IN
        <foreach collection="taskIds" item="taskId" open="(" separator="," close=")">
            #{taskId}
        </foreach>
        and s.sendstate=6
        and d.del_flag=0
        GROUP BY
        t.taskid,
        d.questiontext
        ) t2 ON t2.taskid = t.taskid AND t2.questiontext = d.questiontext
        WHERE t.taskid IN
        <foreach collection="taskIds" item="taskId" open="(" separator="," close=")">
            #{taskId}
        </foreach>
        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>
        GROUP BY
        t.taskid,
        d.questiontext,
        d.asrtext
        ORDER BY
        d.questiontext,
        t.taskid
    </select>
    <!-- 新方法:根据子任务 ID 统计问题选项百分比 (用于满意度统计 serviceType=6) -->
    <select id="statQuestionOptionBySubtaskIds" resultType="com.smartor.domain.ServiceSubtaskDetailRatioExport">
        SELECT
        d.questiontext AS questiontext,
        t.taskid AS taskid,
        t.task_name AS taskName,
        d.asrtext AS optionresult,
        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
            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 s.id IN
            <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")">
                #{subtaskId}
            </foreach>
            AND s.sendstate = 6
            AND d.del_flag=0
            GROUP BY d.questiontext  -- ← 关键修改:按题目分组统计每个题目的总数
        ) t2 ON t2.questiontext = d.questiontext  -- ← 关联到当前题目
        WHERE s.id IN
        <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")">
            #{subtaskId}
        </foreach>
        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>
        GROUP BY
        t.taskid,
        d.questiontext,
        d.asrtext
        ORDER BY
        d.questiontext,
        t.taskid
    </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
@@ -3155,5 +3054,6 @@
        and endtime
    </select>
</mapper>
    <!-- 门诊满意度综合得分排名(按科室或病区) -->
    </mapper>