13 changed files with 319 additions and 55 deletions
			
			
		- 
					8ThirdPlugIns/Shentun.Peis.PlugIns.Gem/ChargeRequestPlugInsGem.cs
 - 
					52src/Shentun.ColumnReferencePlugIns/LisResultImportPlugInsBase.cs
 - 
					13src/Shentun.ColumnReferencePlugIns/PatientRegisterForLisRequest.cs
 - 
					89src/Shentun.Peis.Application/RegisterCheckAsbitems/RegisterCheckAsbitemAppService.cs
 - 
					4src/Shentun.Peis.Domain/ChargeRequests/ChargeRequestManager.cs
 - 
					4src/Shentun.Peis.Domain/LisRequests/LisRequestManager.cs
 - 
					4src/Shentun.Peis.Domain/PatientRegisters/PatientRegisterManager.cs
 - 
					4src/Shentun.Peis.Domain/RegisterChecks/RegisterCheckManager.cs
 - 
					8src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs
 - 
					6src/Shentun.Peis.HttpApi.Host/Schedulers/ChargeRequestInterfaceQueryWorker.cs
 - 
					85src/Shentun.Peis.HttpApi.Host/Schedulers/ImportLisResultInterfaceWorker.cs
 - 
					75src/Shentun.Peis.HttpApi.Host/Schedulers/ThirdInterfaceWorkerBase.cs
 - 
					2test/Shentun.Peis.Application.Tests/PrintReportAppServiceTest.cs
 
@ -0,0 +1,13 @@ | 
				
			|||
using System; | 
				
			|||
using System.Collections.Generic; | 
				
			|||
using System.Linq; | 
				
			|||
using System.Text; | 
				
			|||
using System.Threading.Tasks; | 
				
			|||
 | 
				
			|||
