~/dm-history-record/create_dm_record.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
HeadingLevel, AlignmentType, BorderStyle, WidthType, ShadingType,
VerticalAlign, PageNumber, PageBreak, Header, Footer, TableOfContents,
UnderlineType
} = require('docx');
const fs = require('fs');
// ─── COLOUR PALETTE ───────────────────────────────────────────────────────────
const BLUE_DARK = "1F3864"; // deep navy – section headings
const BLUE_MID = "2E75B6"; // mid blue – subsection headings
const BLUE_LIGHT = "BDD7EE"; // pale blue – table header shading
const ORANGE = "C55A11"; // orange – clinical tip labels
const ORANGE_LIGHT= "FCE4D6"; // pale orange – tip boxes
const GREEN_DARK = "375623"; // green – positive-finding labels
const GREEN_LIGHT = "E2EFDA"; // pale green – exam finding shading
const RED_DARK = "C00000"; // red – alert / DKA / HHS / hypo
const GREY_LIGHT = "F2F2F2"; // light grey – alternating rows
// ─── HELPERS ──────────────────────────────────────────────────────────────────
function h1(text) {
return new Paragraph({
text,
heading: HeadingLevel.HEADING_1,
spacing: { before: 360, after: 120 },
run: { color: BLUE_DARK, bold: true, size: 28, font: "Calibri" }
});
}
function h2(text) {
return new Paragraph({
children: [new TextRun({ text, bold: true, color: BLUE_MID, size: 24, font: "Calibri" })],
spacing: { before: 280, after: 80 },
});
}
function h3(text) {
return new Paragraph({
children: [new TextRun({ text, bold: true, color: ORANGE, size: 22, font: "Calibri" })],
spacing: { before: 200, after: 60 },
});
}
function body(text, opts = {}) {
return new Paragraph({
children: [new TextRun({ text, size: 20, font: "Calibri", ...opts })],
spacing: { before: 40, after: 40 },
});
}
function bullet(text, level = 0) {
return new Paragraph({
bullet: { level },
children: [new TextRun({ text, size: 20, font: "Calibri" })],
spacing: { before: 40, after: 40 },
});
}
function questionBullet(q) {
return new Paragraph({
bullet: { level: 0 },
children: [
new TextRun({ text: "\u201C", size: 20, font: "Calibri", italics: true }),
new TextRun({ text: q, size: 20, font: "Calibri", italics: true, color: "1F497D" }),
new TextRun({ text: "\u201D", size: 20, font: "Calibri", italics: true }),
],
spacing: { before: 30, after: 30 },
});
}
function checkBullet(text) {
return new Paragraph({
children: [new TextRun({ text: "\u2610 " + text, size: 20, font: "Calibri" })],
spacing: { before: 30, after: 30 },
});
}
function divider() {
return new Paragraph({
border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: BLUE_LIGHT } },
spacing: { before: 80, after: 80 },
text: "",
});
}
function pageBreak() {
return new Paragraph({ children: [new PageBreak()] });
}
function alertBox(text, bgColor = ORANGE_LIGHT, textColor = "C55A11") {
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
new TableCell({
shading: { fill: bgColor, type: ShadingType.CLEAR, color: "auto" },
margins: { top: 100, bottom: 100, left: 150, right: 150 },
children: [
new Paragraph({
children: [new TextRun({ text, size: 19, font: "Calibri", bold: true, color: textColor })],
})
],
})
]
})
],
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 } }
});
}
function twoColTable(rows, headerRow = null) {
const buildCell = (text, isHeader = false, shade = null) => new TableCell({
shading: shade ? { fill: shade, type: ShadingType.CLEAR, color: "auto" } : undefined,
margins: { top: 80, bottom: 80, left: 120, right: 120 },
verticalAlign: VerticalAlign.CENTER,
children: [
new Paragraph({
children: [new TextRun({ text, size: 19, font: "Calibri", bold: isHeader, color: isHeader ? BLUE_DARK : "000000" })],
})
],
});
const tableRows = [];
if (headerRow) {
tableRows.push(new TableRow({
tableHeader: true,
children: headerRow.map(h => buildCell(h, true, BLUE_LIGHT)),
}));
}
rows.forEach((row, i) => {
tableRows.push(new TableRow({
children: row.map(cell => buildCell(cell, false, i % 2 === 0 ? GREY_LIGHT : "FFFFFF")),
}));
});
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: tableRows,
});
}
function threeColTable(rows, headerRow = null) {
const buildCell = (text, isHeader = false, shade = null, textColor = "000000") => new TableCell({
shading: shade ? { fill: shade, type: ShadingType.CLEAR, color: "auto" } : undefined,
margins: { top: 80, bottom: 80, left: 120, right: 120 },
verticalAlign: VerticalAlign.CENTER,
children: [
new Paragraph({
children: [new TextRun({ text, size: 19, font: "Calibri", bold: isHeader, color: isHeader ? BLUE_DARK : textColor })],
})
],
});
const tableRows = [];
if (headerRow) {
tableRows.push(new TableRow({
tableHeader: true,
children: headerRow.map(h => buildCell(h, true, BLUE_LIGHT)),
}));
}
rows.forEach((row, i) => {
tableRows.push(new TableRow({
children: row.map(cell => buildCell(cell, false, i % 2 === 0 ? GREY_LIGHT : "FFFFFF")),
}));
});
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: tableRows,
});
}
// ─── DOCUMENT CONTENT ─────────────────────────────────────────────────────────
const doc = new Document({
styles: {
default: {
document: {
run: { font: "Calibri", size: 20 },
paragraph: { spacing: { line: 276 } }
}
}
},
sections: [{
properties: {
page: {
margin: { top: 900, bottom: 900, left: 1000, right: 1000 }
}
},
headers: {
default: new Header({
children: [
new Paragraph({
children: [
new TextRun({ text: "DIABETES MELLITUS — COMPREHENSIVE HISTORY-TAKING MEDICAL RECORD", bold: true, color: BLUE_DARK, size: 18, font: "Calibri" }),
new TextRun({ text: " | ", color: "999999", size: 18 }),
new TextRun({ text: "Goldman-Cecil | Harrison's | Tintinalli | Firestein", color: "999999", size: 16, italics: true }),
],
border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: BLUE_LIGHT } },
})
]
})
},
footers: {
default: new Footer({
children: [
new Paragraph({
children: [
new TextRun({ text: "Page ", size: 18, color: "888888" }),
new PageNumber({ size: 18, color: "888888" }),
new TextRun({ text: " | Compiled from Goldman-Cecil Medicine, Harrison's 22e, Tintinalli's Emergency Medicine, Firestein & Kelley's Rheumatology", size: 16, color: "999999", italics: true }),
],
alignment: AlignmentType.CENTER,
border: { top: { style: BorderStyle.SINGLE, size: 6, color: BLUE_LIGHT } },
})
]
})
},
children: [
// ════════════════════════════════════════════════════════════════════════
// TITLE PAGE
// ════════════════════════════════════════════════════════════════════════
new Paragraph({
children: [new TextRun({ text: "", size: 20 })],
spacing: { before: 400, after: 0 }
}),
new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: "COMPREHENSIVE HISTORY-TAKING", bold: true, color: BLUE_DARK, size: 40, font: "Calibri" })],
spacing: { before: 200, after: 80 },
}),
new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: "MEDICAL RECORD", bold: true, color: BLUE_DARK, size: 40, font: "Calibri" })],
spacing: { before: 0, after: 80 },
}),
new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: "Diabetes Mellitus & Associated Diseases", bold: true, color: BLUE_MID, size: 30, font: "Calibri" })],
spacing: { before: 120, after: 200 },
}),
alertBox("Based on: Goldman-Cecil Medicine | Harrison's Principles of Internal Medicine (22e) | Tintinalli's Emergency Medicine | Firestein & Kelley's Rheumatology", BLUE_LIGHT, BLUE_DARK),
new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: "Patient: ______________________________", size: 22, font: "Calibri" })],
spacing: { before: 280, after: 80 },
}),
new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: "Date: ______________ Hospital No: ______________ Ward/Clinic: ______________", size: 22, font: "Calibri" })],
spacing: { before: 60, after: 80 },
}),
new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: "Clerk/Student: ______________________________ Supervisor: ______________________________", size: 22, font: "Calibri" })],
spacing: { before: 60, after: 80 },
}),
pageBreak(),
// ════════════════════════════════════════════════════════════════════════
// SECTION 1: BIODATA
// ════════════════════════════════════════════════════════════════════════
h1("SECTION 1: BIODATA"),
alertBox("Always record biodata FIRST before asking any history. It anchors the clinical picture.", BLUE_LIGHT, BLUE_DARK),
new Paragraph({ text: "", spacing: { before: 120 } }),
twoColTable([
["Full Name", ""],
["Age", ""],
["Sex", " Male / Female / Other"],
["Date of Birth", ""],
["Occupation", ""],
["Marital Status", " Single / Married / Divorced / Widowed"],
["Address / Living Situation", ""],
["Religion / Ethnicity", ""],
["Date of Admission / Consultation", ""],
["Referral Source", " Self / GP / Specialist / Emergency"],
["Informant", ""],
["Reliability of History", " Good / Fair / Poor — Reason: __________"],
], ["Field", "Patient Entry"]),
new Paragraph({ text: "", spacing: { before: 120 } }),
alertBox("CLINICAL NOTE — Occupation matters in DM: Shift workers have disrupted glycaemic patterns; sedentary workers have worse insulin resistance; professional drivers face hypoglycaemia risk (licensing implications).", ORANGE_LIGHT, ORANGE),
pageBreak(),
// ════════════════════════════════════════════════════════════════════════
// SECTION 2: CHIEF COMPLAINT
// ════════════════════════════════════════════════════════════════════════
h1("SECTION 2: CHIEF COMPLAINT (CC)"),
alertBox("Ask in the patient's own words — do not suggest answers or use medical terminology.", BLUE_LIGHT, BLUE_DARK),
body("Opening question:"),
questionBullet("What brought you here today?"),
questionBullet("What is the main problem that is bothering you?"),
body("Write verbatim — record exactly one or two main complaints with duration:"),
new Paragraph({
children: [new TextRun({ text: "CC: ____________________________________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 120, after: 60 }
}),
new Paragraph({
children: [new TextRun({ text: "Duration: ______________________________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 60 }
}),
pageBreak(),
// ════════════════════════════════════════════════════════════════════════
// SECTION 3: HISTORY OF PRESENTING ILLNESS
// ════════════════════════════════════════════════════════════════════════
h1("SECTION 3: HISTORY OF PRESENTING ILLNESS (HPI)"),
alertBox("Use SOCRATES for EACH complaint. For DM, always probe for hyperglycaemic symptoms, acute decompensation, and complication clues.", BLUE_LIGHT, BLUE_DARK),
h2("3A. SOCRATES Framework"),
twoColTable([
["S — Site", "\"Where exactly is the problem?\""],
["O — Onset", "\"When did it start? Was it sudden (hours–days) or gradual (weeks–months)?\""],
["C — Character", "\"What does it feel like? Burning? Tingling? Pressure?\""],
["R — Radiation", "\"Does it spread or go anywhere else?\""],
["A — Associated Symptoms", "\"Is there anything else that comes with it?\""],
["T — Time Course", "\"Is it constant or does it come and go? Is it getting better or worse?\""],
["E — Exacerbating/Relieving", "\"What makes it better? What makes it worse?\""],
["S — Severity", "\"On a scale of 0-10, how bad is it? Does it affect daily life?\""],
], ["SOCRATES Letter", "Question to Ask"]),
new Paragraph({ text: "", spacing: { before: 160 } }),
h2("3B. Cardinal Symptoms of Hyperglycaemia — Ask ALL"),
h3("Polyuria (Excessive Urination)"),
twoColTable([
["Mechanism", "Osmotic diuresis from glucosuria when plasma glucose exceeds renal threshold (~10 mmol/L / 180 mg/dL)"],
]),
questionBullet("How many times do you urinate during the day?"),
questionBullet("Do you wake up at night to urinate? How many times? (Nocturia)"),
questionBullet("How much urine do you pass each time — a small amount or a lot?"),
questionBullet("Is your urine pale, dark, or does it look foamy?"),
questionBullet("Have you noticed ants being attracted to where you urinate? (Glycosuria — classical bedside clue)"),
new Paragraph({
children: [new TextRun({ text: "Findings: _____________________________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 80 }
}),
h3("Polydipsia (Excessive Thirst)"),
twoColTable([
["Mechanism", "Compensatory response to dehydration and hyperosmolarity from glucosuria"],
]),
questionBullet("Do you feel very thirsty more than usual?"),
questionBullet("How much water or fluids do you drink in a day?"),
questionBullet("Is the thirst there all the time, or does drinking relieve it only briefly?"),
new Paragraph({
children: [new TextRun({ text: "Findings: _____________________________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 80 }
}),
h3("Polyphagia (Excessive Hunger)"),
twoColTable([
["Mechanism", "Cellular starvation despite hyperglycaemia — especially prominent in Type 1 DM"],
]),
questionBullet("Is your appetite increased, decreased, or normal?"),
questionBullet("Do you feel hungry soon after eating a full meal?"),
new Paragraph({
children: [new TextRun({ text: "Findings: _____________________________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 80 }
}),
h3("Weight Changes"),
twoColTable([
["T1DM", "Weight loss — catabolism of fat and muscle"],
["T2DM", "Often weight gain (obesity-driven); weight loss in late uncontrolled T2DM"],
]),
questionBullet("Have you lost or gained weight recently without trying?"),
questionBullet("How much weight have you lost/gained, and over what period of time?"),
new Paragraph({
children: [new TextRun({ text: "Findings: _____________________________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 80 }
}),
h3("Fatigue and Weakness"),
questionBullet("Do you feel tired all the time?"),
questionBullet("Does the tiredness come on even without activity, or only after effort?"),
questionBullet("Do you feel weak in your arms or legs?"),
new Paragraph({
children: [new TextRun({ text: "Findings: _____________________________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 80 }
}),
h3("Blurred Vision"),
twoColTable([
["Mechanism", "Lens osmotic swelling from sorbitol accumulation during hyperglycaemia"],
]),
questionBullet("Has your vision changed recently?"),
questionBullet("Is the blurring in one eye or both?"),
questionBullet("Is it constant or does it fluctuate with your blood sugar levels?"),
questionBullet("Have you seen floaters, flashes of light, or had sudden loss of vision?"),
new Paragraph({
children: [new TextRun({ text: "Findings: _____________________________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 80 }
}),
h3("Recurrent Infections and Poor Wound Healing"),
twoColTable([
["Mechanism", "Phagocyte dysfunction + glucosuria + impaired vascular + neuropathic tissue repair"],
]),
questionBullet("Do you get infections frequently — skin, genital, or urinary?"),
questionBullet("Have you noticed itching around the genitals or white discharge? (Candidiasis)"),
questionBullet("Do wounds, cuts, or sores take a long time to heal?"),
questionBullet("Do you have any sores or ulcers not healing, especially on the feet?"),
new Paragraph({
children: [new TextRun({ text: "Findings: _____________________________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 80 }
}),
new Paragraph({ text: "", spacing: { before: 80 } }),
h2("3C. Onset and Type Classification Clues"),
twoColTable([
["Acute onset (days–weeks)", "Suggests Type 1 DM / DKA → ask about nausea, vomiting, abdominal pain, fruity breath"],
["Insidious onset (months–years)", "Suggests Type 2 DM → often found incidentally or when complication presents first"],
["During pregnancy", "Gestational diabetes → screen with OGTT in pregnancy"],
["Post-illness / surgery / steroids", "Secondary / drug-induced DM → review precipitants"],
], ["Onset Pattern", "Clinical Implication"]),
new Paragraph({ text: "", spacing: { before: 120 } }),
h2("3D. Acute Decompensation — Screen for ALL Three"),
alertBox("ACUTE DECOMPENSATION — Always ask these questions directly. Missing DKA or HHS is a clinical emergency.", "FCE4D6", RED_DARK),
new Paragraph({ text: "", spacing: { before: 80 } }),
twoColTable([
["DKA (Type 1 DM, occasionally T2DM)", "Nausea, vomiting, abdominal pain, fruity/acetone breath odour, rapid breathing (Kussmaul), decreased consciousness"],
["HHS — Hyperosmolar Hyperglycaemic State (T2DM)", "Extreme thirst, confusion, neurological changes (focal deficits, seizures), profoundly elevated blood sugar (>33 mmol/L), marked dehydration, NO significant acidosis/ketonuria"],
["Hypoglycaemia", "Sweating, palpitations, tremor, confusion, aggression, unconsciousness — especially on insulin or sulfonylurea"],
], ["Emergency", "Symptoms to Screen"]),
questionBullet("Have you had nausea, vomiting, or abdominal pain with very high blood sugar?"),
questionBullet("Have you had episodes of sweating, shakiness, heart racing, or confusion — especially if you missed a meal?"),
questionBullet("Have you ever been hospitalised for very high blood sugar or a diabetic coma?"),
pageBreak(),
// ════════════════════════════════════════════════════════════════════════
// SECTION 4: COMPLICATIONS SCREENING
// ════════════════════════════════════════════════════════════════════════
h1("SECTION 4: COMPLICATIONS SCREENING — SYSTEMATIC REVIEW BY ORGAN"),
alertBox("Tell the patient: \"I am now going to ask about different parts of your body to make sure everything is being checked carefully.\"", BLUE_LIGHT, BLUE_DARK),
body("Ask about each system in turn. Record findings after each block."),
new Paragraph({ text: "", spacing: { before: 80 } }),
h2("4A. EYES — Diabetic Retinopathy"),
questionBullet("Has a doctor ever looked at the back of your eyes with a special instrument? (Fundoscopy / dilated eye exam)"),
questionBullet("Have you had any changes in your vision — blurring, dark spots, or sudden loss of sight?"),
questionBullet("Have you seen floaters, cobweb-like shapes, or flashes of light?"),
questionBullet("Have you had any eye injections (anti-VEGF) or laser treatment for your eyes?"),
questionBullet("Have you ever been told you have diabetic eye disease or glaucoma?"),
new Paragraph({
children: [new TextRun({ text: "Eyes findings: ________________________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 80 }
}),
h2("4B. KIDNEYS — Diabetic Nephropathy"),
questionBullet("Have you noticed your urine becoming foamy or frothy? (Proteinuria)"),
questionBullet("Do you have swelling in your legs, ankles, or around your eyes in the morning? (Nephrotic oedema)"),
questionBullet("Have you ever been told your kidneys are not working properly?"),
questionBullet("Do you know your kidney function test results — creatinine or eGFR?"),
questionBullet("Have you ever been on dialysis or been referred to a kidney specialist?"),
new Paragraph({
children: [new TextRun({ text: "Kidney findings: ______________________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 80 }
}),
h2("4C. PERIPHERAL NERVOUS SYSTEM — Sensorimotor Neuropathy"),
questionBullet("Do you have numbness, tingling, or a burning sensation in your feet or hands?"),
questionBullet("Does it feel like you are walking on cotton wool or sand?"),
questionBullet("Is the pain or tingling worse at night?"),
questionBullet("Have you lost feeling in your feet — for example, unable to feel hot or cold water?"),
questionBullet("Have you had falls because of loss of balance or unsteadiness?"),
questionBullet("Do you have any foot ulcers, wounds, or sores that are not healing?"),
questionBullet("Have you ever had an amputation?"),
new Paragraph({
children: [new TextRun({ text: "Neuropathy findings: __________________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 80 }
}),
h2("4D. AUTONOMIC NERVOUS SYSTEM — Autonomic Neuropathy"),
questionBullet("Do you feel dizzy or lightheaded when you stand up quickly? (Postural / orthostatic hypotension)"),
questionBullet("Do you feel full very quickly after eating only a small meal? (Gastroparesis)"),
questionBullet("Do you have nausea, vomiting, or bloating after eating?"),
questionBullet("Do you have problems with your bowels — constipation or diarrhoea that comes and goes? (Autonomic gut dysmotility)"),
questionBullet("Do you sweat abnormally — too much or not at all?"),
questionBullet("Do you have difficulty controlling your bladder or do you need to strain to pass urine? (Neurogenic bladder)"),
questionBullet("For MALE patients (ask sensitively and privately): Do you have difficulty getting or maintaining an erection? (Erectile dysfunction — earliest autonomic symptom in men)"),
new Paragraph({
children: [new TextRun({ text: "Autonomic findings: ___________________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 80 }
}),
h2("4E. HEART AND LARGE BLOOD VESSELS — Macrovascular Disease"),
alertBox("Diabetic patients may have SILENT myocardial infarction — chest pain may be absent due to cardiac autonomic neuropathy. Always ask about atypical symptoms.", ORANGE_LIGHT, ORANGE),
questionBullet("Do you have chest pain or tightness — especially on walking, climbing stairs, or at rest?"),
questionBullet("Do you feel short of breath with activity or when lying flat? (Orthopnoea — heart failure)"),
questionBullet("Do you have swelling in both ankles? (Biventricular failure)"),
questionBullet("Have you had a heart attack or been told your heart arteries are blocked?"),
questionBullet("Have you had any stroke or sudden weakness / numbness on one side of your body?"),
questionBullet("Do you get pain in your calves when walking that goes away with rest? (Intermittent claudication = Peripheral Arterial Disease)"),
questionBullet("Do you have palpitations or feel your heart racing or skipping?"),
new Paragraph({
children: [new TextRun({ text: "Cardiovascular findings: _______________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 80 }
}),
h2("4F. FEET — Diabetic Foot Disease"),
questionBullet("Do you check your feet every day?"),
questionBullet("What type of footwear do you use? Do they fit well?"),
questionBullet("Do you have any calluses, corns, or hard skin on your feet?"),
questionBullet("Have you had any cuts, blisters, or sores on your feet that you did not feel? (Loss of protective sensation)"),
questionBullet("Have you been told your foot bones have changed shape? (Charcot's arthropathy)"),
new Paragraph({
children: [new TextRun({ text: "Foot findings: ________________________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 80 }
}),
h2("4G. MUSCULOSKELETAL — Diabetic Rheumatological Conditions"),
alertBox("Firestein & Kelley's Rheumatology: Diabetic cheiroarthropathy, Dupuytren's, trigger finger, carpal tunnel, adhesive capsulitis, Charcot arthropathy are all strongly DM-associated.", GREEN_LIGHT, GREEN_DARK),
twoColTable([
["Cheiroarthropathy (Limited Joint Mobility)", "Prayer sign — cannot fully oppose palmar surfaces; Tabletop sign"],
["Dupuytren's Contracture", ">20% in T2DM; palm nodules/cords; ring and little finger fixed flexion"],
["Trigger Finger (Flexor Tenosynovitis)", "A1 pulley nodule; snapping/locking; multiple fingers in DM"],
["Carpal Tunnel Syndrome", "Median nerve; Tinel's, Phalen's, Durkan's tests; thenar wasting"],
["Adhesive Capsulitis (Frozen Shoulder)", "Limited shoulder ROM; insidious onset; bilateral in DM"],
["Charcot Arthropathy (Neuroarthropathy)", "Painless swollen warm foot/ankle; bone destruction on X-ray"],
["Diabetic Amyotrophy", "Severe unilateral thigh pain, weakness, quadriceps wasting; L2–L4"],
], ["Condition", "Key Features"]),
questionBullet("Do you have stiffness in your fingers or cannot fully close/open your hands?"),
questionBullet("Do you have difficulty getting your palm flat on a table?"),
questionBullet("Do any of your fingers catch, snap, or lock when you bend them?"),
questionBullet("Do you have pain or tingling in your hands at night? (Carpal Tunnel)"),
questionBullet("Do you have pain or stiffness in your shoulder that limits lifting your arm?"),
new Paragraph({
children: [new TextRun({ text: "MSK findings: _________________________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 80 }
}),
h2("4H. SKIN"),
questionBullet("Do you have dry, itchy, or discoloured skin?"),
questionBullet("Do you have any non-healing wounds or sores?"),
questionBullet("Have you noticed darker velvety skin at the back of your neck or in the armpits? (Acanthosis nigricans — insulin resistance)"),
new Paragraph({
children: [new TextRun({ text: "Skin findings: ________________________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 80 }
}),
pageBreak(),
// ════════════════════════════════════════════════════════════════════════
// SECTION 5: GLYCAEMIC CONTROL HISTORY
// ════════════════════════════════════════════════════════════════════════
h1("SECTION 5: GLYCAEMIC CONTROL HISTORY"),
alertBox("This section establishes current control, monitoring practice, and hypoglycaemia risk — essential for every DM encounter.", BLUE_LIGHT, BLUE_DARK),
questionBullet("When were you first told you have diabetes? Who made the diagnosis?"),
questionBullet("What type of diabetes do you have — Type 1, Type 2, or were you not told?"),
questionBullet("What was your most recent HbA1c result? When was it done? Is it improving or worsening?"),
questionBullet("Do you check your blood sugar at home with a glucometer? How often?"),
questionBullet("What are your typical fasting blood sugar readings in the morning?"),
questionBullet("What are your blood sugar readings after meals?"),
questionBullet("Do you use a continuous glucose monitor (CGM)? What is your time-in-range?"),
body(""),
h3("Hypoglycaemia Assessment"),
questionBullet("Have you had episodes of low blood sugar (hypoglycaemia)?"),
questionBullet("How often do these episodes happen?"),
questionBullet("What are your warning signs — sweating, shaking, heart racing, confusion?"),
questionBullet("Have you lost your warning signs for low blood sugar? (Hypoglycaemia unawareness — high risk)"),
questionBullet("Have you ever needed help from another person, or called emergency services?"),
twoColTable([
["HbA1c Last Result & Date", ""],
["Fasting BG Range (mmol/L)", ""],
["Post-meal BG Range (mmol/L)", ""],
["Hypoglycaemia Frequency", " Never / Occasional / Weekly / Daily"],
["Hypoglycaemia Unawareness", " Yes / No"],
["Severe Hypoglycaemia (needed help)", " Yes / No — Date: _________"],
["DKA / HHS Hospital Admissions", " Number: ___ Last date: _________"],
["Self-Monitoring Practice", " Yes / No — Frequency: ____________"],
["CGM Use", " Yes / No — Device: ________________"],
], ["Parameter", "Result / Record"]),
pageBreak(),
// ════════════════════════════════════════════════════════════════════════
// SECTION 6: PAST MEDICAL HISTORY
// ════════════════════════════════════════════════════════════════════════
h1("SECTION 6: PAST MEDICAL HISTORY (PMH)"),
alertBox("Ask systematically — these comorbidities are both DM complications and DM accelerators.", BLUE_LIGHT, BLUE_DARK),
twoColTable([
["Hypertension", " Yes / No — Since: ___ Treated: Yes / No"],
["Dyslipidaemia (High Cholesterol / Triglycerides)", " Yes / No"],
["Coronary Artery Disease / Angina / MI", " Yes / No — Date: _______"],
["Congestive Heart Failure", " Yes / No — NYHA Class: ___"],
["Stroke or TIA", " Yes / No — Date: _______ Side: L / R"],
["Peripheral Arterial Disease", " Yes / No — ABI known: ___"],
["Diabetic Retinopathy", " Yes / No — Grade: NPDR / PDR / Maculopathy"],
["Diabetic Nephropathy / CKD", " Yes / No — eGFR: ___ ACR: ___ Stage: ___"],
["Diabetic Neuropathy (peripheral / autonomic)", " Yes / No — Type: ______________"],
["Diabetic Foot Ulcer / Amputation", " Yes / No — Level: ________________"],
["Charcot Arthropathy", " Yes / No"],
["Non-alcoholic Fatty Liver Disease (NAFLD/NASH)", " Yes / No"],
["Sleep Apnoea", " Yes / No — On CPAP: Yes / No"],
["Polycystic Ovary Syndrome (PCOS)", " Yes / No (women)"],
["Gestational Diabetes", " Yes / No (women) — Year: ___"],
["Pancreatitis or Pancreatic Disease", " Yes / No"],
["Thyroid Disease", " Yes / No — Type: ________________"],
["Other Autoimmune Conditions (T1DM)", " Coeliac / Adrenal insufficiency / Vitiligo / Other"],
["Previous DKA / HHS Episodes", " Yes / No — Dates / Number: __________"],
["Previous Surgeries", ""],
["Previous Hospitalisations", ""],
["Psychiatric Conditions", " Depression / Anxiety / Eating disorder (affects glycaemic control)"],
], ["Condition", "Status / Details"]),
pageBreak(),
// ════════════════════════════════════════════════════════════════════════
// SECTION 7: DRUG HISTORY
// ════════════════════════════════════════════════════════════════════════
h1("SECTION 7: DRUG HISTORY & ALLERGIES"),
alertBox("For each drug: Name → Dose → Frequency → Route → Compliance → Duration. Ask specifically about each drug class.", BLUE_LIGHT, BLUE_DARK),
h2("7A. Diabetes Medications"),
twoColTable([
["Metformin", " Dose: ___ Freq: ___ Compliance: Good / Poor"],
["Sulfonylurea (gliclazide, glibenclamide, glipizide)", " Dose: ___ Freq: ___ Compliance: Good / Poor"],
["SGLT2 Inhibitor (empagliflozin, dapagliflozin, canagliflozin)", " Dose: ___ Freq: ___ Compliance: Good / Poor"],
["GLP-1 Receptor Agonist (semaglutide, liraglutide, dulaglutide)", " Dose: ___ Freq: ___ Route: SC / Oral"],
["DPP-4 Inhibitor (sitagliptin, linagliptin, saxagliptin)", " Dose: ___ Freq: ___ Compliance: Good / Poor"],
["Thiazolidinedione (pioglitazone)", " Dose: ___ Freq: ___"],
["Insulin — Basal (glargine / detemir / degludec)", " Dose: ___ Timing: ___ Injection site: ___"],
["Insulin — Rapid-Acting (aspart / lispro / glulisine)", " Dose: ___ Timing: ___ Injection technique: ___"],
["Insulin — Premixed", " Type: ___ Dose: ___ Timing: ___"],
["Insulin Pump (CSII)", " Yes / No — Basal rate: ___ Bolus: ___"],
], ["Drug Class", "Details"]),
questionBullet("Do you take your diabetes medications every day? Do you ever miss doses?"),
questionBullet("For insulin: Do you rotate injection sites? Are there any lumpy areas? (Lipohypertrophy)"),
new Paragraph({ text: "", spacing: { before: 80 } }),
h2("7B. Other Medications (Comorbidities)"),
twoColTable([
["ACE Inhibitor / ARB (renoprotective)", ""],
["Statin (atorvastatin, rosuvastatin)", ""],
["Aspirin or Antiplatelet", ""],
["Antihypertensive (amlodipine, bisoprolol, doxazosin)", ""],
["Diuretic (furosemide, spironolactone, HCTZ)", ""],
], ["Drug", "Name / Dose / Frequency"]),
new Paragraph({ text: "", spacing: { before: 80 } }),
h2("7C. Drugs That WORSEN Glycaemic Control"),
alertBox("Always check for these — they are common and frequently overlooked causes of poor glycaemic control.", ORANGE_LIGHT, ORANGE),
twoColTable([
["Corticosteroids (prednisolone, dexamethasone)", " Currently taking: Yes / No"],
["Thiazide Diuretics (hydrochlorothiazide, indapamide)", " Currently taking: Yes / No"],
["Atypical Antipsychotics (olanzapine, clozapine)", " Currently taking: Yes / No"],
["Beta-Blockers (propranolol, atenolol)", " Currently taking: Yes / No — masks hypoglycaemia symptoms"],
["Calcineurin Inhibitors (tacrolimus, cyclosporin)", " Currently taking: Yes / No"],
["Protease Inhibitors (HIV treatment)", " Currently taking: Yes / No"],
["Niacin / Nicotinic acid", " Currently taking: Yes / No"],
["Herbal / Traditional Medicines", " Details: __________________________"],
], ["Drug", "Status"]),
new Paragraph({ text: "", spacing: { before: 80 } }),
h2("7D. Allergies"),
twoColTable([
["Drug Allergy", "Reaction Type"],
["", ""],
["", ""],
], ["Drug Name", "Reaction (e.g. rash, anaphylaxis, GI intolerance)"]),
pageBreak(),
// ════════════════════════════════════════════════════════════════════════
// SECTION 8: FAMILY HISTORY
// ════════════════════════════════════════════════════════════════════════
h1("SECTION 8: FAMILY HISTORY (FH)"),
alertBox("A strong family history of T2DM confers 2-4x increased risk. First-degree relatives with T1DM increase risk ~15-fold.", BLUE_LIGHT, BLUE_DARK),
twoColTable([
["Diabetes (Type 1 or 2) — in first-degree relatives", " Yes / No — Who: Father / Mother / Sibling — Type: ___"],
["Hypertension", " Yes / No — Who: ______________________"],
["Coronary Artery Disease / Early MI (<55 years)", " Yes / No — Who: ______________________"],
["Stroke", " Yes / No — Who: ______________________"],
["Chronic Kidney Disease", " Yes / No — Who: ______________________"],
["Obesity", " Yes / No — Who: ______________________"],
["Thyroid Disease", " Yes / No — Who: ______________________"],
["MODY (DM in 3 generations, young, non-obese, no antibodies)", " Yes / No — Suggest genetic testing if suspected"],
["Autoimmune Conditions", " Yes / No — Type: ____________________"],
], ["Family Condition", "Details"]),
pageBreak(),
// ════════════════════════════════════════════════════════════════════════
// SECTION 9: SOCIAL HISTORY
// ════════════════════════════════════════════════════════════════════════
h1("SECTION 9: SOCIAL HISTORY (SH)"),
h2("9A. Smoking"),
questionBullet("Do you smoke or have you ever smoked?"),
questionBullet("How many cigarettes per day? For how many years? (Pack-years = [cigarettes/day ÷ 20] × years)"),
questionBullet("If stopped — when did you stop?"),
twoColTable([
["Smoking Status", " Never / Current / Ex-smoker"],
["Cigarettes/day", ""],
["Duration (years)", ""],
["Pack-years", ""],
["Year stopped (if ex)", ""],
], ["Parameter", "Details"]),
alertBox("Smoking DOUBLES cardiovascular risk in DM. It also impairs wound healing, worsens neuropathy, and accelerates nephropathy. Smoking cessation is a core DM management goal.", ORANGE_LIGHT, ORANGE),
new Paragraph({ text: "", spacing: { before: 80 } }),
h2("9B. Alcohol"),
questionBullet("Do you drink alcohol? What type? How much per week?"),
questionBullet("Do you ever drink on an empty stomach?"),
alertBox("Alcohol can mask hypoglycaemia symptoms AND cause delayed hypoglycaemia up to 24 hours after drinking (especially on insulin or sulfonylurea). Educate all patients.", ORANGE_LIGHT, ORANGE),
twoColTable([
["Alcohol Status", " Never / Social / Regular / Dependent"],
["Units per week", ""],
["Type (beer, spirits, wine)", ""],
["Binge drinking (>6 units/session)", " Yes / No"],
], ["Parameter", "Details"]),
new Paragraph({ text: "", spacing: { before: 80 } }),
h2("9C. Diet"),
questionBullet("What do you usually eat in a day from morning to night? (24-hour dietary recall)"),
questionBullet("Do you eat regular meals, or do you skip meals?"),
questionBullet("How much rice, bread, sugar, or sweet drinks do you consume daily?"),
questionBullet("Are you following a special diabetic diet?"),
questionBullet("Do you count carbohydrates or follow a meal plan?"),
twoColTable([
["Meal Regularity", " Regular / Irregular / Skips meals"],
["Carbohydrate Intake", " High / Moderate / Low / Unknown"],
["Sweet Drinks (soda, juice, energy drinks)", " Frequency: ___________________"],
["Diabetic Diet Adherence", " Yes / No / Partial"],
], ["Parameter", "Details"]),
new Paragraph({ text: "", spacing: { before: 80 } }),
h2("9D. Physical Activity"),
questionBullet("How active are you on a daily basis?"),
questionBullet("Do you do any structured exercise? What type, how often, and for how long?"),
alertBox("Target: 150 min/week moderate aerobic exercise + resistance training 2-3x/week. Exercise reduces HbA1c by ~0.6% independently.", BLUE_LIGHT, BLUE_DARK),
twoColTable([
["Activity Level", " Sedentary / Lightly active / Moderately active / Very active"],
["Exercise Type", ""],
["Exercise Frequency/Duration", ""],
], ["Parameter", "Details"]),
new Paragraph({ text: "", spacing: { before: 80 } }),
h2("9E. Socioeconomic Status & Adherence Capacity"),
questionBullet("Do you have any difficulty affording your medications or test strips?"),
questionBullet("Who cooks your meals at home?"),
questionBullet("Do you live alone or with family?"),
questionBullet("Do you understand how to use your glucometer and insulin device?"),
twoColTable([
["Lives Alone / With Family", ""],
["Medication Affordability", " No difficulty / Moderate difficulty / Significant difficulty"],
["Health Literacy", " Good / Fair / Poor"],
["Occupational Risk for Hypoglycaemia", " Driving / Machinery / Heights: Yes / No"],
], ["Parameter", "Details"]),
pageBreak(),
// ════════════════════════════════════════════════════════════════════════
// SECTION 10: DM CLASSIFICATION
// ════════════════════════════════════════════════════════════════════════
h1("SECTION 10: DIABETES CLASSIFICATION — CLINICIAN ASSESSMENT"),
threeColTable([
["Type 1 DM", "Usually <30 yrs, lean, acute onset, prone to DKA, autoimmune markers (anti-GAD, anti-islet, anti-IA2, anti-ZnT8), C-peptide low/undetectable, requires insulin from outset", ""],
["Type 2 DM", "Usually >35 yrs, overweight/obese, insidious onset, strong family history, associated with metabolic syndrome, C-peptide elevated", ""],
["MODY (Maturity Onset DM of the Young)", "Young, non-obese, autosomal dominant FH over 3 generations, no autoantibodies — refer for genetic testing (GCK, HNF1A mutations)", ""],
["Secondary DM", "Pancreatitis, pancreatectomy, haemochromatosis, Cushing's syndrome, acromegaly, drug-induced — underlying cause drives management", ""],
["Gestational DM", "Diagnosed during pregnancy, resolves post-partum — but 50% develop T2DM within 10 years; screen with OGTT", ""],
["LADA (Latent Autoimmune DM in Adults)", "Age >30, initially resembles T2DM, anti-GAD positive, progressive insulin deficiency — often misclassified as T2DM", ""],
], ["Type", "Key Features", "Clinician Assessment"]),
new Paragraph({ text: "", spacing: { before: 80 } }),
new Paragraph({
children: [new TextRun({ text: "Clinical DM Classification: _____________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 60 }
}),
pageBreak(),
// ════════════════════════════════════════════════════════════════════════
// SECTION 11: PHYSICAL EXAMINATION GUIDE
// ════════════════════════════════════════════════════════════════════════
h1("SECTION 11: PHYSICAL EXAMINATION — GUIDE & FINDINGS RECORD"),
alertBox("The physical examination in DM is a targeted, multi-system search for complications. Follow this systematic approach.", BLUE_LIGHT, BLUE_DARK),
h2("11A. General Assessment"),
twoColTable([
["Height (cm)", "___ Weight (kg): ___ BMI: ___ (>25 overweight; >30 obese)"],
["Waist Circumference (cm)", "___ (At risk: women >80 cm; men >90 cm Asian / >102 cm Western)"],
["General Appearance", " Well / Unwell / Ill — Cushingoid features: Yes / No"],
["Hydration Status", " Normal / Dehydrated — Skin turgor / dry mucous membranes"],
["Acanthosis Nigricans", " Present / Absent — Site: posterior neck / axillae / groin"],
], ["Parameter", "Finding"]),
h2("11B. Vital Signs"),
twoColTable([
["Blood Pressure (Right arm)", "___/___ mmHg — Target <130/80 in DM"],
["Blood Pressure (Left arm)", "___/___ mmHg"],
["Orthostatic BP", "Supine: ___/___ | Standing 1 min: ___/___ | 3 min: ___/___ (Drop ≥20 mmHg systolic = autonomic neuropathy)"],
["Heart Rate", "___ bpm — Regular / Irregular (Fixed resting tachycardia = autonomic neuropathy)"],
["Respiratory Rate", "___ /min — Kussmaul breathing (deep sighing) = DKA"],
["Temperature", "___ °C — Fever suggests infection (foot cellulitis / osteomyelitis)"],
["SpO2", "___ %"],
["Random Capillary Blood Glucose", "___ mmol/L"],
], ["Parameter", "Finding"]),
h2("11C. Eyes, ENT, Oral Cavity"),
twoColTable([
["Visual Acuity (Snellen)", "Right: ___ Left: ___"],
["Rubeosis Iridis", " Present / Absent (neovascularisation of iris = advanced retinopathy)"],
["Fundoscopy Findings", " Microaneurysms / Haemorrhages / Cotton-wool spots / Exudates / NVD / NVE / Normal"],
["CN III Palsy", " Present / Absent (painless, pupil-sparing = diabetic mononeuropathy)"],
["Oral Candidiasis", " Present / Absent — White plaques on mucosa"],
["Periodontal Disease", " Present / Absent"],
["Thyroid", " Normal / Goitre / Nodule"],
], ["Examination", "Finding"]),
h2("11D. Cardiovascular"),
twoColTable([
["Carotid Bruits", " Right: Present / Absent | Left: Present / Absent"],
["Apex Beat", ""],
["Heart Sounds", " S1+S2+___ (S3 = HF; S4 = diabetic cardiomyopathy)"],
["Pedal Oedema", " Present / Absent — Grade: ___ Bilateral / Unilateral"],
["Femoral Pulse", " Right: Present / Absent | Left: Present / Absent"],
["Popliteal Pulse", " Right: Present / Absent | Left: Present / Absent"],
["Posterior Tibial Pulse", " Right: Present / Absent | Left: Present / Absent"],
["Dorsalis Pedis Pulse", " Right: Present / Absent | Left: Present / Absent"],
["Ankle-Brachial Index (ABI)", " Right: ___ Left: ___ (Normal ≥0.9; PAD <0.9)"],
], ["Examination", "Finding"]),
h2("11E. Abdomen"),
twoColTable([
["Hepatomegaly (NAFLD)", " Present / Absent — Size: ___ cm below costal margin"],
["Renal Angle Tenderness", " Right: Yes / No | Left: Yes / No"],
["Insulin Injection Sites", " Abdomen / Flanks / Thighs — Lipohypertrophy: Yes / No — Site: ___"],
["Renal Artery Bruit", " Present / Absent"],
], ["Examination", "Finding"]),
h2("11F. Neurological — Peripheral Neuropathy Screening"),
alertBox("Diabetic neuropathy is a DIAGNOSIS OF EXCLUSION — rule out B12 deficiency, hypothyroidism, uraemia, CIDP, and vasculitic neuropathy.", ORANGE_LIGHT, ORANGE),
twoColTable([
["10g Semmes-Weinstein Monofilament (10 plantar sites per foot)", "Right: ___/10 normal | Left: ___/10 normal"],
["128-Hz Tuning Fork (hallux → medial malleolus)", "Right: Normal / Reduced / Absent | Left: Normal / Reduced / Absent"],
["Pin-prick (dorsal foot — small fibre)", "Right: Normal / Reduced | Left: Normal / Reduced"],
["Temperature Discrimination (cool vs warm)", "Right: Normal / Impaired | Left: Normal / Impaired"],
["Ankle Jerk Reflex", "Right: Present / Absent / Diminished | Left: Present / Absent / Diminished"],
["Patellar Reflex", "Right: Present / Absent | Left: Present / Absent"],
["Proprioception (hallux up/down)", "Right: Normal / Impaired | Left: Normal / Impaired"],
["Romberg's Test", " Positive / Negative"],
["Gait Assessment", " Normal / Wide-based / Antalgic"],
], ["Test", "Finding"]),
h2("11G. Foot Examination — 5-Minute Minimum"),
alertBox("ALWAYS remove shoes and socks. Check the feet at every DM visit. Foot disease is the most preventable major complication of DM.", RED_DARK === "C00000" ? "FCE4D6" : "FCE4D6", RED_DARK),
twoColTable([
["Skin Integrity", " Ulcers: Yes / No — Location: ___ Size: ___ Depth: ___ Wagner grade: ___"],
["Calluses / Corns", " Present / Absent — Location: _______________"],
["Deformities", " Hallux valgus / Hammertoe / Charcot foot / Normal"],
["Interdigital Spaces", " Maceration / Tinea pedis / Normal"],
["Nails", " Onychomycosis / Ingrowing / Normal"],
["Skin Colour / Temperature", " Warm / Cool / Discoloured"],
["Callus Over Pressure Points", " Present / Absent"],
["Footwear Inspection", " Appropriate / Ill-fitting / Absent"],
], ["Feature", "Finding — Right Foot / Left Foot"]),
h2("11H. Musculoskeletal — Diabetic Specific Signs (Firestein & Kelley)"),
twoColTable([
["Prayer Sign (LJM — Cheiroarthropathy)", " Positive / Negative (gap between palmar surfaces)"],
["Tabletop Sign", " Positive / Negative"],
["Dupuytren's Contracture", " Present / Absent — Fingers affected: ___ Flexion deficit: ___ degrees"],
["Trigger Finger", " Present / Absent — Fingers affected: ___"],
["Tinel's Sign at wrist (Carpal Tunnel)", " Positive / Negative — Right / Left"],
["Phalen's Test (Carpal Tunnel)", " Positive / Negative — Latency: ___ seconds"],
["Thenar Wasting (Carpal Tunnel — advanced)", " Present / Absent"],
["Shoulder Abduction Range (Frozen Shoulder)", " Right: ___° Left: ___° (Normal >180°)"],
["Charcot Foot (warm, swollen, deformed, painless)", " Present / Absent"],
], ["Sign", "Finding"]),
h2("11I. Skin Examination"),
twoColTable([
["Acanthosis Nigricans", " Present / Absent — Location: _______________"],
["Necrobiosis Lipoidica", " Present / Absent (anterior tibiae — strongly associated T1DM)"],
["Diabetic Dermopathy (shin spots)", " Present / Absent"],
["Eruptive Xanthomas", " Present / Absent (severe hypertriglyceridaemia)"],
["Tinea Pedis / Onychomycosis", " Present / Absent"],
["Lipohypertrophy at Injection Sites", " Present / Absent — Site: _______________"],
["Lipoatrophy (rare)", " Present / Absent"],
["Vitiligo (T1DM autoimmune)", " Present / Absent"],
], ["Skin Finding", "Result"]),
pageBreak(),
// ════════════════════════════════════════════════════════════════════════
// SECTION 12: INVESTIGATIONS
// ════════════════════════════════════════════════════════════════════════
h1("SECTION 12: INVESTIGATIONS — RESULTS RECORD"),
alertBox("ADA Diagnostic Criteria: Any one of — FPG ≥7.0 mmol/L | 2-hr OGTT ≥11.1 mmol/L | Random PG ≥11.1 mmol/L + symptoms | HbA1c ≥48 mmol/mol (≥6.5%). Asymptomatic patients require TWO abnormal tests on DIFFERENT days.", BLUE_LIGHT, BLUE_DARK),
h2("12A. Glycaemic"),
twoColTable([
["Fasting Plasma Glucose (FPG)", " ___ mmol/L (DM: ≥7.0 | Pre-DM: 5.6–6.9 | Normal: <5.6)"],
["2-hour OGTT (75g glucose)", " ___ mmol/L (DM: ≥11.1 | IGT: 7.8–11.0)"],
["HbA1c", " ___ mmol/mol ( ___ %) (DM: ≥48/≥6.5% | Pre-DM: 39–47/5.7–6.4%)"],
["Random Plasma Glucose + Symptoms", " ___ mmol/L (DM: ≥11.1 with symptoms)"],
["C-Peptide", " ___ pmol/L (T1DM: low/undetectable; T2DM: normal/high)"],
["Fasting Insulin", " ___ mU/L (insulin resistance if elevated with FPG)"],
["HOMA-IR", " ___ (insulin resistance index)"],
], ["Test", "Result / Reference Range"]),
h2("12B. Autoimmune (Type 1 / LADA Classification)"),
twoColTable([
["Anti-GAD Antibodies", " Positive / Negative / Not done"],
["Islet Cell Antibodies (ICA)", " Positive / Negative / Not done"],
["Anti-IA2 Antibodies", " Positive / Negative / Not done"],
["Anti-ZnT8 Antibodies", " Positive / Negative / Not done"],
], ["Test", "Result"]),
h2("12C. Metabolic Panel"),
twoColTable([
["Full Blood Count (FBC)", " Hb: ___ WBC: ___ Platelets: ___ (Anaemia affects HbA1c interpretation)"],
["Urea / BUN", " ___ mmol/L"],
["Creatinine", " ___ micromol/L"],
["eGFR (CKD-EPI)", " ___ mL/min/1.73m² (CKD Stage: _____)"],
["Urine Albumin-to-Creatinine Ratio (ACR)", " ___ mg/mmol (Microalbuminuria: 3–30; Macroalbuminuria: >30)"],
["Urine Dipstick", " Glucose: ___ Protein: ___ Ketones: ___ Nitrites: ___ Blood: ___"],
["Total Cholesterol", " ___ mmol/L"],
["LDL Cholesterol", " ___ mmol/L (Target <1.8 mmol/L if high CV risk)"],
["HDL Cholesterol", " ___ mmol/L"],
["Triglycerides", " ___ mmol/L (>5.6 = hypertriglyceridaemia with pancreatitis risk)"],
["Liver Function Tests (ALT, AST, ALP, GGT)", " ALT: ___ AST: ___ ALP: ___ GGT: ___ (NAFLD monitoring)"],
["TSH / Free T4", " TSH: ___ FT4: ___ (Annual in T1DM; consider in T2DM)"],
["Uric Acid", " ___ mmol/L (elevated in insulin resistance / metabolic syndrome)"],
["Serum B12", " ___ pmol/L (deficiency from long-term metformin)"],
], ["Test", "Result"]),
h2("12D. Cardiovascular"),
twoColTable([
["12-Lead ECG", " Normal / LVH / Q waves (silent MI) / AF / Conduction defect: ___"],
["Echocardiogram", " EF: ___ Diastolic dysfunction: Yes / No (if clinical HF)"],
["Ankle-Brachial Index (ABI)", " Right: ___ Left: ___ (PAD <0.9)"],
["Chest X-Ray", " Normal / Cardiomegaly / Pulmonary oedema / Other: ___"],
], ["Test", "Result"]),
h2("12E. Ophthalmology"),
twoColTable([
["Dilated Fundus Exam / Retinal Photography", " Date: ___ Finding: NPDR / PDR / Maculopathy / Normal"],
["Frequency", " At diagnosis (T2DM) | Within 5 years (T1DM) | Then annually"],
], ["Screening", "Result"]),
h2("12F. Coexisting Autoimmune (T1DM Screening)"),
twoColTable([
["Anti-TPO and Anti-Thyroglobulin Antibodies", " Positive / Negative / Not done"],
["Anti-tTG IgA (Coeliac Disease)", " Positive / Negative / Not done"],
["Adrenal Antibodies (21-hydroxylase) if Addison's suspected", " Positive / Negative / Not done"],
], ["Test", "Result"]),
pageBreak(),
// ════════════════════════════════════════════════════════════════════════
// SECTION 13: RISK STRATIFICATION
// ════════════════════════════════════════════════════════════════════════
h1("SECTION 13: RISK STRATIFICATION SUMMARY"),
threeColTable([
["Disease Duration (years)", "", " >10 years = significantly increased microvascular risk"],
["HbA1c", "", " >75 mmol/mol (>9%) = very high risk"],
["Blood Pressure", "", " Uncontrolled BP accelerates nephropathy and retinopathy"],
["Dyslipidaemia", "", " Drives macrovascular disease"],
["Smoking", "", " Doubles CVD risk; impairs wound healing"],
["Obesity", "", " Worsens insulin resistance and CV risk"],
["Existing Organ Damage (retinopathy / nephropathy / neuropathy)", "", " Already present = highest risk tier"],
["Hypoglycaemia Unawareness", "", " Relax targets; refer to specialist"],
["Pregnancy", "", " Tight control required; target HbA1c <48 mmol/mol (<6.5%) pre-conceptionally"],
["Cardiovascular Disease", "", " SGLT2i or GLP-1 RA preferred; high-intensity statin; antiplatelet"],
], ["Risk Factor", "Patient Status", "Clinical Implication"]),
new Paragraph({ text: "", spacing: { before: 80 } }),
new Paragraph({
children: [new TextRun({ text: "Overall Risk Stratification: ____________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 60 }
}),
new Paragraph({
children: [new TextRun({ text: "HbA1c Target for this patient: _________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 60, after: 60 }
}),
pageBreak(),
// ════════════════════════════════════════════════════════════════════════
// SECTION 14: PROBLEM LIST & MANAGEMENT PLAN
// ════════════════════════════════════════════════════════════════════════
h1("SECTION 14: ACTIVE PROBLEM LIST"),
twoColTable([
["1.", ""],
["2.", ""],
["3.", ""],
["4.", ""],
["5.", ""],
["6.", ""],
["7.", ""],
["8.", ""],
], ["#", "Problem"]),
new Paragraph({ text: "", spacing: { before: 120 } }),
h1("SECTION 15: MANAGEMENT PLAN FRAMEWORK"),
alertBox("This framework is for the supervising clinician to complete. Students: use this as a structured learning scaffold.", BLUE_LIGHT, BLUE_DARK),
h2("15A. Patient Education"),
checkBullet("Disease understanding — what is DM and what causes complications"),
checkBullet("Sick-day rules — what to do when ill (never stop insulin)"),
checkBullet("Hypoglycaemia recognition and treatment — carry fast-acting glucose"),
checkBullet("Foot care — daily inspection, proper footwear, nail care, when to seek help"),
checkBullet("Self-monitoring of blood glucose (SMBG) technique"),
checkBullet("Medication adherence counselling"),
h2("15B. Lifestyle Modification"),
checkBullet("Diet: Reduced refined carbohydrates; Mediterranean or DASH diet pattern; caloric restriction if obese"),
checkBullet("Exercise: 150 min/week moderate aerobic activity + resistance training 2-3x/week (reduces HbA1c ~0.6%)"),
checkBullet("Weight loss: 5-10% weight reduction significantly improves glycaemic control, BP, and lipid profile"),
checkBullet("Smoking cessation — pharmacotherapy (varenicline) if needed"),
checkBullet("Alcohol reduction counselling"),
h2("15C. Pharmacotherapy — T2DM Step-Up Approach"),
threeColTable([
["1st Line", "Metformin", "Reduces hepatic glucose output; weight-neutral; renally dosed (reduce if eGFR 30-45, stop if <30)"],
["Add-on (CVD/CKD)", "SGLT2 Inhibitor (empagliflozin, dapagliflozin)", "Renal and cardioprotective; reduce HbA1c, BP, weight; risk genital mycotic infections"],
["Add-on (CVD/Obesity)", "GLP-1 RA (semaglutide, liraglutide)", "Weight loss; CV benefit (LEADER, SUSTAIN-6 trials); injectable or oral"],
["Add-on", "DPP-4 Inhibitor (sitagliptin)", "Weight-neutral; well-tolerated; oral"],
["Add-on", "Sulfonylurea (gliclazide)", "Inexpensive; hypoglycaemia risk; weight gain"],
["Escalation", "Basal Insulin (glargine/detemir)", "When oral agents fail to reach target; start low (0.1-0.2 U/kg/day)"],
["Escalation", "Basal-Bolus Insulin", "Most physiological regimen; essential in T1DM from outset"],
], ["Step", "Drug", "Key Points"]),
new Paragraph({
children: [new TextRun({ text: "Plan for this patient: _________________________________________________________", size: 20, font: "Calibri" })],
spacing: { before: 80, after: 60 }
}),
h2("15D. Treating Comorbidities"),
twoColTable([
["Hypertension", "ACE inhibitor or ARB as first choice (renoprotective + anti-proteinuric); target <130/80 with CKD/CVD"],
["Dyslipidaemia", "High-intensity statin for most DM patients with CVD risk; fenofibrate if hypertriglyceridaemia"],
["Antiplatelet Therapy", "Low-dose aspirin for ESTABLISHED CVD; not routine for primary prevention"],
["Obesity", "GLP-1 RA (semaglutide 2.4 mg); consider bariatric surgery if BMI >35 with inadequate control"],
], ["Comorbidity", "Management"]),
h2("15E. Complication-Specific Treatment"),
twoColTable([
["Retinopathy (NPDR)", "Tight glycaemic + BP control; annual ophthalmology follow-up"],
["Retinopathy (PDR)", "Laser photocoagulation or anti-VEGF (ranibizumab)"],
["Nephropathy (microalbuminuria)", "ACEi or ARB; SGLT2i (reduces CKD progression — CREDENCE, DAPA-CKD trials); protein restriction"],
["Painful Neuropathy", "Duloxetine (1st line); pregabalin; gabapentin; amitriptyline; topical capsaicin"],
["Gastroparesis", "Metoclopramide; domperidone; small frequent meals; low-fat diet"],
["Erectile Dysfunction", "PDE5 inhibitors (sildenafil, tadalafil); refer to urology"],
["Foot Ulcer", "Offloading (total contact cast); wound debridement; treat infection (culture-guided antibiotics); vascular surgery if PAD"],
["Charcot Foot (active)", "Total contact casting; no weight-bearing; urgent orthopaedic / diabetic foot team referral"],
["Cheiroarthropathy/Trigger Finger", "Physiotherapy; corticosteroid injection (less effective in DM); surgical release if severe"],
], ["Complication", "Key Treatment"]),
h2("15F. Follow-Up Schedule"),
twoColTable([
["HbA1c", "Every 3 months if poorly controlled; every 6 months if stable"],
["BP, Weight, Waist Circumference", "Every clinic visit"],
["Urine ACR + eGFR", "Annually"],
["Fasting Lipid Profile", "Annually"],
["Dilated Fundoscopy", "Annually after initial screen"],
["Comprehensive Foot Exam (monofilament + VPT)", "Annually; every visit if high-risk"],
["Thyroid Function (TSH)", "Annually (T1DM); as clinically indicated (T2DM)"],
["B12 Level (on metformin)", "Every 2 years; annually if low intake or symptoms"],
["Dental Review", "Every 6-12 months (periodontal disease worsens glycaemic control)"],
["Influenza Vaccine", "Annually"],
["Pneumococcal Vaccine", "As per local guidelines"],
], ["Parameter", "Frequency"]),
pageBreak(),
// ════════════════════════════════════════════════════════════════════════
// SECTION 16: BEDSIDE CHECKLIST
// ════════════════════════════════════════════════════════════════════════
h1("SECTION 16: BEDSIDE QUICK-REFERENCE CHECKLIST"),
alertBox("Print and use this checklist at the bedside. Tick each item as completed. Hand this to your supervisor at the end of the clerking.", BLUE_LIGHT, BLUE_DARK),
new Paragraph({ text: "", spacing: { before: 80 } }),
h2("History Checklist"),
checkBullet("Biodata complete (name, age, sex, occupation, address, informant)"),
checkBullet("Chief complaint in patient's own words with duration"),
checkBullet("SOCRATES applied to each complaint"),
checkBullet("Polyuria, polydipsia, polyphagia, weight loss asked"),
checkBullet("Blurred vision, recurrent infections, poor wound healing asked"),
checkBullet("DKA symptoms (nausea/vomiting/fruity breath) screened"),
checkBullet("HHS symptoms (confusion/extreme thirst/very high BG) screened"),
checkBullet("Hypoglycaemia episodes and unawareness assessed"),
checkBullet("Eyes complications screened (retinopathy, laser treatment)"),
checkBullet("Kidney complications screened (foamy urine, oedema, eGFR)"),
checkBullet("Peripheral neuropathy screened (numbness, burning, cotton-wool sensation)"),
checkBullet("Autonomic neuropathy screened (postural dizziness, gastroparesis, ED, neurogenic bladder)"),
checkBullet("Cardiovascular history (chest pain, dyspnoea, claudication, palpitations)"),
checkBullet("Foot history (ulcers, amputation, footwear)"),
checkBullet("MSK history (stiff fingers, trigger finger, shoulder pain)"),
checkBullet("Glycaemic control history (HbA1c trend, SMBG, hypoglycaemia)"),
checkBullet("Past medical history (HTN, dyslipidaemia, CVD, CKD, thyroid, PCOS)"),
checkBullet("All diabetes medications recorded with dose, frequency, compliance"),
checkBullet("Drugs that worsen glucose checked (steroids, antipsychotics, thiazides)"),
checkBullet("Allergies recorded"),
checkBullet("Family history (DM, CVD, CKD, obesity)"),
checkBullet("Smoking status and pack-years calculated"),
checkBullet("Alcohol history with hypoglycaemia education noted"),
checkBullet("Diet (24-hour recall), exercise, adherence capacity assessed"),
new Paragraph({ text: "", spacing: { before: 80 } }),
h2("Examination Checklist"),
checkBullet("Height, weight, BMI, waist circumference recorded"),
checkBullet("Blood pressure both arms; orthostatic BP measured"),
checkBullet("Capillary blood glucose measured"),
checkBullet("Fundoscopy attempted or referral arranged"),
checkBullet("Oral cavity (Candidiasis) and thyroid examined"),
checkBullet("All peripheral pulses palpated (femoral, popliteal, PT, DP)"),
checkBullet("Abdomen: liver size, renal angle, injection sites"),
checkBullet("Neurological: monofilament, tuning fork, pin-prick, ankle jerks, proprioception"),
checkBullet("Shoes and socks removed; feet inspected"),
checkBullet("MSK: prayer sign, tabletop, Dupuytren's, trigger finger, Tinel's, Phalen's, shoulder ROM"),
checkBullet("Skin: acanthosis nigricans, necrobiosis lipoidica, dermopathy, xanthomas, vitiligo"),
new Paragraph({ text: "", spacing: { before: 80 } }),
h2("Investigations Checklist"),
checkBullet("HbA1c requested / result recorded"),
checkBullet("FPG or random BG with result"),
checkBullet("Urine ACR (nephropathy screening)"),
checkBullet("eGFR / creatinine / urea"),
checkBullet("Fasting lipid profile"),
checkBullet("FBC (rules out anaemia affecting HbA1c)"),
checkBullet("LFTs (NAFLD screening, medication monitoring)"),
checkBullet("TSH"),
checkBullet("B12 (on metformin)"),
checkBullet("ECG"),
checkBullet("Anti-GAD / C-peptide (if type classification unclear)"),
checkBullet("Dilated fundoscopy referral made if not done within past year"),
pageBreak(),
// ════════════════════════════════════════════════════════════════════════
// SIGNATURE BLOCK
// ════════════════════════════════════════════════════════════════════════
h1("SECTION 17: CLINICAL ASSESSMENT & SIGNATURE"),
twoColTable([
["Date / Time of Clerking", ""],
["Medical Student / Clerk Name", ""],
["Signature", ""],
["Supervising Doctor Name", ""],
["Supervisor Signature", ""],
["Consultant / Attending Name", ""],
["Provisional Diagnosis (Student)", ""],
["Confirmed Diagnosis (Supervisor)", ""],
["HbA1c Target Set", ""],
["Next Review Date", ""],
], ["Field", "Entry"]),
new Paragraph({ text: "", spacing: { before: 200 } }),
alertBox("Sources: Goldman-Cecil Medicine (26th edition) | Harrison's Principles of Internal Medicine (22nd edition) | Tintinalli's Emergency Medicine (9th edition) | Firestein & Kelley's Textbook of Rheumatology (11th edition) | ADA Standards of Medical Care in Diabetes 2024", BLUE_LIGHT, BLUE_DARK),
]
}]
});
Packer.toBuffer(doc).then(buffer => {
fs.writeFileSync('/home/daytona/workspace/dm-history-record/DM_Comprehensive_Medical_Record.docx', buffer);
console.log('Document created successfully.');
});