Introduction
OptiFlow provides comprehensive prescription management for optical stores. Create detailed eye prescriptions, link them to patients and workflow jobs, and automatically generate professional PDF documents.Prescription Data Model
ThePrescription model (app/Models/Prescription.php) stores complete optometric examination data.
Core Fields
- Patient: Link to the customer contact receiving the prescription
- Optometrist: Link to the optometrist who performed the examination
- Workspace: Multi-tenant workspace association
- Created Date: Automatic timestamp with human-readable formatting
Clinical Data
Prescriptions store comprehensive optometric data through relationships with mastertable items:Motivos de Consulta (Consultation Reasons)
Motivos de Consulta (Consultation Reasons)
Why the patient visited (e.g., blurry vision, eye strain, routine checkup)
Estado de Salud Actual (Current Health Status)
Estado de Salud Actual (Current Health Status)
Patient’s current health conditions that may affect eye health
Historia Ocular Familiar (Family Eye History)
Historia Ocular Familiar (Family Eye History)
Family history of eye conditions (glaucoma, cataracts, etc.)
Lentes Recomendados (Recommended Lenses)
Lentes Recomendados (Recommended Lenses)
Types of lenses prescribed (single vision, bifocal, progressive, etc.)
Gotas Recomendadas (Recommended Eye Drops)
Gotas Recomendadas (Recommended Eye Drops)
Prescribed eye drops for treatments
Monturas Recomendadas (Recommended Frames)
Monturas Recomendadas (Recommended Frames)
Frame types recommended for the patient
Visual Acuity Measurements
Prescriptions include detailed measurements for both eyes: Right Eye (OD - Oculus Dexter):- Sphere (SPH)
- Cylinder (CYL)
- Axis
- Visual Acuity
- Pupillary Distance
- Sphere (SPH)
- Cylinder (CYL)
- Axis
- Visual Acuity
- Pupillary Distance
All measurements follow standard optometric notation for consistency across the industry.
Creating Prescriptions
From the Interface
ThePrescriptionController handles prescription creation:
Select Patient
Search for and select the patient (customer contact). You can pre-fill this with
?contact_id=123 query parameter.Select Optometrist
Choose the optometrist who performed the examination. You can pre-fill this with
?optometrist_id=456.Enter Clinical Data
Fill in consultation reasons, health status, family history, and recommendations using the mastertable selections.
Pre-filling Forms
You can link directly to the prescription creation form with pre-selected values:Managing Prescriptions
Listing Prescriptions
The prescriptions index uses thePrescriptionsTable for displaying data:
- Patient name
- Optometrist name
- Creation date (with human-readable format)
- Workspace
- Actions (view, edit, download)
Viewing Prescription Details
The show view displays the complete prescription:- Patient and optometrist information
- All clinical data and recommendations
- Visual acuity measurements for both eyes
- Company details (from
CompanyDetail::getAll()) - Creation timestamp with human-readable format
Editing Prescriptions
The edit form pre-populates all existing data:Linking Prescriptions to Workflow Jobs
Prescriptions can be linked to workflow jobs via theprescription_id field on WorkflowJob:
Workflow Integration
Workflows can require prescriptions:- Required: Prescription eyewear orders must have a prescription
- Optional: Contact lens orders may or may not need a new prescription
When a workflow requires a prescription, the job creation form will enforce this requirement before allowing the job to be saved.
PDF Generation
OptiFlow automatically generates professional PDF prescriptions using theDownloadPrescriptionController.
How It Works
PDF Contents
The generated PDF includes:- Company logo and details
- Patient information (name, contact details)
- Optometrist information
- Examination date
- Visual acuity measurements (right and left eye)
- Clinical data (consultation reasons, health status, family history)
- Recommendations (lenses, frames, eye drops)
- Professional formatting and layout
Downloading PDFs
Users can download prescription PDFs from:- The prescription detail page
- The prescriptions table (action menu)
- Direct link:
/prescriptions/{id}/download
PDFs are generated on-demand using DomPDF. The
DOMPDF_ENABLE_REMOTE constant is set to false for security.Prescription Reports
OptiFlow includes built-in prescription reports:Prescriptions Summary Report
- Total prescriptions created
- Prescriptions by optometrist
- Prescriptions by time period
- Most common recommendations
Prescriptions by Doctor Report
- Which optometrists are most active
- Average prescriptions per doctor
- Trends over time
Mastertable Integration
Prescriptions use mastertables for standardized clinical data.Available Mastertables
motivos_consulta- Consultation reasonsestado_salud_actual- Current health statushistoria_ocular_familiar- Family eye historytipos_de_lentes- Lens typestipos_de_montura- Frame typestipos_de_gotas- Eye drop types
Many-to-Many Relationships
Prescriptions use pivot tables to link multiple items:Mastertables are customizable. Optical stores can add their own consultation reasons, lens types, and recommendations specific to their practice.
Permissions
Prescription access is controlled by permissions:PrescriptionsView- View prescriptionsPrescriptionsCreate- Create new prescriptionsPrescriptionsEdit- Modify existing prescriptions
Best Practices
Verify Patient Information
Verify Patient Information
Always double-check patient details before creating a prescription. Incorrect patient linking can cause serious issues.
Complete All Measurements
Complete All Measurements
Fill in all visual acuity fields. Incomplete prescriptions may not be usable by labs or dispensing staff.
Link to Workflow Jobs
Link to Workflow Jobs
When creating prescription eyewear orders, link the prescription to the workflow job for complete tracking.
Generate PDFs Immediately
Generate PDFs Immediately
After creating a prescription, generate and review the PDF to ensure all data appears correctly.
Use Mastertables Consistently
Use Mastertables Consistently
Standardize your mastertable items across all optometrists for consistent reporting and data analysis.
Regular Backups
Regular Backups
Prescription data is critical. Ensure your workspace includes prescriptions in regular database backups.
Integration with Automations
Prescriptions can trigger automations when linked to workflow jobs: Example Automation: When a job with a prescription enters the “Ready for Pickup” stage, automatically send the prescription PDF to the customer via WhatsApp.Common Use Cases
Eye Exam to Order
Create prescription during eye exam, then immediately create a workflow job for eyewear order.
Prescription History
View patient’s complete prescription history to track vision changes over time.
Insurance Claims
Generate prescription PDFs for insurance claim submissions.
Lab Orders
Include prescription details when sending orders to external lens labs.
Prescription Lifecycle
Related Resources
Workflows Overview
Learn how prescriptions integrate with workflows
Building Automations
Automate prescription delivery and notifications