package com.lantone.report.web;


import com.lantone.common.api.CommonResult;
import com.lantone.report.dto.GetAppealDeptDTO;
import com.lantone.report.dto.GetAppealInfoDTO;
import com.lantone.report.dto.GetAppealModeDTO;
import com.lantone.report.dto.GetReviewerDTO;
import com.lantone.report.facade.MedAppealInfoManagementFacade;
import com.lantone.report.vo.AddAppealInfoVO;
import com.lantone.report.vo.CancelAppealInfoVO;
import com.lantone.report.vo.GetAppealDeptVo;
import com.lantone.report.vo.GetAppealInfoVO;
import com.lantone.report.vo.GetAppealModeVo;
import com.lantone.report.vo.GetAppealOperationTypeVO;
import com.lantone.report.vo.GetReviewerVO;
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.validation.Valid;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 申诉审核 前端控制器
 * </p>
 *
 * @author wangfeng
 * @since 2020-07-06
 */
@RestController
@RequestMapping("/medAppealInfoManage")
@Api(value = "申诉审核数据模块相关接口API", tags = { "申诉审核数据模块相关接口API" })
public class MedAppealInfoManagementController {
    @Autowired
    MedAppealInfoManagementFacade medAppealInfoManagementFacade;


    @ApiOperation(value = "申诉[by:songxl]",
            notes = "申诉")
    @PostMapping("/addAppealInfo")
    @Transactional
    public CommonResult<Boolean> addAppealInfo(@RequestBody @Valid AddAppealInfoVO addAppealInfoVO) {
        return CommonResult.success(medAppealInfoManagementFacade.addAppealInfo(addAppealInfoVO));
    }

    @ApiOperation(value = "获取审核人[by:songxl]",
            notes = "获取审核人")
    @PostMapping("/getReviewer")
    public CommonResult<List<GetReviewerDTO>> getReviewer(@RequestBody GetReviewerVO getReviewerVO) {
        List<GetReviewerDTO> reviewers = medAppealInfoManagementFacade.getReviewer(getReviewerVO);
        return CommonResult.success(reviewers);
    }

    @ApiOperation(value = "再次申诉获取操作类型[by:songxl]",
            notes = "再次申诉获取操作类型")
    @PostMapping("/getAppealOperationType")
    public CommonResult<Map<String, String>> getAppealOperationType(@RequestBody @Valid GetAppealOperationTypeVO getAppealOperationTypeVO) {
        return CommonResult.success(medAppealInfoManagementFacade.getAppealOperationType(getAppealOperationTypeVO));
    }

    @ApiOperation(value = "撤回申诉[by:songxl]",
            notes = "撤回申诉")
    @PostMapping("/cancelAppealInfo")
    @Transactional
    public CommonResult<Boolean> cancelAppealInfo(@RequestBody @Valid CancelAppealInfoVO cancelAppealInfoVO) {
        return CommonResult.success(medAppealInfoManagementFacade.cancelAppealInfo(cancelAppealInfoVO));
    }

    @ApiOperation(value = "申诉记录详情-查看[by:songxl]",
            notes = "申诉记录详情-查看")
    @PostMapping("/getAppealInfo")
    public CommonResult<GetAppealInfoDTO> getAppealInfo(@RequestBody GetAppealInfoVO getAppealInfoVO) {
        return CommonResult.success(medAppealInfoManagementFacade.getAppealInfo(getAppealInfoVO));
    }


    @ApiOperation(value = "申诉审核科室下拉列表查询[by:songxl]",
            notes = "申诉审核科室下拉列表查询")
    @PostMapping("/getAppealDept")
    public CommonResult<List<GetAppealDeptDTO>> getAppealDept(@RequestBody @Valid GetAppealDeptVo getAppealDeptVo) {
        return CommonResult.success(medAppealInfoManagementFacade.getAppealDept(getAppealDeptVo));
    }

    @ApiOperation(value = "申诉审核模块下拉列表查询[by:songxl]",
            notes = "申诉审核模块下拉列表查询")
    @PostMapping("/getAppealMode")
    public CommonResult<List<GetAppealModeDTO>> getAppealMode(@RequestBody @Valid GetAppealModeVo getAppealModeVo) {
        return CommonResult.success(medAppealInfoManagementFacade.getAppealMode(getAppealModeVo));
    }
}
