<?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.archive.mapper.TBasicZkInfoMapper">
    <insert id="saveBatch">
        INSERT INTO `docus_medicalrecord`.`t_basic_zk_info`
            (`id`, `patient_id`, `out_dept_code`, `out_dept_name`, `out_date`, `in_dept_code`, `in_dept_name`, `create_time`) VALUES
        <foreach collection="zkInfos" item="zkInfo" separator=",">
            (
             #{zkInfo.id},#{zkInfo.patientId},#{zkInfo.outDeptCode},#{zkInfo.outDate},#{zkInfo.outDate},
             #{zkInfo.inDeptCode},#{zkInfo.inDeptName},#{zkInfo.createTime}
            )
        </foreach>
    </insert>

    <delete id="deleteByPatientIds">
        delete from docus_medicalrecord.t_basic_zk_info
        where patient_id in <foreach collection="patientIds" item="patientId" separator="," open="(" close=")">
                                #{patientId}
                            </foreach>
    </delete>
    <select id="existsZkInfoPatientIds" resultType="java.lang.String">
        select  patient_id from docus_medicalrecord.t_basic_zk_info
        where patient_id in <foreach collection="patientIds" item="patientId" separator="," open="(" close=")">
                                #{patientId}
                            </foreach>
    </select>
</mapper>
