# Dental Clinic Management Software Installation

## Requirements

- PHP 8.3 with PDO MySQL enabled
- MySQL 8
- Apache, Nginx, or PHP built-in server
- Browser internet access for Bootstrap, jQuery, DataTables, Bootstrap Icons, and Chart.js CDN assets

## Setup

1. Copy this project to your web root, for example `htdocs/dental-clinic`.
2. Create the database and sample data:

```bash
mysql -u root -p < sql/dental_clinic.sql
```

For an existing installation of the previous NABH digital ZIP, back up the database first, upload the new files, then run:

```bash
mysql -u root -p < sql/upgrade_nabh_digital_v2.sql
```

3. Edit database credentials in `config/database.php`.
4. Make uploads writable by the web server:

```bash
chmod -R 755 uploads
```

5. Open the app in your browser:

```text
http://localhost/dental-clinic
```

## Default Login

- Email: `admin@dentacare.test`
- Password: `admin123`
- Default prescription PIN for sample doctors: `admin123`

## Digital Clinic Setup

1. Go to Staff and update each dentist profile with qualification, dental council registration number, and signature image.
2. Go to Settings and update clinic/company name, logo, website, email, phone, address, license, registration, GST, and public software URL.
3. The public software URL is used for prescription QR verification links.
4. Use the E-Prescription Pad to create draft prescriptions.
5. Select `Sign & Lock` and enter the dentist's prescription PIN to create a digitally signed prescription.
6. Print the prescription or share the verification QR/link shown on the print page.
7. Maintain the Medicine Master so medicine suggestions appear while typing prescriptions.
8. If a new medicine is typed in a prescription, the system automatically adds it to the Medicine Master after saving.

## Consent And Billing

- Treatment consent can be printed for physical signature.
- Videographical consent is optional. Use the recording buttons in the NABH Ready consent form, or upload a video file manually.
- Consent videos are stored in `uploads/consents`.
- The browser recorder keeps videos short and compressed. If your server rejects larger videos, increase PHP `post_max_size` and `upload_max_filesize`, or save the consent without video.
- Invoices support multiple payment rows, such as cash + UPI, card + insurance, cheque, bank transfer, or wallet.

## NABH-Ready Workflow

The NABH Ready module helps maintain digital evidence for:

- Patient registration and continuity of care
- Clinical assessment, treatment planning, and consent
- Medication and prescription safety
- Infection-control and sterilization logs
- Biomedical waste records
- Incident reporting and corrective action
- Equipment maintenance
- Staff credentialing and training
- Information management, audit logs, and backups

Software supports NABH readiness, but accreditation requires clinic-specific SOPs, staff training, implementation evidence, internal audits, and assessment by authorized NABH assessors.

## Production Notes

- Change all default passwords immediately.
- Change all default prescription PINs immediately.
- Configure HTTPS and secure cookies.
- Set the public software URL from Settings after deployment.
- Restrict web access to backup SQL files or store backups outside the public web root.
- Configure SMS and WhatsApp gateway URLs in Settings before enabling messaging workflows.
- Schedule external database backups in addition to the in-app backup tool.
