Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CH EMED EPR: PDF generation updates #204

Open
wants to merge 3 commits into
base: develop-3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,41 @@ <h2>Dernière modification</h2>

<div id="active-treatments">
<h2 id="active-treatments-header">Traitements actifs</h2>
<th:block th:insert="~{medication_card_fragments :: table(${activeTreatments}, ${lang})}"/>
</div>
<div id="reserve-treatments">
<h2 id="reserve-treatments-header">Traitements en réserve</h2>
<th:block th:insert="~{medication_card_fragments :: table(${asneededTreatments}, ${lang})}"/>
<table class="treatments">
<thead>
<tr>
<td rowspan="2" colspan="2">Nom du médicament</td>
<td colspan="4">Dosage</td>
<td rowspan="2">Commentaire</td>
<td rowspan="2">Voie et localisation</td>
</tr>
<tr>
<td>Matin</td>
<td>Midi</td>
<td>Soir</td>
<td>Nuit</td>
</tr>
</thead>
<th:block th:each="statements: ${activeTreatments}">
<th:block th:insert="~{medication_card_fragments::treatmentPlan(${statements.value}, ${lang})}"/>
</th:block>
<th:block th:if="${!asneededTreatments.isEmpty()}">
<tbody>
<tr>
<td colspan="8" class="as-needed-treatments-header">Traitements en réserve:</td>
</tr>
</tbody>
<th:block th:each="statements: ${asneededTreatments}">
<th:block th:insert="~{medication_card_fragments::treatmentPlan(${statements.value}, ${lang})}"/>
</th:block>
</th:block>
<th:block th:if="${activeTreatments.isEmpty() && asneededTreatments.isEmpty()}">
<tbody>
<tr>
<td colspan="8" class="no-treatment">Aucun traitement</td>
</tr>
</tbody>
</th:block>
</table>
</div>
</th:block>
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,6 @@
~ on the basis of the eHealth Connector opensource project from June 28, 2021,
~ whereas medshare GmbH is the initial and main contributor/author of the eHealth Connector.
*/-->
<table th:fragment="table(treatments, lang)">
<thead>
<tr>
<td rowspan="2" colspan="2">Nom du médicament</td>
<td colspan="4">Dosage</td>
<td rowspan="2">Commentaire</td>
<td rowspan="2">Voie et localisation</td>
</tr>
<tr>
<td>Matin</td>
<td>Midi</td>
<td>Soir</td>
<td>Nuit</td>
</tr>
</thead>
<th:block th:each="statements: ${treatments}">
<th:block th:insert="~{::treatmentPlan(${statements.value}, ${lang})}"/>
</th:block>
<th:block th:if="${treatments.isEmpty()}">
<tbody>
<tr>
<td colspan="8" class="no-treatment">Aucun traitement</td>
</tr>
</tbody>
</th:block>
</table>

<th:block th:fragment="treatmentPlan(statements, lang)">
<tbody class="treatment-plan-body">
<th:block th:each="statement, iStat: ${statements}">
Expand All @@ -45,11 +18,37 @@
<th:block th:fragment="table-line(medStmt, dosage, index, size, lang)">
<tr class="statement-row" th:classappend="${(index == 0)? ' treatment-first-row' : ''}">
<th:block th:if="${index} == 0">
<td class="treatment-plan-common-cell" th:rowspan="${size} * 2"/>
<td class="treatment-plan-common-cell" th:rowspan="${size}"/>
</th:block>
<!-- Nom du médicament -->
<td>
[[${medStmt.resolveMedication().resolveMedicationName()}]]
<td class="medication" th:with="medication=${medStmt.resolveMedication()}">
<div class="medication-name">[[${medication.resolveMedicationName()}]]</div>
<div class="medication-description">
<th:block th:with="activeIngredients=${medication.resolveActiveIngredients()}">
<ul class="medication-active-ingredients" th:unless="${activeIngredients.isEmpty}">
<li th:each="activeIngredient : ${activeIngredients}">
[[${activeIngredient.resolveActiveIngredient().getDisplayName(lang.getLanguageCode())}]]
</li>
</ul>
</th:block>

