Improve specialty workspace actions and Call next handoff.
Deploy Ladill Care / deploy (push) Successful in 40s
Deploy Ladill Care / deploy (push) Successful in 40s
Move timeline into a workspace tab, surface Complete consultation and Call again in Actions, and make Call next end the current encounter then open the next called patient. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -11,6 +11,7 @@ use App\Services\Care\BranchContext;
|
||||
use App\Services\Care\CarePermissions;
|
||||
use App\Services\Care\CareQueueBridge;
|
||||
use App\Services\Care\CareQueueContexts;
|
||||
use App\Services\Care\CareQueueSessionAdvance;
|
||||
use App\Services\Care\ConsultationService;
|
||||
use App\Services\Care\OrganizationResolver;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
@@ -157,7 +158,7 @@ class QueueController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function callNext(Request $request): RedirectResponse
|
||||
public function callNext(Request $request, CareQueueSessionAdvance $advance): RedirectResponse
|
||||
{
|
||||
abort_unless(app(CarePermissions::class)->handlesFloorCare($this->member($request)), 403);
|
||||
$this->authorizeAbility($request, 'appointments.view');
|
||||
@@ -165,6 +166,7 @@ class QueueController extends Controller
|
||||
abort_unless($this->queueBridge->isEnabled($organization), 404);
|
||||
|
||||
$member = $this->member($request);
|
||||
$owner = $this->ownerRef($request);
|
||||
$practitionerScope = app(OrganizationResolver::class)->practitionerScope($organization, $member);
|
||||
$branchId = $this->branchContext->resolve($request, $organization, $member);
|
||||
$practitionerId = $request->input('practitioner_id') ? (int) $request->input('practitioner_id') : null;
|
||||
@@ -172,7 +174,7 @@ class QueueController extends Controller
|
||||
if ($practitionerScope !== null) {
|
||||
abort_unless($practitionerScope !== [], 422);
|
||||
$practitionerId = $practitionerScope[0];
|
||||
$prac = Practitioner::owned($this->ownerRef($request))->find($practitionerId);
|
||||
$prac = Practitioner::owned($owner)->find($practitionerId);
|
||||
$branchId = (int) ($prac?->branch_id ?: $branchId);
|
||||
}
|
||||
|
||||
@@ -180,13 +182,20 @@ class QueueController extends Controller
|
||||
|
||||
$context = CareQueueContexts::CONSULTATION;
|
||||
if ($practitionerId) {
|
||||
$prac = Practitioner::owned($this->ownerRef($request))->find($practitionerId);
|
||||
$prac = Practitioner::owned($owner)->find($practitionerId);
|
||||
$specialtyContext = $this->queueBridge->contextForPractitioner($organization, $prac);
|
||||
if ($specialtyContext !== CareQueueContexts::CONSULTATION) {
|
||||
$context = $specialtyContext;
|
||||
}
|
||||
}
|
||||
|
||||
if ($request->filled('appointment_id')) {
|
||||
$current = Appointment::owned($owner)
|
||||
->where('organization_id', $organization->id)
|
||||
->findOrFail((int) $request->input('appointment_id'));
|
||||
$advance->endCurrentEncounter($current, $owner, $owner);
|
||||
}
|
||||
|
||||
$result = $this->queueBridge->callNext(
|
||||
$organization,
|
||||
$context,
|
||||
@@ -203,6 +212,11 @@ class QueueController extends Controller
|
||||
return back()->with('info', "No patients waiting at your {$label} service point.");
|
||||
}
|
||||
|
||||
$entity = $result['entity'] ?? null;
|
||||
if ($entity instanceof Appointment) {
|
||||
return $advance->redirectToOpenedPatient($entity, $ticket);
|
||||
}
|
||||
|
||||
return back()->with('success', 'Called '.$ticket['ticket_number'].' — '.($ticket['customer_name'] ?? 'patient').'.');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user