Add full Ambulance and Child Welfare specialty clinical suites.
Deploy Ladill Care / deploy (push) Successful in 54s
Deploy Ladill Care / deploy (push) Successful in 54s
EMS clinic workflow (dispatch → scene → transport → handover) plus completed CWC suite, with shell stages, clinical records, reports/print, demo seed, and suite tests. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -171,6 +171,8 @@ class SpecialtyModuleController extends Controller
|
||||
'dermatology' => 'history',
|
||||
'podiatry' => 'history',
|
||||
'fertility' => 'history',
|
||||
'child_welfare' => 'intake',
|
||||
'ambulance' => 'dispatch',
|
||||
default => (collect(array_keys($shellTabs))
|
||||
->first(fn (string $tab) => $clinical->recordTypeForTab($module, $tab) !== null)
|
||||
?? 'clinical_notes'),
|
||||
@@ -260,6 +262,8 @@ class SpecialtyModuleController extends Controller
|
||||
'dermatology' => 'history',
|
||||
'podiatry' => 'history',
|
||||
'fertility' => 'history',
|
||||
'child_welfare' => 'intake',
|
||||
'ambulance' => 'dispatch',
|
||||
default => (collect(array_keys($shellTabs))
|
||||
->first(fn (string $tab) => $clinical->recordTypeForTab($module, $tab) !== null)
|
||||
?? 'clinical_notes'),
|
||||
@@ -1127,6 +1131,70 @@ class SpecialtyModuleController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
if ($module === 'child_welfare' && in_array($recordType, ['cwc_intake', 'cwc_assessment', 'cwc_plan'], true)) {
|
||||
$workflow = app(\App\Services\Care\ChildWelfare\ChildWelfareWorkflowService::class);
|
||||
$stageService = app(\App\Services\Care\SpecialtyVisitStageService::class);
|
||||
$suggested = match ($recordType) {
|
||||
'cwc_intake' => $workflow->stageFromIntake($record->payload ?? []),
|
||||
'cwc_assessment' => $workflow->stageFromAssessment($record->payload ?? []),
|
||||
'cwc_plan' => $workflow->stageFromPlan($record->payload ?? []),
|
||||
default => null,
|
||||
};
|
||||
$current = $visit->specialty_stage;
|
||||
$early = ['check_in', 'waiting', null, ''];
|
||||
$order = [
|
||||
'check_in' => 0,
|
||||
'intake' => 1,
|
||||
'assessment' => 2,
|
||||
'plan' => 3,
|
||||
'followup' => 4,
|
||||
'completed' => 5,
|
||||
];
|
||||
if ($suggested && (! $current || in_array($current, $early, true))) {
|
||||
try {
|
||||
$stageService->setStage($organization, $visit, 'child_welfare', $suggested, $this->ownerRef($request), $this->ownerRef($request));
|
||||
} catch (\InvalidArgumentException) {
|
||||
}
|
||||
} elseif ($suggested && $suggested !== $current && ($order[$suggested] ?? 0) > ($order[$current] ?? 0)) {
|
||||
try {
|
||||
$stageService->setStage($organization, $visit, 'child_welfare', $suggested, $this->ownerRef($request), $this->ownerRef($request));
|
||||
} catch (\InvalidArgumentException) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($module === 'ambulance' && in_array($recordType, ['amb_dispatch', 'amb_scene', 'amb_en_route'], true)) {
|
||||
$workflow = app(\App\Services\Care\Ambulance\AmbulanceWorkflowService::class);
|
||||
$stageService = app(\App\Services\Care\SpecialtyVisitStageService::class);
|
||||
$suggested = match ($recordType) {
|
||||
'amb_dispatch' => $workflow->stageFromDispatch($record->payload ?? []),
|
||||
'amb_scene' => $workflow->stageFromScene($record->payload ?? []),
|
||||
'amb_en_route' => $workflow->stageFromEnRoute($record->payload ?? []),
|
||||
default => null,
|
||||
};
|
||||
$current = $visit->specialty_stage;
|
||||
$early = ['check_in', 'waiting', null, ''];
|
||||
$order = [
|
||||
'check_in' => 0,
|
||||
'dispatch' => 1,
|
||||
'on_scene' => 2,
|
||||
'transport' => 3,
|
||||
'handover' => 4,
|
||||
'completed' => 5,
|
||||
];
|
||||
if ($suggested && (! $current || in_array($current, $early, true))) {
|
||||
try {
|
||||
$stageService->setStage($organization, $visit, 'ambulance', $suggested, $this->ownerRef($request), $this->ownerRef($request));
|
||||
} catch (\InvalidArgumentException) {
|
||||
}
|
||||
} elseif ($suggested && $suggested !== $current && ($order[$suggested] ?? 0) > ($order[$current] ?? 0)) {
|
||||
try {
|
||||
$stageService->setStage($organization, $visit, 'ambulance', $suggested, $this->ownerRef($request), $this->ownerRef($request));
|
||||
} catch (\InvalidArgumentException) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()
|
||||
->route('care.specialty.workspace', [
|
||||
'module' => $module,
|
||||
@@ -1644,6 +1712,18 @@ class SpecialtyModuleController extends Controller
|
||||
$fertilityCycle = null;
|
||||
$fertilityStageCodes = [];
|
||||
$fertilityStageFlow = [];
|
||||
$childWelfareIntake = null;
|
||||
$childWelfareAssessment = null;
|
||||
$childWelfarePlan = null;
|
||||
$childWelfareFollowup = null;
|
||||
$childWelfareStageCodes = [];
|
||||
$childWelfareStageFlow = [];
|
||||
$ambulanceDispatch = null;
|
||||
$ambulanceScene = null;
|
||||
$ambulanceEnRoute = null;
|
||||
$ambulanceHandover = null;
|
||||
$ambulanceStageCodes = [];
|
||||
$ambulanceStageFlow = [];
|
||||
$activeTab = (string) $request->query('tab', array_key_first($shell->workspaceTabs($module)) ?: 'overview');
|
||||
$clinical = app(SpecialtyClinicalRecordService::class);
|
||||
|
||||
@@ -1926,6 +2006,24 @@ class SpecialtyModuleController extends Controller
|
||||
$fertilityStageFlow = app(\App\Services\Care\Fertility\FertilityWorkflowService::class)->stageFlow();
|
||||
}
|
||||
|
||||
if ($module === 'child_welfare') {
|
||||
$childWelfareIntake = $clinical->findForVisit($workspaceVisit, 'child_welfare', 'cwc_intake');
|
||||
$childWelfareAssessment = $clinical->findForVisit($workspaceVisit, 'child_welfare', 'cwc_assessment');
|
||||
$childWelfarePlan = $clinical->findForVisit($workspaceVisit, 'child_welfare', 'cwc_plan');
|
||||
$childWelfareFollowup = $clinical->findForVisit($workspaceVisit, 'child_welfare', 'cwc_followup');
|
||||
$childWelfareStageCodes = collect($shell->stages('child_welfare'))->pluck('code')->all();
|
||||
$childWelfareStageFlow = app(\App\Services\Care\ChildWelfare\ChildWelfareWorkflowService::class)->stageFlow();
|
||||
}
|
||||
|
||||
if ($module === 'ambulance') {
|
||||
$ambulanceDispatch = $clinical->findForVisit($workspaceVisit, 'ambulance', 'amb_dispatch');
|
||||
$ambulanceScene = $clinical->findForVisit($workspaceVisit, 'ambulance', 'amb_scene');
|
||||
$ambulanceEnRoute = $clinical->findForVisit($workspaceVisit, 'ambulance', 'amb_en_route');
|
||||
$ambulanceHandover = $clinical->findForVisit($workspaceVisit, 'ambulance', 'amb_handover');
|
||||
$ambulanceStageCodes = collect($shell->stages('ambulance'))->pluck('code')->all();
|
||||
$ambulanceStageFlow = app(\App\Services\Care\Ambulance\AmbulanceWorkflowService::class)->stageFlow();
|
||||
}
|
||||
|
||||
if ($patientHeader !== null) {
|
||||
$patientHeader['clinical_alerts'] = $clinicalAlerts;
|
||||
}
|
||||
@@ -2135,6 +2233,18 @@ class SpecialtyModuleController extends Controller
|
||||
'fertilityCycle' => $fertilityCycle,
|
||||
'fertilityStageCodes' => $fertilityStageCodes,
|
||||
'fertilityStageFlow' => $fertilityStageFlow,
|
||||
'childWelfareIntake' => $childWelfareIntake,
|
||||
'childWelfareAssessment' => $childWelfareAssessment,
|
||||
'childWelfarePlan' => $childWelfarePlan,
|
||||
'childWelfareFollowup' => $childWelfareFollowup,
|
||||
'childWelfareStageCodes' => $childWelfareStageCodes,
|
||||
'childWelfareStageFlow' => $childWelfareStageFlow,
|
||||
'ambulanceDispatch' => $ambulanceDispatch,
|
||||
'ambulanceScene' => $ambulanceScene,
|
||||
'ambulanceEnRoute' => $ambulanceEnRoute,
|
||||
'ambulanceHandover' => $ambulanceHandover,
|
||||
'ambulanceStageCodes' => $ambulanceStageCodes,
|
||||
'ambulanceStageFlow' => $ambulanceStageFlow,
|
||||
'queueStubs' => $modules->queueStubsFor($organization, $module),
|
||||
'branchId' => $branchId,
|
||||
'branchLabel' => $branchLabel,
|
||||
|
||||
Reference in New Issue
Block a user