package com.diagbot.web;


import com.diagbot.annotation.SysLogger;
import com.diagbot.dto.AIDTO;
import com.diagbot.dto.RespDTO;
import com.diagbot.facade.AIFacade;
import com.diagbot.vo.AIVO;
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;

/**
 * @Description: AI服务控制层
 * @author: gaodm
 * @time: 2018/10/25 10:09
 */
@RestController
@RequestMapping("/ai")
@Api(value = "AIAPI", tags = { "AIAPI" })
public class AIController {

    @Autowired
    AIFacade aiFacade;

    /**
     * 症状推理症状接口
     *
     * @param aivo ai输入参数
     * @return 症状相关数据
     */
    @ApiOperation(value = "症状推理症状接口[by:gaodm]",
            notes = "age： 年龄(必填)<br>" +
                    "sex：性别，1：男，2：女(必填)<br>" +
                    "symptom：症状自然文本描述(必填)")
    @PostMapping("/pushSymptom")
    @SysLogger("pushSymptom")
    public RespDTO<AIDTO> pushSymptom(@RequestBody @Valid AIVO aivo) {
        return RespDTO.onSuc(aiFacade.push(aivo, "1"));
    }

    /**
     * 症状推理症状接口
     *
     * @param aivo ai输入参数
     * @return 疾病相关数据
     */
    @ApiOperation(value = "症状推理疾病接口[by:gaodm]",
            notes = "age： 年龄(必填)<br>" +
                    "sex：性别，1：男，2：女(必填)<br>" +
                    "symptom：症状自然文本描述(必填)")
    @PostMapping("/pushDis")
    @SysLogger("pushDis")
    public RespDTO<AIDTO> pushDis(@RequestBody @Valid AIVO aivo) {
        return RespDTO.onSuc(aiFacade.push(aivo, "7"));
    }

}

