package com.diagbot.web;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.diagbot.annotation.SysLogger;
import com.diagbot.dto.BehospitalInfoDTO;
import com.diagbot.dto.DeptBaseDTO;
import com.diagbot.dto.GetQcClickDTO;
import com.diagbot.dto.GetQcClickInnerPageDTO;
import com.diagbot.dto.RespDTO;
import com.diagbot.dto.GetEntryDefectImproveDTO;
import com.diagbot.facade.DataAnalysisFacade;
import com.diagbot.vo.BasDeptInfoVO;
import com.diagbot.vo.GetEntryDefectImproveInnerVO;
import com.diagbot.vo.GetQcClickInnerPageVO;
import com.diagbot.vo.GetQcClickVO;
import com.diagbot.vo.GetEntryDefectImproveVO;
import com.diagbot.vo.MedClickInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
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;
import java.util.List;

/**
 * @Description:数据分析
 * @Author: cy
 * @time: 2021/11/16 18:28
 */
@RestController
@Api(value = "数据分析相关API", tags = { "数据分析相关API" })
@RequestMapping("/qc/analysis")
public class DataAnalysisController {

    @Autowired
    DataAnalysisFacade dataAnalysisFacade;

    @ApiOperation(value = "记录医生点击质控病历信息[by:cy]")
    @PostMapping("/addMedClickInfo")
    @SysLogger("addMedClickInfo")
    @Transactional
    public RespDTO<Boolean> addMedClickInfo(@RequestBody @Valid MedClickInfoVO medClickInfoVO) {
        return RespDTO.onSuc(dataAnalysisFacade.addMedClickInfo(medClickInfoVO));
    }

    /**
     * 临床质控使用统计科室列表返回
     *
     * @param
     * @return
     */
    @ApiOperation(value = "临床质控使用统计科室列表[by:cy]")
    @PostMapping("/getQcClickDeptList")
    @SysLogger("getQcClickDeptList")
    public RespDTO<List<DeptBaseDTO>> getQcClickDeptList(@RequestBody BasDeptInfoVO basDeptInfoVO) {
        return RespDTO.onSuc(dataAnalysisFacade.getQcClickDeptList(basDeptInfoVO));
    }
    /**
     * 临床质控使用统计
     *
     * @param getQcClickVO
     * @return
     */
    @ApiOperation(value = "临床质控使用统计[by:cy]")
    @PostMapping("/getQcClick")
    @SysLogger("getQcClick")
    public RespDTO<List<GetQcClickDTO>> getQcClick(@RequestBody @Valid GetQcClickVO getQcClickVO) {
        return RespDTO.onSuc(dataAnalysisFacade.getQcClick(getQcClickVO));
    }

    /**
     * 临床质控使用统计-导出
     *
     * @param getQcClickVO
     * @return
     */
    @ApiOperation(value = "临床质控使用统计-导出[by:cy]")
    @PostMapping("/getQcClickByExport")
    @SysLogger("getQcClickByExport")
    public void getQcClickByExport(HttpServletResponse response, @RequestBody @Valid GetQcClickVO getQcClickVO) {
        dataAnalysisFacade.getQcClickByExport(response, getQcClickVO);
    }


    /**
     * 临床质控使用统计-内页
     *
     * @param getQcClickInnerPageVO
     * @return
     */
    @ApiOperation(value = "临床质控使用统计-内页[by:cy]")
    @PostMapping("/getQcClickInnerPage")
    @SysLogger("getQcClickInnerPage")
    public RespDTO<IPage<GetQcClickInnerPageDTO>> getQcClickInnerPage(@RequestBody @Valid GetQcClickInnerPageVO getQcClickInnerPageVO) {
        return RespDTO.onSuc(dataAnalysisFacade.getQcClickInnerPage(getQcClickInnerPageVO));
    }

    /**
     * 临床质控使用统计-内页导出
     *
     * @param getQcClickInnerPageVO
     * @return
     */
    @ApiOperation(value = "临床质控使用统计-内页导出[by:cy]")
    @PostMapping("/getQcClickInnerPageByExport")
    @SysLogger("getQcClickInnerPageByExport")
    public void getQcClickInnerPageByExport(HttpServletResponse response, @RequestBody @Valid GetQcClickInnerPageVO getQcClickInnerPageVO) {
        dataAnalysisFacade.getQcClickInnerPageByExport(response, getQcClickInnerPageVO);
    }

    /**
     * 条目缺陷改善统计
     *
     * @param getEntryDefectImproveVO
     * @return
     */
    @ApiOperation(value = "条目缺陷改善统计[by:cy]")
    @PostMapping("/getEntryDefectImprove")
    @SysLogger("getEntryDefectImprove")
    public RespDTO<IPage<GetEntryDefectImproveDTO>> getEntryDefectImprove(@RequestBody @Valid GetEntryDefectImproveVO getEntryDefectImproveVO) {
        return RespDTO.onSuc(dataAnalysisFacade.getEntryDefectImprove(getEntryDefectImproveVO));
    }

    /**
     * 条目缺陷改善统计-导出
     *
     * @param getEntryDefectImproveVO
     * @return
     */
    @ApiOperation(value = "条目缺陷改善统计-导出[by:cy]")
    @PostMapping("/getEntryDefectImproveByExport")
    @SysLogger("getEntryDefectImproveByExport")
    public void getEntryDefectImproveByExport(HttpServletResponse response, @RequestBody @Valid GetEntryDefectImproveVO getEntryDefectImproveVO) {
        dataAnalysisFacade.getEntryDefectImproveByExport(response, getEntryDefectImproveVO);
    }


    /**
     * 条目缺陷改善统计-内页
     *
     * @param getEntryDefectImproveInnerVO
     * @return
     */
    @ApiOperation(value = "条目缺陷改善统计-内页[by:cy]")
    @PostMapping("/getEntryDefectImproveInner")
    @SysLogger("getEntryDefectImproveInner")
    public RespDTO<IPage<BehospitalInfoDTO>> getEntryDefectImproveInner(@RequestBody GetEntryDefectImproveInnerVO getEntryDefectImproveInnerVO) {
        return RespDTO.onSuc(dataAnalysisFacade.getEntryDefectImproveInner(getEntryDefectImproveInnerVO));
    }

    /**
     * 条目缺陷改善统计-内页导出
     *
     * @param getEntryDefectImproveInnerVO
     * @return
     */
    @ApiOperation(value = "条目缺陷改善统计-内页导出[by:cy]")
    @PostMapping("/getDefectImproveInnerByExport")
    @SysLogger("getDefectImproveInnerByExport")
    public void getDefectImproveInnerByExport(HttpServletResponse response, @RequestBody GetEntryDefectImproveInnerVO getEntryDefectImproveInnerVO) {
        dataAnalysisFacade.getDefectImproveInnerByExport(response, getEntryDefectImproveInnerVO);
    }
}
