use of org.hl7.fhir.r4.model.Medication in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7AllergyFHIRConversionTest method test_allergy_no_severity_no_coding_system.
@Test
void test_allergy_no_severity_no_coding_system() {
String hl7message = "MSH|^~\\&|SE050|050|PACS|050|20120912011230||ADT^A01|102|T|2.6|||AL|NE\r" + "PID|0010||PID1234^5^M11^A^MR^HOSP~1234568965^^^USA^SS||DOE^JOHN^A^||19800202|F||W|111 TEST_STREET_NAME^^TEST_CITY^NY^111-1111^USA||(905)111-1111|||S|ZZ|12^^^124|34-13-312||||TEST_BIRTH_PLACE\r" + "AL1|1|DA|00000741^OXYCODONE||HYPOTENSION\r";
AllergyIntolerance allergy = ResourceUtils.getAllergyResource(ftv, hl7message);
assertThat(allergy.hasCriticality()).isFalse();
assertThat(allergy.getCategory().get(0).getCode()).isEqualTo("medication");
assertThat(allergy.getCode().getText()).isEqualTo("OXYCODONE");
List<Coding> codings = allergy.getCode().getCoding();
Assertions.assertEquals(1, codings.size());
Coding coding = codings.get(0);
Assertions.assertEquals("00000741", coding.getCode());
Assertions.assertEquals("OXYCODONE", coding.getDisplay());
assertThat(allergy.getReaction().get(0).getManifestation()).extracting(m -> m.getText()).containsExactly("HYPOTENSION");
}
use of org.hl7.fhir.r4.model.Medication in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7AllergyFHIRConversionTest method test_allergy_single.
@Test
void test_allergy_single() {
String hl7message = "MSH|^~\\&|SE050|050|PACS|050|20120912011230||ADT^A01|102|T|2.6|||AL|NE\r" + "PID|0010||PID1234^5^M11^A^MR^HOSP~1234568965^^^USA^SS||DOE^JOHN^A^||19800202|F||W|111 TEST_STREET_NAME^^TEST_CITY^NY^111-1111^USA||(905)111-1111|||S|ZZ|12^^^124|34-13-312||||TEST_BIRTH_PLACE\r" + "AL1|1|DA|^PENICILLIN|MI|PRODUCES HIVES~RASH|MI\r" + "AL1|2|AA|^CAT DANDER|SV";
AllergyIntolerance allergy = ResourceUtils.getAllergyResource(ftv, hl7message);
assertThat(allergy.getCriticality().toCode()).isEqualTo("low");
assertThat(allergy.getCategory().get(0).getCode()).isEqualTo("medication");
assertThat(allergy.getCode().getText()).isEqualTo("PENICILLIN");
assertThat(allergy.getReaction().get(0).getManifestation()).extracting(m -> m.getText()).containsExactlyInAnyOrder("PRODUCES HIVES", "RASH");
}
use of org.hl7.fhir.r4.model.Medication 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.Medication 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");
}
use of org.hl7.fhir.r4.model.Medication in project cqf-ruler by DBCG.
the class ActivityDefinitionApplyProvider method resolveMedicationRequest.
private MedicationRequest resolveMedicationRequest(ActivityDefinition activityDefinition, String patientId) throws ActivityDefinitionApplyException {
// intent, medication, and subject are required
MedicationRequest medicationRequest = new MedicationRequest();
medicationRequest.setIntent(MedicationRequest.MedicationRequestIntent.ORDER);
medicationRequest.setSubject(new Reference(patientId));
if (activityDefinition.hasProduct()) {
medicationRequest.setMedication(activityDefinition.getProduct());
} else {
throw new ActivityDefinitionApplyException("Missing required product property");
}
if (activityDefinition.hasDosage()) {
medicationRequest.setDosageInstruction(activityDefinition.getDosage());
}
if (activityDefinition.hasBodySite()) {
throw new ActivityDefinitionApplyException("BodySite does not map to " + activityDefinition.getKind());
}
if (activityDefinition.hasCode()) {
throw new ActivityDefinitionApplyException("Code does not map to " + activityDefinition.getKind());
}
if (activityDefinition.hasQuantity()) {
throw new ActivityDefinitionApplyException("Quantity does not map to " + activityDefinition.getKind());
}
return medicationRequest;
}
Aggregations