package thyyxxk.webserver.controller.highreport;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import thyyxxk.webserver.config.auth.PassToken;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.highreport.HighReportDto;
import thyyxxk.webserver.service.highreport.AllStatisticsService;

import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @description: 全部报表
 * @author: hsh
 * @createtime: 2023-05-11  10:50
 * @version: 1.0
 */
@RestController
@RequestMapping("/allStatistics")
public class AllStatisticsController {

    private final AllStatisticsService service;

    @Autowired
    public AllStatisticsController(AllStatisticsService service) {
        this.service = service;
    }

    @PostMapping("/selectWorkloadStatistics")
    public ResultVo<Map<String, Object>> selectWorkloadStatistics(@RequestBody @Validated HighReportDto dto){
        return service.selectWorkloadStatistics(dto);
    }

    @PostMapping("/selectIncomeStatistics")
    public ResultVo<Map<String, Object>> selectIncomeStatistics(@RequestBody @Validated HighReportDto dto){
        return service.selectIncomeStatistics(dto);
    }

    @PostMapping("/selectInpatientDeptAccountingReport")
    public ResultVo<Map<String, Object>> selectInpatientDeptAccountingReport(@RequestBody @Validated HighReportDto dto){
        return service.selectInpatientDeptAccountingReport(dto);
    }

    @PassToken
    @PostMapping("/exportInpatientDeptAccountingReport")
    public void exportInpatientDeptAccountingReport(HttpServletResponse response, @RequestBody @Validated HighReportDto dto){
        service.exportInpatientDeptAccountingReport(response, dto);
    }

    @PostMapping("/selectWorkFeeStatistics")
    public ResultVo<Map<String, Object>> selectWorkFeeStatistics(@RequestBody @Validated HighReportDto dto){
        return service.selectWorkFeeStatistics(dto);
    }

    @PostMapping("/exportWorkFeeStatisticsInfo")
    public ResultVo<Map<String, Object>> exportWorkFeeStatisticsInfo(HttpServletResponse response, @RequestBody @Validated HighReportDto dto){
        return service.exportWorkFeeStatisticsInfo(response, dto);
    }

}
