package com.smartor.mapper;
|
|
import com.smartor.domain.MchFollowupArchiveCandidate;
|
import com.smartor.domain.MchFollowupArchiveCursor;
|
import com.ruoyi.task.domain.ServiceSubtask;
|
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Param;
|
|
import java.util.Date;
|
import java.util.List;
|
|
/**
|
* 妇幼随访任务(service_subtask)专用 Mapper。
|
*
|
* <p>妇幼节点不再使用独立计划表,节点快照落在 service_subtask 的
|
* mch_archive_detail_id / mch_node_seq / mch_plan_hash / mch_node_json 上。</p>
|
*/
|
@Mapper
|
public interface MchFollowupSubtaskMapper {
|
|
/**
|
* 扫描已确认、且拟随访日期和随访周期都有值的妇幼档案。
|
*/
|
List<MchFollowupArchiveCandidate> selectCandidates(@Param("orgid") String orgid,
|
@Param("dueBefore") Date dueBefore,
|
@Param("limit") int limit);
|
|
/**
|
* 查询某档案详情下已生成的妇幼 subtask。
|
*/
|
List<ServiceSubtask> selectByArchiveDetailId(@Param("detailId") Long detailId);
|
|
/**
|
* 插入一条妇幼随访 subtask。
|
*/
|
int insertMchSubtask(ServiceSubtask subtask);
|
|
/**
|
* 计划变更时取消旧计划版本下未发送的妇幼 subtask。
|
*/
|
int cancelPendingByArchiveDetailId(@Param("detailId") Long detailId,
|
@Param("planHash") String planHash,
|
@Param("now") Date now);
|
|
/**
|
* 查询档案详情的懒生成游标。
|
*/
|
MchFollowupArchiveCursor selectMchCursor(@Param("archiveType") String archiveType,
|
@Param("detailId") Long detailId);
|
|
/**
|
* 更新档案详情的懒生成游标。
|
*/
|
int updateMchCursor(@Param("archiveType") String archiveType,
|
@Param("detailId") Long detailId,
|
@Param("planHash") String planHash,
|
@Param("nextDueTime") Date nextDueTime);
|
|
/**
|
* 读取节点 JSON,供发送时使用。
|
*/
|
String selectNodeJsonById(@Param("id") Long id);
|
|
/**
|
* 抢占待发送任务,避免并发重复发送。
|
*/
|
int claimMchSubtask(@Param("id") Long id, @Param("now") Date now);
|
|
/**
|
* 回写妇幼 subtask 发送结果。
|
*/
|
int updateMchSendResult(@Param("id") Long id,
|
@Param("sendstate") Long sendstate,
|
@Param("result") String result,
|
@Param("remark") String remark,
|
@Param("finishtime") Date finishtime,
|
@Param("now") Date now);
|
}
|