# harshsahu0702/online_medical_system architecture

> Architecture diagram of the GitHub repository harshsahu0702/online_medical_system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harshsahu0702/online_medical_system
- Repository: https://github.com/harshsahu0702/online_medical_system

## Overview

This is a Java servlet-based online medical system. Patients can register, find doctors, book appointments, manage profiles, access prescriptions and orders, and submit emergency requests; doctors manage clinical work and prescriptions; pharmacies manage medicines and orders; administrators oversee the system. The graph highlights these product stages and their persistence layer. Several capabilities are represented by their existing source directories because their implementations were not sampled; edges are limited to relationships shown in excerpts or the source index.

Main entry points: [`src/java/util/DBConnection.java`](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/util/DBConnection.java) (Database connection), [`src/java/doctor/dao/DoctorDAO.java`](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/doctor/dao/DoctorDAO.java) (Doctor records), [`src/java/doctor/dao/AppointmentDAO.java`](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/doctor/dao/AppointmentDAO.java) (Appointment management), [`src/java/pharmacy/dao/MedicineDAO.java`](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/pharmacy/dao/MedicineDAO.java) (Medicine persistence)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_patient["Patient services"]
  node_patient_access["Account and profile"]
  node_patient_search["Doctor discovery"]
  node_patient_booking["Slot booking"]
  node_patient_appointments["Appointment views"]
  node_patient_prescriptions_orders["Prescriptions and orders"]
  node_patient_emergency["Emergency requests"]
  node_patient_model["Patient records<br/>[Patient.java]"]
end

subgraph group_clinical["Doctor services"]
  node_doctor_registration["Doctor registration"]
  node_doctor_directory["Doctor records<br/>[DoctorDAO.java]"]
  node_doctor_profile_data["Doctor profile data<br/>[Doctor.java]"]
  node_doctor_documents["Doctor documents"]
  node_doctor_clinic["Clinic data<br/>[Clinic.java]"]
  node_doctor_specialty["Specializations"]
  node_doctor_appointments["Appointment management"]
  node_doctor_clinical_work["Consultations and prescriptions"]
end

subgraph group_pharmacy["Pharmacy services"]
  node_pharmacy_catalog["Medicine catalog"]
  node_pharmacy_medicine_dao["Medicine persistence<br/>[MedicineDAO.java]"]
  node_pharmacy_medicine["Medicine records<br/>[Medicine.java]"]
  node_pharmacy_orders["Order management"]
end

subgraph group_emergency["Emergency response"]
  node_emergency_admin["Emergency operations"]
  node_emergency_dao["Emergency persistence<br/>[EmergencyDAO.java]"]
  node_emergency_model["Emergency records<br/>[Emergency.java]"]
end

subgraph group_admin["Administration"]
  node_admin_console["System administration"]
  node_admin_dao["Admin persistence<br/>[AdminDAO.java]"]
end

subgraph group_persistence["Persistence"]
  node_db_connection["Database connection<br/>[DBConnection.java]"]
  node_mysql[("MySQL database")]
end

node_patient_actor(("Patient"))
node_doctor_actor(("Doctor"))
node_pharmacy_actor(("Pharmacy staff"))
node_admin_actor(("Administrator"))

node_patient_actor -->|"registers / manages"| node_patient_access
node_patient_access -->|"updates profile"| node_patient_model
node_patient_actor -.->|"finds doctors"| node_patient_search
node_patient_booking -->|"gets slot details"| node_patient_search
node_patient_booking -->|"saves appointment"| node_doctor_appointments
node_patient_actor -->|"books slot"| node_patient_booking
node_patient_appointments -->|"reads appointments"| node_doctor_appointments
node_patient_actor -.->|"views / orders"| node_patient_prescriptions_orders
node_patient_actor -->|"submits request"| node_patient_emergency
node_patient_emergency -->|"uses emergency model"| node_patient_model
node_doctor_actor -->|"registers"| node_doctor_registration
node_doctor_registration -->|"loads / registers"| node_doctor_directory
node_doctor_directory -->|"maps doctor data"| node_doctor_profile_data
node_doctor_directory -->|"maps documents"| node_doctor_documents
node_doctor_directory -->|"loads clinics"| node_doctor_clinic
node_doctor_directory -->|"loads specialties"| node_doctor_specialty
node_doctor_actor -.->|"manages appointments"| node_doctor_appointments
node_doctor_actor -.->|"records clinical work"| node_doctor_clinical_work
node_pharmacy_actor -->|"manages catalog"| node_pharmacy_catalog
node_pharmacy_catalog -->|"uses medicine DAO"| node_pharmacy_medicine_dao
node_pharmacy_medicine_dao -->|"maps medicines"| node_pharmacy_medicine
node_pharmacy_actor -.->|"manages orders"| node_pharmacy_orders
node_emergency_admin -->|"uses emergency records"| node_emergency_model
node_emergency_model -->|"delegates persistence"| node_emergency_dao
node_admin_actor -.->|"administers system"| node_admin_console
node_admin_console -->|"manages records"| node_admin_dao
node_admin_dao -->|"opens connection"| node_db_connection
node_doctor_directory -->|"opens connection"| node_db_connection
node_doctor_appointments -->|"opens connection"| node_db_connection
node_patient_search -->|"opens connection"| node_db_connection
node_pharmacy_medicine_dao -->|"opens connection"| node_db_connection
node_emergency_dao -->|"opens connection"| node_db_connection
node_db_connection -->|"connects"| node_mysql

