# vikesh8860/hospital-management-project architecture

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

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

## Overview

##### Project type and purpose
- This is a standalone Java desktop application (built in NetBeans) for hospital management.
- It uses Java Swing forms for the user interface and MySQL (via JDBC) as its backend database.
- Key functionality: patient registration, room allocation, billing, medicines/tests management, and employee information management.

##### File structure
Top‐level files and directories:
- build.xml, nbproject/ – NetBeans project and build scripts
- src/hospital_management/ – all Java source files and NetBeans .form definitions (UI + code)
- Databse_querries.txt – SQL statements used by the app
- dist/ + lib/mysql‑connector*.jar – packaged JAR and JDBC driver
- build/ – compiled classes

Patterns & layers implied:
- Presentation layer: Swing forms (AdminLogin, PatientRegForm, BillGeneration, etc.)
- Business logic: code inside each form class (event handlers, validations)
- Data access: JDBC calls (SQL from Databse_querries.txt) embedded in the form classes or utility methods
- Persistence layer: MySQL database with tables for Patients, Employees, Rooms, Bills, Medicines, Tests

##### README for additional insights
- Technologies: Java (NetBeans), DBMS: MySQL (WAMP server)

##### Main components & how to represent them
- Client Application (Java Swing UI)
- Business Logic / Controller layer (event handlers and service methods)
- Data Access component (JDBC driver + SQL queries)
- MySQL Database (tables for Patient, Employee, Room, Bill, Medicine, Test)
- External libraries (mysql‑connector‑java.jar)

b. Relationships & interactions
1. User → Swing UI forms (e.g., Login, Registration, Billing)
2. UI forms → Business Logic (validate input, apply rules)
3. Business Logic → Data Access (execute SQL via JDBC)
4. Data Access → MySQL DB (CRUD operations)
5. Data returns back up through the layers to the UI

c. Architectural patterns & principles
- Layered architecture (Presentation → Business → Data Access → Database)
- Modularization by feature: each form handles its slice of functionality
- Use of NetBeans project structure for clean build and packaging

d. Technologies & frameworks
- Java Swing (javax.swing)
- JDBC (java.sql)
- MySQL (WAMP server)
- NetBeans build scripts (Ant)

