<?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.HISBA4Mapper" >
  <resultMap id="BaseResultMap" type="com.emr.entity.his.HISBA4" >
    <id column="FID" property="fid" jdbcType="BIGINT" />
    <result column="FPRN" property="fprn" jdbcType="VARCHAR" />
    <result column="FTIMES" property="ftimes" jdbcType="INTEGER" />
    <result column="FNAME" property="fname" jdbcType="VARCHAR" />
    <result column="FOPTIMES" property="foptimes" jdbcType="INTEGER" />
    <result column="FOPCODE" property="fopcode" jdbcType="VARCHAR" />
    <result column="FOP" property="fop" jdbcType="VARCHAR" />
    <result column="FOPDATE" property="fopdate" jdbcType="TIMESTAMP" />
    <result column="FQIEKOUBH" property="fqiekoubh" jdbcType="VARCHAR" />
    <result column="FQIEKOU" property="fqiekou" jdbcType="VARCHAR" />
    <result column="FYUHEBH" property="fyuhebh" jdbcType="VARCHAR" />
    <result column="FYUHE" property="fyuhe" jdbcType="VARCHAR" />
    <result column="FDOCBH" property="fdocbh" jdbcType="VARCHAR" />
    <result column="FDOCNAME" property="fdocname" jdbcType="VARCHAR" />
    <result column="FMAZUIBH" property="fmazuibh" jdbcType="VARCHAR" />
    <result column="FMAZUI" property="fmazui" jdbcType="VARCHAR" />
    <result column="FIFFSOP" property="fiffsop" jdbcType="BIT" />
    <result column="FOPDOCT1BH" property="fopdoct1bh" jdbcType="VARCHAR" />
    <result column="FOPDOCT1" property="fopdoct1" jdbcType="VARCHAR" />
    <result column="FOPDOCT2BH" property="fopdoct2bh" jdbcType="VARCHAR" />
    <result column="FOPDOCT2" property="fopdoct2" jdbcType="VARCHAR" />
    <result column="FMZDOCTBH" property="fmzdoctbh" jdbcType="VARCHAR" />
    <result column="FMZDOCT" property="fmzdoct" jdbcType="VARCHAR" />
    <result column="FOPTYKH" property="foptykh" jdbcType="VARCHAR" />
    <result column="FOPKSNAME" property="fopksname" jdbcType="VARCHAR" />
    <result column="FZQSSBH" property="fzqssbh" jdbcType="VARCHAR" />
    <result column="FZQSS" property="fzqss" jdbcType="VARCHAR" />
    <result column="FSSJBBH" property="fssjbbh" jdbcType="VARCHAR" />
    <result column="FSSJB" property="fssjb" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    FID, FPRN, FTIMES, FNAME, FOPTIMES, FOPCODE, FOP, FOPDATE, FQIEKOUBH, FQIEKOU, FYUHEBH, 
    FYUHE, FDOCBH, FDOCNAME, FMAZUIBH, FMAZUI, FIFFSOP, FOPDOCT1BH, FOPDOCT1, FOPDOCT2BH, 
    FOPDOCT2, FMZDOCTBH, FMZDOCT, FOPTYKH, FOPKSNAME, FZQSSBH, FZQSS, FSSJBBH, FSSJB
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    select 
    <include refid="Base_Column_List" />
    from HIS_BA4
    where FID = #{fid,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from HIS_BA4
    where FID = #{fid,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.emr.entity.his.HISBA4" >
    insert into HIS_BA4 (FPRN, FTIMES,
      FNAME, FOPTIMES, FOPCODE, 
      FOP, FOPDATE, FQIEKOUBH, 
      FQIEKOU, FYUHEBH, FYUHE, 
      FDOCBH, FDOCNAME, FMAZUIBH, 
      FMAZUI, FIFFSOP, FOPDOCT1BH, 
      FOPDOCT1, FOPDOCT2BH, FOPDOCT2, 
      FMZDOCTBH, FMZDOCT, FOPTYKH, 
      FOPKSNAME, FZQSSBH, FZQSS, 
      FSSJBBH, FSSJB)
    values (#{fprn,jdbcType=VARCHAR}, #{ftimes,jdbcType=INTEGER},
      #{fname,jdbcType=VARCHAR}, #{foptimes,jdbcType=INTEGER}, #{fopcode,jdbcType=VARCHAR}, 
      #{fop,jdbcType=VARCHAR}, #{fopdate,jdbcType=TIMESTAMP}, #{fqiekoubh,jdbcType=VARCHAR}, 
      #{fqiekou,jdbcType=VARCHAR}, #{fyuhebh,jdbcType=VARCHAR}, #{fyuhe,jdbcType=VARCHAR}, 
      #{fdocbh,jdbcType=VARCHAR}, #{fdocname,jdbcType=VARCHAR}, #{fmazuibh,jdbcType=VARCHAR}, 
      #{fmazui,jdbcType=VARCHAR}, #{fiffsop,jdbcType=BIT}, #{fopdoct1bh,jdbcType=VARCHAR}, 
      #{fopdoct1,jdbcType=VARCHAR}, #{fopdoct2bh,jdbcType=VARCHAR}, #{fopdoct2,jdbcType=VARCHAR}, 
      #{fmzdoctbh,jdbcType=VARCHAR}, #{fmzdoct,jdbcType=VARCHAR}, #{foptykh,jdbcType=VARCHAR}, 
      #{fopksname,jdbcType=VARCHAR}, #{fzqssbh,jdbcType=VARCHAR}, #{fzqss,jdbcType=VARCHAR}, 
      #{fssjbbh,jdbcType=VARCHAR}, #{fssjb,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.emr.entity.his.HISBA4" >
    insert into HIS_BA4
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="fid != null" >
        FID,
      </if>
      <if test="fprn != null" >
        FPRN,
      </if>
      <if test="ftimes != null" >
        FTIMES,
      </if>
      <if test="fname != null" >
        FNAME,
      </if>
      <if test="foptimes != null" >
        FOPTIMES,
      </if>
      <if test="fopcode != null" >
        FOPCODE,
      </if>
      <if test="fop != null" >
        FOP,
      </if>
      <if test="fopdate != null" >
        FOPDATE,
      </if>
      <if test="fqiekoubh != null" >
        FQIEKOUBH,
      </if>
      <if test="fqiekou != null" >
        FQIEKOU,
      </if>
      <if test="fyuhebh != null" >
        FYUHEBH,
      </if>
      <if test="fyuhe != null" >
        FYUHE,
      </if>
      <if test="fdocbh != null" >
        FDOCBH,
      </if>
      <if test="fdocname != null" >
        FDOCNAME,
      </if>
      <if test="fmazuibh != null" >
        FMAZUIBH,
      </if>
      <if test="fmazui != null" >
        FMAZUI,
      </if>
      <if test="fiffsop != null" >
        FIFFSOP,
      </if>
      <if test="fopdoct1bh != null" >
        FOPDOCT1BH,
      </if>
      <if test="fopdoct1 != null" >
        FOPDOCT1,
      </if>
      <if test="fopdoct2bh != null" >
        FOPDOCT2BH,
      </if>
      <if test="fopdoct2 != null" >
        FOPDOCT2,
      </if>
      <if test="fmzdoctbh != null" >
        FMZDOCTBH,
      </if>
      <if test="fmzdoct != null" >
        FMZDOCT,
      </if>
      <if test="foptykh != null" >
        FOPTYKH,
      </if>
      <if test="fopksname != null" >
        FOPKSNAME,
      </if>
      <if test="fzqssbh != null" >
        FZQSSBH,
      </if>
      <if test="fzqss != null" >
        FZQSS,
      </if>
      <if test="fssjbbh != null" >
        FSSJBBH,
      </if>
      <if test="fssjb != null" >
        FSSJB,
      </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="fname != null" >
        #{fname,jdbcType=VARCHAR},
      </if>
      <if test="foptimes != null" >
        #{foptimes,jdbcType=INTEGER},
      </if>
      <if test="fopcode != null" >
        #{fopcode,jdbcType=VARCHAR},
      </if>
      <if test="fop != null" >
        #{fop,jdbcType=VARCHAR},
      </if>
      <if test="fopdate != null" >
        #{fopdate,jdbcType=TIMESTAMP},
      </if>
      <if test="fqiekoubh != null" >
        #{fqiekoubh,jdbcType=VARCHAR},
      </if>
      <if test="fqiekou != null" >
        #{fqiekou,jdbcType=VARCHAR},
      </if>
      <if test="fyuhebh != null" >
        #{fyuhebh,jdbcType=VARCHAR},
      </if>
      <if test="fyuhe != null" >
        #{fyuhe,jdbcType=VARCHAR},
      </if>
      <if test="fdocbh != null" >
        #{fdocbh,jdbcType=VARCHAR},
      </if>
      <if test="fdocname != null" >
        #{fdocname,jdbcType=VARCHAR},
      </if>
      <if test="fmazuibh != null" >
        #{fmazuibh,jdbcType=VARCHAR},
      </if>
      <if test="fmazui != null" >
        #{fmazui,jdbcType=VARCHAR},
      </if>
      <if test="fiffsop != null" >
        #{fiffsop,jdbcType=BIT},
      </if>
      <if test="fopdoct1bh != null" >
        #{fopdoct1bh,jdbcType=VARCHAR},
      </if>
      <if test="fopdoct1 != null" >
        #{fopdoct1,jdbcType=VARCHAR},
      </if>
      <if test="fopdoct2bh != null" >
        #{fopdoct2bh,jdbcType=VARCHAR},
      </if>
      <if test="fopdoct2 != null" >
        #{fopdoct2,jdbcType=VARCHAR},
      </if>
      <if test="fmzdoctbh != null" >
        #{fmzdoctbh,jdbcType=VARCHAR},
      </if>
      <if test="fmzdoct != null" >
        #{fmzdoct,jdbcType=VARCHAR},
      </if>
      <if test="foptykh != null" >
        #{foptykh,jdbcType=VARCHAR},
      </if>
      <if test="fopksname != null" >
        #{fopksname,jdbcType=VARCHAR},
      </if>
      <if test="fzqssbh != null" >
        #{fzqssbh,jdbcType=VARCHAR},
      </if>
      <if test="fzqss != null" >
        #{fzqss,jdbcType=VARCHAR},
      </if>
      <if test="fssjbbh != null" >
        #{fssjbbh,jdbcType=VARCHAR},
      </if>
      <if test="fssjb != null" >
        #{fssjb,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.emr.entity.his.HISBA4" >
    update HIS_BA4
    <set >
      <if test="fprn != null" >
        FPRN = #{fprn,jdbcType=VARCHAR},
      </if>
      <if test="ftimes != null" >
        FTIMES = #{ftimes,jdbcType=INTEGER},
      </if>
      <if test="fname != null" >
        FNAME = #{fname,jdbcType=VARCHAR},
      </if>
      <if test="foptimes != null" >
        FOPTIMES = #{foptimes,jdbcType=INTEGER},
      </if>
      <if test="fopcode != null" >
        FOPCODE = #{fopcode,jdbcType=VARCHAR},
      </if>
      <if test="fop != null" >
        FOP = #{fop,jdbcType=VARCHAR},
      </if>
      <if test="fopdate != null" >
        FOPDATE = #{fopdate,jdbcType=TIMESTAMP},
      </if>
      <if test="fqiekoubh != null" >
        FQIEKOUBH = #{fqiekoubh,jdbcType=VARCHAR},
      </if>
      <if test="fqiekou != null" >
        FQIEKOU = #{fqiekou,jdbcType=VARCHAR},
      </if>
      <if test="fyuhebh != null" >
        FYUHEBH = #{fyuhebh,jdbcType=VARCHAR},
      </if>
      <if test="fyuhe != null" >
        FYUHE = #{fyuhe,jdbcType=VARCHAR},
      </if>
      <if test="fdocbh != null" >
        FDOCBH = #{fdocbh,jdbcType=VARCHAR},
      </if>
      <if test="fdocname != null" >
        FDOCNAME = #{fdocname,jdbcType=VARCHAR},
      </if>
      <if test="fmazuibh != null" >
        FMAZUIBH = #{fmazuibh,jdbcType=VARCHAR},
      </if>
      <if test="fmazui != null" >
        FMAZUI = #{fmazui,jdbcType=VARCHAR},
      </if>
      <if test="fiffsop != null" >
        FIFFSOP = #{fiffsop,jdbcType=BIT},
      </if>
      <if test="fopdoct1bh != null" >
        FOPDOCT1BH = #{fopdoct1bh,jdbcType=VARCHAR},
      </if>
      <if test="fopdoct1 != null" >
        FOPDOCT1 = #{fopdoct1,jdbcType=VARCHAR},
      </if>
      <if test="fopdoct2bh != null" >
        FOPDOCT2BH = #{fopdoct2bh,jdbcType=VARCHAR},
      </if>
      <if test="fopdoct2 != null" >
        FOPDOCT2 = #{fopdoct2,jdbcType=VARCHAR},
      </if>
      <if test="fmzdoctbh != null" >
        FMZDOCTBH = #{fmzdoctbh,jdbcType=VARCHAR},
      </if>
      <if test="fmzdoct != null" >
        FMZDOCT = #{fmzdoct,jdbcType=VARCHAR},
      </if>
      <if test="foptykh != null" >
        FOPTYKH = #{foptykh,jdbcType=VARCHAR},
      </if>
      <if test="fopksname != null" >
        FOPKSNAME = #{fopksname,jdbcType=VARCHAR},
      </if>
      <if test="fzqssbh != null" >
        FZQSSBH = #{fzqssbh,jdbcType=VARCHAR},
      </if>
      <if test="fzqss != null" >
        FZQSS = #{fzqss,jdbcType=VARCHAR},
      </if>
      <if test="fssjbbh != null" >
        FSSJBBH = #{fssjbbh,jdbcType=VARCHAR},
      </if>
      <if test="fssjb != null" >
        FSSJB = #{fssjb,jdbcType=VARCHAR},
      </if>
    </set>
    where FID = #{fid,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.emr.entity.his.HISBA4" >
    update HIS_BA4
    set FPRN = #{fprn,jdbcType=VARCHAR},
      FTIMES = #{ftimes,jdbcType=INTEGER},
      FNAME = #{fname,jdbcType=VARCHAR},
      FOPTIMES = #{foptimes,jdbcType=INTEGER},
      FOPCODE = #{fopcode,jdbcType=VARCHAR},
      FOP = #{fop,jdbcType=VARCHAR},
      FOPDATE = #{fopdate,jdbcType=TIMESTAMP},
      FQIEKOUBH = #{fqiekoubh,jdbcType=VARCHAR},
      FQIEKOU = #{fqiekou,jdbcType=VARCHAR},
      FYUHEBH = #{fyuhebh,jdbcType=VARCHAR},
      FYUHE = #{fyuhe,jdbcType=VARCHAR},
      FDOCBH = #{fdocbh,jdbcType=VARCHAR},
      FDOCNAME = #{fdocname,jdbcType=VARCHAR},
      FMAZUIBH = #{fmazuibh,jdbcType=VARCHAR},
      FMAZUI = #{fmazui,jdbcType=VARCHAR},
      FIFFSOP = #{fiffsop,jdbcType=BIT},
      FOPDOCT1BH = #{fopdoct1bh,jdbcType=VARCHAR},
      FOPDOCT1 = #{fopdoct1,jdbcType=VARCHAR},
      FOPDOCT2BH = #{fopdoct2bh,jdbcType=VARCHAR},
      FOPDOCT2 = #{fopdoct2,jdbcType=VARCHAR},
      FMZDOCTBH = #{fmzdoctbh,jdbcType=VARCHAR},
      FMZDOCT = #{fmzdoct,jdbcType=VARCHAR},
      FOPTYKH = #{foptykh,jdbcType=VARCHAR},
      FOPKSNAME = #{fopksname,jdbcType=VARCHAR},
      FZQSSBH = #{fzqssbh,jdbcType=VARCHAR},
      FZQSS = #{fzqss,jdbcType=VARCHAR},
      FSSJBBH = #{fssjbbh,jdbcType=VARCHAR},
      FSSJB = #{fssjb,jdbcType=VARCHAR}
    where FID = #{fid,jdbcType=BIGINT}
  </update>
  <!--按病案号、住院次数查询记录-->
  <select id="selectAllByParam" resultMap="BaseResultMap">
      SELECT * FROM HIS_BA4 WHERE FPRN = #{fprn,jdbcType=VARCHAR} AND FTIMES = #{ftimes,jdbcType=INTEGER}
  </select>
  <!--批量删除-->
  <delete id="deleteAllByParam">
      DELETE FROM HIS_BA4 WHERE FPRN = #{fprn,jdbcType=VARCHAR} AND FTIMES = #{ftimes,jdbcType=INTEGER}
  </delete>
  <!--批量添加-->
  <insert id="SimpleInsert" parameterType="java.util.List">
    insert into HIS_BA4(
    FPRN, FTIMES,
    FNAME, FOPTIMES, FOPCODE,
    FOP, FOPDATE, FQIEKOUBH,
    FQIEKOU, FYUHEBH, FYUHE,
    FDOCBH, FDOCNAME, FMAZUIBH,
    FMAZUI, FIFFSOP, FOPDOCT1BH,
    FOPDOCT1, FOPDOCT2BH, FOPDOCT2,
    FMZDOCTBH, FMZDOCT, FOPTYKH,
    FOPKSNAME, FZQSSBH, FZQSS,
    FSSJBBH, FSSJB
    )
    values
    <foreach collection="list" item="items" separator=",">
      (
      #{items.fprn,jdbcType=VARCHAR}, #{items.ftimes,jdbcType=INTEGER},
      #{items.fname,jdbcType=VARCHAR}, #{items.foptimes,jdbcType=INTEGER}, #{items.fopcode,jdbcType=VARCHAR},
      #{items.fop,jdbcType=VARCHAR}, #{items.fopdate,jdbcType=TIMESTAMP}, #{items.fqiekoubh,jdbcType=VARCHAR},
      #{items.fqiekou,jdbcType=VARCHAR}, #{items.fyuhebh,jdbcType=VARCHAR}, #{items.fyuhe,jdbcType=VARCHAR},
      #{items.fdocbh,jdbcType=VARCHAR}, #{items.fdocname,jdbcType=VARCHAR}, #{items.fmazuibh,jdbcType=VARCHAR},
      #{items.fmazui,jdbcType=VARCHAR}, #{items.fiffsop,jdbcType=BIT}, #{items.fopdoct1bh,jdbcType=VARCHAR},
      #{items.fopdoct1,jdbcType=VARCHAR}, #{items.fopdoct2bh,jdbcType=VARCHAR}, #{items.fopdoct2,jdbcType=VARCHAR},
      #{items.fmzdoctbh,jdbcType=VARCHAR}, #{items.fmzdoct,jdbcType=VARCHAR}, #{items.foptykh,jdbcType=VARCHAR},
      #{items.fopksname,jdbcType=VARCHAR}, #{items.fzqssbh,jdbcType=VARCHAR}, #{items.fzqss,jdbcType=VARCHAR},
      #{items.fssjbbh,jdbcType=VARCHAR}, #{items.fssjb,jdbcType=VARCHAR}
      )
    </foreach>
  </insert>
</mapper>