Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
ae431df9b5
|
@ -2,12 +2,14 @@
|
|||
using FellowOakDicom;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using static IRaCIS.Core.Domain.Share.StaticData;
|
||||
|
@ -20,6 +22,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// </summary>
|
||||
/// <param name="_trialRepository"></param>
|
||||
/// <param name="_oSSService"></param>
|
||||
[AllowAnonymous]
|
||||
[ApiExplorerSettings(GroupName = "Common")]
|
||||
public class BackDownloadService(IRepository<Trial> _trialRepository, IOSSService _oSSService, IWebHostEnvironment _hostEnvironment) : BaseService
|
||||
{
|
||||
|
@ -73,13 +76,23 @@ namespace IRaCIS.Core.Application.Service
|
|||
}).FirstOrDefault();
|
||||
|
||||
|
||||
var count = downloadInfo.VisitList.SelectMany(t => t.NoneDicomStudyList).SelectMany(t => t.FileList).Count();
|
||||
|
||||
if (downloadInfo != null)
|
||||
{
|
||||
|
||||
var rootFolder = FileStoreHelper.GetDonwnloadImageFolder(_hostEnvironment);
|
||||
|
||||
// 获取无效字符(系统定义的)
|
||||
string invalidChars = new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars());
|
||||
|
||||
// 用正则表达式替换所有非法字符为下划线或空字符
|
||||
string pattern = $"[{Regex.Escape(invalidChars)}]";
|
||||
|
||||
var regexNo = Regex.Replace(downloadInfo.ResearchProgramNo, pattern, "_");
|
||||
|
||||
// 创建一个临时文件夹来存放文件
|
||||
string trialFolderPath = Path.Combine(rootFolder, $"{downloadInfo.ResearchProgramNo}_{NewId.NextGuid()}");
|
||||
string trialFolderPath = Path.Combine(rootFolder, $"{regexNo}_{NewId.NextGuid()}");
|
||||
Directory.CreateDirectory(trialFolderPath);
|
||||
|
||||
foreach (var visitItem in downloadInfo.VisitList)
|
||||
|
@ -97,18 +110,6 @@ namespace IRaCIS.Core.Application.Service
|
|||
Directory.CreateDirectory(siteFolderPath);
|
||||
}
|
||||
|
||||
//var subjectDicomFolderPath = Path.Combine(siteFolderPath, $"{visitItem.SubjectCode}_{visitItem.VisitName}_DICOM");
|
||||
//var subjectNoneDicomFolderPath = Path.Combine(siteFolderPath, $"{visitItem.SubjectCode}_{visitItem.VisitName}_Non-DICOM");
|
||||
|
||||
//if (visitItem.NoneDicomStudyList.Count() > 0)
|
||||
//{
|
||||
// Directory.CreateDirectory(subjectNoneDicomFolderPath);
|
||||
//}
|
||||
//if (visitItem.StudyList.Count() > 0)
|
||||
//{
|
||||
// Directory.CreateDirectory(subjectDicomFolderPath);
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
@ -133,6 +134,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
foreach (var noneDicomStudy in visitItem.NoneDicomStudyList)
|
||||
{
|
||||
string studyNoneDicomFolderPath = Path.Combine(siteFolderPath, $"{visitItem.SubjectCode}_{visitItem.VisitName}_Non-DICOM", $"{noneDicomStudy.StudyCode}_{noneDicomStudy.ImageDate.ToString("yyyy-MM-dd")}_{noneDicomStudy.Modality}");
|
||||
|
@ -147,7 +151,6 @@ namespace IRaCIS.Core.Application.Service
|
|||
await _oSSService.DownLoadFromOSSAsync(HttpUtility.UrlDecode(file.Path), destinationPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue