<?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.lyms.platform.permission.dao.master.BabyPatientExtendEarMotherMapper">
<resultMap id="BabyPatientExtendEarMotherResultMap" type="com.lyms.platform.permission.model.BabyPatientExtendEarMother">
<id column="id" property="id" jdbcType="VARCHAR" />
<result column="gestation_age" property="gestationAge" jdbcType="INTEGER" />
<result column="abortion_history_type" property="abortionHistoryType" jdbcType="VARCHAR" />
<result column="viral_infection_history_type" property="viralInfectionHistoryType" jdbcType="VARCHAR" />
<result column="genital_infection_history_type" property="genitalInfectionHistoryType" jdbcType="VARCHAR" />
<result column="radiation_history_type" property="radiationHistoryType" jdbcType="VARCHAR" />
<result column="drug_app_name" property="drugAppName" jdbcType="VARCHAR" />
<result column="harmful_substance_type" property="harmfulSubstanceType" jdbcType="VARCHAR" />
<result column="bad_life_history_type" property="badLifeHistoryType" jdbcType="VARCHAR" />
<result column="medical_history_type" property="medicalHistoryType" jdbcType="VARCHAR" />
<result column="bnormal_pregnancy_history_type" property="bnormalPregnancyHistoryType" jdbcType="VARCHAR" />
<result column="baby_patient_id" property="babyPatientId" jdbcType="VARCHAR" />
<result column="baby_ear_id" property="babyEarId" jdbcType="VARCHAR" />
</resultMap>
<insert id="addBabyPatientExtendEarMother" parameterType="com.lyms.platform.permission.model.BabyPatientExtendEarMother">
insert into baby_patient_extend_ear_mother (id,gestation_age,abortion_history_type,viral_infection_history_type,genital_infection_history_type,radiation_history_type,drug_app_name,harmful_substance_type,bad_life_history_type,medical_history_type,bnormal_pregnancy_history_type,baby_patient_id,baby_ear_id) values (#{id},#{gestationAge},#{abortionHistoryType},#{viralInfectionHistoryType},#{genitalInfectionHistoryType},#{radiationHistoryType},#{drugAppName},#{harmfulSubstanceType},#{badLifeHistoryType},#{medicalHistoryType},#{bnormalPregnancyHistoryType},#{babyPatientId},#{babyEarId})
</insert>
<update id="updateBabyPatientExtendEarMother" parameterType="com.lyms.platform.permission.model.BabyPatientExtendEarMother">
update baby_patient_extend_ear_mother <set><if test="gestationAge != null and gestationAge >= 0">
gestation_age = #{gestationAge,jdbcType=INTEGER},
</if>
<if test="abortionHistoryType != null and abortionHistoryType != ''">
abortion_history_type = #{abortionHistoryType,jdbcType=VARCHAR},
</if>
<if test="viralInfectionHistoryType != null and viralInfectionHistoryType != ''">
viral_infection_history_type = #{viralInfectionHistoryType,jdbcType=VARCHAR},
</if>
<if test="genitalInfectionHistoryType != null and genitalInfectionHistoryType != ''">
genital_infection_history_type = #{genitalInfectionHistoryType,jdbcType=VARCHAR},
</if>
<if test="radiationHistoryType != null and radiationHistoryType != ''">
radiation_history_type = #{radiationHistoryType,jdbcType=VARCHAR},
</if>
<if test="drugAppName != null and drugAppName != ''">
drug_app_name = #{drugAppName,jdbcType=VARCHAR},
</if>
<if test="harmfulSubstanceType != null and harmfulSubstanceType != ''">
harmful_substance_type = #{harmfulSubstanceType,jdbcType=VARCHAR},
</if>
<if test="badLifeHistoryType != null and badLifeHistoryType != ''">
bad_life_history_type = #{badLifeHistoryType,jdbcType=VARCHAR},
</if>
<if test="medicalHistoryType != null and medicalHistoryType != ''">
medical_history_type = #{medicalHistoryType,jdbcType=VARCHAR},
</if>
<if test="bnormalPregnancyHistoryType != null and bnormalPregnancyHistoryType != ''">
bnormal_pregnancy_history_type = #{bnormalPregnancyHistoryType,jdbcType=VARCHAR},
</if>
<if test="babyPatientId != null and babyPatientId != ''">
baby_patient_id = #{babyPatientId,jdbcType=VARCHAR},
</if>
<if test="babyEarId != null and babyEarId != ''">
baby_ear_id = #{babyEarId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<delete id="deleteBabyPatientExtendEarMother" parameterType="java.lang.Integer">
delete from baby_patient_extend_ear_mother where id = #{id,jdbcType=VARCHAR}
</delete>
<select id="getBabyPatientExtendEarMother" resultMap="BabyPatientExtendEarMotherResultMap" parameterType="java.lang.Integer">
select id,gestation_age,abortion_history_type,viral_infection_history_type,genital_infection_history_type,radiation_history_type,drug_app_name,harmful_substance_type,bad_life_history_type,medical_history_type,bnormal_pregnancy_history_type,baby_patient_id,baby_ear_id
from baby_patient_extend_ear_mother where id = #{id,jdbcType=VARCHAR}
</select>
<sql id="orderAndLimit">
<if test="sort != null and sort != '' ">
order by ${sort}
<if test="need != null">
limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER}
</if>
</if>
</sql>
<sql id="BabyPatientExtendEarMotherCondition">
<where>
1 = 1
<if test="id != null and id != ''">
and id = #{id,jdbcType=VARCHAR}
</if>
<if test="gestationAge != null and gestationAge >= 0">
and gestation_age = #{gestationAge,jdbcType=INTEGER}
</if>
<if test="abortionHistoryType != null and abortionHistoryType != ''">
and abortion_history_type = #{abortionHistoryType,jdbcType=VARCHAR}
</if>
<if test="viralInfectionHistoryType != null and viralInfectionHistoryType != ''">
and viral_infection_history_type = #{viralInfectionHistoryType,jdbcType=VARCHAR}
</if>
<if test="genitalInfectionHistoryType != null and genitalInfectionHistoryType != ''">
and genital_infection_history_type = #{genitalInfectionHistoryType,jdbcType=VARCHAR}
</if>
<if test="radiationHistoryType != null and radiationHistoryType != ''">
and radiation_history_type = #{radiationHistoryType,jdbcType=VARCHAR}
</if>
<if test="drugAppName != null and drugAppName != ''">
and drug_app_name = #{drugAppName,jdbcType=VARCHAR}
</if>
<if test="harmfulSubstanceType != null and harmfulSubstanceType != ''">
and harmful_substance_type = #{harmfulSubstanceType,jdbcType=VARCHAR}
</if>
<if test="badLifeHistoryType != null and badLifeHistoryType != ''">
and bad_life_history_type = #{badLifeHistoryType,jdbcType=VARCHAR}
</if>
<if test="medicalHistoryType != null and medicalHistoryType != ''">
and medical_history_type = #{medicalHistoryType,jdbcType=VARCHAR}
</if>
<if test="bnormalPregnancyHistoryType != null and bnormalPregnancyHistoryType != ''">
and bnormal_pregnancy_history_type = #{bnormalPregnancyHistoryType,jdbcType=VARCHAR}
</if>
<if test="babyPatientId != null and babyPatientId != ''">
and baby_patient_id = #{babyPatientId,jdbcType=VARCHAR}
</if>
<if test="babyEarId != null and babyEarId != ''">
and baby_ear_id = #{babyEarId,jdbcType=VARCHAR}
</if>
</where>
</sql>
<select id="queryBabyPatientExtendEarMother" resultMap="BabyPatientExtendEarMotherResultMap" parameterType="com.lyms.platform.permission.model.BabyPatientExtendEarMotherQuery">
select id,gestation_age,abortion_history_type,viral_infection_history_type,genital_infection_history_type,radiation_history_type,drug_app_name,harmful_substance_type,bad_life_history_type,medical_history_type,bnormal_pregnancy_history_type,baby_patient_id,baby_ear_id
from baby_patient_extend_ear_mother
<include refid="BabyPatientExtendEarMotherCondition" />
<include refid="orderAndLimit" />
</select>
<select id="queryBabyPatientExtendEarMotherCount" resultType="int" parameterType="com.lyms.platform.permission.model.BabyPatientExtendEarMotherQuery">
select count(1) from baby_patient_extend_ear_mother
<include refid="BabyPatientExtendEarMotherCondition" />
</select>
</mapper>