diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs index a12d28ada..59d8244ce 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs @@ -9,6 +9,39 @@ using System.Collections.Generic; namespace IRaCIS.Core.Application.Service.Reading.Dto { + public class GetPPDInfoInDto + { + public Guid VisitTaskId { get; set; } + + public Guid QuestionId { get; set; } + + public decimal RowIndex { get; set; } + + } + + public class GetPPDInfoOutDto + { + /// + /// 最低的PPD + /// + public decimal? NadirPPD { get; set; } + + /// + /// 最低PPD的访视 + /// + public string? LowPPDVisit { get; set; } + + /// + /// 该病灶PPD值最小的访视的长径 + /// + public decimal? LowPPDLDi { get; set; } + + /// + /// 该病灶PPD值最小的访视的短径 + /// + public decimal? LowPPDSDi { get; set; } + } + public class CalculateTaskInDto { public Guid VisitTaskId { get; set; } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs index 4a5941163..f05a5e11c 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs @@ -113,7 +113,7 @@ namespace IRaCIS.Application.Services foreach (var item in inDto.QuestionList) { - await _readingGlobalTaskInfoRepository.BatchDeleteNoTrackingAsync(x => x.GlobalTaskId == inDto.GlobalTaskId && x.TaskId == visitTaskId && x.GlobalAnswerType == item.GlobalAnswerType && x.QuestionId == item.QuestionId); + await _readingGlobalTaskInfoRepository.BatchDeleteNoTrackingAsync(x => x.GlobalTaskId == inDto.GlobalTaskId && x.TaskId == item.VisitTaskId && x.GlobalAnswerType == item.GlobalAnswerType && x.QuestionId == item.QuestionId); await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == item.VisitTaskId && x.ReadingQuestionTrialId == item.QuestionId && x.Answer != item.Answer && item.Answer != string.Empty && item.Answer != null @@ -124,6 +124,7 @@ namespace IRaCIS.Application.Services }); } + var createtime = DateTime.Now; await _readingGlobalTaskInfoRepository.AddRangeAsync(inDto.QuestionList.Select(x => new ReadingGlobalTaskInfo() { Answer = x.Answer, @@ -133,6 +134,7 @@ namespace IRaCIS.Application.Services GlobalAnswerType = x.GlobalAnswerType, TaskId = x.VisitTaskId, TrialId = inDto.TrialId, + CreateTime= createtime, }).ToList()); await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.Id == inDto.GlobalTaskId, u => new VisitTask() { ReadingTaskState = ReadingTaskState.Reading }); diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs index c87934ed2..d5babeb63 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs @@ -11,6 +11,7 @@ using Microsoft.Extensions.Caching.Memory; using IRaCIS.Core.Infrastructure; using MassTransit; +using System.Reflection.Metadata.Ecma335; namespace IRaCIS.Core.Application.Service.ReadingCalculate { @@ -351,7 +352,61 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate await ReadingCalculate(readingData,new List() { type}); } + /// + /// 获取最低PDD信息 + /// + /// + /// + [HttpPost] + public async Task GetLowPPDInfo(GetPPDInfoInDto inDto) + { + GetPPDInfoOutDto result = new GetPPDInfoOutDto(); + var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).ProjectTo(_mapper.ConfigurationProvider).FirstNotNullAsync(); + var visitTaskIds = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit && + x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId && + x.IsAnalysisCreate == taskinfo.IsAnalysisCreate && + x.DoctorUserId == taskinfo.DoctorUserId && + x.IsSelfAnalysis == taskinfo.IsSelfAnalysis && + x.SubjectId == taskinfo.SubjectId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ArmEnum == taskinfo.ArmEnum + && x.VisitTaskNum < taskinfo.VisitTaskNum && x.TaskState == TaskState.Effect + ).OrderByDescending(x => x.VisitTaskNum).Select(x => x.Id).ToListAsync(); + var answerList = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId) + && x.QuestionId == inDto.QuestionId + && x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.PPD && x.RowIndex == inDto.RowIndex) + .Select(x => new + { + x.Answer, + x.VisitTaskId, + }).ToListAsync(); + + var lowPddTaskid = answerList.Select(x => new + { + Answer = x.Answer.IsNullOrEmptyReturn0(), + x.VisitTaskId + }).OrderBy(x => x.Answer).Select(x => x.VisitTaskId).FirstOrDefault(); + + if (lowPddTaskid != null&& lowPddTaskid!=default(Guid)) + { + + var lowPPDAnswerList = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId) + && x.QuestionId == inDto.QuestionId + && x.RowIndex == inDto.RowIndex).Include(x => x.ReadingTableQuestionTrial) + .Select(x => new + { + x.Answer, + x.ReadingTableQuestionTrial.QuestionMark, + }).ToListAsync(); + + result.LowPPDSDi = lowPPDAnswerList.Where(x => x.QuestionMark == QuestionMark.PPD).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0(); + result.LowPPDLDi = lowPPDAnswerList.Where(x => x.QuestionMark == QuestionMark.MajorAxis).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0(); + result.LowPPDSDi = lowPPDAnswerList.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0(); + result.LowPPDVisit = await _visitTaskRepository.Where(x => x.Id == lowPddTaskid).Select(x => x.TaskBlindName).FirstOrDefaultAsync(); + } + + return result; + + } /// /// 计算任务 diff --git a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs index 99889d0b2..0558b4bff 100644 --- a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs +++ b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs @@ -1533,10 +1533,66 @@ namespace IRaCIS.Core.Domain.Share /// Part = 8, + /// + /// 首次标记访视 + /// + FirstMarkingVisit = 9, + + /// + /// 部位描述 + /// + BodyPartDescription = 10, + /// /// 病灶数量 /// - LesionNumber=11, + LesionNumber =11, + + /// + /// PPD + /// + PPD = 12, + + /// + /// 最低点PPD + /// + NadirPPD = 13, + + /// + /// PPD最低点所在访视 + /// + LowPPDVisit = 14, + + /// + /// PPD最低点LDi + /// + LowPPDLDi = 15, + + /// + /// PPD最低点SDi + /// + LowPPDSDi = 16, + + /// + /// 相比最低点PPD增加百分比 + /// + LowPPDAddPercent = 17, + + /// + /// 相比PPD最低点LDi增加值 + /// + LowPPDLDiAdded = 18, + + /// + /// 相比PPD最低点SDi增加值 + /// + LowPPDSDiAdded = 19, + + /// + /// SUVmax + /// + SUVmax = 20 + } ///