feat(claims): enrich claims with insurance details and item specifics

This commit is contained in:
hamed
2026-06-24 04:48:11 +03:30
parent 27840da78d
commit c189daa860
8 changed files with 188 additions and 11 deletions
+8
View File
@@ -82,6 +82,14 @@ class PatientSession
public function getInsuranceBaseId(): ?int { return $this->insuranceBaseId; }
public function getInsuranceSupplementaryId(): ?int { return $this->insuranceSupplementaryId; }
public function getServices(): Collection { return $this->services; }
public function addService(SessionService $service): self
{
if (!$this->services->contains($service)) {
$this->services->add($service);
}
return $this;
}
public function getVisitPriceRials(): int { return $this->visitPriceRials; }
public function getBaseInsuranceDiscountPercent(): float { return (float) $this->baseInsuranceDiscountPercent; }
public function getSupplementaryDiscountPercent(): float { return (float) $this->supplementaryDiscountPercent; }
@@ -64,4 +64,29 @@ class PatientSessionRepository extends ServiceEntityRepository
$this->getEntityManager()->persist($session);
$this->getEntityManager()->flush();
}
/**
* تاریخ ثبت چند مراجعه — کلیددار بر اساس id جلسه.
* @param int[] $ids
* @return array<int, int> sessionId => createdAt
*/
public function datesForIds(array $ids): array
{
if ($ids === []) {
return [];
}
$rows = $this->createQueryBuilder('s')
->select('s.id AS id', 's.createdAt AS created_at')
->where('s.id IN (:ids)')
->setParameter('ids', $ids)
->getQuery()
->getArrayResult();
$out = [];
foreach ($rows as $r) {
$out[(int) $r['id']] = (int) $r['created_at'];
}
return $out;
}
}
+1
View File
@@ -173,6 +173,7 @@ class PatientService
$qty = max(1, (int) ($svc['quantity'] ?? 1));
$ss = new SessionService($session, $item, $staff, $qty);
$this->sessionServiceRepo->save($ss);
$session->addService($ss);
}
return $session;