Diagnosis and treatment
| Test | Result | Reference | Status |
|---|---|---|---|
| Triglycerides | 409 mg/dL | < 150 | HIGH |
| LDL:HDL Ratio | 3.61 | < 3.22 | Above target |
| Cholesterol:HDL Ratio | 5.61 | < 6.0 | Borderline |
| SGOT (AST) | 77.44 U/L | 0-38 | ~2x elevated |
| SGPT (ALT) | 171.41 U/L | 0-41 | ~4x elevated |
| GGTP | 85.75 U/L | 7-34 | ~2.5x elevated |
| Bilirubin Total | 0.75 mg/dL | 0-1.0 | Normal |
| Bilirubin Direct | 0.17 mg/dL | 0-0.25 | Normal |
An AST:ALT ratio > 2:1 would suggest alcoholic liver disease; a ratio < 1 points strongly toward NAFLD/MASLD or viral hepatitis.
Caution: Statins are NOT the primary drug for hypertriglyceridemia (they target LDL). With the current liver enzyme elevation (ALT > 3x ULN), statins should be used cautiously and are generally deferred until liver status is clarified.
| Timeframe | Action |
|---|---|
| Now | Hepatitis serology, fasting glucose/HbA1c, ultrasound abdomen |
| 4-6 weeks | Repeat LFTs after lifestyle modification begins |
| 3 months | Repeat fasting lipid panel; decide on pharmacotherapy need |
| Ongoing | Annual lipid panel, LFT, glucose monitoring |
Important: This analysis is for informational and educational purposes. The patient should see a physician (ideally a hepatologist and/or cardiologist) for clinical evaluation, history-taking, and individualized management. Lab results must always be interpreted in the context of symptoms, physical examination, and clinical history.
Create a treatment plan summary document for patient counseling
mkdir -p /home/daytona/workspace/patient-counseling && ls /home/daytona/workspac…
~/patient-counseling/generate.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
HeadingLevel, AlignmentType, BorderStyle, WidthType, ShadingType,
VerticalAlign, PageNumber, Header, Footer, TabStopType, TabStopPosition
} = require('docx');
const fs = require('fs');
// ─── Colour palette ───────────────────────────────────────────────────────────
const BLUE_DARK = "1A3A5C"; // deep navy - headings / header bar
const BLUE_MID = "2E6DA4"; // medium blue - section titles
const BLUE_LIGHT = "D6E8F7"; // pale blue - table header shading
const RED_ALERT = "C0392B"; // red - abnormal values
const GREEN_OK = "1E7E34"; // green - normal values
const GREY_BG = "F4F6F8"; // light grey - alternating rows
const WHITE = "FFFFFF";
const BLACK = "000000";
// ─── Helpers ──────────────────────────────────────────────────────────────────
function bold(text, size=22, color=BLACK) {
return new TextRun({ text, bold: true, size, color, font: "Calibri" });
}
function normal(text, size=20, color=BLACK) {
return new TextRun({ text, size, color, font: "Calibri" });
}
function italic(text, size=18, color="555555") {
return new TextRun({ text, italics: true, size, color, font: "Calibri" });
}
function sectionHeading(text) {
return new Paragraph({
children: [new TextRun({ text, bold: true, size: 26, color: BLUE_MID, font: "Calibri" })],
spacing: { before: 300, after: 100 },
border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: BLUE_MID, space: 4 } }
});
}
function bullet(text, level=0) {
return new Paragraph({
children: [normal(text, 20)],
bullet: { level },
spacing: { before: 40, after: 40 }
});
}
function spacer() {
return new Paragraph({ children: [], spacing: { before: 80, after: 80 } });
}
// ─── Lab Results Table ────────────────────────────────────────────────────────
function labRow(test, result, ref, status, shade) {
const statusColor = status === "HIGH" || status === "ELEVATED" ? RED_ALERT : GREEN_OK;
const rowShade = shade ? GREY_BG : WHITE;
return new TableRow({
children: [
new TableCell({
children: [new Paragraph({ children: [bold(test, 19)], spacing: { before: 60, after: 60 } })],
shading: { fill: rowShade, type: ShadingType.CLEAR },
width: { size: 30, type: WidthType.PERCENTAGE },
margins: { top: 60, bottom: 60, left: 100, right: 80 }
}),
new TableCell({
children: [new Paragraph({ children: [bold(result, 20, statusColor)], alignment: AlignmentType.CENTER, spacing: { before: 60, after: 60 } })],
shading: { fill: rowShade, type: ShadingType.CLEAR },
width: { size: 20, type: WidthType.PERCENTAGE },
verticalAlign: VerticalAlign.CENTER,
margins: { top: 60, bottom: 60, left: 80, right: 80 }
}),
new TableCell({
children: [new Paragraph({ children: [normal(ref, 19)], alignment: AlignmentType.CENTER, spacing: { before: 60, after: 60 } })],
shading: { fill: rowShade, type: ShadingType.CLEAR },
width: { size: 25, type: WidthType.PERCENTAGE },
verticalAlign: VerticalAlign.CENTER,
margins: { top: 60, bottom: 60, left: 80, right: 80 }
}),
new TableCell({
children: [new Paragraph({ children: [bold(status, 19, statusColor)], alignment: AlignmentType.CENTER, spacing: { before: 60, after: 60 } })],
shading: { fill: rowShade, type: ShadingType.CLEAR },
width: { size: 25, type: WidthType.PERCENTAGE },
verticalAlign: VerticalAlign.CENTER,
margins: { top: 60, bottom: 60, left: 80, right: 80 }
})
]
});
}
function tableHeaderRow() {
const cells = [
{ text: "Test", w: 30 }, { text: "Your Result", w: 20 },
{ text: "Normal Range", w: 25 }, { text: "Status", w: 25 }
];
return new TableRow({
tableHeader: true,
children: cells.map(c => new TableCell({
children: [new Paragraph({ children: [bold(c.text, 20, WHITE)], alignment: AlignmentType.CENTER, spacing: { before: 80, after: 80 } })],
shading: { fill: BLUE_DARK, type: ShadingType.CLEAR },
width: { size: c.w, type: WidthType.PERCENTAGE },
margins: { top: 80, bottom: 80, left: 100, right: 80 }
}))
});
}
// ─── Monitoring Table ─────────────────────────────────────────────────────────
function monitorRow(when, action, shade) {
const rowShade = shade ? GREY_BG : WHITE;
return new TableRow({
children: [
new TableCell({
children: [new Paragraph({ children: [bold(when, 19, BLUE_MID)], spacing: { before: 60, after: 60 } })],
shading: { fill: rowShade, type: ShadingType.CLEAR },
width: { size: 25, type: WidthType.PERCENTAGE },
margins: { top: 60, bottom: 60, left: 100, right: 80 }
}),
new TableCell({
children: [new Paragraph({ children: [normal(action, 19)], spacing: { before: 60, after: 60 } })],
shading: { fill: rowShade, type: ShadingType.CLEAR },
width: { size: 75, type: WidthType.PERCENTAGE },
margins: { top: 60, bottom: 60, left: 100, right: 80 }
})
]
});
}
// ─── Diet Table ───────────────────────────────────────────────────────────────
function dietRow(category, eat, avoid, shade) {
const rowShade = shade ? GREY_BG : WHITE;
return new TableRow({
children: [
new TableCell({
children: [new Paragraph({ children: [bold(category, 19, BLUE_MID)], spacing: { before: 60, after: 60 } })],
shading: { fill: rowShade, type: ShadingType.CLEAR },
width: { size: 20, type: WidthType.PERCENTAGE },
margins: { top: 60, bottom: 60, left: 100, right: 80 }
}),
new TableCell({
children: [new Paragraph({ children: [normal(eat, 19, "1A5C2E")], spacing: { before: 60, after: 60 } })],
shading: { fill: rowShade, type: ShadingType.CLEAR },
width: { size: 40, type: WidthType.PERCENTAGE },
margins: { top: 60, bottom: 60, left: 80, right: 80 }
}),
new TableCell({
children: [new Paragraph({ children: [normal(avoid, 19, RED_ALERT)], spacing: { before: 60, after: 60 } })],
shading: { fill: rowShade, type: ShadingType.CLEAR },
width: { size: 40, type: WidthType.PERCENTAGE },
margins: { top: 60, bottom: 60, left: 80, right: 80 }
})
]
});
}
// ─── Build Document ───────────────────────────────────────────────────────────
const doc = new Document({
styles: {
default: {
document: {
run: { font: "Calibri", size: 20 }
}
}
},
sections: [{
properties: {
page: {
margin: { top: 720, bottom: 720, left: 900, right: 900 }
}
},
headers: {
default: new Header({
children: [
new Paragraph({
children: [
bold("PATIENT TREATMENT PLAN & COUNSELING SUMMARY", 22, WHITE),
new TextRun({ text: "\t", size: 22, font: "Calibri" }),
bold("Confidential", 18, "CCDDEE")
],
tabStops: [{ type: TabStopType.RIGHT, position: TabStopPosition.MAX }],
shading: { fill: BLUE_DARK, type: ShadingType.CLEAR },
spacing: { before: 120, after: 120 },
indent: { left: 200, right: 200 }
})
]
})
},
footers: {
default: new Footer({
children: [
new Paragraph({
children: [
italic("This document is for patient education only. Always follow your doctor's advice.", 16),
new TextRun({ text: " | Page ", size: 16, italics: true, font: "Calibri", color: "888888" }),
new TextRun({ children: [PageNumber.CURRENT], size: 16, font: "Calibri", color: "888888" })
],
alignment: AlignmentType.CENTER,
border: { top: { style: BorderStyle.SINGLE, size: 4, color: "CCCCCC", space: 4 } }
})
]
})
},
children: [
// ── Patient Info Banner ──────────────────────────────────────────────────
spacer(),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
new TableCell({
children: [
new Paragraph({ children: [bold("Patient Name:", 20, WHITE), normal(" MR. ARBAZ", 20, "D6E8F7")], spacing: { before: 80, after: 40 } }),
new Paragraph({ children: [bold("Age / Gender:", 20, WHITE), normal(" 23 Years / Male", 20, "D6E8F7")], spacing: { before: 40, after: 80 } })
],
shading: { fill: BLUE_DARK, type: ShadingType.CLEAR },
width: { size: 34, type: WidthType.PERCENTAGE },
margins: { top: 100, bottom: 100, left: 200, right: 100 }
}),
new TableCell({
children: [
new Paragraph({ children: [bold("Lab Date:", 20, WHITE), normal(" 09-Jul-2026", 20, "D6E8F7")], spacing: { before: 80, after: 40 } }),
new Paragraph({ children: [bold("Report Date:", 20, WHITE), normal(" 10-Jul-2026", 20, "D6E8F7")], spacing: { before: 40, after: 80 } })
],
shading: { fill: BLUE_DARK, type: ShadingType.CLEAR },
width: { size: 33, type: WidthType.PERCENTAGE },
margins: { top: 100, bottom: 100, left: 100, right: 100 }
}),
new TableCell({
children: [
new Paragraph({ children: [bold("Ref. Lab:", 20, WHITE), normal(" Laxmi Clinical Lab, Rajouri", 20, "D6E8F7")], spacing: { before: 80, after: 40 } }),
new Paragraph({ children: [bold("Physician:", 20, WHITE), normal(" Dr. Self / Treating Physician", 20, "D6E8F7")], spacing: { before: 40, after: 80 } })
],
shading: { fill: BLUE_DARK, type: ShadingType.CLEAR },
width: { size: 33, type: WidthType.PERCENTAGE },
margins: { top: 100, bottom: 100, left: 100, right: 200 }
})
]
})
]
}),
spacer(),
// ── Section 1: Diagnoses ─────────────────────────────────────────────────
sectionHeading("SECTION 1 — CLINICAL DIAGNOSES"),
spacer(),
// Diagnosis cards as a 2-col table
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
new TableCell({
children: [
new Paragraph({ children: [bold("Primary Diagnosis 1", 20, WHITE)], spacing: { before: 80, after: 40 }, alignment: AlignmentType.CENTER }),
new Paragraph({ children: [bold("Hypertriglyceridemia (High Grade)", 22, WHITE)], alignment: AlignmentType.CENTER, spacing: { before: 40, after: 40 } }),
new Paragraph({ children: [normal("TG: 409 mg/dL (Normal < 150)", 20, "FFEEDD")], alignment: AlignmentType.CENTER, spacing: { before: 40, after: 80 } })
],
shading: { fill: "B03A2E", type: ShadingType.CLEAR },
width: { size: 50, type: WidthType.PERCENTAGE },
margins: { top: 120, bottom: 120, left: 160, right: 160 }
}),
new TableCell({
children: [
new Paragraph({ children: [bold("Primary Diagnosis 2", 20, WHITE)], spacing: { before: 80, after: 40 }, alignment: AlignmentType.CENTER }),
new Paragraph({ children: [bold("Metabolic Liver Disease (MASLD/NAFLD)", 22, WHITE)], alignment: AlignmentType.CENTER, spacing: { before: 40, after: 40 } }),
new Paragraph({ children: [normal("ALT 4x, AST 2x, GGTP 2.5x elevated", 20, "DDEEFF")], alignment: AlignmentType.CENTER, spacing: { before: 40, after: 80 } })
],
shading: { fill: "1A4C7C", type: ShadingType.CLEAR },
width: { size: 50, type: WidthType.PERCENTAGE },
margins: { top: 120, bottom: 120, left: 160, right: 160 }
})
]
})
]
}),
spacer(),
new Paragraph({
children: [
bold("Combined Metabolic Syndrome Pattern: ", 20, BLUE_DARK),
normal("The combination of high triglycerides + elevated liver enzymes (ALT-dominant, AST:ALT ratio 0.45) in a 23-year-old male strongly suggests Metabolic Dysfunction-Associated Steatotic Liver Disease (MASLD) driven by insulin resistance and dyslipidemia. This requires urgent attention to prevent progression to cirrhosis and cardiovascular disease.", 20)
],
spacing: { before: 80, after: 80 },
border: {
left: { style: BorderStyle.THICK, size: 12, color: BLUE_MID, space: 8 }
},
indent: { left: 200 }
}),
spacer(),
// ── Section 2: Lab Results ───────────────────────────────────────────────
sectionHeading("SECTION 2 — YOUR LAB RESULTS AT A GLANCE"),
spacer(),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
tableHeaderRow(),
labRow("Triglycerides", "409 mg/dL", "< 150 mg/dL", "HIGH", false),
labRow("LDL : HDL Ratio", "3.61", "< 3.22", "BORDERLINE", true),
labRow("Cholesterol : HDL Ratio", "5.61", "< 6.0", "ACCEPTABLE", false),
labRow("SGOT (AST)", "77.44 U/L", "0 – 38 U/L", "ELEVATED", true),
labRow("SGPT (ALT)", "171.41 U/L", "0 – 41 U/L", "ELEVATED", false),
labRow("GGTP", "85.75 U/L", "7 – 34 U/L", "ELEVATED", true),
labRow("Bilirubin Total", "0.75 mg/dL", "0.0 – 1.0 mg/dL", "NORMAL", false),
labRow("Bilirubin Direct", "0.17 mg/dL", "0.0 – 0.25 mg/dL", "NORMAL", true),
labRow("Bilirubin Indirect", "0.58 mg/dL", "0.0 – 0.75 mg/dL", "NORMAL", false)
]
}),
spacer(),
// ── Section 3: Investigations Needed ────────────────────────────────────
sectionHeading("SECTION 3 — INVESTIGATIONS RECOMMENDED"),
spacer(),
new Paragraph({ children: [bold("Immediate / First Priority:", 21, BLUE_DARK)], spacing: { before: 60, after: 60 } }),
bullet("Fasting Blood Glucose + HbA1c — to rule out diabetes or pre-diabetes"),
bullet("Full Lipid Profile (LDL, HDL, Total Cholesterol) — complete cardiovascular risk assessment"),
bullet("Hepatitis B Surface Antigen (HBsAg) + Hepatitis C Antibody (anti-HCV) — rule out viral hepatitis"),
bullet("Serum Insulin + HOMA-IR — check for insulin resistance"),
bullet("Abdominal Ultrasound — look for fatty liver (bright echogenic liver)"),
spacer(),
new Paragraph({ children: [bold("Second Priority (if above inconclusive):", 21, BLUE_DARK)], spacing: { before: 60, after: 60 } }),
bullet("Thyroid Function Test (TSH) — hypothyroidism can cause elevated triglycerides"),
bullet("Renal Function Tests (BUN / Creatinine)"),
bullet("Repeat Liver Function Tests after 4-6 weeks of lifestyle changes"),
bullet("ANA, Anti-Smooth Muscle Antibody (ASMA) — if autoimmune hepatitis suspected"),
bullet("Serum Ceruloplasmin — to exclude Wilson's disease in a young patient"),
spacer(),
// ── Section 4: Treatment Plan ────────────────────────────────────────────
sectionHeading("SECTION 4 — TREATMENT PLAN"),
spacer(),
// 4A Lifestyle
new Paragraph({ children: [bold("4A. Lifestyle Modifications (Start Immediately)", 22, BLUE_MID)], spacing: { before: 80, after: 80 } }),
new Paragraph({ children: [italic("Lifestyle changes are the most effective and first-line treatment for both your conditions.", 19)] , spacing: { before: 40, after: 60 } }),
// Diet table
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
tableHeader: true,
children: [
new TableCell({
children: [new Paragraph({ children: [bold("Food Category", 19, WHITE)], alignment: AlignmentType.CENTER })],
shading: { fill: BLUE_MID, type: ShadingType.CLEAR },
width: { size: 20, type: WidthType.PERCENTAGE },
margins: { top: 80, bottom: 80, left: 100, right: 80 }
}),
new TableCell({
children: [new Paragraph({ children: [bold("✔ EAT MORE", 19, WHITE)], alignment: AlignmentType.CENTER })],
shading: { fill: "1E7E34", type: ShadingType.CLEAR },
width: { size: 40, type: WidthType.PERCENTAGE },
margins: { top: 80, bottom: 80, left: 100, right: 80 }
}),
new TableCell({
children: [new Paragraph({ children: [bold("✘ AVOID / REDUCE", 19, WHITE)], alignment: AlignmentType.CENTER })],
shading: { fill: "B03A2E", type: ShadingType.CLEAR },
width: { size: 40, type: WidthType.PERCENTAGE },
margins: { top: 80, bottom: 80, left: 100, right: 80 }
})
]
}),
dietRow("Carbs", "Whole grains, oats, millets, brown rice", "White rice, maida (refined flour), bread, sugary drinks", false),
dietRow("Fats", "Olive oil, mustard oil, walnuts, flaxseeds, fatty fish", "Fried foods, ghee in excess, vanaspati, butter, cream", true),
dietRow("Proteins", "Legumes, dal, egg whites, lean chicken, fish", "Processed meats, red meat in excess", false),
dietRow("Fruits/Veg", "Green leafy vegetables, berries, citrus, cucumber", "Mangoes, bananas, grapes, fruit juices (high sugar)", true),
dietRow("Drinks", "Water (2-3 L/day), green tea, buttermilk", "Alcohol (strictly avoid), soft drinks, packaged juices", false),
dietRow("Snacks", "Roasted chana, sprouts, nuts (handful), salads", "Chips, biscuits, namkeen, sweets, mithai", true)
]
}),
spacer(),
new Paragraph({ children: [bold("Exercise Plan:", 21, BLUE_MID)], spacing: { before: 80, after: 60 } }),
bullet("150 minutes per week of moderate aerobic exercise (brisk walking, cycling, swimming)"),
bullet("Aim for 30 minutes daily, 5 days a week"),
bullet("Avoid prolonged sitting — take a 5-minute walk every hour"),
bullet("Weight loss of even 5-10% of body weight can significantly improve both triglycerides and liver enzymes"),
spacer(),
new Paragraph({ children: [bold("Other Lifestyle Steps:", 21, BLUE_MID)], spacing: { before: 80, after: 60 } }),
bullet("STOP all alcohol consumption completely — alcohol worsens both liver damage and triglycerides"),
bullet("Quit smoking if applicable"),
bullet("Sleep 7-8 hours per night — poor sleep worsens insulin resistance"),
bullet("Manage stress (yoga, meditation, adequate rest)"),
spacer(),
// 4B Medication
new Paragraph({ children: [bold("4B. Medications (As Prescribed by Your Doctor)", 22, BLUE_MID)], spacing: { before: 80, after: 80 } }),
new Paragraph({
children: [
bold("IMPORTANT: ", 20, RED_ALERT),
normal("Do NOT self-medicate. All medications listed below are for your awareness only. Take only what your treating physician prescribes after clinical examination.", 20)
],
border: { left: { style: BorderStyle.THICK, size: 12, color: RED_ALERT, space: 8 } },
indent: { left: 200 },
spacing: { before: 60, after: 80 }
}),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
tableHeader: true,
children: [
new TableCell({ children: [new Paragraph({ children: [bold("Purpose", 19, WHITE)], alignment: AlignmentType.CENTER })], shading: { fill: BLUE_DARK, type: ShadingType.CLEAR }, width: { size: 25, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 100, right: 80 } }),
new TableCell({ children: [new Paragraph({ children: [bold("Medication Options", 19, WHITE)], alignment: AlignmentType.CENTER })], shading: { fill: BLUE_DARK, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 80, right: 80 } }),
new TableCell({ children: [new Paragraph({ children: [bold("Notes", 19, WHITE)], alignment: AlignmentType.CENTER })], shading: { fill: BLUE_DARK, type: ShadingType.CLEAR }, width: { size: 45, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 80, right: 80 } })
]
}),
new TableRow({
children: [
new TableCell({ children: [new Paragraph({ children: [bold("Lower Triglycerides", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 25, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 100, right: 80 } }),
new TableCell({ children: [new Paragraph({ children: [normal("Fenofibrate 145 mg\nOmega-3 Fatty Acids 4g/day", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } }),
new TableCell({ children: [new Paragraph({ children: [normal("First try lifestyle changes for 3 months. Prescribed only if TG remains high. Liver function monitored closely.", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 45, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } })
]
}),
new TableRow({
children: [
new TableCell({ children: [new Paragraph({ children: [bold("Liver Support (NAFLD)", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: WHITE, type: ShadingType.CLEAR }, width: { size: 25, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 100, right: 80 } }),
new TableCell({ children: [new Paragraph({ children: [normal("Vitamin E 800 IU/day\n(off-label)", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: WHITE, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } }),
new TableCell({ children: [new Paragraph({ children: [normal("Shown to reduce liver inflammation in non-diabetic NAFLD. Lifestyle changes remain primary treatment.", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: WHITE, type: ShadingType.CLEAR }, width: { size: 45, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } })
]
}),
new TableRow({
children: [
new TableCell({ children: [new Paragraph({ children: [bold("Statins (if LDL high)", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 25, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 100, right: 80 } }),
new TableCell({ children: [new Paragraph({ children: [normal("Rosuvastatin / Atorvastatin", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } }),
new TableCell({ children: [new Paragraph({ children: [normal("DEFERRED until liver enzymes are re-evaluated. ALT > 3x ULN is a caution for statin use.", 19, RED_ALERT)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 45, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } })
]
})
]
}),
spacer(),
// ── Section 5: Monitoring ────────────────────────────────────────────────
sectionHeading("SECTION 5 — MONITORING & FOLLOW-UP SCHEDULE"),
spacer(),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
tableHeader: true,
children: [
new TableCell({ children: [new Paragraph({ children: [bold("Timeframe", 19, WHITE)], alignment: AlignmentType.CENTER })], shading: { fill: BLUE_DARK, type: ShadingType.CLEAR }, width: { size: 25, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 100, right: 80 } }),
new TableCell({ children: [new Paragraph({ children: [bold("Action Required", 19, WHITE)], alignment: AlignmentType.CENTER })], shading: { fill: BLUE_DARK, type: ShadingType.CLEAR }, width: { size: 75, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 100, right: 80 } })
]
}),
monitorRow("NOW (This Week)", "Hepatitis B & C serology | Fasting glucose + HbA1c | Abdominal ultrasound | Full lipid panel | TSH | HOMA-IR", false),
monitorRow("4 – 6 Weeks", "Repeat LFT (SGOT, SGPT, GGTP) — assess response to lifestyle changes", true),
monitorRow("3 Months", "Repeat fasting lipid panel — decide if TG-lowering medication is needed", false),
monitorRow("6 Months", "Comprehensive review: LFT + lipid panel + glucose + weight + blood pressure", true),
monitorRow("Every Year", "Annual lipid panel, LFT, HbA1c, kidney function — ongoing cardiovascular monitoring", false)
]
}),
spacer(),
// ── Section 6: Warning Signs ─────────────────────────────────────────────
sectionHeading("SECTION 6 — WARNING SIGNS (Seek Immediate Medical Help)"),
spacer(),
new Paragraph({
children: [bold("Go to the nearest doctor or hospital if you experience any of these:", 20, RED_ALERT)],
spacing: { before: 60, after: 80 }
}),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
new TableCell({
children: [
new Paragraph({ children: [bold("Liver Warning Signs", 20, WHITE)], spacing: { before: 80, after: 60 } }),
new Paragraph({ children: [normal("• Yellowing of skin or eyes (jaundice)", 19, "FFEEDD")], spacing: { before: 40, after: 40 } }),
new Paragraph({ children: [normal("• Severe pain in upper right abdomen", 19, "FFEEDD")], spacing: { before: 40, after: 40 } }),
new Paragraph({ children: [normal("• Dark-coloured urine (tea-coloured)", 19, "FFEEDD")], spacing: { before: 40, after: 40 } }),
new Paragraph({ children: [normal("• Persistent nausea and vomiting", 19, "FFEEDD")], spacing: { before: 40, after: 80 } })
],
shading: { fill: "8B0000", type: ShadingType.CLEAR },
width: { size: 50, type: WidthType.PERCENTAGE },
margins: { top: 100, bottom: 100, left: 160, right: 80 }
}),
new TableCell({
children: [
new Paragraph({ children: [bold("Cardiac / Pancreatitis Warning Signs", 20, WHITE)], spacing: { before: 80, after: 60 } }),
new Paragraph({ children: [normal("• Severe pain in the upper abdomen or back", 19, "DDEEFF")], spacing: { before: 40, after: 40 } }),
new Paragraph({ children: [normal("• Chest pain or tightness, shortness of breath", 19, "DDEEFF")], spacing: { before: 40, after: 40 } }),
new Paragraph({ children: [normal("• Sudden dizziness or loss of consciousness", 19, "DDEEFF")], spacing: { before: 40, after: 40 } }),
new Paragraph({ children: [normal("• Severe headache or visual disturbance", 19, "DDEEFF")], spacing: { before: 40, after: 80 } })
],
shading: { fill: "1A2A6C", type: ShadingType.CLEAR },
width: { size: 50, type: WidthType.PERCENTAGE },
margins: { top: 100, bottom: 100, left: 80, right: 160 }
})
]
})
]
}),
spacer(),
// ── Section 7: Why Act Now? ──────────────────────────────────────────────
sectionHeading("SECTION 7 — WHY ACT NOW? (For Patient Motivation)"),
spacer(),
new Paragraph({
children: [
bold("You are only 23 years old. ", 21, BLUE_DARK),
normal("This is actually good news — catching these problems early means you have the best chance of reversing them completely with lifestyle changes alone, before they become permanent. Here is what can happen if left untreated:", 20)
],
spacing: { before: 60, after: 80 }
}),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
tableHeader: true,
children: [
new TableCell({ children: [new Paragraph({ children: [bold("Condition", 19, WHITE)] })], shading: { fill: BLUE_MID, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 100, right: 80 } }),
new TableCell({ children: [new Paragraph({ children: [bold("If Untreated — Risk Over Time", 19, WHITE)] })], shading: { fill: BLUE_MID, type: ShadingType.CLEAR }, width: { size: 40, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 80, right: 80 } }),
new TableCell({ children: [new Paragraph({ children: [bold("With Treatment — Outcome", 19, WHITE)] })], shading: { fill: "1E7E34", type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 80, right: 80 } })
]
}),
new TableRow({
children: [
new TableCell({ children: [new Paragraph({ children: [bold("High Triglycerides", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 100, right: 80 } }),
new TableCell({ children: [new Paragraph({ children: [normal("Acute pancreatitis, heart attack, stroke by 30s-40s", 19, RED_ALERT)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 40, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } }),
new TableCell({ children: [new Paragraph({ children: [normal("Normalises within 3-6 months of diet + exercise", 19, "1E7E34")], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } })
]
}),
new TableRow({
children: [
new TableCell({ children: [new Paragraph({ children: [bold("Fatty Liver (NAFLD)", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: WHITE, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 100, right: 80 } }),
new TableCell({ children: [new Paragraph({ children: [normal("Can progress to liver fibrosis, cirrhosis, liver failure", 19, RED_ALERT)], spacing: { before: 60, after: 60 } })], shading: { fill: WHITE, type: ShadingType.CLEAR }, width: { size: 40, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } }),
new TableCell({ children: [new Paragraph({ children: [normal("Fully reversible in early stage with weight loss + diet", 19, "1E7E34")], spacing: { before: 60, after: 60 } })], shading: { fill: WHITE, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } })
]
}),
new TableRow({
children: [
new TableCell({ children: [new Paragraph({ children: [bold("Metabolic Syndrome", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 100, right: 80 } }),
new TableCell({ children: [new Paragraph({ children: [normal("Type 2 Diabetes, hypertension, early cardiovascular disease", 19, RED_ALERT)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 40, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } }),
new TableCell({ children: [new Paragraph({ children: [normal("Prevented / reversed with sustained lifestyle change", 19, "1E7E34")], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } })
]
})
]
}),
spacer(),
// ── Disclaimer Box ───────────────────────────────────────────────────────
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
new TableCell({
children: [
new Paragraph({
children: [bold("MEDICAL DISCLAIMER ", 18, RED_ALERT), italic("This document is prepared for patient education and counseling purposes only. It does not constitute a formal medical prescription or replace the advice of a qualified physician. All treatment decisions must be made by a licensed healthcare professional after proper clinical evaluation of this patient.", 18, "333333")],
spacing: { before: 80, after: 80 }
})
],
shading: { fill: "FFF3CD", type: ShadingType.CLEAR },
margins: { top: 100, bottom: 100, left: 200, right: 200 },
borders: {
top: { style: BorderStyle.SINGLE, size: 4, color: "FFC107" },
bottom: { style: BorderStyle.SINGLE, size: 4, color: "FFC107" },
left: { style: BorderStyle.THICK, size: 12, color: "FFC107" },
right: { style: BorderStyle.SINGLE, size: 4, color: "FFC107" }
}
})
]
})
]
}),
spacer()
]
}]
});
Packer.toBuffer(doc).then(buffer => {
fs.writeFileSync("/home/daytona/workspace/patient-counseling/TreatmentPlan_Arbaz.docx", buffer);
console.log("Document created successfully.");
});
cd /home/daytona/workspace/patient-counseling && node generate.js 2>&1
python /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/worksp…
cd /home/daytona/workspace/patient-counseling && python3 -c " import zipfile, os…
TreatmentPlan Arbaz
Word Document · DOCX
| Section | Content |
|---|---|
| Patient Info Banner | Name, age, gender, lab date, referring lab |
| Section 1 - Clinical Diagnoses | Two diagnosis cards: Hypertriglyceridemia (High Grade) + MASLD/NAFLD, with explanation of the combined metabolic syndrome pattern |
| Section 2 - Lab Results | Full colour-coded table - abnormal values in red, normal values in green |
| Section 3 - Investigations Needed | First-priority and second-priority tests clearly listed |
| Section 4 - Treatment Plan | Diet table (Eat More vs. Avoid), exercise plan, lifestyle steps, medication table with dosing notes and statin deferral warning |
| Section 5 - Follow-up Schedule | 5-timepoint monitoring calendar from "this week" to annual review |
| Section 6 - Warning Signs | Red-alert symptoms for liver vs. cardiac/pancreatitis emergencies |
| Section 7 - Why Act Now | Motivational risk-vs-outcome table tailored for a 23-year-old patient |