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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.diagbot.entity.StrAdmissionNote">
        <id column="rec_id" property="recId" />
        <result column="hospital_id" property="hospitalId" />
        <result column="behospital_code" property="behospitalCode" />
        <result column="name" property="name" />
        <result column="sex" property="sex" />
        <result column="age" property="age" />
        <result column="bed_no" property="bedNo" />
        <result column="dept_name" property="deptName" />
        <result column="record_date" property="recordDate" />
        <result column="rec_title" property="recTitle" />
        <result column="birthday" property="birthday" />
        <result column="marriage" property="marriage" />
        <result column="job_type" property="jobType" />
        <result column="nation" property="nation" />
        <result column="phone" property="phone" />
        <result column="workplace" property="workplace" />
        <result column="register_address" property="registerAddress" />
        <result column="born_address" property="bornAddress" />
        <result column="expect_date" property="expectDate" />
        <result column="last_menstrual" property="lastMenstrual" />
        <result column="pregnant_num" property="pregnantNum" />
        <result column="behospital_date" property="behospitalDate" />
        <result column="history_teller" property="historyTeller" />
        <result column="chief" property="chief" />
        <result column="present" property="present" />
        <result column="past_history" property="pastHistory" />
        <result column="personal_history" property="personalHistory" />
        <result column="marital_history" property="maritalHistory" />
        <result column="menstrual_history" property="menstrualHistory" />
        <result column="family_history" property="familyHistory" />
        <result column="feeding_history" property="feedingHistory" />
        <result column="operation_history" property="operationHistory" />
        <result column="blood_history" property="bloodHistory" />
        <result column="infection_history" property="infectionHistory" />
        <result column="special_vital" property="specialVital" />
        <result column="assistant_exam" property="assistantExam" />
        <result column="lis_exam" property="lisExam" />
        <result column="pacs_exam" property="pacsExam" />
        <result column="tentative_diagnosis" property="tentativeDiagnosis" />
        <result column="supply_diagnosis" property="supplyDiagnosis" />
        <result column="revised_diagnosis" property="revisedDiagnosis" />
        <result column="rec_doctor" property="recDoctor" />
        <result column="rec_date" property="recDate" />
        <result column="audit_doctor" property="auditDoctor" />
        <result column="audit_date" property="auditDate" />
        <result column="temperature" property="temperature" />
        <result column="pulse" property="pulse" />
        <result column="breathe" property="breathe" />
        <result column="blood_pressure" property="bloodPressure" />
        <result column="pain" property="pain" />
        <result column="weight" property="weight" />
        <result column="height" property="height" />
        <result column="bmi" property="bmi" />
        <result column="whole_data" property="wholeData" />
        <result column="remark" property="remark" />
        <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 str_admission_note
            <set>
                name = #{item.name},
                sex = #{item.sex},
                age = #{item.age},
                bed_no = #{item.bedNo},
                dept_name = #{item.deptName},
                record_date = #{item.recordDate},
                rec_title = #{item.recTitle},
                birthday = #{item.birthday},
                marriage = #{item.marriage},
                job_type = #{item.jobType},
                nation = #{item.nation},
                phone = #{item.phone},
                workplace = #{item.workplace},
                register_address = #{item.registerAddress},
                born_address = #{item.bornAddress},
                expect_date = #{item.expectDate},
                last_menstrual = #{item.lastMenstrual},
                pregnant_num = #{item.pregnantNum},
                behospital_date = #{item.behospitalDate},
                history_teller = #{item.historyTeller},
                chief = #{item.chief},
                present = #{item.present},
                past_history = #{item.pastHistory},
                personal_history = #{item.personalHistory},
                marital_history = #{item.maritalHistory},
                menstrual_history = #{item.menstrualHistory},
                family_history = #{item.familyHistory},
                feeding_history = #{item.feedingHistory},
                operation_history = #{item.operationHistory},
                blood_history = #{item.bloodHistory},
                infection_history = #{item.infectionHistory},
                special_vital = #{item.specialVital},
                assistant_exam = #{item.assistantExam},
                lis_exam = #{item.lisExam},
                pacs_exam = #{item.pacsExam},
                tentative_diagnosis = #{item.tentativeDiagnosis},
                supply_diagnosis = #{item.supplyDiagnosis},
                revised_diagnosis = #{item.revisedDiagnosis},
                rec_doctor = #{item.recDoctor},
                rec_date = #{item.recDate},
                audit_doctor = #{item.auditDoctor},
                audit_date = #{item.auditDate},
                temperature = #{item.temperature},
                pulse = #{item.pulse},
                breathe = #{item.breathe},
                blood_pressure = #{item.bloodPressure},
                pain = #{item.pain},
                weight = #{item.weight},
                height = #{item.height},
                bmi = #{item.bmi},
                whole_data = #{item.wholeData},
                remark = #{item.remark},
                <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} and behospital_code = #{item.behospitalCode}
        </foreach>
    </update>

    <select id="getColumnZhAndCh" resultType="com.diagbot.dto.data.ColumnZhAndChDTO">
        select COLUMN_NAME as en,column_comment as ch from INFORMATION_SCHEMA.Columns where table_name='str_admission_note'
    </select>

</mapper>
