Can you make a rguhs exam oriented notes for hernia Including mnemonics Covering all the latest year questios

Reading File
Finding Sources
Searching the Web

RGUHS MS surgery exam questions hernia inguinal femoral 2020 2021 2022 2023 2024

Now let me read the key hernia sections from Bailey & Love and Maingot's - the most relevant surgery textbooks for RGUHS:
Reading File
Reading File

For final year mbbs

Finding Sources
Searching the Web

RGUHS final year MBBS surgery theory questions hernia 2019 2020 2021 2022 2023 2024 2025

Good. Now let me read the key hernia sections from Bailey & Love and S Das (the go-to books for RGUHS MBBS surgery):
Reading File
Reading File
Reading File
Reading File
Reading File
Finding Sources
Reading File
Reading File
I now have enough rich content from Bailey & Love and S Das. Let me compile the comprehensive RGUHS Final Year MBBS notes:Here are your complete RGUHS Final Year MBBS Surgery exam-oriented notes on Hernia - covering every commonly asked question type with mnemonics:

šŸ„ HERNIA - RGUHS FINAL YEAR MBBS SURGERY NOTES

Sources: Bailey & Love's Short Practice of Surgery 28th Ed | S Das Manual of Clinical Surgery 13th Ed | Schwartz's Principles of Surgery 11th Ed

⭐ FREQUENTLY ASKED RGUHS QUESTIONS (Long & Short Notes)

Long Questions:
  • Classify hernias. Describe anatomy, clinical features and management of inguinal hernia.
  • Describe indirect vs direct inguinal hernia - differences.
  • Describe the anatomy of femoral canal. Clinical features and management of femoral hernia.
  • Complications of inguinal hernia - management of strangulated hernia.
  • Describe various types of umbilical hernia and their management.
  • Incisional hernia - causes, clinical features, management.
  • Surgical anatomy of inguinal canal.
Short Notes:
  • Richter's hernia | Littre's hernia | Maydl's hernia | Pantaloon hernia | Spigelian hernia | Sliding hernia
  • Hesselbach's triangle
  • Herniotomy vs herniorrhaphy vs hernioplasty
  • TEP / TAPP repair
  • Causes of recurrent hernia

1. DEFINITION & COMPONENTS OF A HERNIA

Definition: Protrusion of a viscus or part of a viscus through an abnormal opening in the walls of its containing cavity.
Parts of a Hernia:
Mnemonic: "SNC Covered"
  • Sac - peritoneum lining the hernial sac (neck, body, fundus)
  • Neck - junction of sac with peritoneal cavity (most important part)
  • Contents - omentum, small bowel (most common), colon, bladder
  • Coverings - layers overlying the sac

2. CLASSIFICATION OF HERNIA

By Anatomy (Site):

Mnemonic: "I Feel Unusual Pain Every Single Day"
  • Inguinal (most common overall)
  • Femoral
  • Umbilical/Para-umbilical
  • Para-stomal
  • Epigastric
  • Spigelian
  • Diaphragmatic/Hiatal

By Clinical State:

Mnemonic: "ROIS"
  • Reducible - contents can be returned to cavity
  • Obstructed - hollow viscus obstructed, blood supply intact
  • Irreducible - cannot return, but blood supply intact
  • Strangulated - blood supply compromised → ischemia → gangrene

3. INGUINAL HERNIA (Most High-Yield)

Anatomy of Inguinal Canal:

Length: 4 cm long | Direction: downward, medially, anteriorly
Boundaries:
WallStructure
AnteriorExternal oblique aponeurosis (whole length) + internal oblique (lateral 1/3)
PosteriorTransversalis fascia (whole) + conjoint tendon (medial 1/3)
RoofArching fibers of internal oblique + transversus abdominis
FloorInguinal ligament + lacunar ligament (medially)
Mnemonic for walls: "2A2P" Anterior = 2 structures | Posterior = 2 structures
Rings:
  • Deep inguinal ring: Defect in transversalis fascia | Midpoint of inguinal ligament (midpoint between ASIS and pubic tubercle) | Inferior epigastric vessels lie just medial
  • Superficial inguinal ring: Inverted-V shaped defect in external oblique aponeurosis | Above and medial to pubic tubercle
Contents of inguinal canal (male):
Mnemonic: "I Get Goosebumps Later - D&D"
  • Ilioinguinal nerve
  • Genital branch of genitofemoral nerve
  • Gonadal (testicular) vessels
  • Lympatics
  • Deferens (vas deferens)
  • Dartos fascia (cremasteric muscle fibers)
(In female: round ligament replaces vas deferens)

Hesselbach's Triangle (RGUHS Fav Short Note):

Mnemonic: "RIL"
  • Rectus abdominis (lateral border) - medial boundary
  • Inferior epigastric artery - lateral boundary
  • Linguinal ligament - inferior boundary
Direct hernia passes through Hesselbach's triangle

Indirect vs Direct Inguinal Hernia (CLASSIC COMPARISON QUESTION)

FeatureIndirect (Oblique)Direct (Medial)
Frequency80-85% of all inguinal15-20%
AgeAny age (even infants)Middle-aged and elderly
SexMale > FemaleAlmost exclusively male
CauseCongenital (patent processus vaginalis)Acquired weakness of posterior wall
Neck of sacLateral to inferior epigastric arteryMedial to inferior epigastric artery
PathThrough deep inguinal ring → inguinal canal → superficial ring → scrotumDirectly through Hesselbach's triangle
Sac coveringsCovered by all 3 spermatic fasciaeNot covered by internal spermatic fascia
CompletenessOften complete (reaches scrotum)Rarely complete
ReducibilityDoes not reduce spontaneouslyOften reduces when lying
StrangulationMore commonLess common
Control on deep ringHernia controlled by pressure on deep ringNOT controlled
Zieman's testMiddle finger felt pulsing = directIndex finger felt pulsing = indirect
Mnemonic to remember neck position: "DILM" Direct = Inferior epigastric Lateral to neck = Medial to artery

Clinical Features of Inguinal Hernia:

  • Swelling in groin, descends to scrotum
  • Appears on straining/coughing, reduces on lying down
  • Cough impulse - expansile impulse felt on coughing
  • Invagination test - finger invaginated from scrotum along cord; impulse hits fingertip (indirect) or fingerpad (direct)

Types by Extent (S Das):

  1. Bubonocele - hernia within the inguinal canal, does not exit superficial ring
  2. Incomplete hernia - exits superficial ring but does not reach scrotum
  3. Complete hernia - reaches the bottom of the scrotum

4. FEMORAL HERNIA (Very High Yield)

Femoral Canal (Short Note):

  • Innermost compartment of femoral sheath
  • Length: ~1.3 cm
  • Boundaries:
