# Discharge Summary Placeholder HTML Reference
This document shows the exact HTML structure used for each discharge summary placeholder.
---
## {{DISCHARGE_SUMMARY}}
**Source:** `getDischargeStatusText()` - Status from `ipd_discharge_status` table
**Join:** `ipd_master.ipd_status = ipd_discharge_status.id`
**HTML Structure:**
```html
Discharge Summary
Leave Against Medical Advice
```
**Note:** This placeholder contains **ONLY** the status header text. No additional information like department, doctor, or dates.
**Status-based headers:**
- ipd_status = 0 → "Discharge Summary"
- ipd_status = 1 → "Discharge Summary" (from DB)
- ipd_status = 2 → "Leave Against Medical Advice"
- ipd_status = 3 → "Refer To Higher Centre"
- ipd_status = 5 → "Dead Summary"
- ipd_status = 7 → "Discharge on Request"
**For additional info, use separate tokens:**
- `{{DEPARTMENT}}` - Department name
- `{{DOCTOR_NAMES}}` - Treating doctor(s)
- `{{ADMIT_DATE_ONLY}}` - Admission date
- `{{DISCHARGE_DATE_ONLY}}` - Discharge date
- `{{ADMISSION_TIME}}` - Admission time
- `{{DISCHARGE_TIME}}` - Discharge time
---
## {{PRESENTING_COMPLAINTS}}
**Source:** `ipd_discharge_complaint` + `ipd_discharge_complaint_remark`
**HTML Structure:**
```html
Presenting Complaints and Reason for Admission
- Complaint 1 (Remark)
- Complaint 2 (Remark)
Additional remark text from comp_remark field (rich text)
```
---
## {{PAIN_MEASUREMENT_SCALE}}
**Source:** Pain measurement data from complaint metadata
**HTML Structure:**
```html
Pain Measurement Scale: Moderate (5)
```
**If no data:** Empty string (not shown)
---
## {{GENERAL_EXAM_ADMISSION}}
**Source:** Physical examination data
**HTML Structure:**
```html
General Examination on Admission :
BP: 120/80 mmHg, Pulse: 78 bpm, Temp: 98.6°F, Weight: 65 kg
```
---
## {{PERSONAL_HISTORY}}
**Source:** `patient_master` table personal history flags
**HTML Structure:**
```html
Personal History
Smoking, Hypertension, Type 2 diabetes mellitus (DM)
```
**Fields checked:**
- is_smoking → "Smoking"
- is_alcohol → "Alcohol"
- is_drug_abuse → "Drug abuse"
- is_tobacoo → "Tobacco"
- is_hypertesion → "Hypertension"
- is_niddm → "Type 2 diabetes mellitus (DM)"
- is_hbsag → "HBsAg"
- is_hcv → "HCV"
- is_hiv_I_II → "HIV I & II"
---
## {{DRUG_ALLERGY_ADR}}
**Source:** OPD history data
**HTML Structure:**
```html
Drug Allergy / ADR
Drug Allergy Status: Known allergies
Drug Allergy Details: Penicillin, Aspirin
ADR History: Rash after penicillin
Current Medications: Metformin 500mg BD
```
**If no data:** Empty string (not shown)
---
## {{CO_MORBIDITIES}}
**Source:** OPD history `co_morbidities` field
**HTML Structure:**
```html
Co-Morbidities
Diabetes Mellitus, Hypertension, Chronic Kidney Disease
```
---
## {{CLINICAL_INVESTIGATION_REPORTS}}
**Source:** Lab pathology + non-pathology reports
**HTML Structure:**
### With Pathology Matrix:
```html
Clinical Investigation Reports
In-Hospital Lab:
| Test |
Fixed Normals |
23-05-2026 |
25-05-2026 |
| Hemoglobin |
12-16 g/dL |
11.5 |
13.2 |
```
### Non-Pathology Reports:
```html
X-Ray / ECG / Sonography / CT / MRI:
- [24-05-2026] X-Ray - Chest PA View
Impression: Normal study
```
### Other Examinations:
```html
Other Examinations / Provisional Diagnosis:
Additional examination notes
```
---
## {{FINAL_DIAGNOSIS}}
**Source:** `ipd_discharge_diagnosis` + `ipd_discharge_diagnosis_remark`
**HTML Structure:**
```html
Final Diagnosis
- Diagnosis 1 (Remark)
- Diagnosis 2
Additional diagnosis remarks (rich text)
```
---
## {{COURSE_IN_HOSPITAL}}
**Source:** `ipd_discharge_course` + `ipd_discharge_course_remark`
**HTML Structure:**
```html
Course in the hospital
- Patient admitted with complaints of...
- Treatment started with...
Additional course remarks (rich text)
```
---
## {{EXAMINATION_ON_DISCHARGE}}
**Source:** Discharge examination data
**HTML Structure:**
```html
Examination on Discharge :
BP: 130/85 mmHg, Pulse: 72 bpm, General condition: Stable
```
---
## {{SURGERY}}
**Source:** `ipd_discharge_surgery` table
**HTML Structure:**
```html
Surgery
| Name |
Date |
Remark |
| Laparoscopy |
05-06-2026 |
I & D WITH L. N. EXCISION DONE UNDER GA |
```
**Alternative format (if no table structure):**
```html
Surgery
- Laparoscopy / Date of Surgery : 2026-06-05
```
---
## {{PROCEDURE}}
**Source:** `ipd_discharge_procedure` table
**HTML Structure:**
```html
Procedure
| Name |
Date |
Remark |
| Procedure TEST |
03-06-2026 |
|
```
---
## {{DISCHARGE_MEDICATIONS}}
**Source:** `ipd_discharge_prescrption_prescribed` or `ipd_discharge_drug`
### Format 1 (New prescriptions with full details):
```html
Discharge Medications
| # |
Medicine |
Qty |
Days |
Notes |
| 1 |
Tab Paracetamol 500mg |
30 |
5 days |
1-0-1 After Food |
```
### Format 2 (Simple drug list):
```html
Discharge Medications
- Paracetamol 500mg [5 days]
- Amoxicillin 250mg [7 days]
```
---
## {{DIETARY_ADVICE}}
**Source:** Dietary master data selected for patient
**HTML Structure:**
```html
Dietary Advice:
- High Protein Diet: Include eggs, chicken, fish, pulses
- Avoid Spicy Food: No chilli, pepper, masala
- Low Salt: Reduce salt intake to less than 5g per day
```
**If no data:** Empty string (not shown)
---
## {{DISCHARGE_INSTRUCTIONS}}
**Source:** `ipd_discharge_instructions` table
**HTML Structure:**
```html
Discharge Advice/Instructions/Summary
Dietary Advice:
- Low Fat: Avoid fried foods
Other Advice: Take adequate rest
Additional discharge instructions and advice text (can contain HTML formatting)
Review after 7 Days (14-06-2026) days / as and when required
Emergency contact information
```
---
## {{SIGNATURE_BLOCK}}
**Source:** Auto-generated signature table
**HTML Structure:**
```html
| | | |
| _________________________ |
_________________________ |
_________________________ |
| Signature of Consultant |
Signature of Medical Officer |
Signature of Receiver / Date |
```
---
## Additional Placeholders (Not in Section Content)
### {{PATIENT_INFO_TABLE}}
**Source:** `buildAutoDischargeSummaryTable()`
**HTML Structure:**
```html
Discharge Summary
Leave Against Medical Advice
| Name |
SUNITA DEVI |
UHID |
P26061331171 |
| Age & Gender |
40 Year / Female |
IPD No. |
A26061007144 |
| Guardian |
Wife of JOGENDRA KUMAR |
Admission |
04-06-2026 |
| Phone No. |
9520497324 |
Discharge |
07-06-2026 |
| Address |
MALDHAN***** |
Org. Name |
Direct |
| Department |
General Surgery |
|
|
```
---
## Style Guidelines
### Common CSS Classes Used:
- `margin:16px 0 8px 0` - Standard heading margins
- `margin:0 0 10px 20px` - List indentation
- `color:#475569` - Secondary/remark text color
- `border-collapse:collapse` - Table borders
- `text-align:left` - Default text alignment
- `vertical-align:middle` - Table cell alignment
### HTML Tags Used:
- `` - Section headers (16px top margin, 8px bottom)
- `` - Main title headers
- `` - Content blocks
- `
` / `` - Lists
- `` - Structured data
- `` / `` - Bold text
- `` - Inline styling (remarks)
- `
` - Line breaks
---
## Debug Endpoints
To view the actual rendered HTML:
1. **View full HTML source:**
```
/Ipd_discharge/debug_discharge_html/{ipdId}
```
Example: `http://localhost:8080/Ipd_discharge/debug_discharge_html/1`
2. **View database field values:**
```
/Ipd_discharge/debug_ipd_fields/{ipdId}
```
Example: `http://localhost:8080/Ipd_discharge/debug_ipd_fields/1`
---
## Notes
- All placeholders support both `{{TOKEN}}` and `{TOKEN}` formats
- All placeholders also support lowercase and Ucfirst variants
- Empty sections are NOT rendered (no HTML output)
- Rich text fields preserve HTML formatting from CKEditor
- All user input is escaped using `esc()` for XSS protection
- Date formats: `dd-mm-yyyy` (e.g., 07-06-2026)
- Time formats: `hh:mm AM/PM` (e.g., 02:44 PM)
---
**Generated:** 2026-06-07
**File Location:** `d:\Workplace\HMS_CI4_OLD\DISCHARGE_PLACEHOLDER_HTML_REFERENCE.md`