<?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.Zd_Icd_CodeMapper" >
  <resultMap id="BaseResultMap" type="com.emr.entity.Zd_Icd_Code" >
    <result column="code" property="code" jdbcType="CHAR" />
    <result column="icd_9" property="icd9" jdbcType="CHAR" />
    <result column="name" property="name" jdbcType="VARCHAR" />
    <result column="icd_count" property="icdCount" jdbcType="CHAR" />
    <result column="py_code" property="pyCode" jdbcType="VARCHAR" />
    <result column="five_code" property="fiveCode" jdbcType="VARCHAR" />
    <result column="icd_by" property="icdBy" jdbcType="CHAR" />
    <result column="icd_add" property="icdAdd" jdbcType="CHAR" />
    <result column="serial_no" property="serialNo" jdbcType="INTEGER" />
  </resultMap>
  <insert id="insert" parameterType="com.emr.entity.Zd_Icd_Code" >
    insert into zd_icd_code (code, icd_9, name, icd_count, 
      py_code, five_code, icd_by, 
      icd_add, serial_no)
    values (#{code,jdbcType=CHAR}, #{icd9,jdbcType=CHAR}, #{name,jdbcType=VARCHAR}, #{icdCount,jdbcType=CHAR}, 
      #{pyCode,jdbcType=VARCHAR}, #{fiveCode,jdbcType=VARCHAR}, #{icdBy,jdbcType=CHAR}, 
      #{icdAdd,jdbcType=CHAR}, #{serialNo,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.emr.entity.Zd_Icd_Code" >
    insert into zd_icd_code
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="code != null" >
        code,
      </if>
      <if test="icd9 != null" >
        icd_9,
      </if>
      <if test="name != null" >
        name,
      </if>
      <if test="icdCount != null" >
        icd_count,
      </if>
      <if test="pyCode != null" >
        py_code,
      </if>
      <if test="fiveCode != null" >
        five_code,
      </if>
      <if test="icdBy != null" >
        icd_by,
      </if>
      <if test="icdAdd != null" >
        icd_add,
      </if>
      <if test="serialNo != null" >
        serial_no,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="code != null" >
        #{code,jdbcType=CHAR},
      </if>
      <if test="icd9 != null" >
        #{icd9,jdbcType=CHAR},
      </if>
      <if test="name != null" >
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="icdCount != null" >
        #{icdCount,jdbcType=CHAR},
      </if>
      <if test="pyCode != null" >
        #{pyCode,jdbcType=VARCHAR},
      </if>
      <if test="fiveCode != null" >
        #{fiveCode,jdbcType=VARCHAR},
      </if>
      <if test="icdBy != null" >
        #{icdBy,jdbcType=CHAR},
      </if>
      <if test="icdAdd != null" >
        #{icdAdd,jdbcType=CHAR},
      </if>
      <if test="serialNo != null" >
        #{serialNo,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <!--根据编号或名称对应的单个对象或多个对象-->
  <select id="selectAll" resultMap="BaseResultMap">
      SELECT
          code,name
      FROM
          zd_icd_code
      <where>
        <if test="code != null and code != ''">
          code like '%${code}%'
        </if>
        <if test="name != null and name != ''">
          AND  name like '%${name}%'
        </if>
      </where>
  </select>
</mapper>