use of org.hl7.fhir.r4.model.Encounter in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7MedicationRequestFHIRConversionTest method dosageInstructionTestTextRXO.
@Test
void dosageInstructionTestTextRXO() {
// Test dosageInstruction.text (RXO.6.2)
String hl7message = "MSH|^~\\\\&|||||20210101000000||OMP^O09|MSGID|T|2.6\n" + "PID|||1234||DOE^JANE^|||F||||||||||||||||||||||\n" + "PV1||I||||||||||||||||||||||||||||||||||||||||||\n" + "ORC|OP||||||||||||||||||||||\n" + "RXO|00054418425^Dexamethasone 4 MG Oral Tablet^NDC^^^^^^dexamethasone (DECADRON) 4 MG TABS||||" + // RXO.6.2 to dosageInstruction.text (Purposely leave RXO.6.1 empty) take priority over RXE.21
"|^Take 1 tablet by mouth every 6 (six) hours.||||||||||||||||||\n";
List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
List<Resource> medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
// Confirm that one medicationRequest was created.
assertThat(medicationRequestList).hasSize(1);
MedicationRequest medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
String txt = medicationRequest.getDosageInstructionFirstRep().getText();
// dosageInstruction.text (RXO.6.2)
assertThat(txt).isEqualTo("Take 1 tablet by mouth every 6 (six) hours.");
// Verify no extraneous resources
// Expect MedicationRequest, Patient, and Encounter
assertThat(e).hasSize(3);
}
use of org.hl7.fhir.r4.model.Encounter in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7MedicationRequestFHIRConversionTest method dosageInstructionTestPatientInstructionRXO.
@Test
void dosageInstructionTestPatientInstructionRXO() {
// Test dosageInstruction.patientInstruction (RXO.7)
String hl7message = "MSH|^~\\\\&|||||20210101000000||OMP^O09|MSGID|T|2.6\n" + "PID|||1234||DOE^JANE^|||F||||||||||||||||||||||\n" + "PV1||I||||||||||||||||||||||||||||||||||||||||||\n" + "ORC|OP||||||||||||||||||||||\n" + // Split and concatenate RXO for easier understanding
"RXO|00054418425^Dexamethasone 4 MG Oral Tablet^NDC|||||" + // RXO.7 to dosageInstruction.patientInstruction
"|^Take 1 tablet by mouth every 6 (six) hours.|||||||||||||||||\n";
List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
List<Resource> medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
// Confirm that one medicationRequest was created.
assertThat(medicationRequestList).hasSize(1);
MedicationRequest medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
String patInstruct = medicationRequest.getDosageInstructionFirstRep().getPatientInstruction();
// dosageInstruction.patientInstruction (RXO.7.2)
assertThat(patInstruct).isEqualTo("Take 1 tablet by mouth every 6 (six) hours.");
// Verify no extraneous resources
// Expect MedicationRequest, Patient, and Encounter
assertThat(e).hasSize(3);
}
use of org.hl7.fhir.r4.model.Encounter in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7MedicationRequestFHIRConversionTest method dosageInstructionTestMaxDosePerPeriodRXO.
@Test
void dosageInstructionTestMaxDosePerPeriodRXO() {
// Test dosageInstruction.maxDosePerPeriod from RXO.23
String hl7message = "MSH|^~\\\\&|||||20210101000000||OMP^O09|MSGID|T|2.6\n" + "PID|||1234||DOE^JANE^|||F||||||||||||||||||||||\n" + "PV1||I||||||||||||||||||||||||||||||||||||||||||\n" + "ORC|OP||||||||||||||||||||||\n" + "RXO|00054418425^Dexamethasone 4 MG Oral Tablet^NDC|||||" + // RXO.8 through RXO.22 optional
"||||||||||||||||" + // RXO.23 to dosageInstruction.maxDosePerPeriod.numerator
"|7^PC|\n";
List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
List<Resource> medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
// Confirm that one medicationRequest was created.
assertThat(medicationRequestList).hasSize(1);
MedicationRequest medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
Ratio maxDose = medicationRequest.getDosageInstructionFirstRep().getMaxDosePerPeriod();
// dosageInstruction.maxDosePerPeriod.numerator(RXO.23)
assertThat(maxDose.getNumerator().getValue()).hasToString("7.0");
assertThat(maxDose.getNumerator().getUnit()).isEqualTo("PC");
assertThat(maxDose.getNumerator().getSystem()).isEqualTo("http://unitsofmeasure.org");
// dosageInstruction.maxDosePerPeriod.denominator
assertThat(maxDose.getDenominator().getValue()).hasToString("1.0");
assertThat(maxDose.getDenominator().getUnit()).isEqualTo("day");
assertThat(maxDose.getDenominator().getSystem()).isEqualTo("http://unitsofmeasure.org");
// Verify no extraneous resources
// Expect MedicationRequest, Patient, and Encounter
assertThat(e).hasSize(3);
}
use of org.hl7.fhir.r4.model.Encounter in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7ImmunizationFHIRConversionTest method testImmunizationAdministrationPlaceOrg1.
@Test
// Test priority of Immunization Performer sourcing is tested.
void testImmunizationAdministrationPlaceOrg1() throws IOException {
String hl7VUXmessageRep = "MSH|^~\\&|||||20140701041038||VXU^V04^VXU_V04|MSG.Valid_01|P|2.6|||\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\r" + // PV1.3.4 to Organization referenced by Encounter.serviceProvider; but bypassed for Immunization.performer because RXA.27.4 has priority
"PV1||O|^^^PlacePV1.3.4\r" + "ORC|||197027|||||||^Clerk^Myron|||||||RI2050\r" + // RXA.12 - RXA.26 not used
"RXA|0|1|20130531||48^HIB PRP-T^CVX||||||^^^PlaceRXA11|||||||||||||||" + // RXA.27 to Immunization Performer
"|^^^PlaceRXA274\r" + "OBX|1|CE|59784-9^Disease with presumed immunity^LN||\r";
List<Bundle.BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7VUXmessageRep);
// We expect two different organizations, one for Encounter.serviceProvider, one for Immunization.performer
List<Resource> organizations = ResourceUtils.getResourceList(e, ResourceType.Organization);
assertThat(organizations).hasSize(2);
Organization org1 = (Organization) organizations.get(0);
Organization org2 = (Organization) organizations.get(1);
// RXA.27.4
String orgId1 = org1.getId();
// RXA.27.4
assertThat(orgId1).isEqualTo("Organization/placerxa274");
// PV1.3.4
String orgId2 = org2.getId();
// PV1.3.4
assertThat(orgId2).isEqualTo("Organization/placepv1.3.4");
List<Resource> immunizations = ResourceUtils.getResourceList(e, ResourceType.Immunization);
assertThat(immunizations).hasSize(1);
Immunization imm = (Immunization) immunizations.get(0);
// RXA.27.4
assertThat(imm.getPerformer()).hasSize(1);
// RXA.27
assertThat(imm.getPerformerFirstRep().getActor().getReference()).isEqualTo(orgId1);
List<Resource> encounters = ResourceUtils.getResourceList(e, ResourceType.Encounter);
assertThat(encounters).hasSize(1);
Encounter enc = (Encounter) encounters.get(0);
// PV1.3.4
assertThat(enc.getServiceProvider().getReference()).isEqualTo(orgId2);
// Check for expected resources: Organizations (2), Immunization, Encounter, Patient
assertThat(e).hasSize(5);
}
use of org.hl7.fhir.r4.model.Encounter in project cqf-ruler by DBCG.
the class ProcessMessageProviderIT method testProcessMessage.
@Test
public void testProcessMessage() throws IOException {
String packagePrefix = "org/opencds/cqf/ruler/casereporting/r4/";
Bundle bundle = (Bundle) loadResource(packagePrefix + "example-eicr.json");
Bundle returnBundle = getClient().operation().onServer().named("$process-message-bundle").withParameter(Parameters.class, "content", bundle).returnResourceType(Bundle.class).execute();
assertNotNull(returnBundle);
assertNotNull(getClient().read().resource(Patient.class).withId("patient-12742542").execute());
assertNotNull(getClient().read().resource(Encounter.class).withId("encounter-97953898").execute());
assertNotNull(getClient().read().resource(MeasureReport.class).withId("diabetes-mp").execute());
}
Aggregations