<?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.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="INTEGER" />
<result column="abortion_date" property="abortionDate" jdbcType="TIMESTAMP" />
<result column="abortion_cause" property="abortionCause" jdbcType="VARCHAR" />
<result column="abortion_type" property="abortionType" jdbcType="INTEGER" />
<result column="viral_infection_history_type" property="viralInfectionHistoryType" jdbcType="INTEGER" />
<result column="viral_infection_type_id" property="viralInfectionTypeId" jdbcType="VARCHAR" />
<result column="viral_infection_other_desc" property="viralInfectionOtherDesc" jdbcType="VARCHAR" />
<result column="viral_infection_date" property="viralInfectionDate" jdbcType="INTEGER" />
<result column="genital_infection_history_type" property="genitalInfectionHistoryType" jdbcType="INTEGER" />
<result column="genital_infection_type_id" property="genitalInfectionTypeId" jdbcType="VARCHAR" />
<result column="genital_infection_other_desc" property="genitalInfectionOtherDesc" jdbcType="VARCHAR" />
<result column="genital_infection_date" property="genitalInfectionDate" jdbcType="INTEGER" />
<result column="radiation_type" property="radiationType" jdbcType="INTEGER" />
<result column="radiation_date" property="radiationDate" jdbcType="TIMESTAMP" />
<result column="drug_app_type" property="drugAppType" jdbcType="INTEGER" />
<result column="drug_app_name" property="drugAppName" jdbcType="VARCHAR" />
<result column="drug_app_use_date" property="drugAppUseDate" jdbcType="TIMESTAMP" />
<result column="harmful_substance_type" property="harmfulSubstanceType" jdbcType="INTEGER" />
<result column="harmful_substance_name" property="harmfulSubstanceName" jdbcType="VARCHAR" />
<result column="harmful_substance_date" property="harmfulSubstanceDate" jdbcType="TIMESTAMP" />
<result column="bad_life_history_type" property="badLifeHistoryType" jdbcType="INTEGER" />
<result column="bad_life_type_id" property="badLifeTypeId" jdbcType="VARCHAR" />
<result column="medical_history_type" property="medicalHistoryType" jdbcType="INTEGER" />
<result column="medical_type_id" property="medicalTypeId" jdbcType="INTEGER" />
<result column="medical_other_type_desc" property="medicalOtherTypeDesc" jdbcType="VARCHAR" />
<result column="bnormal_pregnancy_history_type" property="bnormalPregnancyHistoryType" jdbcType="INTEGER" />
<result column="bnormal_pregnancy_type_id" property="bnormalPregnancyTypeId" jdbcType="VARCHAR" />
<result column="bnormal_pregnancy_other_desc" property="bnormalPregnancyOtherDesc" jdbcType="VARCHAR" />
<result column="baby_patient_id" property="babyPatientId" 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,abortion_date,abortion_cause,abortion_type,viral_infection_history_type,viral_infection_type_id,viral_infection_other_desc,viral_infection_date,genital_infection_history_type,genital_infection_type_id,genital_infection_other_desc,genital_infection_date,radiation_type,radiation_date,drug_app_type,drug_app_name,drug_app_use_date,harmful_substance_type,harmful_substance_name,harmful_substance_date,bad_life_history_type,bad_life_type_id,medical_history_type,medical_type_id,medical_other_type_desc,bnormal_pregnancy_history_type,bnormal_pregnancy_type_id,bnormal_pregnancy_other_desc,baby_patient_id) values (#{id},#{gestationAge},#{abortionHistoryType},#{abortionDate},#{abortionCause},#{abortionType},#{viralInfectionHistoryType},#{viralInfectionTypeId},#{viralInfectionOtherDesc},#{viralInfectionDate},#{genitalInfectionHistoryType},#{genitalInfectionTypeId},#{genitalInfectionOtherDesc},#{genitalInfectionDate},#{radiationType},#{radiationDate},#{drugAppType},#{drugAppName},#{drugAppUseDate},#{harmfulSubstanceType},#{harmfulSubstanceName},#{harmfulSubstanceDate},#{badLifeHistoryType},#{badLifeTypeId},#{medicalHistoryType},#{medicalTypeId},#{medicalOtherTypeDesc},#{bnormalPregnancyHistoryType},#{bnormalPregnancyTypeId},#{bnormalPregnancyOtherDesc},#{babyPatientId})
</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 >= 0">
abortion_history_type = #{abortionHistoryType,jdbcType=INTEGER},
</if>
<if test="abortionDate != null">
abortion_date = #{abortionDate,jdbcType=TIMESTAMP},
</if>
<if test="abortionCause != null and abortionCause != ''">
abortion_cause = #{abortionCause,jdbcType=VARCHAR},
</if>
<if test="abortionType != null and abortionType >= 0">
abortion_type = #{abortionType,jdbcType=INTEGER},
</if>
<if test="viralInfectionHistoryType != null and viralInfectionHistoryType >= 0">
viral_infection_history_type = #{viralInfectionHistoryType,jdbcType=INTEGER},
</if>
<if test="viralInfectionTypeId != null and viralInfectionTypeId != ''">
viral_infection_type_id = #{viralInfectionTypeId,jdbcType=VARCHAR},
</if>
<if test="viralInfectionOtherDesc != null and viralInfectionOtherDesc != ''">
viral_infection_other_desc = #{viralInfectionOtherDesc,jdbcType=VARCHAR},
</if>
<if test="viralInfectionDate != null and viralInfectionDate >= 0">
viral_infection_date = #{viralInfectionDate,jdbcType=INTEGER},
</if>
<if test="genitalInfectionHistoryType != null and genitalInfectionHistoryType >= 0">
genital_infection_history_type = #{genitalInfectionHistoryType,jdbcType=INTEGER},
</if>
<if test="genitalInfectionTypeId != null and genitalInfectionTypeId != ''">
genital_infection_type_id = #{genitalInfectionTypeId,jdbcType=VARCHAR},
</if>
<if test="genitalInfectionOtherDesc != null and genitalInfectionOtherDesc != ''">
genital_infection_other_desc = #{genitalInfectionOtherDesc,jdbcType=VARCHAR},
</if>
<if test="genitalInfectionDate != null and genitalInfectionDate >= 0">
genital_infection_date = #{genitalInfectionDate,jdbcType=INTEGER},
</if>
<if test="radiationType != null and radiationType >= 0">
radiation_type = #{radiationType,jdbcType=INTEGER},
</if>
<if test="radiationDate != null">
radiation_date = #{radiationDate,jdbcType=TIMESTAMP},
</if>
<if test="drugAppType != null and drugAppType >= 0">
drug_app_type = #{drugAppType,jdbcType=INTEGER},
</if>
<if test="drugAppName != null and drugAppName != ''">
drug_app_name = #{drugAppName,jdbcType=VARCHAR},
</if>
<if test="drugAppUseDate != null">
drug_app_use_date = #{drugAppUseDate,jdbcType=TIMESTAMP},
</if>
<if test="harmfulSubstanceType != null and harmfulSubstanceType >= 0">
harmful_substance_type = #{harmfulSubstanceType,jdbcType=INTEGER},
</if>
<if test="harmfulSubstanceName != null and harmfulSubstanceName != ''">
harmful_substance_name = #{harmfulSubstanceName,jdbcType=VARCHAR},
</if>
<if test="harmfulSubstanceDate != null">
harmful_substance_date = #{harmfulSubstanceDate,jdbcType=TIMESTAMP},
</if>
<if test="badLifeHistoryType != null and badLifeHistoryType >= 0">
bad_life_history_type = #{badLifeHistoryType,jdbcType=INTEGER},
</if>
<if test="badLifeTypeId != null and badLifeTypeId != ''">
bad_life_type_id = #{badLifeTypeId,jdbcType=VARCHAR},
</if>
<if test="medicalHistoryType != null and medicalHistoryType >= 0">
medical_history_type = #{medicalHistoryType,jdbcType=INTEGER},
</if>
<if test="medicalTypeId != null and medicalTypeId >= 0">
medical_type_id = #{medicalTypeId,jdbcType=INTEGER},
</if>
<if test="medicalOtherTypeDesc != null and medicalOtherTypeDesc != ''">
medical_other_type_desc = #{medicalOtherTypeDesc,jdbcType=VARCHAR},
</if>
<if test="bnormalPregnancyHistoryType != null and bnormalPregnancyHistoryType >= 0">
bnormal_pregnancy_history_type = #{bnormalPregnancyHistoryType,jdbcType=INTEGER},
</if>
<if test="bnormalPregnancyTypeId != null and bnormalPregnancyTypeId != ''">
bnormal_pregnancy_type_id = #{bnormalPregnancyTypeId,jdbcType=VARCHAR},
</if>
<if test="bnormalPregnancyOtherDesc != null and bnormalPregnancyOtherDesc != ''">
bnormal_pregnancy_other_desc = #{bnormalPregnancyOtherDesc,jdbcType=VARCHAR},
</if>
<if test="babyPatientId != null and babyPatientId != ''">
baby_patient_id = #{babyPatientId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<delete id="deleteBabyPatientExtendEarMother" parameterType="java.lang.String">
delete from baby_patient_extend_ear_mother where id = #{id,jdbcType=VARCHAR}
</delete>
<select id="getBabyPatientExtendEarMother" resultMap="BabyPatientExtendEarMotherResultMap" parameterType="java.lang.String">
select id,gestation_age,abortion_history_type,abortion_date,abortion_cause,abortion_type,viral_infection_history_type,viral_infection_type_id,viral_infection_other_desc,viral_infection_date,genital_infection_history_type,genital_infection_type_id,genital_infection_other_desc,genital_infection_date,radiation_type,radiation_date,drug_app_type,drug_app_name,drug_app_use_date,harmful_substance_type,harmful_substance_name,harmful_substance_date,bad_life_history_type,bad_life_type_id,medical_history_type,medical_type_id,medical_other_type_desc,bnormal_pregnancy_history_type,bnormal_pregnancy_type_id,bnormal_pregnancy_other_desc,baby_patient_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 >= 0">
and abortion_history_type = #{abortionHistoryType,jdbcType=INTEGER}
</if>
<if test="abortionDate != null">
and abortion_date = #{abortionDate,jdbcType=TIMESTAMP}
</if>
<if test="abortionCause != null and abortionCause != ''">
and abortion_cause = #{abortionCause,jdbcType=VARCHAR}
</if>
<if test="abortionType != null and abortionType >= 0">
and abortion_type = #{abortionType,jdbcType=INTEGER}
</if>
<if test="viralInfectionHistoryType != null and viralInfectionHistoryType >= 0">
and viral_infection_history_type = #{viralInfectionHistoryType,jdbcType=INTEGER}
</if>
<if test="viralInfectionTypeId != null and viralInfectionTypeId != ''">
and viral_infection_type_id = #{viralInfectionTypeId,jdbcType=VARCHAR}
</if>
<if test="viralInfectionOtherDesc != null and viralInfectionOtherDesc != ''">
and viral_infection_other_desc = #{viralInfectionOtherDesc,jdbcType=VARCHAR}
</if>
<if test="viralInfectionDate != null and viralInfectionDate >= 0">
and viral_infection_date = #{viralInfectionDate,jdbcType=INTEGER}
</if>
<if test="genitalInfectionHistoryType != null and genitalInfectionHistoryType >= 0">
and genital_infection_history_type = #{genitalInfectionHistoryType,jdbcType=INTEGER}
</if>
<if test="genitalInfectionTypeId != null and genitalInfectionTypeId != ''">
and genital_infection_type_id = #{genitalInfectionTypeId,jdbcType=VARCHAR}
</if>
<if test="genitalInfectionOtherDesc != null and genitalInfectionOtherDesc != ''">
and genital_infection_other_desc = #{genitalInfectionOtherDesc,jdbcType=VARCHAR}
</if>
<if test="genitalInfectionDate != null and genitalInfectionDate >= 0">
and genital_infection_date = #{genitalInfectionDate,jdbcType=INTEGER}
</if>
<if test="radiationType != null and radiationType >= 0">
and radiation_type = #{radiationType,jdbcType=INTEGER}
</if>
<if test="radiationDate != null" >
and radiation_date = #{radiationDate,jdbcType=TIMESTAMP}
</if>
<if test="drugAppType != null and drugAppType >= 0">
and drug_app_type = #{drugAppType,jdbcType=INTEGER}
</if>
<if test="drugAppName != null and drugAppName != ''">
and drug_app_name = #{drugAppName,jdbcType=VARCHAR}
</if>
<if test="drugAppUseDate != null">
and drug_app_use_date = #{drugAppUseDate,jdbcType=TIMESTAMP}
</if>
<if test="harmfulSubstanceType != null and harmfulSubstanceType >= 0">
and harmful_substance_type = #{harmfulSubstanceType,jdbcType=INTEGER}
</if>
<if test="harmfulSubstanceName != null and harmfulSubstanceName != ''">
and harmful_substance_name = #{harmfulSubstanceName,jdbcType=VARCHAR}
</if>
<if test="harmfulSubstanceDate != null">
and harmful_substance_date = #{harmfulSubstanceDate,jdbcType=TIMESTAMP}
</if>
<if test="badLifeHistoryType != null and badLifeHistoryType >= 0">
and bad_life_history_type = #{badLifeHistoryType,jdbcType=INTEGER}
</if>
<if test="badLifeTypeId != null and badLifeTypeId != ''">
and bad_life_type_id = #{badLifeTypeId,jdbcType=VARCHAR}
</if>
<if test="medicalHistoryType != null and medicalHistoryType >= 0">
and medical_history_type = #{medicalHistoryType,jdbcType=INTEGER}
</if>
<if test="medicalTypeId != null and medicalTypeId >= 0">
and medical_type_id = #{medicalTypeId,jdbcType=INTEGER}
</if>
<if test="medicalOtherTypeDesc != null and medicalOtherTypeDesc != ''">
and medical_other_type_desc = #{medicalOtherTypeDesc,jdbcType=VARCHAR}
</if>
<if test="bnormalPregnancyHistoryType != null and bnormalPregnancyHistoryType >= 0">
and bnormal_pregnancy_history_type = #{bnormalPregnancyHistoryType,jdbcType=INTEGER}
</if>
<if test="bnormalPregnancyTypeId != null and bnormalPregnancyTypeId != ''">
and bnormal_pregnancy_type_id = #{bnormalPregnancyTypeId,jdbcType=VARCHAR}
</if>
<if test="bnormalPregnancyOtherDesc != null and bnormalPregnancyOtherDesc != ''">
and bnormal_pregnancy_other_desc = #{bnormalPregnancyOtherDesc,jdbcType=VARCHAR}
</if>
<if test="babyPatientId != null and babyPatientId != ''">
and baby_patient_id = #{babyPatientId,jdbcType=VARCHAR}
</if>
</where>
</sql>
<select id="queryBabyPatientExtendEarMother" resultMap="BabyPatientExtendEarMotherResultMap" parameterType="com.lyms.platform.permission.model.BabyPatientExtendEarMotherQuery">
select id,gestation_age,abortion_history_type,abortion_date,abortion_cause,abortion_type,viral_infection_history_type,viral_infection_type_id,viral_infection_other_desc,viral_infection_date,genital_infection_history_type,genital_infection_type_id,genital_infection_other_desc,genital_infection_date,radiation_type,radiation_date,drug_app_type,drug_app_name,drug_app_use_date,harmful_substance_type,harmful_substance_name,harmful_substance_date,bad_life_history_type,bad_life_type_id,medical_history_type,medical_type_id,medical_other_type_desc,bnormal_pregnancy_history_type,bnormal_pregnancy_type_id,bnormal_pregnancy_other_desc,baby_patient_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>