feat: add insurance and location management
- Introduced InsuranceType enum for insurance categorization. - Created InsuranceRepository for managing insurance entities. - Developed LocationController for handling provinces and cities, including CRUD operations. - Implemented City and Province entities with necessary fields and relationships. - Added CityRepository and ProvinceRepository for database interactions. - Established Specialty management with SpecialtyController, including CRUD operations. - Created Specialty and Tag entities with appropriate fields and relationships. - Implemented TagController for managing tags, including CRUD operations. - Added TagRepository for database interactions with tags.
This commit is contained in:
@@ -2,14 +2,14 @@
|
||||
|
||||
namespace App\Insurance\Entity;
|
||||
|
||||
use App\Category\Entity\Category;
|
||||
use App\Doctor\Entity\Doctor;
|
||||
use App\Insurance\Repository\DoctorInsuranceRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Entity(repositoryClass: DoctorInsuranceRepository::class)]
|
||||
#[ORM\Table(name: 'doctor_insurances')]
|
||||
#[ORM\UniqueConstraint(name: 'idx_doctor_insurance', columns: ['doctor_id', 'category_id'])]
|
||||
#[ORM\Index(columns: ['category_id'], name: 'idx_doctor_insurance_cat')]
|
||||
#[ORM\UniqueConstraint(name: 'idx_doctor_insurance', columns: ['doctor_id', 'insurance_id'])]
|
||||
#[ORM\Index(columns: ['insurance_id'], name: 'idx_doctor_insurance_ins')]
|
||||
class DoctorInsurance
|
||||
{
|
||||
#[ORM\Id]
|
||||
@@ -21,35 +21,35 @@ class DoctorInsurance
|
||||
#[ORM\JoinColumn(name: 'doctor_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]
|
||||
private Doctor $doctor;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: Category::class)]
|
||||
#[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id', nullable: false)]
|
||||
private Category $category;
|
||||
#[ORM\ManyToOne(targetEntity: Insurance::class)]
|
||||
#[ORM\JoinColumn(name: 'insurance_id', referencedColumnName: 'id', nullable: false)]
|
||||
private Insurance $insurance;
|
||||
|
||||
#[ORM\Column(type: 'integer', nullable: true)]
|
||||
private ?int $price = null;
|
||||
|
||||
public function __construct(Doctor $doctor, Category $category)
|
||||
public function __construct(Doctor $doctor, Insurance $insurance)
|
||||
{
|
||||
$this->doctor = $doctor;
|
||||
$this->category = $category;
|
||||
$this->doctor = $doctor;
|
||||
$this->insurance = $insurance;
|
||||
}
|
||||
|
||||
public function getId(): ?int { return $this->id; }
|
||||
public function getDoctor(): Doctor { return $this->doctor; }
|
||||
public function getCategory(): Category { return $this->category; }
|
||||
public function getPrice(): ?int { return $this->price; }
|
||||
public function getId(): ?int { return $this->id; }
|
||||
public function getDoctor(): Doctor { return $this->doctor; }
|
||||
public function getInsurance(): Insurance { return $this->insurance; }
|
||||
public function getPrice(): ?int { return $this->price; }
|
||||
|
||||
public function setPrice(?int $v): self { $this->price = $v; return $this; }
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'doctor_id' => $this->doctor->getId(),
|
||||
'category_id' => $this->category->getId(),
|
||||
'category_name' => $this->category->getLabel(),
|
||||
'bundle' => $this->category->getBundle(),
|
||||
'price' => $this->price,
|
||||
'id' => $this->id,
|
||||
'doctor_id' => $this->doctor->getId(),
|
||||
'insurance_id' => $this->insurance->getId(),
|
||||
'insurance_name' => $this->insurance->getName(),
|
||||
'type' => $this->insurance->getType()->value,
|
||||
'price' => $this->price,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Insurance\Entity;
|
||||
|
||||
use App\Insurance\Enum\InsuranceType;
|
||||
use App\Insurance\Repository\InsuranceRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
||||
#[ORM\Entity(repositoryClass: InsuranceRepository::class)]
|
||||
#[ORM\Table(name: 'insurances')]
|
||||
#[ORM\Index(columns: ['type'], name: 'idx_insurances_type')]
|
||||
#[ORM\Index(columns: ['status'], name: 'idx_insurances_status')]
|
||||
class Insurance
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column(type: 'integer')]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 36, unique: true)]
|
||||
private string $uuid;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 255)]
|
||||
private string $name;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 20, enumType: InsuranceType::class)]
|
||||
private InsuranceType $type;
|
||||
|
||||
#[ORM\Column(name: 'logo_url', type: 'string', length: 500, nullable: true)]
|
||||
private ?string $logoUrl = null;
|
||||
|
||||
#[ORM\Column(type: 'smallint')]
|
||||
private int $status = 1;
|
||||
|
||||
public function __construct(string $name, InsuranceType $type)
|
||||
{
|
||||
$this->uuid = Uuid::v4()->toRfc4122();
|
||||
$this->name = $name;
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
public function getId(): ?int { return $this->id; }
|
||||
public function getUuid(): string { return $this->uuid; }
|
||||
public function getName(): string { return $this->name; }
|
||||
public function getType(): InsuranceType { return $this->type; }
|
||||
public function getLogoUrl(): ?string { return $this->logoUrl; }
|
||||
public function getStatus(): int { return $this->status; }
|
||||
|
||||
public function setName(string $v): self { $this->name = $v; return $this; }
|
||||
public function setType(InsuranceType $v): self { $this->type = $v; return $this; }
|
||||
public function setLogoUrl(?string $v): self { $this->logoUrl = $v; return $this; }
|
||||
public function setStatus(int $v): self { $this->status = $v; return $this; }
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'uuid' => $this->uuid,
|
||||
'name' => $this->name,
|
||||
'type' => $this->type->value,
|
||||
'logo_url' => $this->logoUrl,
|
||||
'status' => $this->status,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user