Mnemonic: "NAIL"
  • Neck/anterior = inguinal ligament
  • Anodal node of Cloquet fills the canal normally
  • Inner side = lacunar (Gimbernat's) ligament ← danger - sharp edge, causes strangulation
  • Lateral = femoral vein
Contents normally: Fat + lymphatics + lymph node of Cloquet

Femoral Hernia - Key Facts:

  • More common in women (but inguinal hernia is still commonest hernia in women overall)
  • Right side > Left side (2:1)
  • Most common age: >50 years
  • High risk of strangulation because femoral ring is rigid and narrow (lacunar ligament is sharp)

Femoral vs Inguinal Hernia Distinction:

FeatureFemoralInguinal
Position relative to pubic tubercleLateral and below inguinal ligamentMedial and above inguinal ligament
Invagination testInguinal canal emptyInguinal canal has impulse
Control at deep ringCannot be controlledIndirect can be controlled
Mnemonic: "Femoral = Below & Lateral to pubic tubercle; Inguinal = Above & Medial" "FBI" = Femoral Below Inguinal

Management of Femoral Hernia:

  • Always requires surgery due to high risk of strangulation
  • Approaches:
    • Lockwood's (low) approach - below inguinal ligament - most common for elective
    • Lotheissen's approach - through inguinal canal (transpubic)
    • McEvedy's approach - high approach, through lower rectus sheath - best for strangulated femoral hernia (allows bowel inspection)
    • TAPP/TEP - laparoscopic
Mnemonic for approaches: "LLM" - Low Lockwood, Lotheissen, McEvedy (High)

5. SPECIAL VARIETIES OF HERNIA (Short Note Goldmine)

Mnemonic: "SLIMPR" for special hernias

Sliding Hernia (En Glissade):

  • Part of the wall of the sac is formed by a viscus (e.g., cecum on right, sigmoid on left, bladder)
  • Important: Never ligate the sac without identifying the sliding viscus
  • Associated with Maydl's hernia confusion - different!

Littre's Hernia:

  • Hernia containing Meckel's diverticulum in the sac
  • Can strangulate the diverticulum alone without obstruction
  • Described by Alexis Littre (1700)

Richter's Hernia:

  • Only part (knuckle) of the bowel wall is trapped in the hernia sac (antimesenteric border)
  • No obstruction of bowel lumen (contents can still pass)
  • But can strangulate silently - very dangerous - patient may not have features of obstruction
  • Most common at femoral canal

Maydl's Hernia (Hernia-in-W):

  • Two loops of bowel in sac with connecting loop inside abdomen forms a 'W' shape
  • The middle loop (inside abdomen) becomes strangulated
  • Opening sac shows two loops - middle loop inside is gangrenous
  • Danger: strangulation inside abdomen not obvious at surgery → must inspect both limbs

Pantaloon Hernia (Saddle-bag hernia):

  • Combined direct + indirect hernia straddling the inferior epigastric artery
  • Sac appears on both sides like a pair of pantaloons/trousers

Spigelian Hernia:

  • Hernia through Spigelian fascia (lateral edge of rectus abdominis at the level of arcuate line/linea semilunaris)
  • Interparietal hernia - lies between layers of abdominal wall → often missed clinically
  • CT scan is investigation of choice
  • Treatment: surgical repair

6. UMBILICAL HERNIA

4 Types:
  1. Exomphalos (Omphalocele) - congenital, bowel in umbilical cord, covered by translucent membrane; vs Gastroschisis (no sac, lateral to umbilicus, bowel directly exposed)
  2. Congenital umbilical hernia - through umbilical scar in infants; 90% resolve spontaneously by 5 years; wide neck = rarely strangulates
  3. Acquired umbilical hernia - adults, through umbilical scar due to raised IAP (pregnancy, ascites, ovarian cyst)
  4. Para-umbilical hernia - most common acquired umbilical hernia; just above umbilicus; obese middle-aged women; irreducible when omentum adherent; Mayo's repair (vest-over-pants repair)
Mnemonic: "ECAP" = Exomphalos, Congenital, Acquired, Para-umbilical

Para-umbilical hernia repair:

  • Mayo's operation - transverse elliptical incision; sac excised; fascial layers overlapped (vest-over-pants/imbrication technique)
  • Mesh repair preferred for large defects

7. INCISIONAL HERNIA

Causes (RGUHS Short Note):

Mnemonic: "MOAN WIPS"
  • Malnutrition / Midline incision (higher risk than transverse)
  • Obesity
  • Anemia / corticosteroids
  • Non-absorbable suture not used / poor technique
  • Wound infection / Wound hematoma
  • Intraabdominal pressure raised (post-op cough, ileus, constipation)
  • Patient factor - old age, immunosuppression
  • Steroid therapy / Systemic illness (jaundice, uraemia)

Clinical Features:

  • Swelling through previous scar, increases on straining
  • Expansile cough impulse
  • May be reducible or irreducible
  • Often multiple defects found at surgery even if single bulge seen

Management:

  • Conservative: Supportive belt in unfit patients
  • Surgical:
    • Primary repair (Mayo's type, direct suture) - small defects only
    • Mesh repair (preferred) - onlay, sublay (retrorectus), intraperitoneal (IPOM)
    • Laparoscopic IPOM - intraperitoneal onlay mesh - for moderate-sized hernias
    • Component separation - for large/complex defects

8. STRANGULATED HERNIA (High Priority Long Q)

Pathophysiology:

  • Tight neck compresses venous return → venous congestion → edema → arterial occlusion → ischemia → gangrene in 6 hours
  • Sac fluid becomes blood-stained → Champagne sign (turbid/champagne colored sac fluid = irreversible ischemia)

Clinical Features:

  • Previously reducible hernia becomes suddenly irreducible
  • Severe pain, tender, tense, no cough impulse
  • Features of intestinal obstruction: vomiting, distension, absolute constipation
  • Systemic: fever, tachycardia, toxemia

Management - Emergency Surgery:

  1. Resuscitation - IV fluids, NGT, catheterize, antibiotics
  2. Surgery:
    • Incise coverings, open sac carefully
    • Do NOT reduce contents before assessment
    • Assess viability of bowel: pink color, peristalsis, mesenteric pulsation
    • If viable: reduce and repair
    • If non-viable: resect + anastomosis
    • Mesh use acceptable even in contaminated field with antibiotic cover
Mnemonic for bowel viability check: "CPC" Color (pink vs black) | Peristalsis | Circulation (mesenteric pulse)

Exceptions - Richter's hernia:

  • No bowel obstruction features even though bowel wall is strangulating → dangerous → delayed diagnosis

9. HERNIA REPAIRS - OPERATIONS (Very Frequently Asked)

Mnemonic: "3 H's of Surgery"
  • Herniotomy = Only sac dissection, ligation and excision; NO repair of posterior wall. Done in children and fit young adults with indirect hernia
  • Herniorrhaphy = Herniotomy + repair with sutures (tissue-based repair)
  • Hernioplasty = Herniotomy + reinforcement with mesh (Lichtenstein)

Open Repairs:

RepairKey Feature
Bassini'sConjoint tendon sutured to inguinal ligament
Shouldice4-layer continuous stainless steel wire repair; gold standard tissue repair; <1% recurrence
LichtensteinTension-free mesh repair; current gold standard open repair
Darn repairProlene darn, tension-free
McVay (Cooper's)Conjoint tendon to Cooper's ligament; good for femoral hernia too

Laparoscopic Repairs:

  • TEP (Totally Extraperitoneal): Extraperitoneal dissection, no peritoneal breach, fewer adhesions, faster recovery; preferred for bilateral hernia
  • TAPP (TransAbdominal PrePeritoneal): Peritoneal cavity entered, then preperitoneal space dissected
Mnemonic: "TEP stays outside, TAPP goes in"

10. SPECIAL POINTS / EXAMINER FAVORITES

Why is Indirect Hernia more common than Direct?

Patent processus vaginalis persists in ~20% of adults but symptomatic hernia develops with increased IAP

Why is Femoral Hernia dangerous?

Rigid unyielding femoral ring with sharp lacunar (Gimbernat's) ligament medially → strangulation common

Why use Shouldice over Bassini?

Shouldice has 4-layer repair using the actual strength of transversalis fascia (not just conjoint tendon); much lower recurrence rate

Pantaloon hernia surgery:

Divide the inferior epigastric artery to treat both sacs as one, or treat separately

Sliding hernia - what NOT to do:

Never blindly ligate the sac - the sliding viscus (cecum/bladder) forms part of sac wall - you'll injure it

Investigations:

  • Most hernias: clinical diagnosis
  • Occult hernias: USG/CT (CT preferred for Spigelian, obturator hernia)
  • Hiatus hernia: Barium swallow, OGD

11. QUICKFIRE MNEMONICS SUMMARY SHEET

FactMnemonic
Parts of herniaSNC Covered (Sac, Neck, Contents, Coverings)
Clinical statesROIS (Reducible, Obstructed, Irreducible, Strangulated)
Inguinal canal walls"2A2P" (2 Anterior, 2 Posterior structures)
Contents of inguinal canal"I Get Goosebumps Later - D&D"
Hesselbach's triangleRIL (Rectus, Inferior epigastric, Ligament inguinal)
Femoral positionFBI (Femoral Below Inguinal)
Femoral approachesLLM (Lockwood, Lotheissen, McEvedy)
Special herniasSLIMPR (Sliding, Littre's, Richter's, Maydl's, Pantaloon, Spigelian)
Umbilical typesECAP (Exomphalos, Congenital, Acquired, Para-umbilical)
Incisional hernia causesMOAN WIPS
Bowel viabilityCPC (Color, Peristalsis, Circulation)
3 operations3 H's (Herniotomy, Herniorrhaphy, Hernioplasty)
TEP vs TAPP"TEP stays outside, TAPP goes in"

12. ONE-LINERS FOR MCQs & VIVA

  • Most common hernia overall = Inguinal
  • Most common hernia in women = Inguinal (not femoral!)
  • Femoral hernia more common in = Women (but inguinal still commonest in women)
  • Hernia with highest strangulation risk = Femoral (rigid ring)
  • Silent strangulation = Richter's hernia
  • W-hernia = Maydl's
  • Hernia of Meckel's diverticulum = Littre's
  • Sac wall formed by viscus = Sliding hernia
  • Hernia straddling inferior epigastric = Pantaloon
  • Interparietal hernia at Spigelian fascia = Spigelian hernia
  • Hernia through femoral canal with pre-vascular course = Pre-vascular femoral hernia
  • Gold standard open repair = Lichtenstein (tension-free mesh)
  • Gold standard tissue repair = Shouldice
  • Repair used for femoral hernia (open) = McEvedy (for strangulated), Lockwood (elective)
  • Best for strangulated femoral = McEvedy's approach (high approach, access to bowel)
  • Para-umbilical hernia repair = Mayo's operation
  • Champagne sign = Strangulated hernia (turbid sac fluid = bowel is non-viable)
  • Congenital umbilical hernia - 90% resolve by = 5 years of age
  • Incisional hernia incidence after laparotomy = 10-50%
  • Incisional hernia incidence after laparoscopic port = 1-5%
  • Chronic pain after inguinal hernia repair = affects up to 20% of patients
  • Recurrence after mesh repair goal = <5% at 5 years
  • Laparoscopic repair preferred for = Bilateral hernia (TEP/TAPP)

13. DIAGRAM TIPS FOR EXAM

When drawing inguinal hernia diagrams, always label:
  1. ASIS and pubic tubercle (landmarks)
  2. Inguinal ligament
  3. Deep and superficial inguinal rings
  4. Inferior epigastric artery (key reference for direct vs indirect)
  5. Hesselbach's triangle
For Femoral hernia anatomy: Draw femoral sheath with its 3 compartments (nerve lateral, artery middle, vein medial, canal innermost - NAVY = Nerve, Artery, Vein, Y-empty canal)
Mnemonic for femoral sheath contents: "NAVY" Nerve (outside sheath) | Artery | Vein | Y = Yellow fat (canal)

Sources: Bailey & Love's Short Practice of Surgery 28th Ed, S Das Manual of Clinical Surgery 13th Ed, Schwartz's Principles of Surgery 11th Ed
---These notes cover every angle RGUHS has asked on hernia. Here's a quick navigation guide:
For a 10-mark long question → Use sections 3 (Inguinal - full detail), 4 (Femoral), or 8 (Strangulated hernia)
For a 5-mark short note → Use sections 5 (Special hernias), 6 (Umbilical), 7 (Incisional), or 9 (Operations)
For Viva → Section 12 one-liners + all mnemonics
Key exam traps to avoid:
  • Most common hernia in women = still inguinal (not femoral - examiners love this)
  • Richter's strangulates without obstruction (silent killer)
  • Maydl's - the gangrenous loop is the middle one inside the abdomen, not the visible ones
  • Sliding hernia - never blindly ligate the sac
  • Femoral canal approach for strangulation = McEvedy (NOT Lockwood)
Good luck for your exams! šŸŽÆ

Make the above content a pdf form

Reading File
Running Command

ls /home/daytona/workspace/ 2>/dev/null || mkdir -p /home/daytona/workspace/hernia-notes

Running Command

mkdir -p /home/daytona/workspace/hernia-notes && python3 -c "import reportlab; print('reportlab ok')" && python3 -c "from reportlab.lib.pagesizes import A4; print('A4 ok')"

Writing File

~/hernia-notes/generate_hernia_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import mm, cm
from reportlab.lib import colors
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, PageBreak, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import ListFlowable, ListItem

OUTPUT = "/home/daytona/workspace/hernia-notes/Hernia_RGUHS_MBBS_Notes.pdf"

doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    rightMargin=18*mm,
    leftMargin=18*mm,
    topMargin=18*mm,
    bottomMargin=18*mm,
    title="Hernia - RGUHS Final Year MBBS Surgery Notes",
    author="Orris Medical"
)

W = A4[0] - 36*mm  # usable width

# ── Colour palette ─────────────────────────────────────────────────────────
NAVY   = colors.HexColor("#1a3a5c")
TEAL   = colors.HexColor("#0d6e6e")
AMBER  = colors.HexColor("#e67e22")
LIGHT  = colors.HexColor("#eaf4fb")
MLIGHT = colors.HexColor("#fef9e7")
GREEN  = colors.HexColor("#196f3d")
RED    = colors.HexColor("#922b21")
LGREY  = colors.HexColor("#f4f6f7")
MGREY  = colors.HexColor("#d5d8dc")

# ── Styles ──────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def S(name, **kw):
    return ParagraphStyle(name, **kw)

TITLE_STYLE = S("DocTitle",
    fontSize=20, leading=26, textColor=colors.white,
    fontName="Helvetica-Bold", alignment=TA_CENTER)

SUBTITLE_STYLE = S("DocSub",
    fontSize=11, leading=14, textColor=colors.HexColor("#d6eaf8"),
    fontName="Helvetica", alignment=TA_CENTER)

H1 = S("H1",
    fontSize=13, leading=18, textColor=colors.white,
    fontName="Helvetica-Bold", alignment=TA_LEFT,
    spaceBefore=8, spaceAfter=4,
    leftIndent=0)

H2 = S("H2",
    fontSize=11, leading=15, textColor=NAVY,
    fontName="Helvetica-Bold", alignment=TA_LEFT,
    spaceBefore=8, spaceAfter=3)

H3 = S("H3",
    fontSize=10, leading=14, textColor=TEAL,
    fontName="Helvetica-Bold",
    spaceBefore=5, spaceAfter=2)

BODY = S("Body",
    fontSize=9, leading=13, textColor=colors.HexColor("#1c2833"),
    fontName="Helvetica", alignment=TA_JUSTIFY,
    spaceBefore=2, spaceAfter=2)

BULLET = S("Bullet",
    fontSize=9, leading=13, textColor=colors.HexColor("#1c2833"),
    fontName="Helvetica",
    leftIndent=14, firstLineIndent=-10,
    spaceBefore=1, spaceAfter=1)

MNEM = S("Mnem",
    fontSize=9, leading=13, textColor=GREEN,
    fontName="Helvetica-BoldOblique",
    leftIndent=10, spaceBefore=2, spaceAfter=2)

WARN = S("Warn",
    fontSize=9, leading=13, textColor=RED,
    fontName="Helvetica-Bold",
    leftIndent=10, spaceBefore=2, spaceAfter=2)

ONE_LINER = S("OneLiner",
    fontSize=8.5, leading=12, textColor=colors.HexColor("#1c2833"),
    fontName="Helvetica")

TABLE_HDR = S("TblHdr",
    fontSize=8.5, leading=11, textColor=colors.white,
    fontName="Helvetica-Bold", alignment=TA_CENTER)

TABLE_CELL = S("TblCell",
    fontSize=8, leading=11, textColor=colors.HexColor("#1c2833"),
    fontName="Helvetica")

TABLE_CELL_B = S("TblCellB",
    fontSize=8, leading=11, textColor=NAVY,
    fontName="Helvetica-Bold")

# ── Helpers ──────────────────────────────────────────────────────────────────
def section_header(text, color=NAVY):
    """Coloured section header banner."""
    tbl = Table([[Paragraph(text, H1)]], colWidths=[W])
    tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), color),
        ("TOPPADDING",    (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("RIGHTPADDING",  (0,0), (-1,-1), 10),
        ("ROUNDEDCORNERS", [4]),
    ]))
    return tbl

def mnemonic_box(text):
    tbl = Table([[Paragraph("🧠 " + text, MNEM)]], colWidths=[W])
    tbl.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), colors.HexColor("#eafaf1")),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("BOX",           (0,0), (-1,-1), 0.8, GREEN),
    ]))
    return tbl

