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

This commit is contained in:
he
2026-04-24 11:14:12 +08:00
4 changed files with 75 additions and 20 deletions
@@ -102,6 +102,8 @@ namespace IRaCIS.Core.Application.Contracts.Dicom.DTO
public Guid? SeriesId { get; set; }
public bool? IsMasked { get; set; }
[JsonIgnore]
public int ShowOrder { get; set; }
[JsonIgnore]
@@ -72,7 +72,8 @@ namespace IRaCIS.Core.Application.Services
InstanceNumber = k.InstanceNumber,
IsReading = true,
IsDeleted = false,
FileSize = k.FileSize
FileSize = k.FileSize,
}).ToList();
@@ -103,7 +104,7 @@ namespace IRaCIS.Core.Application.Services
.WhereIf(isReading == true, t => t.IsReading == true)
.OrderBy(t => t.SeriesId).ThenBy(t => t.InstanceNumber)
.ThenBy(s => s.InstanceTime).ThenBy(s => s.CreateTime)
.Select(t => new { t.SeriesId, t.Id, t.Path, t.NumberOfFrames, t.InstanceNumber, t.HtmlPath, t.IsReading, t.IsDeleted, t.FileSize }).ToListAsync();//.GroupBy(u => u.SeriesId);
.Select(t => new { t.SeriesId, t.Id, t.Path, t.NumberOfFrames, t.InstanceNumber, t.HtmlPath, t.IsReading, t.IsDeleted, t.FileSize ,t.IsMasked}).ToListAsync();//.GroupBy(u => u.SeriesId);
foreach (var series in seriesList)
@@ -119,7 +120,8 @@ namespace IRaCIS.Core.Application.Services
InstanceNumber = k.InstanceNumber,
IsReading = k.IsReading,
IsDeleted = k.IsDeleted,
FileSize = k.FileSize
FileSize = k.FileSize,
IsMasked = k.IsMasked
}).ToList();
@@ -92,7 +92,11 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
idPathList = await _dicomInstanceRepository.Where(t => t.SeriesId == inCommand.SeriesId).Select(t => new InstanceIdPath { Id = t.Id, Path = t.Path }).ToListAsync();
}
var errorPathList = new List<string>();
var errorList = new List<InstanceIdPath>();
var okList = new List<InstanceIdPath>();
var batchId = Guid.NewGuid();
foreach (var item in idPathList)
{
@@ -106,20 +110,27 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
var prefix = path.Substring(1, path.LastIndexOf('/') - 1);
var maskPath = $"{Path.GetFileName(path)}.MaskImage";
//每次都用一个新的名字
var maskFileName = $"{Path.GetFileName(path)}.{batchId}_MaskDicom";
//清理缓存的里面的遮盖图,多次遮盖同一张图时,清除缓存很重要
await _oSSService.DeleteFromPrefix(maskPath, true);
if (path.Contains("_MaskDicom"))
{
//清理缓存的里面的遮盖图,多次遮盖同一张图时,清除缓存很重要
await _oSSService.DeleteFromPrefix(path, true); //清理缓存的里面的遮盖图,多次遮盖同一张图时,清除缓存很重要
}
await _oSSService.UploadToOSSAsync(outPutStream, prefix, maskPath);
await _oSSService.UploadToOSSAsync(outPutStream, prefix, maskFileName, false);
var newPath = path + ".MaskImage";
var newPath = $"/{prefix}/{maskFileName}";
await _dicomInstanceRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new DicomInstance() { Path= newPath, IsMasked = true });
okList.Add(new InstanceIdPath() { Id = item.Id, Path = newPath });
await _dicomInstanceRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new DicomInstance() { Path = newPath, IsMasked = true });
}
catch (Exception ex)
{
errorPathList.Add(path);
errorList.Add(new InstanceIdPath() { Id = item.Id, Path = path });
Log.Logger.Error(ex, $"StudyMaskImage Error for InstanceIdList Path:{path} {ex.Message}");
}
@@ -128,7 +139,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
await _dicomInstanceRepository.SaveChangesAsync();
return ResponseOutput.Ok(errorPathList);
return ResponseOutput.Ok(new { OkList = okList, ErrorList = errorList });
}
@@ -158,13 +169,18 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
idPathList = await _dicomInstanceRepository.Where(t => t.SeriesId == inCommand.SeriesId).Select(t => new InstanceIdPath { Id = t.Id, Path = t.Path }).ToListAsync();
}
var okList = new List<InstanceIdPath>();
foreach (var item in idPathList)
{
if (item.Path.EndsWith(".MaskImage"))
if (item.Path.EndsWith("_MaskDicom"))
{
var newPath = item.Path[..^10];
await _oSSService.DeleteFromPrefix(item.Path, true);
//await _oSSService.DeleteFromPrefix(newPath, true);
var length = Guid.Empty.ToString().Length + "_MaskDicom".Length;
var newPath = item.Path[..^length];
okList.Add(new InstanceIdPath() { Id = item.Id, Path = newPath });
await _dicomInstanceRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new DicomInstance() { Path = newPath, IsMasked = false });
}
@@ -174,7 +190,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
await _dicomInstanceRepository.SaveChangesAsync();
return ResponseOutput.Ok();
return ResponseOutput.Ok(new { OkList = okList });
}
@@ -188,7 +204,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
public async Task<PatientInfoDto> GetPatientInfo(GetPatientInfoInDto inDto)
{
var study = await _dicomStudyRepository.Where(s => s.Id == inDto.StudyId).ProjectTo<PatientInfoDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
return study;
}