Files
clinicpro/docs/tasks/task-10-appointment/architecture.md
T
hamed de1a78a235 feat: Implement SMS sending functionality with KavehNegar and Rangineh providers
- 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.
2026-06-09 22:00:34 +03:30

1.9 KiB

معماری — تسک ۱۰: ماژول نوبت‌دهی

ساختار فایل‌ها

src/Module/Appointment/
├── Controller/
│   └── AppointmentController.php
├── Service/
│   ├── AppointmentService.php
│   └── SlotCalculatorService.php   ← محاسبه اسلات‌های خالی
├── Repository/
│   └── AppointmentRepository.php
├── Entity/
│   └── Appointment.php
├── DTO/
│   ├── Request/
│   │   └── CreateAppointmentRequest.php
│   └── Response/
│       ├── AppointmentResponse.php
│       └── SlotResponse.php
└── Voter/
    └── AppointmentVoter.php

Entity: Appointment

#[ORM\Entity]
#[ORM\Table(name: 'appointments')]
class Appointment
{
    #[ORM\Id, ORM\GeneratedValue, ORM\Column]
    private int $id;

    #[ORM\Column(type: UuidType::NAME, unique: true)]
    private Uuid $uuid;

    #[ORM\ManyToOne(targetEntity: User::class)]
    private User $patient;

    #[ORM\ManyToOne(targetEntity: Doctor::class)]
    private Doctor $doctor;

    #[ORM\Column(type: 'date')]
    private \DateTimeInterface $appointmentDate;

    #[ORM\Column(length: 10)]
    private string $appointmentTime;  // HH:MM

    // pending, confirmed, cancelled, completed
    #[ORM\Column(length: 20, default: 'pending')]
    private string $status;

    #[ORM\Column(length: 30, nullable: true)]
    private ?string $insuranceType;

    #[ORM\Column(type: 'text', nullable: true)]
    private ?string $notes;

    #[ORM\OneToOne(targetEntity: Payment::class, mappedBy: 'appointment')]
    private ?Payment $payment;

    // TimestampableTrait
}

SlotCalculatorService

این سرویس با استفاده از WeeklySchedule، DateOverride و Holiday اسلات‌های خالی را برای یک دکتر در یک تاریخ مشخص محاسبه می‌کند:

calculateAvailableSlots(Doctor $doctor, \DateTimeInterface $date): array