using System;
using System.Collections.Generic;
using IRaCIS.Application.Interfaces;
using IRaCIS.Application.ViewModels;
using IRaCIS.Core.Application.Contracts.RequestAndResponse;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace IRaCIS.Api.Controllers
{
///
/// Dashboard统计、全局工作量统计、入组两个维度统计(按照项目、按照人)
///
[Route("statistics")]
[ApiController, Authorize, ApiExplorerSettings(GroupName = "Dashboard&Statistics")]
public class StatisticsController : ControllerBase
{
private readonly IStatisticsService _statisticsService;
public StatisticsController(IStatisticsService statisticsService)
{
_statisticsService = statisticsService;
}
/// 根据项目和医生,分页获取工作量统计[New]
[HttpPost, Route("getWorkloadByTrialAndReviewer")]
public IResponseOutput> GetWorkloadByTrialAndReviewer(
StatisticsWorkloadQueryParam param)
{
return ResponseOutput.Ok(
_statisticsService.GetWorkloadByTrialAndReviewer(param, Guid.Parse(User.FindFirst("id").Value)));
}
/// 项目入组 医生维度统计[New]
[HttpPost, Route("getEnrollStatByReviewer")]
public IResponseOutput> GetEnrollStatByReviewer(
EnrollStatByReviewerQueryDTO param)
{
return ResponseOutput.Ok(_statisticsService.GetEnrollStatByReviewer(param));
}
[HttpPost, Route("getEnrollStatByTrial")]
public IResponseOutput> GetEnrollStatByTrial(
EnrollStatByTrialQueryDTO param)
{
return ResponseOutput.Ok(_statisticsService.GetEnrollStatByTrial(param));
}
#region Dashbord
/// 读片数分类统计[New]
[HttpGet, Route("getReadingDataByType")]
public IResponseOutput GetReadingDataByType()
{
return ResponseOutput.Ok(_statisticsService.GetReadingDataByType());
}
/// 获取最近几个月份的数据[New]
[HttpGet, Route("getReadingDataByMonth/{monthCount:int}")]
public IResponseOutput> GetReadingDataByMonth(int monthCount)
{
return ResponseOutput.Ok(_statisticsService.GetReadingDataByMonth(monthCount));
}
/// 读片数量排行前几的数据[New]
[HttpGet, Route("GetReadingDataRank/{topCount:int}")]
public IResponseOutput> GetReadingDataRank(int topCount)
{
return ResponseOutput.Ok(_statisticsService.GetReadingDataRank(topCount));
}
/// 按Rank统计Reviewer 数量[New]
[HttpGet, Route("getReviewersByRank")]
public IResponseOutput> GetReviewersByRank()
{
return ResponseOutput.Ok(_statisticsService.GetReviewersByRank());
}
/// 最近几个季度入组人次[New] type==0 按照月份
[HttpGet, Route("GetEnrollDataByQuarter/{type:int}/{count:int}")]
public IResponseOutput> GetEnrollDataByQuarter(int type, int count)
{
return ResponseOutput.Ok(_statisticsService.GetEnrollDataByQuarter(type, count));
}
/// 参与项目数排行 [New]
[HttpGet, Route("getTrialCountRank/{topCount:int}")]
public IResponseOutput> GetTrialCountRank(int topCount)
{
return ResponseOutput.Ok(_statisticsService.GetTrialCountRank(topCount));
}
/// 最新工作量 (已确定的)[New]
[HttpGet, Route("getLatestWorkLoadList/{searchCount:int}")]
public IResponseOutput> GetLatestWorkLoadList(int searchCount)
{
return ResponseOutput.Ok(_statisticsService.GetLatestWorkLoadList(searchCount));
}
#endregion
}
}