def warn_box(text):
    tbl = Table([[Paragraph("⚠ " + text, WARN)]], colWidths=[W])
    tbl.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), colors.HexColor("#fdedec")),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("BOX",           (0,0), (-1,-1), 0.8, RED),
    ]))
    return tbl

def b(text): return Paragraph(text, BULLET)
def p(text): return Paragraph(text, BODY)
def h2(text): return Paragraph(text, H2)
def h3(text): return Paragraph(text, H3)
def sp(n=4): return Spacer(1, n)
def hr(): return HRFlowable(width=W, thickness=0.5, color=MGREY, spaceAfter=4, spaceBefore=4)

def make_table(headers, rows, col_widths=None, alt=True):
    header_row = [Paragraph(h, TABLE_HDR) for h in headers]
    data = [header_row]
    for i, row in enumerate(rows):
        cells = []
        for j, cell in enumerate(row):
            style = TABLE_CELL_B if j == 0 else TABLE_CELL
            cells.append(Paragraph(str(cell), style))
        data.append(cells)
    if col_widths is None:
        cw = W / len(headers)
        col_widths = [cw] * len(headers)
    tbl = Table(data, colWidths=col_widths, repeatRows=1)
    ts = [
        ("BACKGROUND",    (0,0), (-1,0),  NAVY),
        ("TEXTCOLOR",     (0,0), (-1,0),  colors.white),
        ("FONTNAME",      (0,0), (-1,0),  "Helvetica-Bold"),
        ("FONTSIZE",      (0,0), (-1,0),  8.5),
        ("ALIGN",         (0,0), (-1,0),  "CENTER"),
        ("TOPPADDING",    (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("LEFTPADDING",   (0,0), (-1,-1), 5),
        ("RIGHTPADDING",  (0,0), (-1,-1), 5),
        ("GRID",          (0,0), (-1,-1), 0.4, MGREY),
        ("VALIGN",        (0,0), (-1,-1), "MIDDLE"),
    ]
    if alt:
        for i in range(1, len(data)):
            bg = LIGHT if i % 2 == 0 else colors.white
            ts.append(("BACKGROUND", (0,i), (-1,i), bg))
    tbl.setStyle(TableStyle(ts))
    return tbl

# ═══════════════════════════════════════════════════════════════════════════
# BUILD CONTENT
# ═══════════════════════════════════════════════════════════════════════════
story = []

# ── COVER ──────────────────────────────────────────────────────────────────
cover = Table([
    [Paragraph("HERNIA", TITLE_STYLE)],
    [Paragraph("RGUHS Final Year MBBS Surgery", SUBTITLE_STYLE)],
    [Paragraph("Exam-Oriented Notes with Mnemonics", SUBTITLE_STYLE)],
    [Spacer(1, 6)],
    [Paragraph("Based on: Bailey & Love 28th Ed | S Das 13th Ed | Schwartz 11th Ed", SUBTITLE_STYLE)],
], colWidths=[W])
cover.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,-1), NAVY),
    ("TOPPADDING",    (0,0), (-1,-1), 14),
    ("BOTTOMPADDING", (0,0), (-1,-1), 14),
    ("LEFTPADDING",   (0,0), (-1,-1), 20),
    ("RIGHTPADDING",  (0,0), (-1,-1), 20),
    ("ROUNDEDCORNERS", [6]),
]))
story.append(cover)
story.append(sp(10))

# ── RGUHS QUESTIONS ─────────────────────────────────────────────────────────
story.append(section_header("⭐  FREQUENTLY ASKED RGUHS QUESTIONS", AMBER))
story.append(sp(4))
story.append(h2("Long Questions (10 marks)"))
lq = [
    "Classify hernias. Describe anatomy, clinical features and management of inguinal hernia.",
    "Differences between indirect and direct inguinal hernia.",
    "Anatomy of femoral canal. Clinical features and management of femoral hernia.",
    "Complications of inguinal hernia – management of strangulated hernia.",
    "Describe various types of umbilical hernia and their management.",
    "Incisional hernia – causes, clinical features, management.",
    "Surgical anatomy of inguinal canal.",
]
for q in lq:
    story.append(b("• " + q))
story.append(sp(4))
story.append(h2("Short Notes (5 marks)"))
sn = [
    "Richter's hernia | Littre's hernia | Maydl's hernia | Pantaloon hernia",
    "Spigelian hernia | Sliding hernia",
    "Hesselbach's triangle",
    "Herniotomy vs Herniorrhaphy vs Hernioplasty",
    "TEP / TAPP laparoscopic repair",
    "Causes of recurrent hernia | Femoral canal anatomy",
]
for s in sn:
    story.append(b("• " + s))
story.append(sp(8))

