<?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.smartor.mapper.MedicalHistoryMapper">
|
|
<resultMap type="com.smartor.domain.MedicalHistory" id="MedicalHistoryResult">
|
<result property="id" column="id" />
|
<result property="pastIllnesses" column="past_illnesses" />
|
<result property="drugAllergy" column="drug_allergy" />
|
<result property="familyHistory" column="family_history" />
|
<result property="surgicalHistory" column="surgical_history" />
|
<result property="reproductiveHistory" column="reproductive_history" />
|
<result property="menstrualHistory" column="menstrual_history" />
|
<result property="smoking" column="smoking" />
|
<result property="drink" column="drink" />
|
<result property="motion" column="motion" />
|
<result property="diet" column="diet" />
|
<result property="psychology" column="psychology" />
|
<result property="pid" column="pid" />
|
<result property="guid" column="guid" />
|
<result property="orgid" column="orgid" />
|
</resultMap>
|
|
<sql id="selectMedicalHistoryVo">
|
select id, past_illnesses, guid, drug_allergy, family_history, surgical_history, reproductive_history, orgid,menstrual_history, smoking, drink, motion, diet, psychology, pid from medical_history
|
</sql>
|
|
<select id="selectMedicalHistoryList" parameterType="com.smartor.domain.MedicalHistory" resultMap="MedicalHistoryResult">
|
<include refid="selectMedicalHistoryVo"/>
|
<where>
|
<if test="pastIllnesses != null and pastIllnesses != ''"> and past_illnesses = #{pastIllnesses}</if>
|
<if test="drugAllergy != null and drugAllergy != ''"> and drug_allergy = #{drugAllergy}</if>
|
<if test="familyHistory != null and familyHistory != ''"> and family_history = #{familyHistory}</if>
|
<if test="surgicalHistory != null and surgicalHistory != ''"> and surgical_history = #{surgicalHistory}</if>
|
<if test="reproductiveHistory != null and reproductiveHistory != ''"> and reproductive_history = #{reproductiveHistory}</if>
|
<if test="menstrualHistory != null and menstrualHistory != ''"> and menstrual_history = #{menstrualHistory}</if>
|
<if test="smoking != null and smoking != ''"> and smoking = #{smoking}</if>
|
<if test="drink != null and drink != ''"> and drink = #{drink}</if>
|
<if test="motion != null and motion != ''"> and motion = #{motion}</if>
|
<if test="diet != null and diet != ''"> and diet = #{diet}</if>
|
<if test="psychology != null and psychology != ''"> and psychology = #{psychology}</if>
|
<if test="pid != null "> and pid = #{pid}</if>
|
<if test="orgid != null "> and orgid = #{orgid}</if>
|
</where>
|
</select>
|
|
<select id="selectMedicalHistoryById" parameterType="Long" resultMap="MedicalHistoryResult">
|
<include refid="selectMedicalHistoryVo"/>
|
where id = #{id}
|
</select>
|
|
<insert id="insertMedicalHistory" parameterType="com.smartor.domain.MedicalHistory" useGeneratedKeys="true" keyProperty="id">
|
insert into medical_history
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="pastIllnesses != null">past_illnesses,</if>
|
<if test="drugAllergy != null">drug_allergy,</if>
|
<if test="familyHistory != null">family_history,</if>
|
<if test="surgicalHistory != null">surgical_history,</if>
|
<if test="reproductiveHistory != null">reproductive_history,</if>
|
<if test="menstrualHistory != null">menstrual_history,</if>
|
<if test="smoking != null">smoking,</if>
|
<if test="drink != null">drink,</if>
|
<if test="motion != null">motion,</if>
|
<if test="diet != null">diet,</if>
|
<if test="psychology != null">psychology,</if>
|
<if test="pid != null">pid,</if>
|
<if test="guid != null">guid,</if>
|
<if test="orgid != null">orgid,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="pastIllnesses != null">#{pastIllnesses},</if>
|
<if test="drugAllergy != null">#{drugAllergy},</if>
|
<if test="familyHistory != null">#{familyHistory},</if>
|
<if test="surgicalHistory != null">#{surgicalHistory},</if>
|
<if test="reproductiveHistory != null">#{reproductiveHistory},</if>
|
<if test="menstrualHistory != null">#{menstrualHistory},</if>
|
<if test="smoking != null">#{smoking},</if>
|
<if test="drink != null">#{drink},</if>
|
<if test="motion != null">#{motion},</if>
|
<if test="diet != null">#{diet},</if>
|
<if test="psychology != null">#{psychology},</if>
|
<if test="pid != null">#{pid},</if>
|
<if test="guid != null">#{guid},</if>
|
<if test="orgid != null">#{orgid},</if>
|
</trim>
|
</insert>
|
|
<update id="updateMedicalHistory" parameterType="com.smartor.domain.MedicalHistory">
|
update medical_history
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="pastIllnesses != null">past_illnesses = #{pastIllnesses},</if>
|
<if test="drugAllergy != null">drug_allergy = #{drugAllergy},</if>
|
<if test="familyHistory != null">family_history = #{familyHistory},</if>
|
<if test="surgicalHistory != null">surgical_history = #{surgicalHistory},</if>
|
<if test="reproductiveHistory != null">reproductive_history = #{reproductiveHistory},</if>
|
<if test="menstrualHistory != null">menstrual_history = #{menstrualHistory},</if>
|
<if test="smoking != null">smoking = #{smoking},</if>
|
<if test="drink != null">drink = #{drink},</if>
|
<if test="motion != null">motion = #{motion},</if>
|
<if test="diet != null">diet = #{diet},</if>
|
<if test="psychology != null">psychology = #{psychology},</if>
|
<if test="pid != null">pid = #{pid},</if>
|
<if test="guid != null">guid = #{guid},</if>
|
<if test="orgid != null">orgid = #{orgid},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteMedicalHistoryById" parameterType="Long">
|
delete from medical_history where id = #{id}
|
</delete>
|
|
<delete id="deleteMedicalHistoryByIds" parameterType="String">
|
delete from medical_history where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
</mapper>
|