# Beautez Telehealth System - Complete Overview

## System Architecture

This is a comprehensive telehealth system built with Laravel 11 for Beautez Pharmacy in Lesotho. The system supports multiple roles, video consultations, prescription management, and branch operations.

## Key Features

### 1. Multi-Role System
- **Admin**: Manage doctors, branches, verify accounts
- **Doctor**: Create prescriptions, view appointments, manage profile
- **Pharmacist**: Create appointments, manage patients, coordinate consultations
- **Patient**: (Implicit through appointments)

### 2. Doctor Management
- Doctor registration with profile information
- Upload letterhead, stamp, and signature
- Admin verification and activation
- Practice number tracking
- Educational details and qualifications

### 3. Appointment System
- Immediate consultations (video call)
- Scheduled appointments
- Multiple consultation types:
  - Diagnostic Consultation
  - Remote Consultation
  - Primary care Consultation
  - Mental health support
  - Psychoanalytic or Psychodynamic Therapy

### 4. Patient Management
- Complete patient records
- Medical history tracking
- Vitals recording (BP, Pulse, Temperature, SpO2, RBS)
- Payment mode (Cash/Medical Aid)
- Document attachments

### 5. Prescription System
- Generate prescriptions with multiple items
- PDF export with letterhead, stamp, and signature
- Prescription numbering
- Diagnosis and additional notes
- Medicine dosage, frequency, and duration

### 6. Video Consultations
- Jitsi Meet integration
- Room-based video calls
- Immediate consultation support

### 7. Branch Management
- Multiple branch support
- Branch-specific operations
- Pharmacist-branch assignment

## Database Structure

### Core Tables
- `users` - Authentication and basic user info
- `branches` - Pharmacy branches
- `doctors` - Doctor profiles and credentials
- `pharmacists` - Pharmacist profiles
- `patients` - Patient information
- `appointments` - Consultation appointments
- `medical_histories` - Patient medical history
- `vitals` - Patient vital signs
- `prescriptions` - Prescription records
- `prescription_items` - Individual prescription medicines
- `patient_documents` - Attached documents
- `payments` - Payment records
- `notifications` - System notifications

## File Structure

```
app/
├── Http/
│   ├── Controllers/
│   │   ├── AdminController.php
│   │   ├── AuthController.php
│   │   ├── DoctorController.php
│   │   ├── DoctorRegistrationController.php
│   │   ├── PharmacistController.php
│   │   └── PrescriptionController.php
│   └── Middleware/
├── Models/
│   ├── Appointment.php
│   ├── Branch.php
│   ├── Doctor.php
│   ├── MedicalHistory.php
│   ├── Patient.php
│   ├── PatientDocument.php
│   ├── Payment.php
│   ├── Pharmacist.php
│   ├── Prescription.php
│   ├── PrescriptionItem.php
│   ├── User.php
│   └── Vitals.php
└── Services/
    └── PrescriptionPdfService.php

database/
├── migrations/
└── seeders/
    └── DatabaseSeeder.php

resources/
└── views/
    ├── admin/
    ├── auth/
    ├── doctor/
    ├── pharmacist/
    ├── prescriptions/
    └── layouts/

routes/
└── web.php
```

## Security Features

- Role-based access control
- CSRF protection
- Password hashing
- File upload validation
- SQL injection prevention (Eloquent ORM)
- XSS protection (Blade templating)

## Installation

See `INSTALLATION.md` for detailed installation instructions.

## Default Credentials

After seeding:
- **Admin**: admin@beautez.com / password
- **Doctor**: doctor@beautez.com / password
- **Pharmacist**: pharmacist@beautez.com / password

## Workflow

### Appointment Creation Flow
1. Pharmacist logs in
2. Creates new appointment with patient details
3. Selects consultation type (immediate or scheduled)
4. If immediate: Video call room is created
5. Doctor receives appointment notification
6. Doctor conducts consultation
7. Doctor creates prescription
8. Prescription PDF is generated with letterhead, stamp, signature
9. Prescription is available for download

### Doctor Registration Flow
1. Doctor visits registration page
2. Fills profile information
3. Uploads letterhead, stamp, signature
4. Account created but inactive
5. Admin verifies and activates account
6. Doctor can now login and use the system

## Technology Stack

- **Backend**: Laravel 11
- **Database**: MySQL
- **PDF Generation**: DomPDF
- **Video Calls**: Jitsi Meet
- **Frontend**: Tailwind CSS, Blade Templates
- **Icons**: Font Awesome

## Future Enhancements

- Email notifications
- SMS notifications
- Payment gateway integration
- Advanced reporting
- Mobile app API
- Real-time chat
- Appointment reminders
- Prescription refill requests

## Support

For technical support or questions, refer to the installation guide or contact the development team.

