Add full Pediatrics, Orthopedics, and ENT specialty clinical suites.
Deploy Ladill Care / deploy (push) Successful in 43s

Mirror Cardiology-depth stage flows, workspace tabs, reports/print, clinical
alerts, demo seeds, and PHPUnit coverage for child health, fracture clinic,
and ENT pathways.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-19 19:12:38 +00:00
co-authored by Cursor
parent 8e23cdeae3
commit dc86b51ed5
36 changed files with 4021 additions and 38 deletions
@@ -159,6 +159,9 @@ class SpecialtyModuleController extends Controller
'radiology' => 'protocol',
'cardiology' => 'history',
'psychiatry' => 'history',
'pediatrics' => 'history',
'orthopedics' => 'history',
'ent' => 'history',
default => (collect(array_keys($shellTabs))
->first(fn (string $tab) => $clinical->recordTypeForTab($module, $tab) !== null)
?? 'clinical_notes'),
@@ -236,6 +239,9 @@ class SpecialtyModuleController extends Controller
'radiology' => 'protocol',
'cardiology' => 'history',
'psychiatry' => 'history',
'pediatrics' => 'history',
'orthopedics' => 'history',
'ent' => 'history',
default => (collect(array_keys($shellTabs))
->first(fn (string $tab) => $clinical->recordTypeForTab($module, $tab) !== null)
?? 'clinical_notes'),
@@ -656,6 +662,150 @@ class SpecialtyModuleController extends Controller
}
}
if ($module === 'pediatrics' && in_array($recordType, ['ped_history', 'pediatric_exam', 'ped_investigation', 'ped_plan'], true)) {
$workflow = app(\App\Services\Care\Pediatrics\PediatricsWorkflowService::class);
$stageService = app(\App\Services\Care\SpecialtyVisitStageService::class);
$suggested = match ($recordType) {
'ped_history' => $workflow->stageFromHistory($record->payload ?? []),
'pediatric_exam' => $workflow->stageFromExam($record->payload ?? []),
'ped_investigation' => $workflow->stageFromInvestigation($record->payload ?? []),
'ped_plan' => $workflow->stageFromPlan($record->payload ?? []),
default => null,
};
$current = $visit->specialty_stage;
$early = ['check_in', 'waiting', null, ''];
$order = [
'check_in' => 0,
'history' => 1,
'exam' => 2,
'investigation' => 3,
'plan' => 4,
'treatment' => 5,
'completed' => 6,
];
if ($suggested && (! $current || in_array($current, $early, true))) {
try {
$stageService->setStage(
$organization,
$visit,
'pediatrics',
$suggested,
$this->ownerRef($request),
$this->ownerRef($request),
);
} catch (\InvalidArgumentException) {
}
} elseif ($suggested && $suggested !== $current && ($order[$suggested] ?? 0) > ($order[$current] ?? 0)) {
try {
$stageService->setStage(
$organization,
$visit,
'pediatrics',
$suggested,
$this->ownerRef($request),
$this->ownerRef($request),
);
} catch (\InvalidArgumentException) {
}
}
}
if ($module === 'orthopedics' && in_array($recordType, ['ortho_history', 'ortho_exam', 'ortho_imaging', 'ortho_plan'], true)) {
$workflow = app(\App\Services\Care\Orthopedics\OrthopedicsWorkflowService::class);
$stageService = app(\App\Services\Care\SpecialtyVisitStageService::class);
$suggested = match ($recordType) {
'ortho_history' => $workflow->stageFromHistory($record->payload ?? []),
'ortho_exam' => $workflow->stageFromExam($record->payload ?? []),
'ortho_imaging' => $workflow->stageFromImaging($record->payload ?? []),
'ortho_plan' => $workflow->stageFromPlan($record->payload ?? []),
default => null,
};
$current = $visit->specialty_stage;
$early = ['check_in', 'waiting', null, ''];
$order = [
'check_in' => 0,
'history' => 1,
'exam' => 2,
'imaging' => 3,
'plan' => 4,
'procedure' => 5,
'completed' => 6,
];
if ($suggested && (! $current || in_array($current, $early, true))) {
try {
$stageService->setStage(
$organization,
$visit,
'orthopedics',
$suggested,
$this->ownerRef($request),
$this->ownerRef($request),
);
} catch (\InvalidArgumentException) {
}
} elseif ($suggested && $suggested !== $current && ($order[$suggested] ?? 0) > ($order[$current] ?? 0)) {
try {
$stageService->setStage(
$organization,
$visit,
'orthopedics',
$suggested,
$this->ownerRef($request),
$this->ownerRef($request),
);
} catch (\InvalidArgumentException) {
}
}
}
if ($module === 'ent' && in_array($recordType, ['ent_history', 'ent_exam', 'ent_investigation', 'ent_plan'], true)) {
$workflow = app(\App\Services\Care\Ent\EntWorkflowService::class);
$stageService = app(\App\Services\Care\SpecialtyVisitStageService::class);
$suggested = match ($recordType) {
'ent_history' => $workflow->stageFromHistory($record->payload ?? []),
'ent_exam' => $workflow->stageFromExam($record->payload ?? []),
'ent_investigation' => $workflow->stageFromInvestigation($record->payload ?? []),
'ent_plan' => $workflow->stageFromPlan($record->payload ?? []),
default => null,
};
$current = $visit->specialty_stage;
$early = ['check_in', 'waiting', null, ''];
$order = [
'check_in' => 0,
'history' => 1,
'exam' => 2,
'investigation' => 3,
'plan' => 4,
'procedure' => 5,
'completed' => 6,
];
if ($suggested && (! $current || in_array($current, $early, true))) {
try {
$stageService->setStage(
$organization,
$visit,
'ent',
$suggested,
$this->ownerRef($request),
$this->ownerRef($request),
);
} catch (\InvalidArgumentException) {
}
} elseif ($suggested && $suggested !== $current && ($order[$suggested] ?? 0) > ($order[$current] ?? 0)) {
try {
$stageService->setStage(
$organization,
$visit,
'ent',
$suggested,
$this->ownerRef($request),
$this->ownerRef($request),
);
} catch (\InvalidArgumentException) {
}
}
}
return redirect()
->route('care.specialty.workspace', [
'module' => $module,
@@ -1091,6 +1241,27 @@ class SpecialtyModuleController extends Controller
$psychiatryFollowup = null;
$psychiatryStageCodes = [];
$psychiatryStageFlow = [];
$pediatricsHistory = null;
$pediatricsExam = null;
$pediatricsInvestigation = null;
$pediatricsPlan = null;
$pediatricsTreatment = null;
$pediatricsStageCodes = [];
$pediatricsStageFlow = [];
$orthopedicsHistory = null;
$orthopedicsExam = null;
$orthopedicsImaging = null;
$orthopedicsPlan = null;
$orthopedicsProcedure = null;
$orthopedicsStageCodes = [];
$orthopedicsStageFlow = [];
$entHistory = null;
$entExam = null;
$entInvestigation = null;
$entPlan = null;
$entProcedure = null;
$entStageCodes = [];
$entStageFlow = [];
$activeTab = (string) $request->query('tab', array_key_first($shell->workspaceTabs($module)) ?: 'overview');
$clinical = app(SpecialtyClinicalRecordService::class);
@@ -1255,6 +1426,36 @@ class SpecialtyModuleController extends Controller
$psychiatryStageFlow = app(\App\Services\Care\Psychiatry\PsychiatryWorkflowService::class)->stageFlow();
}
if ($module === 'pediatrics') {
$pediatricsHistory = $clinical->findForVisit($workspaceVisit, 'pediatrics', 'ped_history');
$pediatricsExam = $clinical->findForVisit($workspaceVisit, 'pediatrics', 'pediatric_exam');
$pediatricsInvestigation = $clinical->findForVisit($workspaceVisit, 'pediatrics', 'ped_investigation');
$pediatricsPlan = $clinical->findForVisit($workspaceVisit, 'pediatrics', 'ped_plan');
$pediatricsTreatment = $clinical->findForVisit($workspaceVisit, 'pediatrics', 'ped_treatment');
$pediatricsStageCodes = collect($shell->stages('pediatrics'))->pluck('code')->all();
$pediatricsStageFlow = app(\App\Services\Care\Pediatrics\PediatricsWorkflowService::class)->stageFlow();
}
if ($module === 'orthopedics') {
$orthopedicsHistory = $clinical->findForVisit($workspaceVisit, 'orthopedics', 'ortho_history');
$orthopedicsExam = $clinical->findForVisit($workspaceVisit, 'orthopedics', 'ortho_exam');
$orthopedicsImaging = $clinical->findForVisit($workspaceVisit, 'orthopedics', 'ortho_imaging');
$orthopedicsPlan = $clinical->findForVisit($workspaceVisit, 'orthopedics', 'ortho_plan');
$orthopedicsProcedure = $clinical->findForVisit($workspaceVisit, 'orthopedics', 'ortho_procedure');
$orthopedicsStageCodes = collect($shell->stages('orthopedics'))->pluck('code')->all();
$orthopedicsStageFlow = app(\App\Services\Care\Orthopedics\OrthopedicsWorkflowService::class)->stageFlow();
}
if ($module === 'ent') {
$entHistory = $clinical->findForVisit($workspaceVisit, 'ent', 'ent_history');
$entExam = $clinical->findForVisit($workspaceVisit, 'ent', 'ent_exam');
$entInvestigation = $clinical->findForVisit($workspaceVisit, 'ent', 'ent_investigation');
$entPlan = $clinical->findForVisit($workspaceVisit, 'ent', 'ent_plan');
$entProcedure = $clinical->findForVisit($workspaceVisit, 'ent', 'ent_procedure');
$entStageCodes = collect($shell->stages('ent'))->pluck('code')->all();
$entStageFlow = app(\App\Services\Care\Ent\EntWorkflowService::class)->stageFlow();
}
if ($patientHeader !== null) {
$patientHeader['clinical_alerts'] = $clinicalAlerts;
}
@@ -1382,6 +1583,27 @@ class SpecialtyModuleController extends Controller
'psychiatryFollowup' => $psychiatryFollowup,
'psychiatryStageCodes' => $psychiatryStageCodes,
'psychiatryStageFlow' => $psychiatryStageFlow,
'pediatricsHistory' => $pediatricsHistory,
'pediatricsExam' => $pediatricsExam,
'pediatricsInvestigation' => $pediatricsInvestigation,
'pediatricsPlan' => $pediatricsPlan,
'pediatricsTreatment' => $pediatricsTreatment,
'pediatricsStageCodes' => $pediatricsStageCodes,
'pediatricsStageFlow' => $pediatricsStageFlow,
'orthopedicsHistory' => $orthopedicsHistory,
'orthopedicsExam' => $orthopedicsExam,
'orthopedicsImaging' => $orthopedicsImaging,
'orthopedicsPlan' => $orthopedicsPlan,
'orthopedicsProcedure' => $orthopedicsProcedure,
'orthopedicsStageCodes' => $orthopedicsStageCodes,
'orthopedicsStageFlow' => $orthopedicsStageFlow,
'entHistory' => $entHistory,
'entExam' => $entExam,
'entInvestigation' => $entInvestigation,
'entPlan' => $entPlan,
'entProcedure' => $entProcedure,
'entStageCodes' => $entStageCodes,
'entStageFlow' => $entStageFlow,
'queueStubs' => $modules->queueStubsFor($organization, $module),
'branchId' => $branchId,
'branchLabel' => $branchLabel,