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
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})
update mch_followup_plan
orgid = #{orgid},
campusid = #{campusid},
archive_type = #{archiveType},
archive_id = #{archiveId},
archive_detail_id = #{archiveDetailId},
source_type = #{sourceType},
source_biz_no = #{sourceBizNo},
patid = #{patid},
patname = #{patname},
phone = #{phone},
idcardno = #{idcardno},
planned_follow_time = #{plannedFollowTime},
followup_period = #{followupPeriod},
plan_status = #{planStatus},
remark = #{remark},
update_time = #{updateTime},
where id = #{id}
update mch_followup_plan
set plan_status = '1',
update_time = #{updateTime}
where id = #{id}
and plan_status in ('0', '3')
update mch_followup_plan
set plan_status = '2',
update_time = #{updateTime}
where id = #{id}
and plan_status = '0'