diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs
index fcc503520..3d69edfc3 100644
--- a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs
+++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs
@@ -42,6 +42,7 @@ namespace IRaCIS.Core.Application.Contracts
//[JsonIgnore]
//public int NoneDicomCode { get; set; }
+ public string RecordPath { get; set; } = string.Empty;
public bool IsDicom { get; set; }
}
diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs
index 24c4a8a24..7a31272b7 100644
--- a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs
+++ b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs
@@ -496,7 +496,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
ArchiveFinishedTime = t.ArchiveFinishedTime,
-
+ RecordPath=t.RecordPath,
IsDicomReUpload = t.IsDicomReUpload,
StudyId = t.Id,
diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs
index 8481be5bf..eb856f767 100644
--- a/IRaCIS.Core.Application/TestService.cs
+++ b/IRaCIS.Core.Application/TestService.cs
@@ -371,80 +371,83 @@ namespace IRaCIS.Application.Services
}
- /////
- ///// 维护OSS 影像数据
- /////
- /////
- //[AllowAnonymous]
- //[UnitOfWork]
- //public async Task OldLocalImageResizeJpg([FromServices] IOSSService oSSService, [FromServices] IRepository _repository, [FromServices] IWebHostEnvironment _hostEnvironment)
- //{
+ ///
+ /// 维护OSS 影像数据
+ ///
+ ///
+ [AllowAnonymous]
+ [UnitOfWork]
+ public async Task OldLocalImageResizeJpg([FromServices] IOSSService oSSService, [FromServices] IRepository _repository, [FromServices] IWebHostEnvironment _hostEnvironment)
+ {
- // var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
+ var aliConfig = oSSService.ObjectStoreServiceOptions.AliyunOSS;
+ var _ossClient = new OssClient(aliConfig.endPoint, aliConfig.accessKeyId, aliConfig.accessKeySecret);
- // var studyList = _repository.Where(t => t.SeriesList.Any(t => t.ImageResizePath.Length < 10)).Select(t => new { t.TrialId, t.SiteId, t.SubjectId, t.SubjectVisitId, t.Id }).ToList();
+ var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
- // foreach (var studyitem in studyList)
- // {
+ var studyList = _repository.Where(t => t.SeriesList.Any(t => t.ImageResizePath.Length < 10)).Select(t => new { t.TrialId, t.SiteId, t.SubjectId, t.SubjectVisitId, t.Id }).ToList();
- // var relativePath = $"{studyitem.TrialId}/{studyitem.SiteId}/{studyitem.SubjectId}/{studyitem.SubjectVisitId}/{StaticData.Folder.DicomFolder}/{studyitem.Id}/";
+ foreach (var studyitem in studyList)
+ {
- // try
- // {
- // string nextMarker = null;
- // do
- // {
- // // 使用 prefix 模拟目录结构,设置 MaxKeys 和 NextMarker
- // var objectListing = oSSService._ossClient.ListObjects(new ListObjectsRequest(oSSService._OSSConfig.bucketName)
- // {
- // Prefix = relativePath,
- // MaxKeys = 1000,
- // Marker = nextMarker
- // });
+ var relativePath = $"{studyitem.TrialId}/{studyitem.SiteId}/{studyitem.SubjectId}/{studyitem.SubjectVisitId}/{StaticData.Folder.DicomFolder}/{studyitem.Id}/";
- // var jpgInfoList = objectListing.ObjectSummaries
- // .Where(summary => summary.Key.EndsWith(".jpg"))
- // .Select(summary =>
- // {
- // string fileName = summary.Key.Split('/').Last(); // 提取文件夹名
- // return new
- // {
+ try
+ {
+ string nextMarker = null;
+ do
+ {
+ // 使用 prefix 模拟目录结构,设置 MaxKeys 和 NextMarker
+ var objectListing = _ossClient.ListObjects(new ListObjectsRequest(aliConfig.bucketName)
+ {
+ Prefix = relativePath,
+ MaxKeys = 1000,
+ Marker = nextMarker
+ });
- // Key = summary.Key,
- // InstanceId = Guid.TryParse(
- // fileName.Split('.')[0],
- // out Guid instanceId)
- // ? instanceId
- // : Guid.Empty
- // };
- // })
- // .Where(info => info.InstanceId != Guid.Empty)
- // .ToList();
+ var jpgInfoList = objectListing.ObjectSummaries
+ .Where(summary => summary.Key.EndsWith(".jpg"))
+ .Select(summary =>
+ {
+ string fileName = summary.Key.Split('/').Last(); // 提取文件夹名
+ return new
+ {
- // foreach (var jpg in jpgInfoList)
- // {
- // var seriesId = _repository.Where(t => t.Id == jpg.InstanceId).Select(t => t.SeriesId).FirstOrDefault();
+ Key = summary.Key,
+ InstanceId = Guid.TryParse(
+ fileName.Split('.')[0],
+ out Guid instanceId)
+ ? instanceId
+ : Guid.Empty
+ };
+ })
+ .Where(info => info.InstanceId != Guid.Empty)
+ .ToList();
- // await _repository.BatchUpdateAsync(t => t.Id == seriesId, t => new DicomSeries() { ImageResizePath = "/" + jpg.Key });
- // }
+ foreach (var jpg in jpgInfoList)
+ {
+ var seriesId = _repository.Where(t => t.Id == jpg.InstanceId).Select(t => t.SeriesId).FirstOrDefault();
- // // 设置 NextMarker 以获取下一页的数据
- // nextMarker = objectListing.NextMarker;
+ await _repository.BatchUpdateAsync(t => t.Id == seriesId, t => new DicomSeries() { ImageResizePath = "/" + jpg.Key });
+ }
- // } while (!string.IsNullOrEmpty(nextMarker));
- // }
- // catch (Exception ex)
- // {
- // Console.WriteLine($"Error: {ex.Message}");
- // }
+ // 设置 NextMarker 以获取下一页的数据
+ nextMarker = objectListing.NextMarker;
- // await _repository.SaveChangesAsync();
- // }
+ } while (!string.IsNullOrEmpty(nextMarker));
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Error: {ex.Message}");
+ }
+
+ await _repository.SaveChangesAsync();
+ }
- // return ResponseOutput.Ok();
- //}
+ return ResponseOutput.Ok();
+ }
#endregion