package com.fs.app.controller.store;


import com.fs.app.controller.AppBaseController;
import com.fs.common.core.domain.R;
import com.fs.hisStore.domain.FsDiseaseScrm;
import com.fs.hisStore.param.FsDiseaseListUParam;
import com.fs.hisStore.service.IFsDiseaseScrmService;
import com.fs.hisStore.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="/store/app/disease")
public class DiseaseScrmController extends AppBaseController {

    @Autowired
    private IFsDiseaseScrmService 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, HttpServletRequest request){
        FsDiseaseScrm disease=diseaseService.selectFsDiseaseByDiseaseId(diseaseId);
        return R.ok().put("data",disease);
    }

}
