# itsantu/hospital-management architecture

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

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

## Overview

This is a Java command-line hospital management application backed by MySQL. A user selects menu actions in `HospitalManagement`: patient and doctor operations validate or display records, while appointment booking checks both IDs and the doctor’s availability before inserting an appointment. The code shows JDBC queries issued directly by these classes, rather than a separate persistence layer. The README also documents the three database tables and the supported menu capabilities; unsampled integrations or additional behavior are not inferred.

Main entry points: [`src/HospitalManagement.java`](https://github.com/itsantu/hospital-management/blob/main/src/HospitalManagement.java) (Menu and connection), [`src/Patient.java`](https://github.com/itsantu/hospital-management/blob/main/src/Patient.java) (Patient operations), [`src/Doctors.java`](https://github.com/itsantu/hospital-management/blob/main/src/Doctors.java) (Doctor operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["CLI application"]
  node_menu["Menu and connection"]
end

subgraph group_records["Record operations"]
  node_patient_ops["Patient operations<br/>[Patient.java]"]
  node_doctor_ops["Doctor operations<br/>[Doctors.java]"]
end

subgraph group_appointments["Appointment booking"]
  node_booking["Appointment booking"]
  node_availability["Doctor availability check"]
end

node_user(("CLI user"))
node_mysql[("Hospital MySQL database")]

node_user -->|"selects actions"| node_menu
node_menu -->|"dispatches patient actions"| node_patient_ops
node_menu -->|"dispatches doctor view"| node_doctor_ops
node_menu -->|"dispatches booking"| node_booking
node_menu -->|"opens JDBC connection"| node_mysql
node_patient_ops -->|"queries patient records"| node_mysql
node_doctor_ops -->|"queries doctor records"| node_mysql
node_booking -->|"validates patient ID"| node_patient_ops
node_booking -->|"validates doctor ID"| node_doctor_ops
node_booking -->|"checks availability"| node_availability
node_availability -->|"checks appointments"| node_mysql
node_booking -->|"inserts appointment"| node_mysql

click node_menu "https://github.com/itsantu/hospital-management/blob/main/src/HospitalManagement.java"
click node_patient_ops "https://github.com/itsantu/hospital-management/blob/main/src/Patient.java"
click node_doctor_ops "https://github.com/itsantu/hospital-management/blob/main/src/Doctors.java"
click node_booking "https://github.com/itsantu/hospital-management/blob/main/src/HospitalManagement.java"
click node_availability "https://github.com/itsantu/hospital-management/blob/main/src/HospitalManagement.java"

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_menu,node_user toneBlue
class node_patient_ops,node_doctor_ops,node_mysql toneAmber
class node_booking,node_availability toneMint
```

## Components

### CLI application

- [Menu and connection](https://github.com/itsantu/hospital-management/blob/main/src/HospitalManagement.java): `src/HospitalManagement.java`

### Record operations

- [Patient operations](https://github.com/itsantu/hospital-management/blob/main/src/Patient.java): `src/Patient.java`
- [Doctor operations](https://github.com/itsantu/hospital-management/blob/main/src/Doctors.java): `src/Doctors.java`

### Appointment booking

- [Appointment booking](https://github.com/itsantu/hospital-management/blob/main/src/HospitalManagement.java): `src/HospitalManagement.java`
- [Doctor availability check](https://github.com/itsantu/hospital-management/blob/main/src/HospitalManagement.java): `src/HospitalManagement.java`

### Other components

- **CLI user**
- **Hospital MySQL database**

## Connections

- CLI user → Menu and connection: selects actions (evidence: `README.md`)
- Menu and connection → Patient operations: dispatches patient actions (evidence: `src/HospitalManagement.java`)
- Menu and connection → Doctor operations: dispatches doctor view (evidence: `src/HospitalManagement.java`)
- Menu and connection → Appointment booking: dispatches booking (evidence: `src/HospitalManagement.java`)
- Menu and connection → Hospital MySQL database: opens JDBC connection (evidence: `src/HospitalManagement.java`)
- Patient operations → Hospital MySQL database: queries patient records (evidence: `src/Patient.java`)
- Doctor operations → Hospital MySQL database: queries doctor records (evidence: `src/Doctors.java`)
- Appointment booking → Patient operations: validates patient ID (evidence: `src/HospitalManagement.java`)
- Appointment booking → Doctor operations: validates doctor ID (evidence: `src/HospitalManagement.java`)
- Appointment booking → Doctor availability check: checks availability (evidence: `src/HospitalManagement.java`)
- Doctor availability check → Hospital MySQL database: checks appointments (evidence: `src/HospitalManagement.java`)
- Appointment booking → Hospital MySQL database: inserts appointment (evidence: `src/HospitalManagement.java`)
