package com.fs.app.controller;


import com.fs.app.annotation.Login;
import com.fs.common.core.domain.R;
import com.fs.his.domain.*;
import com.fs.his.param.FsDiseaseListUParam;
import com.fs.his.param.FsDoctorListUParam;
import com.fs.his.param.FsDoctorPingListUParam;
import com.fs.his.param.FsUserDoctorListUParam;
import com.fs.his.service.*;
import com.fs.his.vo.FsDiseaseListUVO;
import com.fs.his.vo.FsDoctorListUVO;
import com.fs.his.vo.FsDoctorPingUVO;
import com.fs.his.vo.FsUserDoctorListUVO;
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.cache.annotation.Cacheable;
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.HashMap;
import java.util.List;
import java.util.Map;


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

    @Autowired
    private IFsDiseaseService diseaseService;


    @ApiOperation("获取疾病列表")
    @GetMapping("/getDiseaseList")
    @Cacheable(value = "getDiseaseList", key = "#param")
    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("获取疾病详情")
    @Cacheable(value = "getDiseaseById", key = "#diseaseId")
    @GetMapping("/getDiseaseById")
    public R getDiseaseById(@RequestParam("diseaseId")Long diseaseId, HttpServletRequest request){
        FsDisease disease=diseaseService.selectFsDiseaseByDiseaseId(diseaseId);
        return R.ok().put("data",disease);
    }

}
