From 72ae929898689b77c6fc350c0967f4dd38f69c8c Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 14 Jul 2022 15:28:45 +0800 Subject: [PATCH] cc --- .../IRaCIS.Core.Application.xml | 2 +- .../DTO/TaskConsistentRuleViewModel.cs | 2 +- .../Allocation/TaskConsistentRuleService.cs | 23 +++++++++++++++---- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 9976acd9f..648b95e45 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -95,7 +95,7 @@ - 仅仅组内一致性时使用( + 仅仅自身一致性时使用( diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs index 03685097f..7b08dca6c 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs @@ -227,7 +227,7 @@ namespace IRaCIS.Core.Application.ViewModel { public Guid? Id { get; set; } public bool IsEnable { get; set; } - public string Note { get; set; } + public string Note { get; set; } = string.Empty; public Guid TrialId { get; set; } public int PlanSubjectCount { get; set; } public int PlanVisitCount { get; set; } diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs index 56dcd87e5..70bbe5c25 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs @@ -161,6 +161,8 @@ namespace IRaCIS.Core.Application.Service GenerataConsistentTaskList = subject.VisitTaskList.Where(t => t.IsHaveGeneratedTask == false).ToList() }); + await _visitTaskRepository.SaveChangesAsync(); + } } @@ -192,7 +194,11 @@ namespace IRaCIS.Core.Application.Service //所选访视数量 的访视 其中必有一个访视后有全局任务 if (filterObj.IsHaveReadingPeriod == true) { - visitTaskFilter = visitTaskFilter.And(t => t.Subject.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter).Any(u => u.VisitTaskNum == t.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global] && u.ReadingCategory == ReadingCategory.Global)); + //visitTaskFilter = visitTaskFilter.And(t => t.Subject.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter).Any(u => u.VisitTaskNum == t.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global] && u.ReadingCategory == ReadingCategory.Global)); + + //这里的过滤条件 不能用 where(comonTaskFilter) 会报错,奇怪的问题 只能重新写一遍 + visitTaskFilter = visitTaskFilter.And(c => c.Subject.SubjectVisitTaskList.Any(t => t.VisitTaskNum == c.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global] && t.ReadingCategory == ReadingCategory.Global && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned && + t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7) < DateTime.Now && (t.ReReadingApplyState == ReReadingApplyState.Default || t.ReReadingApplyState == ReReadingApplyState.Reject))); } @@ -305,6 +311,11 @@ namespace IRaCIS.Core.Application.Service var needAddDoctorUserIdList = configDoctorUserIdList.Except(subject.VisitTaskList.Select(t => (Guid)t.DoctorUserId)).ToList(); + if (needAddDoctorUserIdList.Count == 0) + { + throw new BusinessValidationFailedException("请配置一致性分析的医生"); + } + foreach (var needAddDoctorUserId in needAddDoctorUserIdList) { @@ -348,6 +359,8 @@ namespace IRaCIS.Core.Application.Service GenerataGroupConsistentTaskList = subjectAddTaskList }); + + await _taskConsistentRuleRepository.SaveChangesAsync(); } @@ -360,7 +373,7 @@ namespace IRaCIS.Core.Application.Service /// - /// 仅仅组内一致性时使用( + /// 仅仅自身一致性时使用( /// /// /// @@ -388,7 +401,9 @@ namespace IRaCIS.Core.Application.Service //所选访视数量 的访视 其中必有一个访视后有全局任务 if (filterObj.IsHaveReadingPeriod == true) { - visitTaskFilter = visitTaskFilter.And(t => t.Subject.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter).Any(u => u.VisitTaskNum == t.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global] && u.ReadingCategory == ReadingCategory.Global)); + //这里的过滤条件 不能用 where(comonTaskFilter) 会报错,奇怪的问题 只能重新写一遍 + visitTaskFilter = visitTaskFilter.And(c => c.Subject.SubjectVisitTaskList.Any(t => t.VisitTaskNum == c.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global] &&t.ReadingCategory==ReadingCategory.Global && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned && + t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7) < DateTime.Now && (t.ReReadingApplyState == ReReadingApplyState.Default || t.ReReadingApplyState == ReReadingApplyState.Reject))); } @@ -471,7 +486,7 @@ namespace IRaCIS.Core.Application.Service var taskConsistentRuleQueryable = from enroll in _repository.Where(t => t.TrialId == trialId) join user in _repository.Where() on enroll.DoctorId equals user.DoctorId - join taskConsistentRule in _repository.Where(t => t.TrialId == trialId) on enroll.TrialId equals taskConsistentRule.TrialId + join taskConsistentRule in _repository.Where(t => t.TrialId == trialId && t.IsSelfAnalysis) on enroll.TrialId equals taskConsistentRule.TrialId select new TaskConsistentRuleView() { Id = taskConsistentRule.Id,