diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs index a12d28ada..1cf028180 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs @@ -9,6 +9,16 @@ 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 CalculateTaskInDto { public Guid VisitTaskId { get; set; } 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 + } ///