package com.diagbot.web;


import com.diagbot.annotation.SysLogger;
import com.diagbot.dto.RespDTO;
import com.diagbot.dto.his.DoctorHosDTO;
import com.diagbot.facade.his.DoctorHosFacade;
import com.diagbot.facade.his.FeedbackHosFacade;
import com.diagbot.vo.his.DoctorHosVO;
import com.diagbot.vo.his.FeedbackHosVO;
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 java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhanghang
 * @since 2022-04-20
 */
@RestController
@RequestMapping("/qcView/data")
@Api(value = "HIS视图接口API", tags = { "HIS视图接口API" })
public class DataViewController {

    @Autowired
    private DoctorHosFacade doctorHosFacade;

    @Autowired
    private FeedbackHosFacade feedbackHosFacade;

    @ApiOperation(value = "获取HIS医生信息")
    @PostMapping("/getDoctorHos")
    @SysLogger("getDoctorHos")
    public RespDTO<List<DoctorHosDTO>> getDoctorInfo(@RequestBody DoctorHosVO doctorHosVO){
        return RespDTO.onSuc(doctorHosFacade.getDoctorInfo(doctorHosVO));
    }


    @ApiOperation(value = "推送缺陷反馈到HIS")
    @PostMapping("/pushFeedback")
    @SysLogger("pushFeedback")
    public RespDTO pushFeedback(@RequestBody FeedbackHosVO feedbackHosVO){
        return feedbackHosFacade.pushFeedback(feedbackHosVO);
    }

    @ApiOperation(value = "修改同步到his中的缺陷反馈")
    @PostMapping("/updateFeedback")
    @SysLogger("updateFeedback")
    public RespDTO updateFeedback(@RequestBody FeedbackHosVO feedbackHosVO){
        return feedbackHosFacade.updateFeedback(feedbackHosVO);
    }

    @ApiOperation(value = "删除同步到his中的缺陷反馈")
    @PostMapping("/deleteFeedback")
    @SysLogger("deleteFeedback")
    public RespDTO deleteFeedback(@RequestBody FeedbackHosVO feedbackHosVO){
        return feedbackHosFacade.deleteFeedback(feedbackHosVO);
    }

    @ApiOperation(value = "从HIS获取待确认缺陷状态")
    @PostMapping("/statusQuery")
    @SysLogger("statusQuery")
    public RespDTO<List<FeedbackHosVO>> statusQuery(@RequestBody FeedbackHosVO feedbackHosVO){
        return feedbackHosFacade.statusQuery(feedbackHosVO);
    }


}
