Search in sources :

Example 26 with Dosage

use of org.hl7.fhir.r4b.model.Dosage in project openmrs-module-fhir2 by openmrs.

the class DosageTranslatorImpl method toFhirResource.

@Override
public Dosage toFhirResource(@Nonnull DrugOrder drugOrder) {
    if (drugOrder == null) {
        return null;
    }
    Dosage dosage = new Dosage();
    dosage.setText(drugOrder.getDosingInstructions());
    dosage.setAsNeeded(new BooleanType(drugOrder.getAsNeeded()));
    dosage.setRoute(conceptTranslator.toFhirResource(drugOrder.getRoute()));
    dosage.setTiming(timingTranslator.toFhirResource(drugOrder));
    return dosage;
}
Also used : BooleanType(org.hl7.fhir.r4.model.BooleanType) Dosage(org.hl7.fhir.r4.model.Dosage)

Example 27 with Dosage

use of org.hl7.fhir.r4b.model.Dosage in project openmrs-module-fhir2 by openmrs.

the class MedicationRequestTranslatorImplTest method toFhirResource_shouldAddDosageInstructions.

@Test
public void toFhirResource_shouldAddDosageInstructions() {
    Concept concept = new Concept();
    concept.setUuid(CONCEPT_UUID);
    concept.setConceptId(10023);
    CodeableConcept codeableConcept = new CodeableConcept();
    codeableConcept.addCoding(new Coding().setCode(concept.getConceptId().toString()));
    Dosage dosage = new Dosage();
    dosage.setRoute(codeableConcept);
    dosage.setAsNeeded(new BooleanType(true));
    dosage.setText(DOSING_INSTRUCTIONS);
    drugOrder.setAsNeeded(true);
    drugOrder.setRoute(concept);
    drugOrder.setDosingInstructions(DOSING_INSTRUCTIONS);
    when(dosageTranslator.toFhirResource(drugOrder)).thenReturn(dosage);
    MedicationRequest result = medicationRequestTranslator.toFhirResource(drugOrder);
    assertThat(result, notNullValue());
    assertThat(result.getDosageInstructionFirstRep(), notNullValue());
    assertThat(result.getDosageInstructionFirstRep().getText(), equalTo(DOSING_INSTRUCTIONS));
    assertThat(result.getDosageInstructionFirstRep().getAsNeededBooleanType().booleanValue(), is(true));
    assertThat(result.getDosageInstructionFirstRep().getRoute(), equalTo(codeableConcept));
}
Also used : CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Concept(org.openmrs.Concept) MedicationRequest(org.hl7.fhir.r4.model.MedicationRequest) Coding(org.hl7.fhir.r4.model.Coding) BooleanType(org.hl7.fhir.r4.model.BooleanType) Dosage(org.hl7.fhir.r4.model.Dosage) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.Test)

Example 28 with Dosage

use of org.hl7.fhir.r4b.model.Dosage in project openmrs-module-fhir2 by openmrs.

the class DosageTranslatorImplTest method toFhirResource_shouldSetDosageTiming.

@Test
public void toFhirResource_shouldSetDosageTiming() {
    Timing.TimingRepeatComponent repeatComponent = new Timing.TimingRepeatComponent();
    repeatComponent.setPeriod(1);
    repeatComponent.setPeriodUnit(Timing.UnitsOfTime.D);
    Timing timing = new Timing();
    timing.addEvent(new Date());
    timing.setRepeat(repeatComponent);
    when(timingTranslator.toFhirResource(drugOrder)).thenReturn(timing);
    Dosage result = dosageTranslator.toFhirResource(drugOrder);
    assertThat(result, notNullValue());
    assertThat(result.getTiming(), notNullValue());
    assertThat(result.getTiming().getEvent(), not(empty()));
    assertThat(result.getTiming().getEvent().get(0).getValue(), DateMatchers.sameDay(new Date()));
    assertThat(result.getTiming().getRepeat().getPeriod(), equalTo(new BigDecimal(1)));
    assertThat(result.getTiming().getRepeat().getPeriodUnit(), equalTo(Timing.UnitsOfTime.D));
}
Also used : Timing(org.hl7.fhir.r4.model.Timing) Dosage(org.hl7.fhir.r4.model.Dosage) Date(java.util.Date) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 29 with Dosage

use of org.hl7.fhir.r4b.model.Dosage in project kindling by HL7.

the class PageProcessor method diHeader.

