feat: add clinic management and financial reporting features

- Implemented ClinicFormPage for adding new clinics with validation.
- Created MyFinancialPage to display financial summaries and charts.
- Developed MyPatientsPage for managing patient data with search and pagination.
- Added PreRegistrationsPage for handling pre-registration requests with approval and rejection functionalities.
- Introduced database migration for pre_registrations table.
- Built PreRegistrationController for managing pre-registration logic, including submission, approval, and rejection.
- Created PreRegistration entity and repository for handling pre-registration data.
This commit is contained in:
hamed
2026-06-12 12:31:27 +03:30
parent 92cb834c22
commit 8ad983310c
14 changed files with 1772 additions and 469 deletions
+70
View File
@@ -801,3 +801,73 @@ Update one or more settings. Unknown keys are silently ignored.
- `commission_enabled``"1"` = active, `"0"` = inactive
- `commission_percent` — integer string, `0``100`
- Commission applies only to regular users (`booked_by = user`); secretaries are exempt
---
## Pre-Registration Management
### GET `/api/v1/admin/pre-registrations`
List pre-registration requests. **Permission:** `ROLE_ADMIN`
**Query params:**
| Param | Default | Notes |
|-------|---------|-------|
| `page` | 1 | |
| `limit` | 20 | max 50 |
| `status` | `pending` | `pending` \| `approved` \| `rejected` \| `all` |
**Response `200`** (paginated):
```json
{
"success": true,
"data": [
{
"uuid": "...",
"type": "independent_doctor",
"name": "دکتر احمدی",
"mobile": "09121234567",
"info": "متخصص داخلی",
"status": "pending",
"admin_note": null,
"created_at": 1718000000
}
],
"meta": { "totalRecords": 5, "totalPages": 1, "currentPage": 1 }
}
```
---
### POST `/api/v1/admin/pre-registrations/{uuid}/approve`
Approve a pending request. Creates User + Doctor/Clinic entity based on `type`, resets password, sends SMS. **Permission:** `ROLE_ADMIN`
**Response `200`:**
```json
{ "success": true, "data": { "message": "تأیید شد و اطلاعات ورود ارسال گردید" } }
```
**Error Codes:**
| Code | HTTP | Meaning |
|------|------|---------|
| `NOT_FOUND` | 404 | UUID not found |
| `ALREADY_PROCESSED` | 409 | Status is not pending |
---
### POST `/api/v1/admin/pre-registrations/{uuid}/reject`
Reject a pending request. **Permission:** `ROLE_ADMIN`
**Request body** (optional):
```json
{ "note": "مدارک ناقص است" }
```
**Response `200`:**
```json
{ "success": true, "data": { "message": "درخواست رد شد" } }
```
+47
View File
@@ -507,3 +507,50 @@ Invalidate the refresh token (stored in Redis).
}
}
```
---
## POST `/api/v1/pre-registration`
Submit a pre-registration request (doctor or clinic). Public endpoint — no auth required.
**Permission:** Public
### Request Body
```json
{
"type": "independent_doctor",
"name": "دکتر علی احمدی",
"mobile": "09121234567",
"info": "متخصص داخلی، ۱۰ سال سابقه"
}
```
| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `type` | string | ✅ | `independent_doctor` \| `doctor_with_clinic` \| `clinic_manager` |
| `name` | string | ✅ | min 2 chars |
| `mobile` | string | ✅ | 1015 chars |
| `info` | string | ❌ | specialty, address, etc. |
**Type meanings:**
| Value | Roles granted on approval | Entities created |
|-------|--------------------------|-----------------|
| `independent_doctor` | `ROLE_DOCTOR` | Doctor |
| `doctor_with_clinic` | `ROLE_DOCTOR` + `ROLE_CLINIC` | Doctor + Clinic |
| `clinic_manager` | `ROLE_CLINIC` | Clinic |
### Response `200`
```json
{
"success": true,
"data": { "uuid": "...", "status": "pending" }
}
```
### Error Codes
| Code | HTTP | Meaning |
|------|------|---------|
| `VALIDATION_ERROR` | 422 | Invalid type / mobile / name |
| `DUPLICATE_REQUEST` | 409 | Pending request already exists for this mobile |