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/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..2685e2710 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 { @@ -36,7 +37,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 +55,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 +69,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 +109,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 +134,46 @@ namespace IRaCIS.Core.Application.Service TaskState = TaskState.Freeze }); + + var taskAnswer = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == taskId && x.ReadingQuestionTrial.Type != "calculation").IgnoreAutoIncludes().AsNoTracking().ToListAsync(); + + taskAnswer.ForEach(x => { + + x.VisitTaskId = taskInfo.Id; + + x.Id= NewId.NextGuid(); + }); + + + var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == taskId).AsNoTracking().ProjectTo(_mapper.ConfigurationProvider).IgnoreAutoIncludes().ToListAsync(); + + tableRowAnswers.ForEach(x => + { + x.VisitTaskId = taskInfo.Id; + x.IsCurrentTaskAdd = false; + x.isf + 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().AsNoTracking().ToListAsync(); + + 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); + 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/Common/DictionaryService.cs b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs index bd02d6989..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)) @@ -197,7 +198,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); 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; } 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);