package com.diagbot.web;


import com.diagbot.dto.RespDTO;
import com.diagbot.dto.SymptomSearchDTO;
import com.diagbot.entity.Symptom;
import com.diagbot.facade.SymptomFacade;
import com.diagbot.vo.SymptomSearchVO;
import com.diagbot.vo.SymptomUsualVO;
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;

/**
 * @Description: 分诊症状Controller
 * @Author: ztg
 * @Date: 2018/10/23 15:09
 */
@RestController
@RequestMapping("/symptom")
public class SymptomController {

    @Autowired
    SymptomFacade symptomFacade;


    @ApiOperation(value = "获取常用症状[by:zhoutg]",
            notes = "sexType：性别，1：男，2：女<br>" +
                    "age：年龄")
    @PostMapping("/getUsual")
    public RespDTO<List<Symptom>> getUsual(@RequestBody @Valid SymptomUsualVO symptomUsualVO) {
        return RespDTO.onSuc(symptomFacade.getUsualFac(symptomUsualVO));
    }


    @ApiOperation(value = "搜索症状[by:zhoutg]",
            notes = "name: 输入内容<br>" +
                    "sexType：性别，1：男，2：女<br>" +
                    "age：年龄")
    @PostMapping("/search")
    public RespDTO<List<SymptomSearchDTO>> search(@RequestBody @Valid SymptomSearchVO symptomSearchVO) {
        return RespDTO.onSuc(symptomFacade.searchFac(symptomSearchVO));
    }

}

