构造函数优化
continuous-integration/drone/push Build is passing

This commit is contained in:
hang
2024-08-22 21:37:56 +08:00
parent 47ec4a5e7e
commit 22b1a839ba
102 changed files with 1111 additions and 2866 deletions
@@ -11,46 +11,22 @@ using Panda.DynamicWebApi.Attributes;
namespace IRaCIS.Application.Services
{
public class CalculateService :BaseService, ICalculateService
public class CalculateService(
IRepository<Payment> _paymentRepository,
IRepository<TrialPaymentPrice> _trialPaymentRepository,
IRepository<ReviewerPayInformation> _doctorPayInfoRepository,
IRepository<Trial> _trialRepository,
IRepository<Doctor> _doctorRepository,
IRepository<Workload> _doctorWorkloadRepository,
IRepository<RankPrice> _rankPriceRepository,
IRepository<PaymentDetail> _paymentDetailRepository,
IVolumeRewardService _volumeRewardPriceService,
IRepository<ExchangeRate> _exchangeRateRepository,
IRepository<PaymentAdjustment> _payAdjustmentRepository,
IRepository<Enroll> _enrollRepository)
: BaseService, ICalculateService
{
private readonly IRepository<Payment> _paymentRepository;
private readonly IRepository<TrialPaymentPrice> _trialPaymentRepository;
private readonly IRepository<ReviewerPayInformation> _doctorPayInfoRepository;
private readonly IRepository<Trial> _trialRepository;
private readonly IRepository<Doctor> _doctorRepository;
private readonly IRepository<Workload> _doctorWorkloadRepository;
private readonly IRepository<RankPrice> _rankPriceRepository;
private readonly IRepository<PaymentDetail> _paymentDetailRepository;
private readonly IVolumeRewardService _volumeRewardPriceService;
private readonly IRepository<ExchangeRate> _exchangeRateRepository;
private readonly IRepository<PaymentAdjustment> _payAdjustmentRepository;
private readonly IRepository<Enroll> _enrollRepository;
public CalculateService(IRepository<Payment> paymentRepository, IRepository<TrialPaymentPrice> trialPaymentPriceRepository,
IRepository<ReviewerPayInformation> reviewerPayInfoRepository,
IRepository<Trial> trialRepository,
IRepository<Doctor> doctorRepository,
IRepository<Workload> workloadRepository,
IRepository<RankPrice> rankPriceRepository,
IRepository<PaymentDetail> paymentDetailRepository,
IVolumeRewardService volumeRewardService,
IRepository<ExchangeRate> exchangeRateRepository,
IRepository<Enroll> EnrollRepository,
IRepository<PaymentAdjustment> paymentAdjustmentRepository)
{
_paymentRepository = paymentRepository;
_trialPaymentRepository = trialPaymentPriceRepository;
_doctorPayInfoRepository = reviewerPayInfoRepository;
_trialRepository = trialRepository;
_doctorRepository = doctorRepository;
_doctorWorkloadRepository = workloadRepository;
_rankPriceRepository = rankPriceRepository;
_paymentDetailRepository = paymentDetailRepository;
_volumeRewardPriceService = volumeRewardService;
_exchangeRateRepository = exchangeRateRepository;
_payAdjustmentRepository = paymentAdjustmentRepository;
this._enrollRepository = EnrollRepository;
}
/// <summary>
/// 获取某个月下的某些医生最终确认的工作量,用于计算月度费用
@@ -11,16 +11,12 @@ namespace IRaCIS.Application.Services
{
[ApiExplorerSettings(GroupName = "Financial")]
public class ExchangeRateService : BaseService, IExchangeRateService
public class ExchangeRateService(
IRepository<ExchangeRate> _exchangeRateRepository,
IRepository<Payment> _paymentRepository)
: BaseService, IExchangeRateService
{
private readonly IRepository<ExchangeRate> _exchangeRateRepository;
private readonly IRepository<Payment> _paymentRepository;
public ExchangeRateService(IRepository<ExchangeRate> exchangeRateRepository, IRepository<Payment> paymentRepository)
{
_exchangeRateRepository = exchangeRateRepository;
_paymentRepository = paymentRepository;
}
[NonDynamicMethod]
public async Task<IResponseOutput> AddOrUpdateExchangeRate(ExchangeRateCommand model)
@@ -10,55 +10,23 @@ using System.Linq.Dynamic.Core;
namespace IRaCIS.Application.Services
{
[ ApiExplorerSettings(GroupName = "Financial")]
public class FinancialService : BaseService, IPaymentService
public class FinancialService(
IRepository<Payment> _paymentRepository,
IRepository<ReviewerPayInformation> _doctorPayInfoRepository,
IRepository<TrialPaymentPrice> _trialPaymentPriceRepository,
IRepository<Trial> _trialRepository,
IRepository<Doctor> _doctorRepository,
IRepository<RankPrice> _rankPriceRepository,
IRepository<PaymentDetail> _paymentDetailRepository,
IRepository<CRO> _croRepository,
IRepository<Workload> _workloadRepository,
IRepository<TrialRevenuesPrice> _trialRevenuePriceRepository,
IRepository<PaymentAdjustment> _payAdjustmentRepository,
IRepository<Enroll> _enrollRepository,
IRepository<Workload> _doctorWorkloadRepository)
: BaseService, IPaymentService
{
private readonly IRepository<Payment> _paymentRepository;
private readonly IRepository<ReviewerPayInformation> _doctorPayInfoRepository;
private readonly IRepository<TrialPaymentPrice> _TrialPaymentPriceRepository;
private readonly IRepository<Trial> _trialRepository;
private readonly IRepository<Doctor> _doctorRepository;
private readonly IRepository<RankPrice> _rankPriceRepository;
private readonly IRepository<PaymentDetail> _paymentDetailRepository;
private readonly IRepository<CRO> _croRepository;
private readonly IRepository<Workload> _workloadRepository;
private readonly IRepository<TrialRevenuesPrice> _trialRevenuePriceRepository;
private readonly IRepository<PaymentAdjustment> _payAdjustmentRepository;
private readonly IRepository<Enroll> _enrollRepository;
private readonly IRepository<Workload> _doctorWorkloadRepository;
public FinancialService(IRepository<Payment> costStatisticsRepository,
IRepository<ReviewerPayInformation> doctorPayInfoRepository,
IRepository<Trial> trialRepository,
IRepository<Doctor> doctorRepository,
IRepository<RankPrice> rankPriceRepository,
IRepository<PaymentDetail> costStatisticsDetailRepository,
IRepository<CRO> croCompanyRepository,
IRepository<Workload> workloadRepository,
IRepository<Enroll> intoGroupRepository,
IRepository<TrialPaymentPrice> trialPaymentPriceRepository,
IRepository<TrialRevenuesPrice> trialCostRepository,
IRepository<PaymentAdjustment> costAdjustmentRepository,
IRepository<Workload> doctoWorkloadRepository
)
{
_TrialPaymentPriceRepository = trialPaymentPriceRepository;
_paymentRepository = costStatisticsRepository;
_doctorPayInfoRepository = doctorPayInfoRepository;
_trialRepository = trialRepository;
_doctorRepository = doctorRepository;
_rankPriceRepository = rankPriceRepository;
_paymentDetailRepository = costStatisticsDetailRepository;
_croRepository = croCompanyRepository;
_enrollRepository = intoGroupRepository;
_workloadRepository = workloadRepository;
_trialRevenuePriceRepository = trialCostRepository;
_payAdjustmentRepository = costAdjustmentRepository;
_doctorWorkloadRepository = doctoWorkloadRepository;
}
/// <summary>
/// Financials /MonthlyPayment 列表查询接口
/// </summary>
@@ -187,7 +155,7 @@ namespace IRaCIS.Application.Services
//from enroll in _enrollRepository.Where(t => t.TrialId == challengeQuery.TrialId)
//join dociorc in _doctorRepository.Where() on enroll.DoctorId equals dociorc.Id
//join price in _TrialPaymentPriceRepository.Where() on enroll.TrialId equals price.TrialId
//join price in _trialPaymentPriceRepository.Where() on enroll.TrialId equals price.TrialId
//select new EnrollViewModel()
@@ -207,7 +175,7 @@ namespace IRaCIS.Application.Services
detailList = await (from pay in _paymentDetailRepository.Where(t => t.PaymentId == paymentId)
join enroll in _enrollRepository.Where() on new { pay.DoctorId, pay.TrialId } equals new { enroll.DoctorId, enroll.TrialId }
join price in _TrialPaymentPriceRepository.Where() on pay.TrialId equals price.TrialId
join price in _trialPaymentPriceRepository.Where() on pay.TrialId equals price.TrialId
orderby pay.ShowCodeOrder
orderby pay.ShowTypeOrder
select new PaymentDetailDTO()
@@ -234,7 +202,7 @@ namespace IRaCIS.Application.Services
var adjList =
await (from costAdjustment in _payAdjustmentRepository.Where(t => t.YearMonth == yearMonthStr&& t.ReviewerId == paymentId)
join enroll in _enrollRepository.Where() on new { costAdjustment.ReviewerId, costAdjustment.TrialId } equals new { ReviewerId= enroll.DoctorId, enroll.TrialId }
join price in _TrialPaymentPriceRepository.Where() on costAdjustment.TrialId equals price.TrialId
join price in _trialPaymentPriceRepository.Where() on costAdjustment.TrialId equals price.TrialId
select new PaymentDetailDTO()
@@ -8,23 +8,14 @@ using Panda.DynamicWebApi.Attributes;
namespace IRaCIS.Application.Services
{
[ApiExplorerSettings(GroupName = "Financial")]
public class PaymentAdjustmentService : BaseService, IPaymentAdjustmentService
public class PaymentAdjustmentService(
IRepository<PaymentAdjustment> _payAdjustmentRepository,
IRepository<Doctor> _doctorRepository,
IRepository<ExchangeRate> _exchangeRateRepository,
IRepository<Payment> _paymentRepository)
: BaseService, IPaymentAdjustmentService
{
private readonly IRepository<PaymentAdjustment> _payAdjustmentRepository;
private readonly IRepository<Doctor> _doctorRepository;
private readonly IRepository<ExchangeRate> _exchangeRateRepository;
private readonly IRepository<Payment> _paymentRepository;
public PaymentAdjustmentService(IRepository<PaymentAdjustment> costAdjustmentRepository, IRepository<Doctor> doctorRepository,
IRepository<ExchangeRate> exchangeRateRepository, IRepository<Payment> paymentRepository, IMapper mapper)
{
_payAdjustmentRepository = costAdjustmentRepository;
_doctorRepository = doctorRepository;
_exchangeRateRepository = exchangeRateRepository;
_paymentRepository = paymentRepository;
}
/// <summary>
/// 添加或更新费用调整[AUTH]
@@ -11,18 +11,12 @@ using Panda.DynamicWebApi.Attributes;
namespace IRaCIS.Application.Services
{
[ ApiExplorerSettings(GroupName = "Financial")]
public class RankPriceService : BaseService, IRankPriceService
public class RankPriceService(
IRepository<RankPrice> _rankPriceRepository,
IRepository<ReviewerPayInformation> _reviewerPayInfoRepository)
: BaseService, IRankPriceService
{
private readonly IRepository<RankPrice> _rankPriceRepository;
private readonly IRepository<ReviewerPayInformation> _reviewerPayInfoRepository;
public RankPriceService(IRepository<RankPrice> rankPriceRepository, IRepository<ReviewerPayInformation> reviewerPayInfoRepository,IMapper mapper)
{
_rankPriceRepository = rankPriceRepository;
_reviewerPayInfoRepository = reviewerPayInfoRepository;
}
[NonDynamicMethod]
public async Task<IResponseOutput> AddOrUpdateRankPrice(RankPriceCommand addOrUpdateModel, Guid userId)
@@ -11,23 +11,14 @@ using Panda.DynamicWebApi.Attributes;
namespace IRaCIS.Application.Services
{
[ ApiExplorerSettings(GroupName = "Financial")]
public class ReviewerPayInfoService : BaseService, IReviewerPayInfoService
public class ReviewerPayInfoService(
IRepository<ReviewerPayInformation> _doctorPayInfoRepository,
IRepository<Doctor> _doctorRepository,
IRepository<RankPrice> _rankPriceRepository,
IRepository<Hospital> _hospitalRepository)
: BaseService, IReviewerPayInfoService
{
private readonly IRepository<ReviewerPayInformation> _doctorPayInfoRepository;
private readonly IRepository<Doctor> _doctorRepository;
private readonly IRepository<RankPrice> _rankPriceRepository;
private readonly IRepository<Hospital> _hospitalRepository;
public ReviewerPayInfoService(IRepository<Doctor> doctorRepository, IRepository<ReviewerPayInformation> doctorPayInfoRepository,
IRepository<RankPrice> rankPriceRepository, IRepository<Hospital> hospitalRepository, IMapper mapper)
{
_doctorPayInfoRepository = doctorPayInfoRepository;
_doctorRepository = doctorRepository;
_rankPriceRepository = rankPriceRepository;
_hospitalRepository = hospitalRepository;
}
[NonDynamicMethod]
public async Task<IResponseOutput> AddOrUpdateReviewerPayInfo(ReviewerPayInfoCommand addOrUpdateModel, Guid userId)
{
@@ -8,27 +8,15 @@ using Panda.DynamicWebApi.Attributes;
namespace IRaCIS.Application.Services
{
[ApiExplorerSettings(GroupName = "Financial")]
public class TrialPaymentPriceService : BaseService, ITrialPaymentPriceService
public class TrialPaymentPriceService(
IRepository<TrialPaymentPrice> _trialExtRepository,
IRepository<Enroll> _enrollRepository,
IRepository<Doctor> _doctorRepository,
IRepository<CRO> _croRepository,
IRepository<Trial> _trialRepository)
: BaseService, ITrialPaymentPriceService
{
private readonly IRepository<TrialPaymentPrice> _trialExtRepository;
private readonly IRepository<Enroll> _enrollRepository;
private readonly IRepository<Doctor> _doctorRepository;
private readonly IRepository<CRO> _croRepository;
private readonly IRepository<Trial> _trialRepository;
public TrialPaymentPriceService(IRepository<Trial> trialRepository, IRepository<TrialPaymentPrice> trialExtRepository,
IRepository<Enroll> enrollRepository,
IRepository<Doctor> doctorRepository,
IRepository<CRO> croCompanyRepository, IMapper mapper)
{
_trialExtRepository = trialExtRepository;
_croRepository = croCompanyRepository;
_enrollRepository = enrollRepository;
_doctorRepository = doctorRepository;
_trialRepository = trialRepository;
}
/// <summary>
/// 添加或更新项目支付价格信息
@@ -10,25 +10,16 @@ using Panda.DynamicWebApi.Attributes;
namespace IRaCIS.Application.Services
{
[ ApiExplorerSettings(GroupName = "Financial")]
public class TrialRevenuesPriceService : BaseService, ITrialRevenuesPriceService
[ApiExplorerSettings(GroupName = "Financial")]
public class TrialRevenuesPriceService(
IRepository<Trial> _trialRepository,
IRepository<TrialRevenuesPrice> _trialRevenuesPriceRepository,
IRepository<CRO> _croRepository,
IRepository<Dictionary> _dictionaryRepository,
IRepository<TrialRevenuesPriceVerification> _trialRevenuesPriceVerificationRepository)
: BaseService, ITrialRevenuesPriceService
{
private readonly IRepository<Trial> _trialRepository;
private readonly IRepository<TrialRevenuesPrice> _trialRevenuesPriceRepository;
private readonly IRepository<CRO> _croRepository;
private readonly IRepository<Dictionary> _dictionaryRepository;
private readonly IRepository<TrialRevenuesPriceVerification> _trialRevenuesPriceVerificationRepository;
public TrialRevenuesPriceService(IRepository<Trial> trialRepository, IRepository<TrialRevenuesPrice> trialCostRepository, IRepository<CRO> croCompanyRepository, IRepository<Dictionary> dictionaryRepository, IRepository<TrialRevenuesPriceVerification> trialRevenuesPriceVerificationRepository, IMapper mapper)
{
_trialRepository = trialRepository;
_trialRevenuesPriceRepository = trialCostRepository;
_croRepository = croCompanyRepository;
_dictionaryRepository = dictionaryRepository;
_trialRevenuesPriceVerificationRepository = trialRevenuesPriceVerificationRepository;
}
public async Task<IResponseOutput> AddOrUpdateTrialRevenuesPrice(TrialRevenuesPriceDTO model)
{
@@ -52,7 +43,7 @@ namespace IRaCIS.Application.Services
{
var trialCost = _mapper.Map<TrialRevenuesPrice>(model);
await _trialRevenuesPriceRepository.AddAsync(trialCost);
var success = await _trialRevenuesPriceRepository.SaveChangesAsync();
var success = await _trialRevenuesPriceRepository.SaveChangesAsync();
return ResponseOutput.Result(success, trialCost.Id.ToString());
}
else//update
@@ -81,15 +72,15 @@ namespace IRaCIS.Application.Services
});
//删除所有有价格的记录 为true 表示有价格或者不需要价格 缺价格的为false
await _trialRevenuesPriceVerificationRepository.BatchDeleteNoTrackingAsync(t => t.TrialId == model.TrialId &&
t.Timepoint&&
t.TimepointIn24H&&
t.TimepointIn48H &&
t.Adjudication &&
t.AdjudicationIn24H &&
t.AdjudicationIn48H &&
t.Global &&
t.Training &&t.RefresherTraining);
await _trialRevenuesPriceVerificationRepository.BatchDeleteNoTrackingAsync(t => t.TrialId == model.TrialId &&
t.Timepoint &&
t.TimepointIn24H &&
t.TimepointIn48H &&
t.Adjudication &&
t.AdjudicationIn24H &&
t.AdjudicationIn48H &&
t.Global &&
t.Training && t.RefresherTraining);
@@ -110,9 +101,9 @@ namespace IRaCIS.Application.Services
[HttpPost]
public async Task<PageOutput<TrialRevenuesPriceDetialDTO>> GetTrialRevenuesPriceList(TrialRevenuesPriceQueryDTO inQuery)
{
var trialQueryable = from trial in _trialRepository.AsQueryable()
.Where(u => u.TrialCode.Contains(inQuery.KeyWord)|| u.Indication.Contains(inQuery.KeyWord))
.Where(u => u.TrialCode.Contains(inQuery.KeyWord) || u.Indication.Contains(inQuery.KeyWord))
.WhereIf(inQuery.CroId != null, o => o.CROId == inQuery.CroId)
join cro in _croRepository.AsQueryable() on trial.CROId equals cro.Id into CRO
from croInfo in CRO.DefaultIfEmpty()
@@ -138,13 +129,13 @@ namespace IRaCIS.Application.Services
Downtime = trialCostItem == null ? 0 : trialCostItem.Downtime,
Global = trialCostItem == null ? 0 : trialCostItem.Global,
Training = trialCostItem == null ? 0 : trialCostItem.Training,
RefresherTraining= trialCostItem == null ? 0 : trialCostItem.RefresherTraining,
RefresherTraining = trialCostItem == null ? 0 : trialCostItem.RefresherTraining,
Expedited = trial.Expedited
};
return await trialQueryable.ToPagedListAsync(inQuery);
}
@@ -11,21 +11,14 @@ namespace IRaCIS.Core.Application.Services
/// Financial---项目收入价格验证
/// </summary>
[ ApiExplorerSettings(GroupName = "Financial")]
public class TrialRevenuesPriceVerificationService : BaseService, ITrialRevenuesPriceVerificationService
public class TrialRevenuesPriceVerificationService(
IRepository<TrialRevenuesPriceVerification> _trialRevenuesPriceVerificationRepository,
IRepository<Trial> _trialRepository,
IRepository<Doctor> _doctorRepository,
IRepository<Payment> _paymentRepository)
: BaseService, ITrialRevenuesPriceVerificationService
{
private readonly IRepository<TrialRevenuesPriceVerification> _trialRevenuesPriceVerificationRepository;
private readonly IRepository<Trial> _trialRepository;
private readonly IRepository<Doctor> _doctorRepository;
private readonly IRepository<Payment> _paymentRepository;
public TrialRevenuesPriceVerificationService(IRepository<TrialRevenuesPriceVerification> trialRevenuesPriceVerificationRepository,
IRepository<Trial> trialRepository,IRepository<Doctor> doctorRepository,IRepository<Payment> paymentRepository)
{
_trialRevenuesPriceVerificationRepository = trialRevenuesPriceVerificationRepository;
_trialRepository = trialRepository;
_doctorRepository = doctorRepository;
_paymentRepository = paymentRepository;
}
[HttpPost]
public async Task<AnalysisVerifyResultDTO> GetAnalysisVerifyList(RevenusVerifyQueryDTO param)
{
@@ -11,16 +11,9 @@ using Panda.DynamicWebApi.Attributes;
namespace IRaCIS.Application.Services
{
[ ApiExplorerSettings(GroupName = "Financial")]
public class VolumeRewardService : BaseService, IVolumeRewardService
public class VolumeRewardService (IRepository<VolumeReward> _volumeRewardRepository) : BaseService, IVolumeRewardService
{
private readonly IRepository<VolumeReward> _volumeRewardRepository;
public VolumeRewardService(IRepository<VolumeReward> volumeRewardRepository,IMapper mapper)
{
_volumeRewardRepository = volumeRewardRepository;
}
/// <summary>
/// 批量添加或更新奖励费用单价
/// </summary>