package com.ruoyi.web.work.api;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.work.domain.Visit;
import com.ruoyi.web.work.service.IVisitService;
import io.swagger.annotations.Api;
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 java.time.LocalDateTime;
import java.util.List;

/**
 * 就诊记录接口
 */
@RestController
@RequestMapping("/app/visit")
@Api(tags = "小程序就诊记录")
public class Api_VisitController {

    @Autowired
    private IVisitService service;

    /**
     * 根据患者id获取就诊记录列表
     * @param patId
     * @return
     */
    @ApiOperation(value = "就诊记录列表")
    @GetMapping("/{patId}")
    public AjaxResult getVisitByCardId(@PathVariable String patId,@RequestParam(value = "startTime",required = false) String startTime,
                                       @RequestParam(value = "endTime",required = false) String endTime){
        List<Visit> visitList = service.getVisitByPatId(patId,startTime,endTime);
        return AjaxResult.success(visitList);
    }
}
