package com.diagbot.web;


import com.diagbot.annotation.SysLogger;
import com.diagbot.dto.RespDTO;
import com.diagbot.dto.RetrievalDTO;
import com.diagbot.facade.RetrievalFacade;
import com.diagbot.vo.RetrievalVO;
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;
import java.util.List;

/**
 * <p>
 * 同义词检索检索表 前端控制器
 * </p>
 *
 * @author wangyu
 * @since 2018-11-16
 */
@RestController
@RequestMapping("/retrieval")
@Api(value = "页面检索API", tags = { "页面检索API" })
@SuppressWarnings("unchecked")
public class RetrievalController {
    @Autowired
    private RetrievalFacade retrievalFacade;

    @ApiOperation(value = "页面检索——查询[by:wangyu]",
            notes = "type：类型(1：症状 3：其他史 4：查体，5：化验 6：辅检 7：诊断)，必填<br>" +
                    "age：年龄，必填<br>" +
                    "inputStr：检索内容，必填<br>" +
                    "sexType：性别，必填<br>")
    @PostMapping("/getTagInfos")
    @SysLogger("getTagInfos")
    public RespDTO<List<RetrievalDTO>> getTagInfos(@Valid @RequestBody RetrievalVO retrievalVO) {
        List<RetrievalDTO> data = retrievalFacade.getTagInfos(retrievalVO);
        return RespDTO.onSuc(data);
    }
}
