From 74fbf1d9ae44bf3354f46caa0e43a2358fa1fbea Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期三, 23 九月 2026 17:11:58 +0800
Subject: [PATCH] 【丽水】更新AI电话
---
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml | 150 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 146 insertions(+), 4 deletions(-)
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 4a23796..9c23ee0 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/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>
@@ -245,7 +246,8 @@
schedule_detail_id,
schedule_seq,
loop_count,
- task_situation
+ task_situation,
+ is_manually_called
from service_subtask
</sql>
@@ -513,6 +515,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
@@ -976,6 +979,7 @@
<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>
@@ -1073,6 +1077,7 @@
<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>
@@ -1175,6 +1180,7 @@
<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>
@@ -1273,6 +1279,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 1=1
<if test="patid != null ">and patid = #{patid}</if>
@@ -1375,6 +1382,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 ">
@@ -1485,6 +1493,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 task_guid = #{taskGuid} and task_name = #{taskName}
</update>
@@ -2575,6 +2584,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,
@@ -3027,7 +3038,7 @@
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 (6, 14)
+ WHERE t.service_type IN (14)
AND t.del_flag = 0
AND d.del_flag = 0
AND d.create_time >= #{startFinishTime}
@@ -3249,6 +3260,13 @@
#{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 >= #{scoreStart}</if>
<if test="scoreEnd != null">AND d.score <= #{scoreEnd}</if>
@@ -3257,6 +3275,19 @@
</if>
and s.sendstate=6
and d.del_flag=0
+ <!-- 鍒嗘瘝蹇呴』鍜屾槑缁嗙敤鍚屼竴濂楁椂闂存潯浠讹紝鍚﹀垯閫変簡鏃堕棿鑼冨洿鍚庢瘮渚嬩細鎸夊叏閲忓巻鍙茶绋�閲� -->
+ <if test="startOutHospTime != null">
+ AND date_format(s.endtime,'%y%m%d') >= date_format(#{startOutHospTime},'%y%m%d')
+ </if>
+ <if test="endOutHospTime != null">
+ AND date_format(s.endtime,'%y%m%d') <= date_format(#{endOutHospTime},'%y%m%d')
+ </if>
+ <if test="startFinishTime != null">
+ AND date_format(s.finishtime,'%y%m%d') >= date_format(#{startFinishTime},'%y%m%d')
+ </if>
+ <if test="endFinishTime != null">
+ AND date_format(s.finishtime,'%y%m%d') <= date_format(#{endFinishTime},'%y%m%d')
+ </if>
GROUP BY
t.taskid,
d.questiontext
@@ -3266,6 +3297,12 @@
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>
@@ -3300,6 +3337,64 @@
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 <=> 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
@@ -3320,6 +3415,14 @@
service_task t
INNER JOIN service_subtask s ON s.taskid = t.taskid
INNER JOIN service_subtask_detail d ON d.sub_id = s.id
+ <!-- 鍘婚噸锛氬悓涓�瀛愪换鍔″悓涓�棰樼洰鍙繚鐣欐渶鏂颁竴鏉★紝閬垮厤閲嶇瓟/閲嶅鍥炶皟鎶婂悓涓�閬撻閲嶅璁″叆椤规暟锛堜笌 mzMydScoreRank 鍙e緞涓�鑷达級 -->
+ AND d.id = (
+ SELECT MAX(d2.id)
+ FROM service_subtask_detail d2
+ WHERE d2.sub_id = d.sub_id
+ AND d2.questiontext <=> d.questiontext
+ AND d2.del_flag = '0'
+ )
INNER JOIN (
SELECT
d.questiontext,
@@ -3328,6 +3431,14 @@
service_task t
INNER JOIN service_subtask s ON s.taskid = t.taskid
INNER JOIN service_subtask_detail d ON d.sub_id = s.id
+ <!-- 鍘婚噸锛氬垎姣嶏紙璇ラ鏈夋晥绛斿嵎鎬绘暟锛変笌鏄庣粏鍙e緞淇濇寔涓�鑷达紝淇濊瘉鍚勯�夐」姣斾緥鍚堣 100% -->
+ AND d.id = (
+ SELECT MAX(d4.id)
+ FROM service_subtask_detail d4
+ WHERE d4.sub_id = d.sub_id
+ AND d4.questiontext <=> d.questiontext
+ AND d4.del_flag = '0'
+ )
WHERE 1=1
<if test="subtaskIds != null and subtaskIds.size() > 0">
AND s.id IN
@@ -3336,16 +3447,37 @@
</foreach>
</if>
<if test="valueType != null">AND d.value_type >= #{valueType}</if>
- <if test="scoreStart != null">AND d.score = #{scoreStart}</if>
+ <if test="scoreStart != null">AND d.score >= #{scoreStart}</if>
<if test="scoreEnd != null">AND d.score <= #{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') >= date_format(#{startOutHospTime},'%y%m%d')
+ </if>
+ <if test="endOutHospTime != null">
+ AND date_format(s.endtime,'%y%m%d') <= date_format(#{endOutHospTime},'%y%m%d')
+ </if>
+ <if test="startFinishTime != null">
+ AND date_format(s.finishtime,'%y%m%d') >= date_format(#{startFinishTime},'%y%m%d')
+ </if>
+ <if test="endFinishTime != null">
+ AND date_format(s.finishtime,'%y%m%d') <= date_format(#{endFinishTime},'%y%m%d')
+ </if>
GROUP BY d.questiontext
) t2 ON t2.questiontext = d.questiontext
WHERE 1=1
+ <!-- 鍘婚噸锛氭槑缁嗚鍚屼竴瀛愪换鍔″悓涓�棰樼洰鍙繚鐣欐渶鏂颁竴鏉★紝閲嶇瓟涓嶉噸澶嶈鍏ラ」鏁� -->
+ AND d.id = (
+ SELECT MAX(d3.id)
+ FROM service_subtask_detail d3
+ WHERE d3.sub_id = d.sub_id
+ AND d3.questiontext <=> 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=")">
@@ -3484,7 +3616,13 @@
WHERE s.del_flag = '0'
AND d.del_flag = '0'
AND s.sendstate = 6
- AND s.service_type = #{serviceType}
+ <if test="serviceTypes != null and serviceTypes.size() > 0">
+ AND service_type IN
+ <foreach collection="serviceTypes" item="serviceType" open="(" separator=","
+ close=")">
+ #{serviceType}
+ </foreach>
+ </if>
<!-- <!– 鍙彇鍏紡閲岀殑浜旀。鏉冮噸锛岀┖鍊�/0/鏈瓟绛夋棦涓嶈繘鍒嗗瓙涔熶笉杩涘垎姣� –>-->
<!-- AND CAST(d.score AS DECIMAL(10,4)) IN (1, 0.8, 0.6, 0.4, 0.2)-->
<!-- 鍚屼竴瀛愪换鍔″悓涓�棰樼洰鍙繚鐣欐渶鏂颁竴鏉★紝閬垮厤閲嶇瓟琚噸澶嶈鍏ラ」鏁� -->
@@ -3506,6 +3644,9 @@
</if>
<if test="endFinishTime != null">
AND s.finishtime < 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"'>
@@ -3538,5 +3679,6 @@
</select>
+
</mapper>
--
Gitblit v1.9.3