~/dm-medical-record/create_dm_record.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
HeadingLevel, AlignmentType, BorderStyle, WidthType, ShadingType,
VerticalAlign, PageNumber, Header, Footer, PageBreak,
UnderlineType, TabStopType, TabStopPosition
} = require('docx');
const fs = require('fs');
// ── Colour palette ──
const DARK_BLUE = "1F3864";
const MED_BLUE = "2E74B5";
const LIGHT_BLUE = "DEEAF1";
const ACCENT_RED = "C00000";
const ACCENT_GOLD = "BF9000";
const LIGHT_GRAY = "F2F2F2";
const WHITE = "FFFFFF";
const BLACK = "000000";
// ── Helpers ──────────────────────────────────────────────────────────────────
function heading1(text) {
return new Paragraph({
heading: HeadingLevel.HEADING_1,
spacing: { before: 300, after: 120 },
children: [new TextRun({
text,
bold: true,
color: WHITE,
size: 26,
font: "Calibri",
})],
shading: { type: ShadingType.SOLID, color: DARK_BLUE },
indent: { left: 100, right: 100 },
});
}
function heading2(text) {
return new Paragraph({
heading: HeadingLevel.HEADING_2,
spacing: { before: 240, after: 80 },
border: { bottom: { style: BorderStyle.SINGLE, size: 8, color: MED_BLUE } },
children: [new TextRun({
text,
bold: true,
color: MED_BLUE,
size: 24,
font: "Calibri",
})],
});
}
function heading3(text) {
return new Paragraph({
spacing: { before: 160, after: 60 },
children: [new TextRun({
text,
bold: true,
color: DARK_BLUE,
size: 22,
font: "Calibri",
underline: { type: UnderlineType.SINGLE, color: MED_BLUE },
})],
});
}
function body(text, { bold = false, italic = false, color = BLACK, indent = 0 } = {}) {
return new Paragraph({
spacing: { after: 60 },
indent: { left: indent },
children: [new TextRun({ text, bold, italic, color, size: 20, font: "Calibri" })],
});
}
function bullet(text, { level = 0, bold = false, color = BLACK } = {}) {
return new Paragraph({
bullet: { level },
spacing: { after: 40 },
indent: { left: 360 + level * 360, hanging: 360 },
children: [new TextRun({ text, bold, color, size: 20, font: "Calibri" })],
});
}
function checkItem(label, subtext = "") {
return new Paragraph({
spacing: { after: 50 },
indent: { left: 360, hanging: 360 },
children: [
new TextRun({ text: "☐ ", bold: true, size: 20, font: "Calibri", color: MED_BLUE }),
new TextRun({ text: label, bold: true, size: 20, font: "Calibri" }),
...(subtext ? [new TextRun({ text: " — " + subtext, size: 20, font: "Calibri", color: "595959", italic: true })] : []),
],
});
}
function question(q) {
return new Paragraph({
spacing: { after: 50 },
indent: { left: 720 },
children: [
new TextRun({ text: "▶ ", size: 20, font: "Calibri", color: MED_BLUE }),
new TextRun({ text: q, size: 20, font: "Calibri", italic: true, color: "404040" }),
],
});
}
function blankField(label, lines = 1) {
const lineText = "_".repeat(55);
return new Paragraph({
spacing: { after: 80 },
children: [
new TextRun({ text: label + ": ", bold: true, size: 20, font: "Calibri", color: DARK_BLUE }),
new TextRun({ text: lineText, size: 20, font: "Calibri", color: "AAAAAA" }),
],
});
}
function spacer(n = 1) {
return new Paragraph({ spacing: { after: 80 * n }, children: [new TextRun("")] });
}
function noteBox(text, color = LIGHT_BLUE) {
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
margins: { top: 80, bottom: 80, left: 100, right: 100 },
borders: {
top: { style: BorderStyle.SINGLE, size: 6, color: MED_BLUE },
bottom: { style: BorderStyle.SINGLE, size: 6, color: MED_BLUE },
left: { style: BorderStyle.THICK, size: 16, color: MED_BLUE },
right: { style: BorderStyle.SINGLE, size: 6, color: MED_BLUE },
},
rows: [
new TableRow({
children: [
new TableCell({
shading: { type: ShadingType.SOLID, color },
children: [new Paragraph({
spacing: { before: 60, after: 60 },
children: [new TextRun({ text, size: 19, font: "Calibri", italic: true, color: "1F3864" })]
})],
}),
],
}),
],
});
}
function redBox(text) {
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
borders: {
top: { style: BorderStyle.THICK, size: 16, color: ACCENT_RED },
bottom: { style: BorderStyle.THICK, size: 16, color: ACCENT_RED },
left: { style: BorderStyle.THICK, size: 16, color: ACCENT_RED },
right: { style: BorderStyle.THICK, size: 16, color: ACCENT_RED },
},
rows: [
new TableRow({
children: [
new TableCell({
shading: { type: ShadingType.SOLID, color: "FFF0F0" },
children: [new Paragraph({
spacing: { before: 60, after: 60 },
children: [new TextRun({ text, size: 19, font: "Calibri", bold: true, color: ACCENT_RED })]
})],
}),
],
}),
],
});
}
function twoColTable(rows, headerRow = null) {
const tableRows = [];
if (headerRow) {
tableRows.push(new TableRow({
tableHeader: true,
children: headerRow.map(h => new TableCell({
shading: { type: ShadingType.SOLID, color: MED_BLUE },
verticalAlign: VerticalAlign.CENTER,
children: [new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: h, bold: true, color: WHITE, size: 20, font: "Calibri" })]
})]
}))
}));
}
rows.forEach((row, i) => {
tableRows.push(new TableRow({
children: row.map((cell, ci) => new TableCell({
shading: { type: ShadingType.SOLID, color: i % 2 === 0 ? WHITE : LIGHT_GRAY },
verticalAlign: VerticalAlign.CENTER,
children: [new Paragraph({
spacing: { before: 40, after: 40 },
indent: { left: 80 },
children: [new TextRun({ text: cell, size: 19, font: "Calibri", bold: ci === 0 })]
})]
}))
}));
});
return new Table({ width: { size: 100, type: WidthType.PERCENTAGE }, rows: tableRows });
}
function sectionDivider(label) {
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
borders: { top: { style: BorderStyle.NONE }, bottom: { style: BorderStyle.NONE }, left: { style: BorderStyle.NONE }, right: { style: BorderStyle.NONE }, insideH: { style: BorderStyle.NONE }, insideV: { style: BorderStyle.NONE } },
rows: [
new TableRow({
children: [
new TableCell({
shading: { type: ShadingType.SOLID, color: DARK_BLUE },
children: [new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { before: 80, after: 80 },
children: [new TextRun({ text: label.toUpperCase(), bold: true, color: WHITE, size: 22, font: "Calibri", characterSpacing: 100 })]
})]
})
]
})
]
});
}
// ── Title page ────────────────────────────────────────────────────────────────
function titlePage() {
return [
spacer(2),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
borders: {
top: { style: BorderStyle.THICK, size: 24, color: DARK_BLUE },
bottom: { style: BorderStyle.THICK, size: 24, color: DARK_BLUE },
left: { style: BorderStyle.THICK, size: 24, color: DARK_BLUE },
right: { style: BorderStyle.THICK, size: 24, color: DARK_BLUE },
},
rows: [
new TableRow({
children: [new TableCell({
shading: { type: ShadingType.SOLID, color: DARK_BLUE },
children: [
new Paragraph({ spacing: { before: 200, after: 80 }, alignment: AlignmentType.CENTER, children: [new TextRun({ text: "DIABETES MELLITUS", bold: true, color: WHITE, size: 44, font: "Calibri" })] }),
new Paragraph({ spacing: { before: 40, after: 40 }, alignment: AlignmentType.CENTER, children: [new TextRun({ text: "& Associated Diseases", bold: false, color: "B8D3EE", size: 32, font: "Calibri" })] }),
new Paragraph({ spacing: { before: 80, after: 40 }, alignment: AlignmentType.CENTER, children: [new TextRun({ text: "─────────────────────────────────", color: MED_BLUE, size: 20, font: "Calibri" })] }),
new Paragraph({ spacing: { before: 40, after: 40 }, alignment: AlignmentType.CENTER, children: [new TextRun({ text: "COMPREHENSIVE HISTORY-TAKING MEDICAL RECORD", bold: true, color: WHITE, size: 26, font: "Calibri", characterSpacing: 60 })] }),
new Paragraph({ spacing: { before: 40, after: 200 }, alignment: AlignmentType.CENTER, children: [new TextRun({ text: "For Medical Students & Clinicians", italic: true, color: "B8D3EE", size: 22, font: "Calibri" })] }),
]
})]
})
]
}),
spacer(2),
new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: "Based on: Harrison's Principles of Internal Medicine 22nd Ed. (2025) | Goldman-Cecil Medicine | Tintinalli's Emergency Medicine | Firestein & Kelley's Rheumatology | Campbell's Operative Orthopaedics", size: 17, font: "Calibri", italic: true, color: "595959" })]
}),
spacer(1),
new Paragraph({ children: [new PageBreak()] }),
];
}
// ═══════════════════════════════════════════════════════════════════════════════
// DOCUMENT BUILD
// ═══════════════════════════════════════════════════════════════════════════════
const doc = new Document({
numbering: {
config: [{
reference: "bullet-list",
levels: [{ level: 0, format: "bullet", text: "•", alignment: AlignmentType.LEFT, style: { paragraph: { indent: { left: 360, hanging: 260 } } } }]
}]
},
sections: [{
properties: { page: { margin: { top: 900, bottom: 900, left: 1080, right: 1080 } } },
headers: {
default: new Header({
children: [new Paragraph({
border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: MED_BLUE } },
alignment: AlignmentType.RIGHT,
children: [new TextRun({ text: "DM Comprehensive History-Taking Medical Record | ", size: 16, font: "Calibri", color: "595959" }), new TextRun({ children: [PageNumber.CURRENT], size: 16, font: "Calibri", color: MED_BLUE })]
})]
})
},
footers: {
default: new Footer({
children: [new Paragraph({
border: { top: { style: BorderStyle.SINGLE, size: 6, color: MED_BLUE } },
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: "Harrison's 22nd Ed. (2025) | Goldman-Cecil | Tintinalli's EM | Firestein & Kelley's Rheumatology | Campbell's Operative Orthopaedics", size: 15, font: "Calibri", color: "808080" })]
})]
})
},
children: [
// ── TITLE PAGE ────────────────────────────────────────────────────────
...titlePage(),
// ══════════════════════════════════════════════════════════════════════
// PART A — ADMINISTRATIVE / BIODATA
// ══════════════════════════════════════════════════════════════════════
sectionDivider("PART A — PATIENT BIODATA & ADMINISTRATIVE INFORMATION"),
spacer(),
heading2("A1. Patient Identification"),
blankField("Full Name"),
blankField("Date of Birth / Age"),
blankField("Sex"),
blankField("Ethnicity / Race"),
blankField("National ID / Hospital Number"),
blankField("Date of Consultation / Admission"),
blankField("Ward / Clinic"),
spacer(),
heading2("A2. Occupation & Social Context"),
blankField("Occupation"),
blankField("Marital Status"),
blankField("Address"),
blankField("Next of Kin / Emergency Contact"),
blankField("Informant (who gave history?)"),
blankField("Reliability of Informant (Good / Fair / Poor)"),
spacer(),
noteBox("⚠ Why occupation matters: shift workers have disrupted circadian rhythms worsening glycaemic control; sedentary workers have greater insulin resistance; drivers must be screened for hypoglycaemia unawareness."),
spacer(),
new Paragraph({ children: [new PageBreak()] }),
// ══════════════════════════════════════════════════════════════════════
// PART B — CHIEF COMPLAINT
// ══════════════════════════════════════════════════════════════════════
sectionDivider("PART B — CHIEF COMPLAINT"),
spacer(),
heading2("B1. Chief Complaint (in patient's own words)"),
noteBox("▶ Ask: \"What brings you here today?\" — Do NOT suggest symptoms. Write verbatim."),
spacer(),
blankField("Chief Complaint"),
blankField("Duration of Complaint"),
spacer(),
heading2("B2. Is the Patient Newly Diagnosed or Known Diabetic?"),
checkItem("Newly presenting — establish diagnosis, classify type, assess baseline"),
checkItem("Known diabetic — assess glycaemic control, complications, current treatment"),
spacer(),
new Paragraph({ children: [new PageBreak()] }),
// ══════════════════════════════════════════════════════════════════════
// PART C — HISTORY OF PRESENTING ILLNESS
// ══════════════════════════════════════════════════════════════════════
sectionDivider("PART C — HISTORY OF PRESENTING ILLNESS (HPI)"),
spacer(),
heading2("C1. Symptoms of Hyperglycaemia — The 'Polys' + More"),
noteBox("Use SOCRATES for each symptom: Site · Onset · Character · Radiation · Associations · Time course · Exacerbating/Relieving factors · Severity"),
spacer(),
heading3("Polyuria (Excessive Urination)"),
checkItem("Frequency of urination per day"),
question("\"How many times do you urinate in a day?\""),
checkItem("Nocturia — waking at night to urinate"),
question("\"Do you wake up at night to urinate? How many times?\""),
question("\"Do ants appear where you urinate?\" (classical sign of glycosuria)"),
blankField("Polyuria details"),
spacer(),
heading3("Polydipsia (Excessive Thirst)"),
checkItem("Unusual or excessive thirst"),
question("\"Do you feel unusually thirsty compared to before?\""),
question("\"How many litres of fluid do you drink daily?\""),
question("\"Does drinking relieve the thirst only briefly?\""),
blankField("Polydipsia details"),
spacer(),
heading3("Polyphagia (Excessive Hunger)"),
checkItem("Increased appetite or hunger soon after eating"),
question("\"Is your appetite increased? Do you feel hungry soon after a full meal?\""),
blankField("Polyphagia details"),
spacer(),
heading3("Weight Changes"),
checkItem("Unexplained weight loss (common in T1DM and uncontrolled T2DM)"),
checkItem("Weight gain (insulin therapy, T2DM with metabolic syndrome)"),
question("\"Have you lost or gained weight without trying?\""),
question("\"How much weight? Over what period of time?\""),
blankField("Weight change (amount / duration)"),
spacer(),
heading3("Fatigue, Weakness & Other Symptoms"),
checkItem("Fatigue / tiredness — present even at rest?"),
checkItem("General weakness in arms or legs"),
checkItem("Blurred vision — one or both eyes? Constant or fluctuating?"),
question("\"Has your vision changed recently? Is it worse when your blood sugar is high?\""),
checkItem("Recurrent infections — skin, genital (candidiasis), urinary tract"),
question("\"Do you get frequent infections — itching, discharge, or burning in the genital area?\""),
checkItem("Slow wound healing — cuts or sores taking longer than usual"),
question("\"Do wounds or sores heal slowly or refuse to close?\""),
blankField("Other symptoms / narrative"),
spacer(),
heading2("C2. Onset and Mode of Presentation"),
twoColTable([
["Sudden onset (days to weeks) + DKA symptoms", "Suggests Type 1 DM or Insulin-deficient T2DM"],
["Gradual onset (months to years) + obesity + family history", "Suggests Type 2 DM"],
["Young, non-obese, strong family history", "Consider MODY (Maturity-Onset DM of Youth)"],
["Steroid use / recent illness / pancreatic surgery", "Consider Secondary DM"],
["Pregnancy", "Consider Gestational DM"],
], ["Clinical Clue", "Type Suggested"]),
spacer(),
heading2("C3. Acute Decompensation Screen — Rule Out Emergencies FIRST"),
redBox("⚠ SCREEN FOR THESE BEFORE CONTINUING — ANY POSITIVE REQUIRES URGENT ACTION"),
spacer(),
checkItem("Nausea, vomiting, abdominal pain, fruity/acetone breath → SUSPECT DKA"),
question("\"Do you have nausea, vomiting, or stomach pain?\" \"Has anyone noticed a fruity smell on your breath?\""),
checkItem("Extreme thirst, confusion, drowsiness, no ketones → SUSPECT HHS (Hyperosmolar Hyperglycaemic State)"),
question("\"Are you more confused than usual? Has anyone noticed you seem drowsy or disoriented?\""),
checkItem("Sweating, shaking, palpitations, confusion, hunger → SUSPECT HYPOGLYCAEMIA"),
question("\"Do you feel shaky, sweaty, or confused, especially if you missed a meal?\""),
spacer(),
new Paragraph({ children: [new PageBreak()] }),
// ══════════════════════════════════════════════════════════════════════
// PART D — GLYCAEMIC CONTROL HISTORY
// ══════════════════════════════════════════════════════════════════════
sectionDivider("PART D — GLYCAEMIC CONTROL HISTORY"),
spacer(),
heading2("D1. Diagnosis and Duration"),
blankField("When was DM first diagnosed?"),
blankField("How was it discovered? (routine test / symptoms / complication)"),
blankField("Type of DM (T1 / T2 / Gestational / MODY / Secondary)"),
spacer(),
heading2("D2. Monitoring"),
checkItem("Self-monitoring of blood glucose (SMBG) at home?"),
question("\"Do you check your blood sugar at home using a glucometer?\""),
question("\"How often do you check?\""),
blankField("Typical fasting morning blood glucose (mmol/L or mg/dL)"),
blankField("Typical 2-hour post-meal blood glucose"),
blankField("Most recent HbA1c result and date"),
spacer(),
heading2("D3. Hypoglycaemia Episodes"),
checkItem("History of low blood sugar episodes?"),
question("\"Have you ever had episodes of feeling shaky, sweaty, confused, or very hungry?\""),
blankField("Frequency of hypoglycaemia (times per week/month)"),
checkItem("Severity — mild (self-treated) / severe (needed help from others)"),
checkItem("Hypoglycaemia unawareness — has patient LOST warning signs?"),
question("\"Do you still feel warning signs (sweating, shakiness) before your sugar goes low?\""),
noteBox("⚠ CRITICAL: Hypoglycaemia unawareness dramatically increases the risk of severe episodes. Report to supervisor immediately. This patient MUST NOT drive until reviewed."),
blankField("Hypoglycaemia details / frequency / unawareness (Y/N)"),
spacer(),
heading2("D4. Previous Hospital Admissions for DM"),
checkItem("DKA episodes — how many? Most recent?"),
checkItem("HHS (diabetic coma) — how many? Most recent?"),
checkItem("Hypoglycaemia requiring emergency services or hospital?"),
blankField("Admission history details"),
spacer(),
new Paragraph({ children: [new PageBreak()] }),
// ══════════════════════════════════════════════════════════════════════
// PART E — COMPLICATIONS SCREENING
// ══════════════════════════════════════════════════════════════════════
sectionDivider("PART E — COMPLICATIONS SCREENING (Systematic by System)"),
spacer(),
noteBox("Tell the patient: \"I am now going to ask about different parts of your body to make sure everything is being checked carefully.\""),
spacer(),
heading2("E1. 👁 Eyes — Diabetic Retinopathy"),
checkItem("Change in vision — blurring, dark spots, floaters, flashes"),
question("\"Has your vision changed recently? Do you see floaters or flashing lights?\""),
checkItem("Sudden loss of vision in one or both eyes"),
question("\"Have you ever had a sudden loss of vision?\""),
checkItem("Previous fundoscopy / retinal screening — when, where, result?"),
question("\"Has a doctor ever examined the back of your eyes with a special instrument?\""),
checkItem("Laser treatment or eye injections (anti-VEGF) for retinopathy?"),
checkItem("Diplopia (double vision) — may indicate diabetic mononeuropathy of CN III, IV, VI"),
blankField("Eye complaint details / last fundoscopy date"),
spacer(),
heading2("E2. 🫘 Kidneys — Diabetic Nephropathy"),
checkItem("Foamy or frothy urine (proteinuria)"),
question("\"Have you noticed your urine becoming foamy or bubbly?\""),
checkItem("Ankle, leg, or periorbital swelling (oedema from hypoalbuminaemia)"),
question("\"Do your ankles or feet swell? Do you notice swelling around your eyes in the morning?\""),
checkItem("Told kidneys are not working properly / low eGFR"),
checkItem("Any history of dialysis or kidney transplant?"),
question("\"Have you ever been on dialysis? Have doctors told you to restrict your fluid or protein intake?\""),
blankField("Renal complaint details / last eGFR / last urine ACR"),
spacer(),
heading2("E3. 🦶 Feet & Lower Limbs — Neuropathy + Peripheral Arterial Disease"),
heading3("Peripheral Neuropathy"),
checkItem("Numbness, tingling, or burning sensation in feet or hands"),
question("\"Do you feel tingling, numbness, or a burning pain in your feet or hands?\""),
question("\"Is the pain or tingling worse at night?\""),
checkItem("\"Feels like walking on cotton wool, sand, or wearing thick socks\""),
checkItem("Loss of ability to feel heat, cold, or sharp objects in feet"),
question("\"Can you feel the difference between hot and cold water on your feet?\""),
checkItem("Falls or loss of balance due to sensory loss"),
heading3("Peripheral Arterial Disease"),
checkItem("Calf or thigh pain when walking that goes away with rest (claudication)"),
question("\"Do you get pain in your calves when you walk a certain distance, that disappears when you stop?\""),
checkItem("Rest pain (pain even when not walking — indicates severe ischaemia)"),
heading3("Foot Ulcers and Charcot"),
checkItem("Current or previous foot ulcers / wounds not healing"),
question("\"Do you have any sores or wounds on your feet that are not healing?\""),
checkItem("Previous foot surgeries or amputations"),
checkItem("Swollen, hot, red foot without pain (Charcot foot — emergency)"),
checkItem("Does the patient check their own feet daily?"),
checkItem("Type of footwear — ill-fitting shoes, no socks, barefoot walking?"),
blankField("Foot complaint details / last foot exam date"),
spacer(),
heading2("E4. ❤️ Cardiovascular — Macrovascular Disease"),
checkItem("Chest pain, pressure, or tightness — at rest or on exertion?"),
question("\"Do you have chest pain or tightness, especially when climbing stairs or walking fast?\""),
question("\"Diabetics can have silent heart attacks without chest pain — do you feel unusually short of breath or very tired with exertion?\""),
checkItem("Shortness of breath on exertion or lying flat (orthopnoea — heart failure)"),
checkItem("Palpitations or irregular heartbeat"),
checkItem("Previous heart attack, angina, coronary stenting, or bypass surgery"),
checkItem("Previous stroke or TIA (sudden weakness, speech difficulty, facial droop)"),
checkItem("Leg swelling and breathlessness together (heart failure)"),
blankField("Cardiovascular complaint details"),
spacer(),
heading2("E5. 🧠 Nervous System — Autonomic Neuropathy"),
checkItem("Postural dizziness / lightheadedness when standing up (orthostatic hypotension)"),
question("\"Do you feel dizzy or faint when you stand up from sitting or lying?\""),
checkItem("Early satiety — feeling full very quickly after a small amount of food (gastroparesis)"),
question("\"Do you feel very full after eating just a small meal? Do you have nausea or vomiting after eating?\""),
checkItem("Bloating, upper abdominal discomfort after meals"),
checkItem("Alternating constipation and diarrhoea (diabetic enteric neuropathy)"),
question("\"Are your bowels unpredictable — sometimes very constipated, sometimes loose?\""),
checkItem("Difficulty starting urination, incomplete bladder emptying (diabetic cystopathy)"),
question("\"Do you have to strain to pass urine or feel like your bladder never fully empties?\""),
checkItem("Erectile dysfunction — ask sensitively and privately (male patients)"),
question("\"[Private setting] Do you experience any difficulty with erections?\""),
checkItem("Reduced sweating in feet / excessive sweating elsewhere (gustatory sweating)"),
checkItem("Falls due to postural hypotension"),
blankField("Autonomic neuropathy details"),
spacer(),
heading2("E6. 🦴 Musculoskeletal Complications"),
checkItem("Hand stiffness — unable to press palms flat together (cheiroarthropathy / Prayer sign)"),
question("\"Do you have difficulty fully straightening or flattening your fingers?\""),
checkItem("Shoulder stiffness or pain — difficulty raising arm above head (frozen shoulder / adhesive capsulitis)"),
question("\"Do you have difficulty raising your arm or rotating your shoulder?\""),
checkItem("Thickened cords or nodules in the palm with finger contracture (Dupuytren's)"),
checkItem("Locking or triggering of fingers when bending and straightening (trigger finger)"),
checkItem("Numbness or tingling in thumb, index, and middle fingers — worse at night (CTS)"),
checkItem("Proximal thigh weakness and pain — asymmetric (diabetic amyotrophy)"),
question("\"Do you have severe pain and weakness in one thigh that came on over weeks?\""),
blankField("MSK complaint details"),
spacer(),
new Paragraph({ children: [new PageBreak()] }),
// ══════════════════════════════════════════════════════════════════════
// PART F — PAST MEDICAL HISTORY
// ══════════════════════════════════════════════════════════════════════
sectionDivider("PART F — PAST MEDICAL HISTORY"),
spacer(),
heading2("F1. Comorbid Conditions (tick all that apply and record year of diagnosis)"),
twoColTable([
["Hypertension", "Year: _______ Controlled? Y / N"],
["Dyslipidaemia (high cholesterol / triglycerides)", "Year: _______ On statin? Y / N"],
["Coronary artery disease / Angina / Previous MI", "Year: _______ Stented / CABG? Y / N"],
["Heart failure", "Year: _______ EF known? ____"],
["Stroke / TIA", "Year: _______ Any residual deficit?"],
["Peripheral arterial disease", "Year: _______ ABI known? ____"],
["Chronic kidney disease (CKD)", "Year: _______ Stage: ____ eGFR: ____"],
["Diabetic retinopathy", "Year: _______ Laser / injection treatment? Y / N"],
["Peripheral neuropathy", "Year: _______ On treatment? Y / N"],
["Thyroid disease (hypothyroid / hyperthyroid)", "Year: _______ On thyroxine? Y / N"],
["NAFLD / NASH (fatty liver)", "Year: _______ Biopsy done? Y / N"],
["Sleep apnoea (OSA)", "Year: _______ On CPAP? Y / N"],
["PCOS (polycystic ovary syndrome)", "Year: _______ (Women only)"],
["Gestational diabetes", "Year: _______ Which pregnancy?"],
["Pancreatitis / pancreatic surgery", "Year: _______ Details: ______"],
["Previous foot ulcer / amputation", "Year: _______ Level: ______"],
["Previous surgery (any)", "Year: _______ Type: ______"],
["Other autoimmune disease (coeliac, Addison's, thyroiditis)", "Details: ______"],
], ["Condition", "Details"]),
spacer(),
heading2("F2. Hospitalisations Related to Diabetes"),
blankField("Hospital admission history"),
spacer(),
new Paragraph({ children: [new PageBreak()] }),
// ══════════════════════════════════════════════════════════════════════
// PART G — DRUG & TREATMENT HISTORY
// ══════════════════════════════════════════════════════════════════════
sectionDivider("PART G — DRUG & TREATMENT HISTORY"),
spacer(),
heading2("G1. Current Diabetes Medications"),
twoColTable([
["Metformin", "Dose: ___mg Frequency: ___ Compliant? Y/N"],
["Sulfonylurea (gliclazide / glibenclamide)", "Dose: ___mg Frequency: ___ Compliant? Y/N"],
["SGLT2 inhibitor (empagliflozin / dapagliflozin)", "Dose: ___mg Frequency: ___ Compliant? Y/N"],
["GLP-1 agonist (semaglutide / liraglutide)", "Dose: ___mg Frequency: ___ Compliant? Y/N"],
["DPP-4 inhibitor (sitagliptin / vildagliptin)", "Dose: ___mg Frequency: ___ Compliant? Y/N"],
["Thiazolidinedione (pioglitazone)", "Dose: ___mg Frequency: ___ Compliant? Y/N"],
["Basal insulin (glargine / detemir / degludec)", "Dose: ___units Time: ___ Site: ___"],
["Short-acting insulin (aspart / lispro / regular)", "Dose: ___units Meals: ___ Site: ___"],
["Mixed insulin (70/30, biphasic)", "Dose: ___units Frequency: ___ Site: ___"],
], ["Drug Class", "Details / Dose / Compliance"]),
spacer(),
heading2("G2. Other Medications"),
twoColTable([
["ACE inhibitor / ARB (renoprotective)", "Name: _____ Dose: _____"],
["Antihypertensive (other)", "Name: _____ Dose: _____"],
["Statin (cholesterol)", "Name: _____ Dose: _____"],
["Antiplatelet / Aspirin", "Dose: _____"],
["Diuretic (water tablet)", "Name: _____ — NOTE: worsens glycaemia"],
["Corticosteroids (prednisolone, dexamethasone)", "Name: _____ — NOTE: causes steroid hyperglycaemia"],
["Antipsychotics (olanzapine, clozapine)", "Name: _____ — NOTE: cause insulin resistance"],
["Thyroid medication (thyroxine)", "Dose: _____"],
["Beta-blocker (masks hypoglycaemia symptoms)", "Name: _____"],
["Herbal / traditional medicine", "Details: _____"],
], ["Medication", "Details / Notes"]),
spacer(),
heading2("G3. Allergies"),
blankField("Drug allergies (name of drug and reaction)"),
blankField("Food / other allergies"),
spacer(),
heading2("G4. Compliance Assessment"),
checkItem("Does the patient take medications every day?"),
question("\"Do you ever miss doses? If yes — how often and why?\""),
checkItem("Reason for non-compliance: cost / side effects / forgetfulness / denial?"),
checkItem("Insulin technique — correct injection sites? Rotating sites? Storing insulin correctly?"),
question("\"Where do you inject your insulin? Do you rotate the injection sites?\""),
checkItem("Lipohypertrophy — firm nodules at injection sites causing erratic absorption?"),
blankField("Compliance details"),
spacer(),
new Paragraph({ children: [new PageBreak()] }),
// ══════════════════════════════════════════════════════════════════════
// PART H — FAMILY HISTORY
// ══════════════════════════════════════════════════════════════════════
sectionDivider("PART H — FAMILY HISTORY"),
spacer(),
twoColTable([
["Father", "DM? ___ HTN? ___ CVD? ___ Other: ___ Status: Alive/Deceased"],
["Mother", "DM? ___ HTN? ___ CVD? ___ Other: ___ Status: Alive/Deceased"],
["Sibling 1", "DM? ___ HTN? ___ CVD? ___ Other: ___"],
["Sibling 2", "DM? ___ HTN? ___ CVD? ___ Other: ___"],
["Grandparents", "DM? ___ HTN? ___ CVD? ___ Other: ___"],
["Children", "DM? ___ HTN? ___ Other: ___"],
], ["Relation", "Relevant Medical History"]),
spacer(),
noteBox("Strong family history of T2DM + obesity = insulin resistance trait. Family history of T1DM in first-degree relative increases risk ~5–10%. Early CVD in first-degree male relative (<55 yrs) or female relative (<65 yrs) = major independent cardiovascular risk factor."),
spacer(),
new Paragraph({ children: [new PageBreak()] }),
// ══════════════════════════════════════════════════════════════════════
// PART I — SOCIAL HISTORY
// ══════════════════════════════════════════════════════════════════════
sectionDivider("PART I — SOCIAL HISTORY"),
spacer(),
heading2("I1. Smoking"),
checkItem("Current smoker?"),
question("\"Do you smoke cigarettes, roll-your-own, or use any tobacco products?\""),
blankField("Cigarettes per day"),
blankField("Years of smoking"),
blankField("Pack-years = (cigarettes per day ÷ 20) × years"),
checkItem("Ex-smoker — when did they stop?"),
checkItem("Non-smoker — confirm"),
noteBox("Smoking doubles cardiovascular risk in diabetes, impairs wound healing, and worsens peripheral arterial disease. Cessation is a top priority in every DM patient."),
spacer(),
heading2("I2. Alcohol"),
checkItem("Does the patient drink alcohol?"),
question("\"Do you drink alcohol? What type? How many drinks per week?\""),
blankField("Type of alcohol / units per week"),
noteBox("Alcohol can cause hypoglycaemia (especially with insulin or sulfonylurea) by inhibiting hepatic gluconeogenesis. It also raises triglycerides and blood pressure. Ask about binge drinking."),
spacer(),
heading2("I3. Diet Assessment"),
checkItem("Typical daily meal pattern — breakfast, lunch, dinner, snacks?"),
question("\"Can you describe what you usually eat from morning to bedtime?\""),
checkItem("Amount of high-GI carbohydrates: white rice, bread, noodles, sugar, sweet drinks?"),
question("\"How much rice, bread, or sugary drinks do you consume daily?\""),
checkItem("Meal regularity — does the patient skip meals?"),
checkItem("Following a diabetic diet or dietitian advice?"),
checkItem("Fruit and vegetable intake?"),
blankField("Dietary summary"),
spacer(),
heading2("I4. Physical Activity"),
checkItem("Any regular exercise?"),
question("\"How active are you during the day? Do you do any planned exercise?\""),
blankField("Type of exercise"),
blankField("Frequency (days per week)"),
blankField("Duration (minutes per session)"),
noteBox("Regular aerobic exercise reduces HbA1c by approximately 0.6% independently of diet. Target: 150 min/week of moderate activity (brisk walking, swimming)."),
spacer(),
heading2("I5. Occupation and Daily Routine"),
checkItem("Nature of work — sedentary / physical / shift work?"),
question("\"Do you work night shifts?\" (disrupts circadian rhythm and glycaemic control)"),
checkItem("Does the patient drive? — CRITICAL for hypoglycaemia risk counselling"),
question("\"Do you drive a car or operate machinery?\" (Inform patient of DVLA/driving authority rules for DM)"),
blankField("Occupation details"),
spacer(),
heading2("I6. Social Support and Socioeconomic Factors"),
checkItem("Living situation — alone / with family / in care facility?"),
checkItem("Financial capability to afford medications, glucose strips, insulin?"),
question("\"Are you able to afford all your diabetes medications and testing supplies?\""),
checkItem("Social support — someone at home who can help if hypoglycaemia occurs?"),
checkItem("Health literacy — does the patient understand their disease and treatment?"),
blankField("Social support details"),
spacer(),
heading2("I7. Reproductive History (Women of Childbearing Age)"),
checkItem("Currently pregnant or planning pregnancy?"),
question("\"Are you pregnant or planning to become pregnant in the near future?\""),
noteBox("ADA recommends HbA1c <6.5% (48 mmol/mol) before conception to minimise congenital malformation risk. All women of childbearing age must be counselled about this."),
checkItem("Contraception in use?"),
checkItem("History of gestational diabetes? Which pregnancy? Current status?"),
blankField("Reproductive history details"),
spacer(),
new Paragraph({ children: [new PageBreak()] }),
// ══════════════════════════════════════════════════════════════════════
// PART J — REVIEW OF SYSTEMS
// ══════════════════════════════════════════════════════════════════════
sectionDivider("PART J — REVIEW OF SYSTEMS (SYSTEMATIC SCREEN)"),
spacer(),
noteBox("\"I am going to quickly ask about a few other body systems to make sure we haven't missed anything.\""),
spacer(),
twoColTable([
["General", "☐ Fever / night sweats ☐ Unintentional weight change ☐ Fatigue"],
["Skin", "☐ Pruritus / itching ☐ Rashes ☐ Non-healing wounds ☐ Skin discolouration"],
["Head", "☐ Headaches ☐ Dizziness (postural?)"],
["Eyes", "☐ Visual changes ☐ Double vision ☐ Eye pain or redness"],
["ENT", "☐ Oral sores (candidiasis) ☐ Difficulty swallowing ☐ Gum disease"],
["Respiratory", "☐ Cough ☐ Shortness of breath ☐ Snoring / daytime sleepiness (OSA)"],
["Cardiovascular", "☐ Chest pain ☐ Palpitations ☐ Ankle swelling ☐ Orthopnoea"],
["Gastrointestinal", "☐ Nausea / vomiting ☐ Heartburn ☐ Abdominal pain ☐ Bowel changes"],
["Genitourinary", "☐ Foamy urine ☐ Dysuria / frequency ☐ Sexual dysfunction"],
["Musculoskeletal", "☐ Joint stiffness ☐ Shoulder pain ☐ Hand contractures ☐ Foot deformity"],
["Neurological", "☐ Numbness / tingling ☐ Weakness ☐ Falls ☐ Memory problems"],
["Psychiatric", "☐ Low mood / depression ☐ Anxiety ☐ Sleep disturbance"],
["Endocrine", "☐ Cold/heat intolerance (thyroid) ☐ Increased thirst / urination"],
], ["System", "Symptoms — Tick if Positive"]),
spacer(),
new Paragraph({ children: [new PageBreak()] }),
// ══════════════════════════════════════════════════════════════════════
// PART K — CLINICAL EXAMINATION
// ══════════════════════════════════════════════════════════════════════
sectionDivider("PART K — CLINICAL EXAMINATION CHECKLIST"),
spacer(),
noteBox("\"I would like to examine you now. I will start from your general appearance. Please tell me if anything is uncomfortable.\" — Always explain what you are doing before you do it."),
spacer(),
heading2("K1. General Examination"),
twoColTable([
["General appearance", "☐ Well / Unwell ☐ Obese / Thin ☐ Cushingoid ☐ Acutely ill"],
["Weight (kg)", ""],
["Height (cm)", ""],
["BMI (kg/m²)", "Target: 18.5–24.9 | Obese: ≥30"],
["Waist circumference", "M: >90 cm (Asian) / >102 cm (Western) F: >80 cm / >88 cm = central obesity"],
["Kussmaul breathing (deep sighing)", "Suggests DKA — URGENT"],
["Fruity / acetone breath odour", "Suggests DKA — URGENT"],
], ["Parameter", "Finding"]),
spacer(),
heading2("K2. Vital Signs"),
twoColTable([
["Blood pressure (right arm)", "mmHg | Target <130/80 (with CKD/CVD) | <140/90 (general)"],
["Blood pressure (left arm)", "mmHg | Difference >10 mmHg = investigate for subclavian stenosis"],
["Orthostatic BP — Supine", "mmHg"],
["Orthostatic BP — Standing 1 min", "mmHg | Drop ≥20 systolic / ≥10 diastolic = autonomic neuropathy"],
["Orthostatic BP — Standing 3 min", "mmHg"],
["Heart rate", "bpm | Resting tachycardia = autonomic neuropathy; irregular = AF (risk in DM)"],
["Respiratory rate", "breaths/min"],
["Temperature", "°C | Fever = suspect infection"],
["SpO2", "%"],
["Blood glucose (capillary)", "mmol/L — document time relative to last meal"],
], ["Vital Sign", "Value / Normal Range / Clinical Significance"]),
spacer(),
heading2("K3. Hands and Upper Limb MSK Examination"),
twoColTable([
["General hand inspection", "☐ Thenar wasting (CTS) ☐ Skin thickening ☐ Colour changes"],
["Prayer sign", "☐ Normal ☐ Positive (gap = cheiroarthropathy / LJM)"],
["Tabletop sign", "☐ Normal ☐ Positive (cannot flatten fingers on table)"],
["Dupuytren's contracture", "☐ Absent ☐ Nodules ☐ Cords ☐ Flexion contracture (ring/little finger)"],
["Trigger finger (tenosynovitis)", "☐ Absent ☐ Click/locking Finger(s): _______"],
["Tinel's sign (tap carpal tunnel)", "☐ Negative ☐ Positive (tingling in median distribution)"],
["Phalen's maneuver (wrist flexion 60s)", "☐ Negative ☐ Positive (paresthesia in median distribution)"],
["Durkan's compression test", "☐ Negative ☐ Positive"],
["Capillary refill", "seconds (Normal: <2 sec)"],
], ["Test", "Finding"]),
spacer(),
heading2("K4. Head, Eyes, Ears, Nose, Throat"),
twoColTable([
["Visual acuity (Snellen chart)", "R: ___/___ L: ___/___"],
["Rubeosis iridis (neovascularisation of iris)", "☐ Absent ☐ Present — URGENT ophthalmology referral"],
["Fundoscopy", "☐ Normal ☐ Microaneurysms ☐ Haemorrhages ☐ Exudates ☐ Neovascularisation"],
["Xanthelasma (periorbital)", "☐ Absent ☐ Present (dyslipidaemia)"],
["Oral candidiasis", "☐ Absent ☐ Present (white plaques — poor glycaemic control)"],
["Gum disease / periodontitis", "☐ Absent ☐ Present (more common in DM)"],
["Thyroid palpation", "☐ Normal ☐ Goitre ☐ Nodule(s)"],
["Carotid bruit", "R: ☐ Present ☐ Absent L: ☐ Present ☐ Absent"],
], ["Area", "Finding"]),
spacer(),
heading2("K5. Cardiovascular Examination"),
twoColTable([
["JVP", "cm H2O — elevated in heart failure"],
["Apex beat", "☐ Normal position ☐ Displaced (cardiomegaly)"],
["Heart sounds", "☐ Normal S1 S2 ☐ S3 (heart failure) ☐ S4 (diastolic dysfunction) ☐ Murmurs"],
["Aortic bruit (abdominal auscultation)", "☐ Absent ☐ Present"],
["Renal bruit (renal artery auscultation)", "☐ Absent ☐ Present"],
["Femoral pulse", "R: ___/2+ L: ___/2+"],
["Popliteal pulse", "R: ___/2+ L: ___/2+"],
["Posterior tibial pulse", "R: ___/2+ L: ___/2+"],
["Dorsalis pedis pulse", "R: ___/2+ L: ___/2+"],
["Ankle-Brachial Index (ABI)", "R: ___ L: ___ (Normal 1.0–1.4; PAD <0.9)"],
], ["Finding", "Result"]),
spacer(),
heading2("K6. Abdominal Examination"),
twoColTable([
["Liver (NAFLD — hepatomegaly)", "☐ Normal ☐ Enlarged ___cm below costal margin ☐ Tender"],
["Renal angle tenderness", "R: ☐ Present ☐ Absent L: ☐ Present ☐ Absent (pyelonephritis risk in DM)"],
["Insulin injection sites", "☐ Normal ☐ Lipohypertrophy (describe site and size)"],
["Generalised oedema (ascites / fluid)", "☐ Absent ☐ Present (renal/cardiac failure)"],
], ["Area", "Finding"]),
spacer(),
heading2("K7. Skin Examination"),
twoColTable([
["Acanthosis nigricans (neck, axillae, groin)", "☐ Absent ☐ Present — indicates insulin resistance"],
["Necrobiosis lipoidica diabeticorum (anterior tibiae)", "☐ Absent ☐ Present (yellow-brown waxy atrophic plaques)"],
["Diabetic dermopathy ('shin spots')", "☐ Absent ☐ Present (bilateral round brown macules on shins)"],
["Eruptive xanthomas", "☐ Absent ☐ Present (yellow papules = severe hypertriglyceridaemia)"],
["Tinea pedis / onychomycosis", "☐ Absent ☐ Present"],
["Lipoatrophy at injection sites", "☐ Absent ☐ Present"],
["Lipohypertrophy at injection sites", "☐ Absent ☐ Present — Site(s): ___________"],
["Non-healing wounds / cellulitis", "☐ Absent ☐ Present — Location: ___________"],
], ["Finding", "Result"]),
spacer(),
heading2("K8. Comprehensive Foot Examination"),
redBox("MANDATORY AT EVERY ENCOUNTER — Remove shoes AND socks. Document every finding precisely."),
spacer(),
heading3("Inspection"),
twoColTable([
["Hallux valgus (bunion)", "R: ☐ Present ☐ Absent L: ☐ Present ☐ Absent"],
["Claw toes / hammer toes / mallet toes", "R: ☐ Present ☐ Absent L: ☐ Present ☐ Absent"],
["Charcot foot (hot, swollen, deformed midfoot)", "R: ☐ Present ☐ Absent L: ☐ Present ☐ Absent — URGENT if present"],
["Calluses (mark high-pressure sites)", "Location: ___________"],
["Ulcers — size, depth, wound base, surrounding tissue", "Location / Dimensions / Depth: ___________"],
["Probe-to-bone test (if ulcer present)", "☐ Negative ☐ Positive — strongly suggests osteomyelitis"],
["Skin condition (dry, cracked, macerated)", "Description: ___________"],
["Interdigital spaces (maceration, fungal)", "☐ Normal ☐ Maceration ☐ Fungal infection"],
["Nails (onychomycosis, ingrown, subungual ulcer)", "Description: ___________"],
["Hair loss on dorsal foot (ischaemia)", "☐ Present ☐ Absent"],
["Skin colour changes (pallor, rubor, cyanosis)", "Description: ___________"],
], ["Finding", "Result"]),
spacer(),
heading3("Neurological Assessment of Foot"),
twoColTable([
["10g monofilament (plantar surface — 10 sites per foot)", "R: ___/10 felt L: ___/10 felt (Loss at any site = LOPS)"],
["128-Hz tuning fork — hallux IP joint", "R: ☐ Present ☐ Absent L: ☐ Present ☐ Absent"],
["128-Hz tuning fork — medial malleolus", "R: ☐ Present ☐ Absent L: ☐ Present ☐ Absent"],
["Pin-prick sensation (dorsum of foot)", "R: ☐ Normal ☐ Reduced ☐ Absent L: ☐ Normal ☐ Reduced ☐ Absent"],
["Temperature discrimination", "R: ☐ Normal ☐ Reduced L: ☐ Normal ☐ Reduced"],
["Proprioception (hallux up/down)", "R: ☐ Normal ☐ Impaired L: ☐ Normal ☐ Impaired"],
["Ankle jerk reflex (S1)", "R: 0/1+/2+/3+ L: 0/1+/2+/3+"],
["Patellar reflex (L3-L4)", "R: 0/1+/2+/3+ L: 0/1+/2+/3+"],
["Capillary refill time (toenail)", "R: ___sec L: ___sec (Normal <2 sec)"],
], ["Assessment", "Result"]),
spacer(),
heading3("Tendon and Joint Assessment"),
twoColTable([
["Achilles tendon — thickening / tightness", "☐ Normal ☐ Tight (equinus) ☐ Thickened"],
["Silfverskiöld test (gastrocnemius vs Achilles equinus)", "Knee extended dorsiflexion: ___° Knee flexed: ___°"],
["Plantar fascia thickening / heel tenderness", "☐ Normal ☐ Tender at calcaneal insertion"],
["Windlass test (passive hallux dorsiflexion)", "☐ Negative ☐ Positive (heel pain reproduced)"],
["Subtalar joint inversion / eversion", "R: ___°/___° L: ___°/___° (Normal: Inv 30°, Ev 15°)"],
["First MTP joint dorsiflexion", "R: ___° L: ___° (Normal: 65–75°)"],
], ["Test", "Finding"]),
spacer(),
heading2("K9. Shoulder Examination (Adhesive Capsulitis Screening)"),
twoColTable([
["Active abduction", "R: ___° L: ___° (Normal 180°)"],
["Active forward flexion", "R: ___° L: ___° (Normal 180°)"],
["Active external rotation", "R: ___° L: ___° (Normal 60–80°) — MOST RESTRICTED in frozen shoulder"],
["Active internal rotation (reach behind back)", "R: reaches T___ L: reaches T___ (Normal T7–T10)"],
["Passive external rotation", "R: ___° L: ___°"],
["Passive abduction", "R: ___° L: ___°"],
["Capsular pattern confirmed?", "☐ Yes (ER > Abduction > IR) ☐ No"],
], ["Movement", "Result"]),
spacer(),
heading2("K10. Proximal Muscle Assessment (Diabetic Amyotrophy Screen)"),
twoColTable([
["Thigh circumference at 15cm above patella", "R: ___cm L: ___cm (>2cm difference = significant wasting)"],
["Hip flexion power (L2-L3, iliopsoas)", "R: MRC ___/5 L: MRC ___/5"],
["Knee extension power (L3-L4, quadriceps)", "R: MRC ___/5 L: MRC ___/5"],
["Hip abduction power (L4-L5, gluteus medius)", "R: MRC ___/5 L: MRC ___/5"],
["Gait observation", "☐ Normal ☐ Trendelenburg ☐ Waddling ☐ Antalgic"],
], ["Assessment", "Result"]),
spacer(),
new Paragraph({ children: [new PageBreak()] }),
// ══════════════════════════════════════════════════════════════════════
// PART L — INVESTIGATIONS
// ══════════════════════════════════════════════════════════════════════
sectionDivider("PART L — INVESTIGATIONS"),
spacer(),
heading2("L1. Diagnostic Criteria (ADA) — Confirm or Exclude DM"),
twoColTable([
["Fasting plasma glucose ≥7.0 mmol/L (126 mg/dL)", "Result: _____ mmol/L ☐ Normal ☐ Pre-DM ☐ DM"],
["Random glucose ≥11.1 mmol/L + symptoms", "Result: _____ mmol/L ☐ Normal ☐ DM"],
["2-hr OGTT (75g) ≥11.1 mmol/L", "Result: _____ mmol/L ☐ Normal ☐ IGT ☐ DM"],
["HbA1c ≥48 mmol/mol (≥6.5%)", "Result: _____ mmol/mol (___%) ☐ Normal ☐ Pre-DM ☐ DM"],
], ["Test", "Result"]),
spacer(),
noteBox("Pre-diabetes: FPG 5.6–6.9 mmol/L | 2-hr OGTT 7.8–11.0 mmol/L | HbA1c 39–47 mmol/mol (5.7–6.4%)"),
spacer(),
heading2("L2. Routine Investigations — Record Results"),
twoColTable([
["HbA1c", "Result: _____ Date: _____ Target: <53 mmol/mol (<7%)"],
["Fasting glucose", "Result: _____ Date: _____"],
["Full blood count (FBC)", "Hb: ___ WBC: ___ Plt: ___ (anaemia affects HbA1c interpretation)"],
["eGFR (renal function)", "Result: _____ Stage of CKD: _____ Date: _____"],
["Urea + Creatinine", "Urea: ___ Creatinine: ___ Date: _____"],
["Urine Albumin:Creatinine Ratio (ACR)", "Result: _____ (Normal <3 mg/mmol; Micro: 3–30; Macro: >30) Date: _____"],
["Fasting lipid profile", "Total cholesterol: ___ LDL: ___ HDL: ___ TG: ___ Date: _____"],
["Liver function tests (LFTs)", "ALT: ___ AST: ___ ALP: ___ (NAFLD screening) Date: _____"],
["Thyroid function (TSH, FT4)", "TSH: ___ FT4: ___ Date: _____"],
["Serum electrolytes (Na, K)", "Na: ___ K: ___ (K critical in DKA management)"],
["Uric acid", "Result: ___ (elevated in metabolic syndrome)"],
["12-lead ECG", "☐ Normal sinus rhythm ☐ LVH ☐ Q waves (silent MI) ☐ AF ☐ Other: ___"],
["Urine dipstick / urinalysis", "Glucose: ___ Protein: ___ Ketones: ___ Nitrites: ___ Leucocytes: ___"],
["Blood ketones (if DKA suspected)", "Result: _____ (DKA: >3.0 mmol/L)"],
["C-peptide (if type classification uncertain)", "Result: _____ (Low = T1DM; Normal/High = T2DM)"],
["Anti-GAD antibodies (if T1DM suspected)", "Result: _____"],
], ["Test", "Result / Date / Target"]),
spacer(),
new Paragraph({ children: [new PageBreak()] }),
// ══════════════════════════════════════════════════════════════════════
// PART M — SUMMARY & CLINICAL FORMULATION
// ══════════════════════════════════════════════════════════════════════
sectionDivider("PART M — CLINICAL SUMMARY & FORMULATION"),
spacer(),
heading2("M1. Summary Statement"),
noteBox("Template: \"[Name] is a [age]-year-old [sex] with a [duration] history of [chief complaint], presenting with [key symptoms]. Relevant background includes [key risk factors and comorbidities]. Key examination findings include [positive findings]. The most likely diagnosis is [diagnosis].\""),
spacer(),
...Array(8).fill(null).map(() => blankField("")),
spacer(),
heading2("M2. Differential Diagnosis"),
twoColTable([
["1st (Most likely)", ""],
["2nd", ""],
["3rd", ""],
["Important to exclude", ""],
], ["Priority", "Diagnosis"]),
spacer(),
heading2("M3. Problem List"),
body("List each active problem separately:"),
...Array(6).fill(null).map((_, i) => blankField(`Problem ${i+1}`)),
spacer(),
heading2("M4. Management Plan"),
twoColTable([
["Lifestyle", "Diet / Exercise / Weight loss / Smoking cessation"],
["Diabetes pharmacotherapy", "Initiate / Adjust / Continue: ___________"],
["Comorbidity treatment", "Antihypertensive / Statin / Antiplatelet: ___________"],
["Referrals required", "Ophthalmology / Podiatry / Nephrology / Cardiology / Dietitian / Physiotherapy"],
["Patient education", "Hypoglycaemia management / Foot care / SMBG technique / Sick-day rules"],
["Investigations ordered", "___________"],
["Follow-up plan", "Next HbA1c: ___ Next foot exam: ___ Next eye exam: ___"],
], ["Domain", "Plan"]),
spacer(),
new Paragraph({ children: [new PageBreak()] }),
// ══════════════════════════════════════════════════════════════════════
// PART N — RED FLAGS
// ══════════════════════════════════════════════════════════════════════
sectionDivider("PART N — RED FLAGS — ACT IMMEDIATELY"),
spacer(),
redBox("⚠ If ANY of the following are present, escalate to a senior immediately."),
spacer(),
twoColTable([
["Kussmaul breathing + fruity breath + vomiting + high glucose", "DIABETIC KETOACIDOSIS (DKA) — EMERGENCY"],
["Extreme thirst + confusion + glucose >33 mmol/L + no ketones", "HYPEROSMOLAR HYPERGLYCAEMIC STATE (HHS) — EMERGENCY"],
["Sweating + shaking + confusion + glucose <3.9 mmol/L", "SEVERE HYPOGLYCAEMIA — EMERGENCY"],
["Sudden, painless vision loss — one or both eyes", "Vitreous haemorrhage / proliferative retinopathy — URGENT ophthalmology"],
["Hot, swollen, red foot — minimal or no pain — in neuropathic patient", "ACUTE CHARCOT FOOT — URGENT — non-weight-bearing + urgent referral"],
["Wound that probes to bone", "OSTEOMYELITIS — URGENT — IV antibiotics + imaging"],
["Cold, pulseless, painful foot + absent pulses + pallor", "CRITICAL LIMB ISCHAEMIA — VASCULAR EMERGENCY"],
["Asymmetric proximal thigh pain + rapid muscle wasting", "DIABETIC AMYOTROPHY — urgent neurology referral"],
["Loss of hypoglycaemia warning signs (unawareness)", "DO NOT DISCHARGE WITHOUT SPECIALIST REVIEW — no driving"],
], ["Clinical Finding", "Action Required"]),
spacer(),
new Paragraph({ children: [new PageBreak()] }),
// ══════════════════════════════════════════════════════════════════════
// PART O — ASSOCIATED DISEASES QUICK REFERENCE
// ══════════════════════════════════════════════════════════════════════
sectionDivider("PART O — ASSOCIATED DISEASES: HISTORY QUESTIONS QUICK REFERENCE"),
spacer(),
noteBox("Diabetes mellitus is rarely a solitary disease. Screen for all of the following associated conditions at every consultation."),
spacer(),
twoColTable([
["Hypertension", "\"Have you ever been told your blood pressure is high? Do you take tablets for it? What does your BP run at home?\""],
["Dyslipidaemia", "\"Have you had a cholesterol test? Were you told it was high? Are you on a statin?\""],
["Coronary artery disease", "\"Have you had a heart attack, angina, or stents placed in your heart arteries?\""],
["Heart failure", "\"Do you become breathless lying flat? Do your legs swell?\""],
["Stroke / TIA", "\"Have you ever had sudden weakness on one side of your body, drooping of the face, or difficulty speaking?\""],
["Peripheral arterial disease", "\"Do you get calf pain when walking that stops when you rest?\""],
["Chronic kidney disease", "\"Have you been told your kidneys are not working fully? Do you know your kidney number (eGFR)?\""],
["Diabetic retinopathy", "\"When were your eyes last examined? Has anyone looked at the back of your eye?\""],
["Peripheral neuropathy", "\"Do you have numbness, tingling, or burning in your feet? Worse at night?\""],
["Autonomic neuropathy", "\"Do you feel dizzy standing up? Do you feel full quickly after eating?\""],
["Non-alcoholic fatty liver disease", "\"Have you been told you have fatty liver? Any right upper abdominal discomfort?\""],
["Obstructive sleep apnoea", "\"Do you snore loudly? Has anyone seen you stop breathing during sleep? Are you sleepy in the day?\""],
["Hypothyroidism (co-exists with T1DM)", "\"Do you feel unusually cold, tired, constipated, or have you gained weight without reason?\""],
["Coeliac disease (T1DM)", "\"Do you have diarrhoea, bloating, or weight loss after eating wheat or bread?\""],
["PCOS (women with T2DM)", "\"Are your periods regular? Have you had difficulty conceiving or excess body hair?\""],
["Depression / anxiety", "\"Over the past 2 weeks have you felt low in mood, hopeless, or lost interest in things you used to enjoy?\""],
["Cheiroarthropathy / Dupuytren's", "\"Do you have stiffness or difficulty fully opening or closing your hands?\""],
["Adhesive capsulitis (frozen shoulder)", "\"Do you have pain or stiffness in your shoulder making it hard to raise your arm?\""],
["Charcot arthropathy", "\"Has your foot ever become very swollen, red, and warm without an obvious injury or infection?\""],
["Diabetic amyotrophy", "\"Have you had severe pain followed by weakness and wasting of one thigh over weeks?\""],
["Diffuse idiopathic skeletal hyperostosis (DISH)", "\"Do you have stiffness in your back or neck, especially in the morning or after rest?\""],
["Recurrent infections", "\"Do you get frequent urinary infections, skin infections, or thrush (candida)?\""],
["Erectile dysfunction (men)", "\"[Private — ask sensitively] Do you experience any difficulty with erections?\""],
["Diabetic gastroparesis", "\"Do you have nausea, vomiting, or feeling full very quickly after eating?\""],
], ["Associated Condition", "Key History Question to Ask"]),
spacer(),
new Paragraph({ children: [new PageBreak()] }),
// ══════════════════════════════════════════════════════════════════════
// PART P — HbA1c MONITORING TARGETS
// ══════════════════════════════════════════════════════════════════════
sectionDivider("PART P — HbA1c & MONITORING TARGETS REFERENCE"),
spacer(),
twoColTable([
["Most adults with DM", "<53 mmol/mol (<7.0%)"],
["Older / frail / hypoglycaemia unawareness", "<64 mmol/mol (<8.0%) — relaxed target"],
["Pre-conception (women planning pregnancy)", "<48 mmol/mol (<6.5%) — ADA recommendation"],
["Recent new diagnosis — short disease duration", "<48 mmol/mol (<6.5%) — tight target if safe"],
["Blood pressure target (with CKD/CVD)", "<130/80 mmHg"],
["Blood pressure target (general)", "<140/90 mmHg"],
["LDL cholesterol (high CV risk patient)", "<1.8 mmol/L (<70 mg/dL)"],
["Fasting glucose target", "4.0–7.0 mmol/L (72–126 mg/dL)"],
["2-hr postprandial glucose target", "<10.0 mmol/L (<180 mg/dL)"],
["Time-in-range (CGM target)", ">70% of readings in 3.9–10.0 mmol/L"],
], ["Parameter", "Target"]),
spacer(),
spacer(),
new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { before: 200 },
children: [new TextRun({
text: "End of Diabetes Mellitus Comprehensive History-Taking Medical Record",
bold: true, italic: true, color: DARK_BLUE, size: 20, font: "Calibri"
})]
}),
new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({
text: "Sources: Harrison's Principles of Internal Medicine 22nd Ed. (2025, McGraw-Hill) | Goldman-Cecil Medicine International Ed. | Tintinalli's Emergency Medicine 9th Ed. | Firestein & Kelley's Textbook of Rheumatology | Campbell's Operative Orthopaedics 15th Ed. (2026)",
size: 16, font: "Calibri", color: "808080", italic: true
})]
}),
]
}]
});
Packer.toBuffer(doc).then(buffer => {
fs.writeFileSync('/home/daytona/workspace/dm-medical-record/DM_Comprehensive_Medical_Record.docx', buffer);
console.log('Document created successfully.');
});