From a24c6775e8c7fa4b8852787e04a6f3335ad456fe Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 12 Mar 2024 09:32:01 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=B5=8B=E8=AF=95=20dicom=20=E6=B3=A8?= =?UTF-8?q?=E5=85=A5=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/Progranm.cs | 6 +++++- .../Service/ImageAndDoc/CStoreSCPService.cs | 12 ++++++++++-- .../Service/TrialSiteUser/PersonalWorkstation.cs | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/IRaCIS.Core.API/Progranm.cs b/IRaCIS.Core.API/Progranm.cs index 8062420c5..8798ea688 100644 --- a/IRaCIS.Core.API/Progranm.cs +++ b/IRaCIS.Core.API/Progranm.cs @@ -257,6 +257,7 @@ var hangfireJobService = app.Services.GetRequiredService(); await hangfireJobService.InitHangfireJobTaskAsync(); + #endregion try @@ -292,7 +293,10 @@ try //Log.Logger.Warning($"ContentRootPath——GetParent:{Directory.GetParent(env.ContentRootPath).Parent.FullName}"); //Log.Logger.Warning($"ContentRootPath——xx:{Path.GetDirectoryName(Path.GetDirectoryName(env.ContentRootPath))}"); - //DicomServerFactory.Create(11112); + + + + var server = DicomServerFactory.Create(11112,userState: app.Services); app.Run(); diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/CStoreSCPService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/CStoreSCPService.cs index 934d2de1f..53ea5547e 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/CStoreSCPService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/CStoreSCPService.cs @@ -7,13 +7,14 @@ using System.Text; using System.Threading.Tasks; using Microsoft.Extensions.Logging; using IRaCIS.Core.Application.Contracts.Dicom; +using Microsoft.Extensions.DependencyInjection; namespace IRaCIS.Core.Application.Service.ImageAndDoc { public class CStoreSCPService : DicomService, IDicomServiceProvider, IDicomCStoreProvider, IDicomCEchoProvider { - public readonly IDicomArchiveService _dicomArchiveService; + private IServiceProvider _serviceProvider { get; set; } private static readonly DicomTransferSyntax[] _acceptedTransferSyntaxes = new DicomTransferSyntax[] @@ -43,15 +44,20 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc }; - public CStoreSCPService(INetworkStream stream, Encoding fallbackEncoding, ILogger log, DicomServiceDependencies dependencies/*, IDicomArchiveService dicomArchiveService*/) + public CStoreSCPService(INetworkStream stream, Encoding fallbackEncoding, ILogger log, DicomServiceDependencies dependencies) : base(stream, fallbackEncoding, log, dependencies) { + var tt = base.UserState; //_dicomArchiveService = dicomArchiveService; } + + public Task OnReceiveAssociationRequestAsync(DicomAssociation association) { + _serviceProvider =(IServiceProvider) this.UserState; + if (association.CalledAE != "STORESCP") { return SendAssociationRejectAsync( @@ -96,6 +102,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc public async Task OnCStoreRequestAsync(DicomCStoreRequest request) { + var tt= _serviceProvider.GetService(); + var studyUid = request.Dataset.GetSingleValue(DicomTag.StudyInstanceUID).Trim(); var instUid = request.SOPInstanceUID.UID; diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs index 9f4c79733..67523f2fd 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs @@ -1266,7 +1266,7 @@ namespace IRaCIS.Core.Application .Where(t => t.EndDate == null || t.EndDate != null && t.EndDate > DateTime.Now) .CountAsync(), - #region PM + #region PM PM_SiteSurveryCount = isPM ? siteSurveyCount : 0, From ce31ab3097625e1fcc44c34da19e476b934e298f Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 12 Mar 2024 10:05:04 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Document/TrialDocumentService.cs | 20 +++++++++---------- .../TrialSiteUser/PersonalWorkstation.cs | 7 ++++--- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs index 405d1d974..95c157680 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs @@ -66,16 +66,16 @@ namespace IRaCIS.Core.Application.Services return await trialDocumentQueryable.ToPagedListAsync(queryTrialDocument.PageIndex, queryTrialDocument.PageSize, queryTrialDocument.SortField, queryTrialDocument.Asc); } - + [HttpPost] public async Task> GetTrialSignDocumentList(TrialDocQuery querySystemDocument) { - var trialDocQueryable = from trialDoc in _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == querySystemDocument.TrialId) - .Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - .Where(t => t.IsDeleted == false || (t.IsDeleted == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id))) + var trialDocQueryable = from trialDoc in _trialDocumentRepository.AsQueryable(true) + .WhereIf(querySystemDocument.TrialId!=null,t=>t.TrialId==querySystemDocument.TrialId) + .Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) + .Where(t => t.IsDeleted == false || (t.IsDeleted == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id))) - join trialUser in _repository.Where(t => t.TrialId == querySystemDocument.TrialId && t.UserId == _userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId join confirm in _repository.Where(t => t.TrialDocument.TrialId == querySystemDocument.TrialId) on - new { trialUser.UserId, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc + new { UserId=_userInfo.Id, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc from confirm in cc.DefaultIfEmpty() select new UnionDocumentWithConfirmInfoView() { @@ -94,10 +94,10 @@ namespace IRaCIS.Core.Application.Services //IsConfirmed = confirm.ConfirmTime != null, ConfirmUserId = confirm.ConfirmUserId, ConfirmTime = confirm.ConfirmTime, - RealName = trialUser.User.FullName, - UserName = trialUser.User.UserName, - UserTypeId = trialUser.User.UserTypeId, - UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName + RealName = confirm.User.FullName, + UserName = confirm.User.UserName, + UserTypeId = confirm.User.UserTypeId, + UserTypeShortName = confirm.User.UserTypeRole.UserTypeShortName }; diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs index 67523f2fd..f79c71301 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs @@ -1212,9 +1212,10 @@ namespace IRaCIS.Core.Application .SelectMany(t => t.NeedConfirmedUserTypeList) .CountAsync(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId); - var signedTrialCount = await _trialRepository.Where(t => t.TrialStatusStr != StaticData.TrialState.TrialStopped).Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) - && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)).Count() > 0).CountAsync(); + var signedTrialCount = await _trialDocumentRepository.AsQueryable(true) + .Where(t=>t.Trial.TrialUserList.Any(t=>t.UserId==_userInfo.Id)) + .Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) + .Where(t => t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime!=null)).CountAsync(); var signedSysDocCont = await _systemDocumentRepository .Where(t => t.IsDeleted == false && t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)) From 5579f543dedbf61bb890d2b8eac132266cc00a8d Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 12 Mar 2024 11:41:18 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Document/TrialDocumentService.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs index 95c157680..cebd97dfc 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs @@ -71,11 +71,12 @@ namespace IRaCIS.Core.Application.Services { var trialDocQueryable = from trialDoc in _trialDocumentRepository.AsQueryable(true) .WhereIf(querySystemDocument.TrialId!=null,t=>t.TrialId==querySystemDocument.TrialId) - .Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - .Where(t => t.IsDeleted == false || (t.IsDeleted == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id))) + .Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) ) + + join trialUser in _repository.Where(t=>t.UserId==_userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId + join confirm in _repository.Where() on + new { trialUser.UserId, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc - join confirm in _repository.Where(t => t.TrialDocument.TrialId == querySystemDocument.TrialId) on - new { UserId=_userInfo.Id, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc from confirm in cc.DefaultIfEmpty() select new UnionDocumentWithConfirmInfoView() { From 396797dc0cab755ee84b94fbd95ac5187185254f Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 12 Mar 2024 11:47:21 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Document/TrialDocumentService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs index cebd97dfc..8cf8b0755 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs @@ -95,10 +95,10 @@ namespace IRaCIS.Core.Application.Services //IsConfirmed = confirm.ConfirmTime != null, ConfirmUserId = confirm.ConfirmUserId, ConfirmTime = confirm.ConfirmTime, - RealName = confirm.User.FullName, - UserName = confirm.User.UserName, - UserTypeId = confirm.User.UserTypeId, - UserTypeShortName = confirm.User.UserTypeRole.UserTypeShortName + RealName = trialUser.User.FullName, + UserName = trialUser.User.UserName, + UserTypeId = trialUser.User.UserTypeId, + UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName };