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
This commit is contained in:
DevSoftTech Server 2026-06-07 20:07:34 +05:30
parent 2b95bb8b7c
commit 5f052945d2

View File

@ -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 .= '<div>' . $this->renderStoredHtmlFragment($remark) . '</div>';
$html .= '<div class="discharge-field"><strong>Discharge Summary:</strong> ' . $this->renderStoredHtmlFragment($remark) . '</div>';
}
$reviewAfter = trim((string) ($first['review_after'] ?? ''));