Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions src/main/java/org/example/fromabdullahalhadabi/HMS-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Oracle APEX Hospital Management System

## Project Overview
A comprehensive Hospital Management System built with Oracle APEX and Oracle Database. The system manages patients, doctors, appointments, admissions, prescriptions, medicines, and room allocations with full reporting and dashboard capabilities.

**APEX Application ID:** 153222
**Workspace:** WKSP_ALNOORHOSPITALOMAN
**Author:** Abdullah Alhadabi

---

## Project Structure

```
fromabdullahalhadabi/
├── database/
│ ├── 01_schema/ # Table DDL, sequences, constraints
│ ├── 02_sample_data/ # Seed data for testing
│ ├── 03_views_triggers/ # Database views and triggers
│ ├── 04_reports/ # Report queries
│ └── 05_audit/ # Audit and security
├── apex/
│ └── f153222.sql # Full APEX application export
├── docs/
│ ├── DEPLOYMENT.md # Deployment guide
│ └── *.pdf # Application documentation
├── screenshots/ # Application screenshots
└── *.java # Supporting Java files
```

---

## Database Schema

| Table | Description |
|-------|-------------|
| DEPARTMENTS | Hospital departments |
| DOCTOR_SPECIALTIES | Doctor specialty mappings |
| MEDICINE_CATEGORIES | Medicine分类 |
| APPOINTMENT_STATUSES | Appointment status codes |
| PATIENTS | Patient records |
| DOCTORS | Doctor records |
| ROOMS | Room allocations |
| MEDICINES | Medicine inventory |
| APPOINTMENTS | Patient appointments |
| ADMISSIONS | Patient admissions |
| PATIENT_VISITS | Visit records |
| PRESCRIPTIONS | Prescription headers |
| PRESCRIPTION_ITEMS | Prescription line items |

---

## Dashboard Views

- `VW_DASH_APPTS_BY_DEPT` - Appointments by department
- `VW_DASH_PATIENTS_BY_GENDER` - Patient distribution by gender
- `VW_DASH_MEDICINE_STOCK` - Medicine stock levels
- `VW_DASH_ROOM_STATUS` - Room availability status
- `VW_HMS_KPI_CARDS` - Key performance indicators

---

## Setup Instructions

### Prerequisites
- Oracle Database 19c or later
- Oracle APEX 22.x or later
- SQL*Plus or SQL Developer

### Database Setup
```sql
-- 1. Create schema objects
@database/01_schema/Hospital_Management_System_Schema.sql

-- 2. Load sample data
@database/02_sample_data/Hospital_Management_System_Sample_Data.sql

-- 3. Create views and triggers
@database/03_views_triggers/Hospital_Management_System_Views_Triggers.sql
```

### APEX Application Import
1. Navigate to Oracle APEX Workshop
2. Import `apex/f153222.sql`
3. Run the application

---

## Deployment
See [DEPLOYMENT.md](docs/DEPLOYMENT.md) for detailed deployment instructions.

---

## License
Academic project - AlNoor Hospital Management System
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- ============================================================
-- Hospital Management System - Oracle APEX Application Export
-- Application ID: 153222
-- Workspace: WKSP_ALNOORHOSPITALOMAN
-- Author: Abdullah Alhadabi
-- ============================================================

-- TODO: Paste the full APEX application export (f153222.sql) here
-- This is the complete application definition including:
-- - Pages 0-36 + 9999, 38 pages total
-- - 106 items
-- - 43 processes
-- - 76 regions
-- - 66 buttons
-- - 16 dynamic actions
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-- ============================================================
-- Hospital Management System - Schema DDL
-- Author: Abdullah Alhadabi
-- APEX App ID: 153222
-- ============================================================

-- TODO: Paste the schema SQL content here
-- This file should contain:
-- - CREATE TABLE statements for all 13 tables
-- - Sequences
-- - Constraints (PK, FK, CHECK, UNIQUE)
-- - Comments

