Search in sources :

Example 96 with MR

use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7MedicationRequestFHIRConversionTest method test_medicationreq_patient.

// private static FHIRContext context = new FHIRContext(true, false);
// private static final Logger LOGGER = LoggerFactory.getLogger(Hl7MedicationRequestFHIRConversionTest.class);
@Test
void test_medicationreq_patient() {
    String hl7message = "MSH|^~\\&|APP|FAC|WHIA|IBM|20180622230000||RDE^O11^RDE_O11|MSGID221xx0xcnvMed31|T|2.6\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "PV1||I|6N^1234^A^GENHOS||||0100^ANDERSON,CARL|0148^ADDISON,JAMES||SUR|||||||0100^ANDERSON,CARL|S|V446911|A|||||||||||||||||||SF|K||||20180622230000\n" + "ORC|NW|F800006^OE|P800006^RX|||E|10^BID^D4^^^R||20180622230000\n" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE|100||mg|||||G||10||5\n" + "RXE|^^^20180622230000^^R|62756-017^Testosterone Cypionate^NDC|100||mg|||||10||5\n";
    List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
    List<Resource> patientList = ResourceUtils.getResourceList(e, ResourceType.Patient);
    assertThat(patientList).hasSize(1);
    Patient patient = ResourceUtils.getResourcePatient(patientList.get(0), ResourceUtils.context);
    List<Resource> medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
    assertThat(medicationRequestList).hasSize(1);
    MedicationRequest medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
    assertThat(medicationRequest.getSubject()).isNotNull();
    assertThat(medicationRequest.getSubject().getReference()).isEqualTo(patient.getId());
    // Test that RDE_O11 messages don't create ServiceRequests
    List<Resource> serviceRequestList = ResourceUtils.getResourceList(e, ResourceType.ServiceRequest);
    // Confirm that a serviceRequest was not created.
    assertThat(serviceRequestList).isEmpty();
}
Also used : MedicationRequest(org.hl7.fhir.r4.model.MedicationRequest) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) Resource(org.hl7.fhir.r4.model.Resource) Patient(org.hl7.fhir.r4.model.Patient) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 97 with MR

use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7MedicationRequestFHIRConversionTest method test_medicationCodeableConcept_authoredOn_and_intent_in_rde_with_just_rxe.

// Tests medication request fields MedicationCodeableConcept, Authored On, and Intent.
// Tests with supported message types RDE-O11, RDE-O25.
// With just the RXE segment.
@ParameterizedTest
@ValueSource(strings = { "MSH|^~\\&||||||S1|RDE^O11||T|2.6|||||||||\r", "MSH|^~\\&||||||S1|RDE^O25||T|2.6|||||||||\r" })
void test_medicationCodeableConcept_authoredOn_and_intent_in_rde_with_just_rxe(String msh) {
    // AuthoredOn comes from RXE.32
    String hl7message = msh + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|F800006^OE|P800006^RX|||E|10^BID^D4^^^R||20190622160000\n" + // RXE.32 to MedicationRequest.AuthoredOn
    "RXE|||3||mL|47||||1|PC||||||||||||||||||||DUONEB3INH^3 ML PLAS CONT : IPRATROPIUM-ALBUTEROL 0.5-2.5 (3) MG/3ML IN SOLN^ADS|20180622230000||||||||\n";
    // RXE.31
    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 date is correct (RXE.32)
    Date authoredOnDate = medicationRequest.getAuthoredOn();
    Calendar c = Calendar.getInstance();
    c.clear();
    // 2018 06 22 23 00 00   -- June is 05
    c.set(2018, 5, 22, 23, 0);
    ZoneId zone = ConverterConfiguration.getInstance().getZoneId();
    TimeZone timeZone = TimeZone.getTimeZone(zone);
    c.setTimeZone(timeZone);
    Date authoredOnDateTest = c.getTime();
    assertThat(authoredOnDate).isEqualTo(authoredOnDateTest);
    // Verify intent is set correctly (Hardcoded for all MedicalRequests in template)
    String intent = medicationRequest.getIntent().toString();
    assertThat(intent).isEqualTo("ORDER");
    // Verify medicationCodeableConcept is set correctly RXE.31
    assertThat(medicationRequest.hasMedicationCodeableConcept()).isTrue();
    CodeableConcept medCC = medicationRequest.getMedicationCodeableConcept();
    assertThat(medCC.getText()).isEqualTo("3 ML PLAS CONT : IPRATROPIUM-ALBUTEROL 0.5-2.5 (3) MG/3ML IN SOLN");
    assertThat(medCC.getCoding().get(0).getSystem()).isEqualTo("urn:id:ADS");
    assertThat(medCC.getCoding().get(0).getCode()).isEqualTo("DUONEB3INH");
    assertThat(medCC.getCoding().get(0).getDisplay()).isEqualTo("3 ML PLAS CONT : IPRATROPIUM-ALBUTEROL 0.5-2.5 (3) MG/3ML IN SOLN");
}
Also used : MedicationRequest(org.hl7.fhir.r4.model.MedicationRequest) TimeZone(java.util.TimeZone) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) ZoneId(java.time.ZoneId) Calendar(java.util.Calendar) Resource(org.hl7.fhir.r4.model.Resource) Date(java.util.Date) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 98 with MR

use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7MedicationRequestFHIRConversionTest method test_medicationCodeableConcept_authoredOn_and_intent_in_rde_with_rxO_with_rxe.

// Tests medication request fields MedicationCodeableConcept, Authored On, and Intent.
// Tests with supported message types RDE-O11, RDE-O25.
// With both RXO and RXE segments, only RXE will be used.
@ParameterizedTest
@ValueSource(strings = { "MSH|^~\\&||||||S1|RDE^O11||T|2.6|||||||||\r", "MSH|^~\\&||||||S1|RDE^O25||T|2.6|||||||||\r" })
void test_medicationCodeableConcept_authoredOn_and_intent_in_rde_with_rxO_with_rxe(String msh) {
    // AuthoredOn comes from ORC.9 (the backup value) No RXE.32
    String hl7message = msh + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|F800006^OE|P800006^RX|||E|10^BID^D4^^^R||20180622230000\n" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE^NDC||100||mg|||||G||10||5\n" + "RXE||DUONEB3INH^3 ML PLAS CONT : IPRATROPIUM-ALBUTEROL 0.5-2.5 (3) MG/3ML IN SOLN^ADS||||||||||||||||||||||||||||||||||||||\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 date is correct.
    Date authoredOnDate = medicationRequest.getAuthoredOn();
    Calendar c = Calendar.getInstance();
    c.clear();
    // 2018 06 22 23 00 00   -- june is 05 //ORC.9
    c.set(2018, 5, 22, 23, 0);
    ZoneId zone = ConverterConfiguration.getInstance().getZoneId();
    TimeZone timeZone = TimeZone.getTimeZone(zone);
    c.setTimeZone(timeZone);
    Date authoredOnDateTest = c.getTime();
    assertThat(authoredOnDate).isEqualTo(authoredOnDateTest);
    // Verify intent is set correctly
    String intent = medicationRequest.getIntent().toString();
    assertThat(intent).isEqualTo("ORDER");
    // Very medicationCodeableConcept is set correctly RXE.2
    assertThat(medicationRequest.hasMedicationCodeableConcept()).isTrue();
    CodeableConcept medCC = medicationRequest.getMedicationCodeableConcept();
    assertThat(medCC.getText()).isEqualTo("3 ML PLAS CONT : IPRATROPIUM-ALBUTEROL 0.5-2.5 (3) MG/3ML IN SOLN");
    assertThat(medCC.getCoding().get(0).getSystem()).isEqualTo("urn:id:ADS");
    assertThat(medCC.getCoding().get(0).getCode()).isEqualTo("DUONEB3INH");
    assertThat(medCC.getCoding().get(0).getDisplay()).isEqualTo("3 ML PLAS CONT : IPRATROPIUM-ALBUTEROL 0.5-2.5 (3) MG/3ML IN SOLN");
}
Also used : MedicationRequest(org.hl7.fhir.r4.model.MedicationRequest) TimeZone(java.util.TimeZone) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) ZoneId(java.time.ZoneId) Calendar(java.util.Calendar) Resource(org.hl7.fhir.r4.model.Resource) Date(java.util.Date) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 99 with MR

use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7MedicationRequestFHIRConversionTest method testMedicationRequestCategoryRequesterAndDispenseRequest2.

@Test
void testMedicationRequestCategoryRequesterAndDispenseRequest2() {
    String hl7message = "MSH|^~\\&||||||S1|RDE^O11||T|2.6|||||||||\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + // ORC.12 purposely present but ignored by RXE.13 priority
    "ORC|NW|||||||||||3122^PROVIDER^ORDERING^^^DR|||||||||||||||||\n" + "RXE|^Q24H&0600^^20210330144208^^ROU|DUONEB3INH^3 ML PLAS CONT : IPRATROPIUM-ALBUTEROL 0.5-2.5 (3) MG/3ML IN SOLN^ADS|3||mL|47||||||" + // RXE.13 to practitioner take priority over ORC.12
    "|2213^ORDERING^PROVIDER|||||||||||||||||||||||||||\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);
    // requester comes from RXE.13
    String requesterRef = medicationRequest.getRequester().getReference();
    Practitioner practBundle = ResourceUtils.getSpecificPractitionerFromBundleEntriesList(e, requesterRef);
    Identifier practitionerIdentifier = practBundle.getIdentifierFirstRep();
    HumanName practName = practBundle.getNameFirstRep();
    CodeableConcept practitionerIdentifierType = practitionerIdentifier.getType();
    // Check meta extension.display is null
    Extension ext = practBundle.getMeta().getExtension().get(0);
    assertThat(ext).isNotNull();
    CodeableConcept cc = (CodeableConcept) ext.getValue();
    assertThat(cc.hasCoding()).isTrue();
    assertThat(cc.getCoding().get(0).getDisplay()).isNull();
    DatatypeUtils.checkCommonCodeableConceptAssertions(practitionerIdentifierType, "DEA", "Drug Enforcement Administration registration number", "http://terminology.hl7.org/CodeSystem/v2-0203", null);
    // RXE.13.1
    assertThat(practitionerIdentifier.getValue()).isEqualTo("2213");
    // RXE.13.9
    assertThat(practitionerIdentifier.getSystem()).isNull();
    // RXE.13.2
    assertThat(practName.getFamily()).isEqualTo("ORDERING");
    // RXE.13.3
    assertThat(practName.getGivenAsSingleString()).isEqualTo("PROVIDER");
    // RXE.13.6
    assertThat(practName.getPrefix()).isEmpty();
    // RXE.13.5
    assertThat(practName.getSuffix()).isEmpty();
    // RXE.13
    assertThat(practName.getText()).isEqualTo("PROVIDER ORDERING");
}
Also used : Practitioner(org.hl7.fhir.r4.model.Practitioner) Extension(org.hl7.fhir.r4.model.Extension) HumanName(org.hl7.fhir.r4.model.HumanName) MedicationRequest(org.hl7.fhir.r4.model.MedicationRequest) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) Identifier(org.hl7.fhir.r4.model.Identifier) Resource(org.hl7.fhir.r4.model.Resource) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 100 with MR

use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7MedicationRequestFHIRConversionTest method test_medicationreq_status.

