diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 9a606e0c4..8c0fb82d8 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -122,7 +122,7 @@ namespace IRaCIS.Core.Application.Service.Allocation { //var inOrder = _trialRepository.Where(t => t.Id == command.TrialId).Select(t => t.IsReadingTaskViewInOrder).FirstOrDefault(); - var inOrder = _trialReadingCriterionRepository.Where(t => t.Id == command.TrialReadingCriterionId).Select(t => t.IsReadingTaskViewInOrder).FirstOrDefault(); + //var inOrder = _trialReadingCriterionRepository.Where(t => t.Id == command.TrialReadingCriterionId).Select(t => t.IsReadingTaskViewInOrder).FirstOrDefault(); foreach (var subjectId in command.SubjectIdList) @@ -140,18 +140,18 @@ namespace IRaCIS.Core.Application.Service.Allocation Expression> updateWhere = t => t.TrialReadingCriterionId == command.TrialReadingCriterionId && t.SubjectId == subjectId && t.ArmEnum == doctorArm.ArmEnum && t.TrialId == command.TrialId && t.TaskAllocationState == TaskAllocationState.NotAllocate && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false; - if (inOrder) - { + //if (inOrder) + //{ + // //针对有序阅片 只分配< 最小的 不是一致性核查通过状态 和不是失访 的访视 的任务 + // if (await _subjectVisitRepository.AnyAsync(t => t.SubjectId == subjectId && t.CheckState != CheckStateEnum.CVPassed && t.IsLostVisit == false)) + // { + // var notCheckPassedMinVisitNum = await _subjectVisitRepository.Where(t => t.SubjectId == subjectId && t.CheckState != CheckStateEnum.CVPassed).OrderBy(t => t.VisitNum).Select(t => t.VisitNum).FirstOrDefaultAsync(); - if (await _subjectVisitRepository.AnyAsync(t => t.SubjectId == subjectId && t.CheckState != CheckStateEnum.CVPassed && t.IsLostVisit == false)) - { - var notCheckPassedMinVisitNum = await _subjectVisitRepository.Where(t => t.SubjectId == subjectId && t.CheckState != CheckStateEnum.CVPassed).OrderBy(t => t.VisitNum).Select(t => t.VisitNum).FirstOrDefaultAsync(); + // updateWhere = updateWhere.And(t => t.VisitTaskNum < notCheckPassedMinVisitNum); - updateWhere = updateWhere.And(t => t.VisitTaskNum < notCheckPassedMinVisitNum); + // } - } - - } + //} await _visitTaskRepository diff --git a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs index 5a8db49dd..0b723921d 100644 --- a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs @@ -307,9 +307,9 @@ namespace IRaCIS.Application.Services private async Task DealVisiTaskClinicalDataSignedAsync(Guid trialId, Guid subjectId, Guid readingId, bool isVisit, Guid trialReadingCritrialId) { //获取确认的临床数据配置 - var trialClinicalDataSetList = _clinicalDataTrialSetRepository.Where(t => t.TrialId == trialId && t.IsConfirm).ToList(); + var trialClinicalDataSetList = _clinicalDataTrialSetRepository.Where(t => t.TrialId == trialId && t.IsConfirm).Include(t => t.TrialClinicalDataSetCriteriaList).ToList(); - var criterionType = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == trialReadingCritrialId).Select(t => t.CriterionType).FirstOrDefaultAsync(); + //var criterionType = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == trialReadingCritrialId).Select(t => t.CriterionType).FirstOrDefaultAsync(); // 获取确认的项目标准 废弃 签名的时候 传递标准Id //var confirmedCtritrialList = _repository.Where(t => t.TrialId == trialId && t.ReadingInfoSignTime != null).Select(t => new { t.Id, t.CriterionType }).ToList(); @@ -326,11 +326,11 @@ namespace IRaCIS.Application.Services if (isBaseLine) { //CRC 的自动签名 不用管 只用处理PM 的就好 - needSignCount = trialClinicalDataSetList.Where(t => t.CriterionEnumList.Any(c => c == (int)criterionType) && (t.ClinicalDataLevel == ClinicalLevel.Subject || t.ClinicalDataLevel == ClinicalLevel.SubjectVisit) && t.UploadRole == UploadRole.PM).Count(); + needSignCount = trialClinicalDataSetList.Where(t => t.TrialClinicalDataSetCriteriaList.Any(c => c.TrialReadingCriterionId == trialReadingCritrialId) && (t.ClinicalDataLevel == ClinicalLevel.Subject || t.ClinicalDataLevel == ClinicalLevel.SubjectVisit) && t.UploadRole == UploadRole.PM).Count(); } else { - needSignCount = trialClinicalDataSetList.Where(t => t.CriterionEnumList.Any(c => c == (int)criterionType) && t.ClinicalDataLevel == ClinicalLevel.SubjectVisit && t.UploadRole == UploadRole.PM).Count(); + needSignCount = trialClinicalDataSetList.Where(t => t.TrialClinicalDataSetCriteriaList.Any(c => c.TrialReadingCriterionId == trialReadingCritrialId) && t.ClinicalDataLevel == ClinicalLevel.SubjectVisit && t.UploadRole == UploadRole.PM).Count(); } //可能仅仅CRC 基线 没有PM @@ -355,12 +355,12 @@ namespace IRaCIS.Application.Services //影像学 if (readingSetType == ReadingSetType.ImageReading) { - needSignCount = trialClinicalDataSetList.Where(t => t.CriterionEnumList.Any(c => c == (int)criterionType) && t.ClinicalDataLevel == ClinicalLevel.ImageRead).Count(); + needSignCount = trialClinicalDataSetList.Where(t => t.TrialClinicalDataSetCriteriaList.Any(c => c.TrialReadingCriterionId == trialReadingCritrialId) && t.ClinicalDataLevel == ClinicalLevel.ImageRead).Count(); } //肿瘤学 else { - needSignCount = trialClinicalDataSetList.Where(t => t.CriterionEnumList.Any(c => c == (int)criterionType) && t.ClinicalDataLevel == ClinicalLevel.OncologyRead).Count(); + needSignCount = trialClinicalDataSetList.Where(t => t.TrialClinicalDataSetCriteriaList.Any(c => c.TrialReadingCriterionId == trialReadingCritrialId) && t.ClinicalDataLevel == ClinicalLevel.OncologyRead).Count(); } //可能仅仅CRC 基线 没有PM