package thyyxxk.webserver.scheduled;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import thyyxxk.webserver.dao.his.triage.TriageDao;

@Component
public class ResetPatientNum {
    private final TriageDao dao;
    @Value("${execute-scheduled}")
    private Boolean executeScheduled;

    @Autowired
    public ResetPatientNum(TriageDao dao) {
        this.dao = dao;
    }

    @Scheduled(cron = "0 0 0 * * ?")
    public void resetPatientNum() {
        if (executeScheduled) {
            dao.resetPatientNum();
        }
    }

}