-- Tables to include:
-- 1. DEPARTMENTS
-- 2. DOCTOR_SPECIALTIES
-- 3. MEDICINE_CATEGORIES
-- 4. APPOINTMENT_STATUSES
-- 5. PATIENTS
-- 6. DOCTORS
-- 7. ROOMS
-- 8. MEDICINES
-- 9. APPOINTMENTS
-- 10. ADMISSIONS
-- 11. PATIENT_VISITS
-- 12. PRESCRIPTIONS
-- 13. PRESCRIPTION_ITEMS
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- ============================================================
-- Hospital Management System - Sample Data
-- Author: Abdullah Alhadabi
-- APEX App ID: 153222
-- ============================================================

-- TODO: Paste the sample data SQL content here
-- This file should contain INSERT statements for:
-- - DEPARTMENTS
-- - DOCTOR_SPECIALTIES
-- - MEDICINE_CATEGORIES
-- - APPOINTMENT_STATUSES
-- - PATIENTS
-- - DOCTORS
-- - ROOMS
-- - MEDICINES
-- - APPOINTMENTS
-- - ADMISSIONS
-- - PATIENT_VISITS
-- - PRESCRIPTIONS
-- - PRESCRIPTION_ITEMS
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
-- ============================================================
-- Hospital Management System - Views and Triggers
-- Author: Abdullah Alhadabi
-- APEX App ID: 153222
-- ============================================================

-- TODO: Paste the views and triggers SQL content here

-- Views to include:
-- 1. HMS_ADMISSION_REPORT_V
-- 2. HMS_APPOINTMENT_REPORT_V
-- 3. HMS_CLINICAL_WORKSPACE_V
-- 4. HMS_MEDICINE_STOCK_REPORT_V
-- 5. HMS_PATIENT_ADMISSION_HISTORY_V
-- 6. HMS_PATIENT_APPOINTMENT_HISTORY_V
-- 7. HMS_PATIENT_PREVIOUS_VISITS_V
-- 8. HMS_PATIENT_PROFILE_V
-- 9. HMS_PATIENT_VISIT_REPORT_V
-- 10. HMS_PHARMACY_PRESCRIPTION_V
-- 11. HMS_VISIT_PRESCRIPTION_V
-- 12. VW_DASH_APPTS_BY_DEPT
-- 13. VW_DASH_PATIENTS_BY_GENDER
-- 14. VW_DASH_MEDICINE_STOCK
-- 15. VW_DASH_ROOM_STATUS
-- 16. VW_HMS_KPI_CARDS

-- Triggers to include:
-- 1. HMS_ADMISSIONS_AIU_ROOM_TRG
-- 2. HMS_ADMISSIONS_BIU_VAL_TRG
-- 3. HMS_APPOINTMENTS_BIU_TRG
-- 4. HMS_PATIENT_VISITS_BIU_TRG
-- 5. HMS_PRESCRIPTIONS_BIU_TRG
-- 6. TRG_ADMISSIONS_ROOM_STATUS
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
-- ============================================================
-- Hospital Management System - Report Queries
-- Author: Abdullah Alhadabi
-- APEX App ID: 153222
-- ============================================================

-- TODO: Add report-specific queries here
-- These queries are used by APEX report regions

-- Example report queries:

-- Admission Report
-- SELECT * FROM HMS_ADMISSION_REPORT_V;

-- Appointment Report
-- SELECT * FROM HMS_APPOINTMENT_REPORT_V;

-- Patient Visit Report
-- SELECT * FROM HMS_PATIENT_VISIT_REPORT_V;

-- Medicine Stock Report
-- SELECT * FROM HMS_MEDICINE_STOCK_REPORT_V;

-- Pharmacy Prescription Report
-- SELECT * FROM HMS_PHARMACY_PRESCRIPTION_V;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- ============================================================
-- Hospital Management System - Audit and Security
-- Author: Abdullah Alhadabi
-- APEX App ID: 153222
-- ============================================================

-- TODO: Add audit-related SQL here

-- Audit trail tables
-- Audit triggers
-- Security policies
-- Row-Level Security (RLS) policies if applicable
147 changes: 147 additions & 0 deletions src/main/java/org/example/fromabdullahalhadabi/docs/DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Hospital Management System - Deployment Guide

