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; } }
public async Task Handle(RegistrationReceivedIntegrationEvent @event) { using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}")) { Random rnd = new Random(); Adt message = await _grpcRegistrationService.SearchRegistrationDataById(@event.DocumentId, @event.ClientId); int num = rnd.Next(1, 30); DateTime date; string[] format = { "yyyyMMdd" }; if (message.content.PV1[0].admitDateTime != null) { DateTime.TryParseExact(message.content.PV1[0].admitDateTime, format, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out date); } else { string str = DateTime.Now.ToString("yyyy-MM-dd'T'HH:mm:ss.fffffff'Z'"); date = Convert.ToDateTime(str); } var command = new CreateUpdatePatientDetailsInESCommand(message.content.PID[0].patientAccountNumber.id, date, "Payer" + "" + num.ToString(), message.content.PID[0].ssn, message.content.PV1[0].financialClass.financialClass, message.content.PV1[0].patientType, message.content.PID[0].internalId[0].id, message.content.PID[0].patientName[0].firstName, message.content.PID[0].patientName[0].lastName, message.content.PV1[0].admissionType, "RED-Flagged", "HAR" + "" + num.ToString(), @event.ClientId.ToString(), @event.PatientVisitId.ToString(), message.content.EVN[0].operatorId.firstName, "DOS" + "" + num.ToString(), message.content.PID[0].sex, message.content.MSH.sendingFacility.namespaceId, @event.ClientName); _logger.LogInformation("-----Sending command: CreateUpdatePatientDetailsInESCommand"); await _mediatr.Publish(command); await Task.CompletedTask; } }