From 0a368c06074b4d1e482aa5af518d1472b313193b Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 13 Dec 2024 16:52:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A2=9E=E5=8A=A0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 7 +++ .../Service/Common/_MapConfig.cs | 3 +- .../Service/Visit/DTO/SCUClientViewModel.cs | 4 +- .../Service/Visit/PatientService.cs | 62 +++++++++++++------ 4 files changed, 54 insertions(+), 22 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index a416af9a5..905d0b10b 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -18260,6 +18260,13 @@ + + + 批量验证Cmove 检查在系统存在与否 + + + + 拉取影像 diff --git a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs index d55d78cb9..3108fde80 100644 --- a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs @@ -100,7 +100,8 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUser.UserName)) .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteCode)); - + CreateMap(); + } } diff --git a/IRaCIS.Core.Application/Service/Visit/DTO/SCUClientViewModel.cs b/IRaCIS.Core.Application/Service/Visit/DTO/SCUClientViewModel.cs index 14a83c2f5..0720a8d41 100644 --- a/IRaCIS.Core.Application/Service/Visit/DTO/SCUClientViewModel.cs +++ b/IRaCIS.Core.Application/Service/Visit/DTO/SCUClientViewModel.cs @@ -22,7 +22,7 @@ namespace IRaCIS.Application.Contracts public string? ModalitiesInStudy { get; set; } - + public string? AccessionNumber { get; set; } public string? StudyDate { get; set; } @@ -46,7 +46,7 @@ namespace IRaCIS.Application.Contracts [NotDefault] public Guid PacsDicomAEId { get; set; } - public List StudyIDList { get; set; } + public List StudyInstanceUIDList { get; set; } } public class SCUStudyView : SCUBasicInfo diff --git a/IRaCIS.Core.Application/Service/Visit/PatientService.cs b/IRaCIS.Core.Application/Service/Visit/PatientService.cs index 19e48f9c9..bd1ed85d0 100644 --- a/IRaCIS.Core.Application/Service/Visit/PatientService.cs +++ b/IRaCIS.Core.Application/Service/Visit/PatientService.cs @@ -47,6 +47,7 @@ using FellowOakDicom.Network; using Microsoft.Extensions.Logging; using DocumentFormat.OpenXml.Wordprocessing; using System; +using Amazon.Runtime.Internal.Transform; namespace IRaCIS.Application.Services { @@ -2873,6 +2874,7 @@ namespace IRaCIS.Application.Services request.Dataset.AddOrUpdate(DicomTag.PatientBirthDate, inQuery.PatientBirthDate.IsNullOrEmpty() ? "" : inQuery.PatientBirthDate); //检查号 设备类型 request.Dataset.AddOrUpdate(DicomTag.StudyID, inQuery.StudyID.IsNullOrEmpty() ? "" : inQuery.StudyID); + request.Dataset.AddOrUpdate(DicomTag.AccessionNumber, inQuery.StudyID.IsNullOrEmpty() ? "" : inQuery.AccessionNumber); request.Dataset.AddOrUpdate(DicomTag.ModalitiesInStudy, inQuery.ModalitiesInStudy.IsNullOrEmpty() ? "" : inQuery.ModalitiesInStudy); @@ -2904,6 +2906,9 @@ namespace IRaCIS.Application.Services #endregion + + + /// /// 获取 检查列表 /// @@ -2950,6 +2955,7 @@ namespace IRaCIS.Application.Services PatientSex = response.Dataset?.GetSingleValueOrDefault(DicomTag.PatientSex, ""), PatientBirthDate = response.Dataset?.GetSingleValueOrDefault(DicomTag.PatientBirthDate, ""), StudyID = response.Dataset?.GetSingleValueOrDefault(DicomTag.StudyID, ""), + AccessionNumber = response.Dataset?.GetSingleValueOrDefault(DicomTag.AccessionNumber, ""), ModalitiesInStudy = response.Dataset?.GetSingleValueOrDefault(DicomTag.ModalitiesInStudy, ""), StudyDate = datePart.ToString(), StudyTime = timePart.ToString("HH:mm:ss"), @@ -2968,6 +2974,26 @@ namespace IRaCIS.Application.Services } + /// + /// 批量验证Cmove 检查在系统存在与否 + /// + /// + /// + public async Task> CMoveVerify(SCUCmoveCommand inCommand) + { + var existStudyIdList = _studyRepository.Where(t => inCommand.StudyInstanceUIDList.Contains(t.StudyInstanceUid)).Select(t => t.StudyInstanceUid).ToList(); + + var dic = new Dictionary(); + foreach (var item in inCommand.StudyInstanceUIDList) + { + dic.Add(item, existStudyIdList.Any(t => t == item)); + } + + return dic; + } + + + /// /// 拉取影像 /// @@ -2976,14 +3002,6 @@ namespace IRaCIS.Application.Services /// public async Task CmoveStudyList(SCUCmoveCommand inCommand, [FromServices] IRepository _dicomAEReposiotry) { - var existStudyIdList = _studyRepository.Where(t => inCommand.StudyIDList.Contains(t.StudyId)).Select(t => t.StudyId).ToList(); - - var needMoveList = inCommand.StudyIDList.Except(existStudyIdList).ToList(); - - if (needMoveList.Count == 0) - { - return ResponseOutput.Ok(); - } var result = new List(); @@ -2993,24 +3011,30 @@ namespace IRaCIS.Application.Services if (hirServer == null) { - return ResponseOutput.NotOk("未找到服务端AE配置,请核查后再拉取"); + //"未找到服务端AE配置,请核查后再拉取" + return ResponseOutput.NotOk(_localizer["Patient_NoPacsAE"]); } if (find != null) { - var client = DicomClientFactory.Create(find.IP, find.Port, false, "HIRSCUAE", find.CalledAE); - client.NegotiateAsyncOps(); - - var cmoveRequestList = new List(); - - foreach (var item in inCommand.StudyIDList) + await Task.Run(async () => { - cmoveRequestList.Add(new DicomCMoveRequest(hirServer.CalledAE, item)); - } - await client.AddRequestsAsync(cmoveRequestList); - await client.SendAsync(); + var client = DicomClientFactory.Create(find.IP, find.Port, false, "HIRSCUAE", find.CalledAE); + client.NegotiateAsyncOps(); + + var cmoveRequestList = new List(); + + foreach (var item in inCommand.StudyInstanceUIDList) + { + cmoveRequestList.Add(new DicomCMoveRequest(hirServer.CalledAE, item)); + } + + await client.AddRequestsAsync(cmoveRequestList); + await client.SendAsync(); + }); + } return ResponseOutput.Ok();