Add full Physiotherapy and Maternity specialty clinical suites.
Deploy Ladill Care / deploy (push) Successful in 52s

Mirror Eye Care depth with stages, workspace tabs, clinical JSON, stage Move→tab routing, reports/print, demo seeds, and suite feature tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-19 16:39:22 +00:00
co-authored by Cursor
parent 2f724daf49
commit cfa71c2c15
30 changed files with 2794 additions and 24 deletions
@@ -154,6 +154,8 @@ class SpecialtyModuleController extends Controller
'emergency' => 'triage',
'blood_bank' => 'requests',
'ophthalmology' => 'refraction',
'physiotherapy' => 'assessment',
'maternity' => 'history',
default => (collect(array_keys($shellTabs))
->first(fn (string $tab) => $clinical->recordTypeForTab($module, $tab) !== null)
?? 'clinical_notes'),
@@ -226,6 +228,8 @@ class SpecialtyModuleController extends Controller
'emergency' => 'triage',
'blood_bank' => 'requests',
'ophthalmology' => 'refraction',
'physiotherapy' => 'assessment',
'maternity' => 'history',
default => (collect(array_keys($shellTabs))
->first(fn (string $tab) => $clinical->recordTypeForTab($module, $tab) !== null)
?? 'clinical_notes'),
@@ -409,6 +413,103 @@ class SpecialtyModuleController extends Controller
}
}
if ($module === 'physiotherapy' && in_array($recordType, ['pt_assessment', 'pt_plan', 'pt_session', 'pt_home_program'], true)) {
$workflow = app(\App\Services\Care\Physiotherapy\PhysiotherapyWorkflowService::class);
$stageService = app(\App\Services\Care\SpecialtyVisitStageService::class);
$suggested = match ($recordType) {
'pt_assessment' => $workflow->stageFromAssessment($record->payload ?? []),
'pt_plan' => $workflow->stageFromPlan($record->payload ?? []),
'pt_session' => $workflow->stageFromSession($record->payload ?? []),
'pt_home_program' => $workflow->stageFromHomeProgram($record->payload ?? []),
default => null,
};
$current = $visit->specialty_stage;
$early = ['check_in', 'waiting', null, ''];
$order = [
'check_in' => 0,
'assessment' => 1,
'treatment_plan' => 2,
'session' => 3,
'progress' => 4,
'completed' => 5,
];
if ($suggested && (! $current || in_array($current, $early, true))) {
try {
$stageService->setStage(
$organization,
$visit,
'physiotherapy',
$suggested,
$this->ownerRef($request),
$this->ownerRef($request),
);
} catch (\InvalidArgumentException) {
}
} elseif ($suggested && $suggested !== $current && ($order[$suggested] ?? 0) > ($order[$current] ?? 0)) {
try {
$stageService->setStage(
$organization,
$visit,
'physiotherapy',
$suggested,
$this->ownerRef($request),
$this->ownerRef($request),
);
} catch (\InvalidArgumentException) {
}
}
}
if ($module === 'maternity' && in_array($recordType, ['anc_history', 'obstetric_exam', 'fetal_notes', 'mat_investigation', 'mat_plan'], true)) {
$workflow = app(\App\Services\Care\Maternity\MaternityWorkflowService::class);
$stageService = app(\App\Services\Care\SpecialtyVisitStageService::class);
$suggested = match ($recordType) {
'anc_history' => $workflow->stageFromHistory($record->payload ?? []),
'obstetric_exam' => $workflow->stageFromExam($record->payload ?? []),
'fetal_notes' => $workflow->stageFromFetal($record->payload ?? []),
'mat_investigation' => \App\Services\Care\Maternity\MaternityWorkflowService::STAGE_INVESTIGATION,
'mat_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,
'postnatal' => 5,
'completed' => 6,
];
if ($suggested && (! $current || in_array($current, $early, true))) {
try {
$stageService->setStage(
$organization,
$visit,
'maternity',
$suggested,
$this->ownerRef($request),
$this->ownerRef($request),
);
} catch (\InvalidArgumentException) {
}
} elseif ($suggested && $suggested !== $current && ($order[$suggested] ?? 0) > ($order[$current] ?? 0)) {
try {
$stageService->setStage(
$organization,
$visit,
'maternity',
$suggested,
$this->ownerRef($request),
$this->ownerRef($request),
);
} catch (\InvalidArgumentException) {
}
}
}
return redirect()
->route('care.specialty.workspace', [
'module' => $module,
@@ -809,6 +910,20 @@ class SpecialtyModuleController extends Controller
$ophthalmologyProcedure = null;
$ophthalmologyStageCodes = [];
$ophthalmologyStageFlow = [];
$physiotherapyAssessment = null;
$physiotherapyPlan = null;
$physiotherapySession = null;
$physiotherapyHomeProgram = null;
$physiotherapyStageCodes = [];
$physiotherapyStageFlow = [];
$maternityHistory = null;
$maternityExam = null;
$maternityFetal = null;
$maternityInvestigation = null;
$maternityPlan = null;
$maternityPostnatal = null;
$maternityStageCodes = [];
$maternityStageFlow = [];
$activeTab = (string) $request->query('tab', array_key_first($shell->workspaceTabs($module)) ?: 'overview');
$clinical = app(SpecialtyClinicalRecordService::class);
@@ -925,6 +1040,26 @@ class SpecialtyModuleController extends Controller
$ophthalmologyStageFlow = app(\App\Services\Care\Ophthalmology\OphthalmologyWorkflowService::class)->stageFlow();
}
if ($module === 'physiotherapy') {
$physiotherapyAssessment = $clinical->findForVisit($workspaceVisit, 'physiotherapy', 'pt_assessment');
$physiotherapyPlan = $clinical->findForVisit($workspaceVisit, 'physiotherapy', 'pt_plan');
$physiotherapySession = $clinical->findForVisit($workspaceVisit, 'physiotherapy', 'pt_session');
$physiotherapyHomeProgram = $clinical->findForVisit($workspaceVisit, 'physiotherapy', 'pt_home_program');
$physiotherapyStageCodes = collect($shell->stages('physiotherapy'))->pluck('code')->all();
$physiotherapyStageFlow = app(\App\Services\Care\Physiotherapy\PhysiotherapyWorkflowService::class)->stageFlow();
}
if ($module === 'maternity') {
$maternityHistory = $clinical->findForVisit($workspaceVisit, 'maternity', 'anc_history');
$maternityExam = $clinical->findForVisit($workspaceVisit, 'maternity', 'obstetric_exam');
$maternityFetal = $clinical->findForVisit($workspaceVisit, 'maternity', 'fetal_notes');
$maternityInvestigation = $clinical->findForVisit($workspaceVisit, 'maternity', 'mat_investigation');
$maternityPlan = $clinical->findForVisit($workspaceVisit, 'maternity', 'mat_plan');
$maternityPostnatal = $clinical->findForVisit($workspaceVisit, 'maternity', 'postnatal_note');
$maternityStageCodes = collect($shell->stages('maternity'))->pluck('code')->all();
$maternityStageFlow = app(\App\Services\Care\Maternity\MaternityWorkflowService::class)->stageFlow();
}
if ($patientHeader !== null) {
$patientHeader['clinical_alerts'] = $clinicalAlerts;
}
@@ -1019,6 +1154,20 @@ class SpecialtyModuleController extends Controller
'ophthalmologyProcedure' => $ophthalmologyProcedure,
'ophthalmologyStageCodes' => $ophthalmologyStageCodes,
'ophthalmologyStageFlow' => $ophthalmologyStageFlow,
'physiotherapyAssessment' => $physiotherapyAssessment,
'physiotherapyPlan' => $physiotherapyPlan,
'physiotherapySession' => $physiotherapySession,
'physiotherapyHomeProgram' => $physiotherapyHomeProgram,
'physiotherapyStageCodes' => $physiotherapyStageCodes,
'physiotherapyStageFlow' => $physiotherapyStageFlow,
'maternityHistory' => $maternityHistory,
'maternityExam' => $maternityExam,
'maternityFetal' => $maternityFetal,
'maternityInvestigation' => $maternityInvestigation,
'maternityPlan' => $maternityPlan,
'maternityPostnatal' => $maternityPostnatal,
'maternityStageCodes' => $maternityStageCodes,
'maternityStageFlow' => $maternityStageFlow,
'queueStubs' => $modules->queueStubsFor($organization, $module),
'branchId' => $branchId,
'branchLabel' => $branchLabel,