## Overview
This guide covers deploying the Oracle APEX Hospital Management System.

## Prerequisites

### Software Requirements
- Oracle Database 19c or later
- Oracle APEX 22.x or later
- SQL*Plus or SQL Developer
- Oracle REST Data Services (ORDS) for web access

### Hardware Requirements
- Minimum 4GB RAM for database
- 2 CPU cores recommended
- 20GB disk space

---

## Step 1: Database Setup

### 1.1 Create Tablespace (Optional)
```sql
CREATE TABLESPACE hms_data
DATAFILE 'hms_data01.dbf' SIZE 100M
AUTOEXTEND ON NEXT 10M
MAXSIZE UNLIMITED;
```

### 1.2 Create User
```sql
CREATE USER hms_admin IDENTIFIED BY <secure_password>
DEFAULT TABLESPACE hms_data
QUOTA UNLIMITED ON hms_data;

GRANT CONNECT, RESOURCE TO hms_admin;
GRANT CREATE VIEW, CREATE TRIGGER, CREATE PROCEDURE TO hms_admin;
```

### 1.3 Run Schema Scripts
```sql
-- Connect as hms_admin or SYSDBA
@database/01_schema/Hospital_Management_System_Schema.sql
@database/02_sample_data/Hospital_Management_System_Sample_Data.sql
@database/03_views_triggers/Hospital_Management_System_Views_Triggers.sql
```

---

## Step 2: APEX Application Setup

### 2.1 Import Application
1. Log in to Oracle APEX Workshop
2. Navigate to **App Builder** > **Import**
3. Select `apex/f153222.sql`
4. Follow the import wizard
5. Set the application alias as needed

### 2.2 Configure Application
1. Open the imported application
2. Navigate to **Shared Components** > **Application Processing**
3. Verify all processes are enabled
4. Test each page functionality

### 2.3 Set Up Authentication
1. Navigate to **Shared Components** > **Authentication Schemes**
2. Configure the default authentication scheme
3. Set up user accounts if needed

---

## Step 3: Post-Deployment Verification

### 3.1 Verify Database Objects
```sql
-- Check tables
SELECT table_name FROM user_tables ORDER BY table_name;

-- Check views
SELECT view_name FROM user_views ORDER BY view_name;

-- Check triggers
SELECT trigger_name FROM user_triggers ORDER BY trigger_name;
```

### 3.2 Verify Sample Data
```sql
-- Check record counts
SELECT 'PATIENTS' as tbl, COUNT(*) as cnt FROM patients
UNION ALL
SELECT 'DOCTORS', COUNT(*) FROM doctors
UNION ALL
SELECT 'APPOINTMENTS', COUNT(*) FROM appointments
UNION ALL
SELECT 'MEDICINES', COUNT(*) FROM medicines;
```

### 3.3 Test APEX Application
1. Run the application from App Builder
2. Test login functionality
3. Navigate through all pages
4. Verify dashboard displays correctly
5. Test CRUD operations on all forms

---

## Step 4: Security Checklist

- [ ] No hardcoded passwords in SQL files
- [ ] APEX application uses authentication scheme
- [ ] Database user has minimum required privileges
- [ ] Sensitive data is not exposed in URLs
- [ ] Session timeout is configured appropriately

---

## Troubleshooting

### Common Issues

**Issue: ORA-00942: table or view does not exist**
- Solution: Ensure schema scripts were run in correct order

**Issue: APEX application shows blank pages**
- Solution: Verify database views exist and have correct permissions

**Issue: Triggers not firing**
- Solution: Check trigger status with `SELECT status FROM user_triggers`

---

## Rollback Procedure

If issues occur after deployment:
1. Drop application in APEX App Builder
2. Drop schema objects in reverse order:
```sql
DROP TRIGGER <trigger_name>;
DROP VIEW <view_name>;
DROP TABLE <table_name> CASCADE CONSTRAINTS;
```
3. Restore from backup if available

---

*Deployment Guide - AlNoor Hospital Management System*
Loading
Loading