修改Cmove 推送命令
continuous-integration/drone/push Build is passing Details

Test_HIR_Net8
hang 2025-02-07 11:25:08 +08:00
parent 0d7a04f1e8
commit fdb0b74296
5 changed files with 37 additions and 8 deletions

View File

@ -35,7 +35,10 @@
"LoginMaxFailCount": 5,
"LoginFailLockMinutes": 30,
"AutoLoginOutMinutes": 120,
"AESKey": "HIR_System_AES_Key_Info"
"AESKey": "HIR_System_AES_Key_Info",
"CmoveIntervalMinutes": 1,
"CmoveInstanceIntervalMinutes": 1
},
"SystemHospitalConfig": {
"HospitalCode": "EI",

View File

@ -34,7 +34,9 @@
"LoginMaxFailCount": 5,
"LoginFailLockMinutes": 30,
"AutoLoginOutMinutes": 120,
"AESKey": "HIR_System_AES_Key_Info"
"AESKey": "HIR_System_AES_Key_Info",
"CmoveIntervalMinutes": 1,
"CmoveInstanceIntervalMinutes": 1
},
"SystemHospitalConfig": {
"HospitalCode": "EI",

View File

@ -38,6 +38,11 @@ public class ServiceVerifyConfigOption
public string AESKey { get; set; }
public int CmoveIntervalMinutes { get; set; }
public int CmoveInstanceIntervalMinutes { get; set; }
}
public class SystemEmailSendConfig
@ -68,7 +73,7 @@ public class SystemEmailSendConfig
public bool IsOpenErrorNoticeEmail { get; set; }
public List<string> ErrorNoticeEmailList { get; set; } =new List<string>();
public List<string> ErrorNoticeEmailList { get; set; } = new List<string>();
}
public class SystemEmailSendConfigView

View File

@ -58,6 +58,9 @@ public static class CacheKeys
/// <returns></returns>
public static string StartRestTime(Guid userId) => $"{userId}StartRestTime";
public static string CmoveStudyId(string studyIdStr) => $"CmoveStudyId:{studyIdStr}";
}
public static class CacheHelper

View File

@ -49,6 +49,7 @@ using System;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
using DocumentFormat.OpenXml.Vml.Office;
using IRaCIS.Core.Infra.EFCore.Migrations;
using System.Dynamic;
namespace IRaCIS.Application.Services
@ -65,7 +66,7 @@ namespace IRaCIS.Application.Services
IRepository<SCPImageUpload> _SCPImageUploadRepository,
IRepository<User> _userRepository,
ILogger<PatientService> _logger,
IDistributedLockProvider _distributedLockProvider, IMapper _mapper, IUserInfo _userInfo, IWebHostEnvironment _hostEnvironment, IStringLocalizer _localizer
IDistributedLockProvider _distributedLockProvider, IMapper _mapper, IUserInfo _userInfo, IWebHostEnvironment _hostEnvironment, IStringLocalizer _localizer, IFusionCache _fusionCache
) : BaseService
@ -3119,8 +3120,13 @@ namespace IRaCIS.Application.Services
/// </summary>
/// <param name="inCommand"></param>
/// <param name="_dicomAEReposiotry"></param>
/// <param name="_scpInstanceRepository"></param>
/// <param name="_basicSystemConfigConfig"></param>
/// <returns></returns>
public async Task<IResponseOutput> CmoveStudyList(SCUCmoveCommand inCommand, [FromServices] IRepository<DicomAE> _dicomAEReposiotry)
public async Task<IResponseOutput> CmoveStudyList(SCUCmoveCommand inCommand,
[FromServices] IRepository<DicomAE> _dicomAEReposiotry,
[FromServices] IRepository<SCPInstance> _scpInstanceRepository,
[FromServices] IOptionsMonitor<ServiceVerifyConfigOption> _basicSystemConfigConfig)
{
var result = new List<SCUStudyView>();
@ -3163,13 +3169,23 @@ namespace IRaCIS.Application.Services
foreach (var item in inCommand.StudyInstanceUIDList)
{
var cmoveConfig = _basicSystemConfigConfig.CurrentValue;
var exsitStudyId = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.CmoveStudyId(item), null);
var latestInstance = await _scpInstanceRepository.Where(t => t.StudyInstanceUid == item).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync();
//缓存不存在当前检查或者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;
cmoveRequestList.Add(cmoveRequest);
}
}
await client.AddRequestsAsync(cmoveRequestList);
await client.SendAsync();