diff --git a/IRaCIS.Core.Application/Helper/OSSService.cs b/IRaCIS.Core.Application/Helper/OSSService.cs
index 47ad9e321..7cbe43924 100644
--- a/IRaCIS.Core.Application/Helper/OSSService.cs
+++ b/IRaCIS.Core.Application/Helper/OSSService.cs
@@ -93,7 +93,9 @@ namespace IRaCIS.Core.Application.Helper
public void DownLoadFromOSS(string ossRelativePath, string localFilePath);
+ public AliyunOSSOptions _OSSConfig { get; set; }
+ public OssClient _ossClient { get; set; }
}
public class OSSService : IOSSService
{
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 8a73e868f..6e78e508e 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -3977,6 +3977,11 @@
受试者ID
+
+
+ 阅片配置的类型
+
+
模块名称
@@ -13896,6 +13901,12 @@
+
+
+ 维护OSS 影像数据
+
+
+
维护临床数据 --一定要在同步表前同步数据才行
diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs
index 8aeb529d0..ac80c1f00 100644
--- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs
+++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs
@@ -205,7 +205,7 @@ namespace IRaCIS.Core.Application
ToBeRepliedCount = t.SubjectVisitList.Where(u => u.CheckState == CheckStateEnum.CVIng &&
u.CheckChallengeDialogList.OrderByDescending(t => t.CreateTime).First().UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count(),
- }).Where(x => x.ToBeRepliedCount > 0);
+ }).Where(x => x.ToBeRepliedCount+x.ToBeCheckedCount > 0);
var defalutSortArray = new string[] { nameof(CheckToBeDoneDto.UrgentCount) + " desc", nameof(CheckToBeDoneDto.ToBeCheckedCount) + " desc" };
@@ -679,7 +679,7 @@ namespace IRaCIS.Core.Application
{
var query = _trialRepository
- .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id))
+ .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id) && (t.IsUrgent || t.IsSubjectExpeditedView || t.IsEnrollementQualificationConfirm || t.IsPDProgressView))
.Select(t => new ImageSubmittedToBeDoneDto()
{
TrialId = t.Id,
diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs
index 8ef812d03..be1de8758 100644
--- a/IRaCIS.Core.Application/TestService.cs
+++ b/IRaCIS.Core.Application/TestService.cs
@@ -1,5 +1,7 @@
-using BeetleX;
+using Aliyun.OSS;
+using BeetleX;
using BeetleX.BNR;
+using Castle.DynamicProxy.Generators.Emitters.SimpleAST;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Service;
using IRaCIS.Core.Application.ViewModel;
@@ -15,7 +17,9 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using MiniExcelLibs;
using Minio;
+using NPOI.HPSF;
using NPOI.POIFS.Crypt;
+using Spire.Doc;
using System.Linq.Expressions;
using System.Reflection.Metadata;
using System.Security.Cryptography;
@@ -29,7 +33,7 @@ namespace IRaCIS.Application.Services
public class TestService : BaseService
{
- public static int IntValue = 100;
+ public static int IntValue = 100;
private readonly IRepository _dicRepository;
private readonly IRepository _trialRepository;
@@ -44,7 +48,7 @@ namespace IRaCIS.Application.Services
private readonly ILogger _logger;
- public TestService(IRepository dicRepository, IRepository trialRepository,ILogger logger
+ public TestService(IRepository dicRepository, IRepository trialRepository, ILogger logger
, IOptionsMonitor systemEmailConfig, IOptionsMonitor basicConfig, IRepository visitTaskRepository, IDistributedLockProvider distributedLockProvider)
{
@@ -56,12 +60,102 @@ namespace IRaCIS.Application.Services
_dicRepository = dicRepository;
_trialRepository = trialRepository;
- _distributedLockProvider= distributedLockProvider;
+ _distributedLockProvider = distributedLockProvider;
- _logger= logger;
+ _logger = logger;
//_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()
+ {
+
+
+ await _dicRepository._dbContext.Subject.Where(t => t.Id == Guid.Empty).ExecuteUpdateAsync(t => t
+ .SetProperty(c => EF.Property(c, "UpdateTime"), u => DateTime.Now)
+ .SetProperty(c => c.FirstName, u => "NewUserName"));
+
+ await _repository.BatchUpdateAsync(t => t.Id == Guid.Empty, u => new Subject() { FirstName = "fddd", LastName = "sss" });
+
+ return ResponseOutput.Ok();
+ }
+ // 设置 Ne
+
[AllowAnonymous]
public async Task TestMinIO([FromServices] IOptionsMonitor options)
{
@@ -70,32 +164,32 @@ namespace IRaCIS.Application.Services
var minioClient = new MinioClient().WithEndpoint($"{minIO.endpoint}:{minIO.port}")
- .WithCredentials(minIO.accessKey,minIO.secretKey)
+ .WithCredentials(minIO.accessKey, minIO.secretKey)
.Build();
//ResponseOutput.Ok(options)
- return await Task.FromResult(ResponseOutput.Ok(options)) ;
+ return await Task.FromResult(ResponseOutput.Ok(options));
}
[AllowAnonymous]
- public async Task TestDistributedLock( )
+ public async Task TestDistributedLock()
{
- await _repository.Where().Select(t => t.FullName).FirstNotNullAsync();
+ await _repository.Where().Select(t => t.FullName).FirstNotNullAsync();
Console.WriteLine($"我进来了当前值是:" + IntValue);
_logger.LogWarning($"我进来了当前值是:" + IntValue);
var @lock = _distributedLockProvider.CreateLock($"UserAccount");
- using (await @lock.AcquireAsync())
+ using (await @lock.AcquireAsync())
{
await Task.Delay(4);
IntValue--;
- _logger.LogWarning( IntValue.ToString());
+ _logger.LogWarning(IntValue.ToString());
Console.WriteLine(IntValue);
}