修改缩略图切换存储

Uat_Study
hang 2023-05-16 16:55:55 +08:00
parent 26e246e71a
commit e736fe6557
1 changed files with 31 additions and 4 deletions

View File

@ -140,13 +140,40 @@ namespace IRaCIS.Core.Application.Services
path = (await _instanceRepository.Where(s => s.SeriesId == seriesId).Select(t => t.Path).FirstOrDefaultAsync()).IfNullThrowException();
var physicalPath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, path);
#region 切换磁盘存储之前
//var physicalPath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, path);
//DicomInstance dicomInstance = await _instanceRepository.FirstOrDefaultAsync(s => s.SeriesId == seriesId).IfNullThrowException();
#endregion
#region 切换磁盘存储后
var physicalPath = string.Empty;
//找到所有磁盘
var drives = DriveInfo.GetDrives()
.Where(d => d.DriveType == DriveType.Fixed && d.IsReady)
//剩余空间最多的
.OrderByDescending(d => d.AvailableFreeSpace)
//存储空间相同,则按照按照总空间从大到小排序
.ThenByDescending(d => d.TotalSize - d.TotalFreeSpace)
.Select(d => d.RootDirectory.FullName)
.ToList();
foreach (var drive in drives)
{
physicalPath = Path.Combine(drive, _hostEnvironment.EnvironmentName, path.Trim('/'));
if(File.Exists(physicalPath))
{
break;
}
}
#endregion
//DicomStudy dicomStudy = await _studyRepository.FirstOrDefaultAsync(s => s.Id == dicomInstance.StudyId).IfNullThrowException();
//var (physicalPath, relativePath) = FileStoreHelper.GetDicomInstanceFilePath(_hostEnvironment, dicomStudy.TrialId, dicomStudy.SiteId, dicomStudy.SubjectId, dicomStudy.SubjectVisitId, dicomStudy.Id, dicomInstance.Id);
using (var sw = ImageHelper.RenderPreviewJpeg(physicalPath))
{