diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs index 1c37f91c..8932d483 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs @@ -315,11 +315,11 @@ namespace IRaCIS.Core.Application.Services if (item != null) { item.SeriesInstanceUid = string.Empty; + + item.InstanceList = thisRowinfo.Where(y => y.InstanceId != null).Select(y => y.InstanceId.Value).ToList(); - - var tempInstanceList = thisRowinfo.Where(y => y.InstanceId != null).Select(y => new { InstanceId = y.InstanceId.Value, y.Instance.Path, y.Instance.NumberOfFrames }).Distinct().ToList(); - - item.InstanceList = tempInstanceList.Select(y => y.InstanceId).ToList(); + var tempInstanceList = await _repository.Where(t => item.InstanceList.Contains(t.Id)).OrderBy(t => t.InstanceNumber) + .Select(t => new { t.Path, t.NumberOfFrames }).ToListAsync(); item.InstancePathList = tempInstanceList.SelectMany(u =>