<?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.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"/>
</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) values (#{id},#{personId},#{createDate},#{createUserId},#{createHospitalId},#{lastUpdateDate},#{lastUpdateUserId},#{lastUpdateHospitalId},#{highRiskCause},#{status},#{babyPatientId})
</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="babyPatientId != null and babyPatientId != ''">
baby_patient_id = #{babyPatientId,jdbcType=VARCHAR},
</if>
<if test="status != null and status >= 0">
status = #{status,jdbcType=INTEGER},
</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 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="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="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 != ''">
baby_patient_id = #{babyPatientId,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 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>