# ravigupta46/hospital-management-system architecture

> Architecture diagram of the GitHub repository ravigupta46/hospital-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ravigupta46/hospital-management-system
- Repository: https://github.com/ravigupta46/hospital-management-system

## Overview

This is a Java/JDBC console system for maintaining patient and doctor records and scheduling appointments. The user workflow starts at the console menu, which dispatches record operations or appointment booking and lifecycle actions; booking verifies patient and doctor IDs, checks date, time, and availability, then records the appointment. Patient, doctor, and appointment operations issue SQL through a shared JDBC connection to MySQL. The README documents the schema and booking safeguards; some details of appointment validation are in omitted source, so only documented or indexed relationships are shown.

Main entry points: [`src/HospitalManagementSystem/HospitalManagementSystem.java`](https://github.com/ravigupta46/hospital-management-system/blob/main/src/HospitalManagementSystem/HospitalManagementSystem.java) (Menu controller), [`src/HospitalManagementSystem/Appointment.java`](https://github.com/ravigupta46/hospital-management-system/blob/main/src/HospitalManagementSystem/Appointment.java) (Appointment lifecycle), [`src/HospitalManagementSystem/Patient.java`](https://github.com/ravigupta46/hospital-management-system/blob/main/src/HospitalManagementSystem/Patient.java) (Patient records), [`src/HospitalManagementSystem/Doctor.java`](https://github.com/ravigupta46/hospital-management-system/blob/main/src/HospitalManagementSystem/Doctor.java) (Doctor directory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Console Interface"]
  node_entry["Application entry<br/>[Main.java]"]
  node_menu["Menu controller"]
end

subgraph group_hospital_ops["Hospital Operations"]
  node_patients["Patient records<br/>[Patient.java]"]
  node_doctors["Doctor directory<br/>[Doctor.java]"]
  node_appointments["Appointment lifecycle<br/>[Appointment.java]"]
end

subgraph group_data_access["Database Access"]
  node_connection["JDBC connection"]
  node_schema["Relational schema<br/>[hospital.sql]"]
end

node_user(("Hospital staff"))
node_mysql[("MySQL database")]

node_user -->|"starts"| node_entry
node_entry -->|"delegates to"| node_menu
node_menu -->|"opens connection"| node_connection
node_menu -->|"dispatches"| node_patients
node_menu -->|"dispatches"| node_doctors
node_menu -->|"dispatches"| node_appointments
node_connection -->|"connects to"| node_mysql
node_patients -->|"queries"| node_mysql
node_doctors -->|"queries"| node_mysql
node_appointments -->|"queries and updates"| node_mysql
node_appointments -->|"verifies patient"| node_patients
node_appointments -->|"verifies doctor"| node_doctors
node_schema -->|"defines tables"| node_mysql

click node_entry "https://github.com/ravigupta46/hospital-management-system/blob/main/src/HospitalManagementSystem/Main.java"
click node_menu "https://github.com/ravigupta46/hospital-management-system/blob/main/src/HospitalManagementSystem/HospitalManagementSystem.java"
click node_patients "https://github.com/ravigupta46/hospital-management-system/blob/main/src/HospitalManagementSystem/Patient.java"
click node_doctors "https://github.com/ravigupta46/hospital-management-system/blob/main/src/HospitalManagementSystem/Doctor.java"
click node_appointments "https://github.com/ravigupta46/hospital-management-system/blob/main/src/HospitalManagementSystem/Appointment.java"
click node_connection "https://github.com/ravigupta46/hospital-management-system/blob/main/src/HospitalManagementSystem/DatabaseConnection.java"
click node_schema "https://github.com/ravigupta46/hospital-management-system/blob/main/hospital.sql"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_menu toneBlue
class node_patients,node_doctors,node_appointments,node_mysql toneAmber
class node_connection,node_schema toneMint
class node_user toneIndigo
```

## Components

### Console Interface

- [Application entry](https://github.com/ravigupta46/hospital-management-system/blob/main/src/HospitalManagementSystem/Main.java): `src/HospitalManagementSystem/Main.java`
- [Menu controller](https://github.com/ravigupta46/hospital-management-system/blob/main/src/HospitalManagementSystem/HospitalManagementSystem.java): `src/HospitalManagementSystem/HospitalManagementSystem.java`

### Hospital Operations

- [Patient records](https://github.com/ravigupta46/hospital-management-system/blob/main/src/HospitalManagementSystem/Patient.java): `src/HospitalManagementSystem/Patient.java`
- [Doctor directory](https://github.com/ravigupta46/hospital-management-system/blob/main/src/HospitalManagementSystem/Doctor.java): `src/HospitalManagementSystem/Doctor.java`
- [Appointment lifecycle](https://github.com/ravigupta46/hospital-management-system/blob/main/src/HospitalManagementSystem/Appointment.java): `src/HospitalManagementSystem/Appointment.java`

### Database Access

- [JDBC connection](https://github.com/ravigupta46/hospital-management-system/blob/main/src/HospitalManagementSystem/DatabaseConnection.java): `src/HospitalManagementSystem/DatabaseConnection.java`
- [Relational schema](https://github.com/ravigupta46/hospital-management-system/blob/main/hospital.sql): `hospital.sql`

### Other components

- **Hospital staff**
- **MySQL database**

## Connections

- Hospital staff → Application entry: starts (evidence: `README.md`)
- Application entry → Menu controller: delegates to (evidence: `src/HospitalManagementSystem/Main.java`)
- Menu controller → JDBC connection: opens connection (evidence: `src/HospitalManagementSystem/HospitalManagementSystem.java`)
- Menu controller → Patient records: dispatches (evidence: `src/HospitalManagementSystem/HospitalManagementSystem.java`)
- Menu controller → Doctor directory: dispatches (evidence: `src/HospitalManagementSystem/HospitalManagementSystem.java`)
- Menu controller → Appointment lifecycle: dispatches (evidence: `src/HospitalManagementSystem/HospitalManagementSystem.java`)
- JDBC connection → MySQL database: connects to (evidence: `src/HospitalManagementSystem/DatabaseConnection.java`)
- Patient records → MySQL database: queries (evidence: `src/HospitalManagementSystem/Patient.java`)
- Doctor directory → MySQL database: queries (evidence: `src/HospitalManagementSystem/Doctor.java`)
- Appointment lifecycle → MySQL database: queries and updates (evidence: `src/HospitalManagementSystem/Appointment.java`)
- Appointment lifecycle → Patient records: verifies patient (evidence: `README.md`)
- Appointment lifecycle → Doctor directory: verifies doctor (evidence: `README.md`)
- Relational schema → MySQL database: defines tables (evidence: `README.md`)
