From 98741d9a3bf3bdfda5bbc00faca80fa3fd11644d Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 12 Sep 2025 09:00:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E6=94=B6=E5=BD=B1=E5=83=8F=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E5=BC=A0=E7=9A=84=E6=97=B6=E5=80=99=E5=B0=B1=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=E6=89=93=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRC.Core.SCP/Service/CStoreSCPService.cs | 65 +++++++++++++----------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/IRC.Core.SCP/Service/CStoreSCPService.cs b/IRC.Core.SCP/Service/CStoreSCPService.cs index 462bad2e2..f8fda11a0 100644 --- a/IRC.Core.SCP/Service/CStoreSCPService.cs +++ b/IRC.Core.SCP/Service/CStoreSCPService.cs @@ -190,9 +190,7 @@ namespace IRaCIS.Core.SCP.Service var _dictionaryRepository = _serviceProvider.GetService>(); var _seriesRepository = _serviceProvider.GetService>(); var _studyRepository = _serviceProvider.GetService>(); - var _studyGroupRepository = _serviceProvider.GetService>(); - var _cmoveStudyRepository = _serviceProvider.GetService>(); var dicModalityList = _dictionaryRepository.Where(t => t.Code == "Modality").SelectMany(t => t.ChildList.Select(c => c.Value)).ToList(); var seriesModalityList = _seriesRepository.Where(t => _SCPStudyIdList.Contains(t.StudyId)).Select(t => new { SCPStudyId = t.StudyId, t.Modality, t.StudyInstanceUid }).ToList(); @@ -220,34 +218,7 @@ namespace IRaCIS.Core.SCP.Service await _studyRepository.BatchUpdateNoTrackingAsync(t => t.Id == g.Key.SCPStudyId, u => new SCPStudy() { Modalities = modality, ModalityForEdit = modalityForEdit }); - //添加课题组标签 - if (CurrentHospitalGroup != null) - { - if (!_studyGroupRepository.Any(t => t.SCPStudyId == g.Key.SCPStudyId && t.HospitalGroupId == CurrentHospitalGroup.Id)) - { - await _studyGroupRepository.AddAsync(new SCPStudyHospitalGroup() { SCPStudyId = g.Key.SCPStudyId, HospitalGroupId = CurrentHospitalGroup.Id }); - } - } - else - { - var findCmoveInfo = _cmoveStudyRepository.Where(t => t.StudyInstanceUIDList.Any(c => c == g.Key.StudyInstanceUid)).OrderByDescending(t => t.CreateTime).FirstOrDefault(); - if (findCmoveInfo != null) - { - foreach (var item in findCmoveInfo.HopitalGroupIdList) - { - if (!_studyGroupRepository.Any(t => t.SCPStudyId == g.Key.SCPStudyId && t.HospitalGroupId == item)) - { - await _studyGroupRepository.AddAsync(new SCPStudyHospitalGroup() { SCPStudyId = g.Key.SCPStudyId, HospitalGroupId = item }); - - } - } - } - else - { - Log.Logger.Warning($"未找到{g.Key.StudyInstanceUid}的Cmove记录"); - } - } } @@ -319,6 +290,9 @@ namespace IRaCIS.Core.SCP.Service var ossService = _serviceProvider.GetService(); var dicomArchiveService = _serviceProvider.GetService(); var _seriesRepository = _serviceProvider.GetService>(); + var _studyGroupRepository = _serviceProvider.GetService>(); + + var _cmoveStudyRepository = _serviceProvider.GetService>(); var _distributedLockProvider = _serviceProvider.GetService(); @@ -422,6 +396,39 @@ namespace IRaCIS.Core.SCP.Service if (!_SCPStudyIdList.Contains(scpStudyId)) { _SCPStudyIdList.Add(scpStudyId); + + #region 给检查打课题组标签 + + //添加课题组标签 + if (CurrentHospitalGroup != null) + { + if (!_studyGroupRepository.Any(t => t.SCPStudyId == scpStudyId && t.HospitalGroupId == CurrentHospitalGroup.Id)) + { + await _studyGroupRepository.AddAsync(new SCPStudyHospitalGroup() { SCPStudyId = scpStudyId, HospitalGroupId = CurrentHospitalGroup.Id }); + } + } + else + { + var findCmoveInfo = _cmoveStudyRepository.Where(t => t.StudyInstanceUIDList.Any(c => c == studyInstanceUid)).OrderByDescending(t => t.CreateTime).FirstOrDefault(); + + if (findCmoveInfo != null) + { + foreach (var item in findCmoveInfo.HopitalGroupIdList) + { + if (!_studyGroupRepository.Any(t => t.SCPStudyId == scpStudyId && t.HospitalGroupId == item)) + { + await _studyGroupRepository.AddAsync(new SCPStudyHospitalGroup() { SCPStudyId = scpStudyId, HospitalGroupId = item }); + + } + } + } + else + { + Log.Logger.Warning($"未找到{g.Key.StudyInstanceUid}的Cmove记录"); + } + } + #endregion + } var series = await _seriesRepository.FirstOrDefaultAsync(t => t.Id == seriesId);