Compare commits
No commits in common. "07ddb7b234aca768426e0d41eb47ce92480d658f" and "0c28f85f49e8ebe715022d9af6b06a19df807e91" have entirely different histories.
07ddb7b234
...
0c28f85f49
|
|
@ -69,15 +69,6 @@ public static class FileStoreHelper
|
||||||
return rootFolder;
|
return rootFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetDonwnloadImageFolder(IWebHostEnvironment _hostEnvironment)
|
|
||||||
{
|
|
||||||
var rootPath = GetIRaCISRootPath(_hostEnvironment);
|
|
||||||
|
|
||||||
var rootFolder = Path.Combine(rootPath, StaticData.Folder.DownloadIamgeFolder);
|
|
||||||
|
|
||||||
return rootFolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
//根据相对路径 获取具体文件物理地址
|
//根据相对路径 获取具体文件物理地址
|
||||||
public static string GetPhysicalFilePath(IWebHostEnvironment _hostEnvironment, string relativePath)
|
public static string GetPhysicalFilePath(IWebHostEnvironment _hostEnvironment, string relativePath)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -360,11 +360,7 @@ public class OSSService : IOSSService
|
||||||
|
|
||||||
public async Task DownLoadFromOSSAsync(string ossRelativePath, string localFilePath)
|
public async Task DownLoadFromOSSAsync(string ossRelativePath, string localFilePath)
|
||||||
{
|
{
|
||||||
if (isFirstCall)
|
GetObjectStoreTempToken();
|
||||||
{
|
|
||||||
GetObjectStoreTempToken();
|
|
||||||
isFirstCall = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ossRelativePath = ossRelativePath.TrimStart('/');
|
ossRelativePath = ossRelativePath.TrimStart('/');
|
||||||
try
|
try
|
||||||
|
|
|
||||||
|
|
@ -549,20 +549,6 @@
|
||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="T:IRaCIS.Core.Application.Service.BackDownloadService">
|
|
||||||
<summary>
|
|
||||||
项目影像后台下载,不打包
|
|
||||||
</summary>
|
|
||||||
<param name="_trialRepository"></param>
|
|
||||||
<param name="_oSSService"></param>
|
|
||||||
</member>
|
|
||||||
<member name="M:IRaCIS.Core.Application.Service.BackDownloadService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Application.Helper.IOSSService,Microsoft.AspNetCore.Hosting.IWebHostEnvironment)">
|
|
||||||
<summary>
|
|
||||||
项目影像后台下载,不打包
|
|
||||||
</summary>
|
|
||||||
<param name="_trialRepository"></param>
|
|
||||||
<param name="_oSSService"></param>
|
|
||||||
</member>
|
|
||||||
<member name="T:IRaCIS.Core.Application.Service.CommonDocumentService">
|
<member name="T:IRaCIS.Core.Application.Service.CommonDocumentService">
|
||||||
<summary>
|
<summary>
|
||||||
系统模板文档配置表
|
系统模板文档配置表
|
||||||
|
|
|
||||||
|
|
@ -1,166 +0,0 @@
|
||||||
using DocumentFormat.OpenXml.EMMA;
|
|
||||||
using FellowOakDicom;
|
|
||||||
using IRaCIS.Core.Application.Helper;
|
|
||||||
using MassTransit;
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Web;
|
|
||||||
using static IRaCIS.Core.Domain.Share.StaticData;
|
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Service
|
|
||||||
{
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 项目影像后台下载,不打包
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="_trialRepository"></param>
|
|
||||||
/// <param name="_oSSService"></param>
|
|
||||||
[ApiExplorerSettings(GroupName = "Common")]
|
|
||||||
public class BackDownloadService(IRepository<Trial> _trialRepository, IOSSService _oSSService, IWebHostEnvironment _hostEnvironment) : BaseService
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
public async Task<IResponseOutput> DownloadTrialImage(Guid trialId)
|
|
||||||
{
|
|
||||||
|
|
||||||
var downloadInfo = _trialRepository.Where(t => t.Id == trialId).Select(t => new
|
|
||||||
{
|
|
||||||
t.ResearchProgramNo,
|
|
||||||
|
|
||||||
VisitList = t.SubjectVisitList.Select(sv => new
|
|
||||||
{
|
|
||||||
TrialSiteCode = sv.TrialSite.TrialSiteCode,
|
|
||||||
SubjectCode = sv.Subject.Code,
|
|
||||||
VisitName = sv.VisitName,
|
|
||||||
StudyList = sv.StudyList.Select(u => new
|
|
||||||
{
|
|
||||||
u.PatientId,
|
|
||||||
u.StudyTime,
|
|
||||||
u.StudyCode,
|
|
||||||
|
|
||||||
SeriesList = u.SeriesList.Select(z => new
|
|
||||||
{
|
|
||||||
z.Modality,
|
|
||||||
|
|
||||||
InstancePathList = z.DicomInstanceList.Select(k => new
|
|
||||||
{
|
|
||||||
k.Path
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
}),
|
|
||||||
|
|
||||||
NoneDicomStudyList = sv.NoneDicomStudyList.Select(nd => new
|
|
||||||
{
|
|
||||||
nd.Modality,
|
|
||||||
nd.StudyCode,
|
|
||||||
nd.ImageDate,
|
|
||||||
|
|
||||||
FileList = nd.NoneDicomFileList.Select(file => new
|
|
||||||
{
|
|
||||||
file.FileName,
|
|
||||||
file.Path,
|
|
||||||
file.FileType
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}).ToList()
|
|
||||||
|
|
||||||
}).FirstOrDefault();
|
|
||||||
|
|
||||||
|
|
||||||
if (downloadInfo != null)
|
|
||||||
{
|
|
||||||
|
|
||||||
var rootFolder = FileStoreHelper.GetDonwnloadImageFolder(_hostEnvironment);
|
|
||||||
|
|
||||||
// 创建一个临时文件夹来存放文件
|
|
||||||
string trialFolderPath = Path.Combine(rootFolder, $"{downloadInfo.ResearchProgramNo}_{NewId.NextGuid()}");
|
|
||||||
Directory.CreateDirectory(trialFolderPath);
|
|
||||||
|
|
||||||
foreach (var visitItem in downloadInfo.VisitList)
|
|
||||||
{
|
|
||||||
if (visitItem.StudyList.Count() == 0 && visitItem.NoneDicomStudyList.Count() == 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region 处理 中心,受试者dicom non-dicom 文件夹层级
|
|
||||||
|
|
||||||
var siteFolderPath = Path.Combine(trialFolderPath, visitItem.TrialSiteCode);
|
|
||||||
if (!Directory.Exists(siteFolderPath))
|
|
||||||
{
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
foreach (var studyInfo in visitItem.StudyList)
|
|
||||||
{
|
|
||||||
// 遍历 Series
|
|
||||||
foreach (var seriesInfo in studyInfo.SeriesList)
|
|
||||||
{
|
|
||||||
string studyDicomFolderPath = Path.Combine(siteFolderPath, $"{visitItem.SubjectCode}_{visitItem.VisitName}_DICOM", $"{studyInfo.StudyCode}_{studyInfo.StudyTime?.ToString("yyyy-MM-dd")}_{seriesInfo.Modality}");
|
|
||||||
|
|
||||||
// 创建 影像 文件夹
|
|
||||||
Directory.CreateDirectory(studyDicomFolderPath);
|
|
||||||
|
|
||||||
// 遍历 InstancePathList
|
|
||||||
foreach (var instanceInfo in seriesInfo.InstancePathList)
|
|
||||||
{
|
|
||||||
// 复制文件到相应的文件夹
|
|
||||||
string destinationPath = Path.Combine(studyDicomFolderPath, Path.GetFileName(instanceInfo.Path));
|
|
||||||
|
|
||||||
//下载到当前目录
|
|
||||||
await _oSSService.DownLoadFromOSSAsync(instanceInfo.Path, destinationPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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}");
|
|
||||||
|
|
||||||
Directory.CreateDirectory(studyNoneDicomFolderPath);
|
|
||||||
|
|
||||||
foreach (var file in noneDicomStudy.FileList)
|
|
||||||
{
|
|
||||||
string destinationPath = Path.Combine(studyNoneDicomFolderPath, Path.GetFileName(file.FileName));
|
|
||||||
|
|
||||||
//下载到当前目录
|
|
||||||
await _oSSService.DownLoadFromOSSAsync(HttpUtility.UrlDecode(file.Path), destinationPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -74,7 +74,6 @@ public static class StaticData
|
||||||
|
|
||||||
public static readonly string Resources = "Resources";
|
public static readonly string Resources = "Resources";
|
||||||
public static readonly string IRaCISDataFolder = "IRaCISData";
|
public static readonly string IRaCISDataFolder = "IRaCISData";
|
||||||
public static readonly string DownloadIamgeFolder = "DownloadImage";
|
|
||||||
public static readonly string OtherDataFolder = "OtherData";
|
public static readonly string OtherDataFolder = "OtherData";
|
||||||
public static readonly string TrialDataFolder = "TrialData";
|
public static readonly string TrialDataFolder = "TrialData";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue