# kishan0725/hospital-management-system architecture

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

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

## Overview

#### Purpose and runtime
A server-rendered Hospital Management System for patient, doctor, and administrator workflows. It runs as a PHP application under Apache/XAMPP, persists operational data in MySQL, and is initialized from `myhmsdb.sql`. TCPDF is vendored for PDF generation. Core entry points are `index.php` (public/auth landing), `index1.php` (patient area), `doctor-panel.php`, and `admin-panel.php`.

#### Shared application boundary
Database connectivity and common page composition are centralized in `include/config.php` and the shared layout files `include/header.php`, `include/sidebar.php`, and `include/footer.php`. These form the boundary between individual PHP page/controllers and the MySQL-backed application state. `include/checklogin.php` is the reusable session/authentication gate for protected screens.

#### Authentication and role routing
The landing flow accepts separate patient, doctor, and admin credentials and dispatches users into role-specific dashboards. `index.php` is the primary login/registration endpoint; `func.php`, `func1.php`, `func2.php`, and `func3.php` likely contain action handlers used by these form-driven flows. Separate logout endpoints (`logout.php`, `logout1.php`) reflect distinct role/session paths rather than a unified routing layer.

#### Patient workflow
Patients register/login, book appointments, inspect appointment history, and cancel appointments. The patient dashboard is `index1.php`; appointment/prescription-related interactions are represented by `prescribe.php` and likely submitted through the shared function handlers. Appointment state is a cross-role record: a patient cancellation must remain visible to the corresponding doctor and admin views.

#### Doctor workflow
Doctors are admin-provisioned users who authenticate and view or search their assigned appointments/patients. `doctor-panel.php` is the role dashboard and `doctorsearch.php` provides doctor-facing lookup. The doctor may cancel an appointment, changing the same persisted appointment record consumed by patient and administrative views.

#### Administrative workflow
Admin is the operational control plane: view patients, doctors, appointments, and contact submissions; add/remove doctors; and search records. Its main dashboard is `admin-panel.php`, with related alternate/admin listing handling in `admin-panel1.php` and search endpoints such as `patientsearch.php`, `appsearch.php`, `messearch.php`, and `search.php`. Admin mutations to doctors affect who can authenticate and be selected for appointments.

#### Contact, presentation, and PDF output
Public informational/contact pages are `contact.html`, `contact.php`, and `services.html`; contact submissions become records reviewed by admin. The UI is PHP/HTML with Bootstrap-oriented static assets under `assets/`, `css/`, and `js/`, plus Font Awesome. PDF generation is provided by the embedded TCPDF library, centered on `TCPDF/tcpdf.php`, with application-level dependency declaration in `composer.json`; it is an in-process PHP library, not an external service.

