- Add SendSmsMessage class for encapsulating SMS message data. - Create KavehNegarProvider and RanginehProvider classes implementing SmsProviderInterface for sending SMS. - Implement SmsLogRepository and SmsTemplateRepository for managing SMS logs and templates. - Develop SendSmsHandler for handling SMS sending messages. - Create SmsService to manage SMS dispatching and logging. - Add UserProfileController for managing user profiles with CRUD operations. - Implement UserProfile entity and repository for user profile data management. - Update symfony.lock and bootstrap.php for project dependencies and environment setup.
110 lines
4.5 KiB
Markdown
110 lines
4.5 KiB
Markdown
# پایگاه داده — تسک ۰۳: ماژول پروفایل کاربر
|
|
|
|
## جدول: profiles
|
|
_(entity_type=profile — از DB backup و config تأیید شده)_
|
|
|
|
| ستون | نوع | نام Drupal | توضیح |
|
|
|------|-----|-----------|-------|
|
|
| id | INT UNSIGNED AUTO_INCREMENT PK | id | |
|
|
| uuid | CHAR(36) UNIQUE NOT NULL | uuid | |
|
|
| user_id | INT FK → users.id UNIQUE NOT NULL | uid | کاربر مرتبط |
|
|
| label | VARCHAR(255) NULL | label | نام نمایشی پروفایل |
|
|
| family | VARCHAR(25) NULL | field_family | نام خانوادگی (max 25) |
|
|
| fathers_name | VARCHAR(255) NULL | field_fathers_name | نام پدر |
|
|
| national_code | VARCHAR(10) NULL | field_national_code | کد ملی (max 10) |
|
|
| national_code_approved | TINYINT(1) DEFAULT 0 | field_national_code_approved | کد ملی تأیید شده |
|
|
| gender | VARCHAR(10) NULL | field_gender | `male` یا `female` |
|
|
| date_of_birth | INT NULL | field_date_of_birth | تاریخ تولد (Unix timestamp) |
|
|
| blood_type | VARCHAR(20) NULL | field_blood_type | گروه خونی |
|
|
| marital_status | VARCHAR(30) NULL | field_marital_status | وضعیت تأهل |
|
|
| education | VARCHAR(100) NULL | field_education | تحصیلات |
|
|
| job | VARCHAR(100) NULL | field_job | شغل |
|
|
| address | LONGTEXT NULL | field_address | آدرس |
|
|
| home_phone | VARCHAR(30) NULL | field_home_phone | تلفن منزل |
|
|
| work_phone | VARCHAR(30) NULL | field_work_phone | تلفن کار |
|
|
| insurance_id | VARCHAR(50) NULL | field_insurance_id | شماره بیمه |
|
|
| basic_insurance_id | INT FK → categories.id NULL | field_basic_insurance | entity ref → category (بیمه پایه) |
|
|
| supplementary_insurance_id | INT FK → categories.id NULL | field_supplementary_insurance | entity ref → category (بیمه تکمیلی) |
|
|
| other | LONGTEXT NULL | field_other | سایر اطلاعات |
|
|
| sharing_with_user | TINYINT(1) DEFAULT 0 | field_sharing_with_user | اشتراک با کاربر دیگر |
|
|
| description | LONGTEXT NULL | description | توضیحات (base field) |
|
|
| created_at | INT NOT NULL | created | Unix timestamp |
|
|
| updated_at | INT NOT NULL | changed | Unix timestamp |
|
|
|
|
## مقادیر field_gender (profile — از config)
|
|
```
|
|
male → آقا
|
|
female → خانم
|
|
```
|
|
|
|
## مقادیر field_blood_type (از config)
|
|
```
|
|
a_positive → A+ a_negative → A-
|
|
b_positive → B+ b_negative → B-
|
|
o_positive → O+ o_negative → O-
|
|
ab_positive → AB+ ab_negative → AB-
|
|
```
|
|
|
|
## مقادیر field_education (از Manual)
|
|
```
|
|
diploma → دیپلم
|
|
postgraduate_diploma → فوق دیپلم
|
|
bachelor_s_degree → لیسانس
|
|
master_s_degree → فوق لیسانس
|
|
doctorate → دکترا
|
|
```
|
|
|
|
## ساختار field_other (JSON — از Manual و نمونه Request واقعی)
|
|
|
|
```json
|
|
{
|
|
"disease": [
|
|
{ "id": 1, "name": "فشار خون", "status": "false" },
|
|
{ "id": 2, "name": "دیابت", "status": "false" }
|
|
],
|
|
"allergies": [
|
|
{ "substance": "پنیسیلین", "reaction": "کهیر", "severity": "شدید" }
|
|
],
|
|
"medications": [
|
|
{ "name": "لورازپام", "dose": "1mg", "frequency": "شبها قبل خواب" }
|
|
],
|
|
"surgeries": [
|
|
{ "type": "آپاندکتومی", "year": 2015, "hospital": "بیمارستان امام خمینی" }
|
|
],
|
|
"family_history": [
|
|
{ "relation": "پدر", "disease": "فشار خون" }
|
|
],
|
|
"relatives": [
|
|
{
|
|
"name": "علی",
|
|
"relation": "پسر عمو",
|
|
"contact": { "phone": "+989121234567", "email": "...", "address": "..." }
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
## ایندکسها
|
|
```sql
|
|
CREATE UNIQUE INDEX idx_profiles_user ON profiles(user_id);
|
|
CREATE INDEX idx_profiles_national_code ON profiles(national_code);
|
|
```
|
|
|
|
## رابطه
|
|
- `profiles.user_id` → `users.id` (OneToOne, CASCADE DELETE)
|
|
- `profiles.basic_insurance_id` → `categories.id`
|
|
- `profiles.supplementary_insurance_id` → `categories.id`
|
|
|
|
## نمونه داده واقعی از DB backup
|
|
```
|
|
id=1, uid=10, label='hamed', status=1
|
|
id=3, uid=32, label='hamed', status=1
|
|
```
|
|
|
|
## نکات مهم
|
|
- `field_family` VARCHAR(25) است — نام خانوادگی کوتاه ذخیره میشود
|
|
- `field_national_code` VARCHAR(10) است — کد ملی ۱۰ رقمی
|
|
- `date_of_birth` از نوع timestamp (INT) است، نه DATE
|
|
- `basic_insurance` و `supplementary_insurance` entity reference به جدول categories هستند
|
|
- `field_sharing_with_user` احتمالاً برای اشتراک پروفایل با دکتر/منشی است
|