package com.diagbot.web;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.diagbot.annotation.SysLogger;
import com.diagbot.dto.DoctorAverageLevelDTO;
import com.diagbot.dto.DoctorAverageStatisticsDTO;
import com.diagbot.dto.GetDetailRecordListPageDTO;
import com.diagbot.dto.GetDoctorDetailPageDTO;
import com.diagbot.dto.RespDTO;
import com.diagbot.facade.ConsoleByDoctorFacade;
import com.diagbot.facade.ConsoleExportFacade;
import com.diagbot.vo.DoctorAverageLevelVO;
import com.diagbot.vo.DoctorAverageStatisticsVO;
import com.diagbot.vo.ExportDoctorAverageLevelVO;
import com.diagbot.vo.GetDetailRecordListPageVO;
import com.diagbot.vo.GetDoctorDetailPageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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 javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

/**
 * @author songxl
 * @Description: 控制台（医生）统计相关API
 * @date 2022/4/8 13:20
 **/
@RequestMapping("/consoleByDoctor")
@RestController
@Api(value = "控制台（医生）统计相关API", tags = { "控制台（医生）统计相关API" })
@SuppressWarnings("unchecked")
public class ConsoleByDoctorController {
    @Autowired
    private ConsoleByDoctorFacade consoleByDoctorFacade;

    @Autowired
    private ConsoleExportFacade consoleExportFacade;
    /**
     * 医生质控平均分页面统计
     *
     * @param doctorAverageStatisticsVO
     * @return
     */
    @ApiOperation(value = "医生质控平均分页面统计[by:songxl]",
            notes = "医生质控平均分页面统计")
    @PostMapping("/doctorAverageStatistics")
    @SysLogger("doctorAverageStatistics")
    public RespDTO<IPage<DoctorAverageStatisticsDTO>> doctorAverageStatistics(@RequestBody @Valid DoctorAverageStatisticsVO doctorAverageStatisticsVO) {
        return RespDTO.onSuc(consoleByDoctorFacade.doctorAverageStatistics(doctorAverageStatisticsVO));
    }


    /**
     * 医生质控平均分页面统计-导出
     *
     * @param doctorAverageStatisticsVO
     * @return
     */
    @PostMapping("/doctorAverageStatisticsExport")
    @SysLogger("doctorAverageStatisticsExport")
    public void doctorAverageStatisticsExport(HttpServletResponse response, @RequestBody @Valid DoctorAverageStatisticsVO doctorAverageStatisticsVO) {
        consoleExportFacade.doctorAverageStatisticsExport(response, doctorAverageStatisticsVO);
    }
    /**
     * 医生质控平均分-患者列表（等级）
     *
     * @param doctorAverageLevelVO
     * @return
     */
    @ApiOperation(value = "医生质控平均分-患者列表（等级）[by:songxl]",
            notes = "医生质控平均分-患者列表（等级）")
    @PostMapping("/doctorAverageLevelPage")
    @SysLogger("doctorAverageLevelPage")
    public RespDTO<IPage<DoctorAverageLevelDTO>> doctorAverageLevelPage(@RequestBody @Valid DoctorAverageLevelVO doctorAverageLevelVO) {
        return RespDTO.onSuc(consoleByDoctorFacade.doctorAverageLevelPage(doctorAverageLevelVO));
    }

    /**
     * 医生质控平均分-患者列表（等级）-导出
     *
     * @param exportDoctorAverageLevelVO
     * @return
     */
    @PostMapping("/doctorAverageLevelExport")
    @SysLogger("doctorAverageLevelExport")
    public void doctorAverageLevelExport(HttpServletResponse response, @RequestBody @Valid ExportDoctorAverageLevelVO exportDoctorAverageLevelVO) {
        consoleExportFacade.doctorAverageLevelExport(response, exportDoctorAverageLevelVO);
    }


    @ApiOperation(value = "获取缺陷列表[by:zhanghang]",
            notes = "获取缺陷列表接口")
    @PostMapping("/getDoctorDetailPage")
    @SysLogger("getDoctorDetailPage")
    public RespDTO<IPage<GetDoctorDetailPageDTO>> getDoctorDetailPage(@RequestBody GetDoctorDetailPageVO getDetailListPageVO) {
        return  RespDTO.onSuc(consoleByDoctorFacade.getDoctorDetailPage(getDetailListPageVO));
    }

    @ApiOperation(value = "缺陷列表导出[by:zhanghang]",
            notes = "缺陷列表导出接口")
    @PostMapping("/getDoctorDetailPageExport")
    @SysLogger("getDoctorDetailPageExport")
    public void getDoctorDetailPageExport(HttpServletResponse response, @RequestBody GetDoctorDetailPageVO getDetailListPageVO) {
        consoleExportFacade.getDoctorDetailPageExport(response, getDetailListPageVO);
    }

    @ApiOperation(value = "获取缺陷数量对应的病历[by:zhanghang]",
            notes = "获取缺陷数量对应的病历")
    @PostMapping("/getDetailRecordListPage")
    @SysLogger("getDetailRecordListPage")
    public RespDTO<IPage<GetDetailRecordListPageDTO>> getDetailRecordListPage(@RequestBody GetDetailRecordListPageVO getDetailRecordListPageVO) {
        return  RespDTO.onSuc(consoleByDoctorFacade.getDetailRecordListPage(getDetailRecordListPageVO));
    }

    @ApiOperation(value = "导出缺陷数量对应的病历[by:zhanghang]",
            notes = "导出缺陷数量对应的病历")
    @PostMapping("/getDetailRecordListPageExport")
    @SysLogger("getDetailRecordListPageExport")
    public void getDetailRecordListPageExport(HttpServletResponse response,@RequestBody GetDetailRecordListPageVO getDetailRecordListPageVO) {
        consoleExportFacade.getDetailRecordListPageExport(response,getDetailRecordListPageVO);
    }
}
