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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.diagbot.entity.HomeOperationInfo">
        <id column="home_page_id" property="homePageId" />
        <result column="hospital_id" property="hospitalId" />
        <result column="operation_order_no" property="operationOrderNo" />
        <result column="operation_date" property="operationDate" />
        <result column="operation_code" property="operationCode" />
        <result column="operation_doctor_id" property="operationDoctorId" />
        <result column="first_assistant_id" property="firstAssistantId" />
        <result column="second_assistant_id" property="secondAssistantId" />
        <result column="cut_level" property="cutLevel" />
        <result column="healing_level" property="healingLevel" />
        <result column="operation_name" property="operationName" />
        <result column="operation_level" property="operationLevel" />
        <result column="anaesthesia_name" property="anaesthesiaName" />
        <result column="sham_operation_name" property="shamOperationName" />
        <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_operation_info
            <set>
                <if test="item.operationDate != null">
                    operation_date = #{item.operationDate},
                </if>
                <if test="item.operationCode != null">
                    operation_code = #{item.operationCode},
                </if>
                <if test="item.operationDoctorId != null">
                    operation_doctor_id = #{item.operationDoctorId},
                </if>
                <if test="item.firstAssistantId != null">
                    first_assistant_id = #{item.firstAssistantId},
                </if>
                <if test="item.secondAssistantId != null">
                    second_assistant_id = #{item.secondAssistantId},
                </if>
                <if test="item.cutLevel != null">
                    cut_level = #{item.cutLevel},
                </if>
                <if test="item.healingLevel != null">
                    healing_level = #{item.healingLevel},
                </if>
                <if test="item.operationName != null">
                    operation_name = #{item.operationName},
                </if>
                <if test="item.operationLevel != null">
                    operation_level = #{item.operationLevel},
                </if>
                <if test="item.anaesthesiaName != null">
                    anaesthesia_name = #{item.anaesthesiaName},
                </if>
                <if test="item.shamOperationName != null">
                    sham_operation_name = #{item.shamOperationName},
                </if>
                <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 operation_order_no = #{item.operationOrderNo}
        </foreach>
    </update>

</mapper>
