package com.smartor.service; import com.smartor.domain.ServiceTaskSchedule; import com.smartor.domain.ServiceTaskScheduleDetail; import com.smartor.domain.ServiceTaskScheduleVO; import java.util.List; /** * 随访任务计划 Service 接口 * * @author smartor * @date 2026-06-30 */ public interface IServiceTaskScheduleService { /** * 保存计划(含明细)。 * 若 taskid 已有计划:先软删旧的,再新建。 * * @param vo 主计划 + 明细 * @return 保存后的主计划(含主键) */ ServiceTaskSchedule saveScheduleWithDetail(ServiceTaskScheduleVO vo); /** * 按 taskid 查询计划详情(含明细) */ ServiceTaskScheduleVO getScheduleByTaskid(Long taskid); /** * 通过 taskid 查询主计划 */ ServiceTaskSchedule selectByTaskid(Long taskid); /** * 通过 scheduleid 查询明细 */ List selectDetailByScheduleid(Long scheduleid); /** * 按 taskid 软删主计划 + 明细 */ int removeByTaskid(Long taskid); /** * 循环任务滚动调度: *

* 扫描所有 schedule_style=1 的有效计划,若 current_loop_count 已达上限则跳过; * 否则判定本轮(current_loop_count)是否已全部 finalize(sendstate ∉ 1/2/3)。 * 是 -> 生成下一轮 subtask(克隆本轮的患者,visit_time = 本轮 visit_time + N天/周/月/年), * current_loop_count + 1,next_execute_time 推进。 * 否 -> 跳过等待下次扫描。 *

* 由 RyTask 定时调用,单次扫描限制 200 条避免长事务。 * * @return 实际推进了多少个计划 */ int rollCycleTasks(); }