From 8107dedd85ceec29491293d8ebf69f7d7213aa6b Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期一, 21 九月 2026 15:24:08 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml | 226 +++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 188 insertions(+), 38 deletions(-)
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 0c32669..9471442 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -1386,6 +1386,9 @@
<if test="id != null ">
and id = #{id}
</if>
+ <if test="inhospid != null ">
+ and inhospid = #{inhospid}
+ </if>
</where>
</update>
@@ -2585,6 +2588,12 @@
<if test="phone != null and phone != ''">
AND phone = #{phone}
</if>
+ <if test="finishtimeStart != null">
+ AND date_format(finishtime,'%y%m%d') >= date_format(#{finishtimeStart},'%y%m%d')
+ </if>
+ <if test="finishtimeEnd != null">
+ AND date_format(finishtime,'%y%m%d') <= date_format(#{finishtimeEnd},'%y%m%d')
+ </if>
<if test="deptOrDistrict==1">
<if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
AND leavehospitaldistrictcode IN
@@ -3007,6 +3016,117 @@
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 (6, 14)
+ AND t.del_flag = 0
+ AND d.del_flag = 0
+ AND d.create_time >= #{startFinishTime}
+ AND d.create_time < 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 < #{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 < #{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 < #{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 < #{endFinishTime}
+ GROUP BY p.period, c.campusid
+ ORDER BY p.period, c.campusid;
+ </select>
+
<!-- 浠诲姟缁勶紙appltype=5锛夋粴鍔ㄨ皟搴︾敤锛氭媺鏈疆鍏ㄩ噺 subtask锛屼綔涓轰笅涓�杞殑鍏嬮殕妯℃澘 -->
<select id="selectByScheduleIdAndLoop" resultMap="ServiceSubtaskResult">
<include refid="selectServiceSubtaskVo"/>
@@ -3162,6 +3282,12 @@
<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,
@@ -3240,12 +3366,24 @@
<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,
d.score,
d.targetvalue,
- d.asrtext
+ d.asrtext,
+ t.task_name,
+ s.deptcode,
+ s.deptname,
+ s.leavehospitaldistrictcode,
+ s.leavehospitaldistrictname,
+ d.value_type
ORDER BY
d.questiontext,
t.taskid
@@ -3253,50 +3391,61 @@
<select id="statQuestionOptionByKsOrBq" resultType="com.smartor.domain.DTO.QuestionCountKsOrBqDTO"
parameterType="com.smartor.domain.VO.QuestionCountKsOrBqVO">
- SELECT questiontext,
- d.taskid,
- s.deptname,
- d.create_time as createTime,
- s.leavehospitaldistrictname,
- d.targetvalue,
- d.asrtext,
- COUNT(d.asrtext) AS answercount,
- d.score AS singleScore
- FROM service_subtask_detail d,
- service_task s
- WHERE d.taskid = s.taskid
- AND deptname IS NOT NULL
- AND leavehospitaldistrictname IS NOT NULL
+ 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 < #{endFinishTime}
</if>
<if test="startFinishTime != null">
- AND d.create_time >= #{startFinishTime}
+ AND d.create_time >= #{startFinishTime}
</if>
- <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
- AND leavehospitaldistrictcode IN
- <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="("
- separator=","
- close=")">
- #{leavehospitaldistrictcode}
- </foreach>
+ <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=" leaveldeptcodes != null and leaveldeptcodes.size()>0">
- AND deptcode IN
- <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
- close=")">
- #{leaveldeptcode}
- </foreach>
+ <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>
- GROUP BY d.questiontext,
- d.taskid,
- d.score,
- s.deptname,
- d.targetvalue,
- d.create_time,
- s.leavehospitaldistrictname,
- d.asrtext
- ORDER BY d.taskid
</select>
<select id="selectServiceSubtaskListDeadLine" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
@@ -3308,5 +3457,6 @@
and endtime
</select>
+
</mapper>
--
Gitblit v1.9.3