<?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.HISBA3Mapper" >
  <resultMap id="BaseResultMap" type="com.emr.entity.his.HISBA3" >
    <id column="FID" property="fid" jdbcType="BIGINT" />
    <result column="FPRN" property="fprn" jdbcType="VARCHAR" />
    <result column="FTIMES" property="ftimes" jdbcType="INTEGER" />
    <result column="FZDLX" property="fzdlx" jdbcType="VARCHAR" />
    <result column="FICDVERSION" property="ficdversion" jdbcType="TINYINT" />
    <result column="FICDM" property="ficdm" jdbcType="VARCHAR" />
    <result column="FJBNAME" property="fjbname" jdbcType="VARCHAR" />
    <result column="FZLJGBH" property="fzljgbh" jdbcType="VARCHAR" />
    <result column="FZLJG" property="fzljg" jdbcType="VARCHAR" />
    <result column="FRYBQBH" property="frybqbh" jdbcType="VARCHAR" />
    <result column="FRYBQ" property="frybq" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    FID, FPRN, FTIMES, FZDLX, FICDVERSION, FICDM, FJBNAME, FZLJGBH, FZLJG, FRYBQBH, FRYBQ
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    select 
    <include refid="Base_Column_List" />
    from HIS_BA3
    where FID = #{fid,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from HIS_BA3
    where FID = #{fid,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.emr.entity.his.HISBA3" >
    insert into HIS_BA3 (FPRN, FTIMES,
      FZDLX, FICDVERSION, FICDM, 
      FJBNAME, FZLJGBH, FZLJG, 
      FRYBQBH, FRYBQ)
    values (#{fprn,jdbcType=VARCHAR}, #{ftimes,jdbcType=INTEGER},
      #{fzdlx,jdbcType=VARCHAR}, #{ficdversion,jdbcType=TINYINT}, #{ficdm,jdbcType=VARCHAR}, 
      #{fjbname,jdbcType=VARCHAR}, #{fzljgbh,jdbcType=VARCHAR}, #{fzljg,jdbcType=VARCHAR}, 
      #{frybqbh,jdbcType=VARCHAR}, #{frybq,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.emr.entity.his.HISBA3" >
    insert into HIS_BA3
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="fid != null" >
        FID,
      </if>
      <if test="fprn != null" >
        FPRN,
      </if>
      <if test="ftimes != null" >
        FTIMES,
      </if>
      <if test="fzdlx != null" >
        FZDLX,
      </if>
      <if test="ficdversion != null" >
        FICDVERSION,
      </if>
      <if test="ficdm != null" >
        FICDM,
      </if>
      <if test="fjbname != null" >
        FJBNAME,
      </if>
      <if test="fzljgbh != null" >
        FZLJGBH,
      </if>
      <if test="fzljg != null" >
        FZLJG,
      </if>
      <if test="frybqbh != null" >
        FRYBQBH,
      </if>
      <if test="frybq != null" >
        FRYBQ,
      </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="fzdlx != null" >
        #{fzdlx,jdbcType=VARCHAR},
      </if>
      <if test="ficdversion != null" >
        #{ficdversion,jdbcType=TINYINT},
      </if>
      <if test="ficdm != null" >
        #{ficdm,jdbcType=VARCHAR},
      </if>
      <if test="fjbname != null" >
        #{fjbname,jdbcType=VARCHAR},
      </if>
      <if test="fzljgbh != null" >
        #{fzljgbh,jdbcType=VARCHAR},
      </if>
      <if test="fzljg != null" >
        #{fzljg,jdbcType=VARCHAR},
      </if>
      <if test="frybqbh != null" >
        #{frybqbh,jdbcType=VARCHAR},
      </if>
      <if test="frybq != null" >
        #{frybq,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.emr.entity.his.HISBA3" >
    update HIS_BA3
    <set >
      <if test="fprn != null" >
        FPRN = #{fprn,jdbcType=VARCHAR},
      </if>
      <if test="ftimes != null" >
        FTIMES = #{ftimes,jdbcType=INTEGER},
      </if>
      <if test="fzdlx != null" >
        FZDLX = #{fzdlx,jdbcType=VARCHAR},
      </if>
      <if test="ficdversion != null" >
        FICDVERSION = #{ficdversion,jdbcType=TINYINT},
      </if>
      <if test="ficdm != null" >
        FICDM = #{ficdm,jdbcType=VARCHAR},
      </if>
      <if test="fjbname != null" >
        FJBNAME = #{fjbname,jdbcType=VARCHAR},
      </if>
      <if test="fzljgbh != null" >
        FZLJGBH = #{fzljgbh,jdbcType=VARCHAR},
      </if>
      <if test="fzljg != null" >
        FZLJG = #{fzljg,jdbcType=VARCHAR},
      </if>
      <if test="frybqbh != null" >
        FRYBQBH = #{frybqbh,jdbcType=VARCHAR},
      </if>
      <if test="frybq != null" >
        FRYBQ = #{frybq,jdbcType=VARCHAR},
      </if>
    </set>
    where FID = #{fid,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.emr.entity.his.HISBA3" >
    update HIS_BA3
    set FPRN = #{fprn,jdbcType=VARCHAR},
      FTIMES = #{ftimes,jdbcType=INTEGER},
      FZDLX = #{fzdlx,jdbcType=VARCHAR},
      FICDVERSION = #{ficdversion,jdbcType=TINYINT},
      FICDM = #{ficdm,jdbcType=VARCHAR},
      FJBNAME = #{fjbname,jdbcType=VARCHAR},
      FZLJGBH = #{fzljgbh,jdbcType=VARCHAR},
      FZLJG = #{fzljg,jdbcType=VARCHAR},
      FRYBQBH = #{frybqbh,jdbcType=VARCHAR},
      FRYBQ = #{frybq,jdbcType=VARCHAR}
    where FID = #{fid,jdbcType=BIGINT}
  </update>
  <!--按病案号、住院次数查询记录-->
  <select id="selectAllByParam" resultMap="BaseResultMap">
      SELECT * FROM HIS_BA3 WHERE FPRN = #{fprn,jdbcType=VARCHAR} AND FTIMES = #{ftimes,jdbcType=INTEGER}
  </select>
  <!--批量删除-->
  <delete id="deleteAllByParam">
      DELETE FROM HIS_BA3 WHERE FPRN = #{fprn,jdbcType=VARCHAR} AND FTIMES = #{ftimes,jdbcType=INTEGER}
  </delete>
  <!--批量添加-->
  <insert id="SimpleInsert" parameterType="java.util.List">
    insert into HIS_BA3(
    FPRN, FTIMES,
    FZDLX, FICDVERSION, FICDM,
    FJBNAME, FZLJGBH, FZLJG,
    FRYBQBH, FRYBQ
    )
    values
    <foreach collection="list" item="items" separator=",">
      (
      #{items.fprn,jdbcType=VARCHAR}, #{items.ftimes,jdbcType=INTEGER},
      #{items.fzdlx,jdbcType=VARCHAR}, #{items.ficdversion,jdbcType=TINYINT}, #{items.ficdm,jdbcType=VARCHAR},
      #{items.fjbname,jdbcType=VARCHAR}, #{items.fzljgbh,jdbcType=VARCHAR}, #{items.fzljg,jdbcType=VARCHAR},
      #{items.frybqbh,jdbcType=VARCHAR}, #{items.frybq,jdbcType=VARCHAR}
      )
    </foreach>
  </insert>
</mapper>