Full-stack Flask application for managing patient registrations, appointment scheduling, consultations, lab tests, billing, and payments in a clinic setting.
- Patient registration with demographic details stored in MySQL.
- Doctor directory with specialization and fees.
- Appointment booking that links patients and doctors.
- Consultation records with diagnoses and prescriptions.
- Lab tests and lab reports tied to consultations.
- Automated bill generation including doctor fees and lab costs.
- Payment tracking with mode, status, and date.
- Patient-centric reports covering appointments, lab results, and payments.
clinic_app/
├── app.py
├── templates/
│ ├── base.html
│ ├── index.html
│ ├── register.html
│ ├── appointment.html
│ ├── consultation.html
│ ├── lab_test.html
│ ├── bill.html
│ ├── payment.html
│ └── report.html
├── static/
│ └── css/
│ └── styles.css
└── database/
├── db_connection.py
└── schema.sql
env.example
requirements.txt
- Python 3.10+
- MySQL 8+
-
Create environment file
copy env.example .env
Edit
.envto include your MySQL credentials and target database name (clinic_db). -
Create and activate a Python virtual environment (recommended)
python -m venv .venv .venv\Scripts\activate -
Install dependencies
pip install -r requirements.txt -
Create the database schema and sample data
mysql -u <user> -p < schema_sql_path
Replace
<user>with your MySQL username andschema_sql_pathwithclinic_app\database\schema.sql. You will be prompted for the password specified in your.envfile. -
Run the Flask application
python clinic_app\app.py
The default development server runs at
http://127.0.0.1:5000/.
- Navigation links at the top of the UI cover every core module.
- Flash messages confirm database actions or highlight validation issues.
- Bills are calculated as
doctor fees + sum(lab test costs)per consultation. - Reports can be filtered per patient to review their full history.
clinic_app/database/db_connection.py reads the following variables (set in .env):
MYSQL_HOSTMYSQL_PORTMYSQL_USERMYSQL_PASSWORDMYSQL_DATABASEFLASK_SECRET_KEY(optional; defaults tochange-this-secret)
- Adjust Bootstrap styling or add JavaScript interactions as needed.
- Add authentication/authorization for staff roles if required.
- Replace sample data with production entries or seed scripts.