From c91e21c23a037013e11c179b048e8852d957acbf Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 22 Apr 2024 17:19:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E6=9F=A5=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=BA=8F=E5=88=97=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Visit/DTO/VisitPointViewModel.cs | 2 ++ .../Service/Visit/SubjectVisitService.cs | 23 +++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Visit/DTO/VisitPointViewModel.cs b/IRaCIS.Core.Application/Service/Visit/DTO/VisitPointViewModel.cs index 5e08a5994..de40a0364 100644 --- a/IRaCIS.Core.Application/Service/Visit/DTO/VisitPointViewModel.cs +++ b/IRaCIS.Core.Application/Service/Visit/DTO/VisitPointViewModel.cs @@ -244,6 +244,8 @@ namespace IRaCIS.Core.Application.Contracts public class GetDicomSeriesInfoInDto { + [NotDefault] + public Guid TrialId { get; set; } public Guid SeriesId { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs index 896dab968..384563cff 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs @@ -14,6 +14,7 @@ using IRaCIS.Core.Application.Service.Reading.Dto; using IRaCIS.Application.Services; using Microsoft.Extensions.DependencyInjection; using DocumentFormat.OpenXml.Drawing.Charts; +using IRaCIS.Core.Domain.Models; namespace IRaCIS.Core.Application.Services { @@ -268,12 +269,12 @@ namespace IRaCIS.Core.Application.Services }).ToListAsync(); var studyIds = studyList.Select(t => t.StudyId).ToList(); - var instanceList = await _repository.Where(t => studyIds.Contains(t.StudyId)) + var instanceList = await _repository.Where(t => studyIds.Contains(t.StudyId) && t.TrialId == trialId) .Select(t => new { t.SeriesId, t.Id, t.InstanceNumber, t.Path, t.NumberOfFrames,t.HtmlPath }).ToListAsync(); foreach (var t in studyList) { - t.SeriesList = await _repository.Where(s => s.StudyId == t.StudyId) + t.SeriesList = await _repository.Where(s => s.StudyId == t.StudyId && s.TrialId == trialId) .WhereIf(isReading == 1, s => s.IsReading).OrderBy(s => s.SeriesNumber).ThenBy(s => s.SeriesTime) .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); @@ -335,9 +336,10 @@ namespace IRaCIS.Core.Application.Services [HttpPost] public async Task GetDicomSeriesInfo(GetDicomSeriesInfoInDto inDto) { - DicomSeriesDTO series = await _repository.Where(s =>s.Id==inDto.SeriesId).ProjectTo(_mapper.ConfigurationProvider).FirstNotNullAsync(); + var trialId = inDto.TrialId; + DicomSeriesDTO series = await _repository.Where(s =>s.Id==inDto.SeriesId && s.TrialId == trialId).ProjectTo(_mapper.ConfigurationProvider).FirstNotNullAsync(); - var instanceList = await _repository.Where(t => t.SeriesId==inDto.SeriesId) + var instanceList = await _repository.Where(t => t.SeriesId==inDto.SeriesId && t.TrialId == trialId) .Select(t => new { t.SeriesId, t.StudyId, t.Id, t.InstanceNumber, t.Path, t.NumberOfFrames, t.WindowCenter, t.WindowWidth, t.HtmlPath ,t.SliceLocation}).ToListAsync(); series.InstanceList = instanceList.Where(t => t.SeriesId == series.Id).OrderByDescending(t => t.SliceLocation).ThenBy(t=>t.InstanceNumber).Select(k => k.Id).ToList(); @@ -522,6 +524,7 @@ namespace IRaCIS.Core.Application.Services [HttpPost] public async Task> GetReadingVisitStudyList(GetReadingVisitStudyListIndto indto) { + var trialId = indto.TrialId; var result = new List(); var thisRowinfo = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId && x.StudyId != null).OrderBy(x => x.ReadingQuestionTrial.ShowOrder).ThenBy(x => x.RowIndex).Select(x => new @@ -543,7 +546,7 @@ namespace IRaCIS.Core.Application.Services var thisSeriesIdIds = thisRowinfo.Where(x => x.SeriesId != null).OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex).Select(x => x.SeriesId).Distinct().ToList(); if (thisRowinfo.Count > 0) { - var thisVisitTaskStudy = await _repository.Where(t => thisStudyIds.Contains(t.Id)).Select(k => new VisitStudyDTO() + var thisVisitTaskStudy = await _repository.Where(t => thisStudyIds.Contains(t.Id) && t.TrialId==trialId).Select(k => new VisitStudyDTO() { InstanceCount = k.InstanceCount, @@ -557,7 +560,7 @@ namespace IRaCIS.Core.Application.Services if (thisVisitTaskStudy != null) { thisVisitTaskStudy.StudyId = default(Guid); - var item = await _repository.Where(s => thisSeriesIdIds.Contains(s.Id)).OrderBy(s => s.SeriesNumber). + var item = await _repository.Where(s => thisSeriesIdIds.Contains(s.Id) && s.TrialId == trialId).OrderBy(s => s.SeriesNumber). ThenBy(s => s.SeriesTime) .ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); @@ -567,7 +570,7 @@ namespace IRaCIS.Core.Application.Services item.InstanceList = thisRowinfo.Where(y => y.InstanceId != null).OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex).Select(y => y.InstanceId!.Value).Distinct().ToList(); - var tempInstanceList = await _repository.Where(t => item.InstanceList.Contains(t.Id)).OrderBy(t => t.InstanceNumber) + var tempInstanceList = await _repository.Where(t => item.InstanceList.Contains(t.Id) && t.TrialId == trialId).OrderBy(t => t.InstanceNumber) .Select(t => new TempInstance { @@ -616,7 +619,7 @@ namespace IRaCIS.Core.Application.Services item.Description = "Key Series"; - var modalityList = await _repository.Where(s => thisSeriesIdIds.Contains(s.Id)).OrderBy(s => s.SeriesNumber). + var modalityList = await _repository.Where(s => thisSeriesIdIds.Contains(s.Id) && s.TrialId == trialId).OrderBy(s => s.SeriesNumber). ThenBy(s => s.SeriesTime).Select(x => x.Modality).Distinct().ToListAsync(); ; item.Modality = string.Join(",", modalityList); thisVisitTaskStudy.SeriesList.Add(item); @@ -653,12 +656,12 @@ namespace IRaCIS.Core.Application.Services }).ToListAsync(); var studyIds = studyList.Select(t => t.StudyId).ToList(); - var instanceList = await _repository.Where(t => studyIds.Contains(t.StudyId)) + var instanceList = await _repository.Where(t => studyIds.Contains(t.StudyId) && t.TrialId == trialId) .Select(t => new { t.SeriesId, t.Id, t.InstanceNumber, t.Path, t.NumberOfFrames,t.WindowCenter,t.WindowWidth,t.HtmlPath }).ToListAsync(); - List seriesLists = await _repository.Where(s => studyIds.Contains(s.StudyId) /*&& s.IsReading*/) + List seriesLists = await _repository.Where(s => studyIds.Contains(s.StudyId) && s.TrialId == trialId /*&& s.IsReading*/) .WhereIf(isManualGenerate==false, t => t.IsReading) .WhereIf(isManualGenerate, t => t.SubjectCriteriaEvaluationVisitStudyFilterList.Any(t => t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && t.IsConfirmed && t.IsReading)) .OrderBy(s => s.SeriesNumber).