<?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.emr.dao.his.HISBA5Mapper" >
  <resultMap id="BaseResultMap" type="com.emr.entity.his.HISBA5" >
    <id column="FID" property="fid" jdbcType="BIGINT" />
    <result column="FPRN" property="fprn" jdbcType="VARCHAR" />
    <result column="FTIMES" property="ftimes" jdbcType="INTEGER" />
    <result column="FBABYNUM" property="fbabynum" jdbcType="INTEGER" />
    <result column="FNAME" property="fname" jdbcType="VARCHAR" />
    <result column="FBABYSEXBH" property="fbabysexbh" jdbcType="VARCHAR" />
    <result column="FBABYSEX" property="fbabysex" jdbcType="VARCHAR" />
    <result column="FTZ" property="ftz" jdbcType="DOUBLE" />
    <result column="FRESULTBH" property="fresultbh" jdbcType="VARCHAR" />
    <result column="FRESULT" property="fresult" jdbcType="VARCHAR" />
    <result column="FZGBH" property="fzgbh" jdbcType="VARCHAR" />
    <result column="FZG" property="fzg" jdbcType="VARCHAR" />
    <result column="FGRICD10" property="fgricd10" jdbcType="VARCHAR" />
    <result column="FGRNAME" property="fgrname" jdbcType="VARCHAR" />
    <result column="FBABYGR" property="fbabygr" jdbcType="INTEGER" />
    <result column="FBABYQJ" property="fbabyqj" jdbcType="INTEGER" />
    <result column="FBABYSUC" property="fbabysuc" jdbcType="INTEGER" />
    <result column="FHXBH" property="fhxbh" jdbcType="VARCHAR" />
    <result column="FHX" property="fhx" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    FID, FPRN, FTIMES, FBABYNUM, FNAME, FBABYSEXBH, FBABYSEX, FTZ, FRESULTBH, FRESULT, 
    FZGBH, FZG, FGRICD10, FGRNAME, FBABYGR, FBABYQJ, FBABYSUC, FHXBH, FHX
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    select 
    <include refid="Base_Column_List" />
    from HIS_BA5
    where FID = #{fid,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from HIS_BA5
    where FID = #{fid,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.emr.entity.his.HISBA5" >
    insert into HIS_BA5 (FPRN, FTIMES,
      FBABYNUM, FNAME, FBABYSEXBH, 
      FBABYSEX, FTZ, FRESULTBH, 
      FRESULT, FZGBH, FZG, 
      FGRICD10, FGRNAME, FBABYGR, 
      FBABYQJ, FBABYSUC, FHXBH, 
      FHX)
    values (#{fprn,jdbcType=VARCHAR}, #{ftimes,jdbcType=INTEGER},
      #{fbabynum,jdbcType=INTEGER}, #{fname,jdbcType=VARCHAR}, #{fbabysexbh,jdbcType=VARCHAR}, 
      #{fbabysex,jdbcType=VARCHAR}, #{ftz,jdbcType=DOUBLE}, #{fresultbh,jdbcType=VARCHAR}, 
      #{fresult,jdbcType=VARCHAR}, #{fzgbh,jdbcType=VARCHAR}, #{fzg,jdbcType=VARCHAR}, 
      #{fgricd10,jdbcType=VARCHAR}, #{fgrname,jdbcType=VARCHAR}, #{fbabygr,jdbcType=INTEGER}, 
      #{fbabyqj,jdbcType=INTEGER}, #{fbabysuc,jdbcType=INTEGER}, #{fhxbh,jdbcType=VARCHAR}, 
      #{fhx,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.emr.entity.his.HISBA5" >
    insert into HIS_BA5
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="fid != null" >
        FID,
      </if>
      <if test="fprn != null" >
        FPRN,
      </if>
      <if test="ftimes != null" >
        FTIMES,
      </if>
      <if test="fbabynum != null" >
        FBABYNUM,
      </if>
      <if test="fname != null" >
        FNAME,
      </if>
      <if test="fbabysexbh != null" >
        FBABYSEXBH,
      </if>
      <if test="fbabysex != null" >
        FBABYSEX,
      </if>
      <if test="ftz != null" >
        FTZ,
      </if>
      <if test="fresultbh != null" >
        FRESULTBH,
      </if>
      <if test="fresult != null" >
        FRESULT,
      </if>
      <if test="fzgbh != null" >
        FZGBH,
      </if>
      <if test="fzg != null" >
        FZG,
      </if>
      <if test="fgricd10 != null" >
        FGRICD10,
      </if>
      <if test="fgrname != null" >
        FGRNAME,
      </if>
      <if test="fbabygr != null" >
        FBABYGR,
      </if>
      <if test="fbabyqj != null" >
        FBABYQJ,
      </if>
      <if test="fbabysuc != null" >
        FBABYSUC,
      </if>
      <if test="fhxbh != null" >
        FHXBH,
      </if>
      <if test="fhx != null" >
        FHX,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="fid != null" >
        #{fid,jdbcType=BIGINT},
      </if>
      <if test="fprn != null" >
        #{fprn,jdbcType=VARCHAR},
      </if>
      <if test="ftimes != null" >
        #{ftimes,jdbcType=INTEGER},
      </if>
      <if test="fbabynum != null" >
        #{fbabynum,jdbcType=INTEGER},
      </if>
      <if test="fname != null" >
        #{fname,jdbcType=VARCHAR},
      </if>
      <if test="fbabysexbh != null" >
        #{fbabysexbh,jdbcType=VARCHAR},
      </if>
      <if test="fbabysex != null" >
        #{fbabysex,jdbcType=VARCHAR},
      </if>
      <if test="ftz != null" >
        #{ftz,jdbcType=DOUBLE},
      </if>
      <if test="fresultbh != null" >
        #{fresultbh,jdbcType=VARCHAR},
      </if>
      <if test="fresult != null" >
        #{fresult,jdbcType=VARCHAR},
      </if>
      <if test="fzgbh != null" >
        #{fzgbh,jdbcType=VARCHAR},
      </if>
      <if test="fzg != null" >
        #{fzg,jdbcType=VARCHAR},
      </if>
      <if test="fgricd10 != null" >
        #{fgricd10,jdbcType=VARCHAR},
      </if>
      <if test="fgrname != null" >
        #{fgrname,jdbcType=VARCHAR},
      </if>
      <if test="fbabygr != null" >
        #{fbabygr,jdbcType=INTEGER},
      </if>
      <if test="fbabyqj != null" >
        #{fbabyqj,jdbcType=INTEGER},
      </if>
      <if test="fbabysuc != null" >
        #{fbabysuc,jdbcType=INTEGER},
      </if>
      <if test="fhxbh != null" >
        #{fhxbh,jdbcType=VARCHAR},
      </if>
      <if test="fhx != null" >
        #{fhx,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.emr.entity.his.HISBA5" >
    update HIS_BA5
    <set >
      <if test="fprn != null" >
        FPRN = #{fprn,jdbcType=VARCHAR},
      </if>
      <if test="ftimes != null" >
        FTIMES = #{ftimes,jdbcType=INTEGER},
      </if>
      <if test="fbabynum != null" >
        FBABYNUM = #{fbabynum,jdbcType=INTEGER},
      </if>
      <if test="fname != null" >
        FNAME = #{fname,jdbcType=VARCHAR},
      </if>
      <if test="fbabysexbh != null" >
        FBABYSEXBH = #{fbabysexbh,jdbcType=VARCHAR},
      </if>
      <if test="fbabysex != null" >
        FBABYSEX = #{fbabysex,jdbcType=VARCHAR},
      </if>
      <if test="ftz != null" >
        FTZ = #{ftz,jdbcType=DOUBLE},
      </if>
      <if test="fresultbh != null" >
        FRESULTBH = #{fresultbh,jdbcType=VARCHAR},
      </if>
      <if test="fresult != null" >
        FRESULT = #{fresult,jdbcType=VARCHAR},
      </if>
      <if test="fzgbh != null" >
        FZGBH = #{fzgbh,jdbcType=VARCHAR},
      </if>
      <if test="fzg != null" >
        FZG = #{fzg,jdbcType=VARCHAR},
      </if>
      <if test="fgricd10 != null" >
        FGRICD10 = #{fgricd10,jdbcType=VARCHAR},
      </if>
      <if test="fgrname != null" >
        FGRNAME = #{fgrname,jdbcType=VARCHAR},
      </if>
      <if test="fbabygr != null" >
        FBABYGR = #{fbabygr,jdbcType=INTEGER},
      </if>
      <if test="fbabyqj != null" >
        FBABYQJ = #{fbabyqj,jdbcType=INTEGER},
      </if>
      <if test="fbabysuc != null" >
        FBABYSUC = #{fbabysuc,jdbcType=INTEGER},
      </if>
      <if test="fhxbh != null" >
        FHXBH = #{fhxbh,jdbcType=VARCHAR},
      </if>
      <if test="fhx != null" >
        FHX = #{fhx,jdbcType=VARCHAR},
      </if>
    </set>
    where FID = #{fid,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.emr.entity.his.HISBA5" >
    update HIS_BA5
    set FPRN = #{fprn,jdbcType=VARCHAR},
      FTIMES = #{ftimes,jdbcType=INTEGER},
      FBABYNUM = #{fbabynum,jdbcType=INTEGER},
      FNAME = #{fname,jdbcType=VARCHAR},
      FBABYSEXBH = #{fbabysexbh,jdbcType=VARCHAR},
      FBABYSEX = #{fbabysex,jdbcType=VARCHAR},
      FTZ = #{ftz,jdbcType=DOUBLE},
      FRESULTBH = #{fresultbh,jdbcType=VARCHAR},
      FRESULT = #{fresult,jdbcType=VARCHAR},
      FZGBH = #{fzgbh,jdbcType=VARCHAR},
      FZG = #{fzg,jdbcType=VARCHAR},
      FGRICD10 = #{fgricd10,jdbcType=VARCHAR},
      FGRNAME = #{fgrname,jdbcType=VARCHAR},
      FBABYGR = #{fbabygr,jdbcType=INTEGER},
      FBABYQJ = #{fbabyqj,jdbcType=INTEGER},
      FBABYSUC = #{fbabysuc,jdbcType=INTEGER},
      FHXBH = #{fhxbh,jdbcType=VARCHAR},
      FHX = #{fhx,jdbcType=VARCHAR}
    where FID = #{fid,jdbcType=BIGINT}
  </update>
  <!--按病案号、住院次数查询记录-->
  <select id="selectAllByParam" resultMap="BaseResultMap">
      SELECT * FROM HIS_BA5 WHERE FPRN = #{fprn,jdbcType=VARCHAR} AND FTIMES = #{ftimes,jdbcType=INTEGER}
  </select>
  <!--批量删除-->
  <delete id="deleteAllByParam">
      DELETE FROM HIS_BA5 WHERE FPRN = #{fprn,jdbcType=VARCHAR} AND FTIMES = #{ftimes,jdbcType=INTEGER}
  </delete>
  <!--批量添加-->
  <insert id="SimpleInsert" parameterType="java.util.List">
    insert into HIS_BA5(
    FPRN, FTIMES,
    FBABYNUM, FNAME, FBABYSEXBH,
    FBABYSEX, FTZ, FRESULTBH,
    FRESULT, FZGBH, FZG,
    FGRICD10, FGRNAME, FBABYGR,
    FBABYQJ, FBABYSUC, FHXBH,
    FHX
    )
    values
    <foreach collection="list" item="items" separator=",">
      (
      #{items.fprn,jdbcType=VARCHAR}, #{items.ftimes,jdbcType=INTEGER},
      #{items.fbabynum,jdbcType=INTEGER}, #{items.fname,jdbcType=VARCHAR}, #{items.fbabysexbh,jdbcType=VARCHAR},
      #{items.fbabysex,jdbcType=VARCHAR}, #{items.ftz,jdbcType=DOUBLE}, #{items.fresultbh,jdbcType=VARCHAR},
      #{items.fresult,jdbcType=VARCHAR}, #{items.fzgbh,jdbcType=VARCHAR}, #{items.fzg,jdbcType=VARCHAR},
      #{items.fgricd10,jdbcType=VARCHAR}, #{items.fgrname,jdbcType=VARCHAR}, #{items.fbabygr,jdbcType=INTEGER},
      #{items.fbabyqj,jdbcType=INTEGER}, #{items.fbabysuc,jdbcType=INTEGER}, #{items.fhxbh,jdbcType=VARCHAR},
      #{items.fhx,jdbcType=VARCHAR}
      )
    </foreach>
  </insert>
</mapper>