# ── SECTION 1 ───────────────────────────────────────────────────────────────
story.append(section_header("1.  DEFINITION & COMPONENTS"))
story.append(sp(4))
story.append(p("<b>Definition:</b> Protrusion of a viscus or part of a viscus through an abnormal opening in the walls of its containing cavity."))
story.append(sp(4))
story.append(mnemonic_box('Mnemonic – Parts of Hernia: "SNC Covered"'))
parts_data = [
    ["S – Sac", "Peritoneum lining the hernial sac (has neck, body, fundus)"],
    ["N – Neck", "Junction of sac with peritoneal cavity (most important clinically)"],
    ["C – Contents", "Omentum (most common), small bowel, colon, bladder"],
    ["Coverings", "Layers overlying the sac (fasciae, skin)"],
]
story.append(sp(3))
story.append(make_table(["Component", "Description"], parts_data, [60*mm, W-60*mm]))
story.append(sp(8))

# ── SECTION 2 ───────────────────────────────────────────────────────────────
story.append(section_header("2.  CLASSIFICATION OF HERNIA"))
story.append(sp(4))
story.append(h2("By Site"))
story.append(mnemonic_box('Mnemonic: "I Feel Unusual Pain Every Single Day"'))
story.append(sp(2))
story.append(b("Inguinal (most common) • Femoral • Umbilical/Para-umbilical • Para-stomal • Epigastric • Spigelian • Diaphragmatic/Hiatal"))
story.append(sp(6))
story.append(h2("By Clinical State"))
story.append(mnemonic_box('Mnemonic: "ROIS"'))
state_data = [
    ["Reducible",     "Contents can be returned to cavity manually or spontaneously"],
    ["Obstructed",    "Hollow viscus obstructed; blood supply INTACT; causes intestinal obstruction"],
    ["Irreducible",   "Cannot return to cavity; blood supply intact; no obstruction"],
    ["Strangulated",  "Blood supply COMPROMISED → ischemia → gangrene within ~6 hours"],
]
story.append(sp(3))
story.append(make_table(["State", "Features"], state_data, [50*mm, W-50*mm]))
story.append(sp(8))

# ── SECTION 3 ───────────────────────────────────────────────────────────────
story.append(section_header("3.  INGUINAL HERNIA  (Most High-Yield)", TEAL))
story.append(sp(4))
story.append(h2("Anatomy of Inguinal Canal"))
story.append(p("Length: 4 cm | Direction: downward, medially, anteriorly | Connects deep inguinal ring to superficial inguinal ring"))
story.append(sp(4))
wall_data = [
    ["Anterior", "External oblique aponeurosis (whole length) + Internal oblique (lateral 1/3)"],
    ["Posterior", "Transversalis fascia (whole) + Conjoint tendon (medial 1/3)"],
    ["Roof",      "Arching fibres of Internal oblique + Transversus abdominis"],
    ["Floor",     "Inguinal ligament + Lacunar ligament (medially)"],
]
story.append(make_table(["Wall", "Structure"], wall_data, [30*mm, W-30*mm]))
story.append(sp(4))
story.append(mnemonic_box('Wall mnemonic: "2A2P" – 2 Anterior structures, 2 Posterior structures'))
story.append(sp(4))
story.append(h3("Rings"))
story.append(b("• <b>Deep inguinal ring:</b> Defect in transversalis fascia | Midpoint between ASIS and pubic tubercle | Inferior epigastric vessels lie just <b>medial</b>"))
story.append(b("• <b>Superficial inguinal ring:</b> Inverted-V defect in external oblique aponeurosis | Above and medial to pubic tubercle"))
story.append(sp(4))
story.append(h3("Contents of Inguinal Canal (Male)"))
story.append(mnemonic_box('Mnemonic: "I Get Goosebumps Later – D & D"'))
story.append(b("Ilioinguinal nerve • Genital branch of genitofemoral nerve • Gonadal (testicular) vessels • Lymphatics • Deferens (vas) • Dartos/cremasteric fibres"))
story.append(p("<i>(In female: round ligament replaces vas deferens)</i>"))
story.append(sp(4))

story.append(h2("Hesselbach's Triangle  (Short Note Favourite)"))
story.append(mnemonic_box('Mnemonic: "RIL" – Rectus, Inferior epigastric, Ligament inguinal'))
hess_data = [
    ["Medial",   "Lateral border of Rectus abdominis"],
    ["Lateral",  "Inferior epigastric artery"],
    ["Inferior", "Inguinal ligament"],
]
story.append(sp(2))
story.append(make_table(["Boundary", "Structure"], hess_data, [40*mm, W-40*mm]))
story.append(p("<i>Direct hernia passes through Hesselbach's triangle (medial to inferior epigastric artery)</i>"))
story.append(sp(6))

story.append(h2("Indirect vs Direct Inguinal Hernia  (Classic Comparison Question)"))
comp_data = [
    ["Frequency",       "80–85% of inguinal hernias",              "15–20% of inguinal hernias"],
    ["Age",             "Any age (even infants)",                   "Middle-aged & elderly"],
    ["Sex",             "Male > Female",                            "Almost exclusively male"],
    ["Cause",           "Congenital (patent processus vaginalis)",  "Acquired weakness of posterior wall"],
    ["Neck of sac",     "Lateral to inferior epigastric artery",   "Medial to inferior epigastric artery"],
    ["Path",            "Deep ring → canal → superficial ring → scrotum",  "Directly through Hesselbach's triangle"],
    ["Completeness",    "Often complete (reaches scrotum)",         "Rarely complete"],
    ["Strangulation",   "More common",                              "Less common"],
    ["Deep ring control","Hernia CONTROLLED by pressure on ring",   "NOT controlled"],
    ["Zieman's test",   "Index finger impulse = indirect",          "Middle finger impulse = direct"],
]
story.append(sp(3))
story.append(make_table(["Feature", "Indirect (Oblique)", "Direct (Medial)"],
                        comp_data, [42*mm, (W-42*mm)/2, (W-42*mm)/2]))
story.append(sp(4))
story.append(mnemonic_box('Neck position: "DILM" – Direct = Inferior epigastric Lies Medially (neck medial to artery)'))
story.append(sp(4))

story.append(h2("Types by Extent (S Das)"))
story.append(b("1. <b>Bubonocele</b> – hernia within inguinal canal, does not exit superficial ring"))
story.append(b("2. <b>Incomplete hernia</b> – exits superficial ring but does not reach scrotum"))
story.append(b("3. <b>Complete hernia</b> – reaches the bottom of the scrotum"))
story.append(sp(6))

story.append(h2("Management of Inguinal Hernia"))
story.append(b("• <b>Conservative:</b> Truss – only for elderly/unfit with direct hernia; NOT recommended routinely"))
story.append(b("• <b>Surgery:</b> Elective repair recommended for all symptomatic hernias"))
story.append(b("• <b>Watchful waiting</b> acceptable for asymptomatic direct hernia in elderly"))
story.append(sp(8))

# ── SECTION 4 ───────────────────────────────────────────────────────────────
story.append(section_header("4.  FEMORAL HERNIA", TEAL))
story.append(sp(4))
story.append(h2("Femoral Canal (Short Note)"))
story.append(mnemonic_box('Femoral sheath contents: "NAVY" – Nerve (outside sheath), Artery, Vein, Y = empty canal (with fat/lymphatics)'))
story.append(sp(3))
story.append(b("• Length of femoral canal: ~1.3 cm"))
story.append(b("• Normally contains: fat + lymphatics + lymph node of Cloquet (Rosenmuller)"))
fem_bounds = [
    ["Anterior",  "Inguinal ligament"],
    ["Posterior", "Pectineal ligament (Cooper's ligament) & pectineus muscle"],
    ["Medial",    "Lacunar (Gimbernat's) ligament – <b>SHARP EDGE → causes strangulation</b>"],
    ["Lateral",   "Femoral vein"],
]
story.append(sp(3))
story.append(make_table(["Boundary", "Structure"], fem_bounds, [35*mm, W-35*mm]))
story.append(sp(4))

story.append(h2("Key Facts"))
story.append(b("• More common in <b>women</b> (but inguinal is still commonest hernia in women overall)"))
story.append(b("• Right side > Left (2:1) | Bilateral in 20%"))
story.append(b("• Most common age: >50 years"))
story.append(warn_box("High risk of strangulation – rigid femoral ring with sharp lacunar ligament medially"))
story.append(sp(4))

story.append(h2("Femoral vs Inguinal – Distinguishing Features"))
fvsi = [
    ["Position", "Lateral & BELOW inguinal ligament", "Medial & ABOVE inguinal ligament"],
    ["Relation to pubic tubercle", "Lateral to pubic tubercle", "Medial to pubic tubercle"],
    ["Invagination test", "Inguinal canal EMPTY", "Impulse felt in inguinal canal"],
    ["Deep ring control", "Cannot be controlled", "Indirect: can be controlled"],
]
story.append(sp(3))
story.append(make_table(["Feature", "Femoral", "Inguinal"], fvsi, [50*mm, (W-50*mm)/2, (W-50*mm)/2]))
story.append(sp(4))
story.append(mnemonic_box('Mnemonic: "FBI" = Femoral Below Inguinal (lateral to pubic tubercle)'))
story.append(sp(4))

story.append(h2("Surgical Approaches"))
fem_app = [
    ["Lockwood's (Low)", "Below inguinal ligament", "Most common for ELECTIVE repair"],
    ["Lotheissen's",     "Through inguinal canal (transpubic)", "Allows inguinal canal access"],
    ["McEvedy's (High)", "Through lower rectus sheath / preperitoneal", "BEST for STRANGULATED femoral hernia"],
    ["TEP / TAPP",       "Laparoscopic preperitoneal", "Bilateral or recurrent hernias"],
]
story.append(sp(3))
story.append(make_table(["Approach", "Route", "Indication"], fem_app, [42*mm, 60*mm, W-102*mm]))
story.append(sp(4))
story.append(mnemonic_box('Mnemonic: "LLM" – Low Lockwood → Lotheissen → McEvedy (High for strangulated)'))
story.append(sp(8))

# ── SECTION 5 ───────────────────────────────────────────────────────────────
story.append(section_header("5.  SPECIAL VARIETIES OF HERNIA", AMBER))
story.append(sp(4))
story.append(mnemonic_box('Mnemonic: "SLIMPR" – Sliding, Littre\'s, Richter\'s (+ Irreducible), Maydl\'s, Pantaloon, Spigelian'))
story.append(sp(5))

specials = [
    ("Sliding Hernia (En Glissade)",
     "Part of the sac WALL is formed by a viscus (caecum on right, sigmoid on left, urinary bladder).",
     "Never blindly ligate the sac – the viscus forms part of the sac wall and will be injured!"),
    ("Littre's Hernia",
     "Hernia sac contains a Meckel's diverticulum. Can strangulate diverticulum alone without bowel obstruction.",
     "Meckel's diverticulum may strangulate without intestinal obstruction features."),
    ("Richter's Hernia",
     "Only a KNUCKLE (antimesenteric border) of bowel wall is trapped. No full lumen obstruction. Can strangulate SILENTLY.",
     "Most common at femoral canal. No obstruction features yet bowel goes gangrenous – very dangerous!"),
    ("Maydl's Hernia (W-hernia)",
     "Two loops in sac + connecting loop INSIDE abdomen forming a 'W'. The middle (intra-abdominal) loop strangulates.",
     "Opening sac shows 2 visible loops but the MIDDLE loop inside abdomen is gangrenous – always inspect both limbs!"),
    ("Pantaloon Hernia",
     "Combined direct + indirect hernia straddling the inferior epigastric artery – like 2 legs of trousers.",
     "Divide inferior epigastric artery to treat both sacs as one."),
    ("Spigelian Hernia",
     "Through Spigelian fascia (lateral rectus edge at arcuate line). INTERPARIETAL – lies between muscle layers, often missed clinically.",
     "CT scan is investigation of choice. Cannot palpate easily – high index of suspicion needed."),
]

for name, desc, caution in specials:
    story.append(KeepTogether([
        h3("ā–¶ " + name),
        p(desc),
        warn_box(caution),
        sp(4),
    ]))

story.append(sp(4))

# ── SECTION 6 ───────────────────────────────────────────────────────────────
story.append(section_header("6.  UMBILICAL HERNIA"))
story.append(sp(4))
story.append(mnemonic_box('Mnemonic: "ECAP" – Exomphalos, Congenital, Acquired, Para-umbilical'))
story.append(sp(4))

umb_data = [
    ["Exomphalos\n(Omphalocele)",
     "Congenital. Abdominal contents in umbilical cord covered by translucent diaphanous membrane. Distinguish from Gastroschisis (no sac, lateral to umbilicus, bowel directly exposed, better prognosis)."],
    ["Congenital\nUmbilical Hernia",
     "Through umbilical scar in infants. Wide neck → rarely strangulates. 90% resolve spontaneously by 5 years. Observe till 5 years before surgery."],
    ["Acquired\nUmbilical Hernia",
     "Adults; through umbilical scar due to raised IAP (pregnancy, ascites, ovarian cyst, fibroid). Treat underlying cause first."],
    ["Para-umbilical\nHernia",
     "Most common acquired umbilical hernia. Just above umbilicus, between the two recti. Obese middle-aged women. Omentum often adherent → irreducible. Repair: Mayo's operation."],
]
story.append(make_table(["Type", "Key Features"], umb_data, [45*mm, W-45*mm]))
story.append(sp(4))
story.append(h3("Mayo's Operation (Para-umbilical repair):"))
story.append(b("• Transverse elliptical incision excising redundant skin"))
story.append(b("• Sac opened, contents reduced, neck transfixed"))
story.append(b("• Fascia imbricated in VEST-OVER-PANTS technique (upper flap overlaps lower)"))
story.append(b("• Mesh preferred for large defects"))
story.append(sp(8))

# ── SECTION 7 ───────────────────────────────────────────────────────────────
story.append(section_header("7.  INCISIONAL HERNIA"))
story.append(sp(4))
story.append(p("Hernia through a defect in the musculofascial layers at the site of a previous surgical scar. Incidence: <b>10–50% of laparotomies, 1–5% of laparoscopic port sites</b>."))
story.append(sp(4))
story.append(h2("Causes"))
story.append(mnemonic_box('Mnemonic: "MOAN WIPS"'))
moan = [
    ("M", "Malnutrition / Midline incision (higher risk than transverse)"),
    ("O", "Obesity"),
    ("A", "Anaemia / Corticosteroids / Age (elderly)"),
    ("N", "Non-absorbable suture not used / poor suture technique"),
    ("W", "Wound infection / Wound haematoma"),
    ("I", "Intraabdominal pressure raised (post-op cough, ileus, constipation)"),
    ("P", "Patient factors – immunosuppression, collagen disorders, cancer"),
    ("S", "Steroid therapy / Systemic illness (jaundice, uraemia, diabetes)"),
]
story.append(sp(3))
story.append(make_table(["Letter", "Cause"], moan, [20*mm, W-20*mm]))
story.append(sp(4))

story.append(h2("Clinical Features"))
story.append(b("• Swelling through previous scar, increases on straining/standing"))
story.append(b("• Expansile cough impulse"))
story.append(b("• Often multiple defects found at surgery even if single bulge clinically"))
story.append(b("• Heralded by serosanguineous discharge ~6th postoperative day (fascial layer failure)"))
story.append(sp(4))

story.append(h2("Management"))
inc_mgmt = [
    ["Conservative",      "Supportive belt – only for unfit/elderly patients"],
    ["Primary repair",    "Direct suture closure – only for small (<2 cm) defects"],
    ["Onlay mesh",        "Mesh placed over fascial repair – higher infection risk"],
    ["Sublay/Retrorectus","Mesh in retrorectus space (between rectus & posterior sheath) – preferred; lowest recurrence"],
    ["IPOM laparoscopic", "Intraperitoneal onlay mesh – moderate-sized hernias; less wound morbidity"],
    ["Component separation","Releasing external oblique laterally to advance rectus; for large/complex defects"],
]
story.append(sp(3))
story.append(make_table(["Method", "Details"], inc_mgmt, [50*mm, W-50*mm]))
story.append(sp(8))

# ── SECTION 8 ───────────────────────────────────────────────────────────────
story.append(section_header("8.  STRANGULATED HERNIA – EMERGENCY MANAGEMENT", RED))
story.append(sp(4))
story.append(h2("Pathophysiology"))
story.append(b("1. Tight neck → compresses venous return → venous congestion"))
story.append(b("2. Oedema → arterial occlusion → ischaemia → GANGRENE within ~6 hours"))
story.append(b("3. Sac fluid becomes blood-stained / turbid → 'Champagne sign' = irreversible ischaemia"))
story.append(sp(4))

story.append(h2("Clinical Features"))
story.append(b("• Previously reducible hernia becomes suddenly IRREDUCIBLE + PAINFUL"))
story.append(b("• Tense, tender, red swelling – NO cough impulse"))
story.append(b("• Features of intestinal obstruction: vomiting, distension, absolute constipation"))
story.append(b("• Systemic: fever, tachycardia, toxaemia, shock"))
story.append(warn_box("Richter's hernia – strangulates WITHOUT features of obstruction. Easily missed!"))
story.append(sp(4))

story.append(h2("Emergency Management"))
story.append(h3("Step 1 – Resuscitation:"))
story.append(b("• IV access + crystalloid fluid resuscitation"))
story.append(b("• Nasogastric tube (NGT) + urinary catheter"))
story.append(b("• Bloods: FBC, U&E, LFT, coagulation, group & save"))
story.append(b("• IV broad-spectrum antibiotics (e.g. co-amoxiclav + metronidazole)"))
story.append(h3("Step 2 – Emergency Surgery:"))
story.append(b("• Open sac carefully – do NOT reduce before assessing viability"))
story.append(b("• Assess bowel viability"))
story.append(mnemonic_box('Viability mnemonic: "CPC" – Color (pink vs black/dark) | Peristalsis | Circulation (mesenteric pulse)'))
story.append(b("• If VIABLE → reduce, repair hernia"))
story.append(b("• If NON-VIABLE → resect + primary anastomosis"))
story.append(b("• Approximately 20% require bowel resection"))
story.append(b("• Mesh acceptable even with mild contamination if covered with antibiotics"))
story.append(sp(8))

# ── SECTION 9 ───────────────────────────────────────────────────────────────
story.append(section_header("9.  HERNIA REPAIR OPERATIONS"))
story.append(sp(4))
story.append(mnemonic_box('Mnemonic: "3 H\'s" – Herniotomy, Herniorrhaphy, Hernioplasty'))
story.append(sp(4))
three_h = [
    ["Herniotomy",     "Dissect sac → open → reduce contents → transfix neck → excise sac. NO posterior wall repair.",
     "Children (superficial + deep rings are superimposed, no canal repair needed), young adults with indirect hernia"],
    ["Herniorrhaphy",  "Herniotomy + repair of posterior wall with SUTURES (tissue-based, tension repair).",
     "Adults; older techniques (Bassini, Shouldice)"],
    ["Hernioplasty",   "Herniotomy + reinforcement with MESH (tension-free). Current gold standard.",
     "All adults; Lichtenstein open mesh repair"],
]
story.append(make_table(["Operation", "What is done", "When used"], three_h,
                        [38*mm, (W-38*mm)*0.55, (W-38*mm)*0.45]))
story.append(sp(6))

story.append(h2("Open Tissue Repairs"))
open_r = [
    ["Bassini's",    "Conjoint tendon sutured to inguinal ligament"],
    ["Shouldice",    "4-layer continuous stainless steel wire repair of transversalis fascia. GOLD STANDARD tissue repair. <1% recurrence"],
    ["McVay (Cooper's)", "Conjoint tendon to Cooper's (pectineal) ligament. Good for femoral hernia too"],
    ["Darn repair",  "Prolene lattice darn, tension-free"],
]
story.append(make_table(["Repair", "Key Feature"], open_r, [50*mm, W-50*mm]))
story.append(sp(4))

story.append(h2("Mesh Repair"))
story.append(b("• <b>Lichtenstein Tension-free Mesh Repair</b> – current GOLD STANDARD for open inguinal hernia repair"))
story.append(b("• Polypropylene mesh; placed over posterior wall; sutured to conjoint tendon, inguinal ligament"))
story.append(b("• Recurrence rate <5% at 5 years"))
story.append(sp(4))

story.append(h2("Laparoscopic Repairs"))
lap_r = [
    ["TEP\n(Totally Extraperitoneal)",
     "Extraperitoneal dissection only. Peritoneal cavity NOT entered. Fewer bowel adhesions, faster recovery.",
     "Preferred for bilateral hernia, recurrent hernia"],
    ["TAPP\n(Trans-Abdominal Pre-Peritoneal)",
     "Enter peritoneal cavity → dissect preperitoneal space → place mesh → close peritoneum.",
     "When TEP is difficult; allows inspection of abdominal contents"],
]
story.append(sp(3))
story.append(make_table(["Approach", "Technique", "Preference"], lap_r, [35*mm, (W-35*mm)*0.58, (W-35*mm)*0.42]))
story.append(sp(4))
story.append(mnemonic_box('Mnemonic: "TEP stays outside, TAPP goes in" (peritoneal cavity)'))
story.append(sp(8))

# ── SECTION 10 ──────────────────────────────────────────────────────────────
story.append(section_header("10.  QUICK ONE-LINERS FOR MCQs & VIVA", GREEN))
story.append(sp(4))

