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;
}
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));
}
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));
}
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();
}
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();
}
Aggregations