Replace Maternity with Women's Health (OB/GYN) and configurable service lines.
Deploy Ladill Care / deploy (push) Successful in 26s
Deploy Ladill Care / deploy (push) Successful in 26s
Keeps Fertility as a separate specialty, adds OB/GYN and fertility staff roles, and migrates live org settings from maternity → womens_health. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -47,6 +47,7 @@ class SettingsModulesController extends Controller
|
||||
CarePricingService $pricing,
|
||||
): View {
|
||||
$this->authorizeAbility($request, 'settings.view');
|
||||
$module = $modules->normalizeKey($module);
|
||||
$definition = $modules->definition($module);
|
||||
abort_unless($definition, 404);
|
||||
|
||||
@@ -69,6 +70,8 @@ class SettingsModulesController extends Controller
|
||||
'moduleKey' => $module,
|
||||
'definition' => $definition,
|
||||
'services' => $services,
|
||||
'serviceLines' => $modules->serviceLines($module),
|
||||
'enabledServiceLines' => $modules->enabledServiceLines($organization, $module),
|
||||
'enabled' => $modules->isEnabled($organization, $module),
|
||||
'canManage' => $canManage && $canUse,
|
||||
'canUseSpecialtyModules' => $canUse,
|
||||
@@ -77,6 +80,36 @@ class SettingsModulesController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function updateServiceLines(
|
||||
Request $request,
|
||||
string $module,
|
||||
SpecialtyModuleService $modules,
|
||||
): RedirectResponse {
|
||||
$this->authorizeAbility($request, 'settings.manage');
|
||||
$organization = $this->organization($request);
|
||||
abort_unless($modules->definition($module), 404);
|
||||
abort_unless($modules->canManage($organization), 403);
|
||||
abort_unless($modules->serviceLines($module) !== [], 404);
|
||||
|
||||
$lines = $modules->serviceLines($module);
|
||||
$rules = ['lines' => ['required', 'array']];
|
||||
foreach (array_keys($lines) as $key) {
|
||||
$rules["lines.{$key}"] = ['nullable', 'boolean'];
|
||||
}
|
||||
$validated = $request->validate($rules);
|
||||
|
||||
$desired = [];
|
||||
foreach (array_keys($lines) as $key) {
|
||||
$desired[$key] = (bool) ($validated['lines'][$key] ?? false);
|
||||
}
|
||||
|
||||
$modules->syncServiceLines($organization, $module, $desired);
|
||||
|
||||
return redirect()
|
||||
->route('care.settings.modules.show', $module)
|
||||
->with('success', 'Service lines saved.');
|
||||
}
|
||||
|
||||
public function updateServices(
|
||||
Request $request,
|
||||
string $module,
|
||||
|
||||
@@ -155,7 +155,7 @@ class SpecialtyModuleController extends Controller
|
||||
'blood_bank' => 'requests',
|
||||
'ophthalmology' => 'refraction',
|
||||
'physiotherapy' => 'assessment',
|
||||
'maternity' => 'history',
|
||||
'womens_health' => 'history',
|
||||
'radiology' => 'protocol',
|
||||
'cardiology' => 'history',
|
||||
'psychiatry' => 'history',
|
||||
@@ -246,7 +246,7 @@ class SpecialtyModuleController extends Controller
|
||||
'blood_bank' => 'requests',
|
||||
'ophthalmology' => 'refraction',
|
||||
'physiotherapy' => 'assessment',
|
||||
'maternity' => 'history',
|
||||
'womens_health' => 'history',
|
||||
'radiology' => 'protocol',
|
||||
'cardiology' => 'history',
|
||||
'psychiatry' => 'history',
|
||||
@@ -495,14 +495,14 @@ class SpecialtyModuleController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
if ($module === 'womens_health' && in_array($recordType, ['anc_history', 'obstetric_exam', 'fetal_notes', 'mat_investigation', 'mat_plan'], true)) {
|
||||
$workflow = app(\App\Services\Care\WomensHealth\WomensHealthWorkflowService::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_investigation' => \App\Services\Care\WomensHealth\WomensHealthWorkflowService::STAGE_INVESTIGATION,
|
||||
'mat_plan' => $workflow->stageFromPlan($record->payload ?? []),
|
||||
default => null,
|
||||
};
|
||||
@@ -522,7 +522,7 @@ class SpecialtyModuleController extends Controller
|
||||
$stageService->setStage(
|
||||
$organization,
|
||||
$visit,
|
||||
'maternity',
|
||||
'womens_health',
|
||||
$suggested,
|
||||
$this->ownerRef($request),
|
||||
$this->ownerRef($request),
|
||||
@@ -534,7 +534,7 @@ class SpecialtyModuleController extends Controller
|
||||
$stageService->setStage(
|
||||
$organization,
|
||||
$visit,
|
||||
'maternity',
|
||||
'womens_health',
|
||||
$suggested,
|
||||
$this->ownerRef($request),
|
||||
$this->ownerRef($request),
|
||||
@@ -1424,6 +1424,7 @@ class SpecialtyModuleController extends Controller
|
||||
CareQueueBridge $queueBridge,
|
||||
?Visit $visit = null,
|
||||
): View {
|
||||
$module = $modules->normalizeKey($module);
|
||||
$definition = $modules->definition($module);
|
||||
abort_unless($definition, 404);
|
||||
|
||||
@@ -1849,15 +1850,15 @@ class SpecialtyModuleController extends Controller
|
||||
$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 ($module === 'womens_health') {
|
||||
$maternityHistory = $clinical->findForVisit($workspaceVisit, 'womens_health', 'anc_history');
|
||||
$maternityExam = $clinical->findForVisit($workspaceVisit, 'womens_health', 'obstetric_exam');
|
||||
$maternityFetal = $clinical->findForVisit($workspaceVisit, 'womens_health', 'fetal_notes');
|
||||
$maternityInvestigation = $clinical->findForVisit($workspaceVisit, 'womens_health', 'mat_investigation');
|
||||
$maternityPlan = $clinical->findForVisit($workspaceVisit, 'womens_health', 'mat_plan');
|
||||
$maternityPostnatal = $clinical->findForVisit($workspaceVisit, 'womens_health', 'postnatal_note');
|
||||
$maternityStageCodes = collect($shell->stages('womens_health'))->pluck('code')->all();
|
||||
$maternityStageFlow = app(\App\Services\Care\WomensHealth\WomensHealthWorkflowService::class)->stageFlow();
|
||||
}
|
||||
|
||||
if ($module === 'radiology') {
|
||||
|
||||
+36
-36
@@ -6,8 +6,8 @@ use App\Http\Controllers\Care\Concerns\ScopesToAccount;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\SpecialtyClinicalRecord;
|
||||
use App\Models\Visit;
|
||||
use App\Services\Care\Maternity\MaternityAnalyticsService;
|
||||
use App\Services\Care\Maternity\MaternityWorkflowService;
|
||||
use App\Services\Care\WomensHealth\WomensHealthAnalyticsService;
|
||||
use App\Services\Care\WomensHealth\WomensHealthWorkflowService;
|
||||
use App\Services\Care\SpecialtyClinicalRecordService;
|
||||
use App\Services\Care\SpecialtyModuleService;
|
||||
use App\Services\Care\SpecialtyShellService;
|
||||
@@ -16,20 +16,20 @@ use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class MaternityWorkspaceController extends Controller
|
||||
class WomensHealthWorkspaceController extends Controller
|
||||
{
|
||||
use ScopesToAccount;
|
||||
|
||||
protected function assertMaternityAccess(Request $request, SpecialtyModuleService $modules): void
|
||||
protected function assertWomensHealthAccess(Request $request, SpecialtyModuleService $modules): void
|
||||
{
|
||||
$organization = $this->organization($request);
|
||||
abort_unless($modules->memberCanAccess($organization, $this->member($request), 'maternity'), 403);
|
||||
abort_unless($modules->memberCanAccess($organization, $this->member($request), 'womens_health'), 403);
|
||||
}
|
||||
|
||||
protected function assertMaternityManage(Request $request, SpecialtyModuleService $modules): void
|
||||
protected function assertWomensHealthManage(Request $request, SpecialtyModuleService $modules): void
|
||||
{
|
||||
$organization = $this->organization($request);
|
||||
abort_unless($modules->memberCanManage($organization, $this->member($request), 'maternity'), 403);
|
||||
abort_unless($modules->memberCanManage($organization, $this->member($request), 'womens_health'), 403);
|
||||
}
|
||||
|
||||
protected function assertVisit(Request $request, Visit $visit): void
|
||||
@@ -46,7 +46,7 @@ class MaternityWorkspaceController extends Controller
|
||||
SpecialtyShellService $shell,
|
||||
): RedirectResponse {
|
||||
$this->authorizeAbility($request, 'consultations.manage');
|
||||
$this->assertMaternityManage($request, $modules);
|
||||
$this->assertWomensHealthManage($request, $modules);
|
||||
$this->assertVisit($request, $visit);
|
||||
|
||||
$validated = $request->validate([
|
||||
@@ -57,7 +57,7 @@ class MaternityWorkspaceController extends Controller
|
||||
$stages->setStage(
|
||||
$this->organization($request),
|
||||
$visit,
|
||||
'maternity',
|
||||
'womens_health',
|
||||
$validated['stage'],
|
||||
$this->ownerRef($request),
|
||||
$this->actorRef($request),
|
||||
@@ -68,9 +68,9 @@ class MaternityWorkspaceController extends Controller
|
||||
|
||||
return redirect()
|
||||
->route('care.specialty.workspace', [
|
||||
'module' => 'maternity',
|
||||
'module' => 'womens_health',
|
||||
'visit' => $visit,
|
||||
'tab' => $shell->workspaceTabForStage('maternity', $validated['stage']),
|
||||
'tab' => $shell->workspaceTabForStage('womens_health', $validated['stage']),
|
||||
])
|
||||
->with('success', 'Visit stage updated.');
|
||||
}
|
||||
@@ -81,17 +81,17 @@ class MaternityWorkspaceController extends Controller
|
||||
SpecialtyModuleService $modules,
|
||||
SpecialtyClinicalRecordService $clinical,
|
||||
SpecialtyVisitStageService $stages,
|
||||
MaternityWorkflowService $workflow,
|
||||
WomensHealthWorkflowService $workflow,
|
||||
): RedirectResponse {
|
||||
$this->authorizeAbility($request, 'consultations.manage');
|
||||
$this->assertMaternityManage($request, $modules);
|
||||
$this->assertWomensHealthManage($request, $modules);
|
||||
$this->assertVisit($request, $visit);
|
||||
|
||||
$organization = $this->organization($request);
|
||||
$owner = $this->ownerRef($request);
|
||||
|
||||
$payload = (array) $request->input('payload', []);
|
||||
foreach ($clinical->fieldsFor('maternity', 'postnatal_note') as $field) {
|
||||
foreach ($clinical->fieldsFor('womens_health', 'postnatal_note') as $field) {
|
||||
if (($field['type'] ?? '') === 'boolean') {
|
||||
$payload[$field['name']] = $request->boolean('payload.'.$field['name']);
|
||||
}
|
||||
@@ -100,17 +100,17 @@ class MaternityWorkspaceController extends Controller
|
||||
|
||||
$validated = $request->validate(array_merge([
|
||||
'tab' => ['required', 'string'],
|
||||
], $clinical->validationRules('maternity', 'postnatal_note')));
|
||||
], $clinical->validationRules('womens_health', 'postnatal_note')));
|
||||
|
||||
$record = $clinical->upsert(
|
||||
$organization,
|
||||
$visit,
|
||||
'maternity',
|
||||
'womens_health',
|
||||
'postnatal_note',
|
||||
$clinical->payloadFromRequest($validated),
|
||||
$owner,
|
||||
$owner,
|
||||
MaternityWorkflowService::STAGE_POSTNATAL,
|
||||
WomensHealthWorkflowService::STAGE_POSTNATAL,
|
||||
SpecialtyClinicalRecord::STATUS_COMPLETED,
|
||||
);
|
||||
|
||||
@@ -118,8 +118,8 @@ class MaternityWorkspaceController extends Controller
|
||||
$stages->setStage(
|
||||
$organization,
|
||||
$visit,
|
||||
'maternity',
|
||||
MaternityWorkflowService::STAGE_POSTNATAL,
|
||||
'womens_health',
|
||||
WomensHealthWorkflowService::STAGE_POSTNATAL,
|
||||
$owner,
|
||||
$owner,
|
||||
);
|
||||
@@ -131,8 +131,8 @@ class MaternityWorkspaceController extends Controller
|
||||
$stages->setStage(
|
||||
$organization,
|
||||
$visit,
|
||||
'maternity',
|
||||
MaternityWorkflowService::STAGE_COMPLETED,
|
||||
'womens_health',
|
||||
WomensHealthWorkflowService::STAGE_COMPLETED,
|
||||
$owner,
|
||||
$owner,
|
||||
);
|
||||
@@ -157,7 +157,7 @@ class MaternityWorkspaceController extends Controller
|
||||
}
|
||||
|
||||
return redirect()
|
||||
->route('care.specialty.workspace', ['module' => 'maternity', 'visit' => $visit, 'tab' => 'postnatal'])
|
||||
->route('care.specialty.workspace', ['module' => 'womens_health', 'visit' => $visit, 'tab' => 'postnatal'])
|
||||
->with('success', 'Delivery / postnatal note saved.');
|
||||
}
|
||||
|
||||
@@ -165,10 +165,10 @@ class MaternityWorkspaceController extends Controller
|
||||
Request $request,
|
||||
SpecialtyModuleService $modules,
|
||||
SpecialtyShellService $shell,
|
||||
MaternityAnalyticsService $analytics,
|
||||
WomensHealthAnalyticsService $analytics,
|
||||
): View {
|
||||
$this->authorizeAbility($request, 'consultations.view');
|
||||
$this->assertMaternityAccess($request, $modules);
|
||||
$this->assertWomensHealthAccess($request, $modules);
|
||||
|
||||
$organization = $this->organization($request);
|
||||
$branchScope = app(\App\Services\Care\OrganizationResolver::class)->branchScope($this->member($request));
|
||||
@@ -181,10 +181,10 @@ class MaternityWorkspaceController extends Controller
|
||||
$request->query('to'),
|
||||
);
|
||||
|
||||
return view('care.specialty.maternity.reports', [
|
||||
'moduleKey' => 'maternity',
|
||||
'definition' => $modules->definition('maternity'),
|
||||
'shellNav' => $shell->navItems('maternity'),
|
||||
return view('care.specialty.womens_health.reports', [
|
||||
'moduleKey' => 'womens_health',
|
||||
'definition' => $modules->definition('womens_health'),
|
||||
'shellNav' => $shell->navItems('womens_health'),
|
||||
'report' => $report,
|
||||
'currency' => strtoupper((string) config('care.billing.currency', config('care.currency', 'GHS'))),
|
||||
]);
|
||||
@@ -197,20 +197,20 @@ class MaternityWorkspaceController extends Controller
|
||||
SpecialtyClinicalRecordService $clinical,
|
||||
): View {
|
||||
$this->authorizeAbility($request, 'consultations.view');
|
||||
$this->assertMaternityAccess($request, $modules);
|
||||
$this->assertWomensHealthAccess($request, $modules);
|
||||
$this->assertVisit($request, $visit);
|
||||
|
||||
$visit->loadMissing(['patient', 'appointment.practitioner', 'branch']);
|
||||
|
||||
return view('care.specialty.maternity.print', [
|
||||
return view('care.specialty.womens_health.print', [
|
||||
'visit' => $visit,
|
||||
'patient' => $visit->patient,
|
||||
'history' => $clinical->findForVisit($visit, 'maternity', 'anc_history'),
|
||||
'exam' => $clinical->findForVisit($visit, 'maternity', 'obstetric_exam'),
|
||||
'fetal' => $clinical->findForVisit($visit, 'maternity', 'fetal_notes'),
|
||||
'investigation' => $clinical->findForVisit($visit, 'maternity', 'mat_investigation'),
|
||||
'plan' => $clinical->findForVisit($visit, 'maternity', 'mat_plan'),
|
||||
'postnatal' => $clinical->findForVisit($visit, 'maternity', 'postnatal_note'),
|
||||
'history' => $clinical->findForVisit($visit, 'womens_health', 'anc_history'),
|
||||
'exam' => $clinical->findForVisit($visit, 'womens_health', 'obstetric_exam'),
|
||||
'fetal' => $clinical->findForVisit($visit, 'womens_health', 'fetal_notes'),
|
||||
'investigation' => $clinical->findForVisit($visit, 'womens_health', 'mat_investigation'),
|
||||
'plan' => $clinical->findForVisit($visit, 'womens_health', 'mat_plan'),
|
||||
'postnatal' => $clinical->findForVisit($visit, 'womens_health', 'postnatal_note'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user