one_liners = [
    ("Most common hernia overall",                    "Inguinal hernia"),
    ("Most common hernia in WOMEN",                   "Inguinal hernia (NOT femoral!)"),
    ("Femoral hernia – commoner in",                  "Women (but inguinal still #1 in women)"),
    ("Highest strangulation risk",                    "Femoral hernia (rigid ring + sharp lacunar ligament)"),
    ("Silent strangulation (no obstruction features)", "Richter's hernia"),
    ("W-hernia",                                      "Maydl's hernia"),
    ("Hernia of Meckel's diverticulum",               "Littre's hernia"),
    ("Sac wall formed by viscus",                     "Sliding hernia"),
    ("Hernia straddling inferior epigastric artery",  "Pantaloon hernia"),
    ("Interparietal hernia at lateral rectus edge",   "Spigelian hernia"),
    ("Investigation of choice for Spigelian",         "CT scan"),
    ("Gold standard OPEN repair",                     "Lichtenstein tension-free mesh repair"),
    ("Gold standard TISSUE repair (no mesh)",         "Shouldice repair"),
    ("Best approach for strangulated femoral hernia", "McEvedy's (high) approach"),
    ("Para-umbilical hernia repair",                  "Mayo's operation (vest-over-pants)"),
    ("Champagne sign",                                "Strangulated hernia – turbid sac fluid = non-viable bowel"),
    ("Congenital umbilical hernia – 90% resolve by",  "5 years of age"),
    ("Incisional hernia after laparotomy",            "10–50% incidence"),
    ("Chronic pain after inguinal hernia repair",     "Up to 20% of patients (>3 months = chronic)"),
    ("Laparoscopic repair preferred for bilateral",   "TEP (Totally Extraperitoneal) repair"),
    ("Herniorrhaphy in children – sac only, no repair", "Because deep and superficial rings are superimposed"),
]
story.append(make_table(["Question", "Answer"], one_liners, [W*0.52, W*0.48]))
story.append(sp(8))

# ── SECTION 11 ──────────────────────────────────────────────────────────────
story.append(section_header("11.  MNEMONICS MASTER SHEET", AMBER))
story.append(sp(4))
mn_data = [
    ["Parts of hernia",                  '"SNC Covered"',       "Sac, Neck, Contents, Coverings"],
    ["Clinical states",                  '"ROIS"',              "Reducible, Obstructed, Irreducible, Strangulated"],
    ["Inguinal canal walls",             '"2A2P"',              "2 Anterior structures, 2 Posterior structures"],
    ["Inguinal canal contents",          '"I Get Goosebumps Later – D&D"', "Ilioinguinal, Genital GF, Gonadal, Lymphatics, Deferens, Dartos"],
    ["Hesselbach's triangle",            '"RIL"',               "Rectus, Inferior epigastric, Ligament inguinal"],
    ["Direct hernia neck",               '"DILM"',              "Direct = Inferior epigastric Lies Medially"],
    ["Femoral position vs inguinal",     '"FBI"',               "Femoral Below Inguinal (below inguinal lig, lateral to pubic tubercle)"],
    ["Femoral canal approaches",         '"LLM"',               "Lockwood (elective), Lotheissen, McEvedy (strangulated)"],
    ["Femoral sheath contents",          '"NAVY"',              "Nerve (outside), Artery, Vein, Y (empty canal)"],
    ["Special hernias",                  '"SLIMPR"',            "Sliding, Littre's, Richter's, Maydl's, Pantaloon, Spigelian"],
    ["Umbilical hernia types",           '"ECAP"',              "Exomphalos, Congenital, Acquired, Para-umbilical"],
    ["Incisional hernia causes",         '"MOAN WIPS"',         "Malnutrition, Obesity, Anaemia, Non-absorbable, Wound infxn, IAP, Patient factors, Steroids"],
    ["Bowel viability check",            '"CPC"',               "Colour, Peristalsis, Circulation (mesenteric pulse)"],
    ["3 hernia operations",              '"3 H\'s"',            "Herniotomy, Herniorrhaphy, Hernioplasty"],
    ["Lap repairs",                      '"TEP stays outside, TAPP goes in"', "TEP = extraperitoneal; TAPP = enters peritoneum"],
]
story.append(make_table(["Topic", "Mnemonic", "Expansion"], mn_data,
                        [50*mm, 50*mm, W-100*mm]))
story.append(sp(8))

# ── SECTION 12 ──────────────────────────────────────────────────────────────
story.append(section_header("12.  EXAM TRAPS – DO NOT MAKE THESE MISTAKES", RED))
story.append(sp(5))
traps = [
    "Most common hernia in WOMEN = INGUINAL (NOT femoral) – classic examiner trick",
    "Richter's hernia → strangulation WITHOUT obstruction features – diagnosis is easily missed",
    "Maydl's hernia → the MIDDLE loop inside abdomen is gangrenous – always pull out both limbs",
    "Sliding hernia → NEVER blindly ligate the sac (bowel/bladder wall forms sac)",
    "Femoral strangulation → use McEVEDY approach (NOT Lockwood) – allows bowel inspection",
    "Herniotomy in CHILDREN – superficial and deep rings are superimposed, so NO canal repair needed",
    "Spigelian hernia is interparietal – clinically missed easily; use CT scan to diagnose",
    "Congenital umbilical hernia – watch till 5 years; DO NOT rush to operate",
    "Para-umbilical hernia (NOT umbilical) is the COMMONEST acquired umbilical hernia in adults",
    "Direct hernia – posterior wall weakness, NOT from patent processus vaginalis",
]
for trap in traps:
    story.append(warn_box(trap))
    story.append(sp(2))

story.append(sp(8))

# ── FOOTER NOTE ─────────────────────────────────────────────────────────────
footer = Table([
    [Paragraph("Sources: Bailey & Love's Short Practice of Surgery 28th Ed | S Das Manual of Clinical Surgery 13th Ed | Schwartz's Principles of Surgery 11th Ed", SUBTITLE_STYLE)],
    [Paragraph("Prepared for RGUHS Final Year MBBS Surgery Examination | Orris Medical", SUBTITLE_STYLE)],
], colWidths=[W])
footer.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,-1), NAVY),
    ("TOPPADDING",    (0,0), (-1,-1), 8),
    ("BOTTOMPADDING", (0,0), (-1,-1), 8),
    ("LEFTPADDING",   (0,0), (-1,-1), 12),
    ("RIGHTPADDING",  (0,0), (-1,-1), 12),
]))
story.append(footer)

# ── BUILD ────────────────────────────────────────────────────────────────────
doc.build(story)
print("PDF generated:", OUTPUT)
Running Command

cd /home/daytona/workspace/hernia-notes && python3 generate_hernia_pdf.py

Running Command

ls -lh /home/daytona/workspace/hernia-notes/Hernia_RGUHS_MBBS_Notes.pdf

Your PDF is ready! Download it here:

Hernia RGUHS MBBS Notes

PDF Document Ā· PDF

What's inside the PDF (12 sections, fully formatted):
  • Color-coded section headers (Navy, Teal, Amber, Red, Green)
  • All comparison tables (Indirect vs Direct, Femoral vs Inguinal, Repair types)
  • Mnemonic boxes highlighted in green
  • Warning boxes in red for exam traps
  • One-liner MCQ/Viva sheet
  • Master mnemonics summary table
  • "Exam Traps" section with the 10 most common mistakes
  • Sourced from Bailey & Love 28th Ed + S Das 13th Ed
This is a shared conversation. Sign in to Orris to start your own chat.