Add clinical device registry, browser wedge scan, and local agent API.
Deploy Ladill Care / deploy (push) Successful in 1m39s
Deploy Ladill Care / deploy (push) Successful in 1m39s
Branch-scoped Care devices with hashed agent tokens, patient barcode lookup/labels, and provenance-aware vitals from a minimal device agent (Pro for agent hardware; wedge free). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -10,6 +10,7 @@ use App\Services\Care\CareFeatures;
|
||||
use App\Services\Care\CarePermissions;
|
||||
use App\Services\Care\OrganizationResolver;
|
||||
use App\Services\Care\PatientService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
@@ -49,6 +50,58 @@ class PatientController extends Controller
|
||||
return view('care.patients.index', compact('patients', 'organization', 'heroStats'));
|
||||
}
|
||||
|
||||
public function scanLookup(Request $request): JsonResponse|RedirectResponse
|
||||
{
|
||||
$this->authorizeAbility($request, 'patients.view');
|
||||
$organization = $this->organization($request);
|
||||
$branchScope = app(OrganizationResolver::class)->branchScope($this->member($request));
|
||||
|
||||
$code = trim((string) $request->query('code', ''));
|
||||
abort_unless($code !== '', 422, 'Scan code required.');
|
||||
|
||||
$patient = $this->patients->findByScanCode(
|
||||
$this->ownerRef($request),
|
||||
$organization->id,
|
||||
$code,
|
||||
$branchScope,
|
||||
);
|
||||
|
||||
if ($request->expectsJson() || $request->wantsJson() || $request->ajax()) {
|
||||
if (! $patient) {
|
||||
return response()->json(['message' => 'No patient found for that barcode.'], 404);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'patient' => [
|
||||
'uuid' => $patient->uuid,
|
||||
'patient_number' => $patient->patient_number,
|
||||
'name' => $patient->fullName(),
|
||||
'url' => route('care.patients.show', $patient),
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
if (! $patient) {
|
||||
return redirect()
|
||||
->route('care.patients.index', ['q' => $code])
|
||||
->with('error', 'No patient found for that barcode.');
|
||||
}
|
||||
|
||||
return redirect()->route('care.patients.show', $patient);
|
||||
}
|
||||
|
||||
public function label(Request $request, Patient $patient): View
|
||||
{
|
||||
$this->authorizeAbility($request, 'patients.view');
|
||||
$this->authorizePatient($request, $patient);
|
||||
|
||||
return view('care.patients.label', [
|
||||
'patient' => $patient,
|
||||
'organization' => $this->organization($request),
|
||||
'genders' => config('care.genders'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function create(Request $request): View
|
||||
{
|
||||
$this->authorizeAbility($request, 'patients.manage');
|
||||
|
||||
Reference in New Issue
Block a user