private String diHeader(String mode) {
    StringBuilder b = new StringBuilder();
    b.append("<ul class=\"nav nav-tabs\">");
    b.append(makeHeaderTab("Dosage Instruction Detail", "dosage.html", mode == null || "base".equals(mode)));
    b.append(makeHeaderTab("Examples", "dosage-examples.html", mode == null || "examples".equals(mode)));
    b.append(makeHeaderTab("Detailed Descriptions", "dosage-definitions.html", mode == null || "definitions".equals(mode)));
    b.append(makeHeaderTab("Mappings", "dosage-mappings.html", mode == null || "mappings".equals(mode)));
    b.append("</ul>\r\n");
    return b.toString();
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Example 30 with Dosage

use of org.hl7.fhir.r4b.model.Dosage in project kindling by HL7.

the class PageProcessor method genDiffLinks.

private String genDiffLinks() {
    StringBuilder b = new StringBuilder();
    b.append("<ul>\r\n");
    pageDiffLinks(b, "resourcelist");
    pageDiffLinks(b, "lifecycle");
    pageDiffLinks(b, "compartmentdefinition");
    pageDiffLinks(b, "rdf");
    pageDiffLinks(b, "terminologies-systems");
    pageDiffLinks(b, "mappings");
    pageDiffLinks(b, "versioning");
    pageDiffLinks(b, "history");
    pageDiffLinks(b, "diff");
    pageDiffLinks(b, "r3maps");
    pageDiffLinks(b, "overview");
    pageDiffLinks(b, "overview-dev");
    pageDiffLinks(b, "overview-clinical");
    pageDiffLinks(b, "overview-arch");
    pageDiffLinks(b, "summary");
    pageDiffLinks(b, "help");
    pageDiffLinks(b, "license");
    pageDiffLinks(b, "credits");
    pageDiffLinks(b, "todo");
    pageDiffLinks(b, "change");
    pageDiffLinks(b, "async");
    pageDiffLinks(b, "graphql");
    pageDiffLinks(b, "documents");
    pageDiffLinks(b, "messaging");
    pageDiffLinks(b, "services");
    pageDiffLinks(b, "storage");
    pageDiffLinks(b, "dosage");
    pageDiffLinks(b, "fivews");
    pageDiffLinks(b, "event");
    pageDiffLinks(b, "request");
    pageDiffLinks(b, "definition");
    pageDiffLinks(b, "downloads");
    pageDiffLinks(b, "versioning");
    pageDiffLinks(b, "validation");
    pageDiffLinks(b, "best-practices");
    pageDiffLinks(b, "mapping-language");
    pageDiffLinks(b, "testing");
    pageDiffLinks(b, "security");
    pageDiffLinks(b, "safety");
    pageDiffLinks(b, "managing");
    pageDiffLinks(b, "resourceguide");
    pageDiffLinks(b, "languages");
    pageDiffLinks(b, "updates");
    pageDiffLinks(b, "pushpull");
    pageDiffLinks(b, "integrated-examples");
    pageDiffLinks(b, "usecases");
    pageDiffLinks(b, "comparison-v2");
    pageDiffLinks(b, "comparison-v3");
    pageDiffLinks(b, "comparison-cda");
    pageDiffLinks(b, "comparison-other");
    for (String n : definitions.sortedResourceNames()) {
        resourceDiffLinks(b, n);
    }
    b.append("</ul>\r\n");
    return b.toString();
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Aggregations

Dosage (org.hl7.fhir.r4.model.Dosage)8 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)8 Date (java.util.Date)6 ArrayList (java.util.ArrayList)5 Reference (org.hl7.fhir.dstu3.model.Reference)5 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)5 Test (org.junit.Test)5 JsonElement (com.google.gson.JsonElement)4 JsonObject (com.google.gson.JsonObject)4 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)4 Dosage (org.hl7.fhir.dstu3.model.Dosage)4 Coding (org.hl7.fhir.r4.model.Coding)4 Quantity (org.hl7.fhir.r4.model.Quantity)4 NotImplementedException (org.apache.commons.lang3.NotImplementedException)3 Coding (org.hl7.fhir.dstu3.model.Coding)3 Quantity (org.hl7.fhir.dstu3.model.Quantity)3 Timing (org.hl7.fhir.dstu3.model.Timing)3 BooleanType (org.hl7.fhir.r4.model.BooleanType)3 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)3 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)3