| | |
| | | <result property="assigntime" column="assigntime"/> |
| | | <result property="starttime" column="starttime"/> |
| | | <result property="answertime" column="answertime"/> |
| | | <result property="dimension" column="lib_templateid"/> |
| | | <result property="isMydException" column="is_myd_exception"/> |
| | | |
| | | <result property="silent" column="silent"/> |
| | | <result property="dtmfKey" column="dtmf_key"/> |
| | |
| | | <sql id="selectServiceSubtaskDetailVo"> |
| | | select id, |
| | | sub_id, |
| | | is_myd_exception, |
| | | dimension, |
| | | lib_templateid, |
| | | targetid, |
| | | answerps, |
| | |
| | | <include refid="selectServiceSubtaskDetailVo"/> |
| | | where 1=1 |
| | | <if test="subId != null">and sub_id = #{subId}</if> |
| | | <if test="isMydException != null">and is_myd_exception = #{isMydException}</if> |
| | | <if test="dimension != null">and dimension = #{dimension}</if> |
| | | <if test="templateType != null">and template_type = #{templateType}</if> |
| | | <if test="libTemplateid != null">and lib_templateid = #{libTemplateid}</if> |
| | | <if test="targetid != null">and targetid = #{targetid}</if> |
| | |
| | | resultType="java.util.HashMap"> |
| | | select |
| | | ssd.sub_id, |
| | | ssd.is_myd_exception, |
| | | ssd.dimension, |
| | | ssd.taskid, |
| | | ssd.patid, |
| | | sd.sendname, |
| | |
| | | <if test="subId != null">and ssd.sub_id = #{subId}</if> |
| | | <if test="taskid != null">and ssd.taskid = #{taskid}</if> |
| | | <if test="questiontext != null and questiontext != ''">and ssd.questiontext = #{questiontext}</if> |
| | | <if test="isMydException != null">and ssd.is_myd_exception = #{isMydException}</if> |
| | | <if test="dimension != null">and ssd.dimension = #{dimension}</if> |
| | | <if test="matchedtext != null and matchedtext != ''">and ssd.matchedtext = #{matchedtext}</if> |
| | | <if test="asrtext != null and asrtext != ''">and ssd.asrtext = #{asrtext}</if> |
| | | <if test="scriptid != null">and ssd.scriptid = #{scriptid}</if> |
| | |
| | | #{scriptId} |
| | | </foreach> |
| | | </if> |
| | | <if test="isFilled != null and isFilled != '0'"> |
| | | AND IFNULL(ssd.matchedtext,ssd.asrtext) is not null |
| | | AND IFNULL(ssd.matchedtext,ssd.asrtext) != '' |
| | | </if> |
| | | <if test="configValue != null and configValue != ''"> |
| | | AND ssd.categoryid IN (${configValue}) |
| | | </if> |
| | | order by ssd.sub_id desc, ssd.id desc |
| | | </select> |
| | | <select id="selectServiceSubtaskDetailByCalldetailid" parameterType="String" resultMap="ServiceSubtaskDetailResult"> |
| | |
| | | #{subid} |
| | | </foreach> |
| | | <if test="questiontext != null">and questiontext = #{questiontext}</if> |
| | | </select> |
| | | |
| | | <!-- |
| | | 满意度柱状图:一次性统计本次请求全部模板的填报量。 |
| | | 等价于对每个模板执行 queryFillCount(subids, questiontext),区别是: |
| | | 1) 用 join service_subtask 代替先把全部 sub_id 查回 Java 再拼 IN(...); |
| | | 2) 按 libtemplateid + questiontext + score 分组,只回传分值与条数; |
| | | 3) visit_time 改成可走索引的范围条件。 |
| | | 注意:这里刻意不在 SQL 里过滤 questiontext,由 Java 按原 queryFillCount 的 |
| | | 「questiontext 为 null 时不拼该条件」语义做匹配,保证结果口径完全一致。 |
| | | --> |
| | | <select id="selectSatisfactionFillStat" parameterType="com.smartor.domain.entity.SatisfactionStatQuery" |
| | | resultType="java.util.Map"> |
| | | select ss.libtemplateid as libtemplateid, |
| | | ssd.questiontext as questiontext, |
| | | ssd.score as score, |
| | | count(*) as cnt |
| | | from service_subtask_detail ssd |
| | | join service_subtask ss on ss.id = ssd.sub_id |
| | | where ssd.del_flag = 0 |
| | | 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="type != null and type != ''">and ss.type = #{type}</if> |
| | | <if test="startTime != null"> |
| | | and ss.visit_time >= #{startTime} |
| | | </if> |
| | | <if test="endTime != null"> |
| | | and ss.visit_time < date_add(#{endTime}, interval 1 day) |
| | | </if> |
| | | <if test="libTemplateIds != null and libTemplateIds.size() > 0"> |
| | | and ss.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"> |
| | | ss.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"> |
| | | ss.deptcode IN |
| | | <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | ) |
| | | </if> |
| | | group by ss.libtemplateid, ssd.questiontext, ssd.score |
| | | </select> |
| | | |
| | | <!-- |
| | | 满意度统计(statistics / statisticsByDimension):一次性统计本次请求全部问题的填报量。 |
| | | 等价于对每个问题执行 queryFillCount(subids, questiontext),区别是: |
| | | 1) 用 join service_subtask 代替先把全部 sub_id 查回 Java 再拼 IN(...); |
| | | 2) 按 模板+问题+matchedtext+score 分组,只回传选项/分值与条数; |
| | | 3) targetvalue 用 min() 取该问题的一个非空选项串(同一个问题该值一致); |
| | | 4) visit_time 改成可走索引的范围条件。 |
| | | 注意:这里刻意不在 SQL 里过滤 questiontext,由 Java 按原 queryFillCount 的 |
| | | 「questiontext 为 null 时不拼该条件」语义做匹配,保证结果口径完全一致。 |
| | | --> |
| | | <select id="selectSatisfactionFillStatByMatchedtext" parameterType="com.smartor.domain.entity.SatisfactionStatQuery" |
| | | resultType="java.util.Map"> |
| | | select ss.libtemplateid as libtemplateid, |
| | | ssd.questiontext as questiontext, |
| | | ssd.matchedtext as matchedtext, |
| | | ssd.score as score, |
| | | count(*) as cnt, |
| | | min(ssd.targetvalue) as targetvalue |
| | | from service_subtask_detail ssd |
| | | join service_subtask ss on ss.id = ssd.sub_id |
| | | where ssd.del_flag = 0 |
| | | 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="type != null and type != ''">and ss.type = #{type}</if> |
| | | <if test="startTime != null"> |
| | | and ss.visit_time >= #{startTime} |
| | | </if> |
| | | <if test="endTime != null"> |
| | | and ss.visit_time < date_add(#{endTime}, interval 1 day) |
| | | </if> |
| | | <if test="libTemplateIds != null and libTemplateIds.size() > 0"> |
| | | and ss.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"> |
| | | ss.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"> |
| | | ss.deptcode IN |
| | | <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | ) |
| | | </if> |
| | | group by ss.libtemplateid, ssd.questiontext, ssd.matchedtext, ssd.score |
| | | </select> |
| | | |
| | | <select id="isExistServiceSubtaskDetail" resultType="com.smartor.domain.DTO.ServiceSubtaskDetailDTO"> |
| | |
| | | <if test="templateType != null">template_type,</if> |
| | | <if test="libTemplateid != null">lib_templateid,</if> |
| | | <if test="score != null">score,</if> |
| | | <if test="isMydException != null">is_myd_exception,</if> |
| | | <if test="dimension != null">dimension,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id},</if> |
| | |
| | | <if test="templateType != null">#{templateType},</if> |
| | | <if test="libTemplateid != null">#{libTemplateid},</if> |
| | | <if test="score != null">#{score},</if> |
| | | <if test="isMydException != null">#{isMydException},</if> |
| | | <if test="dimension != null">#{dimension},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateServiceSubtaskDetail" parameterType="com.smartor.domain.ServiceSubtaskDetail"> |
| | | update service_subtask_detail |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="isMydException != null">is_myd_exception = #{isMydException},</if> |
| | | <if test="dimension != null">dimension = #{dimension},</if> |
| | | <if test="subId != null">sub_id = #{subId},</if> |
| | | <if test="taskid != null">taskid = #{taskid},</if> |
| | | <if test="targetid != null">targetid = #{targetid},</if> |
| | |
| | | <if test="templateType != null">template_type = #{templateType},</if> |
| | | <if test="libTemplateid != null">lib_templateid = #{libTemplateid},</if> |
| | | <if test="score != null">score = #{score},</if> |
| | | <if test="isMydException != null">is_myd_exception = #{isMydException},</if> |
| | | <if test="dimension != null">dimension = #{dimension},</if> |
| | | </trim> |
| | | where patid = #{patid} and scriptid = #{scriptid} and sub_id = #{subId} |
| | | </update> |
| | |
| | | ivr_liba_target.targetname, |
| | | service_subtask_detail.matchedtext |
| | | </select> |
| | | |
| | | <select id="selectRepeatDetailIds" resultType="Long"> |
| | | SELECT d1.id |
| | | FROM service_subtask_detail d1 |
| | | INNER JOIN ( |
| | | SELECT sub_id, questiontext, |
| | | MAX(create_time) AS max_create_time, |
| | | MAX(id) AS keep_id |
| | | FROM service_subtask_detail |
| | | WHERE del_flag = 0 |
| | | GROUP BY sub_id, questiontext |
| | | HAVING COUNT(*) > 1 |
| | | ) d2 ON d1.sub_id = d2.sub_id |
| | | AND d1.questiontext = d2.questiontext |
| | | AND ( |
| | | d1.create_time < d2.max_create_time |
| | | OR (d1.create_time = d2.max_create_time AND d1.id < d2.keep_id) |
| | | ) |
| | | WHERE d1.del_flag = 0 |
| | | </select> |
| | | |
| | | <update id="deleteRepeatDetailByIds"> |
| | | UPDATE service_subtask_detail |
| | | SET del_flag = 1 |
| | | WHERE del_flag = 0 |
| | | AND id IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </update> |
| | | </mapper> |