package com.diagbot.web;


import com.diagbot.annotation.SysLogger;
import com.diagbot.client.AIServiceClient;
import com.diagbot.client.bean.Response;
import com.diagbot.client.bean.ResponseData;
import com.diagbot.dto.RespDTO;
import com.diagbot.facade.ClinicalFacade;
import com.diagbot.vo.SearchVo;
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 javax.validation.Valid;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Mark Huang
 * @since 2019-03-04
 */
@RestController
@RequestMapping("/clinicaldata")
@Api(value = "临床数据处理API", tags = { "临床数据处理API" })

public class ClinicalController {
    @Autowired
    private ClinicalFacade clinicalFacade;

    @Autowired
    private AIServiceClient aiServiceClient;

    @ApiOperation(value = "临床数据处理", notes = "")
    @PostMapping("/processData")
    @SysLogger("processData")
    public RespDTO<ResponseData> processData(@Valid @RequestBody SearchVo searchVo) {

        SearchVo sData = clinicalFacade.processClinicalData(searchVo);

//        Response<ResponseData> res = aiServiceClient.bayesPageData(sData);

        Response<SearchVo> res = new Response<>();
        res.setData(sData);

        return RespDTO.onSuc(res.getData());
    }

}
