From 558ed488749e7bbcb5f451234cfe1175168f5ba6 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Wed, 10 Jan 2024 14:56:34 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE=E6=96=87?=
=?UTF-8?q?=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
IRaCIS.Core.API/appsettings.Test_IRC.json | 2 +-
.../IRaCIS.Core.Application.xml | 18 +-
IRaCIS.Core.Application/TestService.cs | 198 ++++++++----------
3 files changed, 94 insertions(+), 124 deletions(-)
diff --git a/IRaCIS.Core.API/appsettings.Test_IRC.json b/IRaCIS.Core.API/appsettings.Test_IRC.json
index 2ab92a091..e173b6993 100644
--- a/IRaCIS.Core.API/appsettings.Test_IRC.json
+++ b/IRaCIS.Core.API/appsettings.Test_IRC.json
@@ -14,7 +14,7 @@
"ObjectStoreService": {
- "ObjectStoreUse": "AliyunOSS",
+ "ObjectStoreUse": "MinIO",
"AliyunOSS": {
"regionId": "cn-shanghai",
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 7f49a0446..163fe9223 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -84,17 +84,16 @@
-
+
- oosFolderPath 不要 "/ "开头 应该: TempFolder/ChildFolder
+ oosFolderPath 不要 "/ "开头 应该: TempFolder/ChildFolder
-
-
+
oosFolderPath 不要 "/ "开头 应该: TempFolder/ChildFolder
@@ -1023,6 +1022,11 @@
阅读片人
+
+
+ 角色
+
+
是否有签名
@@ -13927,12 +13931,6 @@
-
-
- 维护OSS 影像数据
-
-
-
维护临床数据 --一定要在同步表前同步数据才行
diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs
index 156f0d6b2..cca5680bd 100644
--- a/IRaCIS.Core.Application/TestService.cs
+++ b/IRaCIS.Core.Application/TestService.cs
@@ -69,80 +69,6 @@ namespace IRaCIS.Application.Services
//_cache = cache;
}
- ///
- /// 维护OSS 影像数据
- ///
- ///
- [AllowAnonymous]
- [UnitOfWork]
- public async Task OldLocalImageResizeJpg([FromServices] IOSSService oSSService, [FromServices] IRepository _repository, [FromServices] IWebHostEnvironment _hostEnvironment)
- {
-
- var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
-
- 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();
-
- foreach (var studyitem in studyList)
- {
-
- var relativePath = $"{studyitem.TrialId}/{studyitem.SiteId}/{studyitem.SubjectId}/{studyitem.SubjectVisitId}/{StaticData.Folder.DicomFolder}/{studyitem.Id}/";
-
- 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 jpgInfoList = objectListing.ObjectSummaries
- .Where(summary => summary.Key.EndsWith(".jpg"))
- .Select(summary =>
- {
- string fileName = summary.Key.Split('/').Last(); // 提取文件夹名
- return new
- {
-
- Key = summary.Key,
- InstanceId = Guid.TryParse(
- fileName.Split('.')[0],
- out Guid instanceId)
- ? instanceId
- : Guid.Empty
- };
- })
- .Where(info => info.InstanceId != Guid.Empty)
- .ToList();
-
- foreach (var jpg in jpgInfoList)
- {
- var seriesId = _repository.Where(t => t.Id == jpg.InstanceId).Select(t => t.SeriesId).FirstOrDefault();
-
- await _repository.BatchUpdateAsync(t => t.Id == seriesId, t => new DicomSeries() { ImageResizePath = "/" + jpg.Key });
- }
-
- // 设置 NextMarker 以获取下一页的数据
- nextMarker = objectListing.NextMarker;
-
- } while (!string.IsNullOrEmpty(nextMarker));
- }
- catch (Exception ex)
- {
- Console.WriteLine($"Error: {ex.Message}");
- }
-
- await _repository.SaveChangesAsync();
- }
-
-
-
- return ResponseOutput.Ok();
- }
public async Task TestEFcore8()
@@ -160,26 +86,14 @@ namespace IRaCIS.Application.Services
// 设置 Ne
[AllowAnonymous]
- public async Task TestMinIO([FromServices] IOptionsMonitor options)
+ public async Task TestMinIO([FromServices] IOSSService oSSService)
{
- await _repository.BatchUpdateAsync(t => t.Id == Guid.Empty, t => new Subject() { Id = Guid.Empty });
+ await oSSService.UploadToOSSAsync("C:\\Users\\Administrator\\Desktop\\TrialSiteUserImportTemplate.xlsx", "myfolder");
- var minIO = options.CurrentValue.MinIO;
+ await oSSService.DownLoadFromOSSAsync("myfolder/TrialSiteUserImportTemplate.xlsx", "C:\\Users\\Administrator\\Desktop\\TrialSiteUserImportTemplateoss.xlsx");
-
- var minioClient = new MinioClient().WithEndpoint($"{minIO.endpoint}:{minIO.port}")
- .WithCredentials(minIO.accessKey, minIO.secretKey).WithSSL(false)
- .Build();
-
- var putObjectArgs = new PutObjectArgs()
- .WithBucket(minIO.bucketName)
- .WithObject("myfolder/test.txt")
- .WithFileName("C:\\Users\\Administrator\\Desktop\\TrialSiteUserImportTemplate.xlsx");
-
- await minioClient.PutObjectAsync(putObjectArgs);
-
- return await Task.FromResult(ResponseOutput.Ok(options));
+ return ResponseOutput.Ok();
}
[AllowAnonymous]
@@ -310,24 +224,6 @@ namespace IRaCIS.Application.Services
- private static Dictionary _replacePatterns = new Dictionary()
- {
- { "test", "Atlanta Knight" },
- { "GAME_TIME", "7:30pm" },
- { "GAME_NUMBER", "161" },
- { "DATE", "October 18 2018" },
- };
-
- private static string ReplaceFunc(string findStr)
- {
- if (_replacePatterns.ContainsKey(findStr))
- {
- return _replacePatterns[findStr];
- }
- return findStr;
- }
-
-
[AllowAnonymous]
public async Task testwwwww([FromServices] IWebHostEnvironment env)
{
@@ -433,11 +329,7 @@ namespace IRaCIS.Application.Services
- public string PostData(TestModel testModelList)
- {
- return String.Empty;
- }
-
+ #region 历史维护
///
/// 维护临床数据 --一定要在同步表前同步数据才行
///
@@ -477,6 +369,86 @@ namespace IRaCIS.Application.Services
}
+ /////
+ ///// 维护OSS 影像数据
+ /////
+ /////
+ //[AllowAnonymous]
+ //[UnitOfWork]
+ //public async Task OldLocalImageResizeJpg([FromServices] IOSSService oSSService, [FromServices] IRepository _repository, [FromServices] IWebHostEnvironment _hostEnvironment)
+ //{
+
+ // var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
+
+ // 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();
+
+ // foreach (var studyitem in studyList)
+ // {
+
+ // var relativePath = $"{studyitem.TrialId}/{studyitem.SiteId}/{studyitem.SubjectId}/{studyitem.SubjectVisitId}/{StaticData.Folder.DicomFolder}/{studyitem.Id}/";
+
+ // 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 jpgInfoList = objectListing.ObjectSummaries
+ // .Where(summary => summary.Key.EndsWith(".jpg"))
+ // .Select(summary =>
+ // {
+ // string fileName = summary.Key.Split('/').Last(); // 提取文件夹名
+ // return new
+ // {
+
+ // Key = summary.Key,
+ // InstanceId = Guid.TryParse(
+ // fileName.Split('.')[0],
+ // out Guid instanceId)
+ // ? instanceId
+ // : Guid.Empty
+ // };
+ // })
+ // .Where(info => info.InstanceId != Guid.Empty)
+ // .ToList();
+
+ // foreach (var jpg in jpgInfoList)
+ // {
+ // var seriesId = _repository.Where(t => t.Id == jpg.InstanceId).Select(t => t.SeriesId).FirstOrDefault();
+
+ // await _repository.BatchUpdateAsync(t => t.Id == seriesId, t => new DicomSeries() { ImageResizePath = "/" + jpg.Key });
+ // }
+
+ // // 设置 NextMarker 以获取下一页的数据
+ // nextMarker = objectListing.NextMarker;
+
+ // } while (!string.IsNullOrEmpty(nextMarker));
+ // }
+ // catch (Exception ex)
+ // {
+ // Console.WriteLine($"Error: {ex.Message}");
+ // }
+
+ // await _repository.SaveChangesAsync();
+ // }
+
+
+
+ // return ResponseOutput.Ok();
+ //}
+
+
+ #endregion
+
+
+
}
public class TestModel