click node_patient_access "https://github.com/harshsahu0702/online_medical_system/tree/main/src/java/patient/controller"
click node_patient_search "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/patient/dao/PatientDoctorDAO.java"
click node_patient_booking "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/patient/model/BookAppointment.java"
click node_patient_appointments "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/patient/controller/AppointmentsController.java"
click node_patient_prescriptions_orders "https://github.com/harshsahu0702/online_medical_system/tree/main/src/java/patient/controller"
click node_patient_emergency "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/patient/controller/EmergencyController.java"
click node_patient_model "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/patient/model/Patient.java"
click node_doctor_registration "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/doctor/controller/DoctorRegisterServlet.java"
click node_doctor_directory "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/doctor/dao/DoctorDAO.java"
click node_doctor_profile_data "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/doctor/model/Doctor.java"
click node_doctor_documents "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/doctor/model/DoctorDocument.java"
click node_doctor_clinic "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/doctor/model/Clinic.java"
click node_doctor_specialty "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/doctor/model/Specialization.java"
click node_doctor_appointments "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/doctor/dao/AppointmentDAO.java"
click node_doctor_clinical_work "https://github.com/harshsahu0702/online_medical_system/tree/main/src/java/doctor"
click node_pharmacy_catalog "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/pharmacy/controller/MedicineServlet.java"
click node_pharmacy_medicine_dao "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/pharmacy/dao/MedicineDAO.java"
click node_pharmacy_medicine "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/pharmacy/model/Medicine.java"
click node_pharmacy_orders "https://github.com/harshsahu0702/online_medical_system/tree/main/src/java/pharmacy"
click node_emergency_admin "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/emergency/controller/EmergencyServlet.java"
click node_emergency_dao "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/emergency/dao/EmergencyDAO.java"
click node_emergency_model "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/emergency/model/Emergency.java"
click node_admin_console "https://github.com/harshsahu0702/online_medical_system/tree/main/src/java/admin/controller"
click node_admin_dao "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/admin/dao/AdminDAO.java"
click node_db_connection "https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/util/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_patient_access,node_patient_search,node_patient_booking,node_patient_appointments,node_patient_prescriptions_orders,node_patient_emergency,node_patient_model toneBlue
class node_doctor_registration,node_doctor_directory,node_doctor_profile_data,node_doctor_documents,node_doctor_clinic,node_doctor_specialty,node_doctor_appointments,node_doctor_clinical_work toneAmber
class node_pharmacy_catalog,node_pharmacy_medicine_dao,node_pharmacy_medicine,node_pharmacy_orders toneMint
class node_emergency_admin,node_emergency_dao,node_emergency_model toneRose
class node_admin_console,node_admin_dao,node_patient_actor,node_doctor_actor,node_pharmacy_actor,node_admin_actor toneIndigo
class node_db_connection,node_mysql toneTeal
```

## Components

### Patient services

- [Account and profile](https://github.com/harshsahu0702/online_medical_system/tree/main/src/java/patient/controller): `src/java/patient/controller`
- [Doctor discovery](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/patient/dao/PatientDoctorDAO.java): `src/java/patient/dao/PatientDoctorDAO.java`
- [Slot booking](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/patient/model/BookAppointment.java): `src/java/patient/model/BookAppointment.java`
- [Appointment views](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/patient/controller/AppointmentsController.java): `src/java/patient/controller/AppointmentsController.java`
- [Prescriptions and orders](https://github.com/harshsahu0702/online_medical_system/tree/main/src/java/patient/controller): `src/java/patient/controller`
- [Emergency requests](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/patient/controller/EmergencyController.java): `src/java/patient/controller/EmergencyController.java`
- [Patient records](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/patient/model/Patient.java): `src/java/patient/model/Patient.java`

### Doctor services

- [Doctor registration](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/doctor/controller/DoctorRegisterServlet.java): `src/java/doctor/controller/DoctorRegisterServlet.java`
- [Doctor records](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/doctor/dao/DoctorDAO.java): `src/java/doctor/dao/DoctorDAO.java`
- [Doctor profile data](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/doctor/model/Doctor.java): `src/java/doctor/model/Doctor.java`
- [Doctor documents](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/doctor/model/DoctorDocument.java): `src/java/doctor/model/DoctorDocument.java`
- [Clinic data](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/doctor/model/Clinic.java): `src/java/doctor/model/Clinic.java`
- [Specializations](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/doctor/model/Specialization.java): `src/java/doctor/model/Specialization.java`
- [Appointment management](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/doctor/dao/AppointmentDAO.java): `src/java/doctor/dao/AppointmentDAO.java`
- [Consultations and prescriptions](https://github.com/harshsahu0702/online_medical_system/tree/main/src/java/doctor): `src/java/doctor`

### Pharmacy services

- [Medicine catalog](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/pharmacy/controller/MedicineServlet.java): `src/java/pharmacy/controller/MedicineServlet.java`
- [Medicine persistence](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/pharmacy/dao/MedicineDAO.java): `src/java/pharmacy/dao/MedicineDAO.java`
- [Medicine records](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/pharmacy/model/Medicine.java): `src/java/pharmacy/model/Medicine.java`
- [Order management](https://github.com/harshsahu0702/online_medical_system/tree/main/src/java/pharmacy): `src/java/pharmacy`

### Emergency response

- [Emergency operations](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/emergency/controller/EmergencyServlet.java): `src/java/emergency/controller/EmergencyServlet.java`
- [Emergency persistence](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/emergency/dao/EmergencyDAO.java): `src/java/emergency/dao/EmergencyDAO.java`
- [Emergency records](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/emergency/model/Emergency.java): `src/java/emergency/model/Emergency.java`

### Administration

- [System administration](https://github.com/harshsahu0702/online_medical_system/tree/main/src/java/admin/controller): `src/java/admin/controller`
- [Admin persistence](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/admin/dao/AdminDAO.java): `src/java/admin/dao/AdminDAO.java`

### Persistence

- [Database connection](https://github.com/harshsahu0702/online_medical_system/blob/main/src/java/util/DBConnection.java): `src/java/util/DBConnection.java`
- **MySQL database**

### Other components

- **Patient**
- **Doctor**
- **Pharmacy staff**
- **Administrator**

## Connections

- Patient → Account and profile: registers / manages (evidence: `src/java/patient/controller/SignupController.java`)
- Account and profile → Patient records: updates profile (evidence: `src/java/patient/controller/EditProfileController.java`)
- Patient → Doctor discovery: finds doctors
- Slot booking → Doctor discovery: gets slot details (evidence: `src/java/patient/model/BookAppointment.java`)
- Slot booking → Appointment management: saves appointment (evidence: `src/java/patient/model/BookAppointment.java`)
- Patient → Slot booking: books slot
- Appointment views → Appointment management: reads appointments (evidence: `src/java/patient/controller/AppointmentsController.java`)
- Patient → Prescriptions and orders: views / orders
- Patient → Emergency requests: submits request (evidence: `src/java/patient/controller/EmergencyController.java`)
- Emergency requests → Patient records: uses emergency model (evidence: `src/java/patient/controller/EmergencyController.java`)
- Doctor → Doctor registration: registers (evidence: `src/java/doctor/controller/DoctorRegisterServlet.java`)
- Doctor registration → Doctor records: loads / registers (evidence: `src/java/doctor/controller/DoctorRegisterServlet.java`)
- Doctor records → Doctor profile data: maps doctor data (evidence: `src/java/doctor/dao/DoctorDAO.java`)
- Doctor records → Doctor documents: maps documents (evidence: `src/java/doctor/dao/DoctorDAO.java`)
- Doctor records → Clinic data: loads clinics (evidence: `src/java/doctor/dao/DoctorDAO.java`)
- Doctor records → Specializations: loads specialties (evidence: `src/java/doctor/dao/DoctorDAO.java`)
- Doctor → Appointment management: manages appointments
- Doctor → Consultations and prescriptions: records clinical work
- Pharmacy staff → Medicine catalog: manages catalog (evidence: `src/java/pharmacy/controller/MedicineServlet.java`)
- Medicine catalog → Medicine persistence: uses medicine DAO (evidence: `src/java/pharmacy/controller/MedicineServlet.java`)
- Medicine persistence → Medicine records: maps medicines (evidence: `src/java/pharmacy/dao/MedicineDAO.java`)
- Pharmacy staff → Order management: manages orders
- Emergency operations → Emergency records: uses emergency records (evidence: `src/java/emergency/controller/EmergencyServlet.java`)
- Emergency records → Emergency persistence: delegates persistence (evidence: `src/java/emergency/model/Emergency.java`)
- Administrator → System administration: administers system
- System administration → Admin persistence: manages records (evidence: `src/java/admin/controller/AdminDoctorManagementServlet.java`)
- Admin persistence → Database connection: opens connection (evidence: `src/java/admin/dao/AdminDAO.java`)
- Doctor records → Database connection: opens connection (evidence: `src/java/doctor/dao/DoctorDAO.java`)
- Appointment management → Database connection: opens connection (evidence: `src/java/doctor/dao/AppointmentDAO.java`)
- Doctor discovery → Database connection: opens connection (evidence: `src/java/patient/dao/PatientDoctorDAO.java`)
- Medicine persistence → Database connection: opens connection (evidence: `src/java/pharmacy/dao/MedicineDAO.java`)
- Emergency persistence → Database connection: opens connection (evidence: `src/java/emergency/dao/EmergencyDAO.java`)
- Database connection → MySQL database: connects (evidence: `src/java/util/DBConnection.java`)
