修改维护数据代码-2
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
2769cf7efd
commit
2b82044213
|
|
@ -1572,6 +1572,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
var allDeleteDistinceKeys = new List<string>();
|
||||
|
||||
var haveRestoreInstanceIdList = new List<Guid>();
|
||||
var haveRestoreSeriesIdList = new List<Guid>();
|
||||
|
||||
var restoreCount = 0;
|
||||
foreach (var item in rows)
|
||||
{
|
||||
|
|
@ -1616,10 +1619,19 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
var fileSize = new FileInfo(dicomFilePath).Length;
|
||||
|
||||
var isInstanceNeedAdd = await ArchiveDicomFileAsync(dicomFile, trialId, item.SubjectId, item.SubjectVisitId, item.Key, fileSize);
|
||||
var archieveInfo = await ArchiveDicomFileAsync(dicomFile, trialId, item.SubjectId, item.SubjectVisitId, item.Key, fileSize, haveRestoreSeriesIdList, haveRestoreInstanceIdList);
|
||||
|
||||
if (archieveInfo.IsInstanceAdd)
|
||||
{
|
||||
haveRestoreInstanceIdList.Add(archieveInfo.InstanceId);
|
||||
}
|
||||
|
||||
if (isInstanceNeedAdd == false)
|
||||
if (archieveInfo.IsSeriesAdd)
|
||||
{
|
||||
haveRestoreSeriesIdList.Add(archieveInfo.SeriesId);
|
||||
}
|
||||
|
||||
if (archieveInfo.IsInstanceAdd == false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1717,6 +1729,23 @@ namespace IRaCIS.Core.Application.Service
|
|||
public string SOPInstanceUID { get; set; }
|
||||
}
|
||||
|
||||
public class CurrentImageArchiveInfo
|
||||
{
|
||||
public bool IsStudyAdd { get; set; }
|
||||
|
||||
public bool IsSeriesAdd { get; set; }
|
||||
|
||||
public bool IsInstanceAdd { get; set; }
|
||||
|
||||
public Guid StudyId { get; set; }
|
||||
|
||||
public Guid SeriesId { get; set; }
|
||||
|
||||
|
||||
public Guid InstanceId { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 单个文件接收 归档
|
||||
/// </summary>
|
||||
|
|
@ -1726,8 +1755,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// <param name="subjectVisitId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task<bool> ArchiveDicomFileAsync(DicomFile dicomFile, Guid trialId, Guid subjectId, Guid subjectVisitId, string path, long fileSize)
|
||||
public async Task<CurrentImageArchiveInfo> ArchiveDicomFileAsync(DicomFile dicomFile, Guid trialId, Guid subjectId, Guid subjectVisitId, string path, long fileSize, List<Guid> addSeriesIdList, List<Guid> addInstanceIdList)
|
||||
{
|
||||
|
||||
var dataset = dicomFile.Dataset;
|
||||
|
||||
string studyInstanceUid = dataset.GetString(DicomTag.StudyInstanceUID);
|
||||
|
|
@ -1741,6 +1771,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
var isSeriesNeedAdd = false;
|
||||
var isInstanceNeedAdd = false;
|
||||
|
||||
var archieveInfo = new CurrentImageArchiveInfo() { StudyId = studyId, SeriesId = seriesId, InstanceId = instanceId };
|
||||
|
||||
|
||||
|
||||
var findStudy = await _studyRepository.FirstOrDefaultAsync(t => t.Id == studyId);
|
||||
var findSerice = await _seriesRepository.FirstOrDefaultAsync(t => t.Id == seriesId);
|
||||
|
|
@ -1752,6 +1785,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
isSeriesNeedAdd = true;
|
||||
|
||||
|
||||
|
||||
findSerice = new DicomSeries
|
||||
{
|
||||
|
||||
|
|
@ -1854,16 +1889,22 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
|
||||
|
||||
if (isSeriesNeedAdd)
|
||||
if (isSeriesNeedAdd && !addSeriesIdList.Any(t => t == seriesId))
|
||||
{
|
||||
archieveInfo.IsSeriesAdd = true;
|
||||
|
||||
await _seriesRepository.AddAsync(findSerice);
|
||||
}
|
||||
if (isInstanceNeedAdd)
|
||||
if (isInstanceNeedAdd && !addInstanceIdList.Any(t => t == instanceId))
|
||||
{
|
||||
archieveInfo.IsInstanceAdd = true;
|
||||
await _instanceRepository.AddAsync(findInstance);
|
||||
}
|
||||
|
||||
return isInstanceNeedAdd;
|
||||
return archieveInfo;
|
||||
|
||||
////有新建序列的,否则就要自己记住是否有新建序列,不然会重复跟踪
|
||||
//await _studyRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue