Add full Dermatology, Podiatry, and Fertility specialty clinical suites.
Deploy Ladill Care / deploy (push) Successful in 35s

Bring thin catalog modules to the same depth as Cardiology with stages, clinical tabs, reports/print, demo seed, and suite tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-19 22:03:01 +00:00
co-authored by Cursor
parent 7b722c71d0
commit 8c18ecc5c9
35 changed files with 3937 additions and 39 deletions
@@ -168,6 +168,9 @@ class SpecialtyModuleController extends Controller
'vaccination' => 'eligibility',
'pathology' => 'request',
'infusion' => 'assessment',
'dermatology' => 'history',
'podiatry' => 'history',
'fertility' => 'history',
default => (collect(array_keys($shellTabs))
->first(fn (string $tab) => $clinical->recordTypeForTab($module, $tab) !== null)
?? 'clinical_notes'),
@@ -254,6 +257,9 @@ class SpecialtyModuleController extends Controller
'vaccination' => 'eligibility',
'pathology' => 'request',
'infusion' => 'assessment',
'dermatology' => 'history',
'podiatry' => 'history',
'fertility' => 'history',
default => (collect(array_keys($shellTabs))
->first(fn (string $tab) => $clinical->recordTypeForTab($module, $tab) !== null)
?? 'clinical_notes'),
@@ -1019,6 +1025,108 @@ class SpecialtyModuleController extends Controller
}
}
if ($module === 'dermatology' && in_array($recordType, ['derm_history', 'skin_exam', 'derm_investigation', 'derm_plan'], true)) {
$workflow = app(\App\Services\Care\Dermatology\DermatologyWorkflowService::class);
$stageService = app(\App\Services\Care\SpecialtyVisitStageService::class);
$suggested = match ($recordType) {
'derm_history' => $workflow->stageFromHistory($record->payload ?? []),
'skin_exam' => $workflow->stageFromExam($record->payload ?? []),
'derm_investigation' => $workflow->stageFromInvestigation($record->payload ?? []),
'derm_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, 'dermatology', $suggested, $this->ownerRef($request), $this->ownerRef($request));
} catch (\InvalidArgumentException) {
}
} elseif ($suggested && $suggested !== $current && ($order[$suggested] ?? 0) > ($order[$current] ?? 0)) {
try {
$stageService->setStage($organization, $visit, 'dermatology', $suggested, $this->ownerRef($request), $this->ownerRef($request));
} catch (\InvalidArgumentException) {
}
}
}
if ($module === 'podiatry' && in_array($recordType, ['pod_history', 'foot_exam', 'pod_investigation', 'pod_plan'], true)) {
$workflow = app(\App\Services\Care\Podiatry\PodiatryWorkflowService::class);
$stageService = app(\App\Services\Care\SpecialtyVisitStageService::class);
$suggested = match ($recordType) {
'pod_history' => $workflow->stageFromHistory($record->payload ?? []),
'foot_exam' => $workflow->stageFromExam($record->payload ?? []),
'pod_investigation' => $workflow->stageFromInvestigation($record->payload ?? []),
'pod_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, 'podiatry', $suggested, $this->ownerRef($request), $this->ownerRef($request));
} catch (\InvalidArgumentException) {
}
} elseif ($suggested && $suggested !== $current && ($order[$suggested] ?? 0) > ($order[$current] ?? 0)) {
try {
$stageService->setStage($organization, $visit, 'podiatry', $suggested, $this->ownerRef($request), $this->ownerRef($request));
} catch (\InvalidArgumentException) {
}
}
}
if ($module === 'fertility' && in_array($recordType, ['fert_history', 'fert_exam', 'fert_investigation', 'fert_plan'], true)) {
$workflow = app(\App\Services\Care\Fertility\FertilityWorkflowService::class);
$stageService = app(\App\Services\Care\SpecialtyVisitStageService::class);
$suggested = match ($recordType) {
'fert_history' => $workflow->stageFromHistory($record->payload ?? []),
'fert_exam' => $workflow->stageFromExam($record->payload ?? []),
'fert_investigation' => $workflow->stageFromInvestigation($record->payload ?? []),
'fert_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,
'cycle' => 5,
'completed' => 6,
];
if ($suggested && (! $current || in_array($current, $early, true))) {
try {
$stageService->setStage($organization, $visit, 'fertility', $suggested, $this->ownerRef($request), $this->ownerRef($request));
} catch (\InvalidArgumentException) {
}
} elseif ($suggested && $suggested !== $current && ($order[$suggested] ?? 0) > ($order[$current] ?? 0)) {
try {
$stageService->setStage($organization, $visit, 'fertility', $suggested, $this->ownerRef($request), $this->ownerRef($request));
} catch (\InvalidArgumentException) {
}
}
}
return redirect()
->route('care.specialty.workspace', [
'module' => $module,
@@ -1515,6 +1623,27 @@ class SpecialtyModuleController extends Controller
$infusionMonitoring = null;
$infusionStageCodes = [];
$infusionStageFlow = [];
$dermatologyHistory = null;
$dermatologyExam = null;
$dermatologyInvestigation = null;
$dermatologyPlan = null;
$dermatologyProcedure = null;
$dermatologyStageCodes = [];
$dermatologyStageFlow = [];
$podiatryHistory = null;
$podiatryExam = null;
$podiatryInvestigation = null;
$podiatryPlan = null;
$podiatryProcedure = null;
$podiatryStageCodes = [];
$podiatryStageFlow = [];
$fertilityHistory = null;
$fertilityExam = null;
$fertilityInvestigation = null;
$fertilityPlan = null;
$fertilityCycle = null;
$fertilityStageCodes = [];
$fertilityStageFlow = [];
$activeTab = (string) $request->query('tab', array_key_first($shell->workspaceTabs($module)) ?: 'overview');
$clinical = app(SpecialtyClinicalRecordService::class);
@@ -1767,6 +1896,36 @@ class SpecialtyModuleController extends Controller
$infusionStageFlow = app(\App\Services\Care\Infusion\InfusionWorkflowService::class)->stageFlow();
}
if ($module === 'dermatology') {
$dermatologyHistory = $clinical->findForVisit($workspaceVisit, 'dermatology', 'derm_history');
$dermatologyExam = $clinical->findForVisit($workspaceVisit, 'dermatology', 'skin_exam');
$dermatologyInvestigation = $clinical->findForVisit($workspaceVisit, 'dermatology', 'derm_investigation');
$dermatologyPlan = $clinical->findForVisit($workspaceVisit, 'dermatology', 'derm_plan');
$dermatologyProcedure = $clinical->findForVisit($workspaceVisit, 'dermatology', 'derm_procedure');
$dermatologyStageCodes = collect($shell->stages('dermatology'))->pluck('code')->all();
$dermatologyStageFlow = app(\App\Services\Care\Dermatology\DermatologyWorkflowService::class)->stageFlow();
}
if ($module === 'podiatry') {
$podiatryHistory = $clinical->findForVisit($workspaceVisit, 'podiatry', 'pod_history');
$podiatryExam = $clinical->findForVisit($workspaceVisit, 'podiatry', 'foot_exam');
$podiatryInvestigation = $clinical->findForVisit($workspaceVisit, 'podiatry', 'pod_investigation');
$podiatryPlan = $clinical->findForVisit($workspaceVisit, 'podiatry', 'pod_plan');
$podiatryProcedure = $clinical->findForVisit($workspaceVisit, 'podiatry', 'pod_procedure');
$podiatryStageCodes = collect($shell->stages('podiatry'))->pluck('code')->all();
$podiatryStageFlow = app(\App\Services\Care\Podiatry\PodiatryWorkflowService::class)->stageFlow();
}
if ($module === 'fertility') {
$fertilityHistory = $clinical->findForVisit($workspaceVisit, 'fertility', 'fert_history');
$fertilityExam = $clinical->findForVisit($workspaceVisit, 'fertility', 'fert_exam');
$fertilityInvestigation = $clinical->findForVisit($workspaceVisit, 'fertility', 'fert_investigation');
$fertilityPlan = $clinical->findForVisit($workspaceVisit, 'fertility', 'fert_plan');
$fertilityCycle = $clinical->findForVisit($workspaceVisit, 'fertility', 'fert_cycle');
$fertilityStageCodes = collect($shell->stages('fertility'))->pluck('code')->all();
$fertilityStageFlow = app(\App\Services\Care\Fertility\FertilityWorkflowService::class)->stageFlow();
}
if ($patientHeader !== null) {
$patientHeader['clinical_alerts'] = $clinicalAlerts;
}
@@ -1955,6 +2114,27 @@ class SpecialtyModuleController extends Controller
'infusionMonitoring' => $infusionMonitoring,
'infusionStageCodes' => $infusionStageCodes,
'infusionStageFlow' => $infusionStageFlow,
'dermatologyHistory' => $dermatologyHistory,
'dermatologyExam' => $dermatologyExam,
'dermatologyInvestigation' => $dermatologyInvestigation,
'dermatologyPlan' => $dermatologyPlan,
'dermatologyProcedure' => $dermatologyProcedure,
'dermatologyStageCodes' => $dermatologyStageCodes,
'dermatologyStageFlow' => $dermatologyStageFlow,
'podiatryHistory' => $podiatryHistory,
'podiatryExam' => $podiatryExam,
'podiatryInvestigation' => $podiatryInvestigation,
'podiatryPlan' => $podiatryPlan,
'podiatryProcedure' => $podiatryProcedure,
'podiatryStageCodes' => $podiatryStageCodes,
'podiatryStageFlow' => $podiatryStageFlow,
'fertilityHistory' => $fertilityHistory,
'fertilityExam' => $fertilityExam,
'fertilityInvestigation' => $fertilityInvestigation,
'fertilityPlan' => $fertilityPlan,
'fertilityCycle' => $fertilityCycle,
'fertilityStageCodes' => $fertilityStageCodes,
'fertilityStageFlow' => $fertilityStageFlow,
'queueStubs' => $modules->queueStubsFor($organization, $module),
'branchId' => $branchId,
'branchLabel' => $branchLabel,