| | |
| | | <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> |
| | | |
| | |
| | | schedule_detail_id, |
| | | schedule_seq, |
| | | loop_count, |
| | | task_situation |
| | | task_situation, |
| | | is_manually_called |
| | | from service_subtask |
| | | </sql> |
| | | |
| | |
| | | <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 |
| | |
| | | <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> |
| | |
| | | <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> |
| | | |
| | |
| | | <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> |
| | |
| | | <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="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 "> |
| | |
| | | </if> |
| | | <if test="id != null "> |
| | | and id = #{id} |
| | | </if> |
| | | <if test="inhospid != null "> |
| | | and inhospid = #{inhospid} |
| | | </if> |
| | | </where> |
| | | </update> |
| | |
| | | <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> |
| | |
| | | <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 |
| | |
| | | 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 < 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"/> |
| | |
| | | <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, |
| | |
| | | <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 |
| | |
| | | |
| | | <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" |
| | |
| | | and endtime |
| | | </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> |
| | | <!-- <!– 只取公式里的五档权重,空值/0/未答等既不进分子也不进分母 –>--> |
| | | <!-- 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 <=> 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 >= #{startFinishTime} |
| | | </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"'> |
| | | AND s.leavehospitaldistrictcode IS NOT NULL AND s.leavehospitaldistrictcode <> '' |
| | | AND s.leavehospitaldistrictname IS NOT NULL AND s.leavehospitaldistrictname <> '' |
| | | <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 <> '' |
| | | AND s.deptname IS NOT NULL AND s.deptname <> '' |
| | | <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> |
| | | |