影像汇总修改
continuous-integration/drone/push Build is running
Details
continuous-integration/drone/push Build is running
Details
parent
a13917bded
commit
2c3f35c26b
|
@ -389,14 +389,12 @@ public class OSSService : IOSSService
|
|||
|
||||
var _ossClient = new OssClient(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? aliConfig.EndPoint : aliConfig.InternalEndpoint, AliyunOSSTempToken.AccessKeyId, AliyunOSSTempToken.AccessKeySecret, AliyunOSSTempToken.SecurityToken);
|
||||
|
||||
// 上传文件
|
||||
var result = _ossClient.GetObject(aliConfig.BucketName, ossRelativePath);
|
||||
|
||||
// 将下载的文件流保存到本地文件
|
||||
using (var fs = File.OpenWrite(localFilePath))
|
||||
{
|
||||
result.Content.CopyTo(fs);
|
||||
fs.Close();
|
||||
await result.Content.CopyToAsync(fs);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -180,22 +180,51 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
}
|
||||
|
||||
#region 异步方式处理
|
||||
|
||||
const int batchSize = 15;
|
||||
int totalCount = downloadJobs.Count;
|
||||
int downloadedCount = 0;
|
||||
|
||||
for (int i = 0; i < downloadJobs.Count; i += batchSize)
|
||||
foreach (var job in downloadJobs)
|
||||
{
|
||||
var batch = downloadJobs.Skip(i).Take(batchSize).Select(job => job());
|
||||
try
|
||||
{
|
||||
await job();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"下载失败: {ex.Message}");
|
||||
}
|
||||
|
||||
await Task.WhenAll(batch);
|
||||
|
||||
downloadedCount += batch.Count();
|
||||
downloadedCount++;
|
||||
|
||||
// 每处理50个,输出一次进度(或最后一个时也输出)
|
||||
if (downloadedCount % 50 == 0 || downloadedCount == totalCount)
|
||||
{
|
||||
Console.WriteLine($"已下载 {downloadedCount} / {totalCount} 个文件,完成 {(downloadedCount * 100.0 / totalCount):F2}%");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 多线程测试
|
||||
|
||||
//const int batchSize = 15;
|
||||
//int totalCount = downloadJobs.Count;
|
||||
//int downloadedCount = 0;
|
||||
|
||||
//for (int i = 0; i < downloadJobs.Count; i += batchSize)
|
||||
//{
|
||||
// var batch = downloadJobs.Skip(i).Take(batchSize).Select(job => job());
|
||||
|
||||
// await Task.WhenAll(batch);
|
||||
|
||||
// downloadedCount += batch.Count();
|
||||
|
||||
// Console.WriteLine($"已下载 {downloadedCount} / {totalCount} 个文件,完成 {(downloadedCount * 100.0 / totalCount):F2}%");
|
||||
//}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
|
||||
|
|
|
@ -612,6 +612,9 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
|
||||
public bool IsKeyImage { get; set; }
|
||||
|
||||
// true 导出阅片,null 就是所有影像
|
||||
public bool? IsExportReading { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
@ -655,8 +658,14 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
public long? TotalImageSize { get; set; }
|
||||
|
||||
public long? TotalReadingImageSize { get; set; }
|
||||
|
||||
public string TotalImageSizeStr => TotalImageSize.HasValue
|
||||
? $"{TotalImageSize.Value / 1024d / 1024d:F3} MB"
|
||||
: "0.000 MB";
|
||||
|
||||
public string TotalReadingImageSizeStr => TotalReadingImageSize.HasValue
|
||||
? $"{TotalReadingImageSize.Value / 1024d / 1024d:F3} MB"
|
||||
: "0.000 MB";
|
||||
|
||||
public string ImageTypeStr => $"{(IsHaveDicom ? "DICOM" : "")}{(IsHaveNoneDicom&&IsHaveDicom?" , ":"")}{(IsHaveNoneDicom ? "Non-DICOM" : "")}";
|
||||
|
@ -710,6 +719,22 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
? $"{TotalImageSize.Value / SubjectVisitCount / 1024d / 1024d:F3} MB"
|
||||
: "0.000 MB";
|
||||
|
||||
public long? TotalReadingImageSize { get; set; }
|
||||
|
||||
|
||||
public string TotalReadingImageSizeStr => TotalReadingImageSize.HasValue
|
||||
? $"{TotalReadingImageSize.Value / 1024d / 1024d:F3} MB"
|
||||
: "0.000 MB";
|
||||
|
||||
|
||||
public string SubjectReadingImageAVGSizeStr => TotalReadingImageSize.HasValue
|
||||
? $"{TotalReadingImageSize.Value / SubjectCount / 1024d / 1024d:F3} MB"
|
||||
: "0.000 MB";
|
||||
|
||||
|
||||
public string SubjectVisitReadingImageAVGSizeStr => TotalReadingImageSize.HasValue
|
||||
? $"{TotalReadingImageSize.Value / SubjectVisitCount / 1024d / 1024d:F3} MB"
|
||||
: "0.000 MB";
|
||||
|
||||
}
|
||||
public class TrialImageDownloadView
|
||||
|
|
|
@ -1218,6 +1218,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
TotalImageSize = t.StudyList.SelectMany(t => t.InstanceList).Sum(t => t.FileSize) + t.NoneDicomStudyList.SelectMany(t => t.NoneDicomFileList).Sum(t => t.FileSize),
|
||||
|
||||
TotalReadingImageSize = t.StudyList.SelectMany(t => t.InstanceList.Where(t => t.IsReading && t.DicomSerie.IsReading)).Sum(t => t.FileSize)
|
||||
+ t.NoneDicomStudyList.Where(t => t.IsReading).SelectMany(t => t.NoneDicomFileList.Where(t => t.IsReading)).Sum(t => t.FileSize),
|
||||
|
||||
|
||||
//DicomStudyCount = t.StudyList.Count(),
|
||||
//NoneDicomStudyCount = t.NoneDicomStudyList.Count(),
|
||||
|
@ -1249,6 +1252,10 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
{
|
||||
SubjectId = g.Key,
|
||||
VisitCount = g.Count(),
|
||||
ReadingImageSize = g.SelectMany(t => t.NoneDicomStudyList.Where(t => t.IsReading)).SelectMany(t => t.NoneDicomFileList.Where(t => t.IsReading)).Sum(t => t.FileSize)
|
||||
|
||||
+ g.SelectMany(t => t.StudyList).SelectMany(t => t.InstanceList.Where(t => t.IsReading && t.DicomSerie.IsReading)).Sum(t => t.FileSize),
|
||||
|
||||
ImageSize = g.SelectMany(t => t.NoneDicomStudyList).SelectMany(t => t.NoneDicomFileList).Sum(t => t.FileSize)
|
||||
|
||||
+ g.SelectMany(t => t.StudyList).SelectMany(t => t.InstanceList).Sum(t => t.FileSize)
|
||||
|
@ -1261,7 +1268,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
var totalImageSize = subjectImageList.Sum(t => t.ImageSize);
|
||||
|
||||
return ResponseOutput.Ok(new TrialImageStatInfo { SubjectCount = subjectCount, SubjectVisitCount = subjectVisitCount, TotalImageSize = totalImageSize });
|
||||
return ResponseOutput.Ok(new TrialImageStatInfo { SubjectCount = subjectCount, SubjectVisitCount = subjectVisitCount, TotalImageSize = totalImageSize,Tot });
|
||||
|
||||
|
||||
}
|
||||
|
@ -1275,6 +1282,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
public async Task<IResponseOutput> GetExportSubjectVisitImageList(TrialExportImageCommand inCommand)
|
||||
{
|
||||
|
||||
var isExportReading = inCommand.IsExportReading == true;
|
||||
|
||||
if (inCommand.IsKeyImage)
|
||||
{
|
||||
var downloadInfoList = _visitTaskRepository.Where(t => t.TrialId == inCommand.TrialId && (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global)
|
||||
|
@ -1538,11 +1547,11 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
u.StudyTime,
|
||||
u.StudyCode,
|
||||
|
||||
SeriesList = u.SeriesList.Select(z => new
|
||||
SeriesList = u.SeriesList.Where(t => isExportReading ? t.IsReading : true).Select(z => new
|
||||
{
|
||||
z.Modality,
|
||||
|
||||
InstancePathList = z.DicomInstanceList.Select(k => new
|
||||
InstancePathList = z.DicomInstanceList.Where(t => isExportReading ? t.IsReading : true).Select(k => new
|
||||
{
|
||||
k.Path
|
||||
})
|
||||
|
@ -1550,13 +1559,13 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
}),
|
||||
|
||||
NoneDicomStudyList = sv.NoneDicomStudyList.Select(nd => new
|
||||
NoneDicomStudyList = sv.NoneDicomStudyList.Where(t => isExportReading ? t.IsReading : true).Select(nd => new
|
||||
{
|
||||
nd.Modality,
|
||||
nd.StudyCode,
|
||||
nd.ImageDate,
|
||||
|
||||
FileList = nd.NoneDicomFileList.Select(file => new
|
||||
FileList = nd.NoneDicomFileList.Where(t => isExportReading ? t.IsReading : true).Select(file => new
|
||||
{
|
||||
file.FileName,
|
||||
file.Path,
|
||||
|
|
Loading…
Reference in New Issue