<?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.sooka.system.mapper.TGuijiHealthcommissionXxMapper">
    
    <resultMap type="TGuijiHealthcommissionXx" id="TGuijiHealthcommissionXxResult">
        <result property="id"    column="id"    />
        <result property="createTime"    column="create_time"    />
        <result property="cdTime"    column="cd_time"    />
        <result property="cdBatch"    column="cd_batch"    />
        <result property="cdOperation"    column="cd_operation"    />
        <result property="cdSource"    column="cd_source"    />
        <result property="name"    column="name"    />
        <result property="idcardnum"    column="idcardnum"    />
        <result property="sexid"    column="sexid"    />
        <result property="birthday"    column="birthday"    />
        <result property="address"    column="address"    />
        <result property="fmname"    column="fmname"    />
        <result property="chname"    column="chname"    />
        <result property="donkind"    column="donkind"    />
        <result property="doncode"    column="doncode"    />
        <result property="volume"    column="volume"    />
        <result property="abo"    column="abo"    />
        <result property="rhd"    column="rhd"    />
        <result property="collectdate"    column="collectdate"    />
        <result property="collectplace"    column="collectplace"    />
        <result property="organname"    column="organname"    />
        <result property="organtel"    column="organtel"    />
    </resultMap>

    <sql id="selectTGuijiHealthcommissionXxVo">
        select id, create_time, cd_time, cd_batch, cd_operation, cd_source, name, idcardnum, sexid, birthday, address, fmname, chname, donkind, doncode, volume, abo, rhd, collectdate, collectplace, organname, organtel from t_guiji_healthcommission_xx
    </sql>

    <select id="selectTGuijiHealthcommissionXxList" parameterType="TGuijiHealthcommissionXx" resultMap="TGuijiHealthcommissionXxResult">
        <include refid="selectTGuijiHealthcommissionXxVo"/>
        <where>  
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="idcardnum != null  and idcardnum != ''"> and idcardnum = #{idcardnum}</if>
        </where>
        order by create_time desc
    </select>
    
    <select id="selectTGuijiHealthcommissionXxById" parameterType="String" resultMap="TGuijiHealthcommissionXxResult">
        <include refid="selectTGuijiHealthcommissionXxVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTGuijiHealthcommissionXx" parameterType="TGuijiHealthcommissionXx">
        insert into t_guiji_healthcommission_xx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="createTime != null">create_time,</if>
            <if test="cdTime != null">cd_time,</if>
            <if test="cdBatch != null">cd_batch,</if>
            <if test="cdOperation != null">cd_operation,</if>
            <if test="cdSource != null">cd_source,</if>
            <if test="name != null">name,</if>
            <if test="idcardnum != null">idcardnum,</if>
            <if test="sexid != null">sexid,</if>
            <if test="birthday != null">birthday,</if>
            <if test="address != null">address,</if>
            <if test="fmname != null">fmname,</if>
            <if test="chname != null">chname,</if>
            <if test="donkind != null">donkind,</if>
            <if test="doncode != null">doncode,</if>
            <if test="volume != null">volume,</if>
            <if test="abo != null">abo,</if>
            <if test="rhd != null">rhd,</if>
            <if test="collectdate != null">collectdate,</if>
            <if test="collectplace != null">collectplace,</if>
            <if test="organname != null">organname,</if>
            <if test="organtel != null">organtel,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="cdTime != null">#{cdTime},</if>
            <if test="cdBatch != null">#{cdBatch},</if>
            <if test="cdOperation != null">#{cdOperation},</if>
            <if test="cdSource != null">#{cdSource},</if>
            <if test="name != null">#{name},</if>
            <if test="idcardnum != null">#{idcardnum},</if>
            <if test="sexid != null">#{sexid},</if>
            <if test="birthday != null">#{birthday},</if>
            <if test="address != null">#{address},</if>
            <if test="fmname != null">#{fmname},</if>
            <if test="chname != null">#{chname},</if>
            <if test="donkind != null">#{donkind},</if>
            <if test="doncode != null">#{doncode},</if>
            <if test="volume != null">#{volume},</if>
            <if test="abo != null">#{abo},</if>
            <if test="rhd != null">#{rhd},</if>
            <if test="collectdate != null">#{collectdate},</if>
            <if test="collectplace != null">#{collectplace},</if>
            <if test="organname != null">#{organname},</if>
            <if test="organtel != null">#{organtel},</if>
         </trim>
    </insert>

    <update id="updateTGuijiHealthcommissionXx" parameterType="TGuijiHealthcommissionXx">
        update t_guiji_healthcommission_xx
        <trim prefix="SET" suffixOverrides=",">
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="cdTime != null">cd_time = #{cdTime},</if>
            <if test="cdBatch != null">cd_batch = #{cdBatch},</if>
            <if test="cdOperation != null">cd_operation = #{cdOperation},</if>
            <if test="cdSource != null">cd_source = #{cdSource},</if>
            <if test="name != null">name = #{name},</if>
            <if test="idcardnum != null">idcardnum = #{idcardnum},</if>
            <if test="sexid != null">sexid = #{sexid},</if>
            <if test="birthday != null">birthday = #{birthday},</if>
            <if test="address != null">address = #{address},</if>
            <if test="fmname != null">fmname = #{fmname},</if>
            <if test="chname != null">chname = #{chname},</if>
            <if test="donkind != null">donkind = #{donkind},</if>
            <if test="doncode != null">doncode = #{doncode},</if>
            <if test="volume != null">volume = #{volume},</if>
            <if test="abo != null">abo = #{abo},</if>
            <if test="rhd != null">rhd = #{rhd},</if>
            <if test="collectdate != null">collectdate = #{collectdate},</if>
            <if test="collectplace != null">collectplace = #{collectplace},</if>
            <if test="organname != null">organname = #{organname},</if>
            <if test="organtel != null">organtel = #{organtel},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTGuijiHealthcommissionXxById" parameterType="String">
        delete from t_guiji_healthcommission_xx where id = #{id}
    </delete>

    <delete id="deleteTGuijiHealthcommissionXxByIds" parameterType="String">
        delete from t_guiji_healthcommission_xx where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

</mapper>