测试 dicom 注入服务

IRC_NewDev
hang 2024-03-12 09:32:01 +08:00
parent d675cc50b3
commit a24c6775e8
3 changed files with 16 additions and 4 deletions

View File

@ -257,6 +257,7 @@ var hangfireJobService = app.Services.GetRequiredService<IIRaCISHangfireJob>();
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<CStoreSCPService>(11112);
var server = DicomServerFactory.Create<CStoreSCPService>(11112,userState: app.Services);
app.Run();

View File

@ -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<DicomCStoreResponse> OnCStoreRequestAsync(DicomCStoreRequest request)
{
var tt= _serviceProvider.GetService<IDicomArchiveService>();
var studyUid = request.Dataset.GetSingleValue<string>(DicomTag.StudyInstanceUID).Trim();
var instUid = request.SOPInstanceUID.UID;

View File

@ -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,