<?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.message.mapper.ZxjhMapper">

    <select id="getBasicData" resultType="com.docus.server.message.entity.TBasicExcel">
        select
        patient_id,
        admiss_times,
        inpatient_no,
        id_card,
        jzh
        from t_basic_excel
        where file_source=#{fileSource}
        <if test="disDates!=null">
            and dis_date &gt;= #{disDates}
        </if>
        <if test="disDatee!=null">
            and dis_date &lt;= #{disDatee}
        </if>
    </select>

    <insert id="saveLog">
        INSERT INTO `docus_medicalrecord`.`t_basic_excel_log` (`patient_id`, `erro`)
        VALUES (#{pid}, #{msg});
    </insert>

    <delete id="delete">
        delete from `docus_archivefile`.t_scan_assort
        where patient_id=#{pid}
    </delete>

    <insert id="saveAssort">
        <foreach collection="tScanAssorts" item="tScanAssort" >
            INSERT INTO `docus_archivefile`.`t_scan_assort` (
            `id`,
            `patient_id`,
            `assort_id`,
            `file_title`,
            `image_path`,
            `scan_page`,
            `file_source`,
            `file_storage_type`,
            `create_time`,
            `file_pages`,
            `source`,
            creater
            ) VALUES (
            #{tScanAssort.id},
            #{tScanAssort.patientId},
            #{tScanAssort.assortId},
            #{tScanAssort.fileTitle},
            #{tScanAssort.imagePath},
            #{tScanAssort.scanPage},
            #{tScanAssort.fileSource},
            #{tScanAssort.fileStorageType},
            #{tScanAssort.createTime},
            #{tScanAssort.filePages},
            #{tScanAssort.source},
            'admin'
            );
        </foreach>
    </insert>

    <select id="getJzh" resultType="java.lang.String">
        select
        jzh
        from t_basic_excel
        where patient_id=#{pid}
    </select>
</mapper>
