Patient admitted due to left leg finger swelling and pain Present complaint swelling and redness in left 4th finger Swelling from 4 months ago Consulted thuong nhat hospital and he didn't reduce the symptoms on 29/6/2026 he admitted to the truong vuong hospital The pain present all the time When he touches and walking on light pressure he feels pain sometimes he notices white color pus Pain does not radiate to any other joint Pain score 6/10 Gout attack history 3 yrs ago he got his 1st gout attack on the right leg 4th finger and cut it on 2023 This is 2nd attack since 3 yrs Previous attack was same as now While getting the last attack he also had pain in knee joint and the knee joint is still present He relieve pain when he takes rest He has specific diet he avoids non veg he did not eat any red meat and sea food He consumes alcohol 2 to 3 times a year He has no recent infection or last surgery He has no dehydration no trauma ,no excessive exercise He has no joint stiffness No lumps or nodules No urinary symptoms Past history Has past history of hypertension He took medication for 4 yrs and medication is unknown Family history No allergy No family history No weight loss Examination Musculoskeletal Morning stiffness no On observation mild swelling no redness On palpation crepitus seen in left leg Patella tap test negative not more fluid present Cardio normal Got normal. Skin No rashes no ulceration ,tenderness Systematic No fever,no fatiye no weight loss Functional impact Pain on walking Cannot able to climb stairs In right hand 3 rd MCP has gout and in 2nd finger he had trauma and got abnormality in younger age and also he had gout on the 2nd finger. From the information given above and the image make me a medical record in the doc medical record format
cd /home/daytona/workspace/attachments/7cab689d-974b-4a8c-bd62-2c12142e1cf6/ && python3 -c " import pdfplumber with pdfplumber.open('Here is the fully corrected medical record (1).pdf') as pdf: for i, page in enumerate(pdf.pages): print(f'=== PAGE {i+1} ===') print(page.extract_text()) print() "
mkdir -p /home/daytona/workspace/ngo-xuan-ky-medical-record && ls /home/daytona/workspace/ngo-xuan-ky-medical-record/
~/ngo-xuan-ky-medical-record/create_record.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
AlignmentType, HeadingLevel, BorderStyle, WidthType, VerticalAlign,
ShadingType, Header, Footer, PageNumber, NumberFormat
} = require('docx');
const fs = require('fs');
// Helper functions
function heading1(text) {
return new Paragraph({
children: [new TextRun({ text, bold: true, size: 28, font: "Arial" })],
spacing: { before: 280, after: 120 },
border: { bottom: { color: "1F497D", size: 6, style: BorderStyle.SINGLE } }
});
}
function heading2(text) {
return new Paragraph({
children: [new TextRun({ text, bold: true, size: 24, font: "Arial", color: "1F497D" })],
spacing: { before: 200, after: 80 }
});
}
function heading3(text) {
return new Paragraph({
children: [new TextRun({ text, bold: true, size: 22, font: "Arial", color: "374151" })],
spacing: { before: 160, after: 60 }
});
}
function para(text, opts = {}) {
return new Paragraph({
children: [new TextRun({ text, size: 22, font: "Arial", ...opts })],
spacing: { before: 60, after: 60 }
});
}
function labelValue(label, value) {
return new Paragraph({
children: [
new TextRun({ text: label + ": ", bold: true, size: 22, font: "Arial" }),
new TextRun({ text: value || "—", size: 22, font: "Arial" })
],
spacing: { before: 60, after: 60 }
});
}
function bullet(text) {
return new Paragraph({
children: [new TextRun({ text: "• " + text, size: 22, font: "Arial" })],
spacing: { before: 40, after: 40 },
indent: { left: 360 }
});
}
function twoColRow(label, value) {
return new TableRow({
children: [
new TableCell({
children: [new Paragraph({ children: [new TextRun({ text: label, bold: true, size: 20, font: "Arial" })] })],
width: { size: 40, type: WidthType.PERCENTAGE },
shading: { type: ShadingType.SOLID, color: "EFF3FB" }
}),
new TableCell({
children: [new Paragraph({ children: [new TextRun({ text: value, size: 20, font: "Arial" })] })],
width: { size: 60, type: WidthType.PERCENTAGE }
})
]
});
}
function threeColRow(col1, col2, col3, isHeader = false) {
const runOpts = isHeader ? { bold: true, size: 20, font: "Arial" } : { size: 20, font: "Arial" };
const shading = isHeader ? { type: ShadingType.SOLID, color: "1F497D" } : {};
const colorOpts = isHeader ? { color: "FFFFFF" } : {};
return new TableRow({
children: [col1, col2, col3].map(text => new TableCell({
children: [new Paragraph({ children: [new TextRun({ text, ...runOpts, ...colorOpts })] })],
shading,
verticalAlign: VerticalAlign.CENTER
}))
});
}
function fourColRow(col1, col2, col3, col4, isHeader = false) {
const runOpts = isHeader ? { bold: true, size: 20, font: "Arial" } : { size: 20, font: "Arial" };
const shading = isHeader ? { type: ShadingType.SOLID, color: "1F497D" } : {};
const colorOpts = isHeader ? { color: "FFFFFF" } : {};
return new TableRow({
children: [col1, col2, col3, col4].map(text => new TableCell({
children: [new Paragraph({ children: [new TextRun({ text, ...runOpts, ...colorOpts })] })],
shading,
verticalAlign: VerticalAlign.CENTER
}))
});
}
function simpleTable(rows) {
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
borders: {
top: { style: BorderStyle.SINGLE, size: 4, color: "AAAAAA" },
bottom: { style: BorderStyle.SINGLE, size: 4, color: "AAAAAA" },
left: { style: BorderStyle.SINGLE, size: 4, color: "AAAAAA" },
right: { style: BorderStyle.SINGLE, size: 4, color: "AAAAAA" },
insideHorizontal: { style: BorderStyle.SINGLE, size: 2, color: "CCCCCC" },
insideVertical: { style: BorderStyle.SINGLE, size: 2, color: "CCCCCC" }
},
rows
});
}
function spacer() {
return new Paragraph({ children: [new TextRun("")], spacing: { before: 80, after: 80 } });
}
// ========== DOCUMENT CONTENT ==========
const doc = new Document({
styles: {
default: {
document: { run: { font: "Arial", size: 22 } }
}
},
sections: [{
properties: {
page: {
size: { width: 11906, height: 16838 },
margin: { top: 1134, right: 1134, bottom: 1134, left: 1440 }
}
},
headers: {
default: new Header({
children: [
new Paragraph({
children: [
new TextRun({ text: "INTERNAL MEDICINE CASE RECORD | Trung Vuong Hospital, Ho Chi Minh City", size: 18, font: "Arial", color: "666666" })
],
alignment: AlignmentType.CENTER,
border: { bottom: { color: "AAAAAA", size: 4, style: BorderStyle.SINGLE } }
})
]
})
},
footers: {
default: new Footer({
children: [
new Paragraph({
children: [
new TextRun({ text: "Patient: Ngo Xuan Ky | DOB: 10/10/1943 | Admission: 29/06/2026 | Page ", size: 18, font: "Arial", color: "666666" }),
new PageNumber(),
],
alignment: AlignmentType.CENTER,
border: { top: { color: "AAAAAA", size: 4, style: BorderStyle.SINGLE } }
})
]
})
},
children: [
// ====== TITLE BLOCK ======
new Paragraph({
children: [new TextRun({ text: "INTERNAL MEDICINE CASE RECORD", bold: true, size: 36, font: "Arial", color: "1F497D" })],
alignment: AlignmentType.CENTER,
spacing: { before: 120, after: 60 }
}),
new Paragraph({
children: [new TextRun({ text: "Endocrinology / General Medicine Department — Trung Vuong Hospital", size: 22, font: "Arial", color: "374151" })],
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 60 }
}),
new Paragraph({
children: [new TextRun({ text: "Ho Chi Minh City Department of Health", size: 22, font: "Arial", color: "374151" })],
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 40 }
}),
new Paragraph({
children: [new TextRun({ text: "Address: 266 Ly Thuong Kiet, Ward 14, District 10, HCMC | Tel: (028) 54484949 / 38656744", size: 18, font: "Arial", color: "666666" })],
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 200 }
}),
// ====== SECTION I: ADMINISTRATIVE INFORMATION ======
heading1("I. ADMINISTRATIVE INFORMATION"),
spacer(),
simpleTable([
twoColRow("Full Name", "Ngo Xuan Ky"),
twoColRow("Sex", "Male"),
twoColRow("Date of Birth", "10 October 1943"),
twoColRow("Age", "83 years"),
twoColRow("Address", "356/16/1 Go Dau Street, Tan Son Nhi Ward, Tan Phu District, Ho Chi Minh City"),
twoColRow("Phone Number", "0902862902"),
twoColRow("Health Insurance Number", "LH248492149400749088"),
twoColRow("Date of Admission", "29 June 2026 at 16:55"),
twoColRow("Ward / Room / Bed", "Khoa Noi Tiet – Tong Hop (Endocrinology – General) / Room 11 / Bed BCa"),
twoColRow("Inpatient Number", "26/015116"),
twoColRow("Patient ID (MA NB)", "7013112602318"),
twoColRow("Treating Physician", "Dr. Truong Anh Minh"),
twoColRow("Admitting Diagnosis (ICD-10)", "L08 – Other local infections of skin/subcutaneous tissue; M10 – Gout; M86.8 – Suspected osteomyelitis, left foot"),
twoColRow("Previous Hospital", "Thuong Nhat Hospital (prior consultation, no improvement)"),
twoColRow("Referral Source", "Self-referred / Transfer from Thuong Nhat Hospital"),
]),
spacer(),
// ====== SECTION II: REASON FOR ADMISSION ======
heading1("II. REASON FOR ADMISSION"),
para("Swelling, redness, and pain in the left 4th toe (4th digit of left foot) — present for 4 months with no improvement despite outpatient management at Thuong Nhat Hospital. Occasional white pus discharge from the lesion. Admitted to Trung Vuong Hospital on 29/06/2026."),
spacer(),
// ====== SECTION III: HISTORY OF PRESENT ILLNESS ======
heading1("III. HISTORY OF PRESENT ILLNESS"),
para("Mr. Ngo Xuan Ky is an 83-year-old male with a known history of gout who presented with a 4-month history of progressive swelling, erythema, and constant pain in the left 4th toe. He had sought medical attention at Thuong Nhat Hospital but did not experience symptomatic relief, prompting transfer to Trung Vuong Hospital on 29/06/2026."),
spacer(),
heading3("Nature of Pain and Symptoms:"),
bullet("Location: Left 4th toe (4th digit of left foot)"),
bullet("Onset: Approximately 4 months ago"),
bullet("Character: Constant, aching pain with tenderness on palpation and light pressure (e.g. walking)"),
bullet("Severity: Pain score 6/10 on NRS"),
bullet("Radiation: No radiation to other joints"),
bullet("Associated features: Intermittent white pus discharge from the lesion"),
bullet("Aggravating factors: Touch, ambulation, light pressure"),
bullet("Relieving factors: Rest"),
spacer(),
heading3("Gout History:"),
bullet("First gout attack: Approximately 3 years ago — right 4th toe; underwent surgical excision/debridement in 2023"),
bullet("Present episode is the 2nd gout attack over 3 years"),
bullet("Previous attack characteristics were similar to the present episode"),
bullet("During the previous attack: concomitant knee joint pain — knee pain persists to date"),
spacer(),
heading3("Functional Impact:"),
bullet("Pain on walking"),
bullet("Unable to climb stairs"),
spacer(),
heading3("Negative History (Pertinent Negatives):"),
bullet("No recent infection or surgery"),
bullet("No dehydration, trauma, or excessive exercise"),
bullet("No joint stiffness"),
bullet("No lumps or nodules"),
bullet("No urinary symptoms"),
bullet("No fever, fatigue, or unintentional weight loss"),
bullet("Pain does not radiate to other joints"),
spacer(),
// ====== SECTION IV: PAST MEDICAL HISTORY ======
heading1("IV. PAST MEDICAL HISTORY"),
heading3("Medical Conditions:"),
bullet("Hypertension — on antihypertensive medication for approximately 4 years (specific medication unknown)"),
bullet("Gout — first attack 3 years ago on right 4th toe; surgically treated in 2023"),
heading3("Surgical History:"),
bullet("Surgical excision/debridement of right 4th toe gout lesion (2023)"),
heading3("Allergies:"),
bullet("No known drug or food allergies"),
spacer(),
// ====== SECTION V: FAMILY HISTORY ======
heading1("V. FAMILY HISTORY"),
bullet("No family history of gout"),
bullet("No family history of metabolic or autoimmune disease"),
spacer(),
// ====== SECTION VI: SOCIAL HISTORY & LIFESTYLE ======
heading1("VI. SOCIAL HISTORY AND LIFESTYLE"),
bullet("Diet: Special diet — avoids non-vegetarian food; does not eat red meat or seafood"),
bullet("Alcohol: Occasional (2–3 times per year, minimal quantity)"),
bullet("Smoking: Not documented"),
bullet("Occupation: Not documented"),
spacer(),
// ====== SECTION VII: PHYSICAL EXAMINATION ======
heading1("VII. PHYSICAL EXAMINATION"),
heading3("Vital Signs (at 16:55 on 29/06/2026):"),
spacer(),
simpleTable([
fourColRow("Parameter", "Value", "Unit", "Reference", true),
fourColRow("Temperature", "37", "°C", "36.5 – 37.5"),
fourColRow("Heart Rate (Pulse)", "82", "beats/min", "60 – 100"),
fourColRow("Blood Pressure", "130/70", "mmHg", "<130/80"),
fourColRow("Respiratory Rate", "20", "breaths/min", "12 – 20"),
fourColRow("SpO2", "96", "%", "95 – 100"),
fourColRow("BMI", "22.2", "kg/m²", "18.5 – 24.9"),
fourColRow("Glasgow Coma Scale (GCS)", "15/15", "—", "15 = normal"),
]),
spacer(),
heading3("General Appearance:"),
bullet("Conscious, alert, fully oriented"),
bullet("Good general condition (Toan trang: Tot)"),
bullet("No acute distress"),
heading3("Musculoskeletal Examination:"),
bullet("Left 4th toe: Mild swelling on observation; no active redness at time of examination"),
bullet("Tenderness on palpation of left 4th toe"),
bullet("Crepitus detected on palpation of left lower limb"),
bullet("Patella tap test: Negative (no significant knee effusion)"),
bullet("No morning stiffness"),
bullet("No lumps or nodules"),
bullet("Right hand 3rd MCP joint: Gout present"),
bullet("Right hand 2nd finger: History of trauma in younger age with resulting deformity; also had gout involving this digit"),
heading3("Cardiovascular:"),
bullet("Regular heart rate and rhythm"),
bullet("No murmurs detected"),
bullet("Blood pressure 130/70 mmHg"),
heading3("Gastrointestinal (Abdomen):"),
bullet("Abdomen: Normal"),
heading3("Respiratory:"),
bullet("Normal breathing, no abnormal findings"),
heading3("Skin:"),
bullet("No rashes"),
bullet("No ulceration"),
bullet("Tenderness at the left 4th toe lesion"),
bullet("No xanthomas or tophaceous deposits noted elsewhere"),
heading3("Neurological:"),
bullet("No focal neurological deficits"),
heading3("Systemic:"),
bullet("No fever"),
bullet("No fatigue"),
bullet("No weight loss"),
spacer(),
// ====== SECTION VIII: CASE SUMMARY ======
heading1("VIII. CASE SUMMARY"),
para("Mr. Ngo Xuan Ky is an 83-year-old male with a background of gout and hypertension who presented with a 4-month history of persistent swelling, tenderness, and pain (NRS 6/10) in the left 4th toe, with intermittent white pus discharge. This is his second gout-related episode in 3 years. His first episode affected the right 4th toe and was treated surgically in 2023. He also has persistent knee pain dating from the previous gout attack. On examination, mild swelling and tenderness of the left 4th toe were present, with crepitus in the left lower limb. Vital signs were stable; BMI 22.2. He follows a diet low in purines (avoids red meat and seafood) and drinks minimally."),
spacer(),
heading3("Subjective:"),
bullet("Constant pain in left 4th toe (NRS 6/10)"),
bullet("Swelling present for 4 months"),
bullet("Intermittent white pus discharge"),
bullet("Pain worsened by walking and touch; relieved by rest"),
bullet("Unable to climb stairs"),
heading3("Objective:"),
bullet("Mild swelling left 4th toe; tenderness on palpation"),
bullet("Crepitus left lower limb"),
bullet("BP 130/70 mmHg; HR 82 bpm; SpO2 96%; Temp 37°C; GCS 15/15"),
bullet("Lab: Uric acid 519 µmol/L (elevated); WBC 12.62 K/µL (elevated); Neutrophils 69.0% (elevated)"),
bullet("ECG: Normal sinus rhythm 73 bpm; QRS 135 ms; no acute ischaemic changes"),
spacer(),
// ====== SECTION IX: INVESTIGATIONS ======
heading1("IX. INVESTIGATIONS"),
heading2("A. Haematology (Blood Count) — Sample Date: 29/06/2026"),
spacer(),
simpleTable([
fourColRow("Test", "Result", "Unit", "Reference Range", true),
fourColRow("WBC (White Blood Cell Count)", "12.62 (HIGH)", "K/µL", "4.4 – 10.8"),
fourColRow("Neutrophils # (NEU#)", "8.70 (HIGH)", "K/µL", "2.0 – 6.9"),
fourColRow("Neutrophils % (NEU%)", "69.0", "%", "49 – 72"),
fourColRow("Lymphocytes % (LYM%)", "14.7 (LOW)", "%", "20 – 42"),
fourColRow("Monocytes # (MONO#)", "1.43 (HIGH)", "K/µL", "0.0 – 0.9"),
fourColRow("Monocytes % (MONO%)", "11.3", "%", "0 – 12"),
fourColRow("Eosinophils % (EOS%)", "1.9", "%", "0 – 7"),
fourColRow("Basophils # (BASO#)", "0.05", "K/µL", "0.0 – 0.2"),
fourColRow("Basophils % (BASO%)", "0.4", "%", "0 – 2.5"),
fourColRow("Immature Granulocytes % (IG%)", "0.34", "%", "0 – 0.6"),
fourColRow("RBC (Red Blood Cells)", "2.7 (LOW)", "M/µL", "4.3 – 5.8"),
fourColRow("Haemoglobin (HGB)", "4.41 (LOW)", "g/dL", "13 – 16.3"),
fourColRow("Haematocrit (HCT)", "13.7 (LOW)", "%", "38 – 50"),
fourColRow("MCV", "41.1 (LOW)", "fL", "80 – 97"),
fourColRow("MCH", "93.2 (HIGH)", "pg", "27.2 – 35.4"),
fourColRow("MCHC", "31.1", "g/dL", "31.8 – 35.4"),
fourColRow("RDW", "33.3 (HIGH)", "%", "11.5 – 14.8"),
fourColRow("Platelets (PLT)", "292", "K/µL", "150 – 450"),
fourColRow("MPV", "8.5", "fL", "5 – 10"),
]),
spacer(),
heading2("B. Biochemistry — Sample Date: 29/06/2026"),
spacer(),
simpleTable([
fourColRow("Test", "Result", "Unit", "Reference Range", true),
fourColRow("Glucose", "5.2", "mmol/L", "3.9 – 5.6"),
fourColRow("Creatinine", "111 (HIGH)", "µmol/L", "59 – 104"),
fourColRow("eGFR (CKD-EPI)", "519", "mL/min/1.73m²", "> 90"),
fourColRow("Uric Acid", "519 (HIGH)", "µmol/L", "208 – 428"),
fourColRow("Electrolytes (Na, K, Cl)", "Ordered (01/01/25)", "—", "—"),
fourColRow("Na+", "141", "mmol/L", "135 – 145"),
fourColRow("K+", "3.7", "mmol/L", "3.5 – 5.1"),
fourColRow("Cl-", "105", "mmol/L", "98 – 108"),
fourColRow("AST (GOT)", "16", "U/L", "< 50"),
fourColRow("ALT (GPT)", "14", "U/L", "< 50"),
]),
spacer(),
heading2("C. Electrocardiogram (ECG) — Date: 29/06/2026 at 17:30"),
spacer(),
simpleTable([
twoColRow("Heart Rate (HR)", "73 bpm"),
twoColRow("PR Interval", "178 ms"),
twoColRow("P Duration", "130 ms"),
twoColRow("QRS Duration", "135 ms (borderline prolonged)"),
twoColRow("T Duration", "244 ms"),
twoColRow("QT / QTc", "410 / 451 ms"),
twoColRow("P / QRS / T Axis", "27.8° / 94.0° / 5.9°"),
twoColRow("R(V5) / S(V1)", "0.65 mV / 0.28 mV"),
twoColRow("R(V5) + S(V1)", "0.94 mV"),
twoColRow("Interpretation", "Normal sinus rhythm; borderline QRS broadening; no acute ischaemic changes. Note: right bundle branch block (RBBB) pattern to be confirmed by specialist physician."),
]),
spacer(),
heading2("D. Functional Investigations — 29/06/2026"),
bullet("ECG (Dien tim thuong) — performed 29/06/2026 18:31"),
bullet("Skin and soft tissue biopsy / culture of left foot lesion — ordered (Khac cua da va mo duoi da)"),
bullet("X-ray of left foot bones — ordered (Chup X-quang xuong ban chan trai)"),
bullet("proBNP (NT-proBNP) — ordered"),
spacer(),
// ====== SECTION X: DIFFERENTIAL DIAGNOSIS ======
heading1("X. DIFFERENTIAL DIAGNOSIS"),
spacer(),
simpleTable([
threeColRow("Diagnosis", "Supporting Evidence", "Against", true),
threeColRow(
"Acute Gout Flare (Most Likely)",
"Known gout history; prior right foot attack; elevated uric acid 519 µmol/L; 2nd metatarsophalangeal involvement; dietary purine restriction but with residual hyperuricaemia",
"Chronic duration (4 months); pus discharge more typical of infected tophus or septic arthritis"
),
threeColRow(
"Infected Tophaceous Gout",
"Chronic swelling 4 months; white pus discharge; elevated WBC 12.62; neutrophilia; tenderness",
"No systemic fever documented; no prior tophus noted"
),
threeColRow(
"Septic Arthritis / Osteomyelitis",
"Pus discharge; elevated WBC; ICD-10 M86.8 listed (TD Viem xuong ban chan trai — suspected osteomyelitis); no improvement with previous treatment",
"No systemic sepsis; no preceding trauma or surgery; afebrile"
),
threeColRow(
"Cellulitis / Soft Tissue Infection (L08)",
"Swelling, tenderness, pus discharge; ICD-10 L08 assigned",
"No systemic fever; chronic course not typical of simple cellulitis"
),
threeColRow(
"Pseudogout (CPPD)",
"Elderly male; joint involvement",
"Gout well-documented; elevated uric acid strongly supports gout"
),
threeColRow(
"Rheumatoid Arthritis",
"Multiple joint involvement (knee, hands, foot)",
"No morning stiffness; no symmetric polyarthritis; no nodules; elevated uric acid"
),
]),
spacer(),
// ====== SECTION XI: DEFINITIVE DIAGNOSIS ======
heading1("XI. DEFINITIVE DIAGNOSIS"),
heading3("Primary Diagnosis:"),
bullet("Gout (M10) — Acute-on-chronic gout flare, left 4th toe, with suspected infected tophus/soft tissue infection (L08)"),
heading3("Secondary Diagnoses / Comorbidities:"),
bullet("Suspected osteomyelitis, left foot (M86.8 — working diagnosis pending imaging and culture results)"),
bullet("Hyperuricaemia — serum uric acid 519 µmol/L"),
bullet("Hypertension — on antihypertensive medication"),
bullet("Elevated creatinine (111 µmol/L) — possible CKD or acute kidney stress; eGFR to be formally calculated"),
bullet("Persistent knee joint pain — likely gouty arthropathy"),
bullet("Right hand 3rd MCP joint gout"),
spacer(),
// ====== SECTION XII: TREATMENT PLAN ======
heading1("XII. TREATMENT PLAN"),
heading2("A. Non-Pharmacological Management"),
bullet("Rest; elevate affected limb"),
bullet("Diet: Low-purine diet — continue avoidance of red meat, organ meat, and seafood; increase hydration (target >2L/day) to promote uric acid excretion"),
bullet("Avoid alcohol completely"),
bullet("Wound care: Daily dressing of left 4th toe lesion; monitor for increased discharge, odour, or systemic signs of infection"),
bullet("Patient education: Gout management, medication adherence, dietary adherence, recognition of signs of systemic infection"),
bullet("Nursing care: Assist with mobility; fall prevention measures given age 83 and impaired ambulation"),
bullet("Monitoring: Blood pressure, pulse, temperature, and respiratory rate every 12 hours"),
heading2("B. Pharmacological Treatment (Orders dated 29/06/2026)"),
spacer(),
simpleTable([
fourColRow("Drug", "Dose / Route", "Frequency", "Notes", true),
fourColRow("Paracetamol (Acetaminophen) 500 mg", "500 mg oral / PR", "2 tablets x 2/day (morning 500mg, evening 500mg)", "Pain management; safe in renal impairment"),
fourColRow("Uric acid-lowering therapy", "To be initiated / reviewed", "Per physician order", "Allopurinol or febuxostat — hold during acute attack per guidelines; start after acute episode resolves"),
fourColRow("Antibiotics", "Pending culture results", "IV or oral — per culture and sensitivity", "For suspected infected tophus / L08 diagnosis"),
fourColRow("Antihypertensive", "Continuation of home medication", "As per prior regimen", "Medication name not on record — clarify with patient"),
]),
spacer(),
heading2("C. Investigations Ordered"),
bullet("Blood culture — if systemic infection suspected"),
bullet("Wound swab / culture and sensitivity from left 4th toe lesion"),
bullet("X-ray left foot (plain radiograph) — assess for erosive gout, osteomyelitis, soft tissue calcification"),
bullet("Uric acid repeat — to guide urate-lowering therapy titration"),
bullet("Renal function panel (creatinine, eGFR, urea) — creatinine elevated, assess renal clearance"),
bullet("Erythrocyte sedimentation rate (ESR) and C-reactive protein (CRP) — assess systemic inflammation"),
bullet("proBNP (NT-proBNP) — cardiac screening given age and hypertension"),
bullet("Synovial fluid aspiration (if feasible) — gold standard for gout confirmation and to rule out septic arthritis"),
spacer(),
heading2("D. Monitoring Plan"),
bullet("Vital signs every 12 hours"),
bullet("Wound assessment daily"),
bullet("Urine output monitoring (given elevated creatinine)"),
bullet("Blood glucose monitoring (ordered — bedside capillary glucose)"),
bullet("Daily nursing assessment: mobility, pain score, mental status"),
spacer(),
// ====== SECTION XIII: PROBLEM LIST ======
heading1("XIII. PROBLEM LIST"),
spacer(),
simpleTable([
threeColRow("Problem", "Active / Resolved", "Management", true),
threeColRow("Gout flare — left 4th toe", "Active", "Analgesics; urate-lowering therapy post-acute phase"),
threeColRow("Suspected infected tophus / L08 soft tissue infection", "Active", "Wound swab, culture, antibiotics"),
threeColRow("Suspected osteomyelitis (M86.8)", "Under investigation", "X-ray; MRI if indicated; orthopaedic review"),
threeColRow("Hyperuricaemia (Uric acid 519 µmol/L)", "Active", "Dietary modification; urate-lowering therapy"),
threeColRow("Hypertension", "Active — on medication", "Continue home antihypertensive"),
threeColRow("Elevated creatinine (111 µmol/L)", "Active", "Monitor eGFR; avoid nephrotoxic agents"),
threeColRow("Persistent knee arthropathy (likely gout)", "Active", "Joint assessment; urate lowering"),
threeColRow("Right hand 3rd MCP gout", "Active", "Monitor; urate lowering therapy"),
threeColRow("Right 2nd finger post-traumatic deformity (childhood)", "Resolved / chronic", "No active intervention required"),
]),
spacer(),
// ====== SIGNATURE BLOCK ======
heading1("XIV. SIGNATURES"),
spacer(),
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 },
insideHorizontal: { style: BorderStyle.NONE },
insideVertical: { style: BorderStyle.NONE }
},
rows: [
new TableRow({
children: [
new TableCell({
children: [
new Paragraph({ children: [new TextRun({ text: "Treating Physician", bold: true, size: 22, font: "Arial" })], alignment: AlignmentType.CENTER }),
new Paragraph({ children: [new TextRun({ text: " ", size: 22 })], spacing: { before: 400, after: 80 } }),
new Paragraph({ children: [new TextRun({ text: "Dr. Truong Anh Minh", size: 22, font: "Arial" })], alignment: AlignmentType.CENTER }),
new Paragraph({ children: [new TextRun({ text: "Endocrinology – General Medicine", size: 20, font: "Arial", color: "666666" })], alignment: AlignmentType.CENTER }),
new Paragraph({ children: [new TextRun({ text: "Trung Vuong Hospital", size: 20, font: "Arial", color: "666666" })], alignment: AlignmentType.CENTER }),
new Paragraph({ children: [new TextRun({ text: "Date: 29/06/2026", size: 20, font: "Arial" })], alignment: AlignmentType.CENTER }),
],
width: { size: 50, type: WidthType.PERCENTAGE }
}),
new TableCell({
children: [
new Paragraph({ children: [new TextRun({ text: "Head of Department", bold: true, size: 22, font: "Arial" })], alignment: AlignmentType.CENTER }),
new Paragraph({ children: [new TextRun({ text: " ", size: 22 })], spacing: { before: 400, after: 80 } }),
new Paragraph({ children: [new TextRun({ text: "________________________________", size: 22, font: "Arial" })], alignment: AlignmentType.CENTER }),
new Paragraph({ children: [new TextRun({ text: "Trung Vuong Hospital", size: 20, font: "Arial", color: "666666" })], alignment: AlignmentType.CENTER }),
new Paragraph({ children: [new TextRun({ text: "Date: ___/___/2026", size: 20, font: "Arial" })], alignment: AlignmentType.CENTER }),
],
width: { size: 50, type: WidthType.PERCENTAGE }
})
]
})
]
}),
spacer(),
spacer(),
new Paragraph({
children: [new TextRun({ text: "— END OF RECORD —", size: 20, font: "Arial", color: "888888", bold: true })],
alignment: AlignmentType.CENTER,
spacing: { before: 200, after: 100 }
}),
]
}]
});
Packer.toBuffer(doc).then(buffer => {
fs.writeFileSync("/home/daytona/workspace/ngo-xuan-ky-medical-record/Ngo_Xuan_Ky_Medical_Record.docx", buffer);
console.log("SUCCESS: File written.");
}).catch(err => {
console.error("ERROR:", err);
process.exit(1);
});