Merge branch 'Test.IRC' of http://192.168.3.68:2000/XCKJ/irc-netcore-api into Test.IRC
continuous-integration/drone/push Build is passing Details

IRC_NewDev
he 2023-12-11 14:18:40 +08:00
commit 6f1651dfc5
4 changed files with 120 additions and 13 deletions

View File

@ -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
{

View File

@ -3977,6 +3977,11 @@
受试者ID
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetCanChangeReadVisitListInDto.ReadingSetType">
<summary>
阅片配置的类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ChangeCutOffVisitInDto.Name">
<summary>
模块名称
@ -13896,6 +13901,12 @@
<param name="outEnrollTime"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Application.Services.TestService.OldLocalImageResizeJpg(IRaCIS.Core.Application.Helper.IOSSService,IRaCIS.Core.Infra.EFCore.IRepository,Microsoft.AspNetCore.Hosting.IWebHostEnvironment)">
<summary>
维护OSS 影像数据
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Application.Services.TestService.ModifyClinicalDataTable">
<summary>
维护临床数据 --一定要在同步表前同步数据才行

View File

@ -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,

View File

@ -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<Dictionary> _dicRepository;
private readonly IRepository<Trial> _trialRepository;
@ -44,7 +48,7 @@ namespace IRaCIS.Application.Services
private readonly ILogger<TestService> _logger;
public TestService(IRepository<Dictionary> dicRepository, IRepository<Trial> trialRepository,ILogger<TestService> logger
public TestService(IRepository<Dictionary> dicRepository, IRepository<Trial> trialRepository, ILogger<TestService> logger
, IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig, IOptionsMonitor<ServiceVerifyConfigOption> basicConfig, IRepository<VisitTask> 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;
}
/// <summary>
/// 维护OSS 影像数据
/// </summary>
/// <returns></returns>
[AllowAnonymous]
[UnitOfWork]
public async Task<IResponseOutput> OldLocalImageResizeJpg([FromServices] IOSSService oSSService, [FromServices] IRepository _repository, [FromServices] IWebHostEnvironment _hostEnvironment)
{
var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
var studyList = _repository.Where<DicomStudy>(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<DicomInstance>(t=>t.Id==jpg.InstanceId).Select(t=>t.SeriesId).FirstOrDefault();
await _repository.BatchUpdateAsync<DicomSeries>(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<IResponseOutput> TestEFcore8()
{
await _dicRepository._dbContext.Subject.Where(t => t.Id == Guid.Empty).ExecuteUpdateAsync(t => t
.SetProperty(c => EF.Property<DateTime>(c, "UpdateTime"), u => DateTime.Now)
.SetProperty(c => c.FirstName, u => "NewUserName"));
await _repository.BatchUpdateAsync<Subject>(t => t.Id == Guid.Empty, u => new Subject() { FirstName = "fddd", LastName = "sss" });
return ResponseOutput.Ok();
}
// 设置 Ne
[AllowAnonymous]
public async Task<IResponseOutput> TestMinIO([FromServices] IOptionsMonitor<ObjectStoreServiceOptions> 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<IResponseOutput>(ResponseOutput.Ok(options)) ;
return await Task.FromResult<IResponseOutput>(ResponseOutput.Ok(options));
}
[AllowAnonymous]
public async Task<IResponseOutput> TestDistributedLock( )
public async Task<IResponseOutput> TestDistributedLock()
{
await _repository.Where<User>().Select(t => t.FullName).FirstNotNullAsync();
await _repository.Where<User>().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);
}