package com.emr.controller;

import com.emr.annotation.OptionalLog;
import com.emr.service.browseRecordsService;
import com.emr.util.ExceptionPrintUtil;
import com.emr.vo.EmrPrintOrDownLoadInfo.EmrPrintOrDownLoadInfoVo;
import com.emr.vo.browseRecords;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("browseRecords/")
public class BrowseRecordsController {
    @Autowired
    private browseRecordsService browseRecordsService;





    @RequestMapping(value="recordsList")
    public String recordsList(Model model) {
        return "otherManage/browseRecords";
    }



    @RequiresPermissions("/browseRecords/select")
    @RequestMapping("selectBrowseRecords")
    @ResponseBody
    public PageInfo selectBrowseRecords(Integer page, Integer limit, browseRecords browseRecords){
        if(null != page && null != limit){
            PageHelper.startPage(page, limit);
        }
        try{
            //查询
            List<com.emr.vo.browseRecords> list = browseRecordsService.selectAll(browseRecords);
            return new PageInfo<>(list);
        }catch (Exception e){
            ExceptionPrintUtil.printException(e);
            e.printStackTrace();
            return null;
        }
    }
}
