<?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.smartor.mapper.MchFollowupPlanMapper">
|
|
<resultMap id="MchFollowupPlanResult" type="com.smartor.domain.MchFollowupPlan">
|
<id property="id" column="id"/>
|
<result property="orgid" column="orgid"/>
|
<result property="campusid" column="campusid"/>
|
<result property="archiveType" column="archive_type"/>
|
<result property="archiveId" column="archive_id"/>
|
<result property="archiveDetailId" column="archive_detail_id"/>
|
<result property="sourceType" column="source_type"/>
|
<result property="sourceBizNo" column="source_biz_no"/>
|
<result property="patid" column="patid"/>
|
<result property="patname" column="patname"/>
|
<result property="phone" column="phone"/>
|
<result property="idcardno" column="idcardno"/>
|
<result property="plannedFollowTime" column="planned_follow_time"/>
|
<result property="followupPeriod" column="followup_period"/>
|
<result property="planStatus" column="plan_status"/>
|
<result property="remark" column="remark"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateTime" column="update_time"/>
|
</resultMap>
|
|
<sql id="selectPlanVo">
|
select id, orgid, campusid, archive_type, archive_id, archive_detail_id,
|
source_type, source_biz_no, patid, patname, phone, idcardno,
|
planned_follow_time, followup_period, plan_status, remark,
|
create_time, update_time
|
from mch_followup_plan
|
</sql>
|
|
<insert id="insertMchFollowupPlan" parameterType="com.smartor.domain.MchFollowupPlan"
|
useGeneratedKeys="true" keyProperty="id">
|
insert into mch_followup_plan
|
(orgid, campusid, archive_type, archive_id, archive_detail_id,
|
source_type, source_biz_no, patid, patname, phone, idcardno,
|
planned_follow_time, followup_period, plan_status, remark,
|
create_time, update_time)
|
values
|
(#{orgid}, #{campusid}, #{archiveType}, #{archiveId}, #{archiveDetailId},
|
#{sourceType}, #{sourceBizNo}, #{patid}, #{patname}, #{phone}, #{idcardno},
|
#{plannedFollowTime}, #{followupPeriod}, #{planStatus}, #{remark},
|
#{createTime}, #{updateTime})
|
</insert>
|
|
<update id="updateMchFollowupPlan" parameterType="com.smartor.domain.MchFollowupPlan">
|
update mch_followup_plan
|
<set>
|
<if test="orgid != null">orgid = #{orgid},</if>
|
<if test="campusid != null">campusid = #{campusid},</if>
|
<if test="archiveType != null">archive_type = #{archiveType},</if>
|
<if test="archiveId != null">archive_id = #{archiveId},</if>
|
<if test="archiveDetailId != null">archive_detail_id = #{archiveDetailId},</if>
|
<if test="sourceType != null">source_type = #{sourceType},</if>
|
<if test="sourceBizNo != null">source_biz_no = #{sourceBizNo},</if>
|
<if test="patid != null">patid = #{patid},</if>
|
<if test="patname != null">patname = #{patname},</if>
|
<if test="phone != null">phone = #{phone},</if>
|
<if test="idcardno != null">idcardno = #{idcardno},</if>
|
<if test="plannedFollowTime != null">planned_follow_time = #{plannedFollowTime},</if>
|
<if test="followupPeriod != null">followup_period = #{followupPeriod},</if>
|
<if test="planStatus != null">plan_status = #{planStatus},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
</set>
|
where id = #{id}
|
</update>
|
|
<select id="selectMchFollowupPlanById" resultMap="MchFollowupPlanResult">
|
<include refid="selectPlanVo"/>
|
where id = #{id}
|
</select>
|
|
<select id="selectActiveByArchive" resultMap="MchFollowupPlanResult">
|
<include refid="selectPlanVo"/>
|
where archive_type = #{archiveType}
|
and archive_id = #{archiveId}
|
<if test="archiveDetailId != null">
|
and archive_detail_id = #{archiveDetailId}
|
</if>
|
and plan_status in ('0', '3')
|
order by id desc
|
</select>
|
|
<update id="cancelById">
|
update mch_followup_plan
|
set plan_status = '1',
|
update_time = #{updateTime}
|
where id = #{id}
|
and plan_status in ('0', '3')
|
</update>
|
|
<update id="completeById">
|
update mch_followup_plan
|
set plan_status = '2',
|
update_time = #{updateTime}
|
where id = #{id}
|
and plan_status = '0'
|
</update>
|
|
<select id="selectCandidates" resultType="com.smartor.domain.MchFollowupArchiveCandidate">
|
select '1' as archiveType, d.archiveid as archiveId, d.id as archiveDetailId
|
from pat_maternity_archive_detail d
|
where d.orgid = #{orgid}
|
and (d.del_flag is null or d.del_flag = '0')
|
and d.planned_follow_time is not null
|
and d.followup_period is not null
|
and d.followup_period <> ''
|
and d.archiveid is not null
|
union all
|
select '2' as archiveType, d.archiveid as archiveId, d.id as archiveDetailId
|
from pat_child_archive_detail d
|
where d.orgid = #{orgid}
|
and (d.del_flag is null or d.del_flag = '0')
|
and d.planned_follow_time is not null
|
and d.followup_period is not null
|
and d.followup_period <> ''
|
and d.archiveid is not null
|
limit #{limit}
|
</select>
|
|
</mapper>
|