using System;
using System.Collections.Generic;
using IRaCIS.Application.Interfaces;
using IRaCIS.Application.ViewModels;
using IRaCIS.Application.ViewModels.Pay;
using IRaCIS.Core.Application.Contracts.RequestAndResponse;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace IRaCIS.Api.Controllers
{
///
/// 费用查询(月度付费、月度付费明细、历史范围付费、历史范围付费明细、收入、收入支出分析)
///
[Route("financial")]
[ApiController, Authorize, ApiExplorerSettings(GroupName = "Financial")]
public class FinancialController : ControllerBase
{
private readonly IPaymentService _paymentService;
private readonly IExchangeRateService _exchangeRateService;
private readonly ICalculateService _calculateService;
public FinancialController(IPaymentService paymentService,
IExchangeRateService exchangeRateService,
ICalculateService calculateService)
{
_paymentService = paymentService;
_exchangeRateService = exchangeRateService;
_calculateService = calculateService;
}
///
/// 计算医生月度费用,并将计算的结果存入费用表
///
[HttpPost, Route("calculateMonthlyPayment")]
public IResponseOutput CalculateMonthlyPayment(CalculateDoctorAndMonthDTO param)
{
if (!ModelState.IsValid)
{
return ResponseOutput.NotOk("Invalid parameter.");
}
return _calculateService.CalculateMonthlyPayment(param, User.FindFirst("id").Value);
}
///
/// Financials /Monthly Payment 列表查询接口
///
[HttpPost, Route("getMonthlyPaymentList")]
public IResponseOutput GetMonthlyPaymentList(MonthlyPaymentQueryDTO queryParam)
{
return ResponseOutput.Ok(new PaymentDTO
{
CostList = _paymentService.GetMonthlyPaymentList(queryParam),
ExchangeRate = _exchangeRateService.GetExchangeRateByMonth(queryParam.StatisticsDate.ToString("yyyy-MM"))
});
}
///
/// Financials /MonthlyPaymentDetail 详情查询接口
///
[HttpPost, Route("getMonthlyPaymentDetailList/{paymentId:guid}/{doctorId:guid}/{yearMonth:datetime}")]
public IResponseOutput GetMonthlyPaymentDetailList(Guid paymentId, Guid doctorId, DateTime yearMonth)
{
return ResponseOutput.Ok(_paymentService.GetMonthlyPaymentDetailList(paymentId, doctorId, yearMonth));
}
///
/// NEW 导出Excel压缩包 数据获取
///
///
///
[HttpPost, Route("getReviewersMonthlyPaymentDetail")]
public IResponseOutput> GetReviewersMonthlyPaymentDetail(List manyReviewers)
{
return ResponseOutput.Ok(_paymentService.GetReviewersMonthlyPaymentDetail(manyReviewers));
}
///
/// 获取劳务费用列表
///
///
///
[HttpPost, Route("getLaborPaymentList")]
public IResponseOutput> GetLaborPaymentList(List paymentIds)
{
return ResponseOutput.Ok(_paymentService.GetLaborPaymentList(paymentIds));
}
///
/// 锁定医生费用,锁定后,无法变更该医生对应月份的费用和工作量[New]
///
[HttpPost, Route("lockMonthlyPayment")]
public IResponseOutput LockMonthlyPayment(LockPaymentDTO param)
{
var yearMonth = param.Month.ToString("yyyy-MM");
return _calculateService.UpdateLockStatus(param.ReviewerIdList, yearMonth, true);
}
///
/// Financials / Payment History 列表查询接口(已经支付锁定的数据,包含调整的)[New]
///
[HttpPost, Route("getPaymentHistoryList")]
public IResponseOutput> GetPaymentHistoryList(PaymentQueryDTO param)
{
return ResponseOutput.Ok(_paymentService.GetPaymentHistoryList(param)) ;
}
///
/// Financials / Payment History 详情接口[New]
///
[HttpPost, Route("getPaymentHistoryDetailList")]
public IResponseOutput> GetPaymentHistoryDetailList(VolumeQueryDTO param)
{
var result = _paymentService.GetPaymentHistoryDetailList(param);
return ResponseOutput.Ok(result);
}
///
/// Revenues列表接口,收入统计[New] 0是Detail 1是按照项目 2是按照人 3按照月份
///
[HttpPost, Route("getRevenuesStatistics")]
public IResponseOutput> GetRevenuesStatistics(StatisticsQueryDTO param)
{
var result = _paymentService.GetRevenuesList(param);
return ResponseOutput.Ok(result) ;
}
///
/// 收入支出分析接口,按照医生维度分析统计
///
[HttpPost, Route("getReviewerAnalysisList")]
public IResponseOutput> GetReviewerAnalysisList(AnalysisQueryDTO param)
{
return ResponseOutput.Ok(_paymentService.GetReviewerAnalysisList(param));
}
///
/// 收入支出分析接口,按照项目维度分析统计
///
[HttpPost, Route("getTrialAnalysisList")]
public IResponseOutput> GetTrialAnalysisList(TrialAnalysisQueryDTO param)
{
return ResponseOutput.Ok(_paymentService.GetTrialAnalysisList(param));
}
}
}