遮盖影像修改
continuous-integration/drone/push Build is running
Details
continuous-integration/drone/push Build is running
Details
parent
2969306d1e
commit
c9ffa64560
|
|
@ -60,6 +60,14 @@ namespace IRaCIS.Core.Application.Service
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#region 方式一 有的必须在内存中,不能用这种
|
||||||
|
//await using var source = await sourceFactory();
|
||||||
|
//// 如果你是从 stream 打开
|
||||||
|
//var dicomFile = await DicomFile.OpenAsync(source);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 方式二
|
||||||
await using var source = await sourceFactory();
|
await using var source = await sourceFactory();
|
||||||
|
|
||||||
// 【关键修复】将 OSS 流缓冲到 MemoryStream
|
// 【关键修复】将 OSS 流缓冲到 MemoryStream
|
||||||
|
|
@ -79,6 +87,8 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
// 如果你是从 stream 打开
|
// 如果你是从 stream 打开
|
||||||
var dicomFile = await DicomFile.OpenAsync(source.CanSeek ? source : bufferedStream);
|
var dicomFile = await DicomFile.OpenAsync(source.CanSeek ? source : bufferedStream);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
//获取像素是否为封装形式
|
//获取像素是否为封装形式
|
||||||
var syntax = dicomFile.Dataset.InternalTransferSyntax;
|
var syntax = dicomFile.Dataset.InternalTransferSyntax;
|
||||||
|
|
@ -211,8 +221,12 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
var oldVisits = MiniExcel.Query<SubjectVisitExcel>(Path.Combine(rootFolder, "Old.xlsx")).ToList();
|
||||||
|
|
||||||
var downloadVisits = MiniExcel.Query<SubjectVisitExcel>(Path.Combine(rootFolder, "download.xlsx")).ToList().Where(t => t.SubjectCode.IsNotNullOrEmpty() && t.VisitName.IsNotNullOrEmpty());
|
var downloadVisits = MiniExcel.Query<SubjectVisitExcel>(Path.Combine(rootFolder, "download.xlsx")).ToList().Where(t => t.SubjectCode.IsNotNullOrEmpty() && t.VisitName.IsNotNullOrEmpty()).ToList();
|
||||||
|
|
||||||
|
downloadVisits= downloadVisits.Where(t => !oldVisits.Any(old => old.VisitNum == t.VisitNum && old.SubjectCode == t.SubjectCode &&
|
||||||
|
old.VisitName.Trim().ToLower() == t.VisitName.Trim().ToLower())).ToList();
|
||||||
|
|
||||||
var downloadJobs = new List<DownloadJob>();
|
var downloadJobs = new List<DownloadJob>();
|
||||||
|
|
||||||
|
|
@ -308,6 +322,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.Logger.Warning($"开始获取访视信息准备下载任务:{visitItem.SubjectCode} {visitItem.VisitName} {visitItem.VisitNum}");
|
||||||
|
|
||||||
foreach (var studyInfo in visitItem.StudyList)
|
foreach (var studyInfo in visitItem.StudyList)
|
||||||
{
|
{
|
||||||
|
|
@ -502,6 +517,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -515,14 +531,14 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Log.Logger.Warning($"访视信息准备完毕: {downloadVisits.Count},后端开始下载任务......");
|
||||||
|
|
||||||
#region 异步方式处理
|
#region 异步方式处理
|
||||||
|
|
||||||
int totalCount = downloadJobs.Count;
|
int totalCount = downloadJobs.Count;
|
||||||
int downloadedCount = 0;
|
int downloadedCount = 0;
|
||||||
|
|
||||||
Log.Logger.Warning($"开始下载总数: {totalCount}");
|
Log.Logger.Warning($"下载文件总数: {totalCount}");
|
||||||
foreach (var job in downloadJobs)
|
foreach (var job in downloadJobs)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
||||||
|
|
@ -82,9 +82,35 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#region 方式一 有的必须在内存中,不能用这种
|
||||||
|
//await using var source = await sourceFactory();
|
||||||
|
//// 如果你是从 stream 打开
|
||||||
|
//var dicomFile = await DicomFile.OpenAsync(source);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 方式二
|
||||||
|
|
||||||
await using var source = await sourceFactory();
|
await using var source = await sourceFactory();
|
||||||
|
|
||||||
|
// 【关键修复】将 OSS 流缓冲到 MemoryStream
|
||||||
|
using var bufferedStream = new MemoryStream();
|
||||||
|
|
||||||
|
if (source.CanSeek)
|
||||||
|
{
|
||||||
|
source.Position = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 完全复制到内存流
|
||||||
|
await source.CopyToAsync(bufferedStream);
|
||||||
|
bufferedStream.Position = 0; // 重置位置
|
||||||
|
}
|
||||||
|
|
||||||
// 如果你是从 stream 打开
|
// 如果你是从 stream 打开
|
||||||
var dicomFile = await DicomFile.OpenAsync(source);
|
var dicomFile = await DicomFile.OpenAsync(source.CanSeek ? source : bufferedStream);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
//获取像素是否为封装形式
|
//获取像素是否为封装形式
|
||||||
var syntax = dicomFile.Dataset.InternalTransferSyntax;
|
var syntax = dicomFile.Dataset.InternalTransferSyntax;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue