Class HtmlNarrativeGenerator
java.lang.Object
org.projecthusky.fhir.emed.ch.epr.narrative.html.HtmlNarrativeGenerator
A generator of narrative as HTML content.
The template engine is Thymeleaf. Templates are stored in '/resources/narrative/templates'.
- Author:
- Quentin Ligier
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final EnumMap<NarrativeLanguage, PropertyResourceBundle> The resource bundle that contains the translations.protected final ca.uhn.fhir.context.FhirContextThe FHIR context.protected MedicationImageProviderA provider of images for medications.protected final NarrativeFormatprotected final org.thymeleaf.TemplateEngineThe Thymeleaf template engine.protected final ValueSetEnumNarrativeForPatientServiceA provider of better display name for enums, targeted at patients. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongenerate(ChEmedEprDocumentPmlc document, NarrativeLanguage lang) Generates the narrative for a medication card and return it as HTML content.final Stringgenerate(ChEmedEprDocumentPre document, NarrativeLanguage lang, AbstractMap.SimpleImmutableEntry<@NonNull String, Object>... extraContext) Generates the narrative for a prescription and return it as HTML content.protected StringGets the prescription narrative template to be used by this HTML narrative generator depending on the selectedNarrativeFormat.protected StringGets the prescription narrative template to be used by this HTML narrative generator depending on the selectedNarrativeFormat.voidsetMedicationImageProvider(@Nullable MedicationImageProvider medicationImageProvider) Sets the medication images provider.
-
Field Details
-
fhirContext
protected final ca.uhn.fhir.context.FhirContext fhirContextThe FHIR context. -
templateEngine
protected final org.thymeleaf.TemplateEngine templateEngineThe Thymeleaf template engine. -
narrativeFormat
-
bundles
The resource bundle that contains the translations. -
valueSetEnumNarrativeForPatientService
A provider of better display name for enums, targeted at patients. -
medicationImageProvider
A provider of images for medications.
-
-
Constructor Details
-
HtmlNarrativeGenerator
- Throws:
IOException
-
-
Method Details
-
generate
Generates the narrative for a medication card and return it as HTML content.- Parameters:
document- The medication card document.lang- The language of the narrative.- Returns:
- The HTML content of the narrative.
-
generate
@SafeVarargs public final String generate(ChEmedEprDocumentPre document, NarrativeLanguage lang, AbstractMap.SimpleImmutableEntry<@NonNull String, Object>... extraContext) Generates the narrative for a prescription and return it as HTML content.- Parameters:
document- The prescription document.lang- The language of the narrative.extraContext- extra context to be passed to the generator as pairs of keys (string) and objects.- Returns:
- The HTML content of the narrative.
-
getMedicationCardNarrativeTemplate
Gets the prescription narrative template to be used by this HTML narrative generator depending on the selectedNarrativeFormat. -
getPrescriptionNarrativeTemplate
Gets the prescription narrative template to be used by this HTML narrative generator depending on the selectedNarrativeFormat. -
setMedicationImageProvider
Sets the medication images provider.- Parameters:
medicationImageProvider- The medication images provider to use, ornull.
-