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/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs index 405d1d974..8cf8b0755 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs @@ -66,16 +66,17 @@ 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) ) - 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 + 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 + from confirm in cc.DefaultIfEmpty() select new UnionDocumentWithConfirmInfoView() { 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..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)) @@ -1266,7 +1267,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,