package com.emr.controller;

import com.emr.entity.*;
import com.emr.service.StatisticsService;
import net.sf.ehcache.Statistics;
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 javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("/Statistics")
public class StatisticsController {

    @Autowired
    StatisticsService statisticsService;

    @ResponseBody
    @RequestMapping(value = "/getStatistics")
    public OffsetLimitPage getStatistics(HttpServletRequest request, HttpServletResponse response, StatisticsVo statisticsVo, Integer offset, Integer limit) {
        response.setCharacterEncoding("utf-8");
        OffsetLimitPage result = statisticsService.getStatisticsVo(statisticsVo, offset, limit);
        return result;
    }



    @ResponseBody
    @RequestMapping(value = "/getRecoveryStatistics")
    public OffsetLimitPage getRecoveryStatistics(HttpServletRequest request, HttpServletResponse response, Archive_otherVo archiveOtherVo, Integer offset, Integer limit) {
        response.setCharacterEncoding("utf-8");
        OffsetLimitPage result = statisticsService.getRecoveryStatistics(archiveOtherVo, offset, limit);
        return result;
    }


    @ResponseBody
    @RequestMapping(value = "/getFileStatistics")
    public OffsetLimitPage getFileStatistics(HttpServletRequest request, HttpServletResponse response, FileVo fileVo, Integer offset, Integer limit) {
        response.setCharacterEncoding("utf-8");
        OffsetLimitPage result = statisticsService.getFileStatistics(fileVo, offset, limit);
        return result;
    }



    @ResponseBody
    @RequestMapping(value = "/getBorrowingStatistics")
    public OffsetLimitPage getBorrowingStatistics(HttpServletRequest request, HttpServletResponse response, BorrowingVo borrowingVo, Integer offset, Integer limit) {
        response.setCharacterEncoding("utf-8");
        OffsetLimitPage result = statisticsService.getBorrowingStatistics(borrowingVo, offset, limit);
        return result;
    }



    @ResponseBody
    @RequestMapping(value = "/getWindowPrintStatistics")
    public OffsetLimitPage getWindowPrintStatistics(HttpServletRequest request, HttpServletResponse response, WindowPrintVo windowPrintVo, Integer offset, Integer limit) {
        response.setCharacterEncoding("utf-8");
        OffsetLimitPage result = statisticsService.getWindowPrintStatistics(windowPrintVo, offset, limit);
        return result;
    }





}
