<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.server.reportmanager.mapper.ScanAssortMapper">
    <insert id="insertDeleteLog">
        INSERT INTO `docus_archivefile`.`af_report_delete_log`
            (`id`, `patient_id`, `delete_content`, `type`, `create_time`, `update_time`)
        VALUES (#{delLog.id}, #{delLog.patientId}, #{delLog.deleteContent}, #{delLog.type}, #{delLog.createTime}, #{delLog.updateTime})
    </insert>

    <update id="cancel">
        UPDATE `docus_archivefile`.`t_scan_assort`
        SET `is_del` = 1
        WHERE `id` in
        <foreach collection="ids" item="id" separator="," open="(" close=")">
            #{id}
        </foreach>
    </update>
    <update id="updateDleteLog">
        UPDATE `docus_archivefile`.`af_report_delete_log`
        SET `patient_id` = #{delLog.patientId},
            `delete_content` = #{delLog.deleteContent},
            `type` = #{delLog.type},
            `create_time` = #{delLog.createTime},
            `update_time` = #{delLog.updateTime}
        WHERE `id` = #{delLog.id}

    </update>
    <update id="cancelBySerialNum">
        UPDATE `docus_archivefile`.`t_scan_assort`
        SET `is_del` = 1
        WHERE
            patient_id=#{patientId}
          AND source=#{source}
              AND `file_column_1` in
        <foreach collection="serials" item="serial" separator="," open="(" close=")">
            #{serial}
        </foreach>
    </update>
    <select id="getIdByPatientTask" resultType="java.lang.Long">
        select id
        from `docus_archivefile`.`t_scan_assort`
        where patient_id = #{patientId}
          and taskid = #{taskId}
    </select>
</mapper>
