代码修改

master
he 2026-01-23 09:52:57 +08:00
parent 53cb7e302c
commit 6a09a76d61
6 changed files with 50 additions and 26 deletions

View File

@ -31,6 +31,7 @@ namespace IRaCIS.Application.Services
private readonly IUserDoctorRepository _userDoctorRepository; private readonly IUserDoctorRepository _userDoctorRepository;
private readonly ITrialRepository _trialRepository; private readonly ITrialRepository _trialRepository;
private readonly ITrialPaymentPriceRepository _TrialPaymentPrice; private readonly ITrialPaymentPriceRepository _TrialPaymentPrice;
private readonly ITrialRevenuesPriceRepository _trialRevenuesPriceRepository;
private readonly IMapper _mapper; private readonly IMapper _mapper;
public DoctorListQueryService(IDoctorRepository doctorInfoRepository, public DoctorListQueryService(IDoctorRepository doctorInfoRepository,
@ -41,6 +42,7 @@ namespace IRaCIS.Application.Services
IUserDoctorRepository userDoctorRepository, IUserDoctorRepository userDoctorRepository,
ITrialRepository trialRepository, ITrialRepository trialRepository,
ITrialPaymentPriceRepository trialPaymentPrice, ITrialPaymentPriceRepository trialPaymentPrice,
ITrialRevenuesPriceRepository trialRevenuesPriceRepository,
IMapper mapper IMapper mapper
) )
{ {
@ -48,6 +50,7 @@ namespace IRaCIS.Application.Services
_dictionaryRepository = dictionaryRepository; _dictionaryRepository = dictionaryRepository;
_hospitalRepository = hospitalRepository; _hospitalRepository = hospitalRepository;
_TrialPaymentPrice = trialPaymentPrice; _TrialPaymentPrice = trialPaymentPrice;
_trialRevenuesPriceRepository = trialRevenuesPriceRepository;
_enrollRepository = intoGroupRepository; _enrollRepository = intoGroupRepository;
_enrollDetailRepository = intoGroupDetailRepository; _enrollDetailRepository = intoGroupDetailRepository;
@ -165,6 +168,8 @@ namespace IRaCIS.Application.Services
var costStatisticsQueryable = from enroll in _enrollRepository.GetAll().Where(t => t.TrialId == challengeQuery.TrialId) var costStatisticsQueryable = from enroll in _enrollRepository.GetAll().Where(t => t.TrialId == challengeQuery.TrialId)
join dociorc in _doctorRepository.GetAll() on enroll.DoctorId equals dociorc.Id join dociorc in _doctorRepository.GetAll() on enroll.DoctorId equals dociorc.Id
join price in _TrialPaymentPrice.GetAll() on enroll.TrialId equals price.TrialId join price in _TrialPaymentPrice.GetAll() on enroll.TrialId equals price.TrialId
join trialRevenuesPrice in _trialRevenuesPriceRepository.GetAll() on enroll.TrialId equals trialRevenuesPrice.TrialId into temp
from trialRevenuesPrice in temp.DefaultIfEmpty()
select new EnrollViewModel() select new EnrollViewModel()
{ {
ChineseName = dociorc.ChineseName, ChineseName = dociorc.ChineseName,
@ -189,7 +194,7 @@ namespace IRaCIS.Application.Services
AdditionalCharge1 = enroll.AdditionalCharge1, AdditionalCharge1 = enroll.AdditionalCharge1,
AdditionalCharge2 = enroll.AdditionalCharge2, AdditionalCharge2 = enroll.AdditionalCharge2,
AdditionalCharge3 = enroll.AdditionalCharge3, AdditionalCharge3 = enroll.AdditionalCharge3,
Note = enroll.Note, Note = trialRevenuesPrice.Note,
}; };

View File

@ -1,4 +1,4 @@
using AutoMapper; using AutoMapper;
using AutoMapper.QueryableExtensions; using AutoMapper.QueryableExtensions;
using IRaCIS.Application.Interfaces; using IRaCIS.Application.Interfaces;
using IRaCIS.Application.ViewModels; using IRaCIS.Application.ViewModels;
@ -34,6 +34,7 @@ namespace IRaCIS.Application.Services
private readonly IExchangeRateRepository _exchangeRateRepository; private readonly IExchangeRateRepository _exchangeRateRepository;
private readonly IPaymentAdjustmentRepository _payAdjustmentRepository; private readonly IPaymentAdjustmentRepository _payAdjustmentRepository;
private readonly IEnrollRepository _enrollRepository; private readonly IEnrollRepository _enrollRepository;
private readonly ITrialRevenuesPriceRepository _trialRevenuesPriceRepository;
private readonly IMapper _mapper; private readonly IMapper _mapper;
public CalculateService(IPaymentRepository paymentRepository, ITrialPaymentPriceRepository trialPaymentPriceRepository, public CalculateService(IPaymentRepository paymentRepository, ITrialPaymentPriceRepository trialPaymentPriceRepository,
@ -41,12 +42,13 @@ namespace IRaCIS.Application.Services
ITrialRepository trialRepository, ITrialRepository trialRepository,
IDoctorRepository doctorRepository, IDoctorRepository doctorRepository,
IWorkloadRepository workloadRepository, IWorkloadRepository workloadRepository,
IRankPriceRepository rankPriceRepository, IRankPriceRepository rankPriceRepository,
IUserTrialRepository userTrialRepository, IUserTrialRepository userTrialRepository,
IPaymentDetailRepository paymentDetailRepository, IPaymentDetailRepository paymentDetailRepository,
IVolumeRewardService volumeRewardService, IVolumeRewardService volumeRewardService,
IExchangeRateRepository exchangeRateRepository, IExchangeRateRepository exchangeRateRepository,
IEnrollRepository enrollRepository, IEnrollRepository enrollRepository,
ITrialRevenuesPriceRepository trialRevenuesPriceRepository,
IPaymentAdjustmentRepository paymentAdjustmentRepository, IMapper mapper) IPaymentAdjustmentRepository paymentAdjustmentRepository, IMapper mapper)
{ {
_paymentRepository = paymentRepository; _paymentRepository = paymentRepository;
@ -57,11 +59,12 @@ namespace IRaCIS.Application.Services
_doctorRepository = doctorRepository; _doctorRepository = doctorRepository;
_doctorWorkloadRepository = workloadRepository; _doctorWorkloadRepository = workloadRepository;
_rankPriceRepository = rankPriceRepository; _rankPriceRepository = rankPriceRepository;
this._userTrialRepository = userTrialRepository; this._userTrialRepository = userTrialRepository;
_paymentDetailRepository = paymentDetailRepository; _paymentDetailRepository = paymentDetailRepository;
_volumeRewardPriceService = volumeRewardService; _volumeRewardPriceService = volumeRewardService;
_exchangeRateRepository = exchangeRateRepository; _exchangeRateRepository = exchangeRateRepository;
_payAdjustmentRepository = paymentAdjustmentRepository; _payAdjustmentRepository = paymentAdjustmentRepository;
_trialRevenuesPriceRepository = trialRevenuesPriceRepository;
_mapper = mapper; _mapper = mapper;
} }
@ -87,6 +90,8 @@ namespace IRaCIS.Application.Services
from trialPay in temp.DefaultIfEmpty() from trialPay in temp.DefaultIfEmpty()
join doctorPayInfo in _doctorPayInfoRepository.GetAll() on doctor.Id equals doctorPayInfo.DoctorId join doctorPayInfo in _doctorPayInfoRepository.GetAll() on doctor.Id equals doctorPayInfo.DoctorId
join rankPrice in _rankPriceRepository.GetAll() on doctorPayInfo.RankId equals rankPrice.Id join rankPrice in _rankPriceRepository.GetAll() on doctorPayInfo.RankId equals rankPrice.Id
join trialRevenuesPrice in _trialRevenuesPriceRepository.GetAll() on trial.Id equals trialRevenuesPrice.TrialId into trialRevenuesPricetemp
from trialRevenuesPrice in trialRevenuesPricetemp.DefaultIfEmpty()
select new CalculatePaymentDTO() select new CalculatePaymentDTO()
{ {
Id = workLoad.Id, Id = workLoad.Id,
@ -109,7 +114,7 @@ namespace IRaCIS.Application.Services
AdditionalCharge1 = workLoad.AdditionalCharge1, AdditionalCharge1 = workLoad.AdditionalCharge1,
AdditionalCharge2 = workLoad.AdditionalCharge2, AdditionalCharge2 = workLoad.AdditionalCharge2,
AdditionalCharge3 = workLoad.AdditionalCharge3, AdditionalCharge3 = workLoad.AdditionalCharge3,
Note = workLoad.Note, Note = trialRevenuesPrice.Note,
TrialAdditional = trialPay.TrialAdditional, TrialAdditional = trialPay.TrialAdditional,
PersonalAdditional = doctorPayInfo.Additional, PersonalAdditional = doctorPayInfo.Additional,

View File

@ -1,4 +1,4 @@
using AutoMapper; using AutoMapper;
using AutoMapper.QueryableExtensions; using AutoMapper.QueryableExtensions;
using IRaCIS.Application.ExpressionExtend; using IRaCIS.Application.ExpressionExtend;
using IRaCIS.Application.Interfaces; using IRaCIS.Application.Interfaces;
@ -258,6 +258,8 @@ namespace IRaCIS.Application.Services
workLoadQueryable = from workLoad in _doctorWorkloadRepository.GetAll().Where(workloadLambda.And(t => t.DataFrom == (int)WorkLoadFromStatus.CRO)) workLoadQueryable = from workLoad in _doctorWorkloadRepository.GetAll().Where(workloadLambda.And(t => t.DataFrom == (int)WorkLoadFromStatus.CRO))
join doctor in _doctorRepository.GetAll() on workLoad.DoctorId equals doctor.Id join doctor in _doctorRepository.GetAll() on workLoad.DoctorId equals doctor.Id
join trial in _trialRepository.GetAll() on workLoad.TrialId equals trial.Id join trial in _trialRepository.GetAll() on workLoad.TrialId equals trial.Id
join trialRevenuesPrice in _trialRevenuesPriceRepository.GetAll() on trial.Id equals trialRevenuesPrice.TrialId into temp
from trialRevenuesPrice in temp.DefaultIfEmpty()
select new WorkLoadDetailDTO() select new WorkLoadDetailDTO()
{ {
@ -291,7 +293,7 @@ namespace IRaCIS.Application.Services
AdditionalCharge1 = workLoad.AdditionalCharge1, AdditionalCharge1 = workLoad.AdditionalCharge1,
AdditionalCharge2 = workLoad.AdditionalCharge2, AdditionalCharge2 = workLoad.AdditionalCharge2,
AdditionalCharge3 = workLoad.AdditionalCharge3, AdditionalCharge3 = workLoad.AdditionalCharge3,
Note = workLoad.Note, Note = trialRevenuesPrice.Note,
IsLock = workLoad.IsLock IsLock = workLoad.IsLock
}; };
tempWorkload.AddRange(workLoadQueryable.ToList()); tempWorkload.AddRange(workLoadQueryable.ToList());
@ -303,6 +305,8 @@ namespace IRaCIS.Application.Services
workLoadQueryable = from workLoad in _doctorWorkloadRepository.GetAll().Where(workloadLambda.And(t => t.DataFrom == (int)WorkLoadFromStatus.FinalConfirm)) workLoadQueryable = from workLoad in _doctorWorkloadRepository.GetAll().Where(workloadLambda.And(t => t.DataFrom == (int)WorkLoadFromStatus.FinalConfirm))
join doctor in _doctorRepository.GetAll() on workLoad.DoctorId equals doctor.Id join doctor in _doctorRepository.GetAll() on workLoad.DoctorId equals doctor.Id
join trial in _trialRepository.GetAll() on workLoad.TrialId equals trial.Id join trial in _trialRepository.GetAll() on workLoad.TrialId equals trial.Id
join trialRevenuesPrice in _trialRevenuesPriceRepository.GetAll() on trial.Id equals trialRevenuesPrice.TrialId into temp
from trialRevenuesPrice in temp.DefaultIfEmpty()
select new WorkLoadDetailDTO() select new WorkLoadDetailDTO()
{ {
@ -335,7 +339,7 @@ namespace IRaCIS.Application.Services
AdditionalCharge1 = workLoad.AdditionalCharge1, AdditionalCharge1 = workLoad.AdditionalCharge1,
AdditionalCharge2 = workLoad.AdditionalCharge2, AdditionalCharge2 = workLoad.AdditionalCharge2,
AdditionalCharge3 = workLoad.AdditionalCharge3, AdditionalCharge3 = workLoad.AdditionalCharge3,
Note = workLoad.Note, Note = trialRevenuesPrice.Note,
IsLock = workLoad.IsLock IsLock = workLoad.IsLock
}; };
tempWorkload.AddRange(workLoadQueryable.ToList()); tempWorkload.AddRange(workLoadQueryable.ToList());
@ -364,10 +368,15 @@ namespace IRaCIS.Application.Services
AdjudicationIn48H = g.Sum(workLoad => workLoad.AdjudicationIn48H), AdjudicationIn48H = g.Sum(workLoad => workLoad.AdjudicationIn48H),
Training = g.Sum(workLoad => workLoad.Training), Training = g.Sum(workLoad => workLoad.Training),
Downtime = g.Sum(workLoad => workLoad.Downtime) Downtime = g.Sum(workLoad => workLoad.Downtime),
AdditionalCharge1 = g.Sum(workLoad => workLoad.AdditionalCharge1),
AdditionalCharge2 = g.Sum(workLoad => workLoad.AdditionalCharge2),
AdditionalCharge3 = g.Sum(workLoad => workLoad.AdditionalCharge3)
}) })
join doctor in _doctorRepository.GetAll() on workLoad.DoctorId equals doctor.Id join doctor in _doctorRepository.GetAll() on workLoad.DoctorId equals doctor.Id
join trial in _trialRepository.GetAll() on workLoad.TrialId equals trial.Id join trial in _trialRepository.GetAll() on workLoad.TrialId equals trial.Id
join trialRevenuesPrice in _trialRevenuesPriceRepository.GetAll() on trial.Id equals trialRevenuesPrice.TrialId into temp
from trialRevenuesPrice in temp.DefaultIfEmpty()
select new WorkLoadDetailDTO() select new WorkLoadDetailDTO()
{ {
Id = workLoad.Id, Id = workLoad.Id,
@ -393,6 +402,10 @@ namespace IRaCIS.Application.Services
Training = workLoad.Training, Training = workLoad.Training,
Downtime = workLoad.Downtime, Downtime = workLoad.Downtime,
AdditionalCharge1 = workLoad.AdditionalCharge1,
AdditionalCharge2 = workLoad.AdditionalCharge2,
AdditionalCharge3 = workLoad.AdditionalCharge3,
Note = trialRevenuesPrice.Note,
IsLock = workLoad.IsLock IsLock = workLoad.IsLock
}; };
tempWorkload.AddRange(workLoadQueryable.ToList()); tempWorkload.AddRange(workLoadQueryable.ToList());
@ -430,6 +443,8 @@ namespace IRaCIS.Application.Services
var workLoadQueryable = from workLoad in _doctorWorkloadRepository.GetAll().Where(workloadLambda) var workLoadQueryable = from workLoad in _doctorWorkloadRepository.GetAll().Where(workloadLambda)
join doctor in _doctorRepository.GetAll() on workLoad.DoctorId equals doctor.Id join doctor in _doctorRepository.GetAll() on workLoad.DoctorId equals doctor.Id
join trial in _trialRepository.GetAll() on workLoad.TrialId equals trial.Id join trial in _trialRepository.GetAll() on workLoad.TrialId equals trial.Id
join trialRevenuesPrice in _trialRevenuesPriceRepository.GetAll() on trial.Id equals trialRevenuesPrice.TrialId into temp
from trialRevenuesPrice in temp.DefaultIfEmpty()
select new WorkLoadDetailViewModel() select new WorkLoadDetailViewModel()
{ {
@ -461,7 +476,7 @@ namespace IRaCIS.Application.Services
AdditionalCharge1 = workLoad.AdditionalCharge1, AdditionalCharge1 = workLoad.AdditionalCharge1,
AdditionalCharge2 = workLoad.AdditionalCharge2, AdditionalCharge2 = workLoad.AdditionalCharge2,
AdditionalCharge3 = workLoad.AdditionalCharge3, AdditionalCharge3 = workLoad.AdditionalCharge3,
Note = workLoad.Note, Note = trialRevenuesPrice.Note,
IsLock = workLoad.IsLock IsLock = workLoad.IsLock
}; };
@ -674,7 +689,6 @@ namespace IRaCIS.Application.Services
AdditionalCharge1 = workLoadAddOrUpdateModel.AdditionalCharge1, AdditionalCharge1 = workLoadAddOrUpdateModel.AdditionalCharge1,
AdditionalCharge2 = workLoadAddOrUpdateModel.AdditionalCharge2, AdditionalCharge2 = workLoadAddOrUpdateModel.AdditionalCharge2,
AdditionalCharge3 = workLoadAddOrUpdateModel.AdditionalCharge3, AdditionalCharge3 = workLoadAddOrUpdateModel.AdditionalCharge3,
Note = workLoadAddOrUpdateModel.Note,
UpdateTime = DateTime.Now, UpdateTime = DateTime.Now,
UpdateUserId = userId, UpdateUserId = userId,

