# archith2006/hospital-management-system architecture

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

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

## Overview

The repository’s documented product is a Java console hospital management system: a user admits a patient to a room, assigns a doctor, and later discharges the patient to generate a bill. It also offers room and patient views, billing history, and save/load persistence. A sampled `app.js` provides a separate browser-based workflow with in-memory patient, room, doctor, and bill state. The Java controller excerpt is partial, so links for unsampled menu operations are limited to documented capabilities.

Main entry points: [`src/hms/HospitalManagementSystem.java`](https://github.com/archith2006/hospital-management-system/blob/main/src/hms/HospitalManagementSystem.java) (Workflow controller), [`src/hms/Room.java`](https://github.com/archith2006/hospital-management-system/blob/main/src/hms/Room.java) (Room availability), [`src/hms/Patient.java`](https://github.com/archith2006/hospital-management-system/blob/main/src/hms/Patient.java) (Patient admission), [`src/hms/Doctor.java`](https://github.com/archith2006/hospital-management-system/blob/main/src/hms/Doctor.java) (Doctor assignment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Console application"]
  node_launcher["Java launcher<br/>[Main.java]"]
  node_controller["Workflow controller"]
end

subgraph group_domain["Hospital domain"]
  node_patient["Patient admission<br/>[Patient.java]"]
  node_person["Person model<br/>[Person.java]"]
  node_doctor["Doctor assignment<br/>[Doctor.java]"]
  node_bookable["Room booking contract<br/>[Bookable.java]"]
  node_room["Room availability<br/>[Room.java]"]
  node_general["General room<br/>[GeneralRoom.java]"]
  node_semi["Semi-private room"]
  node_icu["ICU room<br/>[ICU.java]"]
end

subgraph group_billing["Billing"]
  node_bill["Bill generation<br/>[Bill.java]"]
  node_recordstore[("Serialized records")]
  node_billfile[("CSV bill history")]
end

subgraph group_browser["Browser application"]
  node_browserapp["Browser workflow<br/>[app.js]"]
end

node_operator(("Hospital operator"))

node_operator -->|"starts"| node_launcher
node_launcher -->|"launches"| node_controller
node_operator -->|"uses menu"| node_controller
node_controller -->|"loads and saves"| node_recordstore
node_controller -->|"creates and admits"| node_patient
node_controller -->|"selects room"| node_room
node_controller -->|"assigns doctor"| node_doctor
node_patient -->|"books and releases"| node_room
node_patient -->|"releases doctor"| node_doctor
node_controller -->|"generates bill"| node_bill
node_bill -->|"calculates charges"| node_room
node_bill -->|"reads fee"| node_doctor
node_controller -->|"appends bill"| node_billfile
node_person -->|"extends"| node_patient
node_person -->|"extends"| node_doctor
node_room -->|"implements"| node_bookable
node_general -->|"extends"| node_room
node_semi -->|"extends"| node_room
node_icu -->|"extends"| node_room
node_operator -.->|"uses browser"| node_browserapp

click node_launcher "https://github.com/archith2006/hospital-management-system/blob/main/src/hms/Main.java"
click node_controller "https://github.com/archith2006/hospital-management-system/blob/main/src/hms/HospitalManagementSystem.java"
click node_patient "https://github.com/archith2006/hospital-management-system/blob/main/src/hms/Patient.java"
click node_person "https://github.com/archith2006/hospital-management-system/blob/main/src/hms/Person.java"
click node_doctor "https://github.com/archith2006/hospital-management-system/blob/main/src/hms/Doctor.java"
click node_bookable "https://github.com/archith2006/hospital-management-system/blob/main/src/hms/Bookable.java"
click node_room "https://github.com/archith2006/hospital-management-system/blob/main/src/hms/Room.java"
click node_general "https://github.com/archith2006/hospital-management-system/blob/main/src/hms/GeneralRoom.java"
click node_semi "https://github.com/archith2006/hospital-management-system/blob/main/src/hms/SemiPrivateRoom.java"
click node_icu "https://github.com/archith2006/hospital-management-system/blob/main/src/hms/ICU.java"
click node_bill "https://github.com/archith2006/hospital-management-system/blob/main/src/hms/Bill.java"
click node_browserapp "https://github.com/archith2006/hospital-management-system/blob/main/app.js"

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_launcher,node_controller toneBlue
class node_patient,node_person,node_doctor,node_bookable,node_room,node_general,node_semi,node_icu toneAmber
class node_bill,node_recordstore,node_billfile toneMint
class node_browserapp toneRose
class node_operator toneIndigo
```

## Components

### Console application

- [Java launcher](https://github.com/archith2006/hospital-management-system/blob/main/src/hms/Main.java): `src/hms/Main.java`
- [Workflow controller](https://github.com/archith2006/hospital-management-system/blob/main/src/hms/HospitalManagementSystem.java): `src/hms/HospitalManagementSystem.java`

### Hospital domain

- [Patient admission](https://github.com/archith2006/hospital-management-system/blob/main/src/hms/Patient.java): `src/hms/Patient.java`
- [Person model](https://github.com/archith2006/hospital-management-system/blob/main/src/hms/Person.java): `src/hms/Person.java`
- [Doctor assignment](https://github.com/archith2006/hospital-management-system/blob/main/src/hms/Doctor.java): `src/hms/Doctor.java`
- [Room booking contract](https://github.com/archith2006/hospital-management-system/blob/main/src/hms/Bookable.java): `src/hms/Bookable.java`
- [Room availability](https://github.com/archith2006/hospital-management-system/blob/main/src/hms/Room.java): `src/hms/Room.java`
- [General room](https://github.com/archith2006/hospital-management-system/blob/main/src/hms/GeneralRoom.java): `src/hms/GeneralRoom.java`
- [Semi-private room](https://github.com/archith2006/hospital-management-system/blob/main/src/hms/SemiPrivateRoom.java): `src/hms/SemiPrivateRoom.java`
- [ICU room](https://github.com/archith2006/hospital-management-system/blob/main/src/hms/ICU.java): `src/hms/ICU.java`

### Billing

- [Bill generation](https://github.com/archith2006/hospital-management-system/blob/main/src/hms/Bill.java): `src/hms/Bill.java`
- **Serialized records**
- **CSV bill history**

### Browser application

- [Browser workflow](https://github.com/archith2006/hospital-management-system/blob/main/app.js): `app.js`

### Other components

- **Hospital operator**

## Connections

- Hospital operator → Java launcher: starts
- Java launcher → Workflow controller: launches
- Hospital operator → Workflow controller: uses menu
- Workflow controller → Serialized records: loads and saves
- Workflow controller → Patient admission: creates and admits
- Workflow controller → Room availability: selects room
- Workflow controller → Doctor assignment: assigns doctor
- Patient admission → Room availability: books and releases
- Patient admission → Doctor assignment: releases doctor
- Workflow controller → Bill generation: generates bill
- Bill generation → Room availability: calculates charges
- Bill generation → Doctor assignment: reads fee
- Workflow controller → CSV bill history: appends bill
- Person model → Patient admission: extends
- Person model → Doctor assignment: extends
- Room availability → Room booking contract: implements
- General room → Room availability: extends
- Semi-private room → Room availability: extends
- ICU room → Room availability: extends
- Hospital operator → Browser workflow: uses browser
