package com.diagbot.web;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.diagbot.annotation.SysLogger;
import com.diagbot.dto.CheckedRecordListDTO;
import com.diagbot.dto.RespDTO;
import com.diagbot.facade.RecordCheckFacade;
import com.diagbot.vo.CheckedRecordListVO;
import com.diagbot.vo.RecordCheckVO;
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 java.util.Map;

/**
 * @author rengb
 * @since 2021-05-11
 */
@RestController
@RequestMapping("/qc/recCheck")
@Api(value = "核查任务列表--相关接口API", tags = { "核查任务列表--相关接口API" })
public class RecordCheckController {

    @Autowired
    RecordCheckFacade recordCheckFacade;

    @ApiOperation(value = "获取核查任务列表[by:rengb]")
    @PostMapping("/checkedRecordList")
    @SysLogger("checkedRecordList")
    public RespDTO<IPage<CheckedRecordListDTO>> checkedRecordList(@RequestBody CheckedRecordListVO checkedRecordListVO) {
        IPage<CheckedRecordListDTO> data = recordCheckFacade.checkedRecordList(checkedRecordListVO);
        return RespDTO.onSuc(data);
    }

    @ApiOperation(value = "病历核查[by:rengb]")
    @PostMapping("/recordCheck")
    @SysLogger("recordCheck")
    @Transactional
    public RespDTO<Boolean> recordCheck(@RequestBody RecordCheckVO recordCheckVO) {
        Boolean res = recordCheckFacade.recordCheck(recordCheckVO);
        return RespDTO.onSuc(res);
    }

    @ApiOperation(value = "获取核查任务来源[by:songxl]")
    @PostMapping("/getCheckType")
    @SysLogger("getCheckType")
    public RespDTO<Map<String, Object>> getCheckType() {
        Map<String, Object> data = recordCheckFacade.getCheckType();
        return RespDTO.onSuc(data);
    }
}