package thyyxxk.webserver.controller.medicalinsurance;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import thyyxxk.webserver.dao.his.medicalinsurance.SiManageDao;
import thyyxxk.webserver.entity.inpatient.patient.Overview;
import thyyxxk.webserver.service.medicalinsurance.SiManageService;

import java.util.List;

@RestController
@RequestMapping("/uploadFrontSheet")
public class UploadFrontSheetController {

    private final SiManageDao dao;
    private final SiManageService service;

    @Autowired
    public UploadFrontSheetController(SiManageDao dao, SiManageService service) {
        this.dao = dao;
        this.service = service;
    }

    @GetMapping("/startUploadStatistics")
    private void startUploadStatistics() {
        List<Overview> list = dao.selectNotUploadedSheet();
        for (Overview item : list) {
            service.uploadFrontSheet(item.getInpatientNo(), item.getAdmissTimes());
        }
    }
}