@Test
void test_medicationreq_status() {
    // ORC.5 = A -> Expected medication status = (ACTIVE ORC.1 is present but ORC.5 takes precedence)
    String hl7message = "MSH|^~\\&|APP|FAC|WHIA|IBM|20180622230000||RDE^O11^RDE_O11|MSGID221xx0xcnvMed31|T|2.6\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|F800006^OE|P800006^RX||A|E|10^BID^D4^^^R||20180622230000\n" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE|100||mg|||||G||10||5\n" + "RXE|^^^20180622230000^^R|62756-017^Testosterone Cypionate^NDC|100||mg|||||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);
    assertThat(medicationRequest.getStatus()).isEqualTo(MedicationRequestStatus.ACTIVE);
    // ORC.5 = CM -> Expected medication status = COMPLETED (ORC.1 is present but ORC.5 takes precedence)
    hl7message = "MSH|^~\\&|APP|FAC|WHIA|IBM|20180622230000||RDE^O11^RDE_O11|MSGID221xx0xcnvMed31|T|2.6\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|F800006^OE|P800006^RX||CM|E|10^BID^D4^^^R||20180622230000\n" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE|100||mg|||||G||10||5\n" + "RXE|^^^20180622230000^^R|62756-017^Testosterone Cypionate^NDC|100||mg|||||10||5\n";
    e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
    medicationRequestList.clear();
    medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
    assertThat(medicationRequestList).hasSize(1);
    medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
    assertThat(medicationRequest.getStatus()).isEqualTo(MedicationRequestStatus.COMPLETED);
    // ORC.5 = ER -> Expected medication status = ENTEREDINERROR (ORC.1 is present but ORC.5 takes precedence)
    hl7message = "MSH|^~\\&|APP|FAC|WHIA|IBM|20180622230000||RDE^O11^RDE_O11|MSGID221xx0xcnvMed31|T|2.6\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|F800006^OE|P800006^RX||ER|E|10^BID^D4^^^R||20180622230000\n" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE|100||mg|||||G||10||5\n" + "RXE|^^^20180622230000^^R|62756-017^Testosterone Cypionate^NDC|100||mg|||||10||5\n";
    e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
    medicationRequestList.clear();
    medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
    assertThat(medicationRequestList).hasSize(1);
    medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
    assertThat(medicationRequest.getStatus()).isEqualTo(MedicationRequestStatus.ENTEREDINERROR);
    // ORC.1 = NW -> Expected medication status = ACTIVE (Missing ORC.5 so ORC.1 takes precedence)
    hl7message = "MSH|^~\\&|APP|FAC|WHIA|IBM|20180622230000||RDE^O11^RDE_O11|MSGID221xx0xcnvMed31|T|2.6\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|F800006^OE|P800006^RX|||E|10^BID^D4^^^R||20180622230000\n" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE|100||mg|||||G||10||5\n" + "RXE|^^^20180622230000^^R|62756-017^Testosterone Cypionate^NDC|100||mg|||||10||5\n";
    e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
    medicationRequestList.clear();
    medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
    assertThat(medicationRequestList).hasSize(1);
    medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
    assertThat(medicationRequest.getStatus()).isEqualTo(MedicationRequestStatus.ACTIVE);
    // ORC.1 = RP -> Expected medication status = UNKNOWN (Missing ORC.5 so ORC.1 takes precedence)
    hl7message = "MSH|^~\\&|APP|FAC|WHIA|IBM|20180622230000||RDE^O11^RDE_O11|MSGID221xx0xcnvMed31|T|2.6\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|RP|F800006^OE|P800006^RX|||E|10^BID^D4^^^R||20180622230000\n" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE|100||mg|||||G||10||5\n" + "RXE|^^^20180622230000^^R|62756-017^Testosterone Cypionate^NDC|100||mg|||||10||5\n";
    e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
    medicationRequestList.clear();
    medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
    assertThat(medicationRequestList).hasSize(1);
    medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
    assertThat(medicationRequest.getStatus()).isEqualTo(MedicationRequestStatus.UNKNOWN);
    // ORC.1 = DC -> Expected medication status = STOPPED (Missing ORC.5 so ORC.1 takes precedence)
    hl7message = "MSH|^~\\&|APP|FAC|WHIA|IBM|20180622230000||RDE^O11^RDE_O11|MSGID221xx0xcnvMed31|T|2.6\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|DC|F800006^OE|P800006^RX|||E|10^BID^D4^^^R||20180622230000\n" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE|100||mg|||||G||10||5\n" + "RXE|^^^20180622230000^^R|62756-017^Testosterone Cypionate^NDC|100||mg|||||10||5\n";
    e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
    medicationRequestList.clear();
    medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
    assertThat(medicationRequestList).hasSize(1);
    medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
    assertThat(medicationRequest.getStatus()).isEqualTo(MedicationRequestStatus.STOPPED);
    // Test that RDE_O11 messages don't create ServiceRequests
    List<Resource> serviceRequestList = e.stream().filter(v -> ResourceType.ServiceRequest == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
    // Confirm that a serviceRequest was not created.
    assertThat(serviceRequestList).isEmpty();
    // ORC.1 = CA -> Expected medication status = CANCELLED (Missing ORC.5 so ORC.1 takes precedence)
    hl7message = "MSH|^~\\&|APP|FAC|WHIA|IBM|20180622230000||RDE^O11^RDE_O11|MSGID221xx0xcnvMed31|T|2.6\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "PV1||I|6N^1234^A^GENHOS||||0100^ANDERSON,CARL|0148^ADDISON,JAMES||SUR|||||||0100^ANDERSON,CARL|S|V446911|A|||||||||||||||||||SF|K||||20180622230000\n" + "ORC|CA|F800006^OE|P800006^RX|||E|10^BID^D4^^^R||20180622230000\n" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE|100||mg|||||G||10||5\n" + "RXE|^^^20180622230000^^R|62756-017^Testosterone Cypionate^NDC|100||mg|||||10||5\n";
    e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
    medicationRequestList.clear();
    medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
    assertThat(medicationRequestList).hasSize(1);
    medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
    assertThat(medicationRequest.getStatus()).isEqualTo(MedicationRequestStatus.CANCELLED);
    // Test that RDE_O11 messages don't create ServiceRequests
    serviceRequestList.clear();
    serviceRequestList = e.stream().filter(v -> ResourceType.ServiceRequest == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
    // Confirm that a serviceRequest was not created.
    assertThat(serviceRequestList).isEmpty();
}
Also used : MedicationRequest(org.hl7.fhir.r4.model.MedicationRequest) Date(java.util.Date) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Identifier(org.hl7.fhir.r4.model.Identifier) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Range(org.hl7.fhir.r4.model.Range) Calendar(java.util.Calendar) HumanName(org.hl7.fhir.r4.model.HumanName) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) ConverterConfiguration(io.github.linuxforhealth.core.config.ConverterConfiguration) ResourceUtils(io.github.linuxforhealth.hl7.segments.util.ResourceUtils) Quantity(org.hl7.fhir.r4.model.Quantity) Ratio(org.hl7.fhir.r4.model.Ratio) HL7ToFHIRConverter(io.github.linuxforhealth.hl7.HL7ToFHIRConverter) Patient(org.hl7.fhir.r4.model.Patient) Practitioner(org.hl7.fhir.r4.model.Practitioner) ValueSource(org.junit.jupiter.params.provider.ValueSource) TimeZone(java.util.TimeZone) Resource(org.hl7.fhir.r4.model.Resource) MedicationRequestStatus(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus) Collectors(java.util.stream.Collectors) ZoneId(java.time.ZoneId) Test(org.junit.jupiter.api.Test) ResourceType(org.hl7.fhir.r4.model.ResourceType) List(java.util.List) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) DatatypeUtils(io.github.linuxforhealth.hl7.segments.util.DatatypeUtils) Extension(org.hl7.fhir.r4.model.Extension) MedicationRequest(org.hl7.fhir.r4.model.MedicationRequest) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) Resource(org.hl7.fhir.r4.model.Resource) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Test (org.junit.jupiter.api.Test)126 Resource (org.hl7.fhir.r4.model.Resource)86 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)83 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)58 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)40 Patient (org.hl7.fhir.r4.model.Patient)36 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)35 Identifier (org.hl7.fhir.r4.model.Identifier)30 Bundle (org.hl7.fhir.r4.model.Bundle)29 MedicationRequest (org.hl7.fhir.r4.model.MedicationRequest)22 Immunization (org.hl7.fhir.r4.model.Immunization)19 Encounter (org.hl7.fhir.r4.model.Encounter)18 Coding (org.hl7.fhir.r4.model.Coding)16 Observation (org.hl7.fhir.r4.model.Observation)15 Organization (org.hl7.fhir.r4.model.Organization)15 ServiceRequest (org.hl7.fhir.r4.model.ServiceRequest)15 ValueSource (org.junit.jupiter.params.provider.ValueSource)14 ResourceModel (io.github.linuxforhealth.api.ResourceModel)13 Reference (org.hl7.fhir.r4.model.Reference)13 Extension (org.hl7.fhir.r4.model.Extension)11