cmove-测试
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
1bfe23f9ec
commit
3861e7642a
|
@ -3385,51 +3385,60 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
var task = Task.Run(async () =>
|
||||
{
|
||||
var client = DicomClientFactory.Create(find.IP, find.Port, false, hirClient.CalledAE, find.CalledAE);
|
||||
client.NegotiateAsyncOps();
|
||||
try
|
||||
{
|
||||
var client = DicomClientFactory.Create(find.IP, find.Port, false, hirClient.CalledAE, find.CalledAE);
|
||||
client.NegotiateAsyncOps();
|
||||
|
||||
var cmoveRequestList = new List<DicomCMoveRequest>();
|
||||
var cmoveRequestList = new List<DicomCMoveRequest>();
|
||||
|
||||
foreach (var item in inCommand.StudyInstanceUIDList)
|
||||
foreach (var item in inCommand.StudyInstanceUIDList)
|
||||
{
|
||||
|
||||
var cmoveConfig = _basicSystemConfigConfig.CurrentValue;
|
||||
var exsitStudyId = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.CmoveStudyId(item), null);
|
||||
|
||||
var latestInstance = latestInstanceList.Where(t => t.StudyInstanceUid == item).FirstOrDefault();
|
||||
|
||||
//缓存不存在当前检查,或者instance表最新的记录时间与当前时间之差超过1分钟(认为完成归档,可以重复拉取)
|
||||
if (exsitStudyId == null && (latestInstance == null || latestInstance?.CreateTime.AddMinutes(cmoveConfig.CmoveInstanceIntervalMinutes) < DateTime.Now))
|
||||
{
|
||||
await _fusionCache.SetAsync(CacheKeys.CmoveStudyId(item), item, TimeSpan.FromMinutes(cmoveConfig.CmoveIntervalMinutes));
|
||||
|
||||
var cmoveRequest = new DicomCMoveRequest(hirServer.CalledAE, item);
|
||||
|
||||
cmoveRequest.OnResponseReceived += responseDelegate;
|
||||
|
||||
#region 测试私有tag 传输信息
|
||||
var privateTag = new DicomTag(0x9999, 0x1001, "PRJGROUPS");
|
||||
var groupIdsJson = (new List<string> { "KTGroup1", "KTGroup2" }).ToJson();
|
||||
cmoveRequest.Dataset.Add(new DicomLongString(privateTag, groupIdsJson));
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
cmoveRequestList.Add(cmoveRequest);
|
||||
|
||||
_logger.LogInformation($"执行C-Move StudyInstanceUID:{item},携带课题组信息:{groupIdsJson}");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation($"忽略C-Move StudyInstanceUID:{item}");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
await client.AddRequestsAsync(cmoveRequestList);
|
||||
await client.SendAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
var cmoveConfig = _basicSystemConfigConfig.CurrentValue;
|
||||
var exsitStudyId = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.CmoveStudyId(item), null);
|
||||
|
||||
var latestInstance = latestInstanceList.Where(t => t.StudyInstanceUid == item).FirstOrDefault();
|
||||
|
||||
//缓存不存在当前检查,或者instance表最新的记录时间与当前时间之差超过1分钟(认为完成归档,可以重复拉取)
|
||||
if (exsitStudyId == null && (latestInstance == null || latestInstance?.CreateTime.AddMinutes(cmoveConfig.CmoveInstanceIntervalMinutes) < DateTime.Now))
|
||||
{
|
||||
await _fusionCache.SetAsync(CacheKeys.CmoveStudyId(item), item, TimeSpan.FromMinutes(cmoveConfig.CmoveIntervalMinutes));
|
||||
|
||||
var cmoveRequest = new DicomCMoveRequest(hirServer.CalledAE, item);
|
||||
|
||||
cmoveRequest.OnResponseReceived += responseDelegate;
|
||||
|
||||
#region 测试私有tag 传输信息
|
||||
var privateTag = new DicomTag(0x9999, 0x1001, "PRJGROUPS");
|
||||
var groupIdsJson = (new List<string> { "KTGroup1", "KTGroup2" }).ToJson();
|
||||
cmoveRequest.Dataset.Add(new DicomLongString(privateTag, groupIdsJson));
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
cmoveRequestList.Add(cmoveRequest);
|
||||
|
||||
_logger.LogInformation($"执行C-Move StudyInstanceUID:{item},携带课题组信息:{groupIdsJson}");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation($"忽略C-Move StudyInstanceUID:{item}");
|
||||
|
||||
}
|
||||
|
||||
_logger.LogError($"cmove error:{ex.Message}");
|
||||
}
|
||||
|
||||
await client.AddRequestsAsync(cmoveRequestList);
|
||||
await client.SendAsync();
|
||||
});
|
||||
|
||||
//await task;
|
||||
|
|
Loading…
Reference in New Issue