From e5c9bf0688f184877cb56c63895c2ff9d78bb24c Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Fri, 31 Mar 2023 18:09:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReadingImageTaskService.cs | 30 ++++++++++++++-- .../General/GeneralCalculateService.cs | 2 +- IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs | 5 +++ IRaCIS.Core.Domain/Allocation/VisitTask.cs | 34 +++++++++++++++++-- IRaCIS.Core.Domain/SQLFile/Test.sql | 8 +++++ 5 files changed, 73 insertions(+), 6 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index c99b3cbd0..9d422bd17 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -2436,6 +2436,9 @@ namespace IRaCIS.Application.Services // 既往任务Id List pastResultTaskIdList = new List(); + // 冻结任务Id + List reportRelatedTaskIdList = new List(); + if (isReadingTaskViewInOrder) { @@ -2447,13 +2450,29 @@ namespace IRaCIS.Application.Services x.DoctorUserId == taskInfo.DoctorUserId && x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && x.ReadingTaskState == ReadingTaskState.HaveSigned && - (x.TaskState == TaskState.Effect||x.TaskState== TaskState.Freeze) && + x.TaskState == TaskState.Effect && x.IsSelfAnalysis == taskInfo.IsSelfAnalysis && x.IsAnalysisCreate == taskInfo.IsAnalysisCreate && x.ReadingCategory == taskInfo.ReadingCategory && x.Id != taskInfo.Id ).OrderBy(x=>x.VisitTaskNum).ThenBy(x=>x.TaskState).Select(x => x.Id).ToListAsync(); + + reportRelatedTaskIdList = await _visitTaskRepository.Where(x => + x.TrialId == taskInfo.TrialId && + x.SubjectId == taskInfo.SubjectId && + x.VisitTaskNum <= taskInfo.VisitTaskNum && + x.ArmEnum == taskInfo.ArmEnum && + x.DoctorUserId == taskInfo.DoctorUserId && + x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && + x.ReadingTaskState == ReadingTaskState.HaveSigned && + (x.TaskState == TaskState.Effect||x.TaskState==TaskState.Freeze) && + x.IsSelfAnalysis == taskInfo.IsSelfAnalysis && + x.IsAnalysisCreate == taskInfo.IsAnalysisCreate && + x.ReadingCategory == taskInfo.ReadingCategory && + x.Id != taskInfo.Id + ).OrderBy(x => x.VisitTaskNum).ThenBy(x => x.TaskState).Select(x => x.Id).ToListAsync(); + switch (taskInfo.ReadingCategory) { case ReadingCategory.Visit: @@ -2485,7 +2504,7 @@ namespace IRaCIS.Application.Services { - + ReportRelatedTaskIds = JsonConvert.SerializeObject(reportRelatedTaskIdList), PastResultTaskIds = JsonConvert.SerializeObject(pastResultTaskIdList), RelatedVisitTaskIds = JsonConvert.SerializeObject(relatedVisitTaskIdList), }); @@ -2504,6 +2523,13 @@ namespace IRaCIS.Application.Services RelevanceType = RelevanceType.Related, })); + await _readingTaskRelationRepository.AddRangeAsync(reportRelatedTaskIdList.Select(x => new ReadingTaskRelation() + { + RelevanceTaskId = x, + TaskId = visitTaskId, + RelevanceType = RelevanceType.ReportResult, + })); + await _visitTaskRepository.SaveChangesAsync(); } diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs index 40ec03075..691faa5e9 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs @@ -300,7 +300,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate ); if(visitTaskInfo.ReadingTaskState==ReadingTaskState.HaveSigned) { - taskquery = _visitTaskRepository.Where(x => visitTaskInfo.RelatedVisitTaskIdList.Contains(x.Id)||x.Id==visitTaskInfo.Id); + taskquery = _visitTaskRepository.Where(x => visitTaskInfo.ReportRelatedTaskIdList.Contains(x.Id)||x.Id==visitTaskInfo.Id); } diff --git a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs index a351a19fc..aeb673415 100644 --- a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs +++ b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs @@ -49,6 +49,11 @@ namespace IRaCIS.Core.Domain.Share /// 既往任务Id 不包括自己 /// PastResult = 1, + + /// + /// 报告 包括自己 + /// + ReportResult = 2, } /// diff --git a/IRaCIS.Core.Domain/Allocation/VisitTask.cs b/IRaCIS.Core.Domain/Allocation/VisitTask.cs index 3bffaa9b3..bc75a527c 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTask.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs @@ -200,7 +200,7 @@ namespace IRaCIS.Core.Domain.Models public string RelatedVisitTaskIds { get; set; } = "[]"; /// - /// 关联的访视任务ID (当前任务是访视任务的话会有自己)集合 不包括冻结 + /// 关联的访视任务ID (当前任务是访视任务的话会有自己)集合 /// [NotMapped] public List RelatedVisitTaskIdList @@ -223,7 +223,35 @@ namespace IRaCIS.Core.Domain.Models } /// - /// 既往任务Id 不包括自己 包括冻结 + /// 报告任务关系 包含冻结 + /// + public string ReportRelatedTaskIds { get; set; } = "[]"; + + /// + /// 报告任务关系 包含冻结 + /// + [NotMapped] + public List ReportRelatedTaskIdList + { + get + { + + try + { + + return JsonConvert.DeserializeObject>(this.ReportRelatedTaskIds); + } + catch (Exception) + { + + return new List(); + } + + } + } + + /// + /// 既往任务Id 不包括自己 /// public string PastResultTaskIds { get; set; } = "[]"; @@ -231,7 +259,7 @@ namespace IRaCIS.Core.Domain.Models /// - /// 既往任务Id 不包括自己集合 包括冻结 + /// 既往任务Id 不包括自己集合 /// [NotMapped] public List PastResultTaskIdList diff --git a/IRaCIS.Core.Domain/SQLFile/Test.sql b/IRaCIS.Core.Domain/SQLFile/Test.sql index 3d42b017a..c34d0981a 100644 --- a/IRaCIS.Core.Domain/SQLFile/Test.sql +++ b/IRaCIS.Core.Domain/SQLFile/Test.sql @@ -1010,3 +1010,11 @@ update ReadingQuestionTrial set GroupId= (select top 1 id from ReadingQuestion update ReadingQuestionSystem set GroupId= (select top 1 id from ReadingQuestionSystem a where a.Type='group' and a.GroupName=ReadingQuestionSystem.GroupName and a.ReadingQuestionCriterionSystemId=ReadingQuestionSystem.ReadingQuestionCriterionSystemId) where ReadingQuestionSystem.Type!='group' and GroupId is null +------------------------------------------------------------------------------------------------------------------------------维护报告数据 +update VisitTask set ReportRelatedTaskIds=RelatedVisitTaskIds where ReadingCategory=1 and RelatedVisitTaskIds!='[]' + + +delete ReadingTaskRelation where RelevanceType=2 + +INSERT INTO ReadingTaskRelation(Id, TaskId, RelevanceTaskId, RelevanceType, CreateTime,CreateUserId) +SELECT NEWID(), TaskId, RelevanceTaskId, 2,ReadingTaskRelation.CreateTime ,ReadingTaskRelation.CreateUserId FROM ReadingTaskRelation inner join VisitTask on VisitTask.Id=ReadingTaskRelation.TaskId WHERE RelevanceType = 1 and ReadingCategory=1