A comprehensive virtual consultation system connecting patients and doctors. Built with PHP, MySQL, JavaScript, HTML, and CSS with a modern, responsive design.
- ✅ User registration and secure login
- ✅ Schedule appointments with available doctors
- ✅ Upload and manage medical history files (PDF, JPG, PNG)
- ✅ View appointment status and history
- ✅ Access and download prescriptions
- ✅ Responsive dashboard with appointment overview
- ✅ Secure doctor login and dashboard
- ✅ View and manage assigned appointments
- ✅ Accept, reject, or mark appointments as completed
- ✅ Access patient medical history and files
- ✅ Create and manage prescriptions
- ✅ Download patient files and prescription reports
- ✅ Real-time appointment statistics
- ✅ Role-based access control (Patient/Doctor)
- ✅ Session-based authentication
- ✅ File upload and download management
- ✅ PDF prescription generation
- ✅ Responsive design for all devices
- ✅ Secure file handling and validation
telemedicine-app/
├── backend/
│ ├── appointments/
│ │ ├── book.php # Patient appointment booking
│ │ ├── list.php # List appointments by role
│ │ ├── respond.php # Doctor appointment responses
│ │ └── view.php # View appointment details
│ ├── auth/
│ │ ├── login.php # User authentication
│ │ ├── logout.php # Session termination
│ │ └── register.php # User registration
│ ├── config/
│ │ └── db.php # Database configuration
│ ├── history/
│ │ ├── fetch.php # Fetch medical history
│ │ ├── upload.php # Upload medical files
│ │ └── view.php # View/download medical files
│ ├── middleware/
│ │ └── auth.php # Authentication middleware
│ ├── prescriptions/
│ │ ├── create.php # Create prescriptions
│ │ ├── index.php # List prescriptions
│ │ └── view.php # View/download prescriptions
│ ├── users/
│ │ ├── doctors.php # List available doctors
│ │ └── profile.php # User profile management
│ └── utils/
│ └── get_dashboard_data.php # Dashboard statistics
├── frontend/
│ ├── assets/
│ │ ├── css/
│ │ │ └── style.css # Main stylesheet
│ │ └── js/
│ │ ├── appointments.js # Appointment functionality
│ │ ├── auth.js # Authentication scripts
│ │ ├── history.js # Medical history scripts
│ │ ├── prescriptions.js # Prescription scripts
│ │ ├── script.js # Main JavaScript
│ │ ├── session.js # Session management
│ │ └── utils.js # Utility functions
│ ├── components/
│ │ └── navbar.html # Reusable navigation component
│ ├── doctor/
│ │ ├── dashboard.html # Doctor dashboard
│ │ ├── prescriptions.html # Prescription management
│ │ ├── respond-appointment.html # Appointment management
│ │ └── view-history.html # Patient history viewer
│ └── patient/
│ ├── dashboard.html # Patient dashboard
│ ├── medical-history.html # Medical history management
│ ├── prescriptions.html # View prescriptions
│ └── schedule-appointment.html # Book appointments
├── lib/
│ └── fpdf/ # PDF generation library
│ ├── font/ # Font files for PDF
│ └── fpdf.php # Main FPDF class
├── uploads/
│ └── history/ # Medical file storage
├── index.html # Landing page
├── login.html # Login page
├── register.html # Registration page
└── README.md # Project documentation
- Backend: PHP 8.0+
- Database: MySQL
- Frontend: HTML5, CSS3, JavaScript (ES6+)
- PDF Generation: FPDF Library
- Server: Apache (XAMPP/WAMP/LAMP)
- Authentication: PHP Sessions
- File Upload: PHP File Handling
- PHP >= 8.0
- MySQL >= 5.7
- Apache Web Server
- Modern web browser (Chrome, Firefox, Safari, Edge)
- Minimum 100MB disk space
git clone https://github.com/dan-kingo/telemedicine-app.git
cd telemedicine-app
Create a MySQL database and import the schema:
CREATE DATABASE telemedicine;
USE telemedicine;
-- Users table
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
full_name VARCHAR(100) NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
role ENUM('patient', 'doctor') NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Appointments table
CREATE TABLE appointments (
id INT AUTO_INCREMENT PRIMARY KEY,
patient_id INT NOT NULL,
doctor_id INT NOT NULL,
appointment_date DATE NOT NULL,
appointment_time TIME NOT NULL,
reason TEXT,
status ENUM('pending', 'confirmed', 'cancelled', 'completed') DEFAULT 'pending',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (patient_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (doctor_id) REFERENCES users(id) ON DELETE CASCADE
);
-- Medical history table
CREATE TABLE medical_history (
id INT AUTO_INCREMENT PRIMARY KEY,
patient_id INT NOT NULL,
file_name VARCHAR(255) NOT NULL,
file_path VARCHAR(500) NOT NULL,
description TEXT,
uploaded_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (patient_id) REFERENCES users(id) ON DELETE CASCADE
);
-- Prescriptions table
CREATE TABLE prescriptions (
id INT AUTO_INCREMENT PRIMARY KEY,
appointment_id INT NOT NULL,
doctor_id INT NOT NULL,
patient_id INT NOT NULL,
prescription_text TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (appointment_id) REFERENCES appointments(id) ON DELETE CASCADE,
FOREIGN KEY (doctor_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (patient_id) REFERENCES users(id) ON DELETE CASCADE
);
Update backend/config/db.php
with your database credentials:
<?php
$host = 'localhost';
$dbname = 'telemedicine';
$username = 'root'; // Your MySQL username
$password = ''; // Your MySQL password
?>
Ensure the uploads directory is writable:
chmod -R 755 uploads/
mkdir -p uploads/history
chmod -R 755 uploads/history
Using XAMPP:
- Start Apache and MySQL services
- Place the project in
htdocs/telemedicine-app/
- Access via
http://localhost/telemedicine-app/
Using PHP built-in server:
php -S localhost:8000
- Registration: Create an account by selecting "Patient" role
- Login: Access your dashboard with email and password
- Book Appointment:
- Select a doctor from the dropdown
- Choose date and time
- Provide reason for visit
- Upload Medical History:
- Navigate to Medical History section
- Upload PDF, JPG, or PNG files
- Add descriptions for each file
- View Prescriptions: Access all prescriptions from doctors
- Login: Access doctor dashboard with credentials
- Manage Appointments:
- View all assigned appointments
- Accept, reject, or mark as completed
- View Patient History:
- Access patient medical files
- Download files for review
- Create Prescriptions:
- Write prescriptions for completed appointments
- Generate PDF reports
- Password Hashing: BCrypt encryption for user passwords
- Session Management: Secure PHP session handling
- Role-Based Access: Middleware protection for routes
- File Validation: Restricted file types and size limits
- SQL Injection Protection: Prepared statements
- XSS Prevention: Input sanitization and validation
The application is fully responsive and works on:
- Desktop computers (1200px+)
- Tablets (768px - 1199px)
- Mobile phones (320px - 767px)
POST /backend/auth/register.php
- User registrationPOST /backend/auth/login.php
- User loginPOST /backend/auth/logout.php
- User logout
POST /backend/appointments/book.php
- Book appointment (Patient)GET /backend/appointments/list.php
- List appointmentsPOST /backend/appointments/respond.php
- Respond to appointment (Doctor)
POST /backend/history/upload.php
- Upload medical file (Patient)GET /backend/history/fetch.php
- Fetch medical historyGET /backend/history/view.php
- View/download files
POST /backend/prescriptions/create.php
- Create prescription (Doctor)GET /backend/prescriptions/index.php
- List prescriptionsGET /backend/prescriptions/view.php
- View/download prescriptions
GET /backend/users/doctors.php
- List available doctorsGET /backend/users/profile.php
- Get user profile
-
Database Connection Error
- Check database credentials in
backend/config/db.php
- Ensure MySQL service is running
- Check database credentials in
-
File Upload Issues
- Verify
uploads/history/
directory permissions - Check PHP
upload_max_filesize
andpost_max_size
settings
- Verify
-
Session Issues
- Clear browser cookies and cache
- Check PHP session configuration
-
PDF Generation Issues
- Ensure FPDF library is properly included
- Check file permissions for PDF output
- Video consultation integration
- Real-time chat between patients and doctors
- Email notifications for appointments
- SMS reminders
- Payment gateway integration
- Multi-language support
- Advanced reporting and analytics
- Mobile app development
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-feature
) - Commit your changes (
git commit -am 'Add new feature'
) - Push to the branch (
git push origin feature/new-feature
) - Create a Pull Request
For support and questions:
- Create an issue on GitHub
- Email: support@telemedicine-app.com
- Documentation: Check the
/docs
folder for detailed guides
Note: This is a demonstration project. For production use, implement additional security measures, error handling, and testing protocols.