陈昶聿
3 天以前 3acf9415fce2dd21c0fd5d67805b72a8bde24a81
smartor/src/main/resources/mapper/smartor/MchFollowupPlanMapper.xml
@@ -107,19 +107,33 @@
        from pat_maternity_archive_detail d
        where d.orgid = #{orgid}
          and (d.del_flag is null or d.del_flag = '0')
          and d.followup_status = '1'
          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
          and not exists (
              select 1 from mch_followup_plan p
              where p.archive_type = '1'
                and p.archive_detail_id = d.id
                and p.plan_status in ('0', '3')
          )
        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.followup_status = '1'
          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
          and not exists (
              select 1 from mch_followup_plan p
              where p.archive_type = '2'
                and p.archive_detail_id = d.id
                and p.plan_status in ('0', '3')
          )
        limit #{limit}
    </select>