<?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.MedicalRecordContentMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.diagbot.entity.MedicalRecordContent">
        <result column="rec_id" property="recId" />
        <result column="hospital_id" property="hospitalId" />
        <result column="content_blob" property="contentBlob" typeHandler="org.apache.ibatis.type.BlobTypeHandler"/>
        <result column="content_text" property="contentText" />
        <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_medical_record_content
            <set>
                <if test="item.htmlText != null">
                    html_text = #{item.htmlText},
                </if>
                <if test="item.xmlText != null">
                    xml_text = #{item.xmlText},
                </if>
                <if test="item.gmtModified != null">
                    gmt_modified = #{item.gmtModified},
                </if>
                <if test="item.modifier != null">
                    modifier = #{item.modifier},
                </if>
            </set>
            where rec_id = #{item.recId} and hospital_id = #{item.hospitalId}
        </foreach>
    </update>

</mapper>
