<?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.tTumour.TTumourChemotherapyMapper" >
  <resultMap id="BaseResultMap" type="com.emr.entity.tTumour.TTumourChemotherapy" >
    <result column="patient_id" property="patientId" jdbcType="VARCHAR" />
    <result column="start_time" property="startTime" jdbcType="VARCHAR" />
    <result column="end_time" property="endTime" jdbcType="VARCHAR" />
    <result column="drug_name_and_dose" property="drugNameAndDose" jdbcType="VARCHAR" />
    <result column="treatment_course" property="treatmentCourse" jdbcType="VARCHAR" />
    <result column="curative_effect" property="curativeEffect" jdbcType="VARCHAR" />
  </resultMap>
  <insert id="insert" parameterType="com.emr.entity.tTumour.TTumourChemotherapy" >
    insert into t_tumour_chemotherapy (patient_id, start_time, end_time, 
      drug_name_and_dose, treatment_course, curative_effect
      )
    values (#{patientId,jdbcType=VARCHAR}, #{startTime,jdbcType=VARCHAR}, #{endTime,jdbcType=VARCHAR}, 
      #{drugNameAndDose,jdbcType=VARCHAR}, #{treatmentCourse,jdbcType=VARCHAR}, #{curativeEffect,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.emr.entity.tTumour.TTumourChemotherapy" >
    insert into t_tumour_chemotherapy
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="patientId != null" >
        patient_id,
      </if>
      <if test="startTime != null" >
        start_time,
      </if>
      <if test="endTime != null" >
        end_time,
      </if>
      <if test="drugNameAndDose != null" >
        drug_name_and_dose,
      </if>
      <if test="treatmentCourse != null" >
        treatment_course,
      </if>
      <if test="curativeEffect != null" >
        curative_effect,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="patientId != null" >
        #{patientId,jdbcType=VARCHAR},
      </if>
      <if test="startTime != null" >
        #{startTime,jdbcType=VARCHAR},
      </if>
      <if test="endTime != null" >
        #{endTime,jdbcType=VARCHAR},
      </if>
      <if test="drugNameAndDose != null" >
        #{drugNameAndDose,jdbcType=VARCHAR},
      </if>
      <if test="treatmentCourse != null" >
        #{treatmentCourse,jdbcType=VARCHAR},
      </if>
      <if test="curativeEffect != null" >
        #{curativeEffect,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="selectByPatientId" resultMap="BaseResultMap">
      select * from t_tumour_chemotherapy where patient_id = #{patientId};
  </select>
  <delete id="deleteByPatientId">
    delete from t_tumour_chemotherapy where patient_id = #{patientId}
  </delete>
  <insert id="SimpleInsert" parameterType="java.util.List">
    insert into t_tumour_chemotherapy(
      patient_id, start_time, end_time,
      drug_name_and_dose, treatment_course, curative_effect
    )
    values
    <foreach collection="list" item="items" separator=",">
      (
        #{items.patientId,jdbcType=VARCHAR}, #{items.startTime,jdbcType=VARCHAR}, #{items.endTime,jdbcType=VARCHAR},
        #{items.drugNameAndDose,jdbcType=VARCHAR}, #{items.treatmentCourse,jdbcType=VARCHAR},
        #{items.curativeEffect,jdbcType=VARCHAR}
      )
    </foreach>
  </insert>
</mapper>