dir 准备修改
parent
492312f595
commit
48d48b343e
|
@ -7,10 +7,10 @@
|
|||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
//"RemoteNew": "Server=101.132.193.237,1434;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true",
|
||||
//"Hangfire": "Server=101.132.193.237,1434;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true"
|
||||
"RemoteNew": "Server=prod_mssql_standard,1433;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true",
|
||||
"Hangfire": "Server=prod_mssql_standard,1433;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true"
|
||||
"RemoteNew": "Server=101.132.193.237,1434;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true",
|
||||
"Hangfire": "Server=101.132.193.237,1434;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true"
|
||||
//"RemoteNew": "Server=prod_mssql_standard,1433;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true",
|
||||
//"Hangfire": "Server=prod_mssql_standard,1433;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true"
|
||||
},
|
||||
"ObjectStoreService": {
|
||||
"ObjectStoreUse": "AliyunOSS",
|
||||
|
|
|
@ -366,6 +366,17 @@ public class OSSService : IOSSService
|
|||
GetObjectStoreTempToken();
|
||||
isFirstCall = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//判断是否过期了
|
||||
if (ObjectStoreServiceOptions.ObjectStoreUse == "AliyunOSS")
|
||||
{
|
||||
if (AliyunOSSTempToken != null && AliyunOSSTempToken.Expiration <= DateTime.Now)
|
||||
{
|
||||
GetObjectStoreTempToken();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ossRelativePath = ossRelativePath.TrimStart('/');
|
||||
try
|
||||
|
@ -1013,6 +1024,17 @@ public class OSSService : IOSSService
|
|||
GetObjectStoreTempToken();
|
||||
isFirstCall = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//判断是否过期了
|
||||
if (ObjectStoreServiceOptions.ObjectStoreUse == "AliyunOSS")
|
||||
{
|
||||
if(AliyunOSSTempToken != null && AliyunOSSTempToken.Expiration <= DateTime.Now)
|
||||
{
|
||||
GetObjectStoreTempToken();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var objectkey = sourcePath.Trim('/');
|
||||
|
|
|
@ -41,12 +41,14 @@ namespace IRaCIS.Core.Application.Service
|
|||
[AllowAnonymous]
|
||||
public async Task<IResponseOutput> DownloadTrialImage(Guid trialId)
|
||||
{
|
||||
var subjectCodeList = new List<string>() { "05002", "07006", "07026" };
|
||||
//var subjectCodeList = new List<string>() { "05002", "07006", "07026" };
|
||||
var downloadInfo = _trialRepository.Where(t => t.Id == trialId).Select(t => new
|
||||
{
|
||||
t.ResearchProgramNo,
|
||||
|
||||
VisitList = t.SubjectVisitList.Where(t=>subjectCodeList.Contains(t.Subject.Code)).Select(sv => new
|
||||
VisitList = t.SubjectVisitList
|
||||
//.Where(t=>subjectCodeList.Contains(t.Subject.Code))
|
||||
.Select(sv => new
|
||||
{
|
||||
TrialSiteCode = sv.TrialSite.TrialSiteCode,
|
||||
SubjectCode = sv.Subject.Code,
|
||||
|
@ -57,11 +59,11 @@ namespace IRaCIS.Core.Application.Service
|
|||
u.StudyTime,
|
||||
u.StudyCode,
|
||||
|
||||
SeriesList = u.SeriesList.Select(z => new
|
||||
SeriesList = u.SeriesList.Where(t => t.IsReading).Select(z => new
|
||||
{
|
||||
z.Modality,
|
||||
|
||||
InstancePathList = z.DicomInstanceList.Select(k => new
|
||||
InstancePathList = z.DicomInstanceList.Where(t => t.IsReading).Select(k => new
|
||||
{
|
||||
k.Path
|
||||
}).ToList()
|
||||
|
@ -69,13 +71,13 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
}).ToList(),
|
||||
|
||||
NoneDicomStudyList = sv.NoneDicomStudyList.Select(nd => new
|
||||
NoneDicomStudyList = sv.NoneDicomStudyList.Where(t => t.IsReading).Select(nd => new
|
||||
{
|
||||
nd.Modality,
|
||||
nd.StudyCode,
|
||||
nd.ImageDate,
|
||||
|
||||
FileList = nd.NoneDicomFileList.Select(file => new
|
||||
FileList = nd.NoneDicomFileList.Where(t => t.IsReading).Select(file => new
|
||||
{
|
||||
file.FileName,
|
||||
file.Path,
|
||||
|
@ -88,12 +90,17 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
var count = downloadInfo.VisitList.SelectMany(t => t.NoneDicomStudyList).SelectMany(t => t.FileList).Count();
|
||||
var count2 = downloadInfo.VisitList.SelectMany(t => t.StudyList).SelectMany(t => t.SeriesList).SelectMany(t=>t.InstancePathList).Count();
|
||||
var count2 = downloadInfo.VisitList.SelectMany(t => t.StudyList).SelectMany(t => t.SeriesList).SelectMany(t => t.InstancePathList).Count();
|
||||
|
||||
Console.WriteLine($"下载总数量:{count}+{count2}={count + count2}");
|
||||
|
||||
if (downloadInfo != null)
|
||||
{
|
||||
var downloadJobs = new List<Func<Task>>();
|
||||
|
||||
var rootFolder = FileStoreHelper.GetDonwnloadImageFolder(_hostEnvironment);
|
||||
var rootFolder = @"E:\DownloadImage";
|
||||
|
||||
//var rootFolder = FileStoreHelper.GetDonwnloadImageFolder(_hostEnvironment);
|
||||
|
||||
// 获取无效字符(系统定义的)
|
||||
string invalidChars = new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars());
|
||||
|
@ -141,12 +148,16 @@ namespace IRaCIS.Core.Application.Service
|
|||
// 复制文件到相应的文件夹
|
||||
string destinationPath = Path.Combine(studyDicomFolderPath, Path.GetFileName(instanceInfo.Path));
|
||||
|
||||
|
||||
//加入到下载任务里
|
||||
downloadJobs.Add(() => _oSSService.DownLoadFromOSSAsync(instanceInfo.Path, destinationPath));
|
||||
|
||||
//下载到当前目录
|
||||
await _oSSService.DownLoadFromOSSAsync(instanceInfo.Path, destinationPath);
|
||||
//await _oSSService.DownLoadFromOSSAsync(instanceInfo.Path, destinationPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
foreach (var noneDicomStudy in visitItem.NoneDicomStudyList)
|
||||
|
@ -159,8 +170,10 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
string destinationPath = Path.Combine(studyNoneDicomFolderPath, Path.GetFileName(file.FileName));
|
||||
|
||||
//加入到下载任务里
|
||||
downloadJobs.Add(() => _oSSService.DownLoadFromOSSAsync(HttpUtility.UrlDecode(file.Path), destinationPath));
|
||||
//下载到当前目录
|
||||
await _oSSService.DownLoadFromOSSAsync(HttpUtility.UrlDecode(file.Path), destinationPath);
|
||||
//await _oSSService.DownLoadFromOSSAsync(HttpUtility.UrlDecode(file.Path), destinationPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,7 +181,20 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
|
||||
|
||||
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}%");
|
||||
}
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
|
|
|
@ -323,6 +323,10 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
public string BodyPartExamined { get; set; } = string.Empty;
|
||||
|
||||
public string DicomStudyDate { get; set; }
|
||||
|
||||
public string DicomStudyTime { get; set; }
|
||||
|
||||
public List<AddOrUpdateSeriesDto> SeriesList { get; set; }
|
||||
|
||||
|
||||
|
@ -351,6 +355,12 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public string TriggerTime { get; set; } = string.Empty;
|
||||
|
||||
public string ImageResizePath { get; set; } = string.Empty;
|
||||
|
||||
public string DicomSeriesDate { get; set; }
|
||||
|
||||
public string DicomSeriesTime { get; set; }
|
||||
|
||||
|
||||
public List<AddInstanceDto> InstanceList { get; set; }
|
||||
|
||||
public Guid? VisitTaskId { get; set; }
|
||||
|
@ -385,6 +395,14 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public string HtmlPath { get; set; } = string.Empty;
|
||||
|
||||
public long FileSize { get; set; }
|
||||
|
||||
public string SOPClassUID { get; set; }
|
||||
|
||||
public string MediaStorageSOPClassUID { get; set; }
|
||||
|
||||
public string TransferSytaxUID { get; set; }
|
||||
|
||||
public string mediaStorageSOPInstanceUID { get; set; }
|
||||
}
|
||||
|
||||
public class CRCUploadTaskQuery
|
||||
|
|
|
@ -77,4 +77,18 @@ public class DicomInstance : BaseFullDeleteAuditEntity, IEntitySeqId
|
|||
public string WindowWidth { get; set; } = null!;
|
||||
|
||||
public bool IsReading { get; set; } = true;
|
||||
|
||||
|
||||
|
||||
#region DIR 增加
|
||||
|
||||
public string SOPClassUID { get; set; }
|
||||
|
||||
public string MediaStorageSOPClassUID { get; set; }
|
||||
|
||||
public string TransferSytaxUID { get; set; }
|
||||
|
||||
public string MediaStorageSOPInstanceUID { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -73,5 +73,12 @@ public class DicomSeries : BaseFullDeleteAuditEntity, IEntitySeqId
|
|||
public string TriggerTime { get; set; } = null!;
|
||||
|
||||
public Guid? VisitTaskId { get; set; }
|
||||
|
||||
#region DIR 增加
|
||||
|
||||
public string DicomSeriesDate { get; set; }
|
||||
|
||||
public string DicomSeriesTime { get; set; }
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
|
|
@ -102,4 +102,11 @@ public class DicomStudy : BaseFullDeleteAuditEntity, IEntitySeqId
|
|||
public string Uploader { get; set; } = null!;
|
||||
|
||||
public string ModifyReason { get; set; }
|
||||
|
||||
#region DIR 增加字段
|
||||
|
||||
public string DicomStudyDate { get; set; }
|
||||
|
||||
public string DicomStudyTime { get; set; }
|
||||
#endregion
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,114 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class dir : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "DicomStudyDate",
|
||||
table: "DicomStudy",
|
||||
type: "nvarchar(400)",
|
||||
maxLength: 400,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "DicomStudyTime",
|
||||
table: "DicomStudy",
|
||||
type: "nvarchar(400)",
|
||||
maxLength: 400,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "DicomSeriesDate",
|
||||
table: "DicomSeries",
|
||||
type: "nvarchar(400)",
|
||||
maxLength: 400,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "DicomSeriesTime",
|
||||
table: "DicomSeries",
|
||||
type: "nvarchar(400)",
|
||||
maxLength: 400,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "MediaStorageSOPClassUID",
|
||||
table: "DicomInstance",
|
||||
type: "nvarchar(400)",
|
||||
maxLength: 400,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "MediaStorageSOPInstanceUID",
|
||||
table: "DicomInstance",
|
||||
type: "nvarchar(400)",
|
||||
maxLength: 400,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "SOPClassUID",
|
||||
table: "DicomInstance",
|
||||
type: "nvarchar(400)",
|
||||
maxLength: 400,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "TransferSytaxUID",
|
||||
table: "DicomInstance",
|
||||
type: "nvarchar(400)",
|
||||
maxLength: 400,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DicomStudyDate",
|
||||
table: "DicomStudy");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DicomStudyTime",
|
||||
table: "DicomStudy");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DicomSeriesDate",
|
||||
table: "DicomSeries");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DicomSeriesTime",
|
||||
table: "DicomSeries");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MediaStorageSOPClassUID",
|
||||
table: "DicomInstance");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MediaStorageSOPInstanceUID",
|
||||
table: "DicomInstance");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SOPClassUID",
|
||||
table: "DicomInstance");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TransferSytaxUID",
|
||||
table: "DicomInstance");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -933,6 +933,16 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.Property<bool>("IsReading")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("MediaStorageSOPClassUID")
|
||||
.IsRequired()
|
||||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<string>("MediaStorageSOPInstanceUID")
|
||||
.IsRequired()
|
||||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<int>("NumberOfFrames")
|
||||
.HasColumnType("int");
|
||||
|
||||
|
@ -946,6 +956,11 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<string>("SOPClassUID")
|
||||
.IsRequired()
|
||||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<Guid>("SeriesId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
|
@ -981,6 +996,11 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.Property<Guid>("SubjectVisitId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("TransferSytaxUID")
|
||||
.IsRequired()
|
||||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<Guid>("TrialId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
|
@ -1057,6 +1077,16 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<string>("DicomSeriesDate")
|
||||
.IsRequired()
|
||||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<string>("DicomSeriesTime")
|
||||
.IsRequired()
|
||||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
|
@ -1217,6 +1247,16 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<string>("DicomStudyDate")
|
||||
.IsRequired()
|
||||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<string>("DicomStudyTime")
|
||||
.IsRequired()
|
||||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
|
|
Loading…
Reference in New Issue