修改Cmove 推送命令
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
0d7a04f1e8
commit
fdb0b74296
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,12 +3169,22 @@ namespace IRaCIS.Application.Services
|
|||
foreach (var item in inCommand.StudyInstanceUIDList)
|
||||
{
|
||||
|
||||
var cmoveRequest = new DicomCMoveRequest(hirServer.CalledAE, item);
|
||||
var cmoveConfig = _basicSystemConfigConfig.CurrentValue;
|
||||
var exsitStudyId = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.CmoveStudyId(item), null);
|
||||
|
||||
cmoveRequest.OnResponseReceived += responseDelegate;
|
||||
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));
|
||||
|
||||
cmoveRequestList.Add(cmoveRequest);
|
||||
var cmoveRequest = new DicomCMoveRequest(hirServer.CalledAE, item);
|
||||
|
||||
cmoveRequest.OnResponseReceived += responseDelegate;
|
||||
|
||||
cmoveRequestList.Add(cmoveRequest);
|
||||
}
|
||||
}
|
||||
|
||||
await client.AddRequestsAsync(cmoveRequestList);
|
||||
|
|
Loading…
Reference in New Issue