|
|
|
@ -23,6 +23,9 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
private readonly IRepository<TrialRevenuesPrice> _trialRevenuesPriceRepository;
|
|
|
|
|
private readonly IRepository<TrialRevenuesPriceVerification> _trialRevenuesPriceVerificationRepository;
|
|
|
|
|
|
|
|
|
|
private readonly IRepository<EnrollReadingCriterion> _enrollReadingCriterionRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly IRepository<TaskAllocationRule> _taskAllocationRuleRepository;
|
|
|
|
|
public DoctorWorkloadService(IRepository<Trial> clinicalTrialProjectRepository,
|
|
|
|
|
IRepository<Enroll> intoGroupRepository,
|
|
|
|
@ -34,7 +37,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
IRepository<TrialRevenuesPrice> trialRevenuesPriceRepository,
|
|
|
|
|
IRepository<TaskAllocationRule> taskAllocationRuleRepository,
|
|
|
|
|
IRepository<TrialRevenuesPriceVerification> trialRevenuesPriceVerificationRepository,
|
|
|
|
|
IMapper mapper)
|
|
|
|
|
IRepository<EnrollReadingCriterion> enrollReadingCriterionRepository)
|
|
|
|
|
{
|
|
|
|
|
_taskAllocationRuleRepository = taskAllocationRuleRepository;
|
|
|
|
|
_trialRepository = clinicalTrialProjectRepository;
|
|
|
|
@ -46,6 +49,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
_costStatisticsRepository = costStatisticsRepository;
|
|
|
|
|
_trialRevenuesPriceRepository = trialRevenuesPriceRepository;
|
|
|
|
|
_trialRevenuesPriceVerificationRepository = trialRevenuesPriceVerificationRepository;
|
|
|
|
|
_enrollReadingCriterionRepository = enrollReadingCriterionRepository;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -105,6 +109,27 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public async Task<IResponseOutput> BatchSetCriterionJoinJoinAnalysis(List<SetCriterionJoinJoinAnalysisCommand> batchList)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
foreach (var item in batchList)
|
|
|
|
|
{
|
|
|
|
|
if (item.Id == null)
|
|
|
|
|
{
|
|
|
|
|
await _enrollReadingCriterionRepository.InsertFromDTOAsync(item);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
await _enrollReadingCriterionRepository.UpdateFromDTOAsync(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await _enrollReadingCriterionRepository.SaveChangesAsync();
|
|
|
|
|
|
|
|
|
|
return ResponseOutput.Ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -121,14 +146,14 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
var enroll = await _enrollRepository.FirstAsync(t => t.Id == inDto.EnrollId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_repository.Where<VisitTask>(t => t.TrialId == enroll.TrialId && t.DoctorUserId == enroll.DoctorUserId && t.TaskAllocationState == TaskAllocationState.Allocated && t.TrialReadingCriterionId==inDto.TrialReadingCriterionId).Any())
|
|
|
|
|
if (_repository.Where<VisitTask>(t => t.TrialId == enroll.TrialId && t.DoctorUserId == enroll.DoctorUserId && t.TaskAllocationState == TaskAllocationState.Allocated && t.TrialReadingCriterionId == inDto.TrialReadingCriterionId).Any())
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var readingCategoryList = await _enrollReadingCategoryRepository.Where(t => t.EnrollId == inDto.EnrollId && t.TrialReadingCriterionId == inDto.TrialReadingCriterionId).Select(t => t.ReadingCategory).ToListAsync();
|
|
|
|
|
|
|
|
|
|
if (readingCategoryList.Except(inDto.ReadingCategorys).Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
//---已分配任务,不允许减少阅片类型
|
|
|
|
|
//---已分配任务,不允许减少阅片类型
|
|
|
|
|
return ResponseOutput.NotOk(_localizer["DoctorWorkload_AssignType"]);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -150,7 +175,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
|
|
|
|
|
List<EnrollReadingCategory> enrollReadings = inDto.ReadingCategorys.Select(x => new EnrollReadingCategory()
|
|
|
|
|
{
|
|
|
|
|
TrialReadingCriterionId= inDto.TrialReadingCriterionId,
|
|
|
|
|
TrialReadingCriterionId = inDto.TrialReadingCriterionId,
|
|
|
|
|
EnrollId = inDto.EnrollId,
|
|
|
|
|
ReadingCategory = x
|
|
|
|
|
}).ToList();
|
|
|
|
@ -171,7 +196,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
|
|
|
|
public async Task<IResponseOutput> UpdateTrialReviewerState(SetEnrollEnableCommand inCommand)
|
|
|
|
|
{
|
|
|
|
|
await _taskAllocationRuleRepository.UpdatePartialFromQueryAsync(t => t.TrialId == inCommand.TrialId && t.EnrollId == inCommand.EnrollId, u => new TaskAllocationRule() { IsEnable = inCommand.IsEnable },true);
|
|
|
|
|
await _taskAllocationRuleRepository.UpdatePartialFromQueryAsync(t => t.TrialId == inCommand.TrialId && t.EnrollId == inCommand.EnrollId, u => new TaskAllocationRule() { IsEnable = inCommand.IsEnable }, true);
|
|
|
|
|
|
|
|
|
|
return ResponseOutput.Ok();
|
|
|
|
|
}
|
|
|
|
@ -182,7 +207,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("{trialId}/{doctorId}/{type}")]
|
|
|
|
|
[TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
|
|
|
|
|
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
|
|
|
|
//[Authorize(Policy = IRaCISPolicy.PM_APM)]
|
|
|
|
|
public async Task<IResponseOutput> UpdateReviewerReadingType(Guid trialId, Guid doctorId, int type)
|
|
|
|
|
{
|
|
|
|
@ -210,20 +235,28 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
join allocateRule in _taskAllocationRuleRepository.AsQueryable() on intoGroup.Id equals allocateRule.EnrollId
|
|
|
|
|
join doctor in _doctorRepository.AsQueryable() on intoGroup.DoctorId equals doctor.Id
|
|
|
|
|
join attachmentItem in _attachmentRepository.AsQueryable() on intoGroup.AttachmentId equals attachmentItem.Id into cc
|
|
|
|
|
from attachment in cc.DefaultIfEmpty()
|
|
|
|
|
from attachment in cc.DefaultIfEmpty()
|
|
|
|
|
|
|
|
|
|
select new WorkLoadAndAgreementDTO()
|
|
|
|
|
{
|
|
|
|
|
EnrollId = intoGroup.Id,
|
|
|
|
|
IsEnable = allocateRule.IsEnable,
|
|
|
|
|
|
|
|
|
|
TrialReadingCriterionList = intoGroup.Trial.ReadingQuestionCriterionTrialList.Where(t=>t.IsConfirm).Select(t=>new TrialReadingCriterionDto() { TrialReadingCriterionId=t.Id,TrialReadingCriterionName=t.CriterionName,CriterionType=t.CriterionType,IsOncologyReading=t.IsOncologyReading,IsArbitrationReading=t.IsArbitrationReading,IsGlobalReading=t.IsGlobalReading,ReadingInfoSignTime=t.ReadingInfoSignTime,ReadingType=t.ReadingType}).ToList(),
|
|
|
|
|
TrialReadingCriterionList = intoGroup.Trial.ReadingQuestionCriterionTrialList.Where(t => t.IsConfirm).Select(t => new TrialReadingCriterionDto() { TrialReadingCriterionId = t.Id, TrialReadingCriterionName = t.CriterionName, CriterionType = t.CriterionType, IsOncologyReading = t.IsOncologyReading, IsArbitrationReading = t.IsArbitrationReading, IsGlobalReading = t.IsGlobalReading, ReadingInfoSignTime = t.ReadingInfoSignTime, ReadingType = t.ReadingType }).ToList(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DoctorCriterionStatusList= intoGroup.EnrollReadingCriteriaList.Select(t=>new DoctorCriterionStatus()
|
|
|
|
|
{
|
|
|
|
|
EnrollId=t.Id,
|
|
|
|
|
Id=t.Id,
|
|
|
|
|
IsJoinAnalysis=t.IsJoinAnalysis,
|
|
|
|
|
TrialReadingCriterionId=t.TrialReadingCriterionId
|
|
|
|
|
}).ToList(),
|
|
|
|
|
|
|
|
|
|
CriterionReadingCategoryList =intoGroup.EnrollReadingCategoryList.Select(t=>new TrialCriterionReadingCategory() { EnrollId=t.EnrollId,ReadingCategory=t.ReadingCategory, TrialReadingCriterionId = t.TrialReadingCriterionId }).ToList(),
|
|
|
|
|
|
|
|
|
|
CriterionFileList = doctor.CriterionFileList.Where(x => x.IsEnable && (x.TrialId==null ||x.TrialId==trialId)).Select(x => new CriterionFile()
|
|
|
|
|
|
|
|
|
|
CriterionReadingCategoryList = intoGroup.EnrollReadingCategoryList.Select(t => new TrialCriterionReadingCategory() { EnrollId = t.EnrollId, ReadingCategory = t.ReadingCategory, TrialReadingCriterionId = t.TrialReadingCriterionId }).ToList(),
|
|
|
|
|
|
|
|
|
|
CriterionFileList = doctor.CriterionFileList.Where(x => x.IsEnable && (x.TrialId == null || x.TrialId == trialId)).Select(x => new CriterionFile()
|
|
|
|
|
{
|
|
|
|
|
CriterionType = x.CriterionType,
|
|
|
|
|
DoctorId = x.DoctorId,
|
|
|
|
@ -231,14 +264,14 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
FilePath = x.FilePath,
|
|
|
|
|
FileType = x.FileType,
|
|
|
|
|
Remark = x.Remark,
|
|
|
|
|
TrialReadingCriterionId=x.TrialReadingCriterionId,
|
|
|
|
|
TrialReadingCriterionId = x.TrialReadingCriterionId,
|
|
|
|
|
Id = x.Id
|
|
|
|
|
}).ToList(),
|
|
|
|
|
|
|
|
|
|
ReadingTaskStateList = doctor.User.VisitTaskList.Where(x => x.TaskState == TaskState.Effect && x.TrialId == trialId).Select(x => new DoctorUserTask()
|
|
|
|
|
{
|
|
|
|
|
ReadingTaskState = x.ReadingTaskState,
|
|
|
|
|
TrialReadingCriterionId=x.TrialReadingCriterionId,
|
|
|
|
|
TrialReadingCriterionId = x.TrialReadingCriterionId,
|
|
|
|
|
CriterionType = x.TrialReadingCriterion.CriterionType,
|
|
|
|
|
|
|
|
|
|
}).ToList(),
|
|
|
|
@ -249,7 +282,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
LastName = doctor.LastName,
|
|
|
|
|
FullName = doctor.FullName,
|
|
|
|
|
ChineseName = doctor.ChineseName,
|
|
|
|
|
UserName= intoGroup.DoctorUser.UserName,
|
|
|
|
|
UserName = intoGroup.DoctorUser.UserName,
|
|
|
|
|
|
|
|
|
|
OutEnrollTime = intoGroup.OutEnrollTime,
|
|
|
|
|
EnrollTime = intoGroup.EnrollTime,
|
|
|
|
@ -263,7 +296,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
|
|
|
|
|
return await doctorIntoGroupQueryable.ToPagedListAsync(doctorSearchModel.PageIndex, doctorSearchModel.PageSize, doctorSearchModel.SortField == "" ? "EnrollTime" : doctorSearchModel.SortField, doctorSearchModel.Asc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -659,7 +692,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
if (await _doctorWorkloadRepository.AnyAsync(workloadLambda))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//---This type of data can only have one
|
|
|
|
|
//---This type of data can only have one
|
|
|
|
|
return ResponseOutput.NotOk(_localizer["DoctorWorkload_Unique"]);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -671,7 +704,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
doctorworkloadLambda = doctorworkloadLambda.And(t => t.DataFrom == (int)WorkLoadFromStatus.Doctor);
|
|
|
|
|
if (await _doctorWorkloadRepository.AnyAsync(doctorworkloadLambda))
|
|
|
|
|
{
|
|
|
|
|
//---This type of data can only have one
|
|
|
|
|
//---This type of data can only have one
|
|
|
|
|
return ResponseOutput.NotOk(_localizer["DoctorWorkload_Unique"]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -701,7 +734,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
if (isLocked)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//---Expenses have been settled and workload cannot be modified.
|
|
|
|
|
//---Expenses have been settled and workload cannot be modified.
|
|
|
|
|
return ResponseOutput.NotOk(_localizer["DoctorWorkload_FeeSettled"]);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|