Main entry points: [`doctor-panel.php`](https://github.com/kishan0725/hospital-management-system/blob/master/doctor-panel.php) (Doctor dashboard), [`admin-panel.php`](https://github.com/kishan0725/hospital-management-system/blob/master/admin-panel.php) (Admin dashboard), [`prescribe.php`](https://github.com/kishan0725/hospital-management-system/blob/master/prescribe.php) (Appointments & prescriptions), [`index.php`](https://github.com/kishan0725/hospital-management-system/blob/master/index.php) (Login & registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public &amp; patient"]
  node_landing["Login &amp; registration<br/>PHP entry point<br/>[index.php]"]
  node_patient_dashboard["Patient dashboard<br/>PHP dashboard<br/>[index1.php]"]
  node_contact["Contact flow<br/>public PHP/HTML<br/>[contact.php]"]
end

subgraph group_clinical["Clinical operations"]
  node_doctor_dashboard["Doctor dashboard<br/>PHP dashboard<br/>[doctor-panel.php]"]
  node_doctor_search["Doctor search<br/>PHP endpoint<br/>[doctorsearch.php]"]
end

subgraph group_admin["Administration"]
  node_admin_dashboard["Admin dashboard<br/>PHP dashboard<br/>[admin-panel.php]"]
  node_admin_listings["Admin listings &amp; search<br/>PHP endpoints<br/>[admin-panel1.php]"]
end

subgraph group_shared["Shared application"]
  node_action_handlers["Form action handlers<br/>PHP handlers<br/>[func.php]"]
  node_appointment_flow["Appointments &amp; prescriptions<br/>PHP workflow<br/>[prescribe.php]"]
  node_auth_gate["Session auth gate<br/>PHP middleware<br/>[checklogin.php]"]
  node_app_config["Database configuration<br/>PHP config<br/>[config.php]"]
  node_shared_layout["Shared page layout<br/>PHP templates<br/>[header.php]"]
  node_static_ui["UI assets<br/>static assets"]
  node_mysql[("Hospital operational data<br/>MySQL database")]
  node_schema["Database initialization<br/>SQL schema<br/>[myhmsdb.sql]"]
  node_pdf_library["TCPDF<br/>vendored PHP library<br/>[tcpdf.php]"]
  node_composer["PHP dependencies<br/>dependency manifest<br/>[composer.json]"]
  node_logout["Role logout endpoints<br/>PHP endpoints<br/>[logout.php]"]
end

node_landing -->|"submits credentials"| node_action_handlers
node_action_handlers -->|"authenticates and registers"| node_mysql
node_landing -->|"routes patient"| node_patient_dashboard
node_landing -->|"routes doctor"| node_doctor_dashboard
node_landing -->|"routes admin"| node_admin_dashboard
node_patient_dashboard -->|"protects access"| node_auth_gate
node_doctor_dashboard -->|"protects access"| node_auth_gate
node_admin_dashboard -->|"protects access"| node_auth_gate
node_patient_dashboard -->|"books and cancels"| node_appointment_flow
node_doctor_dashboard -->|"views and cancels assigned"| node_appointment_flow
node_admin_dashboard -->|"oversees appointments"| node_appointment_flow
node_doctor_dashboard -->|"searches patients"| node_doctor_search
node_admin_dashboard -->|"lists and searches records"| node_admin_listings
node_admin_dashboard -->|"manages doctors and records"| node_mysql
node_appointment_flow -->|"persists shared appointment state"| node_mysql
node_doctor_search -->|"queries assigned records"| node_mysql
node_admin_listings -->|"queries operational records"| node_mysql
node_contact -->|"stores submissions"| node_mysql
node_app_config -->|"connects"| node_mysql
node_schema -->|"initializes"| node_mysql
node_shared_layout -->|"renders with"| node_static_ui
node_appointment_flow -.->|"generates PDFs"| node_pdf_library
node_composer -.->|"declares dependency"| node_pdf_library
node_patient_dashboard -->|"ends session"| node_logout
node_doctor_dashboard -->|"ends session"| node_logout

click node_landing "https://github.com/kishan0725/hospital-management-system/blob/master/index.php"
click node_patient_dashboard "https://github.com/kishan0725/hospital-management-system/blob/master/index1.php"
click node_contact "https://github.com/kishan0725/hospital-management-system/blob/master/contact.php"
click node_doctor_dashboard "https://github.com/kishan0725/hospital-management-system/blob/master/doctor-panel.php"
click node_doctor_search "https://github.com/kishan0725/hospital-management-system/blob/master/doctorsearch.php"
click node_admin_dashboard "https://github.com/kishan0725/hospital-management-system/blob/master/admin-panel.php"
click node_admin_listings "https://github.com/kishan0725/hospital-management-system/blob/master/admin-panel1.php"
click node_action_handlers "https://github.com/kishan0725/hospital-management-system/blob/master/func.php"
click node_appointment_flow "https://github.com/kishan0725/hospital-management-system/blob/master/prescribe.php"
click node_auth_gate "https://github.com/kishan0725/hospital-management-system/blob/master/include/checklogin.php"
click node_app_config "https://github.com/kishan0725/hospital-management-system/blob/master/include/config.php"
click node_shared_layout "https://github.com/kishan0725/hospital-management-system/blob/master/include/header.php"
click node_schema "https://github.com/kishan0725/hospital-management-system/blob/master/myhmsdb.sql"
click node_pdf_library "https://github.com/kishan0725/hospital-management-system/blob/master/TCPDF/tcpdf.php"
click node_composer "https://github.com/kishan0725/hospital-management-system/blob/master/composer.json"
click node_logout "https://github.com/kishan0725/hospital-management-system/blob/master/logout.php"

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_landing,node_patient_dashboard,node_contact toneBlue
class node_doctor_dashboard,node_doctor_search toneAmber
class node_admin_dashboard,node_admin_listings toneMint
class node_action_handlers,node_appointment_flow,node_auth_gate,node_app_config,node_shared_layout,node_static_ui,node_mysql,node_schema,node_pdf_library,node_composer,node_logout toneRose
```

## Components

### Public & patient

- [Login & registration](https://github.com/kishan0725/hospital-management-system/blob/master/index.php): PHP entry point · Role-specific authentication landing. · `index.php`
- [Patient dashboard](https://github.com/kishan0725/hospital-management-system/blob/master/index1.php): PHP dashboard · `index1.php`
- [Contact flow](https://github.com/kishan0725/hospital-management-system/blob/master/contact.php): public PHP/HTML · Collects public contact submissions. · `contact.php`

### Clinical operations

- [Doctor dashboard](https://github.com/kishan0725/hospital-management-system/blob/master/doctor-panel.php): PHP dashboard · `doctor-panel.php`
- [Doctor search](https://github.com/kishan0725/hospital-management-system/blob/master/doctorsearch.php): PHP endpoint · `doctorsearch.php`

### Administration

- [Admin dashboard](https://github.com/kishan0725/hospital-management-system/blob/master/admin-panel.php): PHP dashboard · Operational control plane for records and doctors. · `admin-panel.php`
- [Admin listings & search](https://github.com/kishan0725/hospital-management-system/blob/master/admin-panel1.php): PHP endpoints · `admin-panel1.php`

### Shared application

- [Form action handlers](https://github.com/kishan0725/hospital-management-system/blob/master/func.php): PHP handlers · Processes form-driven authentication and workflow actions. · `func.php`
- [Appointments & prescriptions](https://github.com/kishan0725/hospital-management-system/blob/master/prescribe.php): PHP workflow · Creates, views, cancels, and prepares appointment-related records. · `prescribe.php`
- [Session auth gate](https://github.com/kishan0725/hospital-management-system/blob/master/include/checklogin.php): PHP middleware · `include/checklogin.php`
- [Database configuration](https://github.com/kishan0725/hospital-management-system/blob/master/include/config.php): PHP config · Central MySQL connectivity boundary. · `include/config.php`
- [Shared page layout](https://github.com/kishan0725/hospital-management-system/blob/master/include/header.php): PHP templates · `include/header.php`
- **UI assets**: static assets · Bootstrap-oriented presentation assets.
- **Hospital operational data**: MySQL database · Patients, doctors, appointments, and contact records.
- [Database initialization](https://github.com/kishan0725/hospital-management-system/blob/master/myhmsdb.sql): SQL schema · `myhmsdb.sql`
- [TCPDF](https://github.com/kishan0725/hospital-management-system/blob/master/TCPDF/tcpdf.php): vendored PHP library · In-process PDF generation library. · `TCPDF/tcpdf.php`
- [PHP dependencies](https://github.com/kishan0725/hospital-management-system/blob/master/composer.json): dependency manifest · `composer.json`
- [Role logout endpoints](https://github.com/kishan0725/hospital-management-system/blob/master/logout.php): PHP endpoints · Separate session termination paths. · `logout.php`

## Connections

- Login & registration → Form action handlers: submits credentials
- Form action handlers → Hospital operational data: authenticates and registers
- Login & registration → Patient dashboard: routes patient
- Login & registration → Doctor dashboard: routes doctor
- Login & registration → Admin dashboard: routes admin
- Patient dashboard → Session auth gate: protects access
- Doctor dashboard → Session auth gate: protects access
- Admin dashboard → Session auth gate: protects access
- Patient dashboard → Appointments & prescriptions: books and cancels
- Doctor dashboard → Appointments & prescriptions: views and cancels assigned
- Admin dashboard → Appointments & prescriptions: oversees appointments
- Doctor dashboard → Doctor search: searches patients
- Admin dashboard → Admin listings & search: lists and searches records
- Admin dashboard → Hospital operational data: manages doctors and records
- Appointments & prescriptions → Hospital operational data: persists shared appointment state
- Doctor search → Hospital operational data: queries assigned records
- Admin listings & search → Hospital operational data: queries operational records
- Contact flow → Hospital operational data: stores submissions
- Database configuration → Hospital operational data: connects
- Database initialization → Hospital operational data: initializes
- Shared page layout → UI assets: renders with
- Appointments & prescriptions → TCPDF: generates PDFs
- PHP dependencies → TCPDF: declares dependency
- Patient dashboard → Role logout endpoints: ends session
- Doctor dashboard → Role logout endpoints: ends session
