<?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.goldenwater.slaj.hazard.mapper.BisOccuDiseHazRecMapper">
    <resultMap type="com.goldenwater.slaj.hazard.domain.BisOccuDiseHazRec" id="BisOccuDiseHazRecResult">
        <result property="guid" column="guid"/>
        <result property="orgGuid" column="org_guid"/>
        <result property="occuTime" column="occu_time"/>
        <result property="phexPlace" column="phex_place"/>
        <result property="occuDiseType" column="occu_dise_type"/>
        <result property="occuDiseNum" column="occu_dise_num"/>
        <result property="patiNum" column="pati_num"/>
        <result property="hospTreaNum" column="hosp_trea_num"/>
        <result property="casNum" column="cas_num"/>
        <result property="offiTel" column="offi_tel"/>
        <result property="ohfName" column="ohf_name"/>
        <result property="treaDesc" column="trea_desc"/>
        <result property="acciCause" column="acci_cause"/>
        <result property="note" column="note"/>
        <result property="collTime" column="coll_time"/>
        <result property="updTime" column="upd_time"/>
        <result property="recPers" column="rec_pers"/>
    </resultMap>
    <sql id="selectBisOccuDiseHazRecVo">
        select guid, org_guid, occu_time, phex_place, occu_dise_type, occu_dise_num,
               pati_num, hosp_trea_num, cas_num, offi_tel, ohf_name, trea_desc,
               acci_cause, note, coll_time, upd_time, rec_pers
        from bis_occu_dise_haz_rec
    </sql>
    <select id="selectBisOccuDiseHazRecByGuid" parameterType="String" resultMap="BisOccuDiseHazRecResult">
        <include refid="selectBisOccuDiseHazRecVo"/>
        where guid = #{guid}
    </select>
    <select id="selectBisOccuDiseHazRecList" parameterType="com.goldenwater.slaj.hazard.domain.BisOccuDiseHazRec" resultMap="BisOccuDiseHazRecResult">
        <include refid="selectBisOccuDiseHazRecVo"/>
        <where>
            <if test="orgGuid != null and orgGuid != ''">AND org_guid = #{orgGuid}</if>
            <if test="occuDiseType != null and occuDiseType != ''">AND occu_dise_type = #{occuDiseType}</if>
            <if test="guid != null and guid != ''">AND guid = #{guid}</if>
        </where>
    </select>
    <insert id="insertBisOccuDiseHazRec" parameterType="com.goldenwater.slaj.hazard.domain.BisOccuDiseHazRec">
        insert into bis_occu_dise_haz_rec (
            guid, org_guid, occu_time, phex_place, occu_dise_type, occu_dise_num,
            pati_num, hosp_trea_num, cas_num, offi_tel, ohf_name, trea_desc,
            acci_cause, note, coll_time, upd_time, rec_pers
        ) values (
            #{guid}, #{orgGuid}, #{occuTime}, #{phexPlace}, #{occuDiseType}, #{occuDiseNum},
            #{patiNum}, #{hospTreaNum}, #{casNum}, #{offiTel}, #{ohfName}, #{treaDesc},
            #{acciCause}, #{note}, #{collTime}, #{updTime}, #{recPers}
        )
    </insert>
    <update id="updateBisOccuDiseHazRec" parameterType="com.goldenwater.slaj.hazard.domain.BisOccuDiseHazRec">
        update bis_occu_dise_haz_rec
        <set>
            <if test="orgGuid != null">org_guid = #{orgGuid},</if>
            <if test="occuTime != null">occu_time = #{occuTime},</if>
            <if test="phexPlace != null">phex_place = #{phexPlace},</if>
            <if test="occuDiseType != null">occu_dise_type = #{occuDiseType},</if>
            <if test="occuDiseNum != null">occu_dise_num = #{occuDiseNum},</if>
            <if test="patiNum != null">pati_num = #{patiNum},</if>
            <if test="hospTreaNum != null">hosp_trea_num = #{hospTreaNum},</if>
            <if test="casNum != null">cas_num = #{casNum},</if>
            <if test="offiTel != null">offi_tel = #{offiTel},</if>
            <if test="ohfName != null">ohf_name = #{ohfName},</if>
            <if test="treaDesc != null">trea_desc = #{treaDesc},</if>
            <if test="acciCause != null">acci_cause = #{acciCause},</if>
            <if test="note != null">note = #{note},</if>
            <if test="updTime != null">upd_time = #{updTime},</if>
            <if test="recPers != null">rec_pers = #{recPers},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteBisOccuDiseHazRecByGuid" parameterType="String">
        delete from bis_occu_dise_haz_rec where guid = #{guid}
    </delete>
    <delete id="deleteBisOccuDiseHazRecByGuids" parameterType="String">
        delete from bis_occu_dise_haz_rec where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
