# gamal-abouelhamd/hospital-management-smart-ambulance-system architecture

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

- Interactive diagram: https://gitdiagram.com/gamal-abouelhamd/hospital-management-smart-ambulance-system
- Repository: https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system

## Overview

The repository combines a JavaFX hospital-management application with a console-based ambulance dispatch simulation. In the hospital workflow, a user enters through the management UI, which delegates patient, appointment, waiting-list, billing, and reporting operations to the management service; database helpers persist and reload records. Separately, the console demo sets up a city graph and dispatches ambulances to selected hospitals. The README documents these capabilities; unsampled UI and backend behavior is represented only where the README or source index supports it.

Main entry points: [`src/Backend/PatientManagementSystem.java`](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/PatientManagementSystem.java) (Management service), [`src/Backend/Main.java`](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/Main.java) (Console demo), [`src/GUI/Scene2Controller.java`](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/GUI/Scene2Controller.java) (Management UI), [`src/Backend/Emergency.java`](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/Emergency.java) (Emergency orchestrator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Hospital UI"]
  node_management_ui["Management UI"]
  node_appointment_ui["Appointment screens"]
  node_waiting_ui["Waiting-list screen"]
  node_billing_ui["Billing screen"]
end

subgraph group_care["Patient Care"]
  node_patient_service["Management service"]
  node_patient_records["Patient registry<br/>[PatientBST.java]"]
  node_patient["Patient model<br/>[Patient.java]"]
end

subgraph group_operations["Hospital Operations"]
  node_appointment["Appointment model<br/>[Appointment.java]"]
  node_appointment_queue["Appointment queue"]
  node_waiting_queue["Urgent priority queue<br/>[PriorityQueue.java]"]
  node_waiting_patient["Waiting request"]
  node_billing["Billing records<br/>[Billing.java]"]
  node_reports["Report generator"]
end

subgraph group_storage["Persistence"]
  node_db_management["Database operations"]
  node_db_connection["JDBC connection"]
end

subgraph group_dispatch["Ambulance Dispatch"]
  node_demo["Console demo<br/>[Main.java]"]
  node_emergency["Emergency orchestrator<br/>[Emergency.java]"]
  node_city_graph["City routing graph<br/>[Graph.java]"]
  node_ambulance["Ambulance model<br/>[Ambulance.java]"]
  node_hospital["Hospital model<br/>[Hospital.java]"]
end

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

node_user -->|"uses"| node_management_ui
node_management_ui -->|"delegates to"| node_patient_service
node_appointment_ui -.->|"manages appointments"| node_patient_service
node_waiting_ui -->|"adds request"| node_patient_service
node_billing_ui -->|"requests history"| node_patient_service
node_management_ui -->|"opens"| node_appointment_ui
node_management_ui -->|"opens"| node_waiting_ui
node_patient_service -->|"manages patients"| node_patient_records
node_patient_service -->|"queues appointments"| node_appointment_queue
node_patient_service -->|"prioritizes requests"| node_waiting_queue
node_patient_service -->|"manages billing"| node_billing
node_patient_service -->|"generates reports"| node_reports
node_patient_service -->|"loads and saves"| node_db_management
node_patient_records -->|"indexes"| node_patient
node_appointment_queue -->|"stores"| node_appointment
node_patient_service -->|"creates request"| node_waiting_patient
node_waiting_patient -->|"references"| node_appointment
node_billing -->|"updates payments"| node_db_management
node_db_management -->|"opens connection"| node_db_connection
node_db_connection -->|"connects to"| node_mysql
node_demo -->|"runs simulation"| node_emergency
node_demo -->|"sets up map"| node_city_graph
node_demo -->|"sets up fleet"| node_ambulance
node_demo -->|"sets up hospitals"| node_hospital
node_emergency -->|"routes over"| node_city_graph
node_emergency -->|"dispatches"| node_ambulance
node_emergency -->|"selects destination"| node_hospital

click node_management_ui "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/GUI/Scene2Controller.java"
click node_appointment_ui "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/GUI/Scene4Controller.java"
click node_waiting_ui "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/GUI/Scene10Controller.java"
click node_billing_ui "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/GUI/Scene6Controller.java"
click node_patient_service "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/PatientManagementSystem.java"
click node_patient_records "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/PatientBST.java"
click node_patient "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/Patient.java"
click node_appointment "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/Appointment.java"
click node_appointment_queue "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/AppointmentQueue.java"
click node_waiting_queue "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/PriorityQueue.java"
click node_waiting_patient "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/WaitingPatient.java"
click node_billing "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/Billing.java"
click node_reports "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/ReportGenerator.java"
click node_db_management "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/DatabaseManagement.java"
click node_db_connection "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/DatabaseConnection.java"
click node_demo "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/Main.java"
click node_emergency "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/Emergency.java"
click node_city_graph "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/Graph.java"
click node_ambulance "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/Ambulance.java"
click node_hospital "https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/Hospital.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_management_ui,node_appointment_ui,node_waiting_ui,node_billing_ui toneBlue
class node_patient_service,node_patient_records,node_patient,node_mysql toneAmber
class node_appointment,node_appointment_queue,node_waiting_queue,node_waiting_patient,node_billing,node_reports toneMint
class node_db_management,node_db_connection toneRose
class node_demo,node_emergency,node_city_graph,node_ambulance,node_hospital,node_user toneIndigo
```

## Components

### Hospital UI

- [Management UI](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/GUI/Scene2Controller.java): `src/GUI/Scene2Controller.java`
- [Appointment screens](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/GUI/Scene4Controller.java): `src/GUI/Scene4Controller.java`
- [Waiting-list screen](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/GUI/Scene10Controller.java): `src/GUI/Scene10Controller.java`
- [Billing screen](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/GUI/Scene6Controller.java): `src/GUI/Scene6Controller.java`

### Patient Care

- [Management service](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/PatientManagementSystem.java): `src/Backend/PatientManagementSystem.java`
- [Patient registry](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/PatientBST.java): `src/Backend/PatientBST.java`
- [Patient model](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/Patient.java): `src/Backend/Patient.java`

### Hospital Operations

- [Appointment model](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/Appointment.java): `src/Backend/Appointment.java`
- [Appointment queue](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/AppointmentQueue.java): `src/Backend/AppointmentQueue.java`
- [Urgent priority queue](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/PriorityQueue.java): `src/Backend/PriorityQueue.java`
- [Waiting request](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/WaitingPatient.java): `src/Backend/WaitingPatient.java`
- [Billing records](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/Billing.java): `src/Backend/Billing.java`
- [Report generator](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/ReportGenerator.java): `src/Backend/ReportGenerator.java`

### Persistence

- [Database operations](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/DatabaseManagement.java): `src/Backend/DatabaseManagement.java`
- [JDBC connection](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/DatabaseConnection.java): `src/Backend/DatabaseConnection.java`

### Ambulance Dispatch

- [Console demo](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/Main.java): `src/Backend/Main.java`
- [Emergency orchestrator](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/Emergency.java): `src/Backend/Emergency.java`
- [City routing graph](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/Graph.java): `src/Backend/Graph.java`
- [Ambulance model](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/Ambulance.java): `src/Backend/Ambulance.java`
- [Hospital model](https://github.com/gamal-abouelhamd/hospital-management-smart-ambulance-system/blob/main/src/Backend/Hospital.java): `src/Backend/Hospital.java`

### Other components

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

## Connections

- Hospital staff → Management UI: uses (evidence: `README.md`)
- Management UI → Management service: delegates to (evidence: `src/GUI/Scene2Controller.java`)
- Appointment screens → Management service: manages appointments
- Waiting-list screen → Management service: adds request (evidence: `src/GUI/Scene10Controller.java`)
- Billing screen → Management service: requests history (evidence: `src/GUI/Scene6Controller.java`)
- Management UI → Appointment screens: opens (evidence: `src/GUI/Scene2Controller.java`)
- Management UI → Waiting-list screen: opens (evidence: `src/GUI/Scene10Controller.java`)
- Management service → Patient registry: manages patients (evidence: `src/Backend/PatientManagementSystem.java`)
- Management service → Appointment queue: queues appointments (evidence: `src/Backend/PatientManagementSystem.java`)
- Management service → Urgent priority queue: prioritizes requests (evidence: `src/Backend/PatientManagementSystem.java`)
- Management service → Billing records: manages billing (evidence: `src/Backend/PatientManagementSystem.java`)
- Management service → Report generator: generates reports (evidence: `src/Backend/PatientManagementSystem.java`)
- Management service → Database operations: loads and saves (evidence: `src/Backend/PatientManagementSystem.java`)
- Patient registry → Patient model: indexes (evidence: `src/Backend/PatientBST.java`)
- Appointment queue → Appointment model: stores (evidence: `src/Backend/AppointmentQueue.java`)
- Management service → Waiting request: creates request (evidence: `src/Backend/PatientManagementSystem.java`)
- Waiting request → Appointment model: references (evidence: `src/Backend/WaitingPatient.java`)
- Billing records → Database operations: updates payments (evidence: `src/Backend/Billing.java`)
- Database operations → JDBC connection: opens connection (evidence: `src/Backend/DatabaseManagement.java`)
- JDBC connection → MySQL database: connects to (evidence: `src/Backend/DatabaseConnection.java`)
- Console demo → Emergency orchestrator: runs simulation (evidence: `src/Backend/Main.java`)
- Console demo → City routing graph: sets up map (evidence: `src/Backend/Main.java`)
- Console demo → Ambulance model: sets up fleet (evidence: `src/Backend/Main.java`)
- Console demo → Hospital model: sets up hospitals (evidence: `src/Backend/Main.java`)
- Emergency orchestrator → City routing graph: routes over (evidence: `src/Backend/Emergency.java`)
- Emergency orchestrator → Ambulance model: dispatches (evidence: `src/Backend/Emergency.java`)
- Emergency orchestrator → Hospital model: selects destination (evidence: `src/Backend/Emergency.java`)