<div class="treatment-line-period" th:if="${dosage.period().hasStart() and dosage.period().hasEnd()}">
À prendre du
<th:block th:insert="~{datatypes :: date-time(${dosage.period().getStartElement()}, ${lang})}"/>
au
<th:block th:insert="~{datatypes :: date-time(${dosage.period().getEndElement()}, ${lang})}"/>
</div>
<div class="treatment-line-period" th:if="${dosage.period().hasStart() and not dosage.period().hasEnd()}">
À prendre dès le
<th:block th:insert="~{datatypes :: date-time(${dosage.period().getStartElement()}, ${lang})}"/>
</div>
<div class="treatment-line-period" th:if="${not dosage.period().hasStart() and dosage.period().hasEnd()}">
À prendre jusqu'au
<th:block th:insert="~{datatypes :: date-time(${dosage.period().getEndElement()}, ${lang})}"/>
</div>

<div class="treatment-line-max-dose" th:if="${dosage.hasMaxDose()}" th:insert="~{datatypes::max-doses(${dosage}, ${lang})}"/>
</div>
</td>

<!-- Dosage -->
Expand All @@ -66,10 +65,14 @@
<td th:insert="~{datatypes :: intake-timing(${dosage.hasNightSimpleEventTiming}, ${lang})}"/>
</th:block>
<th:block th:if="${dosage.hasSimpleDose}">
<td colspan="4" th:insert="~{datatypes :: simple-dose(${dosage.simpleDose}, ${lang})}"/>
<td colspan="4" class="daily-intake">
*** <th:block th:insert="~{datatypes :: simple-dose(${dosage.simpleDose}, ${lang})}"/> par jour ***
</td>
</th:block>
<th:block th:unless="${dosage.hasIntakes or dosage.hasSimpleEventTimings or dosage.hasSimpleDose}">
<td colspan="4" th:text="${dosage.patientInstructions}"/>
<td colspan="4" class="daily-instructions">
*** <th:block th:text="${dosage.patientInstructions}"/> ***
</td>
</th:block>

<!-- Commentaire (raison et instructions au patient -->
Expand All @@ -89,24 +92,4 @@
th:text="${fopase.getMessage(dosage.routeOfAdministration(), lang)}"/>
</td>
</tr>
<tr>
<td colspan="8" class="description">
<th:block th:if="${dosage.period().hasStart() and dosage.period().hasEnd()}">
À prendre du
<th:block th:insert="~{datatypes :: date-time(${dosage.period().getStartElement()}, ${lang})}"/>
au
<th:block th:insert="~{datatypes :: date-time(${dosage.period().getEndElement()}, ${lang})}"/>
</th:block>
<th:block th:if="${dosage.period().hasStart() and not dosage.period().hasEnd()}">
À prendre dès le
<th:block th:insert="~{datatypes :: date-time(${dosage.period().getStartElement()}, ${lang})}"/>
</th:block>
<th:block th:if="${not dosage.period().hasStart() and dosage.period().hasEnd()}">
À prendre jusqu'au
<th:block th:insert="~{datatypes :: date-time(${dosage.period().getEndElement()}, ${lang})}"/>
</th:block>

<th:block th:if="${dosage.hasMaxDose()}" th:insert="~{datatypes::max-doses(${dosage}, ${lang})}"/>
</td>
</tr>
</th:block>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import ca.uhn.fhir.model.api.annotation.ResourceDef;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.hl7.fhir.r4.model.CodeableConcept;
import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.Medication;
import org.hl7.fhir.r4.model.UriType;
Expand Down Expand Up @@ -211,8 +210,10 @@ public PharmaceuticalDoseFormEdqm resolveForm() throws InvalidEmedContentExcepti
public List<ChEmedEprMedicationIngredient> resolveActiveIngredients() {
return this.getIngredient().stream()
.filter(MedicationIngredientComponent::getIsActive)
.filter(ChEmedEprMedicationIngredient.class::isInstance)
.map(ChEmedEprMedicationIngredient.class::cast)
.map(ingredient -> {
if (ingredient instanceof ChEmedEprMedicationIngredient chEmedEprIngredient) return chEmedEprIngredient;
else return new ChEmedEprMedicationIngredient(ingredient);
})
.toList();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ public ChEmedEprMedicationIngredient() {
super();
}

/**
* Constructor from {@link Medication.MedicationIngredientComponent} object.
* @param ingredientComponent the ingredient
*/
public ChEmedEprMedicationIngredient(final Medication.MedicationIngredientComponent ingredientComponent) {
ingredientComponent.copyValues(this);
}

/**
* Resolves the dose per unit.
*
Expand Down
Loading