From 95d0363bc3c3f8ec511be53d74294b51f22b9b4b Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Fri, 24 Mar 2023 09:09:26 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Common/DictionaryService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs index bd02d6989..a5528593b 100644 --- a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs +++ b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs @@ -197,7 +197,8 @@ namespace IRaCIS.Application.Services if (await _readingCriterionDictionaryRepository.AnyAsync(x => x.DictionaryId == id)) { - return ResponseOutput.NotOk("当前条目已经在阅片标准中被引用。"); + await _readingCriterionDictionaryRepository.BatchDeleteNoTrackingAsync(t => t.DictionaryId == id); + //return ResponseOutput.NotOk("当前条目已经在阅片标准中被引用。"); } var success = await _dicRepository.BatchDeleteNoTrackingAsync(t => t.Id == id); From 0017b9c98ec4f9ca293831fb97dd1c4f6df8a7b8 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Fri, 24 Mar 2023 09:18:09 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Common/DictionaryService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs index a5528593b..0a9095e23 100644 --- a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs +++ b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs @@ -173,7 +173,8 @@ namespace IRaCIS.Application.Services { if (await _readingCriterionDictionaryRepository.AnyAsync(x => x.DictionaryId == id)) { - return ResponseOutput.NotOk("当前字典在标准中被引用,不允许删除!"); + await _readingCriterionDictionaryRepository.BatchDeleteNoTrackingAsync(t => t.DictionaryId == id); + //return ResponseOutput.NotOk("当前字典在标准中被引用,不允许删除!"); } if (await _dicRepository.AnyAsync(t => t.ParentId == id)) From 040f7213949da15df69f72068fedf1e0d1116771 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Fri, 24 Mar 2023 09:49:38 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTO/TaskAllocationRuleViewModel.cs | 4 ++ .../Allocation/VisitTaskHelpeService.cs | 49 ++++++++++++++++++- .../Service/Allocation/_MapConfig.cs | 5 ++ .../Reading/Dto/ReadingImageTaskViewModel.cs | 5 +- 4 files changed, 60 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs index f31eaaac8..083015b8a 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs @@ -205,6 +205,10 @@ namespace IRaCIS.Core.Application.ViewModel public List ReadingCategoryList { get; set; } } + public class ConvertedRowInfo : ReadingTableAnswerRowInfo + { + public Guid OriginalId { get; set; } + } public class GenerateTaskCommand { public Guid TrialId { get; set; } diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index f489b1bea..ab393116f 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -36,7 +36,9 @@ namespace IRaCIS.Core.Application.Service private readonly IRepository _taskAllocationRuleRepository; private readonly IRepository _subjectUserRepository; private readonly IRepository _readModuleRepository; - + private readonly IRepository _readingTaskQuestionAnswerRepository; + private readonly IRepository _readingTableAnswerRowInfoRepository; + private readonly IRepository _readingTableQuestionAnswerRepository; private readonly IMapper _mapper; private readonly IUserInfo _userInfo; private readonly IRepository _visitTaskReReadingRepository; @@ -52,6 +54,9 @@ namespace IRaCIS.Core.Application.Service public VisitTaskHelpeService(IRepository visitTaskRepository, IRepository subjectUserRepository, IRepository trialRepository, IEasyCachingProvider provider, IRepository subjectVisitRepository, IRepository readModuleRepository, + IRepository readingTaskQuestionAnswerRepository, + IRepository readingTableAnswerRowInfoRepository, + IRepository readingTableQuestionAnswerRepository, IRepository readingJudgeInfoRepository, IRepository taskAllocationRuleRepository, IMapper mapper, IUserInfo userInfo, IRepository visitTaskReReadingRepository, IRepository trialReadingCriterionRepository, IRepository trialClinicalDataSetRepository, IRepository readingClinicalDataRepository, @@ -63,6 +68,9 @@ namespace IRaCIS.Core.Application.Service _visitTaskRepository = visitTaskRepository; _trialRepository = trialRepository; this._readModuleRepository = readModuleRepository; + this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository; + this._readingTableAnswerRowInfoRepository = readingTableAnswerRowInfoRepository; + this._readingTableQuestionAnswerRepository = readingTableQuestionAnswerRepository; _provider = provider; _subjectVisitRepository = subjectVisitRepository; this._readingJudgeInfoRepository = readingJudgeInfoRepository; @@ -100,7 +108,7 @@ namespace IRaCIS.Core.Application.Service public async Task AddConvertedTask(Guid taskId) { var taskInfo = await _visitTaskRepository.Where(x => x.Id == taskId).IgnoreAutoIncludes().AsNoTracking().FirstNotNullAsync(); - taskInfo.ReadingTaskState = ReadingTaskState.WaitReading; + taskInfo.ReadingTaskState = ReadingTaskState.Reading; taskInfo.IsConvertedTask = true; taskInfo.BeforeConvertedTaskId = taskId; taskInfo.Id = NewId.NextGuid(); @@ -125,6 +133,43 @@ namespace IRaCIS.Core.Application.Service TaskState = TaskState.Freeze }); + + var taskAnswer = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == taskId && x.ReadingQuestionTrial.Type != "calculation").IgnoreAutoIncludes().ToListAsync(); + + taskAnswer.ForEach(x => { + + x.VisitTaskId = taskInfo.Id; + x.Id= NewId.NextGuid(); + }); + + + var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == taskId).IgnoreAutoIncludes().ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + + tableRowAnswers.ForEach(x => + { + x.VisitTaskId = taskInfo.Id; + x.IsCurrentTaskAdd = false; + x.Id = NewId.NextGuid(); + }); + + tableRowAnswers.ForEach(x => + { + x.SplitRowId = tableRowAnswers.Where(y => y.OriginalId == x.SplitRowId).Select(y => y.Id).FirstOrDefault(); + x.MergeRowId = tableRowAnswers.Where(y => y.OriginalId == x.MergeRowId).Select(y => y.Id).FirstOrDefault(); + + }); + + var tableAnswer = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == taskId).IgnoreAutoIncludes().ToListAsync(); + + tableAnswer.ForEach(x => + { + x.Id = NewId.NextGuid(); + x.RowId = tableRowAnswers.Where(y => y.OriginalId == x.RowId).Select(x => x.Id).FirstOrDefault(); + }); + var addrowInfo = _mapper.Map>(tableRowAnswers); + await _readingTaskQuestionAnswerRepository.AddRangeAsync(taskAnswer); + await _readingTableAnswerRowInfoRepository.AddRangeAsync(addrowInfo); + await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswer); await _visitTaskRepository.SaveChangesAsync(); } diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs index 70f2702a2..a6c24cc96 100644 --- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs @@ -12,6 +12,11 @@ namespace IRaCIS.Core.Application.Service public AllocationConfig() { + CreateMap() + .ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id)); + + CreateMap(); + CreateMap() .ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode)) diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs index 02988198e..862d8f7de 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs @@ -543,7 +543,10 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public Guid? DeleteUserId { get; set; } - + /// + /// 来自于哪个标记 + /// + public string FromMark { get; set; } = string.Empty; public string RowMark { get; set; } = string.Empty; } From 402a08f03de7318e372566ba172767a97d1f3e92 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Fri, 24 Mar 2023 10:26:59 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessFilter/TrialResourceFilter.cs | 2 +- IRaCIS.Core.Application/IRaCIS.Core.Application.xml | 5 +++++ .../Service/Allocation/VisitTaskHelpeService.cs | 7 ++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/IRaCIS.Core.Application/BusinessFilter/TrialResourceFilter.cs b/IRaCIS.Core.Application/BusinessFilter/TrialResourceFilter.cs index 14f0a78ed..a61db0366 100644 --- a/IRaCIS.Core.Application/BusinessFilter/TrialResourceFilter.cs +++ b/IRaCIS.Core.Application/BusinessFilter/TrialResourceFilter.cs @@ -126,7 +126,7 @@ namespace IRaCIS.Core.Application.Filter //有可能匹配错误 "trialId":"","documentId":"b8180000-3e2c-0016-9fe0-08da33f96236" 从缓存里面验证下 var cacheResultDic = _provider.GetAll(new[] { matchResult.Value }); - var trialStatusStr = cacheResultDic[matchResult.Value].Value; + var trialStatusStr = cacheResultDic[matchResult.Value.ToLower()].Value; if (!string.IsNullOrWhiteSpace(trialStatusStr)) { diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index d61b11bb4..18e67d451 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -3299,6 +3299,11 @@ CreateUserId + + + 来自于哪个标记 + + 问题标识 diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index ab393116f..2619cd6b3 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -16,6 +16,7 @@ using MassTransit; using IRaCIS.Core.Infra.EFCore.Common; using System.Linq.Expressions; using IRaCIS.Core.Domain.Share.Reading; +using IRaCIS.Core.Application.Service.Reading.Dto; namespace IRaCIS.Core.Application.Service { @@ -134,7 +135,7 @@ namespace IRaCIS.Core.Application.Service }); - var taskAnswer = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == taskId && x.ReadingQuestionTrial.Type != "calculation").IgnoreAutoIncludes().ToListAsync(); + var taskAnswer = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == taskId && x.ReadingQuestionTrial.Type != "calculation").IgnoreAutoIncludes().AsNoTracking().ToListAsync(); taskAnswer.ForEach(x => { @@ -143,7 +144,7 @@ namespace IRaCIS.Core.Application.Service }); - var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == taskId).IgnoreAutoIncludes().ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == taskId).AsNoTracking().ProjectTo(_mapper.ConfigurationProvider).IgnoreAutoIncludes().ToListAsync(); tableRowAnswers.ForEach(x => { @@ -159,7 +160,7 @@ namespace IRaCIS.Core.Application.Service }); - var tableAnswer = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == taskId).IgnoreAutoIncludes().ToListAsync(); + var tableAnswer = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == taskId).IgnoreAutoIncludes().AsNoTracking().ToListAsync(); tableAnswer.ForEach(x => { From aee50bf66862ba054ad3cab85cd0664bbb89c8ba Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Fri, 24 Mar 2023 10:45:21 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Allocation/VisitTaskHelpeService.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index 2619cd6b3..0c333d895 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -165,6 +165,7 @@ namespace IRaCIS.Core.Application.Service tableAnswer.ForEach(x => { x.Id = NewId.NextGuid(); + x.VisitTaskId = taskInfo.Id; x.RowId = tableRowAnswers.Where(y => y.OriginalId == x.RowId).Select(x => x.Id).FirstOrDefault(); }); var addrowInfo = _mapper.Map>(tableRowAnswers); From 26636337981051d2c443a10f28be313a46cb0613 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Fri, 24 Mar 2023 10:56:19 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Allocation/VisitTaskHelpeService.cs | 2 ++ .../ReadingImageTask/ReadingImageTaskService.cs | 14 ++------------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index 0c333d895..2685e2710 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -140,6 +140,7 @@ namespace IRaCIS.Core.Application.Service taskAnswer.ForEach(x => { x.VisitTaskId = taskInfo.Id; + x.Id= NewId.NextGuid(); }); @@ -150,6 +151,7 @@ namespace IRaCIS.Core.Application.Service { x.VisitTaskId = taskInfo.Id; x.IsCurrentTaskAdd = false; + x.isf x.Id = NewId.NextGuid(); }); diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index 1489399ec..44b1008da 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -718,17 +718,7 @@ namespace IRaCIS.Application.Services var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync(); - if (taskInfo.IsConvertedTask && - !(await _visitTaskRepository.AnyAsync(x => x.IsAnalysisCreate == taskInfo.IsAnalysisCreate - && x.IsSelfAnalysis == taskInfo.IsSelfAnalysis - && x.VisitTaskNum < taskInfo.VisitTaskNum - && x.DoctorUserId == taskInfo.DoctorUserId - && x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId - && !x.IsConvertedTask - && x.SubjectId == taskInfo.SubjectId - && x.ArmEnum == taskInfo.ArmEnum && - x.TaskState == TaskState.Effect)) - ) + if (taskInfo.IsConvertedTask &&taskInfo.BeforeConvertedTaskId!=null) { result.ForEach(x => { @@ -1153,7 +1143,7 @@ namespace IRaCIS.Application.Services }); - + answers.Add("LesionType", rowInfo.LesionType.ToString()); answers.Add("BlindName", rowInfo.BlindName); answers.Add("IsFirstChangeTask", isFirstChangeTask.ToString()); answers.Add("FromMark", rowInfo.FromMark);