<?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.zdDictionary.ZdDeptCodeMapper" >
  <resultMap id="BaseResultMap" type="com.emr.entity.zdDictionary.ZdDeptCode" >
    <result column="code" property="code" jdbcType="VARCHAR" />
    <result column="name" property="name" jdbcType="VARCHAR" />
    <result column="ward" property="ward" jdbcType="VARCHAR" />
    <result column="py_code" property="pyCode" jdbcType="VARCHAR" />
    <result column="compute_name" property="computeName" jdbcType="VARCHAR" />
    <result column="count_code" property="countCode" jdbcType="VARCHAR" />
    <result column="clinic" property="clinic" jdbcType="VARCHAR" />
    <result column="emergency" property="emergency" jdbcType="VARCHAR" />
    <result column="inhospital" property="inhospital" jdbcType="VARCHAR" />
    <result column="technic" property="technic" jdbcType="VARCHAR" />
    <result column="watch" property="watch" jdbcType="VARCHAR" />
    <result column="home" property="home" jdbcType="VARCHAR" />
    <result column="bed" property="bed" jdbcType="SMALLINT" />
    <result column="profession" property="profession" jdbcType="VARCHAR" />
    <result column="clinic_sort" property="clinicSort" jdbcType="SMALLINT" />
    <result column="emergency_sort" property="emergencySort" jdbcType="SMALLINT" />
    <result column="inhospital_sort" property="inhospitalSort" jdbcType="SMALLINT" />
    <result column="technic_sort" property="technicSort" jdbcType="SMALLINT" />
    <result column="watch_sort" property="watchSort" jdbcType="SMALLINT" />
    <result column="dept_sort" property="deptSort" jdbcType="SMALLINT" />
    <result column="flag" property="flag" jdbcType="SMALLINT" />
    <result column="technic_type" property="technicType" jdbcType="VARCHAR" />
  </resultMap>
  <insert id="insert" parameterType="com.emr.entity.zdDictionary.ZdDeptCode" >
    insert into zd_dept_code (code, name, ward, 
      py_code, compute_name, count_code, 
      clinic, emergency, inhospital, 
      technic, watch, home, 
      bed, profession, clinic_sort, 
      emergency_sort, inhospital_sort, technic_sort, 
      watch_sort, dept_sort, flag, 
      technic_type)
    values (#{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{ward,jdbcType=VARCHAR}, 
      #{pyCode,jdbcType=VARCHAR}, #{computeName,jdbcType=VARCHAR}, #{countCode,jdbcType=VARCHAR}, 
      #{clinic,jdbcType=VARCHAR}, #{emergency,jdbcType=VARCHAR}, #{inhospital,jdbcType=VARCHAR}, 
      #{technic,jdbcType=VARCHAR}, #{watch,jdbcType=VARCHAR}, #{home,jdbcType=VARCHAR}, 
      #{bed,jdbcType=SMALLINT}, #{profession,jdbcType=VARCHAR}, #{clinicSort,jdbcType=SMALLINT}, 
      #{emergencySort,jdbcType=SMALLINT}, #{inhospitalSort,jdbcType=SMALLINT}, #{technicSort,jdbcType=SMALLINT}, 
      #{watchSort,jdbcType=SMALLINT}, #{deptSort,jdbcType=SMALLINT}, #{flag,jdbcType=SMALLINT}, 
      #{technicType,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.emr.entity.zdDictionary.ZdDeptCode" >
    insert into zd_dept_code
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="code != null" >
        code,
      </if>
      <if test="name != null" >
        name,
      </if>
      <if test="ward != null" >
        ward,
      </if>
      <if test="pyCode != null" >
        py_code,
      </if>
      <if test="computeName != null" >
        compute_name,
      </if>
      <if test="countCode != null" >
        count_code,
      </if>
      <if test="clinic != null" >
        clinic,
      </if>
      <if test="emergency != null" >
        emergency,
      </if>
      <if test="inhospital != null" >
        inhospital,
      </if>
      <if test="technic != null" >
        technic,
      </if>
      <if test="watch != null" >
        watch,
      </if>
      <if test="home != null" >
        home,
      </if>
      <if test="bed != null" >
        bed,
      </if>
      <if test="profession != null" >
        profession,
      </if>
      <if test="clinicSort != null" >
        clinic_sort,
      </if>
      <if test="emergencySort != null" >
        emergency_sort,
      </if>
      <if test="inhospitalSort != null" >
        inhospital_sort,
      </if>
      <if test="technicSort != null" >
        technic_sort,
      </if>
      <if test="watchSort != null" >
        watch_sort,
      </if>
      <if test="deptSort != null" >
        dept_sort,
      </if>
      <if test="flag != null" >
        flag,
      </if>
      <if test="technicType != null" >
        technic_type,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="code != null" >
        #{code,jdbcType=VARCHAR},
      </if>
      <if test="name != null" >
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="ward != null" >
        #{ward,jdbcType=VARCHAR},
      </if>
      <if test="pyCode != null" >
        #{pyCode,jdbcType=VARCHAR},
      </if>
      <if test="computeName != null" >
        #{computeName,jdbcType=VARCHAR},
      </if>
      <if test="countCode != null" >
        #{countCode,jdbcType=VARCHAR},
      </if>
      <if test="clinic != null" >
        #{clinic,jdbcType=VARCHAR},
      </if>
      <if test="emergency != null" >
        #{emergency,jdbcType=VARCHAR},
      </if>
      <if test="inhospital != null" >
        #{inhospital,jdbcType=VARCHAR},
      </if>
      <if test="technic != null" >
        #{technic,jdbcType=VARCHAR},
      </if>
      <if test="watch != null" >
        #{watch,jdbcType=VARCHAR},
      </if>
      <if test="home != null" >
        #{home,jdbcType=VARCHAR},
      </if>
      <if test="bed != null" >
        #{bed,jdbcType=SMALLINT},
      </if>
      <if test="profession != null" >
        #{profession,jdbcType=VARCHAR},
      </if>
      <if test="clinicSort != null" >
        #{clinicSort,jdbcType=SMALLINT},
      </if>
      <if test="emergencySort != null" >
        #{emergencySort,jdbcType=SMALLINT},
      </if>
      <if test="inhospitalSort != null" >
        #{inhospitalSort,jdbcType=SMALLINT},
      </if>
      <if test="technicSort != null" >
        #{technicSort,jdbcType=SMALLINT},
      </if>
      <if test="watchSort != null" >
        #{watchSort,jdbcType=SMALLINT},
      </if>
      <if test="deptSort != null" >
        #{deptSort,jdbcType=SMALLINT},
      </if>
      <if test="flag != null" >
        #{flag,jdbcType=SMALLINT},
      </if>
      <if test="technicType != null" >
        #{technicType,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="selectAll" resultMap="BaseResultMap">
      select code,name from zd_dept_code
  </select>
</mapper>