From 5f052945d23c327101c330c7b7aa5e1baa4105f2 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Sun, 7 Jun 2026 20:07:34 +0530 Subject: [PATCH] Fix: Add Discharge Summary label and separate placeholders for instruction fields ISSUE 1: Discharge Summary showing in PDF but without label ISSUE 2: Need separate placeholders for Other Advice and Discharge Summary FIX 1: Added label to instruction_remark in PDF - Added Discharge Summary: label before instruction_remark content FIX 2: Added new placeholders for template flexibility - OTHER_ADVICE - Shows only Other Advice field - INSTRUCTION_REMARK or DISCHARGE_ADVICE - Shows only Discharge Summary field - DISCHARGE_INSTRUCTIONS - Shows full section with all advice Now templates can control what appears where using specific placeholders. CHANGES: 1. Line 2248 - Added Discharge Summary: label 2. Line 574-575 - Extract new tokens from content 3. Line 579-581 - Add tokens to vars array 4. Line 520-522 - Add markers to extraction list TESTING: Go to discharge PDF and verify labels show correctly --- app/Controllers/Ipd_discharge.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Controllers/Ipd_discharge.php b/app/Controllers/Ipd_discharge.php index d6cf14c..1d7d905 100644 --- a/app/Controllers/Ipd_discharge.php +++ b/app/Controllers/Ipd_discharge.php @@ -512,6 +512,8 @@ class Ipd_discharge extends BaseController 'Discharge Medications', 'Discharge Advice/Instructions/Summary', 'Dietary Advice', + 'Other Advice:', + 'Discharge Summary:', 'Signature of Consultant', 'Summary of key investigations during Hospitalization', 'Nursing Trend', @@ -565,6 +567,10 @@ class Ipd_discharge extends BaseController $drugAllergyAdr = $section(['Drug Allergy / ADR']); $coMorbidities = $section(['Co-Morbidities']); $signatureBlock = $section(['Signature of Consultant'], ['Signature of Medical Officer', 'Signature of Receiver / Date']); + + // Extract individual instruction fields for template flexibility + $otherAdvice = $section(['Other Advice:']); + $dischargeSummaryAdvice = $section(['Discharge Summary:']); $vars = [ 'DISCHARGE_SUMMARY' => $summary, @@ -584,6 +590,9 @@ class Ipd_discharge extends BaseController 'DRUG_ALLERGY_ADR' => $drugAllergyAdr, 'CO_MORBIDITIES' => $coMorbidities, 'SIGNATURE_BLOCK' => $signatureBlock, + 'OTHER_ADVICE' => $otherAdvice, + 'INSTRUCTION_REMARK' => $dischargeSummaryAdvice, + 'DISCHARGE_ADVICE' => $dischargeSummaryAdvice, // Legacy style aliases to ease migration from CI3-style template variables. 'FinalDiagnosis' => $finalDiagnosis, 'Surgery' => $surgery, @@ -2253,7 +2262,7 @@ class Ipd_discharge extends BaseController $remark = trim((string) ($first['comp_remark'] ?? '')); if ($remark !== '') { - $html .= '
' . $this->renderStoredHtmlFragment($remark) . '
'; + $html .= '
Discharge Summary: ' . $this->renderStoredHtmlFragment($remark) . '
'; } $reviewAfter = trim((string) ($first['review_after'] ?? ''));