修改缩略图切换存储
parent
26e246e71a
commit
e736fe6557
|
@ -140,13 +140,40 @@ namespace IRaCIS.Core.Application.Services
|
||||||
|
|
||||||
path = (await _instanceRepository.Where(s => s.SeriesId == seriesId).Select(t => t.Path).FirstOrDefaultAsync()).IfNullThrowException();
|
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))
|
using (var sw = ImageHelper.RenderPreviewJpeg(physicalPath))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue