From c3fbf1095385f33aec4322c707344c609bb11465 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 18 Oct 2022 16:30:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 135 +++---- .../ReadingImageTaskService.cs | 365 +++++++++--------- .../ReadingNoDicomTaskService.cs | 1 + 3 files changed, 248 insertions(+), 253 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 9182aecf6..12e1366a0 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -8045,6 +8045,9 @@ 裁判 + 非Dicom + + 肿瘤学 @@ -8072,24 +8075,6 @@ - - - 拆分病灶 - - - - - - 合并病灶 - - - - - - 添加阅片期任务 - - - 根据任务ID获取ReadingTool @@ -8133,20 +8118,6 @@ - - - 修改Dicom阅片问题 - - - - - - - 删除表格行数据 - - - - 获取DIcom阅片问题答案 @@ -8186,52 +8157,35 @@ - + - 获取下一个阅片任务 + 拆分病灶 + + + + + + 合并病灶 + + + + + + 修改Dicom阅片问题 - + - 获取阅片非Dicom文件 - - - - - - - 找子问题 - - - - - - - - 保存任务问题 - - - - - - - 验证访视提交 + 删除表格行数据 - 提交表格问题 - - - - - - - 提交访视阅片问题 + 提交表格问题答案 病灶 @@ -8243,6 +8197,20 @@ + + + 验证访视提交 + + + + + + + 获取下一个阅片任务 + + + + 签名提交任务修改状态 @@ -8250,6 +8218,12 @@ + + + 阅片期 -全局和肿瘤学任务的生成 + + + 获取项目标准的裁判问题 @@ -8304,6 +8278,35 @@ + + + 提交访视阅片问题 + + + + + + + 保存任务问题 + + + + + + + 获取阅片非Dicom文件 + + + + + + + 找子问题 + + + + + 获取肿瘤学任务信息 diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index 528cb5472..f6d0e06d5 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -104,85 +104,6 @@ namespace IRaCIS.Application.Services } - - - - - #region 阅片期 -全局和肿瘤学任务的生成 - - /// - /// 添加阅片期任务 - /// - /// - private async Task AddReadingTask(Guid visitTaskId) - { - // ****** 先生成阅片期 阅片期任务阅片完成之后生成肿瘤学的 如果没有阅片期 直接生成肿瘤学 *********//// - #region 建立关系 - // 访视阅完产生 全局 - Dictionary typeChangeDic = new Dictionary(); - typeChangeDic.Add(ModuleTypeEnum.InPlanSubjectVisit, ReadingCategory.Visit); - typeChangeDic.Add(ModuleTypeEnum.OutPlanSubjectVisit, ReadingCategory.Visit); - //typeChange.Add(ModuleTypeEnum.Read, ReadingCategory.ReadingPeriod); - typeChangeDic.Add(ModuleTypeEnum.Global, ReadingCategory.Global); - typeChangeDic.Add(ModuleTypeEnum.Referee, ReadingCategory.Judge); - typeChangeDic.Add(ModuleTypeEnum.Oncology, ReadingCategory.Oncology); - #endregion - var taskInfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync(); - List needReadList = new List(); - if (!taskInfo.IsAnalysisCreate) - { - // 任务类型 - switch (taskInfo.ReadingCategory) - { - case ReadingCategory.Visit: - needReadList = await _readModuleRepository.Where(x => x.SubjectVisitId == taskInfo.SourceSubjectVisitId && - - x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && - x.ReadingSetType == ReadingSetType.ImageReading) - .Select(x => new ReadingGenerataTaskDTO - { - IsUrgent = x.IsUrgent ?? false, - SubjectId = x.SubjectId, - VisitNum = x.VisitNum, - ReadingName = x.ModuleName, - ReadModuleId = x.Id, - ReadingCategory = typeChangeDic[x.ModuleType], - }).ToListAsync(); - if (needReadList.Any(x => x.ReadingCategory == ReadingCategory.Global)) - { - needReadList = needReadList.Where(x => x.ReadingCategory != ReadingCategory.Oncology).ToList(); - } - //needReadList = needReadList.Where(x => _visitTaskRepository.Where(y => y.SouceReadModuleId == x.ReadModuleId).Count() == 0).ToList(); - await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand() - { - OriginalVisitId = visitTaskId, - ReadingCategory = GenerateTaskCategory.Global, - TrialId = taskInfo.TrialId, - ReadingGenerataTaskList = needReadList - }); - break; - // 肿瘤学 - case ReadingCategory.Global: - var subjectVisitId = await _readModuleRepository.Where(x => x.Id == taskInfo.SouceReadModuleId).Select(x => x.SubjectVisitId).FirstOrDefaultAsync(); - var oncologyReadId = await _readModuleRepository.Where(x => x.SubjectVisitId == subjectVisitId && x.ModuleType == ModuleTypeEnum.Oncology - && x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId - - - ).Select(x => x.Id).FirstOrDefaultAsync(); - await AddOncologyTask(oncologyReadId); - break; - } - } - - - - - - } - - #endregion - - #region 阅片页面 关联信息查询 以及基本验证 /// @@ -792,6 +713,114 @@ namespace IRaCIS.Application.Services #endregion + #region 访视任务 - Dicom 阅片 表格问题 病灶的拆分与合并 + + + /// + /// 拆分病灶 + /// + /// + [HttpPost] + public async Task SplitLesion(SplitLesionInDto inDto) + { + await this.VerifyIsBaseLineTask(inDto.VisitTaskId); + var rowAnswer = await _readingTableAnswerRowInfoRepository.Where(x => x.Id == inDto.RowId).AsNoTracking().FirstNotNullAsync(); + var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == rowAnswer.RowIndex && x.QuestionId == inDto.QuestionId).Include(x => x.ReadingTableQuestionTrial).ToListAsync(); + var maxRowIndex = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId && x.RowIndex < Math.Floor(rowAnswer.RowIndex + 1)).OrderByDescending(x => x.RowIndex).Select(x => x.RowIndex).FirstOrDefaultAsync(); + var newRowIndex = maxRowIndex + (decimal)0.01; + + rowAnswer.RowIndex = newRowIndex; + rowAnswer.MergeRowId = null; + rowAnswer.SplitOrMergeType = SplitOrMergeType.Split; + rowAnswer.SplitRowId = rowAnswer.Id; + rowAnswer.Id = NewId.NextGuid(); + rowAnswer.InstanceId = null; + rowAnswer.SeriesId = null; + rowAnswer.IsCurrentTaskAdd = true; + rowAnswer.MeasureData = string.Empty; + + List needRemoveMark = new List() + { + QuestionMark.MajorAxis, + QuestionMark.ShortAxis, + }; + + tableAnswers.ForEach(x => + { + x.Id = NewId.NextGuid(); + x.RowIndex = newRowIndex; + x.VisitTaskId = inDto.VisitTaskId; + x.RowId = rowAnswer.Id; + x.Answer = needRemoveMark.Contains(x.ReadingTableQuestionTrial.QuestionMark) ? string.Empty : x.Answer; + x.ReadingTableQuestionTrial = null; + }); + await _readingTableAnswerRowInfoRepository.AddAsync(rowAnswer); + await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers); + await _readingTableAnswerRowInfoRepository.SaveChangesAsync(); + + } + + /// + /// 合并病灶 + /// + /// + [HttpPost] + public async Task MergeLesion(MergeLesionInDto inDto) + { + await this.VerifyIsBaseLineTask(inDto.VisitTaskId); + + var rowsInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && (x.Id == inDto.MainRowId || x.Id == inDto.MergeRowId)).ToListAsync(); + + if (rowsInfo.Count() != 2) + { + throw new BusinessValidationFailedException("合并的病灶并非同一个访视任务"); + } + + + var minaid = rowsInfo.Where(x => x.Id == inDto.MainRowId).Select(x => x.Id).FirstOrDefault(); + var mergeid = rowsInfo.Where(x => x.Id == inDto.MergeRowId).Select(x => x.Id).FirstOrDefault(); + + List needRemoveMark = new List() + { + QuestionMark.MajorAxis, + QuestionMark.ShortAxis, + }; + + var mainAnswer = await _readingTableQuestionAnswerRepository.Where(x => x.RowId == minaid).Include(x => x.ReadingTableQuestionTrial).ToListAsync(); + + foreach (var item in mainAnswer) + { + await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.RowId == mergeid && x.TableQuestionId == item.TableQuestionId, x => new ReadingTableQuestionAnswer() + { + Answer = needRemoveMark.Contains(item.ReadingTableQuestionTrial.QuestionMark) ? string.Empty : item.Answer, + }); + } + + + + await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(mergeid, x => new ReadingTableAnswerRowInfo() + { + MergeRowId = minaid, + SplitOrMergeType = SplitOrMergeType.Merge, + }); + + + await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(mergeid, x => new ReadingTableAnswerRowInfo() + { + MergeRowId = minaid, + SplitOrMergeType = SplitOrMergeType.Merge, + }); + + await _readingTableAnswerRowInfoRepository.SaveChangesAsync(); + + + } + + + #endregion + + + #region 访视任务 - Dicom 阅片 提交、修改 /// @@ -1085,112 +1114,6 @@ namespace IRaCIS.Application.Services - #endregion - - #region 访视任务 - Dicom 阅片 表格问题 病灶的拆分与合并 - - - /// - /// 拆分病灶 - /// - /// - [HttpPost] - public async Task SplitLesion(SplitLesionInDto inDto) - { - await this.VerifyIsBaseLineTask(inDto.VisitTaskId); - var rowAnswer = await _readingTableAnswerRowInfoRepository.Where(x => x.Id == inDto.RowId).AsNoTracking().FirstNotNullAsync(); - var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == rowAnswer.RowIndex && x.QuestionId == inDto.QuestionId).Include(x => x.ReadingTableQuestionTrial).ToListAsync(); - var maxRowIndex = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId && x.RowIndex < Math.Floor(rowAnswer.RowIndex + 1)).OrderByDescending(x => x.RowIndex).Select(x => x.RowIndex).FirstOrDefaultAsync(); - var newRowIndex = maxRowIndex + (decimal)0.01; - - rowAnswer.RowIndex = newRowIndex; - rowAnswer.MergeRowId = null; - rowAnswer.SplitOrMergeType = SplitOrMergeType.Split; - rowAnswer.SplitRowId = rowAnswer.Id; - rowAnswer.Id = NewId.NextGuid(); - rowAnswer.InstanceId = null; - rowAnswer.SeriesId = null; - rowAnswer.IsCurrentTaskAdd = true; - rowAnswer.MeasureData = string.Empty; - - List needRemoveMark = new List() - { - QuestionMark.MajorAxis, - QuestionMark.ShortAxis, - }; - - tableAnswers.ForEach(x => - { - x.Id = NewId.NextGuid(); - x.RowIndex = newRowIndex; - x.VisitTaskId = inDto.VisitTaskId; - x.RowId = rowAnswer.Id; - x.Answer = needRemoveMark.Contains(x.ReadingTableQuestionTrial.QuestionMark) ? string.Empty : x.Answer; - x.ReadingTableQuestionTrial = null; - }); - await _readingTableAnswerRowInfoRepository.AddAsync(rowAnswer); - await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers); - await _readingTableAnswerRowInfoRepository.SaveChangesAsync(); - - } - - /// - /// 合并病灶 - /// - /// - [HttpPost] - public async Task MergeLesion(MergeLesionInDto inDto) - { - await this.VerifyIsBaseLineTask(inDto.VisitTaskId); - - var rowsInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && (x.Id == inDto.MainRowId || x.Id == inDto.MergeRowId)).ToListAsync(); - - if (rowsInfo.Count() != 2) - { - throw new BusinessValidationFailedException("合并的病灶并非同一个访视任务"); - } - - - var minaid = rowsInfo.Where(x => x.Id == inDto.MainRowId).Select(x => x.Id).FirstOrDefault(); - var mergeid = rowsInfo.Where(x => x.Id == inDto.MergeRowId).Select(x => x.Id).FirstOrDefault(); - - List needRemoveMark = new List() - { - QuestionMark.MajorAxis, - QuestionMark.ShortAxis, - }; - - var mainAnswer = await _readingTableQuestionAnswerRepository.Where(x => x.RowId == minaid).Include(x => x.ReadingTableQuestionTrial).ToListAsync(); - - foreach (var item in mainAnswer) - { - await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.RowId == mergeid && x.TableQuestionId == item.TableQuestionId, x => new ReadingTableQuestionAnswer() - { - Answer = needRemoveMark.Contains(item.ReadingTableQuestionTrial.QuestionMark) ? string.Empty : item.Answer, - }); - } - - - - await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(mergeid, x => new ReadingTableAnswerRowInfo() - { - MergeRowId = minaid, - SplitOrMergeType = SplitOrMergeType.Merge, - }); - - - await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(mergeid, x => new ReadingTableAnswerRowInfo() - { - MergeRowId = minaid, - SplitOrMergeType = SplitOrMergeType.Merge, - }); - - await _readingTableAnswerRowInfoRepository.SaveChangesAsync(); - - - } - - #endregion @@ -1395,10 +1318,78 @@ namespace IRaCIS.Application.Services } + /// + /// 阅片期 -全局和肿瘤学任务的生成 + /// + /// + private async Task AddReadingTask(Guid visitTaskId) + { + // ****** 先生成阅片期 阅片期任务阅片完成之后生成肿瘤学的 如果没有阅片期 直接生成肿瘤学 *********//// + #region 建立关系 + // 访视阅完产生 全局 + Dictionary typeChangeDic = new Dictionary(); + typeChangeDic.Add(ModuleTypeEnum.InPlanSubjectVisit, ReadingCategory.Visit); + typeChangeDic.Add(ModuleTypeEnum.OutPlanSubjectVisit, ReadingCategory.Visit); + //typeChange.Add(ModuleTypeEnum.Read, ReadingCategory.ReadingPeriod); + typeChangeDic.Add(ModuleTypeEnum.Global, ReadingCategory.Global); + typeChangeDic.Add(ModuleTypeEnum.Referee, ReadingCategory.Judge); + typeChangeDic.Add(ModuleTypeEnum.Oncology, ReadingCategory.Oncology); + #endregion + var taskInfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync(); + List needReadList = new List(); + if (!taskInfo.IsAnalysisCreate) + { + // 任务类型 + switch (taskInfo.ReadingCategory) + { + case ReadingCategory.Visit: + needReadList = await _readModuleRepository.Where(x => x.SubjectVisitId == taskInfo.SourceSubjectVisitId && + + x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && + x.ReadingSetType == ReadingSetType.ImageReading) + .Select(x => new ReadingGenerataTaskDTO + { + IsUrgent = x.IsUrgent ?? false, + SubjectId = x.SubjectId, + VisitNum = x.VisitNum, + ReadingName = x.ModuleName, + ReadModuleId = x.Id, + ReadingCategory = typeChangeDic[x.ModuleType], + }).ToListAsync(); + if (needReadList.Any(x => x.ReadingCategory == ReadingCategory.Global)) + { + needReadList = needReadList.Where(x => x.ReadingCategory != ReadingCategory.Oncology).ToList(); + } + //needReadList = needReadList.Where(x => _visitTaskRepository.Where(y => y.SouceReadModuleId == x.ReadModuleId).Count() == 0).ToList(); + await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand() + { + OriginalVisitId = visitTaskId, + ReadingCategory = GenerateTaskCategory.Global, + TrialId = taskInfo.TrialId, + ReadingGenerataTaskList = needReadList + }); + break; + // 肿瘤学 + case ReadingCategory.Global: + var subjectVisitId = await _readModuleRepository.Where(x => x.Id == taskInfo.SouceReadModuleId).Select(x => x.SubjectVisitId).FirstOrDefaultAsync(); + var oncologyReadId = await _readModuleRepository.Where(x => x.SubjectVisitId == subjectVisitId && x.ModuleType == ModuleTypeEnum.Oncology + && x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId + + + ).Select(x => x.Id).FirstOrDefaultAsync(); + await AddOncologyTask(oncologyReadId); + break; + } + } + + + + + + } + #endregion - - } } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingNoDicomTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingNoDicomTaskService.cs index 3fddcd835..4bfcc9599 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingNoDicomTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingNoDicomTaskService.cs @@ -4,6 +4,7 @@ using IRaCIS.Core.Application.Service.Reading.Dto; using IRaCIS.Core.Infra.EFCore.Common; using Panda.DynamicWebApi.Attributes; using IRaCIS.Core.Application.Contracts; +using MassTransit; namespace IRaCIS.Application.Services {