Skip to content

Commit

Permalink
Jr 20241217 refine ips templates (#6597)
Browse files Browse the repository at this point in the history
* clean up procedures template

* immunization WIP

* complete conversion of immunization template

* medication template

* fix broken integration test

* template for history of illness

* problem list template
  • Loading branch information
JasonRoberts-smile authored Jan 8, 2025
1 parent a23d77b commit 544f832
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ public CustomThymeleafNarrativeGenerator(List<String> theNarrativePropertyFiles)
this(theNarrativePropertyFiles.toArray(new String[0]));
}

public CustomThymeleafNarrativeGenerator(CustomThymeleafNarrativeGenerator theNarrativeGenerator) {
setManifest(theNarrativeGenerator.getManifest());
}

@Override
public NarrativeTemplateManifest getManifest() {
NarrativeTemplateManifest retVal = myManifest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,7 @@ <h5>Allergies And Intolerances</h5>
<td th:insert="~{IpsUtilityFragments :: concatReactionManifestation (list=*{getReaction()})}">Reaction</td>
<td th:insert="~{IpsUtilityFragments :: concat (list=*{getReaction()},attr='severity')}">Severity</td>
<td th:insert="~{IpsUtilityFragments :: concat (list=*{getNote()},attr='text')}">Comments</td>

<th:block th:if="*{hasOnsetDateTimeType()}">
<td th:text="*{getOnsetDateTimeType().getValueAsString()}">Onset</td>
</th:block>
<th:block th:if="*{hasOnsetStringType()}">
<td th:text="*{getOnsetStringType().getValue()}">Onset</td>
</th:block>
<th:block th:if="*{!hasOnsetDateTimeType() && !hasOnsetStringType()}">
<td></td>
</th:block>
<td th:insert="~{IpsUtilityFragments :: renderTime (time=*{getOnset()})}">Date</td>

</tr>
</th:block>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ <h5>History Of Procedures</h5>
<tbody>
<th:block th:each="entry : ${resource.entry}" th:object="${entry.getResource()}">
<th:block th:unless='*{getResourceType().name() == "Composition"}'>
<th:block th:with="extension=${entry.getResource().getExtensionByUrl('http://hl7.org/fhir/StructureDefinition/narrativeLink').getValue().getValue()}">
<tr th:id="${#strings.arraySplit(extension, '#')[1]}">
<th:block th:with="extension=${entry.getResource().getExtensionByUrl('http://hl7.org/fhir/StructureDefinition/narrativeLink')}">
<tr th:id="${extension != null} ? ${#strings.arraySplit(extension.getValue().getValue(), '#')[1]} : ''">
<td th:insert="~{IpsUtilityFragments :: codeableConcept (cc=*{getCode()},attr='display')}">Procedure</td>
<td th:insert="~{IpsUtilityFragments :: concat (list=*{getNote()},attr='text')}">Comments</td>
<td th:insert="~{IpsUtilityFragments :: renderPerformed (performed=*{getPerformed()})}">Date</td>
<td th:insert="~{IpsUtilityFragments :: renderTime (time=*{getPerformed()})}">Date</td>
</tr>
</th:block>
</th:block>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ <h5>Immunizations</h5>
<tbody>
<th:block th:each="entry : ${resource.entry}" th:object="${entry.getResource()}">
<th:block th:if='*{getResourceType().name() == "Immunization"}'>
<th:block th:with="extension=${entry.getResource().getExtensionByUrl('http://hl7.org/fhir/StructureDefinition/narrativeLink').getValue().getValue()}">
<tr th:id="${#strings.arraySplit(extension, '#')[1]}">
<th:block th:with="extension=${entry.getResource().getExtensionByUrl('http://hl7.org/fhir/StructureDefinition/narrativeLink')}">
<tr th:id="${extension != null} ? ${#strings.arraySplit(extension.getValue().getValue(), '#')[1]} : ''">
<td th:insert="~{IpsUtilityFragments :: codeableConcept (cc=*{getVaccineCode()},attr='display')}">Immunization</td>
<td th:text="*{getStatusElement().value}">Status</td>
<td th:insert="~{IpsUtilityFragments :: concatDoseNumber (list=*{getProtocolApplied()})}">Comments</td>
<td th:insert="~{IpsUtilityFragments :: renderOrganization (orgRef=*{getManufacturer()})}">Manufacturer</td>
<td th:insert="~{IpsUtilityFragments :: renderVaccineManufacturer (immunization=${entry.getResource()})}">Manufacturer</td>
<td th:text="*{getLotNumber()}">Lot Number</td>
<td th:insert="~{IpsUtilityFragments :: concat (list=*{getNote()},attr='text')}">Comments</td>
<td th:insert="~{IpsUtilityFragments :: renderOccurrence (occurrence=*{getOccurrence()})}">Date</td>
<td th:insert="~{IpsUtilityFragments :: renderTime (time=*{getOccurrence()})}">Date</td>
</tr>
</th:block>
</th:block>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ <h5>Medication Summary: Medication Requests</h5>
<th:block th:if='*{getResourceType().name() == "MedicationRequest"}'>
<th:block th:unless='*{getResourceType().name() == "Composition"}'>
<th:block
th:with="extension=${entry.getResource().getExtensionByUrl('http://hl7.org/fhir/StructureDefinition/narrativeLink').getValue().getValue()}">
<tr th:id="${#strings.arraySplit(extension, '#')[1]}">
<td th:insert="~{IpsUtilityFragments :: renderMedication (medicationType=*{getMedication()})}">
th:with="extension=${entry.getResource().getExtensionByUrl('http://hl7.org/fhir/StructureDefinition/narrativeLink')}">
<tr th:id="${extension != null} ? ${#strings.arraySplit(extension.getValue().getValue(), '#')[1]} : ''">
<td th:insert="~{IpsUtilityFragments :: renderMedication (medicationType=${entry.getResource()})}">
Medication
</td>
<td th:text="*{getStatus().getDisplay()}">Status</td>
<td th:text="*{getStatus() != null} ? *{getStatus().getDisplay()} : ''">Status</td>
<td th:insert="~{IpsUtilityFragments :: concatDosageRoute (list=*{getDosageInstruction()})}">
Route
</td>
<td th:insert="~{IpsUtilityFragments :: concat (list=*{getDosageInstruction()},attr='text')}">
Sig
</td>
<td th:insert="~{IpsUtilityFragments :: concat (list=*{getNote()},attr='text')}">Comments</td>
<td th:text="*{getAuthoredOnElement().getValue()}">Authored Date</td>
<td th:insert="~{IpsUtilityFragments :: renderTime (time=*{getAuthoredOnElement()})}">Authored Date</td>
</tr>
</th:block>
</th:block>
Expand All @@ -74,15 +74,15 @@ <h5>Medication Summary: Medication Statements</h5>
<th:block th:each="entry : ${resource.entry}" th:object="${entry.getResource()}">
<th:block th:if='*{getResourceType().name() == "MedicationStatement"}'>
<th:block
th:with="extension=${entry.getResource().getExtensionByUrl('http://hl7.org/fhir/StructureDefinition/narrativeLink').getValue().getValue()}">
<tr th:id="${#strings.arraySplit(extension, '#')[1]}">
<td th:insert="~{IpsUtilityFragments :: renderMedication (medicationType=*{getMedication()})}">
th:with="extension=${entry.getResource().getExtensionByUrl('http://hl7.org/fhir/StructureDefinition/narrativeLink')}">
<tr th:id="${extension != null} ? ${#strings.arraySplit(extension.getValue().getValue(), '#')[1]} : ''">
<td th:insert="~{IpsUtilityFragments :: renderMedication (medicationType=${entry.getResource()})}">
Medication
</td>
<td th:text="*{getStatus().getDisplay()}">Status</td>
<td th:text="*{getStatus() != null} ? *{getStatus().getDisplay()} : ''">Status</td>
<td th:insert="~{IpsUtilityFragments :: concatDosageRoute (list=*{getDosage()})}">Route</td>
<td th:insert="~{IpsUtilityFragments :: concat (list=*{getDosage()},attr='text')}">Sig</td>
<td th:insert="~{IpsUtilityFragments :: renderEffective (effective=*{getEffective()})}">Date</td>
<td th:insert="~{IpsUtilityFragments :: renderTime (time=*{getEffective()})}">Date</td>
</tr>
</th:block>
</th:block>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ <h5>Past History of Illnesses</h5>
<tbody>
<th:block th:each="entry : ${resource.entry}" th:object="${entry.getResource()}">
<th:block th:unless='*{getResourceType().name() == "Composition"}'>
<th:block th:with="extension=${entry.getResource().getExtensionByUrl('http://hl7.org/fhir/StructureDefinition/narrativeLink').getValue().getValue()}">
<tr th:id="${#strings.arraySplit(extension, '#')[1]}">
<th:block th:with="extension=${entry.getResource().getExtensionByUrl('http://hl7.org/fhir/StructureDefinition/narrativeLink')}">
<tr th:id="${extension != null} ? ${#strings.arraySplit(extension.getValue().getValue(), '#')[1]} : ''">
<td th:insert="~{IpsUtilityFragments :: codeableConcept (cc=*{getCode()},attr='display')}">Medical Problem</td>
<td th:insert="~{IpsUtilityFragments :: codeableConcept (cc=*{getClinicalStatus()},attr='code')}">Status</td>
<td th:insert="~{IpsUtilityFragments :: concat (list=*{getNote()},attr='text')}">Comments</td>
<td th:insert="~{IpsUtilityFragments :: renderOnset (onset=*{getOnset()})}">Onset Date</td>
<td th:insert="~{IpsUtilityFragments :: renderTime (time=*{getOnset()})}">Onset Date</td>
</tr>
</th:block>
</th:block>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ <h5>Problem List</h5>
<tbody>
<th:block th:each="entry : ${resource.entry}" th:object="${entry.getResource()}">
<th:block th:unless='*{getResourceType().name() == "Composition"}'>
<th:block th:with="extension=${entry.getResource().getExtensionByUrl('http://hl7.org/fhir/StructureDefinition/narrativeLink').getValue().getValue()}">
<tr th:id="${#strings.arraySplit(extension, '#')[1]}">
<th:block th:with="extension=${entry.getResource().getExtensionByUrl('http://hl7.org/fhir/StructureDefinition/narrativeLink')}">
<tr th:id="${extension != null} ? ${#strings.arraySplit(extension.getValue().getValue(), '#')[1]} : ''">
<td th:insert="~{IpsUtilityFragments :: codeableConcept (cc=*{getCode()},attr='display')}">Medical Problems</td>
<td th:insert="~{IpsUtilityFragments :: codeableConcept (cc=*{getClinicalStatus()},attr='code')}">Status</td>
<td th:insert="~{IpsUtilityFragments :: concat (list=*{getNote()},attr='text')}">Comments</td>
<td th:insert="~{IpsUtilityFragments :: renderOnset (onset=*{getOnset()})}">Onset Date</td>
<td th:insert="~{IpsUtilityFragments :: renderTime (time=*{getOnset()})}">Onset Date</td>
</tr>
</th:block>
</th:block>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,33 @@
</th:block>
</th:block>

<th:block th:if="${immunization}" th:fragment="renderVaccineManufacturer (immunization)">
<th:block th:with="organization = ${#fhirpath.evaluateFirst(immunization, 'manufacturer.resolve()')}">
<th:block th:if="${organization != null}">
<th:block th:if='${organization.getResourceType().name() == "Organization"}'>
<th:block th:text="${organization.getName()}">Org Name</th:block>
</th:block>
</th:block>
</th:block>
</th:block>

<th:block th:fragment="renderMedication (medicationType)">
<th:block th:if="${medicationType} != null" th:object="${medicationType}">
<th:block th:switch="*{getClass().getSimpleName()}">
<th:block th:case="'CodeableConcept'">
<th:block th:replace=":: codeableConcept (cc=${medicationType}, attr='display')">Medication</th:block>
</th:block>
<th:block th:case="'Reference'">
<th:block th:replace=":: renderMedicationRef (medicationRef=${medicationType})">Medication</th:block>
</th:block>
</th:block>
<th:block th:if="*{getMedication() != null}">
<th:block th:switch="*{getMedication().getClass().getSimpleName()}">
<th:block th:case="'CodeableConcept'">
<th:block th:replace=":: codeableConcept (cc=${medicationType.getMedication()}, attr='display')">Medication</th:block>
</th:block>
<th:block th:case="'Reference'">
<th:block th:replace=":: renderMedicationRef (medicationRef=${medicationType})">Medication</th:block>
</th:block>
</th:block>
</th:block>
</th:block>
</th:block>

<th:block th:if="${medicationRef}" th:fragment="renderMedicationRef (medicationRef)">
<th:block th:with="medication = ${#fhirpath.evaluateFirst(medicationRef, 'resolve()')}">
<th:block th:with="medication = ${#fhirpath.evaluateFirst(medicationRef, 'medication.resolve()')}">
<th:block th:if="${medication != null}">
<th:block th:replace=":: renderMedicationCode (medication=${medication})">Medication</th:block>
</th:block>
Expand Down Expand Up @@ -94,49 +106,23 @@
</th:block>
</th:block>

<th:block th:if="${onset}" th:fragment="renderOnset (onset)">
<th:block th:if="${onset} != null" th:object="${onset}">
<th:block th:if="${time}" th:fragment="renderTime (time)">
<th:block th:if="${time} != null" th:object="${time}">
<th:block th:switch="*{getClass().getSimpleName()}">
<th:block th:case="'DateTimeType'" th:text="*{getValue()}">Date</th:block>
<th:block th:case="'DateTimeType'" th:text="*{getValueAsString()}">Date</th:block>
<th:block th:case="'Period'"
th:text="*{#strings.concatReplaceNulls('', getStartElement().getValue(), '-', getEndElement().getValue() )}">
th:text="*{#strings.concatReplaceNulls('', getStartElement().getValueAsString(), ' - ', getEndElement().getValueAsString() )}">
Date
</th:block>
<th:block th:case="'Age'" th:text="*{getValue()}">Date</th:block>
<th:block th:case="'Range'"
th:text="*{#strings.concatReplaceNulls('', getLow().getValue(), '-', getHigh().getValue() )}">Date
th:text="*{#strings.concatReplaceNulls('', getLow().getValueAsString(), ' - ', getHigh().getValueAsString() )}">Date
</th:block>
<th:block th:case="'StringType'" th:text="*{getValue()}">Date</th:block>
</th:block>
</th:block>
</th:block>

<th:block th:if="${performed}" th:fragment="renderPerformed (performed)">
<th:block th:if="${performed} != null" th:object="${performed}">
<th:block th:switch="*{getClass().getSimpleName()}">
<th:block th:case="'DateTimeType'" th:text="*{getValue()}">Date</th:block>
<th:block th:case="'Period'"
th:text="*{#strings.concatReplaceNulls('', getStartElement().getValue(), '-', getEndElement().getValue() )}">
Date
</th:block>
<th:block th:case="'Age'" th:text="*{getValue()}">Date</th:block>
<th:block th:case="'Range'"
th:text="*{#strings.concatReplaceNulls('', getLow().getValue(), '-', getHigh().getValue() )}">Date
</th:block>
<th:block th:case="'StringType'" th:text="*{getValue()}">Date</th:block>
</th:block>
</th:block>
</th:block>

<th:block th:if="${occurrence}" th:fragment="renderOccurrence (occurrence)">
<th:block th:if="${occurrence} != null" th:object="${occurrence}">
<th:block th:switch="*{getClass().getSimpleName()}">
<th:block th:case="'DateTimeType'" th:text="*{getValue()}">Date</th:block>
<th:block th:case="'StringType'" th:text="*{getValue()}">Date</th:block>
</th:block>
</th:block>
</th:block>

<th:block th:if="${recorded}" th:fragment="renderRecorded (recorded)">
<th:block th:if="${recorded} != null" th:object="${recorded}">
<th:block th:switch="*{getClass().getSimpleName()}">
Expand Down

0 comments on commit 544f832

Please sign in to comment.