package com.fs.app.controller;

import com.fs.app.annotation.Login;
import com.fs.common.core.domain.R;
import com.fs.course.param.FsInquiryPatientInfoUParam;
import com.fs.course.vo.FsInquiryPatientInfoListUVO;
import com.fs.his.service.IFsInquiryPatientInfoService;
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 java.util.List;

@Api("患者问诊单接口")
@RestController
@RequestMapping(value="/app/inquiryPatient")
public class InquiryPatientInfoController extends AppBaseController{

    @Autowired
    private IFsInquiryPatientInfoService patientInfoService;


    @Login
    @ApiOperation("患者问诊单列表")
    @GetMapping("/getList")
    public R getList(FsInquiryPatientInfoUParam param) {
        PageHelper.startPage(param.getPageNum(), param.getPageSize());
        param.setUserId(Long.parseLong(getUserId()));
        List<FsInquiryPatientInfoListUVO> fsInquiryPatientInfoListUVOS = patientInfoService.selectFsInquiryPatientInfoListUVO(param);
        PageInfo<FsInquiryPatientInfoListUVO> pageInfo = new PageInfo<>(fsInquiryPatientInfoListUVOS);
        return R.ok().put("data",pageInfo);
    }


    @ApiOperation("问诊单详情")
    @GetMapping("/getInfo")
    public R getInfo(@RequestParam("id") Long id) {
        FsInquiryPatientInfoListUVO info = patientInfoService.getInfo(id);
        return R.ok().put("data",info);
    }
}
