From 4f978863e4dd6c210d710d089b66d1bb8df57e31 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Wed, 28 Feb 2024 14:52:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E8=A3=82=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 50 ++++++++++++++ .../Reading/Dto/ReadingImageTaskViewModel.cs | 66 +++++++++++++++++++ .../ReadingImageTaskService.cs | 57 ++++++++++++++-- .../Service/Reading/_MapConfig.cs | 5 +- 4 files changed, 173 insertions(+), 5 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 1e08ec5c2..d98b3e3ce 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -4881,6 +4881,56 @@ 序号标记 + + + 问题标识 + + + + + 问题Id + + + + + 表格问题Id + + + + + 任务Id + + + + + 项目Id + + + + + 行号 + + + + + 答案 + + + + + 创建时间 + + + + + 创建人 + + + + + RowId + + 融合的主病灶 diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs index 4c84b1ec5..3d6a8c9ea 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs @@ -317,6 +317,72 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public Guid RowId { get; set; } } + public class TableQuestionAnswerInfo + { + public Guid Id { get; set; } + + /// + /// 问题标识 + /// + public QuestionMark? QuestionMark { get; set; } + + /// + /// 问题Id + /// + + public Guid QuestionId { get; set; } + + /// + /// 表格问题Id + /// + public Guid TableQuestionId { get; set; } + + /// + /// 任务Id + /// + public Guid VisitTaskId { get; set; } + + /// + /// 项目Id + /// + public Guid TrialId { get; set; } + + /// + /// 行号 + /// + public decimal RowIndex { get; set; } + + /// + /// 答案 + /// + public string Answer { get; set; } + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + + /// + /// 创建人 + /// + public Guid CreateUserId { get; set; } + + + /// + /// RowId + /// + public Guid RowId { get; set; } + + + public Guid UpdateUserId { get; set; } + public DateTime UpdateTime { get; set; } + + public bool IsDeleted { get; set; } + + public DateTime? DeletedTime { get; set; } + + public Guid? DeleteUserId { get; set; } + } public class MergeLesionInDto { public Guid VisitTaskId { get; set; } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index 9b3cbc4b8..00765027c 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -18,6 +18,8 @@ using DocumentFormat.OpenXml.Drawing; using EasyCaching.Core; using DocumentFormat.OpenXml.Drawing.Charts; using IRaCIS.Core.Application.Service.ReadingCalculate.Interface; +using AutoMapper.QueryableExtensions; +using IRaCIS.Application.Contracts; namespace IRaCIS.Application.Services { @@ -1411,8 +1413,9 @@ namespace IRaCIS.Application.Services { await VerifyTaskIsSign(inDto.VisitTaskId); await this.VerifyIsBaseLineTask(inDto.VisitTaskId); + var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync(); 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 tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == rowAnswer.RowIndex && x.QuestionId == inDto.QuestionId).Include(x => x.ReadingTableQuestionTrial).ProjectTo(_mapper.ConfigurationProvider).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; @@ -1444,11 +1447,57 @@ namespace IRaCIS.Application.Services x.RowIndex = newRowIndex; x.VisitTaskId = inDto.VisitTaskId; x.RowId = rowAnswer.Id; - x.Answer = needSaveMark.Contains(x.ReadingTableQuestionTrial.QuestionMark) ? x.Answer : string.Empty; - x.ReadingTableQuestionTrial = null; + x.Answer = needSaveMark.Contains(x.QuestionMark) ? x.Answer : string.Empty; }); + + switch (taskInfo.TrialReadingCriterion.CriterionType) + { + case CriterionType.Lugano2014: + + List needSetNa = new List() + { + QuestionMark.LowPPDAddPercent, + QuestionMark.NadirPPD, + /// + /// PPD最低点所在访视 + /// + QuestionMark.LowPPDVisit , + + /// + /// PPD最低点LDi + /// + QuestionMark.LowPPDLDi, + + /// + /// PPD最低点SDi + /// + QuestionMark.LowPPDSDi, + + /// + /// 相比最低点PPD增加百分比 + /// + QuestionMark.LowPPDAddPercent, + + /// + /// 相比PPD最低点LDi增加值 + /// + QuestionMark.LowPPDLDiAdded, + + /// + /// 相比PPD最低点SDi增加值 + /// + QuestionMark.LowPPDSDiAdded, + + + }; + tableAnswers.ForEach(x => + { + x.Answer = needSetNa.Contains(x.QuestionMark) ?"NA" :x.Answer; + }); + break; + } await _readingTableAnswerRowInfoRepository.AddAsync(rowAnswer); - await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers); + await _readingTableQuestionAnswerRepository.AddRangeAsync(_mapper.Map>(tableAnswers)); await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.RowId, x => new ReadingTableAnswerRowInfo() { SplitOrMergeType = SplitOrMergeType.SplitMain diff --git a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs index f54ef8d61..8ba19ef76 100644 --- a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs @@ -69,8 +69,11 @@ namespace IRaCIS.Core.Application.Service CreateMap().ReverseMap(); CreateMap(); + CreateMap().ReverseMap(); + CreateMap() + .ForMember(d => d.QuestionMark, u => u.MapFrom(s => s.ReadingTableQuestionTrial == null ? null : s.ReadingTableQuestionTrial.QuestionMark)); - CreateMap(); + CreateMap(); CreateMap() .ForMember(d => d.SubjectVisitName, u => u.MapFrom(s => s.VisitStage==null?string.Empty: s.VisitStage.VisitName))