# rare21ism/hospital-management-system architecture

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

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

## Overview

This is a Java Swing hospital-management desktop application. A user signs in against the Users table, then the role-bearing menu opens patient, doctor, or billing screens; those screens perform database-backed record management, and billing associates charges with patients. Patient deletion also removes associated bills transactionally. The excerpts show these screens issuing SQL through DBConnection; the tree also contains PasswordUtil and ComboItem, but their runtime use is not established by the sampled source. MySQL is configured locally in DBConnection.

Main entry points: [`src/com/hms/MainMenu.java`](https://github.com/rare21ism/hospital-management-system/blob/main/src/com/hms/MainMenu.java) (Role menu), [`src/com/hms/DBConnection.java`](https://github.com/rare21ism/hospital-management-system/blob/main/src/com/hms/DBConnection.java) (JDBC connection), [`src/com/hms/LoginFrame.java`](https://github.com/rare21ism/hospital-management-system/blob/main/src/com/hms/LoginFrame.java) (Login), [`src/com/hms/PatientManagement.java`](https://github.com/rare21ism/hospital-management-system/blob/main/src/com/hms/PatientManagement.java) (Patient management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and Navigation"]
  node_login["Login<br/>[LoginFrame.java]"]
  node_menu["Role menu<br/>[MainMenu.java]"]
end

subgraph group_records["Clinical Records"]
  node_patients["Patient management"]
  node_doctors["Doctor management"]
end

subgraph group_billing["Billing"]
  node_bills["Bill management"]
end

subgraph group_persistence["Persistence"]
  node_connection["JDBC connection<br/>[DBConnection.java]"]
  node_mysql[("Hospital MySQL")]
end

node_user(("Hospital staff"))

node_user -->|"enters credentials"| node_login
node_login -->|"requests connection"| node_connection
node_login -->|"checks credentials"| node_mysql
node_login -->|"opens with role"| node_menu
node_user -->|"chooses section"| node_menu
node_menu -->|"opens screen"| node_patients
node_menu -->|"opens screen"| node_doctors
node_menu -->|"opens screen"| node_bills
node_patients -->|"requests connection"| node_connection
node_doctors -->|"requests connection"| node_connection
node_bills -->|"requests connection"| node_connection
node_connection -->|"connects via JDBC"| node_mysql
node_patients -->|"reads and writes patients"| node_mysql
node_patients -->|"deletes related bills"| node_mysql
node_doctors -->|"manages doctors"| node_mysql
node_bills -->|"manages bills"| node_mysql

click node_login "https://github.com/rare21ism/hospital-management-system/blob/main/src/com/hms/LoginFrame.java"
click node_menu "https://github.com/rare21ism/hospital-management-system/blob/main/src/com/hms/MainMenu.java"
click node_patients "https://github.com/rare21ism/hospital-management-system/blob/main/src/com/hms/PatientManagement.java"
click node_doctors "https://github.com/rare21ism/hospital-management-system/blob/main/src/com/hms/DoctorManagement.java"
click node_bills "https://github.com/rare21ism/hospital-management-system/blob/main/src/com/hms/BillManagement.java"
click node_connection "https://github.com/rare21ism/hospital-management-system/blob/main/src/com/hms/DBConnection.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_login,node_menu toneBlue
class node_patients,node_doctors toneAmber
class node_bills toneMint
class node_connection,node_mysql toneRose
class node_user toneIndigo
```

## Components

### Access and Navigation

- [Login](https://github.com/rare21ism/hospital-management-system/blob/main/src/com/hms/LoginFrame.java): `src/com/hms/LoginFrame.java`
- [Role menu](https://github.com/rare21ism/hospital-management-system/blob/main/src/com/hms/MainMenu.java): `src/com/hms/MainMenu.java`

### Clinical Records

- [Patient management](https://github.com/rare21ism/hospital-management-system/blob/main/src/com/hms/PatientManagement.java): `src/com/hms/PatientManagement.java`
- [Doctor management](https://github.com/rare21ism/hospital-management-system/blob/main/src/com/hms/DoctorManagement.java): `src/com/hms/DoctorManagement.java`

### Billing

- [Bill management](https://github.com/rare21ism/hospital-management-system/blob/main/src/com/hms/BillManagement.java): `src/com/hms/BillManagement.java`

### Persistence

- [JDBC connection](https://github.com/rare21ism/hospital-management-system/blob/main/src/com/hms/DBConnection.java): `src/com/hms/DBConnection.java`
- **Hospital MySQL**

### Other components

- **Hospital staff**

## Connections

- Hospital staff → Login: enters credentials
- Login → JDBC connection: requests connection
- Login → Hospital MySQL: checks credentials
- Login → Role menu: opens with role
- Hospital staff → Role menu: chooses section
- Role menu → Patient management: opens screen
- Role menu → Doctor management: opens screen
- Role menu → Bill management: opens screen
- Patient management → JDBC connection: requests connection
- Doctor management → JDBC connection: requests connection
- Bill management → JDBC connection: requests connection
- JDBC connection → Hospital MySQL: connects via JDBC
- Patient management → Hospital MySQL: reads and writes patients
- Patient management → Hospital MySQL: deletes related bills
- Doctor management → Hospital MySQL: manages doctors
- Bill management → Hospital MySQL: manages bills
