Pain Measurement Scale: ' . esc($opdPainLabel)
+ $painSection = '
Pain Measurement Scale: ' . esc($opdPainLabel)
. ($opdPainValue !== '' ? ' (' . esc($opdPainValue) . ')' : '')
. '
';
}
@@ -1316,6 +1434,7 @@ class Ipd_discharge extends BaseController
$sections[] = '
Personal History ' . esc(implode(', ', $personalHistory)) . '
';
}
+ $allergySection = '';
$allergyLines = [];
if ((string) ($opdHistory['drug_allergy_status'] ?? '') !== '') {
$allergyLines[] = '
Drug Allergy Status: ' . esc((string) ($opdHistory['drug_allergy_status'] ?? '')) . '
';
@@ -1330,7 +1449,7 @@ class Ipd_discharge extends BaseController
$allergyLines[] = '
Current Medications: ' . esc((string) ($opdHistory['current_medications'] ?? '')) . '
';
}
if (! empty($allergyLines)) {
- $sections[] = '
Drug Allergy / ADR ' . implode('', $allergyLines);
+ $allergySection = '
Drug Allergy / ADR ' . implode('', $allergyLines);
}
$coMorbText = trim((string) ($opdHistory['co_morbidities'] ?? ''));
@@ -1473,6 +1592,14 @@ class Ipd_discharge extends BaseController
$sections[] = $courseBlock;
}
+ if ($painSection !== '') {
+ $sections[] = $painSection;
+ }
+
+ if ($allergySection !== '') {
+ $sections[] = $allergySection;
+ }
+
$nursingTrendSection = $this->buildNursingTrendSection($ipdId);
if ($nursingTrendSection !== '') {
$sections[] = $nursingTrendSection;
@@ -1614,12 +1741,12 @@ class Ipd_discharge extends BaseController
$otherText = trim((string) ($instructionMeta['other_text'] ?? ''));
if ($otherText !== '') {
- $html .= '
Other Advice: ' . nl2br(esc($otherText)) . '
';
+ $html .= '
Other Advice: ' . $this->renderStoredHtmlFragment($otherText) . '
';
}
$remark = trim((string) ($first['comp_remark'] ?? ''));
if ($remark !== '') {
- $html .= '
' . nl2br(esc($remark)) . '
';
+ $html .= '
' . $this->renderStoredHtmlFragment($remark) . '
';
}
$reviewAfter = trim((string) ($first['review_after'] ?? ''));
@@ -1637,7 +1764,7 @@ class Ipd_discharge extends BaseController
$footerText = trim((string) ($first['footer_text'] ?? ''));
if ($footerText !== '') {
- $html .= '
' . nl2br(esc($footerText)) . '
';
+ $html .= '
' . $this->renderStoredHtmlFragment($footerText) . '
';
}
$sections[] = $html;
diff --git a/app/Views/Setting/Template/discharge_templates.php b/app/Views/Setting/Template/discharge_templates.php
index c9a5e3a..8f1ebf3 100644
--- a/app/Views/Setting/Template/discharge_templates.php
+++ b/app/Views/Setting/Template/discharge_templates.php
@@ -36,13 +36,15 @@ $status = (int) ($edit['status'] ?? 1);
Available placeholders: {{CONTENT}}, {{PATIENT_NAME}}, {{UHID}}, {{IPD_CODE}},
- {{AGE_GENDER}}, {{ADMIT_DATE}}, {{DISCHARGE_DATE}}, {{CURRENT_DATE}},
+ {{AGE_GENDER}}, {{GUARDIAN}}, {{GUARDIAN_RELATION}}, {{GUARDIAN_NAME}}, {{PATIENT_ADDRESS}},
+ {{ADMIT_DATE}}, {{DISCHARGE_DATE}}, {{ADMIT_DATE_ONLY}}, {{DISCHARGE_DATE_ONLY}}, {{CURRENT_DATE}},
{{H_Name}}, {{H_address_1}}, {{H_address_2}}, {{H_phone_No}}, {{H_Email}},
{{hospital_name}}, {{hospital_address}}, {{hospital_phone}}, {{hospital_email}},
{{PRINT_TIME}}.
Section placeholders for custom layout/order: {{DISCHARGE_SUMMARY}}, {{FINAL_DIAGNOSIS}}, {{SURGERY}},
- {{PROCEDURE}}, {{PERSONAL_HISTORY}}, {{PRESENTING_COMPLAINTS}}, {{GENERAL_EXAM_ADMISSION}},
- {{CLINICAL_INVESTIGATION_REPORTS}}, {{COURSE_IN_HOSPITAL}}, {{EXAMINATION_ON_DISCHARGE}},
+ {{PROCEDURE}}, {{PERSONAL_HISTORY}}, {{PRESENTING_COMPLAINTS}}, {{PAIN_MEASUREMENT_SCALE}},
+ {{GENERAL_EXAM_ADMISSION}}, {{CLINICAL_INVESTIGATION_REPORTS}}, {{COURSE_IN_HOSPITAL}},
+ {{EXAMINATION_ON_DISCHARGE}}, {{DRUG_ALLERGY_ADR}}, {{CO_MORBIDITIES}},
{{DISCHARGE_MEDICATIONS}}, {{DIETARY_ADVICE}}, {{DISCHARGE_INSTRUCTIONS}}, {{SIGNATURE_BLOCK}}.
@@ -159,7 +161,7 @@ $status = (int) ($edit['status'] ?? 1);
Template HTML
- Use the editor to format layout. Use the Source button for raw HTML. You can use one {{CONTENT}} block or arrange section placeholders in any custom order.
+ Use the editor to format layout. Use the Source button for raw HTML. You can use one {{CONTENT}} block or arrange the section placeholders in any custom order.