~/neelavathi-care-guide/create_guide.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
HeadingLevel, AlignmentType, BorderStyle, WidthType, ShadingType,
VerticalAlign, PageNumber, Header, Footer, PageBreak, UnderlineType
} = require('docx');
const fs = require('fs');
// โโโ Color palette โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
const C = {
navy: "1A3A5C",
teal: "0D7377",
green: "1B6B3A",
red: "C0392B",
orange: "D35400",
yellow: "F9CA24",
lightBlue:"EBF5FB",
lightGreen:"EAFAF1",
lightRed: "FDEDEC",
lightYellow:"FEFDE7",
white: "FFFFFF",
gray: "ECF0F1",
darkGray: "555555",
black: "000000",
};
// โโโ Helper functions โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
const run = (text, opts = {}) => new TextRun({
text,
bold: opts.bold || false,
italics: opts.italic || false,
color: opts.color || C.black,
size: (opts.size || 11) * 2,
font: opts.font || "Calibri",
underline: opts.underline ? { type: UnderlineType.SINGLE } : undefined,
});
const heading1 = (text) => new Paragraph({
heading: HeadingLevel.HEADING_1,
spacing: { before: 300, after: 120 },
children: [new TextRun({
text, bold: true, color: C.white, size: 28,
font: "Calibri", allCaps: true,
})],
shading: { type: ShadingType.SOLID, color: C.navy, fill: C.navy },
indent: { left: 200, right: 200 },
border: {
bottom: { style: BorderStyle.THICK, size: 6, color: C.teal },
},
});
const heading2 = (text, color = C.teal) => new Paragraph({
heading: HeadingLevel.HEADING_2,
spacing: { before: 240, after: 80 },
border: {
left: { style: BorderStyle.THICK, size: 12, color },
},
indent: { left: 180 },
children: [new TextRun({
text, bold: true, color, size: 26, font: "Calibri",
})],
});
const heading3 = (text, color = C.darkGray) => new Paragraph({
heading: HeadingLevel.HEADING_3,
spacing: { before: 160, after: 60 },
children: [new TextRun({ text, bold: true, color, size: 22, font: "Calibri" })],
});
const para = (children, opts = {}) => new Paragraph({
spacing: { before: 60, after: 60 },
alignment: opts.align || AlignmentType.LEFT,
indent: opts.indent ? { left: 360 } : undefined,
shading: opts.shade ? { type: ShadingType.SOLID, color: opts.shade, fill: opts.shade } : undefined,
children: Array.isArray(children) ? children : [run(children, opts)],
});
const bullet = (text, opts = {}) => new Paragraph({
bullet: { level: 0 },
spacing: { before: 40, after: 40 },
indent: { left: 360, hanging: 260 },
children: [run(text, opts)],
});
const subbullet = (text) => new Paragraph({
bullet: { level: 1 },
spacing: { before: 30, after: 30 },
indent: { left: 720, hanging: 260 },
children: [run(text, { size: 10, color: C.darkGray })],
});
const spacer = (pts = 120) => new Paragraph({ spacing: { before: pts, after: 0 }, children: [] });
const divider = () => new Paragraph({
spacing: { before: 80, after: 80 },
border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: C.teal } },
children: [],
});
const shaded = (paragraphs, color) => paragraphs.map(p => {
p.options = p.options || {};
return p;
});
// โโโ Shaded box helper โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
const infoBox = (lines, bgColor, labelColor = C.black) => {
return lines.map((line, i) => new Paragraph({
spacing: { before: i === 0 ? 40 : 20, after: i === lines.length - 1 ? 40 : 20 },
indent: { left: 300, right: 300 },
shading: { type: ShadingType.SOLID, color: bgColor, fill: bgColor },
children: Array.isArray(line) ? line : [run(line, { color: labelColor, size: 11 })],
}));
};
// โโโ Table builder โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
const makeTable = (headers, rows, colWidths) => {
const headerRow = new TableRow({
tableHeader: true,
children: headers.map((h, i) => new TableCell({
width: { size: colWidths[i], type: WidthType.DXA },
shading: { type: ShadingType.SOLID, color: C.navy, fill: C.navy },
verticalAlign: VerticalAlign.CENTER,
children: [new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: h, bold: true, color: C.white, size: 20, font: "Calibri" })],
})],
})),
});
const dataRows = rows.map((row, ri) => new TableRow({
children: row.map((cell, ci) => new TableCell({
width: { size: colWidths[ci], type: WidthType.DXA },
shading: { type: ShadingType.SOLID, color: ri % 2 === 0 ? C.white : C.gray, fill: ri % 2 === 0 ? C.white : C.gray },
verticalAlign: VerticalAlign.CENTER,
children: [new Paragraph({
alignment: ci === 0 ? AlignmentType.LEFT : AlignmentType.CENTER,
indent: { left: 100 },
children: Array.isArray(cell)
? cell
: [new TextRun({ text: String(cell), size: 20, font: "Calibri",
bold: typeof cell === 'string' && cell.startsWith('โ
') ? false :
typeof cell === 'string' && cell.startsWith('โ') ? false : false })],
})],
})),
}));
return new Table({
width: { size: 9000, type: WidthType.DXA },
rows: [headerRow, ...dataRows],
borders: {
top: { style: BorderStyle.SINGLE, size: 4, color: C.teal },
bottom: { style: BorderStyle.SINGLE, size: 4, color: C.teal },
left: { style: BorderStyle.SINGLE, size: 4, color: C.teal },
right: { style: BorderStyle.SINGLE, size: 4, color: C.teal },
insideH: { style: BorderStyle.SINGLE, size: 2, color: "CCCCCC" },
insideV: { style: BorderStyle.SINGLE, size: 2, color: "CCCCCC" },
},
});
};
// โโโ DOCUMENT โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
const doc = new Document({
styles: {
default: {
document: {
run: { font: "Calibri", size: 22 },
},
},
},
sections: [{
properties: {
page: {
margin: { top: 900, bottom: 900, left: 1000, right: 1000 },
},
},
headers: {
default: new Header({
children: [
new Paragraph({
border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: C.teal } },
spacing: { after: 80 },
children: [
new TextRun({ text: "Patient Care Guide โ Mrs. Neelavathi J | Chronic Hepatitis B", color: C.navy, size: 18, bold: true, font: "Calibri" }),
new TextRun({ text: " Prepared May 2026", color: C.darkGray, size: 16, font: "Calibri", italics: true }),
],
}),
],
}),
},
footers: {
default: new Footer({
children: [
new Paragraph({
border: { top: { style: BorderStyle.SINGLE, size: 4, color: C.teal } },
spacing: { before: 80 },
alignment: AlignmentType.CENTER,
children: [
new TextRun({ text: "โ This guide supplements โ never replaces โ advice from Dr. R. Murali MD, DM (Gastro). Always consult your treating doctor. | Page ", color: C.darkGray, size: 16, font: "Calibri" }),
new TextRun({ children: [PageNumber.CURRENT], size: 16, font: "Calibri", color: C.navy }),
],
}),
],
}),
},
children: [
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// COVER BLOCK
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
new Paragraph({
spacing: { before: 0, after: 0 },
shading: { type: ShadingType.SOLID, color: C.navy, fill: C.navy },
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: " ", size: 4 })],
}),
new Paragraph({
shading: { type: ShadingType.SOLID, color: C.navy, fill: C.navy },
alignment: AlignmentType.CENTER,
spacing: { before: 80, after: 20 },
children: [new TextRun({ text: "PATIENT CARE GUIDE", bold: true, color: C.yellow, size: 52, font: "Calibri", allCaps: true })],
}),
new Paragraph({
shading: { type: ShadingType.SOLID, color: C.navy, fill: C.navy },
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 20 },
children: [new TextRun({ text: "Chronic Hepatitis B โ Family Reference Document", color: C.white, size: 30, font: "Calibri", italics: true })],
}),
new Paragraph({
shading: { type: ShadingType.SOLID, color: C.teal, fill: C.teal },
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 0 },
children: [new TextRun({ text: " Mrs. Neelavathi J ยท 52 Years ยท Female ยท Under care of Dr. R. Murali MD DM (Gastro) ", color: C.white, size: 22, bold: true, font: "Calibri" })],
}),
spacer(200),
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// SECTION 1 โ DIAGNOSIS
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
heading1("1. FINAL DIAGNOSIS"),
spacer(80),
new Paragraph({
spacing: { before: 40, after: 40 },
shading: { type: ShadingType.SOLID, color: C.lightBlue, fill: C.lightBlue },
border: {
left: { style: BorderStyle.THICK, size: 16, color: C.teal },
top: { style: BorderStyle.SINGLE, size: 4, color: C.teal },
bottom: { style: BorderStyle.SINGLE, size: 4, color: C.teal },
},
indent: { left: 200, right: 200 },
children: [
new TextRun({ text: "PRIMARY DIAGNOSIS: ", bold: true, color: C.navy, size: 24, font: "Calibri" }),
new TextRun({ text: "Chronic Hepatitis B Infection (CHB)", bold: true, color: C.teal, size: 24, font: "Calibri" }),
],
}),
spacer(40),
new Paragraph({
spacing: { before: 40, after: 40 },
shading: { type: ShadingType.SOLID, color: C.lightGreen, fill: C.lightGreen },
border: { left: { style: BorderStyle.THICK, size: 16, color: C.green } },
indent: { left: 200, right: 200 },
children: [
new TextRun({ text: "STATUS: ", bold: true, color: C.green, size: 22, font: "Calibri" }),
new TextRun({ text: "Currently in VIROLOGICAL REMISSION โ HBV virus fully suppressed by Entecavir therapy. Liver function NORMAL.", bold: false, color: C.green, size: 22, font: "Calibri" }),
],
}),
spacer(100),
heading2("What is Chronic Hepatitis B?"),
bullet("Hepatitis B is a viral infection that attacks the liver and is caused by the Hepatitis B virus (HBV)."),
bullet("'Chronic' means the infection has lasted longer than 6 months and is unlikely to go away on its own."),
bullet("Mrs. Neelavathi's HBsAg (surface antigen) was confirmed REACTIVE in February 2024 โ meaning she carries the virus."),
bullet("The GOOD news: With antiviral medicine (Entecavir), the virus is now UNDETECTABLE in her blood โ meaning the medicine is working perfectly."),
bullet("Hepatitis B spreads through blood and body fluids โ NOT through normal household contact, sharing food, or hugging."),
spacer(80),
heading2("Key Test Results at a Glance", C.navy),
spacer(60),
makeTable(
["Test", "Her Result", "Normal Range", "Status"],
[
["HBsAg", "REACTIVE", "Non-reactive", "โ Has Hepatitis B"],
["HBV DNA (Virus level)", "UNDETECTABLE", "Undetectable on treatment", "โ
Excellent response"],
["AFP (Cancer marker)", "1.3 ng/mL", "< 10 ng/mL", "โ
Normal โ no cancer"],
["ALT (Liver enzyme)", "14 IU/L", "0โ130 IU/L", "โ
Normal"],
["AST (Liver enzyme)", "29 IU/L", "5โ40 IU/L", "โ
Normal"],
["Total Bilirubin", "0.5 mg/dL", "0.1โ1.2 mg/dL", "โ
Normal"],
["Albumin", "3.3 g/dL", "2โ4 g/dL", "โ
Normal"],
["INR (Clotting)", "1.3", "1โ2", "โ
Normal"],
["Platelets", "2,93,000", "1,20,000โ3,80,000", "โ
Normal"],
["Creatinine (Kidney)", "0.7 mg/dL", "0.6โ1.3 mg/dL", "โ
Normal"],
["Haemoglobin", "13 g/dL", "12โ16 g/dL", "โ
Normal"],
],
[2600, 1800, 2200, 2400]
),
spacer(120),
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// SECTION 2 โ MEDICATIONS
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
new Paragraph({ children: [new PageBreak()] }),
heading1("2. CURRENT MEDICATIONS"),
spacer(80),
heading2("Medicine Schedule"),
spacer(60),
makeTable(
["Medicine", "Dose", "Timing", "Purpose", "Important Note"],
[
["GEPATIT (Entecavir 0.5 mg)", "1 tablet", "Every MORNING โ on EMPTY stomach (2 hrs before or after food)", "Antiviral โ suppresses Hepatitis B virus", "NEVER skip or stop without doctor's order"],
["URZO-300 (Ursodeoxycholic Acid 300 mg)", "As directed", "As prescribed by Dr. Murali", "Liver protection & biliary health", "Take with food"],
],
[2000, 900, 2200, 1800, 2100]
),
spacer(100),
...infoBox([
"โ CRITICAL MEDICATION WARNING",
"",
"โข Entecavir MUST be taken every single day โ missing doses allows the virus to mutate and become resistant.",
"โข NEVER stop Entecavir suddenly โ stopping without medical supervision can cause a severe hepatitis flare that may lead to liver failure.",
"โข If a dose is missed: Take it as soon as you remember the SAME day. If the next day has come, skip the missed dose โ do NOT double up.",
"โข Entecavir is taken on an EMPTY stomach. Food reduces its absorption.",
"โข If vomiting occurs within 30 minutes of taking the tablet, take another dose.",
], "FDEDEC", C.red),
spacer(100),
heading2("Medicines to AVOID (unless prescribed by Dr. Murali)"),
bullet("Paracetamol / Crocin โ safe at low doses (< 1.5 g/day max) but AVOID regular daily use"),
bullet("Ibuprofen, Diclofenac, Aspirin (NSAIDs) โ harm both liver and kidneys โ AVOID"),
bullet("All Ayurvedic / herbal supplements, tonics, 'liver tablets' from medical shops โ many are severely hepatotoxic"),
bullet("Any new antibiotic or medication โ always inform the prescribing doctor about the Hepatitis B status first"),
spacer(120),
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// SECTION 3 โ DIET GUIDE
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
heading1("3. DIET & NUTRITION GUIDE"),
spacer(80),
heading2("โ
Foods to Eat Freely", C.green),
spacer(40),
makeTable(
["Food Group", "Recommended Items", "Benefit"],
[
["Fruits", "Papaya, pomegranate, apple, banana, guava, watermelon, oranges", "Vitamins, antioxidants, support liver healing"],
["Vegetables", "Bottle gourd, ridge gourd, spinach, carrots, beets, beans, broccoli", "Fiber, micronutrients, anti-inflammatory"],
["Protein (Lean)", "Egg whites, skinless chicken (boiled/steamed), fish, dal, lentils, tofu, paneer (low-fat)", "Maintains albumin and muscle mass"],
["Carbohydrates", "Brown rice / small portions of rice, whole wheat roti, oats, ragi, millets", "Sustained energy without fat overload"],
["Healthy Fats", "Olive oil or coconut oil (1โ2 tsp/day), handful of almonds/walnuts", "Good fats without stressing liver"],
["Dairy", "Low-fat milk, curd/yogurt, buttermilk (chaas)", "Calcium, probiotics for gut health"],
["Fluids", "2โ2.5 litres plain water/day, coconut water, fresh lime water (no added sugar)", "Hydration, kidney and liver function"],
["Spices/Herbs", "Turmeric (haldi), ginger, garlic in cooking amounts", "Anti-inflammatory, hepatoprotective"],
],
[1800, 3600, 3600]
),
spacer(100),
heading2("โ Foods & Substances to STRICTLY AVOID", C.red),
spacer(40),
makeTable(
["Item", "Why to Avoid"],
[
["๐ซ ALCOHOL โ beer, wine, whiskey, any form", "Even small amounts massively accelerate liver damage, cause cirrhosis, and increase liver cancer risk. ABSOLUTE ZERO."],
["๐ซ Raw/undercooked shellfish (oysters, crabs, mussels)", "Risk of Vibrio vulnificus infection โ can be FATAL in people with liver disease"],
["๐ซ Fried, oily foods, pakoras, samosas, chips", "Causes fatty liver to develop on top of hepatitis B โ double damage"],
["๐ซ Processed / packaged foods, instant noodles", "High sodium, preservatives, trans fats โ directly harm liver"],
["๐ซ Excess salt (> 2g/day)", "Worsens fluid retention if portal hypertension ever develops"],
["๐ซ Red meat in excess (mutton, beef, pork)", "High saturated fat increases hepatic metabolic load"],
["๐ซ Herbal / Ayurvedic medicines without approval", "Many contain pyrrolizidine alkaloids and other hepatotoxins โ very dangerous"],
["๐ซ Raw eggs", "Salmonella infection risk; immune system is partially suppressed"],
["๐ซ Street food, unhygienic water, cut fruit from vendors", "Risk of Hepatitis A or E superinfection โ can trigger acute-on-chronic liver failure"],
["๐ซ Sugary drinks, sweets, desserts in excess", "Promotes fatty liver (NAFLD) on top of viral hepatitis"],
],
[3000, 6000]
),
spacer(100),
heading2("Sample Daily Meal Plan"),
spacer(60),
makeTable(
["Meal", "What to Eat"],
[
["Early Morning (6โ7 AM)", "1 glass warm water with a pinch of turmeric OR lemon water (no sugar)"],
["Breakfast (8โ9 AM)", "Oats porridge with banana OR 2 idlis with sambar (low oil) OR ragi porridge with low-fat milk"],
["Mid-Morning (11 AM)", "1 fresh fruit (apple / papaya / pomegranate) + a small handful of almonds"],
["Lunch (1 PM)", "1โ2 cups cooked rice OR 2 rotis + 1 cup dal/lentils + 1 cup cooked vegetables + 1 cup curd"],
["Afternoon (4 PM)", "1 glass buttermilk OR coconut water + a small fruit"],
["Dinner (7โ8 PM)", "2 rotis + lightly cooked sabzi + 1 cup dal/egg white curry OR grilled/steamed fish"],
["Before Bed (if hungry)", "1 small glass of low-fat warm milk"],
["AVOID after 8 PM", "No heavy meals โ liver does its repair work at night; heavy food disrupts this"],
],
[2200, 6800]
),
spacer(120),
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// SECTION 4 โ DAILY ACTIVITIES
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
new Paragraph({ children: [new PageBreak()] }),
heading1("4. DAILY ACTIVITIES & LIFESTYLE"),
spacer(80),
heading2("โ
Recommended Activities", C.green),
bullet("WALKING: 30โ45 minutes brisk walk every day โ the single best exercise for liver health and overall wellbeing"),
bullet("YOGA / Light stretching: 15โ20 minutes daily โ reduces stress, improves circulation"),
bullet("NORMAL HOUSEHOLD WORK: No restrictions โ cooking, cleaning, light errands are all fine"),
bullet("REGULAR SLEEP: 7โ8 hours every night. Rest during the day if feeling tired โ do not push through fatigue"),
bullet("NORMAL SOCIAL LIFE: Going out, visiting family, attending functions โ all allowed"),
bullet("BATHING / PERSONAL HYGIENE: Normal โ no restrictions"),
spacer(80),
heading2("โ Activities to Be Careful With", C.orange),
bullet("HEAVY GYM LIFTING / INTENSE CONTACT SPORTS: Avoid until doctor confirms no varices or portal hypertension"),
bullet("LONG FASTING: Do not skip meals for more than 4โ5 hours โ puts metabolic stress on the liver"),
bullet("LONG SUN EXPOSURE WITHOUT WATER: Stay hydrated โ dehydration stresses both kidney and liver"),
bullet("TRAVEL: Can travel normally; carry medicine supply for entire trip; keep Entecavir in hand baggage"),
spacer(80),
heading2("โ Strictly Avoid", C.red),
bullet("SMOKING: Worsens liver fibrosis and dramatically increases liver cancer risk โ quit completely"),
bullet("ALCOHOL: As stated โ absolute zero, forever. Even during festivals, social gatherings, ceremonies."),
bullet("RECREATIONAL DRUGS: Absolute prohibition"),
bullet("TATTOOS / PIERCINGS in unsterile environments: Risk of HBV reactivation or new blood-borne infection"),
bullet("SHARING personal items: razors, nail cutters, toothbrush โ never share with anyone"),
spacer(80),
heading2("Work & Professional Life"),
bullet("She can CONTINUE normal work โ office, domestic, or otherwise โ no special restrictions needed"),
bullet("She should inform her treating doctor if her work involves heavy chemical exposure (solvents, industrial chemicals)"),
bullet("She should NOT donate blood"),
spacer(120),
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// SECTION 5 โ MONITORING SCHEDULE
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
heading1("5. MONITORING & FOLLOW-UP SCHEDULE"),
spacer(80),
heading2("Every 6 Months (Mandatory โ Do Not Skip)"),
spacer(60),
makeTable(
["Test", "Purpose"],
[
["Ultrasound Abdomen", "Screen for liver cancer (HCC) โ most important test"],
["AFP (Alpha-fetoprotein)", "Blood cancer marker โ detects early HCC"],
["LFT (ALT, AST, Bilirubin, Albumin)", "Check liver health and inflammation"],
["HBV DNA Quantitative", "Confirm virus remains suppressed on Entecavir"],
["CBC (Complete Blood Count)", "Check for falling platelets / anaemia โ signs of worsening"],
],
[3000, 6000]
),
spacer(80),
heading2("Every 12 Months"),
spacer(60),
makeTable(
["Test", "Purpose"],
[
["Creatinine + eGFR (Kidney function)", "Safety monitoring for Entecavir โ must check kidneys annually"],
["HBsAg Quantitative", "Track chances of 'functional cure' (HBsAg loss)"],
["Fibroscan / Liver Elastography", "Measure liver stiffness / fibrosis stage without biopsy"],
["Upper GI Endoscopy", "If cirrhosis suspected โ screen for oesophageal varices"],
["Blood pressure monitoring", "130/80 at last visit โ should be checked every 3 months"],
],
[3200, 5800]
),
spacer(100),
...infoBox([
"WHEN CAN ENTECAVIR BE STOPPED?",
"",
"โข Only the doctor decides when โ NEVER stop on your own.",
"โข In general: Only after HBsAg becomes NEGATIVE for at least 12 months AND HBV DNA undetectable for 3+ years.",
"โข If cirrhosis is present: Treatment is likely LIFELONG.",
"โข Stopping too early causes severe relapse โ sometimes fatal.",
], C.lightBlue, C.navy),
spacer(120),
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// SECTION 6 โ RED FLAGS
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
new Paragraph({ children: [new PageBreak()] }),
heading1("6. ๐จ RED FLAG SYMPTOMS โ GO TO HOSPITAL IMMEDIATELY"),
spacer(80),
...infoBox([
"If ANY of the following appear โ go to hospital IMMEDIATELY. Do NOT wait.",
"",
"๐ด Sudden yellowing of the eyes or skin (jaundice)",
"๐ด Vomiting blood (bright red or coffee-ground coloured)",
"๐ด Black, tarry, foul-smelling stools",
"๐ด Swelling of the abdomen / belly (new or rapidly worsening)",
"๐ด Severe abdominal pain",
"๐ด Confusion, unusual sleepiness, difficulty waking, slurred speech",
"๐ด High fever (> 38.5ยฐC) with yellow eyes",
"๐ด Unexplained bruising or bleeding that does not stop",
"๐ด Sudden severe leg swelling",
"",
"Emergency Contact โ Dr. R. Murali: 74023 13295 / 74020 59067",
], "FDEDEC", C.red),
spacer(120),
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// SECTION 7 โ FAMILY PROTECTION
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
heading1("7. PROTECTING FAMILY MEMBERS"),
spacer(80),
heading2("How Hepatitis B Spreads"),
bullet("Through blood โ sharing razors, needles, nail cutters"),
bullet("Through sexual contact"),
bullet("From mother to baby during childbirth"),
bullet("Through tattooing / piercing with unsterilised equipment"),
bullet("NOT through: hugging, kissing on cheek, sharing food, coughing, sneezing, toilets, handshakes"),
spacer(80),
heading2("Action Plan for Every Household Member"),
spacer(60),
makeTable(
["Step", "Action", "Who Does It"],
[
["1", "Get tested for HBsAg, Anti-HBs, Anti-HBc blood tests", "All family members living in the same house"],
["2", "If tests are negative โ Get vaccinated immediately", "All non-immune family members"],
["3", "Vaccination schedule: 3 doses at 0, 1, and 6 months", "As per doctor's guidance"],
["4", "Check Anti-HBs antibody level 1 month after 3rd dose โ confirm immunity", "Doctor to advise"],
["5", "Sexual partner: Use protection until vaccination and immunity confirmed", "Patient + partner"],
["6", "Never share: razors, toothbrush, nail cutters, needles", "All family members โ permanent rule"],
["7", "Cover all wounds/cuts with bandage; avoid contact with patient's blood", "All family members"],
],
[700, 5300, 3000]
),
spacer(100),
heading2("Before Any Medical / Dental Procedure"),
bullet("Always inform the doctor, dentist, surgeon, or nurse about the Hepatitis B status BEFORE any procedure"),
bullet("This is for the healthcare worker's protection AND to ensure the right precautions are taken"),
spacer(120),
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// SECTION 8 โ MENTAL HEALTH
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
heading1("8. MENTAL HEALTH & EMOTIONAL WELLBEING"),
spacer(80),
para([
run("Living with a chronic illness like Hepatitis B can cause anxiety, fear, and sometimes depression. This is completely normal and understandable. Mental health is as important as physical health.", { size: 11 }),
]),
spacer(60),
heading2("Tips for the Patient"),
bullet("Understand that this condition is MANAGEABLE โ the medicine works and her current results are excellent"),
bullet("Share concerns openly with Dr. Murali at every visit โ no question is too small"),
bullet("Join a support group if available โ talking to others with the same condition helps"),
bullet("Avoid reading unverified information online โ it often causes unnecessary fear"),
bullet("Practice relaxation: 10โ15 minutes of deep breathing or meditation daily reduces cortisol which worsens liver inflammation"),
spacer(80),
heading2("Tips for the Family"),
bullet("Do NOT stigmatise or treat her differently โ Hepatitis B does NOT spread through normal contact"),
bullet("Encourage her to take her medicine every day โ remind her gently if needed"),
bullet("Accompany her to doctor visits โ having support helps compliance and reduces anxiety"),
bullet("Ensure she gets enough rest โ do not overburden with household responsibilities when unwell"),
bullet("Celebrate good results (like her current undetectable viral load) โ positive reinforcement matters"),
spacer(120),
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// SECTION 9 โ QUICK REFERENCE CARD
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
new Paragraph({ children: [new PageBreak()] }),
heading1("9. QUICK REFERENCE SUMMARY CARD"),
spacer(80),
makeTable(
["Category", "Key Information"],
[
["Diagnosis", "Chronic Hepatitis B โ Viral Remission on Entecavir"],
["Medicine 1", "Entecavir 0.5 mg (GEPATIT) โ 1 tablet EVERY MORNING on empty stomach"],
["Medicine 2", "Ursodeoxycholic Acid 300 mg (URZO-300) โ as prescribed"],
["NEVER DO", "Stop Entecavir without doctor's order. Drink any alcohol. Take herbal medicines."],
["Next Tests (6-monthly)", "USG Abdomen + AFP + LFT + HBV DNA Quantitative + CBC"],
["Next Tests (yearly)", "Creatinine, Fibroscan, HBsAg Quantitative, Blood Pressure"],
["Diet โ EAT", "Fruits, vegetables, lean protein, whole grains, 2.5L water/day"],
["Diet โ AVOID", "Alcohol, fried food, raw shellfish, street food, herbal tonics"],
["Exercise", "30-minute walk daily + light yoga"],
["Family", "Test all household members; vaccinate if not immune"],
["Doctor", "Dr. R. Murali MD DM (Gastro) โ 74023 13295 / 74020 59067"],
["Emergency signs", "Jaundice, vomiting blood, black stools, confusion, belly swelling โ Hospital immediately"],
],
[2200, 6800]
),
spacer(120),
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// DISCLAIMER
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
divider(),
spacer(60),
new Paragraph({
spacing: { before: 40, after: 40 },
shading: { type: ShadingType.SOLID, color: "F8F9FA", fill: "F8F9FA" },
border: {
left: { style: BorderStyle.THICK, size: 8, color: C.orange },
},
indent: { left: 200, right: 200 },
children: [
new TextRun({ text: "IMPORTANT DISCLAIMER: ", bold: true, color: C.orange, size: 18, font: "Calibri" }),
new TextRun({ text: "This document was prepared based on reports and prescriptions provided by the family and is intended as an educational family reference only. It does not constitute independent medical advice. All treatment decisions, medication changes, and medical management must be made exclusively under the supervision of the treating physician, Dr. R. Murali MD, DM (Gastroenterology & Hepatology). Prepared May 2026.", color: C.darkGray, size: 16, font: "Calibri", italics: true }),
],
}),
],
}],
});
// Write the file
Packer.toBuffer(doc).then(buffer => {
fs.writeFileSync('/home/daytona/workspace/neelavathi-care-guide/Neelavathi_Patient_Care_Guide.docx', buffer);
console.log('SUCCESS: Document created.');
}).catch(err => {
console.error('ERROR:', err);
process.exit(1);
});