use of org.hl7.fhir.r4b.model.Dosage in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeMedicationAdministration.
protected void composeMedicationAdministration(Complex parent, String parentType, String name, MedicationAdministration element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "MedicationAdministration", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "MedicationAdministration", "identifier", element.getIdentifier().get(i), i);
if (element.hasStatusElement())
composeEnum(t, "MedicationAdministration", "status", element.getStatusElement(), -1);
if (element.hasMedication())
composeType(t, "MedicationAdministration", "medication", element.getMedication(), -1);
if (element.hasPatient())
composeReference(t, "MedicationAdministration", "patient", element.getPatient(), -1);
if (element.hasEncounter())
composeReference(t, "MedicationAdministration", "encounter", element.getEncounter(), -1);
if (element.hasEffectiveTime())
composeType(t, "MedicationAdministration", "effectiveTime", element.getEffectiveTime(), -1);
if (element.hasPractitioner())
composeReference(t, "MedicationAdministration", "practitioner", element.getPractitioner(), -1);
if (element.hasPrescription())
composeReference(t, "MedicationAdministration", "prescription", element.getPrescription(), -1);
if (element.hasWasNotGivenElement())
composeBoolean(t, "MedicationAdministration", "wasNotGiven", element.getWasNotGivenElement(), -1);
for (int i = 0; i < element.getReasonNotGiven().size(); i++) composeCodeableConcept(t, "MedicationAdministration", "reasonNotGiven", element.getReasonNotGiven().get(i), i);
for (int i = 0; i < element.getReasonGiven().size(); i++) composeCodeableConcept(t, "MedicationAdministration", "reasonGiven", element.getReasonGiven().get(i), i);
for (int i = 0; i < element.getDevice().size(); i++) composeReference(t, "MedicationAdministration", "device", element.getDevice().get(i), i);
for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "MedicationAdministration", "note", element.getNote().get(i), i);
if (element.hasDosage())
composeMedicationAdministrationMedicationAdministrationDosageComponent(t, "MedicationAdministration", "dosage", element.getDosage(), -1);
}
use of org.hl7.fhir.r4b.model.Dosage in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent.
protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(Complex parent, String parentType, String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "administrationGuidelines", name, element, index);
for (int i = 0; i < element.getDosage().size(); i++) composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(t, "MedicationKnowledge", "dosage", element.getDosage().get(i), i);
if (element.hasIndication())
composeType(t, "MedicationKnowledge", "indication", element.getIndication(), -1);
for (int i = 0; i < element.getPatientCharacteristics().size(); i++) composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(t, "MedicationKnowledge", "patientCharacteristics", element.getPatientCharacteristics().get(i), i);
}
use of org.hl7.fhir.r4b.model.Dosage in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeActivityDefinition.
protected void composeActivityDefinition(Complex parent, String parentType, String name, ActivityDefinition element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "ActivityDefinition", name, element, index);
if (element.hasUrlElement())
composeUri(t, "ActivityDefinition", "url", element.getUrlElement(), -1);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "ActivityDefinition", "identifier", element.getIdentifier().get(i), i);
if (element.hasVersionElement())
composeString(t, "ActivityDefinition", "version", element.getVersionElement(), -1);
if (element.hasNameElement())
composeString(t, "ActivityDefinition", "name", element.getNameElement(), -1);
if (element.hasTitleElement())
composeString(t, "ActivityDefinition", "title", element.getTitleElement(), -1);
if (element.hasSubtitleElement())
composeString(t, "ActivityDefinition", "subtitle", element.getSubtitleElement(), -1);
if (element.hasStatusElement())
composeEnum(t, "ActivityDefinition", "status", element.getStatusElement(), -1);
if (element.hasExperimentalElement())
composeBoolean(t, "ActivityDefinition", "experimental", element.getExperimentalElement(), -1);
if (element.hasSubject())
composeType(t, "ActivityDefinition", "subject", element.getSubject(), -1);
if (element.hasDateElement())
composeDateTime(t, "ActivityDefinition", "date", element.getDateElement(), -1);
if (element.hasPublisherElement())
composeString(t, "ActivityDefinition", "publisher", element.getPublisherElement(), -1);
for (int i = 0; i < element.getContact().size(); i++) composeContactDetail(t, "ActivityDefinition", "contact", element.getContact().get(i), i);
if (element.hasDescriptionElement())
composeMarkdown(t, "ActivityDefinition", "description", element.getDescriptionElement(), -1);
for (int i = 0; i < element.getUseContext().size(); i++) composeUsageContext(t, "ActivityDefinition", "useContext", element.getUseContext().get(i), i);
for (int i = 0; i < element.getJurisdiction().size(); i++) composeCodeableConcept(t, "ActivityDefinition", "jurisdiction", element.getJurisdiction().get(i), i);
if (element.hasPurposeElement())
composeMarkdown(t, "ActivityDefinition", "purpose", element.getPurposeElement(), -1);
if (element.hasUsageElement())
composeString(t, "ActivityDefinition", "usage", element.getUsageElement(), -1);
if (element.hasCopyrightElement())
composeMarkdown(t, "ActivityDefinition", "copyright", element.getCopyrightElement(), -1);
if (element.hasApprovalDateElement())
composeDate(t, "ActivityDefinition", "approvalDate", element.getApprovalDateElement(), -1);
if (element.hasLastReviewDateElement())
composeDate(t, "ActivityDefinition", "lastReviewDate", element.getLastReviewDateElement(), -1);
if (element.hasEffectivePeriod())
composePeriod(t, "ActivityDefinition", "effectivePeriod", element.getEffectivePeriod(), -1);
for (int i = 0; i < element.getTopic().size(); i++) composeCodeableConcept(t, "ActivityDefinition", "topic", element.getTopic().get(i), i);
for (int i = 0; i < element.getAuthor().size(); i++) composeContactDetail(t, "ActivityDefinition", "author", element.getAuthor().get(i), i);
for (int i = 0; i < element.getEditor().size(); i++) composeContactDetail(t, "ActivityDefinition", "editor", element.getEditor().get(i), i);
for (int i = 0; i < element.getReviewer().size(); i++) composeContactDetail(t, "ActivityDefinition", "reviewer", element.getReviewer().get(i), i);
for (int i = 0; i < element.getEndorser().size(); i++) composeContactDetail(t, "ActivityDefinition", "endorser", element.getEndorser().get(i), i);
for (int i = 0; i < element.getRelatedArtifact().size(); i++) composeRelatedArtifact(t, "ActivityDefinition", "relatedArtifact", element.getRelatedArtifact().get(i), i);
for (int i = 0; i < element.getLibrary().size(); i++) composeCanonical(t, "ActivityDefinition", "library", element.getLibrary().get(i), i);
if (element.hasKindElement())
composeEnum(t, "ActivityDefinition", "kind", element.getKindElement(), -1);
if (element.hasProfileElement())
composeCanonical(t, "ActivityDefinition", "profile", element.getProfileElement(), -1);
if (element.hasCode())
composeCodeableConcept(t, "ActivityDefinition", "code", element.getCode(), -1);
if (element.hasIntentElement())
composeEnum(t, "ActivityDefinition", "intent", element.getIntentElement(), -1);
if (element.hasPriorityElement())
composeEnum(t, "ActivityDefinition", "priority", element.getPriorityElement(), -1);
if (element.hasDoNotPerformElement())
composeBoolean(t, "ActivityDefinition", "doNotPerform", element.getDoNotPerformElement(), -1);
if (element.hasTiming())
composeType(t, "ActivityDefinition", "timing", element.getTiming(), -1);
if (element.hasLocation())
composeReference(t, "ActivityDefinition", "location", element.getLocation(), -1);
for (int i = 0; i < element.getParticipant().size(); i++) composeActivityDefinitionActivityDefinitionParticipantComponent(t, "ActivityDefinition", "participant", element.getParticipant().get(i), i);
if (element.hasProduct())
composeType(t, "ActivityDefinition", "product", element.getProduct(), -1);
if (element.hasQuantity())
composeQuantity(t, "ActivityDefinition", "quantity", element.getQuantity(), -1);
for (int i = 0; i < element.getDosage().size(); i++) composeDosage(t, "ActivityDefinition", "dosage", element.getDosage().get(i), i);
for (int i = 0; i < element.getBodySite().size(); i++) composeCodeableConcept(t, "ActivityDefinition", "bodySite", element.getBodySite().get(i), i);
for (int i = 0; i < element.getSpecimenRequirement().size(); i++) composeReference(t, "ActivityDefinition", "specimenRequirement", element.getSpecimenRequirement().get(i), i);
for (int i = 0; i < element.getObservationRequirement().size(); i++) composeReference(t, "ActivityDefinition", "observationRequirement", element.getObservationRequirement().get(i), i);
for (int i = 0; i < element.getObservationResultRequirement().size(); i++) composeReference(t, "ActivityDefinition", "observationResultRequirement", element.getObservationResultRequirement().get(i), i);
if (element.hasTransformElement())
composeCanonical(t, "ActivityDefinition", "transform", element.getTransformElement(), -1);
for (int i = 0; i < element.getDynamicValue().size(); i++) composeActivityDefinitionActivityDefinitionDynamicValueComponent(t, "ActivityDefinition", "dynamicValue", element.getDynamicValue().get(i), i);
}
use of org.hl7.fhir.r4b.model.Dosage in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent.
protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(Complex parent, String parentType, String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "dosage", name, element, index);
if (element.hasType())
composeCodeableConcept(t, "MedicationKnowledge", "type", element.getType(), -1);
for (int i = 0; i < element.getDosage().size(); i++) composeDosage(t, "MedicationKnowledge", "dosage", element.getDosage().get(i), i);
}
use of org.hl7.fhir.r4b.model.Dosage in project org.hl7.fhir.core by hapifhir.
the class ProfileDrivenRenderer method displayLeaf.
private boolean displayLeaf(ResourceWrapper res, BaseWrapper ew, ElementDefinition defn, XhtmlNode x, String name, boolean showCodeDetails, boolean allowLinks) throws FHIRException, UnsupportedEncodingException, IOException {
if (ew == null)
return false;
Base e = ew.getBase();
if (e == null)
return false;
Map<String, String> displayHints = readDisplayHints(defn);
if (name.endsWith("[x]"))
name = name.substring(0, name.length() - 3);
if (!showCodeDetails && e instanceof PrimitiveType && isDefault(displayHints, ((PrimitiveType) e)))
return false;
if (e instanceof StringType) {
x.addText(name + ": " + ((StringType) e).getValue());
return true;
} else if (e instanceof CodeType) {
x.addText(name + ": " + ((CodeType) e).getValue());
return true;
} else if (e instanceof IdType) {
x.addText(name + ": " + ((IdType) e).getValue());
return true;
} else if (e instanceof UriType) {
if (Utilities.isAbsoluteUrlLinkable(((UriType) e).getValue()) && allowLinks) {
x.tx(name + ": ");
x.ah(((UriType) e).getValue()).addText(((UriType) e).getValue());
} else {
x.addText(name + ": " + ((UriType) e).getValue());
}
return true;
} else if (e instanceof DateTimeType) {
x.addText(name + ": " + ((DateTimeType) e).toHumanDisplay());
return true;
} else if (e instanceof InstantType) {
x.addText(name + ": " + ((InstantType) e).toHumanDisplay());
return true;
} else if (e instanceof Extension) {
// x.tx("Extensions: todo");
return false;
} else if (e instanceof org.hl7.fhir.r4b.model.DateType) {
x.addText(name + ": " + ((org.hl7.fhir.r4b.model.DateType) e).toHumanDisplay());
return true;
} else if (e instanceof Enumeration) {
// todo: look up a display name if there is one
x.addText(((Enumeration<?>) e).getValue().toString());
return true;
} else if (e instanceof BooleanType) {
if (((BooleanType) e).hasValue()) {
x.addText(name);
x.addText(": ");
x.addText(((BooleanType) e).getValueAsString());
return true;
}
} else if (e instanceof CodeableReference) {
if (((CodeableReference) e).hasReference()) {
Reference r = ((CodeableReference) e).getReference();
renderReference(res, x, r, allowLinks);
} else {
renderCodeableConcept(x, ((CodeableReference) e).getConcept(), showCodeDetails);
}
return true;
} else if (e instanceof CodeableConcept) {
renderCodeableConcept(x, (CodeableConcept) e, showCodeDetails);
return true;
} else if (e instanceof Coding) {
renderCoding(x, (Coding) e, showCodeDetails);
return true;
} else if (e instanceof Annotation) {
renderAnnotation(x, (Annotation) e, showCodeDetails);
return true;
} else if (e instanceof org.hl7.fhir.r4b.model.IntegerType) {
x.addText(Integer.toString(((org.hl7.fhir.r4b.model.IntegerType) e).getValue()));
return true;
} else if (e instanceof org.hl7.fhir.r4b.model.DecimalType) {
x.addText(((org.hl7.fhir.r4b.model.DecimalType) e).getValue().toString());
return true;
} else if (e instanceof Identifier) {
renderIdentifier(x, (Identifier) e);
return true;
} else if (e instanceof HumanName) {
renderHumanName(x, (HumanName) e);
return true;
} else if (e instanceof SampledData) {
renderSampledData(x, (SampledData) e);
return true;
} else if (e instanceof Address) {
renderAddress(x, (Address) e);
return true;
} else if (e instanceof ContactPoint) {
if (allowLinks) {
renderContactPoint(x, (ContactPoint) e);
} else {
displayContactPoint(x, (ContactPoint) e);
}
return true;
} else if (e instanceof Timing) {
renderTiming(x, (Timing) e);
return true;
} else if (e instanceof Quantity) {
renderQuantity(x, (Quantity) e, showCodeDetails);
return true;
} else if (e instanceof Ratio) {
renderQuantity(x, ((Ratio) e).getNumerator(), showCodeDetails);
x.tx("/");
renderQuantity(x, ((Ratio) e).getDenominator(), showCodeDetails);
return true;
} else if (e instanceof Period) {
Period p = (Period) e;
x.addText(name + ": ");
x.addText(!p.hasStart() ? "?ngen-2?" : p.getStartElement().toHumanDisplay());
x.tx(" --> ");
x.addText(!p.hasEnd() ? "(ongoing)" : p.getEndElement().toHumanDisplay());
return true;
} else if (e instanceof Reference) {
Reference r = (Reference) e;
if (r.hasDisplayElement())
x.addText(r.getDisplay());
else if (r.hasReferenceElement()) {
ResourceWithReference tr = resolveReference(res, r.getReference());
// getDisplayForReference(tr.getReference()));
x.addText(tr == null ? r.getReference() : "?ngen-3");
} else
x.tx("?ngen-4?");
return true;
} else if (e instanceof Narrative) {
return false;
} else if (e instanceof Resource) {
return false;
} else if (e instanceof ContactDetail) {
ContactDetail cd = (ContactDetail) e;
if (cd.hasName()) {
x.tx(cd.getName() + ": ");
}
boolean first = true;
for (ContactPoint c : cd.getTelecom()) {
if (first)
first = false;
else
x.tx(",");
if (allowLinks) {
renderContactPoint(x, c);
} else {
displayContactPoint(x, c);
}
}
return true;
} else if (e instanceof Range) {
return false;
} else if (e instanceof Meta) {
return false;
} else if (e instanceof Dosage) {
return false;
} else if (e instanceof Signature) {
return false;
} else if (e instanceof UsageContext) {
return false;
} else if (e instanceof RelatedArtifact) {
return false;
} else if (e instanceof ElementDefinition) {
return false;
} else if (e instanceof Base64BinaryType) {
return false;
} else if (!(e instanceof Attachment))
throw new NotImplementedException("type " + e.getClass().getName() + " not handled yet");
return false;
}
Aggregations