Add full Blood Bank specialty suite on shared shell.
Deploy Ladill Care / deploy (push) Successful in 37s
Deploy Ladill Care / deploy (push) Successful in 37s
Mirror Emergency: stage workflow, issue/transfusion records, analytics, print, and action-menu stage flow without a parallel EHR. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -270,7 +270,7 @@ class SpecialtyShellService
|
||||
) {
|
||||
$code = (string) ($stage['code'] ?? '');
|
||||
|
||||
if (in_array($moduleKey, ['dentistry', 'emergency'], true) && $visitIds->isNotEmpty()) {
|
||||
if (in_array($moduleKey, ['dentistry', 'emergency', 'blood_bank'], true) && $visitIds->isNotEmpty()) {
|
||||
$count = Visit::owned($ownerRef)
|
||||
->where('organization_id', $organization->id)
|
||||
->whereIn('id', $visitIds)
|
||||
@@ -502,6 +502,7 @@ class SpecialtyShellService
|
||||
string $serviceCode,
|
||||
string $ownerRef,
|
||||
?string $actorRef = null,
|
||||
int $quantity = 1,
|
||||
): Bill {
|
||||
$service = collect($this->provisionedServices($organization, $moduleKey))
|
||||
->first(fn ($s) => ($s['code'] ?? '') === $serviceCode);
|
||||
@@ -510,12 +511,21 @@ class SpecialtyShellService
|
||||
throw new \InvalidArgumentException("Unknown specialty service [{$serviceCode}].");
|
||||
}
|
||||
|
||||
$bill = $this->bills->generateFromVisit($visit, $ownerRef, $actorRef);
|
||||
// Reuse an open visit bill without syncLineItemsFromVisit — that sync deletes
|
||||
// prior specialty_service lines and would wipe multi-item issue/billing batches.
|
||||
$bill = Bill::owned($ownerRef)
|
||||
->where('visit_id', $visit->id)
|
||||
->whereNotIn('status', [Bill::STATUS_VOID])
|
||||
->first();
|
||||
|
||||
if (! $bill) {
|
||||
$bill = $this->bills->generateFromVisit($visit, $ownerRef, $actorRef);
|
||||
}
|
||||
|
||||
return $this->bills->addManualLineItem($bill, $ownerRef, [
|
||||
'type' => $service['type'] ?? 'misc',
|
||||
'description' => $service['label'],
|
||||
'quantity' => 1,
|
||||
'quantity' => max(1, $quantity),
|
||||
'unit_price_minor' => (int) ($service['amount_minor'] ?? 0),
|
||||
'source_type' => 'specialty_service',
|
||||
'source_id' => null,
|
||||
|
||||
Reference in New Issue
Block a user