##### Detail without overcomplication
- Break the app into as many logical components as make sense (UI screens, service modules, DAO module, DB).
- Essential elements: user interactions, core modules, data flow, and persistence.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        AdminLogin_UI["AdminLogin Form"]:::ui
        PatientRegForm_UI["PatientRegForm"]:::ui
        BillGeneration_UI["BillGeneration"]:::ui
        EmployeeDetails_UI["EmployeeDetails"]:::ui
        PatientsMedicine_UI["PatientsMedicine"]:::ui
        PatientsTests_UI["PatientsTests"]:::ui
    end

    %% Business Logic / Controllers
    subgraph "Business Logic / Controllers"
        direction TB
        AdminLogin_BL["AdminLogin Controller"]:::bl
        PatientRegForm_BL["PatientRegForm Controller"]:::bl
        BillGeneration_BL["BillGeneration Controller"]:::bl
        EmployeeDetails_BL["EmployeeDetails Controller"]:::bl
        DeleteEmpInfo_BL["DeleteEmpInfo Controller"]:::bl
        UpdatePatient_BL["UpdatePatient Controller"]:::bl
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        direction TB
        JDBC_Driver["JDBC Driver\n(java.sql)"]:::dataaccess
        SQL_Queries["Database_queries.txt"]:::dataaccess
    end

    %% External Library
    External_JAR1["mysql-connector-java-5.1.23-bin.jar"]:::external
    External_JAR2["mysql-connector-java-5.1.38-bin.jar"]:::external

    %% Persistence Layer
    MySQL_DB["MySQL Database\n(Patient, Employee, Room,\nBill, Medicine, Test)"]:::db

    %% Build & Packaging
    subgraph "Build & Packaging"
        direction TB
        Ant_Build["build.xml"]:::build
        NetBeans_Project["nbproject/"]:::build
        Compiled_Classes["build/classes/hospital_management/"]:::build
        Dist_JAR["dist/Hospital_Management.jar"]:::build
    end

    %% Connections - User flow
    User["User"]:::external
    User -->|"interacts with"| AdminLogin_UI
    User -->|"interacts with"| PatientRegForm_UI
    User -->|"interacts with"| BillGeneration_UI
    User -->|"interacts with"| EmployeeDetails_UI
    User -->|"interacts with"| PatientsMedicine_UI
    User -->|"interacts with"| PatientsTests_UI

    %% UI to Business Logic
    AdminLogin_UI -->|"calls events"| AdminLogin_BL
    PatientRegForm_UI -->|"calls events"| PatientRegForm_BL
    BillGeneration_UI -->|"calls events"| BillGeneration_BL
    EmployeeDetails_UI -->|"calls events"| EmployeeDetails_BL
    AdminLogin_UI -->|"calls events"| DeleteEmpInfo_BL
    PatientRegForm_UI -->|"calls events"| UpdatePatient_BL

    %% Business Logic to Data Access
    AdminLogin_BL -->|"uses JDBC"| JDBC_Driver
    PatientRegForm_BL -->|"executes SQL"| SQL_Queries
    BillGeneration_BL -->|"executes SQL"| SQL_Queries
    EmployeeDetails_BL -->|"executes SQL"| SQL_Queries
    DeleteEmpInfo_BL -->|"executes SQL"| SQL_Queries
    UpdatePatient_BL -->|"executes SQL"| SQL_Queries

    %% Data Access to Database
    JDBC_Driver -->|"connects to"| MySQL_DB
    SQL_Queries -->|"CRUD operations"| MySQL_DB

    %% External libraries
    JDBC_Driver --> External_JAR1
    JDBC_Driver --> External_JAR2

    %% Build dependencies
    Ant_Build --> NetBeans_Project
    Ant_Build --> Compiled_Classes
    Compiled_Classes --> Dist_JAR

    %% Click Events
    click AdminLogin_UI "https://github.com/vikesh8860/hospital-management-project/blob/master/src/hospital_management/AdminLogin.form"
    click AdminLogin_BL "https://github.com/vikesh8860/hospital-management-project/blob/master/src/hospital_management/AdminLogin.java"
    click PatientRegForm_UI "https://github.com/vikesh8860/hospital-management-project/blob/master/src/hospital_management/PatientRegForm.form"
    click PatientRegForm_BL "https://github.com/vikesh8860/hospital-management-project/blob/master/src/hospital_management/PatientRegForm.java"
    click BillGeneration_UI "https://github.com/vikesh8860/hospital-management-project/blob/master/src/hospital_management/BillGeneration.form"
    click BillGeneration_BL "https://github.com/vikesh8860/hospital-management-project/blob/master/src/hospital_management/BillGeneration.java"
    click EmployeeDetails_UI "https://github.com/vikesh8860/hospital-management-project/blob/master/src/hospital_management/EmployeeDetails.form"
    click EmployeeDetails_BL "https://github.com/vikesh8860/hospital-management-project/blob/master/src/hospital_management/EmployeeDetails.java"
    click PatientsMedicine_UI "https://github.com/vikesh8860/hospital-management-project/blob/master/src/hospital_management/PatientsMedicine.form"
    click PatientsTests_UI "https://github.com/vikesh8860/hospital-management-project/blob/master/src/hospital_management/PatientsTests.form"
    click DeleteEmpInfo_BL "https://github.com/vikesh8860/hospital-management-project/blob/master/src/hospital_management/DeleteEmpInfo.java"
    click UpdatePatient_BL "https://github.com/vikesh8860/hospital-management-project/blob/master/src/hospital_management/UpdatePatient.java"
    click SQL_Queries "https://github.com/vikesh8860/hospital-management-project/blob/master/Databse_querries.txt"
    click External_JAR1 "https://github.com/vikesh8860/hospital-management-project/blob/master/dist/lib/mysql-connector‑java-5.1.23‑bin.jar"
    click External_JAR2 "https://github.com/vikesh8860/hospital-management-project/blob/master/dist/lib/mysql-connector‑java-5.1.38‑bin.jar"
    click Ant_Build "https://github.com/vikesh8860/hospital-management-project/blob/master/build.xml"
    click NetBeans_Project "https://github.com/vikesh8860/hospital-management-project/tree/master/nbproject/"
    click Compiled_Classes "https://github.com/vikesh8860/hospital-management-project/tree/master/build/classes/hospital_management/"
    click Dist_JAR "https://github.com/vikesh8860/hospital-management-project/blob/master/dist/Hospital_Management.jar"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef bl fill:#90EE90,stroke:#000,stroke-width:1px
    classDef dataaccess fill:#FFA500,stroke:#000,stroke-width:1px
    classDef db fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef external fill:#DDA0DD,stroke:#000,stroke-width:1px
    classDef build fill:#FFFFE0,stroke:#000,stroke-width:1px
```
