package thyyxxk.webserver.controller.medicalinsurance.costcontrol;

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.medicalinsurance.setlinfo.SiSetlinfo;
import thyyxxk.webserver.entity.medicalinsurance.costcontrol.TreeNodesResult;
import thyyxxk.webserver.entity.medicalinsurance.costcontrol.YbStatDto;
import thyyxxk.webserver.entity.medicalinsurance.costcontrol.YbStatResult;
import thyyxxk.webserver.service.medicalinsurance.costcontrol.YbStatService;

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

/**
 * @ClassName YbStatController
 * @Description 医保统计
 * @Author hsh
 * @Date 2022/6/17 11:30
 **/
@RestController
@RequestMapping("/ybQuery")
public class YbStatController {

    private final YbStatService service;

    @Autowired
    public YbStatController(YbStatService service) {
        this.service = service;
    }

    @PostMapping("/selectYbStatInfo")
    public ResultVo<List<YbStatResult>> selectYbStatInfo(@RequestBody @Validated YbStatDto dto) {
        return service.selectYbStatInfo(dto);
    }

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

    @PostMapping("/exportYbStatRatioExcel")
    public ResultVo<String> exportYbStatRatioExcel(HttpServletResponse response, @RequestBody @Validated YbStatDto dto) {
        return service.exportYbStatRatioExcel(response, dto);
    }

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

    @PostMapping("/selectYbStatDetail")
    public ResultVo<List<SiSetlinfo>> selectYbStatDetail(@RequestBody @Validated YbStatDto dto){
        return service.selectYbStatDetail(dto);
    }


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

    @PostMapping("/selectTreeData")
    public ResultVo<TreeNodesResult> selectTreeData(@RequestBody @Validated YbStatDto dto){
        return service.selectTreeData(dto);
    }

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

}
