Compare commits

..

2 Commits

Author SHA1 Message Date
he 2cf4f5d280 修改计算金额为0 就不插入 2024-03-25 16:45:36 +08:00
he 21074a5ffe 只计算项目医生的信息 2024-02-23 10:48:58 +08:00
1 changed files with 41 additions and 23 deletions

View File

@ -13,6 +13,8 @@ using System.Linq.Expressions;
using IRaCIS.Core.Domain.Interfaces;
using IRaCIS.Core.Domain.Models;
using System.Data;
using System.Linq.Dynamic.Core;
using System.Drawing;
namespace IRaCIS.Application.Services
{
@ -23,9 +25,11 @@ namespace IRaCIS.Application.Services
private readonly IReviewerPayInfoRepository _doctorPayInfoRepository;
private readonly ITrialRepository _trialRepository;
private readonly IDoctorRepository _doctorRepository;
private readonly IWorkloadRepository _doctorWorkloadRepository;
private readonly IRankPriceRepository _rankPriceRepository;
private readonly IPaymentDetailRepository _paymentDetailRepository;
private readonly IUserTrialRepository _userTrialRepository;
private readonly IPaymentDetailRepository _paymentDetailRepository;
private readonly IVolumeRewardService _volumeRewardPriceService;
private readonly IExchangeRateRepository _exchangeRateRepository;
private readonly IPaymentAdjustmentRepository _payAdjustmentRepository;
@ -38,7 +42,8 @@ namespace IRaCIS.Application.Services
IDoctorRepository doctorRepository,
IWorkloadRepository workloadRepository,
IRankPriceRepository rankPriceRepository,
IPaymentDetailRepository paymentDetailRepository,
IUserTrialRepository userTrialRepository,
IPaymentDetailRepository paymentDetailRepository,
IVolumeRewardService volumeRewardService,
IExchangeRateRepository exchangeRateRepository,
IEnrollRepository enrollRepository,
@ -52,7 +57,8 @@ namespace IRaCIS.Application.Services
_doctorRepository = doctorRepository;
_doctorWorkloadRepository = workloadRepository;
_rankPriceRepository = rankPriceRepository;
_paymentDetailRepository = paymentDetailRepository;
this._userTrialRepository = userTrialRepository;
_paymentDetailRepository = paymentDetailRepository;
_volumeRewardPriceService = volumeRewardService;
_exchangeRateRepository = exchangeRateRepository;
_payAdjustmentRepository = paymentAdjustmentRepository;
@ -736,25 +742,33 @@ namespace IRaCIS.Application.Services
}
decimal totalUSD = award + totalNormal;//总费用
result = AddOrUpdateMonthlyPayment(new PaymentCommand
{
DoctorId = doctor,
Year = param.CalculateMonth.Year,
Month = param.CalculateMonth.Month,
PaymentUSD = totalUSD,
CalculateUser = token,
CalculateTime = DateTime.Now,
ExchangeRate = exchangeRate,
PaymentCNY = exchangeRate * totalUSD,
});
var paymentyearMonth = new DateTime(param.CalculateMonth.Year, param.CalculateMonth.Month, 1).ToString("yyyy-MM");
var paymentModel = _paymentRepository.GetAll().FirstOrDefault(t =>
t.DoctorId == doctor && t.YearMonth == paymentyearMonth);
reviewerPaymentUSDList.Add(new ReviewerPaymentUSD { DoctorId = doctor, PaymentUSD = totalUSD, RecordId = result.Data });
foreach (var detail in paymentDetailList)
{
detail.PaymentId = result.Data;
}
AddOrUpdateMonthlyPaymentDetail(paymentDetailList, result.Data);
// 计算金额为0 就不插入
if (totalUSD != 0 || paymentModel != null)
{
result = AddOrUpdateMonthlyPayment(new PaymentCommand
{
DoctorId = doctor,
Year = param.CalculateMonth.Year,
Month = param.CalculateMonth.Month,
PaymentUSD = totalUSD,
CalculateUser = token,
CalculateTime = DateTime.Now,
ExchangeRate = exchangeRate,
PaymentCNY = exchangeRate * totalUSD,
});
reviewerPaymentUSDList.Add(new ReviewerPaymentUSD { DoctorId = doctor, PaymentUSD = totalUSD, RecordId = result.Data });
foreach (var detail in paymentDetailList)
{
detail.PaymentId = result.Data;
}
AddOrUpdateMonthlyPaymentDetail(paymentDetailList, result.Data);
}
UpdatePaymentAdjustment(doctor, yearMonth);
}
@ -915,9 +929,13 @@ namespace IRaCIS.Application.Services
IsLock = x.IsLock,
DataFrom=x.DataFrom,
}).Distinct().ToList();
var doctor = _doctorRepository.GetAll().Select(x => x.Id).ToList();
doctor.ForEach(x =>
var doctorIds = _enrollRepository.GetAll().Select(x => x.DoctorId).Distinct().ToList();
var doctorList = _doctorRepository.GetAll().Where(x=> doctorIds.Contains(x.Id)).Select(x => x.Id).ToList();
doctorList.ForEach(x =>
{
if (!workloadlist.Any(y => y.DoctorId == x))