use of org.hl7.fhir.r4.model.MedicationRequest in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7MedicationRequestFHIRConversionTest method dosageInstructionTestDoseQuantityRXE.
@Test
void dosageInstructionTestDoseQuantityRXE() {
// Test dosageInstruction.DoseQuantity RXE.3 using RXE segment, no range
String hl7message = "MSH|^~\\&||||||S1|RDE^O11||T|2.6|||||||||\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|||||E|||||||||||||||||||||||I\n" + // RXE.6 through RXE.44 not used.
"RXE||DUONEB3INH^3 ML PLAS CONT : IPRATROPIUM-ALBUTEROL 0.5-2.5 (3) MG/3ML IN SOLN^ADS|3||mL|||||||||||||||||||||||||||||\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);
Quantity doseQuantity = medicationRequest.getDosageInstructionFirstRep().getDoseAndRateFirstRep().getDoseQuantity();
// dosageInstruction.doseAndRate.doseQuantity RXE.3
// RXE.3
assertThat(doseQuantity.getValue()).hasToString("3.0");
// RXE.5.1
assertThat(doseQuantity.getUnit()).isEqualTo("mL");
// default
assertThat(doseQuantity.getSystem()).isEqualTo("http://unitsofmeasure.org");
// Verify no extraneous resources
// Expect MedicationRequest, Patient
assertThat(e).hasSize(2);
}
use of org.hl7.fhir.r4.model.MedicationRequest in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7MedicationRequestFHIRConversionTest method dosageInstructionTestRouteRXE.
@Test
void dosageInstructionTestRouteRXE() {
// Test dosageInstruction.Route (RXE.6)
String hl7message = "MSH|^~\\&||||||S1|RDE^O11||T|2.6|||||||||\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|||||E|||||||||||||||||||||||I\n" + "RXE||DUONEB3INH^3 ML PLAS CONT : IPRATROPIUM-ALBUTEROL 0.5-2.5 (3) MG/3ML IN SOLN^ADS|||" + // RXE.6 to route
"|6064005||||||||||||||||||||||||||||||||||\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);
CodeableConcept route = medicationRequest.getDosageInstructionFirstRep().getRoute();
// dosageInstruction.route (RXE.6)
// 6.1
assertThat(route.getCodingFirstRep().getCode()).isEqualTo("6064005");
// 6.2
assertThat(route.getCodingFirstRep().getDisplay()).isNull();
// 6.3
assertThat(route.getCodingFirstRep().getSystem()).isNull();
// 6.2
assertThat(route.getText()).isNull();
// Verify no extraneous resources
// Expect MedicationRequest, Patient
assertThat(e).hasSize(2);
}
use of org.hl7.fhir.r4.model.MedicationRequest in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7MedicationRequestFHIRConversionTest method dosageInstructionTestTextRXE.
@Test
void dosageInstructionTestTextRXE() {
// Test dosageInstruction.text (RXE.21)
String hl7message = "MSH|^~\\&||||||S1|RDE^O11||T|2.6|||||||||\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|||||E|||||||||||||||||||||||I\n" + "RXE||DUONEB3INH^3 ML PLAS CONT : IPRATROPIUM-ALBUTEROL 0.5-2.5 (3) MG/3ML IN SOLN^ADS||||||||||||||||||" + // RXE.21 to dosageInstruction.text
"|333^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 (RXE.21.1 and 21.2 separated by a ':')
assertThat(txt).isEqualTo("333:Take 1 tablet by mouth every 6 (six) hours.");
// Verify no extraneous resources
// Expect MedicationRequest, Patient
assertThat(e).hasSize(2);
}
use of org.hl7.fhir.r4.model.MedicationRequest in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7MedicationRequestFHIRConversionTest method test_medicationCodeableConcept_and_intent_in_OMP_and_ORM.
// Tests medication request fields MedicationCodeableConcept and Intent.
// Tests with supported message types ORM-O01, OMP-O09.
// With just the RXO segment -- these message types don't support RXE.
@ParameterizedTest
@ValueSource(strings = { "MSH|^~\\&||||||S1|OMP^O09||T|2.6|||||||||\r", // --UNCOMMENT BELOW WHEN CONVERTER SUPPORTS THIS MESSAGE TYPE--
"MSH|^~\\&||||||S1|ORM^O01||T|2.6|||||||||\r" })
void test_medicationCodeableConcept_and_intent_in_OMP_and_ORM(String msh) {
String hl7message = msh + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|F800006^OE|P800006^RX|||E|10^BID^D4^^^R||\n" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE^NDC||100||mg|||||G||10||5\n";
List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
List<Resource> medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
assertThat(medicationRequestList).hasSize(1);
MedicationRequest medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
// Verify authored on is not present
assertThat(medicationRequest.getAuthoredOn()).isNull();
// Verify intent is set correctly (Hardcoded for all MedicalRequests in template)
String intent = medicationRequest.getIntent().toString();
assertThat(intent).isEqualTo("ORDER");
// Very medicationCodeableConcept is set correctly (RXO.1)
assertThat(medicationRequest.hasMedicationCodeableConcept()).isTrue();
CodeableConcept medCC = medicationRequest.getMedicationCodeableConcept();
assertThat(medCC.getText()).isEqualTo("Test15 SODIUM 100 MG CAPSULE");
assertThat(medCC.getCoding().get(0).getSystem()).isEqualTo("http://hl7.org/fhir/sid/ndc");
assertThat(medCC.getCoding().get(0).getCode()).isEqualTo("RX800006");
assertThat(medCC.getCoding().get(0).getDisplay()).isEqualTo("Test15 SODIUM 100 MG CAPSULE");
}
use of org.hl7.fhir.r4.model.MedicationRequest in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7MedicationRequestFHIRConversionTest method test_medicationCodeableConcept_and_intent_in_PPR.
// Tests medication request fields MedicationCodeableConcept and Intent.
// Tests with supported message types PPR-PC1, PPR-PC2, PPR-PC3
// With just the RXO segment -- these message types don't support RXE.
@ParameterizedTest
@ValueSource(strings = { "MSH|^~\\&||||||S1|PPR^PC1||T|2.6|||||||||\r" // --UNCOMMENT BELOW WHEN CONVERTER SUPPORTS THIS MESSAGE TYPE--
// "MSH|^~\\&||||||S1|PPR^PC2||T|2.6|||||||||\r",
// "MSH|^~\\&||||||S1|PPR^PC3||T|2.6|||||||||\r",
})
void test_medicationCodeableConcept_and_intent_in_PPR(String msh) {
String hl7message = msh + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "PRB|AD|20140610234741|^oxygenase|Problem_000054321_20190606193536||20140610234741\n" + "ORC|NW|F800006^OE|P800006^RX|||E|10^BID^D4^^^R||\n" + "OBR|1|||555|||20170825010500||||||||||||||||||F\r" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE^NDC||100||mg|||||G||10||5\n";
List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
List<Resource> medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
assertThat(medicationRequestList).hasSize(1);
MedicationRequest medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
// Verify authored on is not present
assertThat(medicationRequest.getAuthoredOn()).isNull();
// Verify intent is set correctly
String intent = medicationRequest.getIntent().toString();
assertThat(intent).isEqualTo("ORDER");
// Very medicationCodeableConcept is set correctly
assertThat(medicationRequest.hasMedicationCodeableConcept()).isTrue();
CodeableConcept medCC = medicationRequest.getMedicationCodeableConcept();
assertThat(medCC.getText()).isEqualTo("Test15 SODIUM 100 MG CAPSULE");
assertThat(medCC.getCoding().get(0).getSystem()).isEqualTo("http://hl7.org/fhir/sid/ndc");
assertThat(medCC.getCoding().get(0).getCode()).isEqualTo("RX800006");
assertThat(medCC.getCoding().get(0).getDisplay()).isEqualTo("Test15 SODIUM 100 MG CAPSULE");
}
Aggregations