package com.ruoyi.web.modules.diagnosis.task;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.ruoyi.web.modules.diagnosis.service.AiConsultDiseaseWarningService;

/**
 * AI 问诊疫病预警定时任务（Quartz 调用：aiConsultDiseaseWarningTask.scanAndWarn）。
 * <p>
 * 建议 cron：{@code 0 0/30 * * * ?}（每 30 分钟）。
 */
@Component("aiConsultDiseaseWarningTask")
public class AiConsultDiseaseWarningTask
{
    private static final Logger LOGGER = LoggerFactory.getLogger(AiConsultDiseaseWarningTask.class);

    @Autowired
    private AiConsultDiseaseWarningService aiConsultDiseaseWarningService;

    public void scanAndWarn()
    {
        LOGGER.info("AiConsultDiseaseWarningTask start");
        int affected = aiConsultDiseaseWarningService.scanAndPersistWarnings();
        LOGGER.info("AiConsultDiseaseWarningTask done, affectedRows={}", affected);
    }
}
