<?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.BabyPatientExtendEarFollowUpMapper">
<resultMap id="BabyPatientExtendEarFollowUpResultMap"
type="com.lyms.platform.permission.model.BabyPatientExtendEarFollowUp">
<id column="id" property="id" jdbcType="VARCHAR"/>
<result column="baby_id" property="babyId" jdbcType="VARCHAR"/>
<result column="follow_time" property="followTime" jdbcType="TIMESTAMP"/>
<result column="follow_addr" property="followAddr" jdbcType="VARCHAR"/>
<result column="mark_time" property="markTime" jdbcType="TIMESTAMP"/>
<result column="mark_result" property="markResult" jdbcType="VARCHAR"/>
<result column="mark_detail" property="markDetail" jdbcType="VARCHAR"/>
<result column="follow_info" property="followInfo" jdbcType="VARCHAR"/>
<result column="audiphone" property="audiphone" jdbcType="INTEGER"/>
<result column="operation" property="operation" jdbcType="INTEGER"/>
<result column="artifi_cochlea" property="artifiCochlea" jdbcType="INTEGER"/>
<result column="is_audiphone" property="isAudiphone" jdbcType="INTEGER"/>
<result column="is_operation" property="isOperation" jdbcType="INTEGER"/>
<result column="is_artifi_cochlea" property="isArtifiCochlea" jdbcType="INTEGER"/>
<result column="guide_opinion" property="guideOpinion" jdbcType="VARCHAR"/>
<result column="follow_doctor_name" property="followDoctorName" jdbcType="VARCHAR"/>
<result column="follow_doctor_id" property="followDoctorId" jdbcType="VARCHAR"/>
<result column="next_time" property="nextTime" jdbcType="TIMESTAMP"/>
<result column="month_age" property="monthAge" jdbcType="INTEGER"/>
<result column="ifdel" property="ifdel" jdbcType="INTEGER"/>
<result column="ifclose" property="ifclose" jdbcType="INTEGER"/>
<result column="verdict" property="verdict" jdbcType="VARCHAR"/>
<result column="hospital_id" property="hospitalId" jdbcType="VARCHAR"/>
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP"/>
<result column="modify_id" property="modifyId" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="create_id" property="createId" jdbcType="VARCHAR"/>
<result column="enalble" property="enalble" jdbcType="INTEGER"/>
<result column="pid" property="pid" jdbcType="VARCHAR"/>
</resultMap>
<insert id="addBabyPatientExtendEarFollowUp"
parameterType="com.lyms.platform.permission.model.BabyPatientExtendEarFollowUp">
insert into baby_patient_extend_ear_follow_up (id,baby_id,follow_time,follow_addr,mark_time,mark_result,mark_detail,follow_info,audiphone,operation,artifi_cochlea,is_audiphone,is_operation,is_artifi_cochlea,guide_opinion,follow_doctor_name,follow_doctor_id,next_time,month_age,ifdel,ifclose,verdict,hospital_id,modify_time,modify_id,create_time,create_id,enalble,pid) values (#{id},#{babyId},#{followTime},#{followAddr},#{markTime},#{markResult},#{markDetail},#{followInfo},#{audiphone},#{operation},#{artifiCochlea},#{isAudiphone},#{isOperation},#{isArtifiCochlea},#{guideOpinion},#{followDoctorName},#{followDoctorId},#{nextTime},#{monthAge},#{ifdel},#{ifclose},#{verdict},#{hospitalId},#{modifyTime},#{modifyId},#{createTime},#{createId},#{enalble},#{pid})
</insert>
<update id="updateBabyPatientExtendEarFollowUp"
parameterType="com.lyms.platform.permission.model.BabyPatientExtendEarFollowUp">
update baby_patient_extend_ear_follow_up
<set>
<if test="babyId != null and babyId != ''">
baby_id = #{babyId,jdbcType=VARCHAR},
</if>
<if test="followTime != null">
follow_time = #{followTime,jdbcType=TIMESTAMP},
</if>
<if test="followAddr != null and followAddr != ''">
follow_addr = #{followAddr,jdbcType=VARCHAR},
</if>
<if test="markTime != null">
mark_time = #{markTime,jdbcType=TIMESTAMP},
</if>
<if test="markResult != null and markResult != ''">
mark_result = #{markResult,jdbcType=VARCHAR},
</if>
<if test="markDetail != null and markDetail != ''">
mark_detail = #{markDetail,jdbcType=VARCHAR},
</if>
<if test="followInfo != null and followInfo != ''">
follow_info = #{followInfo,jdbcType=VARCHAR},
</if>
<if test="audiphone != null and audiphone >= 0">
audiphone = #{audiphone,jdbcType=INTEGER},
</if>
<if test="operation != null and operation >= 0">
operation = #{operation,jdbcType=INTEGER},
</if>
<if test="artifiCochlea != null and artifiCochlea >= 0">
artifi_cochlea = #{artifiCochlea,jdbcType=INTEGER},
</if>
<if test="isAudiphone != null and isAudiphone >= 0">
is_audiphone = #{isAudiphone,jdbcType=INTEGER},
</if>
<if test="isOperation != null and isOperation >= 0">
is_operation = #{isOperation,jdbcType=INTEGER},
</if>
<if test="isArtifiCochlea != null and isArtifiCochlea >= 0">
is_artifi_cochlea = #{isArtifiCochlea,jdbcType=INTEGER},
</if>
<if test="guideOpinion != null and guideOpinion != ''">
guide_opinion = #{guideOpinion,jdbcType=VARCHAR},
</if>
<if test="followDoctorName != null and followDoctorName != ''">
follow_doctor_name = #{followDoctorName,jdbcType=VARCHAR},
</if>
<if test="followDoctorId != null and followDoctorId != ''">
follow_doctor_id = #{followDoctorId,jdbcType=VARCHAR},
</if>
<if test="nextTime != null">
next_time = #{nextTime,jdbcType=TIMESTAMP},
</if>
<if test="monthAge != null and monthAge>=0">
month_age = #{monthAge,jdbcType=INTEGER},
</if>
<if test="ifdel != null and ifdel >= 0">
ifdel = #{ifdel,jdbcType=INTEGER},
</if>
<if test="ifclose != null and ifclose >= 0">
ifclose = #{ifclose,jdbcType=INTEGER},
</if>
<if test="verdict != null and verdict != ''">
verdict = #{verdict,jdbcType=VARCHAR},
</if>
<if test="hospitalId != null and hospitalId != ''">
hospital_id = #{hospitalId,jdbcType=VARCHAR},
</if>
<if test="modifyTime != null">
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyId != null and modifyId != ''">
modify_id = #{modifyId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createId != null and createId != ''">
create_id = #{createId,jdbcType=VARCHAR},
</if>
<if test="pid != null and pid != ''">
pid = #{pid,jdbcType=VARCHAR},
</if>
<if test="enalble != null and enalble >= 0">
enalble = #{enalble,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<delete id="deleteBabyPatientExtendEarFollowUp" parameterType="java.lang.String">
delete from baby_patient_extend_ear_follow_up where id = #{id,jdbcType=VARCHAR}
</delete>
<select id="getBabyPatientExtendEarFollowUp" resultMap="BabyPatientExtendEarFollowUpResultMap"
parameterType="java.lang.String">
select id,baby_id,follow_time,follow_addr,mark_time,mark_result,mark_detail,follow_info,audiphone,operation,artifi_cochlea,is_audiphone,is_operation,is_artifi_cochlea,guide_opinion,follow_doctor_name,follow_doctor_id,next_time,month_age,ifdel,ifclose,verdict,hospital_id,modify_time,modify_id,create_time,create_id,enalble,pid
from baby_patient_extend_ear_follow_up 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="BabyPatientExtendEarFollowUpCondition">
<where>
1 = 1
<if test="id != null and id != ''">
and id = #{id,jdbcType=VARCHAR}
</if>
<if test="babyId != null and babyId != ''">
and baby_id = #{babyId,jdbcType=VARCHAR}
</if>
<if test="babyIds!=null">
and baby_id in (
<foreach item="babyId" collection="babyIds" separator=",">
#{babyId}
</foreach>
)
</if>
<if test="followTime != null">
and follow_time = #{followTime,jdbcType=TIMESTAMP}
</if>
<if test="followUpStartTime != null">
AND
<![CDATA[
DATEDIFF(#{followUpStartTime},follow_time)<=0
]]>
</if>
<if test="followUpEndTime != null and followUpEndTime != ''">
AND
<![CDATA[
DATEDIFF(#{followUpEndTime},follow_time)>=0
]]>
</if>
<if test="markTime != null">
and mark_time = #{markTime,jdbcType=TIMESTAMP}
</if>
<if test="markResult != null and markResult != ''">
and mark_result like concat("%",#{markResult},"%")
</if>
<if test="markDetail != null and markDetail != ''">
and mark_detail = #{markDetail,jdbcType=VARCHAR}
</if>
<if test="followInfo != null and followInfo != ''">
and follow_info = #{followInfo,jdbcType=VARCHAR}
</if>
<if test="pid != null and pid != ''">
and pid = #{pid,jdbcType=VARCHAR}
</if>
<if test="pids != null">
and pid in
<foreach item="item" index="index" collection="pids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="sqlStr!=null and sqlStr!=''">
AND (
${sqlStr}
)
</if>
<if test="guideOpinion != null and guideOpinion != ''">
and guide_opinion = #{guideOpinion,jdbcType=VARCHAR}
</if>
<if test="followDoctorName != null and followDoctorName != ''">
and follow_doctor_name = #{followDoctorName,jdbcType=VARCHAR}
</if>
<if test="followDoctorId != null and followDoctorId != ''">
and follow_doctor_id = #{followDoctorId,jdbcType=VARCHAR}
</if>
<if test="nextStartTime != null">
AND
<![CDATA[
DATEDIFF(#{nextStartTime},next_time)<=0
]]>
</if>
<if test="nextEndTime != null">
AND
<![CDATA[
DATEDIFF(#{nextEndTime},next_time)>=0
]]>
</if>
<if test="nextTime != null">
and next_time = #{nextTime,jdbcType=TIMESTAMP}
</if>
and ifdel =0
<if test="ifclose != null and ifclose >= 0">
and ifclose = #{ifclose,jdbcType=INTEGER}
</if>
<if test="verdict != null and verdict != ''">
and verdict = #{verdict,jdbcType=VARCHAR}
</if>
<if test="hospitalId != null and hospitalId != ''">
and hospital_id = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="checkHospitalIds != null">
and hospital_id in
<foreach item="item" index="index" collection="checkHospitalIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="modifyTime != null">
and modify_time = #{modifyTime,jdbcType=TIMESTAMP}
</if>
<if test="modifyId != null and modifyId != ''">
and modify_id = #{modifyId,jdbcType=VARCHAR}
</if>
<if test="createTime != null">
and create_time = #{createTime,jdbcType=TIMESTAMP}
</if>
<if test="createId != null and createId != ''">
and create_id = #{createId,jdbcType=VARCHAR}
</if>
<if test="enalble != null and enalble >= 0">
and enalble = #{enalble,jdbcType=INTEGER}
</if>
</where>
</sql>
<select id="queryBabyPatientExtendEarFollowUp" resultMap="BabyPatientExtendEarFollowUpResultMap"
parameterType="com.lyms.platform.permission.model.BabyPatientExtendEarFollowUpQuery">
select
id,baby_id,follow_time,follow_addr,mark_time,mark_result,mark_detail,follow_info,audiphone,operation,artifi_cochlea,guide_opinion,follow_doctor_name,follow_doctor_id,next_time,month_age,ifdel,ifclose,verdict,hospital_id,modify_time,modify_id,create_time,create_id,enalble
from baby_patient_extend_ear_follow_up
<include refid="BabyPatientExtendEarFollowUpCondition"/>
<include refid="orderAndLimit"/>
</select>
<select id="queryBabyPatientExtendEarFollowUpCount" resultType="int"
parameterType="com.lyms.platform.permission.model.BabyPatientExtendEarFollowUpQuery">
select count(1) from baby_patient_extend_ear_follow_up
<include refid="BabyPatientExtendEarFollowUpCondition"/>
</select>
<select id="queryBabyPatientExtendEarFollowUpByBaby" resultMap="BabyPatientExtendEarFollowUpResultMap"
parameterType="com.lyms.platform.permission.model.BabyPatientExtendEarFollowUpQuery">
select
id,baby_id,follow_time,follow_addr,mark_time,mark_result,mark_detail,follow_info,audiphone,operation,artifi_cochlea,is_audiphone,is_operation,is_artifi_cochlea,guide_opinion,follow_doctor_name,follow_doctor_id,next_time,ifdel,ifclose,verdict,hospital_id,modify_time,modify_id,create_time,create_id,enalble
from baby_patient_extend_ear_follow_up
<where>
1 = 1
<if test="babyId != null and babyId != ''">
and baby_id = #{babyId,jdbcType=VARCHAR}
</if>
<if test="babyIds != null ">
and baby_id in
<foreach item="item" index="index" collection="babyIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
and ifdel = 0
order by follow_time
</where>
</select>
</mapper>