| | |
| | | ssd.targetid, |
| | | ssd.template_type, |
| | | ssd.lib_templateid, |
| | | sd.deptcode, |
| | | sd.deptname, |
| | | sd.leaveldeptcode AS deptcode, |
| | | sd.leaveldeptname AS deptname, |
| | | sd.leavehospitaldistrictcode, |
| | | sd.leavehospitaldistrictname |
| | | from service_subtask_detail ssd |
| | |
| | | </foreach> |
| | | </if> |
| | | <if test="leaveldeptcodes != null and leaveldeptcodes.size() > 0"> |
| | | and sd.deptcode in |
| | | and sd.leaveldeptcode in |
| | | <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator="," close=")"> |
| | | #{leaveldeptcode} |
| | | </foreach> |
| | |
| | | <if test="questiontext != null">and questiontext = #{questiontext}</if> |
| | | </select> |
| | | |
| | | <select id="isExistServiceSubtaskDetail" resultType="com.ruoyi.task.domain.DTO.ServiceSubtaskDetailDTO"> |
| | | <!-- |
| | | ⚠️ 口径变更(2026-10-21):这里**不再过滤 del_flag**,改为取该 (sub_id, scriptid) 最新的一行。 |
| | | |
| | | 原因:原来只认 del_flag=0,明细一旦被逻辑删除就查不到,下一次保存必然 INSERT 一条新副本, |
| | | 导致同一位患者同一道题堆出 2~6 条重复明细(见 nhfy 2026-09-08 的事故)。 |
| | | 改为「忽略删除标记、取最新一行」后,保存走 UPDATE(由调用方再调 reviveServiceSubtaskDetail 复活), |
| | | 副本不会再累积。 |
| | | --> |
| | | <select id="isExistServiceSubtaskDetail" resultType="com.ruoyi.task.domain.DTO.ServiceSubtaskDetailDTO"> |
| | | select id, questiontext, matchedtext, score |
| | | from service_subtask_detail |
| | | where del_flag = 0 |
| | | where 1 = 1 |
| | | <if test="subid != null ">and sub_id = #{subid}</if> |
| | | <if test="scriptid != null">and scriptid = #{scriptid}</if> |
| | | order by id desc |
| | | limit 1 |
| | | </select> |
| | | |
| | | <insert id="insertServiceSubtaskDetail" parameterType="com.ruoyi.task.domain.ServiceSubtaskDetail" |
| | |
| | | <if test="uploadTime != null">upload_time = #{uploadTime},</if> |
| | | <if test="orgid != null">orgid = #{orgid},</if> |
| | | <if test="createTime != null">create_time = #{createTime},</if> |
| | | <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if> |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | <if test="createBy != null">create_by = #{createBy},</if> |
| | |
| | | <if test="uploadTime != null">upload_time = #{uploadTime},</if> |
| | | <if test="orgid != null">orgid = #{orgid},</if> |
| | | <if test="createTime != null">create_time = #{createTime},</if> |
| | | <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if> |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | <if test="createBy != null">create_by = #{createBy},</if> |
| | |
| | | where patid = #{patid} and scriptid = #{scriptid} and sub_id = #{subId} |
| | | </update> |
| | | |
| | | <!-- ====================================================================== |
| | | 逻辑删除 / 复活(2026-10-21 收口) |
| | | ====================================================================== |
| | | 背景:上面两条通用 UPDATE(updateServiceSubtaskDetail、updateSSDByCondition)原本都带 |
| | | if test="delFlag != null" 就去 SET del_flag = 客户端传的值, |
| | | 等于把 del_flag 的写权限交给了客户端:前端一个 {"subId":x,"delFlag":"1"} |
| | | 就能把整卷答卷悄悄"删除"(nhfy 2026-09-08 就这样丢了 10 位患者的满意度作答, |
| | | 而 patItemExport 的「问题详情占比」又只认 del_flag=0,于是 380 行只剩 370 人)。 |
| | | 现在这两条通用 UPDATE 已移除 del_flag 字段,逻辑删除只能走下面两条专用语句, |
| | | 复活只允许置回 '0'(reviveServiceSubtaskDetail)。 |
| | | ====================================================================== --> |
| | | <update id="softDeleteServiceSubtaskDetailBySubId"> |
| | | update service_subtask_detail |
| | | set del_flag = '1', update_time = now() |
| | | where sub_id = #{subId} |
| | | and del_flag = '0' |
| | | </update> |
| | | |
| | | <update id="softDeleteServiceSubtaskDetailById"> |
| | | update service_subtask_detail |
| | | set del_flag = '1', update_time = now() |
| | | where id = #{id} |
| | | and del_flag = '0' |
| | | </update> |
| | | |
| | | <!-- 复活一行明细:保存答案时命中历史被删副本 -> 更新内容后再置回 del_flag='0',避免新增副本 --> |
| | | <update id="reviveServiceSubtaskDetail"> |
| | | update service_subtask_detail |
| | | set del_flag = '0' |
| | | where id = #{id} |
| | | and del_flag <> '0' |
| | | </update> |
| | | |
| | | <delete id="deleteServiceSubtaskDetailByCalldetailid" parameterType="String"> |
| | | delete |
| | | from service_subtask_detail |