<?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.diagbot.mapper.HomeDiagnoseInfoMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.diagbot.entity.HomeDiagnoseInfo">
        <id column="home_page_id" property="homePageId" />
        <result column="hospital_id" property="hospitalId" />
        <result column="diagnose_order_no" property="diagnoseOrderNo" />
        <result column="diagnose_type" property="diagnoseType" />
        <result column="diagnose_type_short" property="diagnoseTypeShort" />
        <result column="diagnose_name" property="diagnoseName" />
        <result column="behospital_type" property="behospitalType" />
        <result column="leave_hospital_type" property="leaveHospitalType" />
        <result column="pathology_diagnose" property="pathologyDiagnose" />
        <result column="icd_code" property="icdCode" />
        <result column="is_deleted" property="isDeleted" />
        <result column="gmt_create" property="gmtCreate" />
        <result column="gmt_modified" property="gmtModified" />
        <result column="creator" property="creator" />
        <result column="modifier" property="modifier" />
    </resultMap>

    <update id="updateBatchByKey">
        <foreach collection="list" item="item"  separator=";">
            update med_home_diagnose_info
            <set>
                    diagnose_type = #{item.diagnoseType},
                    diagnose_type_short = #{item.diagnoseTypeShort},
                    diagnose_name = #{item.diagnoseName},
                    behospital_type = #{item.behospitalType},
                    leave_hospital_type = #{item.leaveHospitalType},
                    pathology_diagnose = #{item.pathologyDiagnose},
                    icd_code = #{item.icdCode},
                <if test="item.gmtModified != null">
                    gmt_modified = #{item.gmtModified},
                </if>
                <if test="item.modifier != null">
                    modifier = #{item.modifier},
                </if>
            </set>
            where home_page_id = #{item.homePageId} and hospital_id = #{item.hospitalId} and diagnose_order_no = #{item.diagnoseOrderNo}
        </foreach>
    </update>

</mapper>