View File

@ -38,7 +38,7 @@ namespace IRaCIS.Core.Domain.Models
public decimal AdditionalCharge1 { get; set; } public decimal AdditionalCharge1 { get; set; }
public decimal AdditionalCharge2 { get; set; } public decimal AdditionalCharge2 { get; set; }
public decimal AdditionalCharge3 { get; set; } public decimal AdditionalCharge3 { get; set; }
public string Note { get; set; } //public string Note { get; set; }
public int CreateUserType { get; set; } public int CreateUserType { get; set; }

View File

@ -57,7 +57,7 @@ namespace IRaCIS.Core.Domain.Models
public decimal? AdditionalCharge1 { get; set; } public decimal? AdditionalCharge1 { get; set; }
public decimal? AdditionalCharge2 { get; set; } public decimal? AdditionalCharge2 { get; set; }
public decimal? AdditionalCharge3 { get; set; } public decimal? AdditionalCharge3 { get; set; }
public string Note { get; set; } = string.Empty; //public string Note { get; set; } = string.Empty;
#endregion #endregion

View File

@ -17,11 +17,11 @@ IF not exists(select * from sys.columns where name='AdditionalCharge3' and [obje
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'扩展付费项3', @level0type = N'SCHEMA', @level0name = 'dbo', @level1type = N'TABLE', @level1name = 'Enroll', @level2type = N'COLUMN', @level2name = 'AdditionalCharge3'; EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'扩展付费项3', @level0type = N'SCHEMA', @level0name = 'dbo', @level1type = N'TABLE', @level1name = 'Enroll', @level2type = N'COLUMN', @level2name = 'AdditionalCharge3';
END END
IF not exists(select * from sys.columns where name='Note' and [object_id]=object_id(N'Enroll')) --IF not exists(select * from sys.columns where name='Note' and [object_id]=object_id(N'Enroll'))
BEGIN -- BEGIN
alter table Enroll add Note nvarchar(1000) NULL -- alter table Enroll add Note nvarchar(1000) NULL
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'扩展付费项说明', @level0type = N'SCHEMA', @level0name = 'dbo', @level1type = N'TABLE', @level1name = 'Enroll', @level2type = N'COLUMN', @level2name = 'Note'; -- EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'扩展付费项说明', @level0type = N'SCHEMA', @level0name = 'dbo', @level1type = N'TABLE', @level1name = 'Enroll', @level2type = N'COLUMN', @level2name = 'Note';
END -- END
-- 2. TrialRevenuesPrice 表 -- 2. TrialRevenuesPrice 表
IF not exists(select * from sys.columns where name='AdditionalCharge1' and [object_id]=object_id(N'TrialRevenuesPrice')) IF not exists(select * from sys.columns where name='AdditionalCharge1' and [object_id]=object_id(N'TrialRevenuesPrice'))
@ -67,11 +67,11 @@ IF not exists(select * from sys.columns where name='AdditionalCharge3' and [obje
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'扩展付费项3', @level0type = N'SCHEMA', @level0name = 'dbo', @level1type = N'TABLE', @level1name = 'DoctorWorkload', @level2type = N'COLUMN', @level2name = 'AdditionalCharge3'; EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'扩展付费项3', @level0type = N'SCHEMA', @level0name = 'dbo', @level1type = N'TABLE', @level1name = 'DoctorWorkload', @level2type = N'COLUMN', @level2name = 'AdditionalCharge3';
END END
IF not exists(select * from sys.columns where name='Note' and [object_id]=object_id(N'DoctorWorkload')) --IF not exists(select * from sys.columns where name='Note' and [object_id]=object_id(N'DoctorWorkload'))
BEGIN -- BEGIN
alter table DoctorWorkload add Note nvarchar(1000) NULL -- alter table DoctorWorkload add Note nvarchar(1000) NULL
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'扩展付费项说明', @level0type = N'SCHEMA', @level0name = 'dbo', @level1type = N'TABLE', @level1name = 'DoctorWorkload', @level2type = N'COLUMN', @level2name = 'Note'; -- EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'扩展付费项说明', @level0type = N'SCHEMA', @level0name = 'dbo', @level1type = N'TABLE', @level1name = 'DoctorWorkload', @level2type = N'COLUMN', @level2name = 'Note';
END -- END
-- 4. TrialRevenuesPriceVerification 表 (类型保持为 bit) -- 4. TrialRevenuesPriceVerification 表 (类型保持为 bit)
IF not exists(select * from sys.columns where name='AdditionalCharge1' and [object_id]=object_id(N'TrialRevenuesPriceVerification')) IF not exists(select * from sys.columns where name='AdditionalCharge1' and [object_id]=object_id(N'TrialRevenuesPriceVerification'))