package com.fs.app.controller;

import com.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.core.domain.R;
import com.fs.common.core.page.TableDataInfo;
import com.fs.common.enums.BusinessType;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.his.domain.FsDoctor;
import com.fs.his.domain.FsFollow;
import com.fs.his.domain.FsPatient;
import com.fs.his.param.FsPatientListDParam;
import com.fs.his.service.IFsPatientService;
import com.fs.his.vo.FsFollowListDVO;
import com.fs.his.vo.FsPatientListDVO;
import com.fs.his.vo.FsPatientVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

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

@RestController
@RequestMapping("/app/patient")
public class PatientController extends AppBaseController
{
    @Autowired
    private IFsPatientService fsPatientService;


    @GetMapping("/getPatientList")
    public R getPatientList(FsPatientListDParam param)
    {
        param.setDoctorId(Long.parseLong(getDoctorId()));
        PageHelper.startPage(param.getPageNum(), param.getPageSize());
        List<FsPatientListDVO> list=fsPatientService.selectFsPatientListDVO(param);
        PageInfo<FsPatientListDVO> listPageInfo=new PageInfo<>(list);
        return R.ok().put("data",listPageInfo);
    }

    @ApiOperation("获取详情")
    @GetMapping("/getPatientByPatientId")
    public R getPatientByPatientId(@RequestParam("patientId")Long patientId, HttpServletRequest request){
        FsPatient patient=fsPatientService.selectFsPatientByPatientId(patientId);
        return R.ok().put("data",patient);
    }
}
