package com.lantone.report.web;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lantone.common.api.CommonResult;
import com.lantone.report.dto.GetAppealInfoDTO;
import com.lantone.report.dto.GetAppealReviewDTO;
import com.lantone.report.dto.GetComplaintRecordDTO;
import com.lantone.report.entity.QcresultDetail;
import com.lantone.report.facade.MedAppealExamineInfoManagementFacade;
import com.lantone.report.vo.GetAppealInfoVO;
import com.lantone.report.vo.GetAppealReviewVO;
import com.lantone.report.vo.GetAuditNumberVO;
import com.lantone.report.vo.GetComplaintDetailMsgVO;
import com.lantone.report.vo.GetComplaintRecordVO;
import com.lantone.report.vo.RejectedVo;
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;

/**
 * <p>
 * 申诉审核 前端控制器
 * </p>
 *
 * @author zhanghang
 * @since 2022/2/24
 */
@RestController
@RequestMapping("/medAppealExamineInInfoManage")
@Api(value = "申诉审核数据模块相关接口API", tags = { "申诉审核数据模块相关接口API" })
public class MedAppealExamineInfoManagementController {
    @Autowired
    MedAppealExamineInfoManagementFacade medAppealExamineInfoManagementFacade;

    @ApiOperation(value = "获取申述记录列表[by:zhanghang]",
            notes = "获取申述记录列表")
    @PostMapping("/getComplaintRecord")
    public CommonResult<IPage<GetComplaintRecordDTO>> getComplaintRecord(@RequestBody GetComplaintRecordVO getComplaintRecordVO) {
        Page<GetComplaintRecordDTO> complaintRecord = medAppealExamineInfoManagementFacade.getComplaintRecord(getComplaintRecordVO);
        return CommonResult.success(complaintRecord);
    }

    @ApiOperation(value = "获取申诉审核列表[by:zhanghang]",
            notes = "获取申诉审核列表")
    @PostMapping("/getAppealReview")
    public CommonResult<IPage<GetAppealReviewDTO>> getAppealReview(@RequestBody GetAppealReviewVO getAppealReviewVO) {
        Page<GetAppealReviewDTO> appealReview = medAppealExamineInfoManagementFacade.getAppealReview(getAppealReviewVO);
        return CommonResult.success(appealReview);
    }

    @ApiOperation(value = "驳回[by:zhanghang]",
            notes = "驳回")
    @PostMapping("/rejected")
    @Transactional
    public CommonResult<Boolean> rejected(@RequestBody RejectedVo rejectedVo) {
        return CommonResult.success(medAppealExamineInfoManagementFacade.rejected(rejectedVo));
    }

    @ApiOperation(value = "审核查看[by:zhanghang]",
            notes = "审核查看")
    @PostMapping("/getApprovedView")
    public CommonResult<GetAppealInfoDTO> getApprovedView(@RequestBody GetAppealInfoVO getAppealInfoVO) {
        return CommonResult.success(medAppealExamineInfoManagementFacade.getApprovedView(getAppealInfoVO));
    }

    @ApiOperation(value = "获取待审核数量[by:zhanghang]",
            notes = "获取待审核数量")
    @PostMapping("/getAuditNumber")
    public CommonResult<Integer> getAuditNumber(@RequestBody GetAuditNumberVO getAuditNumberVO) {
        Integer complaintRecord = medAppealExamineInfoManagementFacade.getAuditNumber(getAuditNumberVO);
        return CommonResult.success(complaintRecord);
    }

    @ApiOperation(value = "获取该申诉记录最新缺陷详情[by:zhanghang]",
            notes = "获取该申诉记录最新缺陷详情")
    @PostMapping("/getComplaintDetailMsg")
    public CommonResult<QcresultDetail> getComplaintDetailMsg(@RequestBody GetComplaintDetailMsgVO getComplaintDetailMsgVO) {
        return CommonResult.success(medAppealExamineInfoManagementFacade.getComplaintDetailMsg(getComplaintDetailMsgVO));
    }
}
