<?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.BabyPatientExtendEarMapper">
<resultMap id="BabyPatientExtendEarResultMap" type="com.lyms.platform.permission.model.BabyPatientExtendEar">
<id column="id" property="id" jdbcType="VARCHAR"/>
<result column="person_id" property="personId" jdbcType="VARCHAR"/>
<result column="create_date" property="createDate" jdbcType="TIMESTAMP"/>
<result column="create_user_id" property="createUserId" jdbcType="VARCHAR"/>
<result column="create_hospital_id" property="createHospitalId" jdbcType="VARCHAR"/>
<result column="last_update_date" property="lastUpdateDate" jdbcType="TIMESTAMP"/>
<result column="last_update_user_id" property="lastUpdateUserId" jdbcType="VARCHAR"/>
<result column="last_update_hospital_id" property="lastUpdateHospitalId" jdbcType="VARCHAR"/>
<result column="high_risk_cause" property="highRiskCause" jdbcType="VARCHAR"/>
<result column="status" property="status" jdbcType="INTEGER"/>
<result column="baby_patient_id" property="babyPatientId" jdbcType="VARCHAR"/>
<result column="admiss_no" property="admissNo" jdbcType="VARCHAR"/>
<result column="discharge_diagnosis" property="dischargeDiagnosis" jdbcType="VARCHAR"/>
<result column="bar_code" property="barCode" jdbcType="VARCHAR"/>
<result column="nation" property="nation" jdbcType="VARCHAR"/>
<result column="mhigh_risk_factor_id" property="mHighRiskFactorId" jdbcType="VARCHAR"/>
</resultMap>
<insert id="addBabyPatientExtendEar" parameterType="com.lyms.platform.permission.model.BabyPatientExtendEar">
insert into baby_patient_extend_ear (id,person_id,create_date,create_user_id,create_hospital_id,last_update_date,last_update_user_id,last_update_hospital_id,high_risk_cause,status,baby_patient_id,admiss_no,discharge_diagnosis,bar_code,nation,mhigh_risk_factor_id) values (#{id},#{personId},#{createDate},#{createUserId},#{createHospitalId},#{lastUpdateDate},#{lastUpdateUserId},#{lastUpdateHospitalId},#{highRiskCause},#{status},#{babyPatientId},#{admissNo},#{dischargeDiagnosis},#{barCode},#{nation},#{mHighRiskFactorId})
</insert>
<update id="updateBabyPatientExtendEar" parameterType="com.lyms.platform.permission.model.BabyPatientExtendEar">
update baby_patient_extend_ear
<set>
<if test="personId != null and personId != ''">
person_id = #{personId,jdbcType=VARCHAR},
</if>
<if test="createDate != null">
create_date = #{createDate,jdbcType=TIMESTAMP},
</if>
<if test="createUserId != null and createUserId != ''">
create_user_id = #{createUserId,jdbcType=VARCHAR},
</if>
<if test="createHospitalId != null and createHospitalId != ''">
create_hospital_id = #{createHospitalId,jdbcType=VARCHAR},
</if>
<if test="lastUpdateDate != null">
last_update_date = #{lastUpdateDate,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdateUserId != null and lastUpdateUserId != ''">
last_update_user_id = #{lastUpdateUserId,jdbcType=VARCHAR},
</if>
<if test="lastUpdateHospitalId != null and lastUpdateHospitalId != ''">
last_update_hospital_id = #{lastUpdateHospitalId,jdbcType=VARCHAR},
</if>
<if test="highRiskCause != null and highRiskCause != ''">
high_risk_cause = #{highRiskCause,jdbcType=VARCHAR},
</if>
<if test="status != null and status >= 0">
status = #{status,jdbcType=INTEGER},
</if>
<if test="babyPatientId != null and babyPatientId != ''">
baby_patient_id = #{babyPatientId,jdbcType=VARCHAR},
</if>
<if test="admissNo != null and admissNo != ''">
admiss_no = #{admissNo,jdbcType=VARCHAR},
</if>
<if test="dischargeDiagnosis != null and dischargeDiagnosis != ''">
discharge_diagnosis = #{dischargeDiagnosis,jdbcType=VARCHAR},
</if>
<if test="barCode != null and barCode != ''">
bar_code = #{barCode,jdbcType=VARCHAR},
</if>
<if test="nation != null and nation != ''">
nation = #{nation,jdbcType=VARCHAR},
</if>
<if test="mHighRiskFactorId != null and mHighRiskFactorId != ''">
mhigh_risk_factor_id = #{mHighRiskFactorId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<delete id="deleteBabyPatientExtendEar" parameterType="java.lang.String">
delete from baby_patient_extend_ear where id = #{id,jdbcType=VARCHAR}
</delete>
<select id="getBabyPatientExtendEar" resultMap="BabyPatientExtendEarResultMap" parameterType="java.lang.String">
select id,person_id,create_date,create_user_id,create_hospital_id,last_update_date,last_update_user_id,last_update_hospital_id,high_risk_cause,status,baby_patient_id,admiss_no,discharge_diagnosis,bar_code,nation,mhigh_risk_factor_id
from baby_patient_extend_ear 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="BabyPatientExtendEarCondition">
<where>
1 = 1
<if test="id != null and id != ''">
and id = #{id,jdbcType=VARCHAR}
</if>
<if test="babyPatientIds!=null">
and baby_patient_id in (
<foreach item="babyPatientId" collection="babyPatientIds" separator="," >
#{babyPatientId}
</foreach>
)
</if>
<if test="personId != null and personId != ''">
and person_id = #{personId,jdbcType=VARCHAR}
</if>
<if test="createDate != null">
and create_date = #{createDate,jdbcType=TIMESTAMP}
</if>
<if test="createUserId != null and createUserId != ''">
and create_user_id = #{createUserId,jdbcType=VARCHAR}
</if>
<if test="createHospitalId != null and createHospitalId != ''">
and create_hospital_id = #{createHospitalId,jdbcType=VARCHAR}
</if>
<if test="createHospitalIds != null">
and create_hospital_id in
<foreach item="item" index="index" collection="createHospitalIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="lastUpdateDate != null">
and last_update_date = #{lastUpdateDate,jdbcType=TIMESTAMP}
</if>
<if test="lastUpdateUserId != null and lastUpdateUserId != ''">
and last_update_user_id = #{lastUpdateUserId,jdbcType=VARCHAR}
</if>
<if test="lastUpdateHospitalId != null and lastUpdateHospitalId != ''">
and last_update_hospital_id = #{lastUpdateHospitalId,jdbcType=VARCHAR}
</if>
<if test="highRiskCause != null and highRiskCause != ''">
and high_risk_cause = #{highRiskCause,jdbcType=VARCHAR}
</if>
<if test="status != null and status >= 0">
and status = #{status,jdbcType=INTEGER}
</if>
<if test="babyPatientId != null and babyPatientId != ''">
and baby_patient_id = #{babyPatientId,jdbcType=VARCHAR}
</if>
<if test="admissNo != null and admissNo != ''">
and admiss_no = #{admissNo,jdbcType=VARCHAR}
</if>
<if test="dischargeDiagnosis != null and dischargeDiagnosis != ''">
and discharge_diagnosis = #{dischargeDiagnosis,jdbcType=VARCHAR}
</if>
<if test="barCode != null and barCode != ''">
and bar_code = #{barCode,jdbcType=VARCHAR}
</if>
<if test="nation != null and nation != ''">
and nation = #{nation,jdbcType=VARCHAR}
</if>
<if test="mHighRiskFactorId != null and mHighRiskFactorId != ''">
and mhigh_risk_factor_id = #{mHighRiskFactorId,jdbcType=VARCHAR}
</if>
</where>
</sql>
<select id="queryBabyPatientExtendEar" resultMap="BabyPatientExtendEarResultMap"
parameterType="com.lyms.platform.permission.model.BabyPatientExtendEarQuery">
select
id,person_id,create_date,create_user_id,create_hospital_id,last_update_date,last_update_user_id,last_update_hospital_id,high_risk_cause,status,baby_patient_id,admiss_no,discharge_diagnosis,bar_code,nation,mhigh_risk_factor_id
from baby_patient_extend_ear
<include refid="BabyPatientExtendEarCondition"/>
<include refid="orderAndLimit"/>
</select>
<select id="queryBabyPatientExtendEarCount" resultType="int"
parameterType="com.lyms.platform.permission.model.BabyPatientExtendEarQuery">
select count(1) from baby_patient_extend_ear
<include refid="BabyPatientExtendEarCondition"/>
</select>
</mapper>