package com.fs.app.controller;


import com.fs.common.core.domain.R;
import com.fs.store.domain.FsDisease;
import com.fs.store.param.FsDiseaseListUParam;
import com.fs.store.service.IFsDiseaseService;
import com.fs.store.vo.FsDiseaseListUVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;


@Api("疾病接口")
@RestController
@RequestMapping(value="/app/disease")
public class DiseaseController extends  AppBaseController {

    @Autowired
    private IFsDiseaseService diseaseService;


    @ApiOperation("获取疾病列表")
    @GetMapping("/getDiseaseList")
    public R getDiseaseList(FsDiseaseListUParam param)
    {
        PageHelper.startPage(param.getPageNum(), param.getPageSize());
        List<FsDiseaseListUVO> list=diseaseService.selectFsDiseaseListUVO(param);
        PageInfo<FsDiseaseListUVO> listPageInfo=new PageInfo<>(list);
        return R.ok().put("data",listPageInfo);
    }



    @ApiOperation("获取疾病详情")
    @GetMapping("/getDiseaseById")
    public R getDiseaseById(@RequestParam("diseaseId")Long diseaseId){
        FsDisease disease=diseaseService.selectFsDiseaseByDiseaseId(diseaseId);
        return R.ok().put("data",disease);
    }

}
