CostCalculationItem/IRaCIS.Core.API/Controllers/Financial/FinancialController.cs

184 lines
7.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Collections.Generic;
using System.IO;
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
{
/// <summary>
/// 费用查询(月度付费、月度付费明细、历史范围付费、历史范围付费明细、收入、收入支出分析)
/// </summary>
[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;
}
/// <summary>
/// 计算医生月度费用,并将计算的结果存入费用表
/// </summary>
[HttpPost, Route("calculateMonthlyPayment")]
public IResponseOutput CalculateMonthlyPayment(CalculateDoctorAndMonthDTO param)
{
if (!ModelState.IsValid)
{
return ResponseOutput.NotOk("Invalid parameter.");
}
return _calculateService.CalculateMonthlyPayment(param, User.FindFirst("id").Value);
}
/// <summary>
/// Financials /Monthly Payment 列表查询接口
/// </summary>
[HttpPost, Route("getMonthlyPaymentList")]
public IResponseOutput<PaymentDTO> GetMonthlyPaymentList(MonthlyPaymentQueryDTO queryParam)
{
return ResponseOutput.Ok(new PaymentDTO
{
CostList = _paymentService.GetMonthlyPaymentList(queryParam),
ExchangeRate = _exchangeRateService.GetExchangeRateByMonth(queryParam.StatisticsDate.ToString("yyyy-MM"))
});
}
/// <summary>
/// Financials /MonthlyPaymentDetail 详情查询接口
/// </summary>
[HttpPost, Route("getMonthlyPaymentDetailList/{paymentId:guid}/{doctorId:guid}/{yearMonth:datetime}")]
public IResponseOutput<PayDetailDTO> GetMonthlyPaymentDetailList(Guid paymentId, Guid doctorId, DateTime yearMonth)
{
return ResponseOutput.Ok(_paymentService.GetMonthlyPaymentDetailList(paymentId, doctorId, yearMonth));
}
/// <summary>
/// NEW 导出Excel压缩包 数据获取
/// </summary>
/// <param name="manyReviewers"></param>
/// <returns></returns>
[HttpPost, Route("getReviewersMonthlyPaymentDetail")]
public IResponseOutput<List<PayDetailDTO>> GetReviewersMonthlyPaymentDetail(List<MonthlyPaymentDetailQuery> manyReviewers)
{
return ResponseOutput.Ok(_paymentService.GetReviewersMonthlyPaymentDetail(manyReviewers));
}
/// <summary>
/// 获取劳务费用列表
/// </summary>
/// <param name="paymentIds"></param>
/// <returns></returns>
[HttpPost, Route("getLaborPaymentList")]
public IResponseOutput<List<LaborPayment>> GetLaborPaymentList(List<Guid> paymentIds)
{
return ResponseOutput.Ok(_paymentService.GetLaborPaymentList(paymentIds));
}
/// <summary>
/// 修改支付方式
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost, Route("ChangePaymentMethod")]
public IResponseOutput ChangePaymentMethod(ChangePaymentMethodInDto inDto)
{
_paymentService.ChangePaymentMethod(inDto);
return ResponseOutput.Ok(true);
}
[HttpPost, Route("ExportLaborPayment")]
public FileResult ExportLaborPayment(List<Guid> paymentIds)
{
Stream stream = _paymentService.ExportLaborPayment(paymentIds); ;
FileStreamResult actionresult = new FileStreamResult(stream, new Microsoft.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream"));
actionresult.FileDownloadName = "Payroll.zip";
return actionresult;
}
/// <summary>
/// 锁定医生费用,锁定后,无法变更该医生对应月份的费用和工作量[New]
/// </summary>
[HttpPost, Route("lockMonthlyPayment")]
public IResponseOutput LockMonthlyPayment(LockPaymentDTO param)
{
var yearMonth = param.Month.ToString("yyyy-MM");
return _calculateService.UpdateLockStatus(param.ReviewerIdList, yearMonth, true);
}
/// <summary>
/// Financials / Payment History 列表查询接口(已经支付锁定的数据,包含调整的)[New]
/// </summary>
[HttpPost, Route("getPaymentHistoryList")]
public IResponseOutput<PageOutput<MonthlyPaymentDTO>> GetPaymentHistoryList(PaymentQueryDTO param)
{
return ResponseOutput.Ok(_paymentService.GetPaymentHistoryList(param)) ;
}
/// <summary>
/// Financials / Payment History 详情接口[New]
/// </summary>
[HttpPost, Route("getPaymentHistoryDetailList")]
public IResponseOutput<List<VolumeStatisticsDTO>> GetPaymentHistoryDetailList(VolumeQueryDTO param)
{
var result = _paymentService.GetPaymentHistoryDetailList(param);
return ResponseOutput.Ok(result);
}
/// <summary>
/// Revenues列表接口收入统计[New] 0是Detail 1是按照项目 2是按照人 3按照月份
/// </summary>
[HttpPost, Route("getRevenuesStatistics")]
public IResponseOutput<PageOutput<RevenuesDTO>> GetRevenuesStatistics(StatisticsQueryDTO param)
{
var result = _paymentService.GetRevenuesList(param);
return ResponseOutput.Ok(result) ;
}
/// <summary>
/// 收入支出分析接口,按照医生维度分析统计
/// </summary>
[HttpPost, Route("getReviewerAnalysisList")]
public IResponseOutput<List<ReviewerAnalysisDTO>> GetReviewerAnalysisList(AnalysisQueryDTO param)
{
return ResponseOutput.Ok(_paymentService.GetReviewerAnalysisList(param));
}
/// <summary>
/// 收入支出分析接口,按照项目维度分析统计
/// </summary>
[HttpPost, Route("getTrialAnalysisList")]
public IResponseOutput<List<TrialAnalysisDTO>> GetTrialAnalysisList(TrialAnalysisQueryDTO param)
{
return ResponseOutput.Ok(_paymentService.GetTrialAnalysisList(param));
}
}
}