diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index a1db67038..b7c67088f 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -1978,7 +1978,7 @@ namespace IRaCIS.Core.Application.Service SplitOrMergeType = SplitOrMergeType.Merge, }); - await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(inDto.MergeMainRowId, x => new ReadingTableAnswerRowInfo() + await _readingTableAnswerRowInfoRepository.BatchUpdateNoTrackingAsync(x=>x.Id== inDto.MergeMainRowId, x => new ReadingTableAnswerRowInfo() { SplitOrMergeType = SplitOrMergeType.MergeMain, }); diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs index e9ac5155d..b1cb82bec 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs @@ -704,7 +704,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate { var visitTaskId = inDto.VisitTaskId; - var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).ProjectTo(_mapper.ConfigurationProvider).FirstNotNullAsync(); + var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync(); var baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == taskinfo.SubjectId && x.IsBaseLine).Select(x => x.Id).FirstOrDefaultAsync(); @@ -790,13 +790,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate TableQuestionId = x.TableQuestionId, TrialId = x.TrialId, VisitTaskId = visitTaskId, - }); + }).ToList(); var addList = _mapper.Map>(tableRowAnswers); - + await _generalCalculateService.CopyHistoryAnswer(taskinfo, addList, tableAnswers); await _readingTableAnswerRowInfoRepository.AddRangeAsync(addList); await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers); await _readingTableQuestionAnswerRepository.SaveChangesAsync(); diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs index 86294b8f0..1102a37e8 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs @@ -1245,6 +1245,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate var addList = _mapper.Map>(tableRowAnswers).OrderBy(x => x.RowIndex).ToList(); + await _generalCalculateService.CopyHistoryAnswer(taskinfo, addList, tableAnswers); + foreach (var item in addList) { await _readingTableAnswerRowInfoRepository.AddAsync(item); diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoWithoutPETCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoWithoutPETCalculateService.cs index 80e2f74ee..f4e00df13 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoWithoutPETCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoWithoutPETCalculateService.cs @@ -1244,7 +1244,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate var addList = _mapper.Map>(tableRowAnswers).OrderBy(x => x.RowIndex).ToList(); - + await _generalCalculateService.CopyHistoryAnswer(taskinfo, addList, tableAnswers); foreach (var item in addList) { await _readingTableAnswerRowInfoRepository.AddAsync(item); diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/MRECISTHCCCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/MRECISTHCCCalculateService.cs index 77e516d4c..5217b83ae 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/MRECISTHCCCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/MRECISTHCCCalculateService.cs @@ -591,13 +591,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate TableQuestionId = x.TableQuestionId, TrialId = x.TrialId, VisitTaskId = visitTaskId, - }); + }).ToList(); var addList = _mapper.Map>(tableRowAnswers); - + await _generalCalculateService.CopyHistoryAnswer(taskinfo, addList, tableAnswers); await _readingTableAnswerRowInfoRepository.AddRangeAsync(addList); await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers); await _readingTableQuestionAnswerRepository.SaveChangesAsync(); diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs index 3b3da96ad..8017ddb37 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs @@ -488,7 +488,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate var addList = _mapper.Map>(tableRowAnswers); - + await _generalCalculateService.CopyHistoryAnswer(taskinfo, addList, tableAnswers); await _readingTableAnswerRowInfoRepository.AddRangeAsync(addList); await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers); await _readingTableQuestionAnswerRepository.SaveChangesAsync(); diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs index 66379bbe9..ae4f7325f 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs @@ -601,7 +601,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate var addList = _mapper.Map>(tableRowAnswers); - await _generalCalculateService.CopyHistoryAnswer(taskinfo, addList, tableAnswers); + await _generalCalculateService.CopyHistoryAnswer(taskinfo, addList, tableAnswers); await _readingTableAnswerRowInfoRepository.AddRangeAsync(addList); await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers); diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1_BMCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1_BMCalculateService.cs index cb3934cc9..1789cbf3c 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1_BMCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1_BMCalculateService.cs @@ -594,13 +594,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate TableQuestionId = x.TableQuestionId, TrialId = x.TrialId, VisitTaskId = visitTaskId, - }); + }).ToList(); var addList = _mapper.Map>(tableRowAnswers); - + await _generalCalculateService.CopyHistoryAnswer(taskinfo, addList, tableAnswers); await _readingTableAnswerRowInfoRepository.AddRangeAsync(addList); await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers); await _readingTableQuestionAnswerRepository.SaveChangesAsync(); diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/SelfDefineCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/SelfDefineCalculateService.cs index b11cd4f57..8701ab1f7 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/SelfDefineCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/SelfDefineCalculateService.cs @@ -157,6 +157,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate { var visitTaskId = inDto.VisitTaskId; var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync(); + var trialReadingCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskinfo.TrialReadingCriterionId).FirstNotNullAsync(); var isReadingTaskViewInOrder = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskinfo.TrialReadingCriterionId).Select(x => x.IsReadingTaskViewInOrder).FirstOrDefaultAsync(); var baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == taskinfo.SubjectId && x.IsBaseLine).Select(x => x.Id).FirstOrDefaultAsync(); @@ -298,7 +299,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate } } - + if(trialReadingCriterion.IsOncologyReading) + { + await _generalCalculateService.CopyHistoryAnswer(taskinfo, addRowList, addTableQuestionAnswerList); + } + await _readingTableAnswerRowInfoRepository.AddRangeAsync(addRowList); await _readingTableQuestionAnswerRepository.AddRangeAsync(addTableQuestionAnswerList); await _readingTableQuestionAnswerRepository.SaveChangesAsync(); diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 4abdb083d..ffb0417ec 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -1979,7 +1979,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common await InsertInspection(entity, type, x => new InspectionConvertDTO() { SubjectId = x.Id, - + Reason= entity.SuspendReason, TrialSiteId = x.TrialSiteId, //项目的信息 找离的最近的项目稽查信息 @@ -3896,12 +3896,19 @@ namespace IRaCIS.Core.Infra.EFCore.Common //if (_userInfo.RequestUrl == " ReadingImageTask/splitLesion") var originalRowMark = string.Empty; + var mergeRowMark = string.Empty; if (entity.SplitRowId != null) { originalRowMark = await _dbContext.ReadingTableAnswerRowInfo.Where(t => t.Id == entity.SplitRowId).Select(t => t.RowMark).FirstOrDefaultAsync(); } + if (entity.MergeRowId != null) + { + + mergeRowMark = await _dbContext.ReadingTableAnswerRowInfo.Where(t => t.Id == entity.MergeRowId).Select(t => t.RowMark).FirstOrDefaultAsync(); + } + //处理标识 因为触发器在稽查后才进行操作 entity.OrderMark = await _dbContext.ReadingQuestionTrial.Where(x => x.Id == entity.QuestionId).Select(x => x.OrderMark).FirstOrDefaultAsync(); @@ -3939,6 +3946,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common }, new { OriginalRowMark = originalRowMark, + MergeRowMark= mergeRowMark, //TableName = tableName, QuestionAnswerList = @@ -4204,6 +4212,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common inspection = f(entityObj); } + var reason = inspection.Reason; //避免重复赋值 有些特殊的GeneralId var generalId = (inspection.GeneralId != null && inspection.GeneralId != Guid.Empty) ? inspection.GeneralId : entityObj.Id; @@ -4217,6 +4226,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common //var generalData = await GetInspectionGeneralDataAsync(inspection); var generalData = await GetInspectionGeneralGuidAsync(inspection); + //不可少 因为稽查实体可能某些Id没有 MapEntityPropertyToAuditEntity(generalData, inspection); @@ -4276,11 +4286,11 @@ namespace IRaCIS.Core.Infra.EFCore.Common CommonData = new { SiteCode = generalData.SiteCode, SubjectCode = generalData.SubjectCode }, }.ToJsonStr(); - inspection.BatchId = _userInfo.BatchId.Value; inspection.EntityName = entityName; + inspection.Reason=inspection.Reason==string.Empty&&reason!=string.Empty?reason:inspection.Reason; await _dbContext.DataInspection.AddAsync(inspection);