Пример #1
0
        public async Task Handle(RegistrationReceivedIntegrationEvent @event)
        {
            using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
            {
                Hl7AdtDto message = await _grpcRegistrationService.SearchRegistrationDataById(@event.DocumentId, @event.ClientId);

                string[] format = { "yyyyMMdd" };
                DateTime date;

                DateTime.TryParseExact(message.Hl7Message.Pid.Pid7.Pid71,
                                       format,
                                       System.Globalization.CultureInfo.InvariantCulture,
                                       System.Globalization.DateTimeStyles.None,
                                       out date);

                var command = new CreateUpdatePatientDetailsInESCommand(message.Hl7Message.Pid.Pid18.Pid181, date, "Payer1",
                                                                        message.Hl7Message.Pid.Pid19.Pid191, message.Hl7Message.Pv1.Pv120.Pv1201,
                                                                        message.Hl7Message.Pv1.Pv118.ToString(), message.Hl7Message.Pid.Pid3.Pid31.ToString(), message.Hl7Message.Pid.Pid5.Pid51,
                                                                        message.Hl7Message.Pid.Pid5.Pid52, message.Hl7Message.Pv1.Pv14.Pv141,
                                                                        message.Hl7Message.Pv2.Pv224.Pv2241, "HAR1", @event.ClientId.ToString(), @event.PatientVisitId.ToString(),
                                                                        "Registrar", "DOS", message.Hl7Message.Pid.Pid8.Pid81);

                _logger.LogInformation("-----Sending command: RunRegistrationRulesCommand");

                await _mediatr.Publish(command);

                await Task.CompletedTask;
            }
        }
Пример #2
0
        public Task <Hl7AdtDto> SearchRegistrationDataById(string documentId, int clientId)
        {
            AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
            var registrationChannel = GrpcChannel.ForAddress(_grpcClientAddress);
            var registrationClient  = new RegistrationApiRetrieval.RegistrationApiRetrievalClient(registrationChannel);
            var adtMessageRequest   = new SearchAPIAdtMessageRequest {
                Id = documentId, ClientId = clientId
            };
            var       reply   = registrationClient.SearchAPIFindAdtMessageById(adtMessageRequest);
            Hl7AdtDto message = JsonConvert.DeserializeObject <Hl7AdtDto>(reply.AdtMessage);

            return(Task.FromResult(message));
        }