namespace Shentun.Peis.PlugIns | 
				
			|||
{ | 
				
			|||
    public class PatientRegisterForLisRequest | 
				
			|||
    { | 
				
			|||
        public Guid PatientRegisterId { get; set; } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
@ -0,0 +1,85 @@ | 
				
			|||
using Microsoft.Extensions.Configuration; | 
				
			|||
using Microsoft.Extensions.Logging; | 
				
			|||
using Shentun.Utilities; | 
				
			|||
using System; | 
				
			|||
using System.IO; | 
				
			|||
using System.Linq; | 
				
			|||
using System.Threading; | 
				
			|||
using System.Threading.Tasks; | 
				
			|||
using Volo.Abp.BackgroundWorkers.Hangfire; | 
				
			|||
 | 
				
			|||
namespace Shentun.Peis.Schedulers | 
				
			|||
{ | 
				
			|||
    public interface IImportLisResultInterfaceWorker | 
				
			|||
    { | 
				
			|||
        public void DoWork(Guid interfaceId); | 
				
			|||
        public void DoWork(); | 
				
			|||
    } | 
				
			|||
    public class ImportLisResultInterfaceWorker : HangfireBackgroundWorkerBase, IImportLisResultInterfaceWorker | 
				
			|||
    { | 
				
			|||
        private string isActive = "N"; | 
				
			|||
        private static long i; | 
				
			|||
        private static bool _isRunning = false; | 
				
			|||
        private static readonly object lockObject = new object(); | 
				
			|||
        public void DoWork(Guid interfaceId) | 
				
			|||
        { | 
				
			|||
            if (_isRunning) return; | 
				
			|||
            lock (lockObject) | 
				
			|||
            { | 
				
			|||
                _isRunning = true; | 
				
			|||
                try | 
				
			|||
                { | 
				
			|||
                    Logger.LogInformation("Executed ImportLisResultInterfaceWorker..!"); | 
				
			|||
                    var appServiceHelper = new AppServiceHelper(); | 
				
			|||
                    appServiceHelper.Login(); | 
				
			|||
                    var thirdInterFaceForHostOutDto = appServiceHelper.CallAppService<object, ThirdInterFaceForHostOutDto>("api/app/ThirdInterface/GetList", null); | 
				
			|||
                    var thirdInterfaceDto = thirdInterFaceForHostOutDto.Data.Where(o => o.Id == interfaceId).FirstOrDefault(); | 
				
			|||
                    if (thirdInterfaceDto == null) | 
				
			|||
                    { | 
				
			|||
                        _isRunning = false; | 
				
			|||
                        return; | 
				
			|||
                    } | 
				
			|||
 | 
				
			|||
                    var parmValue = thirdInterfaceDto.ParmValue; | 
				
			|||
                    if (!string.IsNullOrWhiteSpace(parmValue)) | 
				
			|||
                    { | 
				
			|||
                        var configurationBuilder = new ConfigurationBuilder() | 
				
			|||
                         .AddJsonStream(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(parmValue))); | 
				
			|||
                        var interfaceConfig = configurationBuilder.Build(); | 
				
			|||
 | 
				
			|||
                        isActive = interfaceConfig.GetSection("Interface").GetSection("Scheduler") | 
				
			|||
                            .GetSection("IsActive").Value; | 
				
			|||
                        if (isActive != "Y") | 
				
			|||
                        { | 
				
			|||
                            _isRunning = false; | 
				
			|||
                            return; | 
				
			|||
                        } | 
				
			|||
                        var assemblyName = interfaceConfig.GetSection("Interface").GetSection("AssemblyName").Value; | 
				
			|||
                        var className = interfaceConfig.GetSection("Interface").GetSection("ClassName").Value; | 
				
			|||
                        var funName = "DoWork"; | 
				
			|||
                        //object[] objects = new object[] { chargeRequestPlugInsInput };
 | 
				
			|||
                        ReflectionHelper.InvokeAsync(assemblyName, className, parmValue, funName); | 
				
			|||
                    } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                } | 
				
			|||
                catch (Exception ex) | 
				
			|||
                { | 
				
			|||
                    Logger.LogError("Executed ImportLisResultInterfaceWorker Error" + ex.Message); | 
				
			|||
                } | 
				
			|||
                _isRunning = false; | 
				
			|||
                return; | 
				
			|||
            } | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        public void DoWork() | 
				
			|||
        { | 
				
			|||
            throw new System.NotImplementedException(); | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        public override Task DoWorkAsync(CancellationToken cancellationToken = default) | 
				
			|||
        { | 
				
			|||
            throw new NotImplementedException(); | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
@ -0,0 +1,75 @@ | 
				
			|||
using Microsoft.Extensions.Configuration; | 
				
			|||
using Microsoft.Extensions.Logging; | 
				
			|||
using Shentun.Utilities; | 
				
			|||
using System; | 
				
			|||
using System.IO; | 
				
			|||
using System.Linq; | 
				
			|||
using System.Threading; | 
				
			|||
using System.Threading.Tasks; | 
				
			|||
using Volo.Abp.BackgroundWorkers.Hangfire; | 
				
			|||
 | 
				
			|||
namespace Shentun.Peis.Schedulers | 
				
			|||
{ | 
				
			|||
    public class ThirdInterfaceWorkerBase: HangfireBackgroundWorkerBase | 
				
			|||
    { | 
				
			|||
        private string isActive = "N"; | 
				
			|||
        private static long i; | 
				
			|||
        private static bool _isRunning = false; | 
				
			|||
        private static readonly object lockObject = new object(); | 
				
			|||
        public void DoWork(Guid interfaceId) | 
				
			|||
        { | 
				
			|||
            if (_isRunning) return; | 
				
			|||
            lock (lockObject) | 
				
			|||
            { | 
				
			|||
                _isRunning = true; | 
				
			|||
                try | 
				
			|||
                { | 
				
			|||
                    Logger.LogInformation("Executed ImportLisResultInterfaceWorker..!"); | 
				
			|||
                    var appServiceHelper = new AppServiceHelper(); | 
				
			|||
                    appServiceHelper.Login(); | 
				
			|||
                    var thirdInterFaceForHostOutDto = appServiceHelper.CallAppService<object, ThirdInterFaceForHostOutDto>("api/app/ThirdInterface/GetList", null); | 
				
			|||
                    var thirdInterfaceDto = thirdInterFaceForHostOutDto.Data.Where(o => o.Id == interfaceId).FirstOrDefault(); | 
				
			|||
                    if (thirdInterfaceDto == null) | 
				
			|||
                    { | 
				
			|||
                        _isRunning = false; | 
				
			|||
                        return; | 
				
			|||
                    } | 
				
			|||
 | 
				
			|||
                    var parmValue = thirdInterfaceDto.ParmValue; | 
				
			|||
                    if (!string.IsNullOrWhiteSpace(parmValue)) | 
				
			|||
                    { | 
				
			|||
                        var configurationBuilder = new ConfigurationBuilder() | 
				
			|||
                         .AddJsonStream(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(parmValue))); | 
				
			|||
                        var interfaceConfig = configurationBuilder.Build(); | 
				
			|||
 | 
				
			|||
                        isActive = interfaceConfig.GetSection("Interface").GetSection("Scheduler") | 
				
			|||
                            .GetSection("IsActive").Value; | 
				
			|||
                        if (isActive != "Y") | 
				
			|||
                        { | 
				
			|||
                            _isRunning = false; | 
				
			|||
                            return; | 
				
			|||
                        } | 
				
			|||
                        var assemblyName = interfaceConfig.GetSection("Interface").GetSection("AssemblyName").Value; | 
				
			|||
                        var className = interfaceConfig.GetSection("Interface").GetSection("ClassName").Value; | 
				
			|||
                        var funName = "DoWork"; | 
				
			|||
                        //object[] objects = new object[] { chargeRequestPlugInsInput };
 | 
				
			|||
                        ReflectionHelper.InvokeAsync(assemblyName, className, parmValue, funName); | 
				
			|||
                    } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
                } | 
				
			|||
                catch (Exception ex) | 
				
			|||
                { | 
				
			|||
                    Logger.LogError("Executed ImportLisResultInterfaceWorker Error" + ex.Message); | 
				
			|||
                } | 
				
			|||
                _isRunning = false; | 
				
			|||
                return; | 
				
			|||
            } | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
        public override Task DoWorkAsync(CancellationToken cancellationToken = default) | 
				
			|||
        { | 
				
			|||
            throw new System.NotImplementedException(); | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
						Write
						Preview
					
					
					Loading…
					
					Cancel
						Save
					
		Reference in new issue