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,
|
CarePricingService $pricing,
|
||||||
): View {
|
): View {
|
||||||
$this->authorizeAbility($request, 'settings.view');
|
$this->authorizeAbility($request, 'settings.view');
|
||||||
|
$module = $modules->normalizeKey($module);
|
||||||
$definition = $modules->definition($module);
|
$definition = $modules->definition($module);
|
||||||
abort_unless($definition, 404);
|
abort_unless($definition, 404);
|
||||||
|
|
||||||
@@ -69,6 +70,8 @@ class SettingsModulesController extends Controller
|
|||||||
'moduleKey' => $module,
|
'moduleKey' => $module,
|
||||||
'definition' => $definition,
|
'definition' => $definition,
|
||||||
'services' => $services,
|
'services' => $services,
|
||||||
|
'serviceLines' => $modules->serviceLines($module),
|
||||||
|
'enabledServiceLines' => $modules->enabledServiceLines($organization, $module),
|
||||||
'enabled' => $modules->isEnabled($organization, $module),
|
'enabled' => $modules->isEnabled($organization, $module),
|
||||||
'canManage' => $canManage && $canUse,
|
'canManage' => $canManage && $canUse,
|
||||||
'canUseSpecialtyModules' => $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(
|
public function updateServices(
|
||||||
Request $request,
|
Request $request,
|
||||||
string $module,
|
string $module,
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ class SpecialtyModuleController extends Controller
|
|||||||
'blood_bank' => 'requests',
|
'blood_bank' => 'requests',
|
||||||
'ophthalmology' => 'refraction',
|
'ophthalmology' => 'refraction',
|
||||||
'physiotherapy' => 'assessment',
|
'physiotherapy' => 'assessment',
|
||||||
'maternity' => 'history',
|
'womens_health' => 'history',
|
||||||
'radiology' => 'protocol',
|
'radiology' => 'protocol',
|
||||||
'cardiology' => 'history',
|
'cardiology' => 'history',
|
||||||
'psychiatry' => 'history',
|
'psychiatry' => 'history',
|
||||||
@@ -246,7 +246,7 @@ class SpecialtyModuleController extends Controller
|
|||||||
'blood_bank' => 'requests',
|
'blood_bank' => 'requests',
|
||||||
'ophthalmology' => 'refraction',
|
'ophthalmology' => 'refraction',
|
||||||
'physiotherapy' => 'assessment',
|
'physiotherapy' => 'assessment',
|
||||||
'maternity' => 'history',
|
'womens_health' => 'history',
|
||||||
'radiology' => 'protocol',
|
'radiology' => 'protocol',
|
||||||
'cardiology' => 'history',
|
'cardiology' => 'history',
|
||||||
'psychiatry' => '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)) {
|
if ($module === 'womens_health' && in_array($recordType, ['anc_history', 'obstetric_exam', 'fetal_notes', 'mat_investigation', 'mat_plan'], true)) {
|
||||||
$workflow = app(\App\Services\Care\Maternity\MaternityWorkflowService::class);
|
$workflow = app(\App\Services\Care\WomensHealth\WomensHealthWorkflowService::class);
|
||||||
$stageService = app(\App\Services\Care\SpecialtyVisitStageService::class);
|
$stageService = app(\App\Services\Care\SpecialtyVisitStageService::class);
|
||||||
$suggested = match ($recordType) {
|
$suggested = match ($recordType) {
|
||||||
'anc_history' => $workflow->stageFromHistory($record->payload ?? []),
|
'anc_history' => $workflow->stageFromHistory($record->payload ?? []),
|
||||||
'obstetric_exam' => $workflow->stageFromExam($record->payload ?? []),
|
'obstetric_exam' => $workflow->stageFromExam($record->payload ?? []),
|
||||||
'fetal_notes' => $workflow->stageFromFetal($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 ?? []),
|
'mat_plan' => $workflow->stageFromPlan($record->payload ?? []),
|
||||||
default => null,
|
default => null,
|
||||||
};
|
};
|
||||||
@@ -522,7 +522,7 @@ class SpecialtyModuleController extends Controller
|
|||||||
$stageService->setStage(
|
$stageService->setStage(
|
||||||
$organization,
|
$organization,
|
||||||
$visit,
|
$visit,
|
||||||
'maternity',
|
'womens_health',
|
||||||
$suggested,
|
$suggested,
|
||||||
$this->ownerRef($request),
|
$this->ownerRef($request),
|
||||||
$this->ownerRef($request),
|
$this->ownerRef($request),
|
||||||
@@ -534,7 +534,7 @@ class SpecialtyModuleController extends Controller
|
|||||||
$stageService->setStage(
|
$stageService->setStage(
|
||||||
$organization,
|
$organization,
|
||||||
$visit,
|
$visit,
|
||||||
'maternity',
|
'womens_health',
|
||||||
$suggested,
|
$suggested,
|
||||||
$this->ownerRef($request),
|
$this->ownerRef($request),
|
||||||
$this->ownerRef($request),
|
$this->ownerRef($request),
|
||||||
@@ -1424,6 +1424,7 @@ class SpecialtyModuleController extends Controller
|
|||||||
CareQueueBridge $queueBridge,
|
CareQueueBridge $queueBridge,
|
||||||
?Visit $visit = null,
|
?Visit $visit = null,
|
||||||
): View {
|
): View {
|
||||||
|
$module = $modules->normalizeKey($module);
|
||||||
$definition = $modules->definition($module);
|
$definition = $modules->definition($module);
|
||||||
abort_unless($definition, 404);
|
abort_unless($definition, 404);
|
||||||
|
|
||||||
@@ -1849,15 +1850,15 @@ class SpecialtyModuleController extends Controller
|
|||||||
$physiotherapyStageFlow = app(\App\Services\Care\Physiotherapy\PhysiotherapyWorkflowService::class)->stageFlow();
|
$physiotherapyStageFlow = app(\App\Services\Care\Physiotherapy\PhysiotherapyWorkflowService::class)->stageFlow();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($module === 'maternity') {
|
if ($module === 'womens_health') {
|
||||||
$maternityHistory = $clinical->findForVisit($workspaceVisit, 'maternity', 'anc_history');
|
$maternityHistory = $clinical->findForVisit($workspaceVisit, 'womens_health', 'anc_history');
|
||||||
$maternityExam = $clinical->findForVisit($workspaceVisit, 'maternity', 'obstetric_exam');
|
$maternityExam = $clinical->findForVisit($workspaceVisit, 'womens_health', 'obstetric_exam');
|
||||||
$maternityFetal = $clinical->findForVisit($workspaceVisit, 'maternity', 'fetal_notes');
|
$maternityFetal = $clinical->findForVisit($workspaceVisit, 'womens_health', 'fetal_notes');
|
||||||
$maternityInvestigation = $clinical->findForVisit($workspaceVisit, 'maternity', 'mat_investigation');
|
$maternityInvestigation = $clinical->findForVisit($workspaceVisit, 'womens_health', 'mat_investigation');
|
||||||
$maternityPlan = $clinical->findForVisit($workspaceVisit, 'maternity', 'mat_plan');
|
$maternityPlan = $clinical->findForVisit($workspaceVisit, 'womens_health', 'mat_plan');
|
||||||
$maternityPostnatal = $clinical->findForVisit($workspaceVisit, 'maternity', 'postnatal_note');
|
$maternityPostnatal = $clinical->findForVisit($workspaceVisit, 'womens_health', 'postnatal_note');
|
||||||
$maternityStageCodes = collect($shell->stages('maternity'))->pluck('code')->all();
|
$maternityStageCodes = collect($shell->stages('womens_health'))->pluck('code')->all();
|
||||||
$maternityStageFlow = app(\App\Services\Care\Maternity\MaternityWorkflowService::class)->stageFlow();
|
$maternityStageFlow = app(\App\Services\Care\WomensHealth\WomensHealthWorkflowService::class)->stageFlow();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($module === 'radiology') {
|
if ($module === 'radiology') {
|
||||||
|
|||||||
+36
-36
@@ -6,8 +6,8 @@ use App\Http\Controllers\Care\Concerns\ScopesToAccount;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\SpecialtyClinicalRecord;
|
use App\Models\SpecialtyClinicalRecord;
|
||||||
use App\Models\Visit;
|
use App\Models\Visit;
|
||||||
use App\Services\Care\Maternity\MaternityAnalyticsService;
|
use App\Services\Care\WomensHealth\WomensHealthAnalyticsService;
|
||||||
use App\Services\Care\Maternity\MaternityWorkflowService;
|
use App\Services\Care\WomensHealth\WomensHealthWorkflowService;
|
||||||
use App\Services\Care\SpecialtyClinicalRecordService;
|
use App\Services\Care\SpecialtyClinicalRecordService;
|
||||||
use App\Services\Care\SpecialtyModuleService;
|
use App\Services\Care\SpecialtyModuleService;
|
||||||
use App\Services\Care\SpecialtyShellService;
|
use App\Services\Care\SpecialtyShellService;
|
||||||
@@ -16,20 +16,20 @@ use Illuminate\Http\RedirectResponse;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
|
|
||||||
class MaternityWorkspaceController extends Controller
|
class WomensHealthWorkspaceController extends Controller
|
||||||
{
|
{
|
||||||
use ScopesToAccount;
|
use ScopesToAccount;
|
||||||
|
|
||||||
protected function assertMaternityAccess(Request $request, SpecialtyModuleService $modules): void
|
protected function assertWomensHealthAccess(Request $request, SpecialtyModuleService $modules): void
|
||||||
{
|
{
|
||||||
$organization = $this->organization($request);
|
$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);
|
$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
|
protected function assertVisit(Request $request, Visit $visit): void
|
||||||
@@ -46,7 +46,7 @@ class MaternityWorkspaceController extends Controller
|
|||||||
SpecialtyShellService $shell,
|
SpecialtyShellService $shell,
|
||||||
): RedirectResponse {
|
): RedirectResponse {
|
||||||
$this->authorizeAbility($request, 'consultations.manage');
|
$this->authorizeAbility($request, 'consultations.manage');
|
||||||
$this->assertMaternityManage($request, $modules);
|
$this->assertWomensHealthManage($request, $modules);
|
||||||
$this->assertVisit($request, $visit);
|
$this->assertVisit($request, $visit);
|
||||||
|
|
||||||
$validated = $request->validate([
|
$validated = $request->validate([
|
||||||
@@ -57,7 +57,7 @@ class MaternityWorkspaceController extends Controller
|
|||||||
$stages->setStage(
|
$stages->setStage(
|
||||||
$this->organization($request),
|
$this->organization($request),
|
||||||
$visit,
|
$visit,
|
||||||
'maternity',
|
'womens_health',
|
||||||
$validated['stage'],
|
$validated['stage'],
|
||||||
$this->ownerRef($request),
|
$this->ownerRef($request),
|
||||||
$this->actorRef($request),
|
$this->actorRef($request),
|
||||||
@@ -68,9 +68,9 @@ class MaternityWorkspaceController extends Controller
|
|||||||
|
|
||||||
return redirect()
|
return redirect()
|
||||||
->route('care.specialty.workspace', [
|
->route('care.specialty.workspace', [
|
||||||
'module' => 'maternity',
|
'module' => 'womens_health',
|
||||||
'visit' => $visit,
|
'visit' => $visit,
|
||||||
'tab' => $shell->workspaceTabForStage('maternity', $validated['stage']),
|
'tab' => $shell->workspaceTabForStage('womens_health', $validated['stage']),
|
||||||
])
|
])
|
||||||
->with('success', 'Visit stage updated.');
|
->with('success', 'Visit stage updated.');
|
||||||
}
|
}
|
||||||
@@ -81,17 +81,17 @@ class MaternityWorkspaceController extends Controller
|
|||||||
SpecialtyModuleService $modules,
|
SpecialtyModuleService $modules,
|
||||||
SpecialtyClinicalRecordService $clinical,
|
SpecialtyClinicalRecordService $clinical,
|
||||||
SpecialtyVisitStageService $stages,
|
SpecialtyVisitStageService $stages,
|
||||||
MaternityWorkflowService $workflow,
|
WomensHealthWorkflowService $workflow,
|
||||||
): RedirectResponse {
|
): RedirectResponse {
|
||||||
$this->authorizeAbility($request, 'consultations.manage');
|
$this->authorizeAbility($request, 'consultations.manage');
|
||||||
$this->assertMaternityManage($request, $modules);
|
$this->assertWomensHealthManage($request, $modules);
|
||||||
$this->assertVisit($request, $visit);
|
$this->assertVisit($request, $visit);
|
||||||
|
|
||||||
$organization = $this->organization($request);
|
$organization = $this->organization($request);
|
||||||
$owner = $this->ownerRef($request);
|
$owner = $this->ownerRef($request);
|
||||||
|
|
||||||
$payload = (array) $request->input('payload', []);
|
$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') {
|
if (($field['type'] ?? '') === 'boolean') {
|
||||||
$payload[$field['name']] = $request->boolean('payload.'.$field['name']);
|
$payload[$field['name']] = $request->boolean('payload.'.$field['name']);
|
||||||
}
|
}
|
||||||
@@ -100,17 +100,17 @@ class MaternityWorkspaceController extends Controller
|
|||||||
|
|
||||||
$validated = $request->validate(array_merge([
|
$validated = $request->validate(array_merge([
|
||||||
'tab' => ['required', 'string'],
|
'tab' => ['required', 'string'],
|
||||||
], $clinical->validationRules('maternity', 'postnatal_note')));
|
], $clinical->validationRules('womens_health', 'postnatal_note')));
|
||||||
|
|
||||||
$record = $clinical->upsert(
|
$record = $clinical->upsert(
|
||||||
$organization,
|
$organization,
|
||||||
$visit,
|
$visit,
|
||||||
'maternity',
|
'womens_health',
|
||||||
'postnatal_note',
|
'postnatal_note',
|
||||||
$clinical->payloadFromRequest($validated),
|
$clinical->payloadFromRequest($validated),
|
||||||
$owner,
|
$owner,
|
||||||
$owner,
|
$owner,
|
||||||
MaternityWorkflowService::STAGE_POSTNATAL,
|
WomensHealthWorkflowService::STAGE_POSTNATAL,
|
||||||
SpecialtyClinicalRecord::STATUS_COMPLETED,
|
SpecialtyClinicalRecord::STATUS_COMPLETED,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -118,8 +118,8 @@ class MaternityWorkspaceController extends Controller
|
|||||||
$stages->setStage(
|
$stages->setStage(
|
||||||
$organization,
|
$organization,
|
||||||
$visit,
|
$visit,
|
||||||
'maternity',
|
'womens_health',
|
||||||
MaternityWorkflowService::STAGE_POSTNATAL,
|
WomensHealthWorkflowService::STAGE_POSTNATAL,
|
||||||
$owner,
|
$owner,
|
||||||
$owner,
|
$owner,
|
||||||
);
|
);
|
||||||
@@ -131,8 +131,8 @@ class MaternityWorkspaceController extends Controller
|
|||||||
$stages->setStage(
|
$stages->setStage(
|
||||||
$organization,
|
$organization,
|
||||||
$visit,
|
$visit,
|
||||||
'maternity',
|
'womens_health',
|
||||||
MaternityWorkflowService::STAGE_COMPLETED,
|
WomensHealthWorkflowService::STAGE_COMPLETED,
|
||||||
$owner,
|
$owner,
|
||||||
$owner,
|
$owner,
|
||||||
);
|
);
|
||||||
@@ -157,7 +157,7 @@ class MaternityWorkspaceController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
return redirect()
|
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.');
|
->with('success', 'Delivery / postnatal note saved.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,10 +165,10 @@ class MaternityWorkspaceController extends Controller
|
|||||||
Request $request,
|
Request $request,
|
||||||
SpecialtyModuleService $modules,
|
SpecialtyModuleService $modules,
|
||||||
SpecialtyShellService $shell,
|
SpecialtyShellService $shell,
|
||||||
MaternityAnalyticsService $analytics,
|
WomensHealthAnalyticsService $analytics,
|
||||||
): View {
|
): View {
|
||||||
$this->authorizeAbility($request, 'consultations.view');
|
$this->authorizeAbility($request, 'consultations.view');
|
||||||
$this->assertMaternityAccess($request, $modules);
|
$this->assertWomensHealthAccess($request, $modules);
|
||||||
|
|
||||||
$organization = $this->organization($request);
|
$organization = $this->organization($request);
|
||||||
$branchScope = app(\App\Services\Care\OrganizationResolver::class)->branchScope($this->member($request));
|
$branchScope = app(\App\Services\Care\OrganizationResolver::class)->branchScope($this->member($request));
|
||||||
@@ -181,10 +181,10 @@ class MaternityWorkspaceController extends Controller
|
|||||||
$request->query('to'),
|
$request->query('to'),
|
||||||
);
|
);
|
||||||
|
|
||||||
return view('care.specialty.maternity.reports', [
|
return view('care.specialty.womens_health.reports', [
|
||||||
'moduleKey' => 'maternity',
|
'moduleKey' => 'womens_health',
|
||||||
'definition' => $modules->definition('maternity'),
|
'definition' => $modules->definition('womens_health'),
|
||||||
'shellNav' => $shell->navItems('maternity'),
|
'shellNav' => $shell->navItems('womens_health'),
|
||||||
'report' => $report,
|
'report' => $report,
|
||||||
'currency' => strtoupper((string) config('care.billing.currency', config('care.currency', 'GHS'))),
|
'currency' => strtoupper((string) config('care.billing.currency', config('care.currency', 'GHS'))),
|
||||||
]);
|
]);
|
||||||
@@ -197,20 +197,20 @@ class MaternityWorkspaceController extends Controller
|
|||||||
SpecialtyClinicalRecordService $clinical,
|
SpecialtyClinicalRecordService $clinical,
|
||||||
): View {
|
): View {
|
||||||
$this->authorizeAbility($request, 'consultations.view');
|
$this->authorizeAbility($request, 'consultations.view');
|
||||||
$this->assertMaternityAccess($request, $modules);
|
$this->assertWomensHealthAccess($request, $modules);
|
||||||
$this->assertVisit($request, $visit);
|
$this->assertVisit($request, $visit);
|
||||||
|
|
||||||
$visit->loadMissing(['patient', 'appointment.practitioner', 'branch']);
|
$visit->loadMissing(['patient', 'appointment.practitioner', 'branch']);
|
||||||
|
|
||||||
return view('care.specialty.maternity.print', [
|
return view('care.specialty.womens_health.print', [
|
||||||
'visit' => $visit,
|
'visit' => $visit,
|
||||||
'patient' => $visit->patient,
|
'patient' => $visit->patient,
|
||||||
'history' => $clinical->findForVisit($visit, 'maternity', 'anc_history'),
|
'history' => $clinical->findForVisit($visit, 'womens_health', 'anc_history'),
|
||||||
'exam' => $clinical->findForVisit($visit, 'maternity', 'obstetric_exam'),
|
'exam' => $clinical->findForVisit($visit, 'womens_health', 'obstetric_exam'),
|
||||||
'fetal' => $clinical->findForVisit($visit, 'maternity', 'fetal_notes'),
|
'fetal' => $clinical->findForVisit($visit, 'womens_health', 'fetal_notes'),
|
||||||
'investigation' => $clinical->findForVisit($visit, 'maternity', 'mat_investigation'),
|
'investigation' => $clinical->findForVisit($visit, 'womens_health', 'mat_investigation'),
|
||||||
'plan' => $clinical->findForVisit($visit, 'maternity', 'mat_plan'),
|
'plan' => $clinical->findForVisit($visit, 'womens_health', 'mat_plan'),
|
||||||
'postnatal' => $clinical->findForVisit($visit, 'maternity', 'postnatal_note'),
|
'postnatal' => $clinical->findForVisit($visit, 'womens_health', 'postnatal_note'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,11 @@ class CarePermissions
|
|||||||
'dentist' => ['dentistry'],
|
'dentist' => ['dentistry'],
|
||||||
'psychiatrist' => ['psychiatry'],
|
'psychiatrist' => ['psychiatry'],
|
||||||
'physiotherapist' => ['physiotherapy'],
|
'physiotherapist' => ['physiotherapy'],
|
||||||
'midwife' => ['maternity'],
|
'midwife' => ['womens_health'],
|
||||||
|
'obstetrician' => ['womens_health'],
|
||||||
|
'gynecologist' => ['womens_health'],
|
||||||
|
'obgyn' => ['womens_health'],
|
||||||
|
'labour_ward_nurse' => ['womens_health'],
|
||||||
'pediatrician' => ['pediatrics'],
|
'pediatrician' => ['pediatrics'],
|
||||||
'oncologist' => ['oncology', 'infusion'],
|
'oncologist' => ['oncology', 'infusion'],
|
||||||
'cardiologist' => ['cardiology'],
|
'cardiologist' => ['cardiology'],
|
||||||
@@ -70,6 +74,8 @@ class CarePermissions
|
|||||||
'orthopedist' => ['orthopedics'],
|
'orthopedist' => ['orthopedics'],
|
||||||
'podiatrist' => ['podiatry'],
|
'podiatrist' => ['podiatry'],
|
||||||
'fertility_specialist' => ['fertility'],
|
'fertility_specialist' => ['fertility'],
|
||||||
|
'embryologist' => ['fertility'],
|
||||||
|
'fertility_nurse' => ['fertility'],
|
||||||
'dialysis_nurse' => ['renal'],
|
'dialysis_nurse' => ['renal'],
|
||||||
'ambulance_staff' => ['ambulance', 'emergency'],
|
'ambulance_staff' => ['ambulance', 'emergency'],
|
||||||
'receptionist' => [], // refer only — see roleReferApps
|
'receptionist' => [], // refer only — see roleReferApps
|
||||||
@@ -77,7 +83,7 @@ class CarePermissions
|
|||||||
'cashier' => [],
|
'cashier' => [],
|
||||||
'accountant' => [],
|
'accountant' => [],
|
||||||
'department_manager' => null, // department analytics — all enabled modules view
|
'department_manager' => null, // department analytics — all enabled modules view
|
||||||
'nurse' => ['vaccination', 'child_welfare', 'infusion', 'maternity'],
|
'nurse' => ['vaccination', 'child_welfare', 'infusion', 'womens_health'],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,21 +94,25 @@ class CarePermissions
|
|||||||
*/
|
*/
|
||||||
protected array $roleReferApps = [
|
protected array $roleReferApps = [
|
||||||
'general_physician' => [
|
'general_physician' => [
|
||||||
'dentistry', 'physiotherapy', 'maternity', 'psychiatry', 'orthopedics',
|
'dentistry', 'physiotherapy', 'womens_health', 'psychiatry', 'orthopedics',
|
||||||
'oncology', 'renal', 'surgery', 'radiology', 'pathology', 'blood_bank',
|
'oncology', 'renal', 'surgery', 'radiology', 'pathology', 'blood_bank',
|
||||||
'infusion', 'podiatry', 'fertility', 'ambulance',
|
'infusion', 'podiatry', 'fertility', 'ambulance',
|
||||||
],
|
],
|
||||||
'doctor' => [
|
'doctor' => [
|
||||||
'dentistry', 'physiotherapy', 'maternity', 'psychiatry', 'orthopedics',
|
'dentistry', 'physiotherapy', 'womens_health', 'psychiatry', 'orthopedics',
|
||||||
'oncology', 'renal', 'surgery', 'radiology', 'pathology', 'blood_bank',
|
'oncology', 'renal', 'surgery', 'radiology', 'pathology', 'blood_bank',
|
||||||
'infusion', 'podiatry', 'fertility', 'ambulance',
|
'infusion', 'podiatry', 'fertility', 'ambulance',
|
||||||
],
|
],
|
||||||
'nurse' => ['emergency', 'pediatrics', 'blood_bank'],
|
'nurse' => ['emergency', 'pediatrics', 'blood_bank'],
|
||||||
'pharmacist' => ['oncology', 'infusion', 'maternity', 'emergency'],
|
'pharmacist' => ['oncology', 'infusion', 'womens_health', 'emergency'],
|
||||||
'receptionist' => [
|
'receptionist' => [
|
||||||
'emergency', 'pediatrics', 'vaccination', 'child_welfare', 'dentistry',
|
'emergency', 'pediatrics', 'vaccination', 'child_welfare', 'dentistry',
|
||||||
'maternity', 'ambulance', 'ophthalmology', 'physiotherapy',
|
'womens_health', 'ambulance', 'ophthalmology', 'physiotherapy',
|
||||||
],
|
],
|
||||||
|
'obstetrician' => ['fertility'],
|
||||||
|
'gynecologist' => ['fertility'],
|
||||||
|
'obgyn' => ['fertility'],
|
||||||
|
'midwife' => ['fertility'],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -115,7 +125,7 @@ class CarePermissions
|
|||||||
'lab_technician' => ['radiology'],
|
'lab_technician' => ['radiology'],
|
||||||
'lab_manager' => ['radiology'],
|
'lab_manager' => ['radiology'],
|
||||||
'pathologist' => ['blood_bank'],
|
'pathologist' => ['blood_bank'],
|
||||||
'pharmacist' => ['oncology', 'infusion', 'maternity', 'emergency'],
|
'pharmacist' => ['oncology', 'infusion', 'womens_health', 'emergency'],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -284,7 +294,45 @@ class CarePermissions
|
|||||||
'consultations.view', 'consultations.manage',
|
'consultations.view', 'consultations.manage',
|
||||||
'vitals.manage',
|
'vitals.manage',
|
||||||
'assessments.view', 'assessments.capture', 'assessments.manage',
|
'assessments.view', 'assessments.capture', 'assessments.manage',
|
||||||
'maternity.view', 'maternity.manage',
|
'womens_health.view', 'womens_health.manage',
|
||||||
|
'service_queues.console',
|
||||||
|
],
|
||||||
|
'obstetrician' => [
|
||||||
|
'dashboard.view', 'patients.view', 'appointments.view',
|
||||||
|
'consultations.view', 'consultations.manage',
|
||||||
|
'investigations.request', 'prescriptions.manage',
|
||||||
|
'vitals.manage',
|
||||||
|
'assessments.view', 'assessments.capture', 'assessments.manage',
|
||||||
|
'pathways.manage',
|
||||||
|
'womens_health.view', 'womens_health.manage',
|
||||||
|
'service_queues.console',
|
||||||
|
],
|
||||||
|
'gynecologist' => [
|
||||||
|
'dashboard.view', 'patients.view', 'appointments.view',
|
||||||
|
'consultations.view', 'consultations.manage',
|
||||||
|
'investigations.request', 'prescriptions.manage',
|
||||||
|
'vitals.manage',
|
||||||
|
'assessments.view', 'assessments.capture', 'assessments.manage',
|
||||||
|
'pathways.manage',
|
||||||
|
'womens_health.view', 'womens_health.manage',
|
||||||
|
'service_queues.console',
|
||||||
|
],
|
||||||
|
'obgyn' => [
|
||||||
|
'dashboard.view', 'patients.view', 'appointments.view',
|
||||||
|
'consultations.view', 'consultations.manage',
|
||||||
|
'investigations.request', 'prescriptions.manage',
|
||||||
|
'vitals.manage',
|
||||||
|
'assessments.view', 'assessments.capture', 'assessments.manage',
|
||||||
|
'pathways.manage',
|
||||||
|
'womens_health.view', 'womens_health.manage',
|
||||||
|
'service_queues.console',
|
||||||
|
],
|
||||||
|
'labour_ward_nurse' => [
|
||||||
|
'dashboard.view', 'patients.view', 'appointments.view',
|
||||||
|
'consultations.view',
|
||||||
|
'vitals.manage',
|
||||||
|
'assessments.view', 'assessments.capture',
|
||||||
|
'womens_health.view', 'womens_health.manage',
|
||||||
'service_queues.console',
|
'service_queues.console',
|
||||||
],
|
],
|
||||||
'pediatrician' => [
|
'pediatrician' => [
|
||||||
@@ -378,6 +426,20 @@ class CarePermissions
|
|||||||
'fertility.view', 'fertility.manage',
|
'fertility.view', 'fertility.manage',
|
||||||
'service_queues.console',
|
'service_queues.console',
|
||||||
],
|
],
|
||||||
|
'embryologist' => [
|
||||||
|
'dashboard.view', 'patients.view', 'appointments.view',
|
||||||
|
'consultations.view',
|
||||||
|
'fertility.view', 'fertility.manage',
|
||||||
|
'service_queues.console',
|
||||||
|
],
|
||||||
|
'fertility_nurse' => [
|
||||||
|
'dashboard.view', 'patients.view', 'appointments.view',
|
||||||
|
'consultations.view',
|
||||||
|
'vitals.manage',
|
||||||
|
'assessments.view', 'assessments.capture',
|
||||||
|
'fertility.view', 'fertility.manage',
|
||||||
|
'service_queues.console',
|
||||||
|
],
|
||||||
'dialysis_nurse' => [
|
'dialysis_nurse' => [
|
||||||
'dashboard.view', 'patients.view', 'appointments.view',
|
'dashboard.view', 'patients.view', 'appointments.view',
|
||||||
'consultations.view',
|
'consultations.view',
|
||||||
@@ -443,9 +505,10 @@ class CarePermissions
|
|||||||
'lab_technician', 'lab_manager', 'pathologist',
|
'lab_technician', 'lab_manager', 'pathologist',
|
||||||
'blood_bank_officer', 'blood_bank_manager',
|
'blood_bank_officer', 'blood_bank_manager',
|
||||||
'pharmacist', 'dentist', 'psychiatrist', 'physiotherapist',
|
'pharmacist', 'dentist', 'psychiatrist', 'physiotherapist',
|
||||||
'midwife', 'pediatrician', 'oncologist',
|
'midwife', 'obstetrician', 'gynecologist', 'obgyn', 'labour_ward_nurse',
|
||||||
|
'pediatrician', 'oncologist',
|
||||||
'cardiologist', 'ent_specialist', 'dermatologist', 'ophthalmologist',
|
'cardiologist', 'ent_specialist', 'dermatologist', 'ophthalmologist',
|
||||||
'orthopedist', 'podiatrist', 'fertility_specialist',
|
'orthopedist', 'podiatrist', 'fertility_specialist', 'embryologist', 'fertility_nurse',
|
||||||
'dialysis_nurse', 'ambulance_staff', 'receptionist', 'cashier', 'billing_officer',
|
'dialysis_nurse', 'ambulance_staff', 'receptionist', 'cashier', 'billing_officer',
|
||||||
'nurse',
|
'nurse',
|
||||||
];
|
];
|
||||||
@@ -454,9 +517,10 @@ class CarePermissions
|
|||||||
protected array $clinicalPractitionerRoles = [
|
protected array $clinicalPractitionerRoles = [
|
||||||
'emergency_physician', 'general_physician', 'doctor', 'surgeon',
|
'emergency_physician', 'general_physician', 'doctor', 'surgeon',
|
||||||
'radiologist', 'pathologist', 'dentist', 'psychiatrist',
|
'radiologist', 'pathologist', 'dentist', 'psychiatrist',
|
||||||
'physiotherapist', 'midwife', 'pediatrician', 'oncologist',
|
'physiotherapist', 'midwife', 'obstetrician', 'gynecologist', 'obgyn',
|
||||||
|
'labour_ward_nurse', 'pediatrician', 'oncologist',
|
||||||
'cardiologist', 'ent_specialist', 'dermatologist', 'ophthalmologist',
|
'cardiologist', 'ent_specialist', 'dermatologist', 'ophthalmologist',
|
||||||
'orthopedist', 'podiatrist', 'fertility_specialist',
|
'orthopedist', 'podiatrist', 'fertility_specialist', 'embryologist', 'fertility_nurse',
|
||||||
'ed_nurse', 'theatre_nurse', 'dialysis_nurse', 'ambulance_staff',
|
'ed_nurse', 'theatre_nurse', 'dialysis_nurse', 'ambulance_staff',
|
||||||
'radiographer', 'lab_technician', 'lab_manager',
|
'radiographer', 'lab_technician', 'lab_manager',
|
||||||
'blood_bank_officer', 'blood_bank_manager', 'pharmacist', 'nurse',
|
'blood_bank_officer', 'blood_bank_manager', 'pharmacist', 'nurse',
|
||||||
@@ -650,8 +714,9 @@ class CarePermissions
|
|||||||
'emergency_physician', 'general_physician', 'doctor', 'surgeon',
|
'emergency_physician', 'general_physician', 'doctor', 'surgeon',
|
||||||
'radiologist', 'pathologist', 'dentist', 'psychiatrist',
|
'radiologist', 'pathologist', 'dentist', 'psychiatrist',
|
||||||
'pediatrician', 'oncologist', 'physiotherapist', 'midwife',
|
'pediatrician', 'oncologist', 'physiotherapist', 'midwife',
|
||||||
|
'obstetrician', 'gynecologist', 'obgyn', 'fertility_specialist',
|
||||||
'cardiologist', 'ent_specialist', 'dermatologist', 'ophthalmologist',
|
'cardiologist', 'ent_specialist', 'dermatologist', 'ophthalmologist',
|
||||||
'orthopedist', 'podiatrist', 'fertility_specialist',
|
'orthopedist', 'podiatrist',
|
||||||
], true);
|
], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -866,7 +866,7 @@ class DemoTenantSeeder
|
|||||||
'dentistry' => ['Toothache', 'Dental cleaning', 'Extraction review'],
|
'dentistry' => ['Toothache', 'Dental cleaning', 'Extraction review'],
|
||||||
'ophthalmology' => ['Blurry vision', 'Eye exam', 'Contact lens fitting'],
|
'ophthalmology' => ['Blurry vision', 'Eye exam', 'Contact lens fitting'],
|
||||||
'physiotherapy' => ['Back pain rehab', 'Post-injury physio', 'Mobility session'],
|
'physiotherapy' => ['Back pain rehab', 'Post-injury physio', 'Mobility session'],
|
||||||
'maternity' => ['Antenatal visit', 'Pregnancy check', 'Postnatal review'],
|
'womens_health' => ['Antenatal visit', 'Pregnancy check', 'Postnatal review'],
|
||||||
'radiology' => ['X-ray referral', 'Ultrasound', 'Imaging review'],
|
'radiology' => ['X-ray referral', 'Ultrasound', 'Imaging review'],
|
||||||
'cardiology' => ['Chest pain review', 'ECG follow-up', 'Hypertension clinic'],
|
'cardiology' => ['Chest pain review', 'ECG follow-up', 'Hypertension clinic'],
|
||||||
'psychiatry' => ['Mental health review', 'Counselling session', 'Medication review'],
|
'psychiatry' => ['Mental health review', 'Counselling session', 'Medication review'],
|
||||||
@@ -1400,7 +1400,7 @@ class DemoTenantSeeder
|
|||||||
|
|
||||||
$departmentIds = Department::owned($ownerRef)
|
$departmentIds = Department::owned($ownerRef)
|
||||||
->whereIn('branch_id', $branchIds)
|
->whereIn('branch_id', $branchIds)
|
||||||
->where('type', 'maternity')
|
->where('type', 'womens_health')
|
||||||
->where('is_active', true)
|
->where('is_active', true)
|
||||||
->pluck('id');
|
->pluck('id');
|
||||||
|
|
||||||
@@ -1435,7 +1435,7 @@ class DemoTenantSeeder
|
|||||||
$clinical->upsert(
|
$clinical->upsert(
|
||||||
$organization,
|
$organization,
|
||||||
$visit,
|
$visit,
|
||||||
'maternity',
|
'womens_health',
|
||||||
'anc_history',
|
'anc_history',
|
||||||
[
|
[
|
||||||
'gravida' => $highRisk ? 3 : 1,
|
'gravida' => $highRisk ? 3 : 1,
|
||||||
@@ -1458,7 +1458,7 @@ class DemoTenantSeeder
|
|||||||
$clinical->upsert(
|
$clinical->upsert(
|
||||||
$organization,
|
$organization,
|
||||||
$visit,
|
$visit,
|
||||||
'maternity',
|
'womens_health',
|
||||||
'obstetric_exam',
|
'obstetric_exam',
|
||||||
[
|
[
|
||||||
'bp' => $highRisk ? '158/102' : '118/74',
|
'bp' => $highRisk ? '158/102' : '118/74',
|
||||||
@@ -1483,7 +1483,7 @@ class DemoTenantSeeder
|
|||||||
$clinical->upsert(
|
$clinical->upsert(
|
||||||
$organization,
|
$organization,
|
||||||
$visit,
|
$visit,
|
||||||
'maternity',
|
'womens_health',
|
||||||
'fetal_notes',
|
'fetal_notes',
|
||||||
[
|
[
|
||||||
'fetal_heart_rate' => $highRisk ? 168 : 142,
|
'fetal_heart_rate' => $highRisk ? 168 : 142,
|
||||||
@@ -1502,7 +1502,7 @@ class DemoTenantSeeder
|
|||||||
$clinical->upsert(
|
$clinical->upsert(
|
||||||
$organization,
|
$organization,
|
||||||
$visit,
|
$visit,
|
||||||
'maternity',
|
'womens_health',
|
||||||
'mat_plan',
|
'mat_plan',
|
||||||
[
|
[
|
||||||
'risk_category' => 'High risk',
|
'risk_category' => 'High risk',
|
||||||
|
|||||||
@@ -53,10 +53,16 @@ class SpecialtyClinicalRecordService
|
|||||||
|
|
||||||
public function findForVisit(Visit $visit, string $moduleKey, string $recordType): ?SpecialtyClinicalRecord
|
public function findForVisit(Visit $visit, string $moduleKey, string $recordType): ?SpecialtyClinicalRecord
|
||||||
{
|
{
|
||||||
|
$keys = [$moduleKey];
|
||||||
|
if ($moduleKey === 'womens_health') {
|
||||||
|
$keys[] = 'maternity'; // legacy clinical rows
|
||||||
|
}
|
||||||
|
|
||||||
return SpecialtyClinicalRecord::owned($visit->owner_ref)
|
return SpecialtyClinicalRecord::owned($visit->owner_ref)
|
||||||
->where('visit_id', $visit->id)
|
->where('visit_id', $visit->id)
|
||||||
->where('module_key', $moduleKey)
|
->whereIn('module_key', $keys)
|
||||||
->where('record_type', $recordType)
|
->where('record_type', $recordType)
|
||||||
|
->orderByDesc('id')
|
||||||
->first();
|
->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,7 +320,7 @@ class SpecialtyClinicalRecordService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($moduleKey === 'maternity' && $recordType === 'obstetric_exam') {
|
if ($moduleKey === 'womens_health' && $recordType === 'obstetric_exam') {
|
||||||
$danger = trim((string) ($payload['danger_signs'] ?? ''));
|
$danger = trim((string) ($payload['danger_signs'] ?? ''));
|
||||||
if ($danger !== '') {
|
if ($danger !== '') {
|
||||||
$alerts[] = [
|
$alerts[] = [
|
||||||
@@ -343,7 +349,7 @@ class SpecialtyClinicalRecordService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($moduleKey === 'maternity' && $recordType === 'fetal_notes') {
|
if ($moduleKey === 'womens_health' && $recordType === 'fetal_notes') {
|
||||||
$fhr = isset($payload['fetal_heart_rate']) ? (int) $payload['fetal_heart_rate'] : null;
|
$fhr = isset($payload['fetal_heart_rate']) ? (int) $payload['fetal_heart_rate'] : null;
|
||||||
if ($fhr !== null && ($fhr < 110 || $fhr > 160)) {
|
if ($fhr !== null && ($fhr < 110 || $fhr > 160)) {
|
||||||
$alerts[] = [
|
$alerts[] = [
|
||||||
@@ -362,7 +368,7 @@ class SpecialtyClinicalRecordService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($moduleKey === 'maternity' && $recordType === 'mat_plan') {
|
if ($moduleKey === 'womens_health' && $recordType === 'mat_plan') {
|
||||||
$risk = strtolower((string) ($payload['risk_category'] ?? ''));
|
$risk = strtolower((string) ($payload['risk_category'] ?? ''));
|
||||||
if (str_contains($risk, 'high')) {
|
if (str_contains($risk, 'high')) {
|
||||||
$alerts[] = [
|
$alerts[] = [
|
||||||
|
|||||||
@@ -45,13 +45,160 @@ class SpecialtyModuleService
|
|||||||
return config('care.specialty_modules', []);
|
return config('care.specialty_modules', []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legacy maternity module key → womens_health.
|
||||||
|
*/
|
||||||
|
public function normalizeKey(string $key): string
|
||||||
|
{
|
||||||
|
return $key === 'maternity' ? 'womens_health' : $key;
|
||||||
|
}
|
||||||
|
|
||||||
public function definition(string $key): ?array
|
public function definition(string $key): ?array
|
||||||
{
|
{
|
||||||
|
$key = $this->normalizeKey($key);
|
||||||
$catalog = $this->catalog();
|
$catalog = $this->catalog();
|
||||||
|
|
||||||
return $catalog[$key] ?? null;
|
return $catalog[$key] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrate org settings from maternity → womens_health (idempotent).
|
||||||
|
*/
|
||||||
|
public function migrateMaternityToWomensHealth(Organization $organization): Organization
|
||||||
|
{
|
||||||
|
$settings = is_array($organization->settings) ? $organization->settings : [];
|
||||||
|
$modules = is_array($settings['specialty_modules'] ?? null) ? $settings['specialty_modules'] : [];
|
||||||
|
$provisioning = is_array($settings['specialty_module_provisioning'] ?? null)
|
||||||
|
? $settings['specialty_module_provisioning']
|
||||||
|
: [];
|
||||||
|
|
||||||
|
$changed = false;
|
||||||
|
if (! empty($modules['maternity']) && empty($modules['womens_health'])) {
|
||||||
|
$modules['womens_health'] = true;
|
||||||
|
$modules['maternity'] = false;
|
||||||
|
$changed = true;
|
||||||
|
}
|
||||||
|
if (isset($provisioning['maternity']) && ! isset($provisioning['womens_health'])) {
|
||||||
|
$provisioning['womens_health'] = $provisioning['maternity'];
|
||||||
|
unset($provisioning['maternity']);
|
||||||
|
$changed = true;
|
||||||
|
} elseif (isset($provisioning['maternity']) && isset($provisioning['womens_health'])) {
|
||||||
|
unset($provisioning['maternity']);
|
||||||
|
$changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $changed) {
|
||||||
|
return $organization;
|
||||||
|
}
|
||||||
|
|
||||||
|
$settings['specialty_modules'] = $modules;
|
||||||
|
$settings['specialty_module_provisioning'] = $provisioning;
|
||||||
|
$organization->update(['settings' => $settings]);
|
||||||
|
|
||||||
|
// Point legacy maternity departments at the new type when still labeled maternity.
|
||||||
|
Department::query()
|
||||||
|
->where('organization_id', $organization->id)
|
||||||
|
->where('type', 'maternity')
|
||||||
|
->update(['type' => 'womens_health']);
|
||||||
|
|
||||||
|
return $organization->fresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, array{label: string, default_on: bool}>
|
||||||
|
*/
|
||||||
|
public function serviceLines(string $moduleKey): array
|
||||||
|
{
|
||||||
|
$definition = $this->definition($moduleKey);
|
||||||
|
$lines = $definition['service_lines'] ?? [];
|
||||||
|
if (! is_array($lines)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$out = [];
|
||||||
|
foreach ($lines as $key => $line) {
|
||||||
|
if (! is_string($key) || ! is_array($line)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$out[$key] = [
|
||||||
|
'label' => (string) ($line['label'] ?? $key),
|
||||||
|
'default_on' => (bool) ($line['default_on'] ?? true),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enabled service lines for an org module (defaults when unset).
|
||||||
|
*
|
||||||
|
* @return array<string, bool>
|
||||||
|
*/
|
||||||
|
public function enabledServiceLines(Organization $organization, string $moduleKey): array
|
||||||
|
{
|
||||||
|
$moduleKey = $this->normalizeKey($moduleKey);
|
||||||
|
$catalog = $this->serviceLines($moduleKey);
|
||||||
|
if ($catalog === []) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$stored = data_get(
|
||||||
|
$organization->settings,
|
||||||
|
"specialty_module_provisioning.{$moduleKey}.service_lines",
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
$stored = is_array($stored) ? $stored : [];
|
||||||
|
|
||||||
|
$out = [];
|
||||||
|
foreach ($catalog as $key => $line) {
|
||||||
|
$out[$key] = array_key_exists($key, $stored)
|
||||||
|
? (bool) $stored[$key]
|
||||||
|
: $line['default_on'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, bool> $desired
|
||||||
|
*/
|
||||||
|
public function syncServiceLines(Organization $organization, string $moduleKey, array $desired): void
|
||||||
|
{
|
||||||
|
$moduleKey = $this->normalizeKey($moduleKey);
|
||||||
|
$catalog = $this->serviceLines($moduleKey);
|
||||||
|
abort_unless($catalog !== [], 404);
|
||||||
|
|
||||||
|
$settings = is_array($organization->settings) ? $organization->settings : [];
|
||||||
|
$provisioning = is_array($settings['specialty_module_provisioning'] ?? null)
|
||||||
|
? $settings['specialty_module_provisioning']
|
||||||
|
: [];
|
||||||
|
$record = is_array($provisioning[$moduleKey] ?? null) ? $provisioning[$moduleKey] : [];
|
||||||
|
|
||||||
|
$lines = [];
|
||||||
|
foreach (array_keys($catalog) as $key) {
|
||||||
|
$lines[$key] = (bool) ($desired[$key] ?? false);
|
||||||
|
}
|
||||||
|
// Keep at least one line on so the module remains usable.
|
||||||
|
if (! in_array(true, $lines, true)) {
|
||||||
|
$first = array_key_first($catalog);
|
||||||
|
if ($first !== null) {
|
||||||
|
$lines[$first] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$record['service_lines'] = $lines;
|
||||||
|
$provisioning[$moduleKey] = $record;
|
||||||
|
$settings['specialty_module_provisioning'] = $provisioning;
|
||||||
|
$organization->update(['settings' => $settings]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isServiceLineEnabled(Organization $organization, string $moduleKey, string $lineKey): bool
|
||||||
|
{
|
||||||
|
$enabled = $this->enabledServiceLines($organization, $moduleKey);
|
||||||
|
|
||||||
|
return (bool) ($enabled[$lineKey] ?? false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Heroicon-style icon identifier from the specialty catalog (e.g. bolt, heart).
|
* Heroicon-style icon identifier from the specialty catalog (e.g. bolt, heart).
|
||||||
*/
|
*/
|
||||||
@@ -86,10 +233,18 @@ class SpecialtyModuleService
|
|||||||
|
|
||||||
public function isEnabled(Organization $organization, string $key): bool
|
public function isEnabled(Organization $organization, string $key): bool
|
||||||
{
|
{
|
||||||
|
$key = $this->normalizeKey($key);
|
||||||
|
|
||||||
if (! $this->definition($key)) {
|
if (! $this->definition($key)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// One-time maternity → womens_health settings migration.
|
||||||
|
if ($key === 'womens_health'
|
||||||
|
&& data_get($organization->settings, 'specialty_modules.maternity')) {
|
||||||
|
$organization = $this->migrateMaternityToWomensHealth($organization);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->isDefaultOnPaidPlans($key) && $this->plans->hasPaidPlan($organization)) {
|
if ($this->isDefaultOnPaidPlans($key) && $this->plans->hasPaidPlan($organization)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -245,6 +400,7 @@ class SpecialtyModuleService
|
|||||||
*/
|
*/
|
||||||
public function memberAccessLevel(Organization $organization, ?Member $member, string $key): string
|
public function memberAccessLevel(Organization $organization, ?Member $member, string $key): string
|
||||||
{
|
{
|
||||||
|
$key = $this->normalizeKey($key);
|
||||||
$cacheKey = $organization->id.'|'.($member?->id ?? 'guest').'|'.$key;
|
$cacheKey = $organization->id.'|'.($member?->id ?? 'guest').'|'.$key;
|
||||||
if (isset($this->memberAccessLevelCache[$cacheKey])) {
|
if (isset($this->memberAccessLevelCache[$cacheKey])) {
|
||||||
return $this->memberAccessLevelCache[$cacheKey];
|
return $this->memberAccessLevelCache[$cacheKey];
|
||||||
@@ -294,6 +450,7 @@ class SpecialtyModuleService
|
|||||||
*/
|
*/
|
||||||
public function memberCanManage(Organization $organization, ?Member $member, string $key): bool
|
public function memberCanManage(Organization $organization, ?Member $member, string $key): bool
|
||||||
{
|
{
|
||||||
|
$key = $this->normalizeKey($key);
|
||||||
if (! $this->isEnabled($organization, $key) || ! $member) {
|
if (! $this->isEnabled($organization, $key) || ! $member) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -358,6 +515,7 @@ class SpecialtyModuleService
|
|||||||
*/
|
*/
|
||||||
public function memberCanView(Organization $organization, ?Member $member, string $key): bool
|
public function memberCanView(Organization $organization, ?Member $member, string $key): bool
|
||||||
{
|
{
|
||||||
|
$key = $this->normalizeKey($key);
|
||||||
if ($this->memberCanManage($organization, $member, $key)
|
if ($this->memberCanManage($organization, $member, $key)
|
||||||
|| $this->memberCanRefer($organization, $member, $key)) {
|
|| $this->memberCanRefer($organization, $member, $key)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -413,6 +571,7 @@ class SpecialtyModuleService
|
|||||||
*/
|
*/
|
||||||
public function memberCanRefer(Organization $organization, ?Member $member, string $key): bool
|
public function memberCanRefer(Organization $organization, ?Member $member, string $key): bool
|
||||||
{
|
{
|
||||||
|
$key = $this->normalizeKey($key);
|
||||||
if ($this->memberCanManage($organization, $member, $key)) {
|
if ($this->memberCanManage($organization, $member, $key)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use App\Services\Care\BloodBank\BloodBankWorkflowService;
|
|||||||
use App\Services\Care\Emergency\EmergencyWorkflowService;
|
use App\Services\Care\Emergency\EmergencyWorkflowService;
|
||||||
use App\Services\Care\Ophthalmology\OphthalmologyWorkflowService;
|
use App\Services\Care\Ophthalmology\OphthalmologyWorkflowService;
|
||||||
use App\Services\Care\Physiotherapy\PhysiotherapyWorkflowService;
|
use App\Services\Care\Physiotherapy\PhysiotherapyWorkflowService;
|
||||||
use App\Services\Care\Maternity\MaternityWorkflowService;
|
use App\Services\Care\WomensHealth\WomensHealthWorkflowService;
|
||||||
use App\Services\Care\Radiology\RadiologyWorkflowService;
|
use App\Services\Care\Radiology\RadiologyWorkflowService;
|
||||||
use App\Services\Care\Cardiology\CardiologyWorkflowService;
|
use App\Services\Care\Cardiology\CardiologyWorkflowService;
|
||||||
use App\Services\Care\Psychiatry\PsychiatryWorkflowService;
|
use App\Services\Care\Psychiatry\PsychiatryWorkflowService;
|
||||||
@@ -48,6 +48,7 @@ class SpecialtyShellService
|
|||||||
*/
|
*/
|
||||||
public function definition(string $moduleKey): array
|
public function definition(string $moduleKey): array
|
||||||
{
|
{
|
||||||
|
$moduleKey = $this->modules->normalizeKey($moduleKey);
|
||||||
$base = $this->modules->definition($moduleKey) ?? [];
|
$base = $this->modules->definition($moduleKey) ?? [];
|
||||||
$shell = config("care_specialty_shell.modules.{$moduleKey}", []);
|
$shell = config("care_specialty_shell.modules.{$moduleKey}", []);
|
||||||
$defaults = config('care_specialty_shell.defaults', []);
|
$defaults = config('care_specialty_shell.defaults', []);
|
||||||
@@ -76,7 +77,7 @@ class SpecialtyShellService
|
|||||||
'blood_bank' => 'care.specialty.blood-bank.stage',
|
'blood_bank' => 'care.specialty.blood-bank.stage',
|
||||||
'ophthalmology' => 'care.specialty.ophthalmology.stage',
|
'ophthalmology' => 'care.specialty.ophthalmology.stage',
|
||||||
'physiotherapy' => 'care.specialty.physiotherapy.stage',
|
'physiotherapy' => 'care.specialty.physiotherapy.stage',
|
||||||
'maternity' => 'care.specialty.maternity.stage',
|
'womens_health' => 'care.specialty.womens_health.stage',
|
||||||
'radiology' => 'care.specialty.radiology.stage',
|
'radiology' => 'care.specialty.radiology.stage',
|
||||||
'cardiology' => 'care.specialty.cardiology.stage',
|
'cardiology' => 'care.specialty.cardiology.stage',
|
||||||
'psychiatry' => 'care.specialty.psychiatry.stage',
|
'psychiatry' => 'care.specialty.psychiatry.stage',
|
||||||
@@ -110,7 +111,7 @@ class SpecialtyShellService
|
|||||||
'blood_bank' => app(BloodBankWorkflowService::class)->stageFlow(),
|
'blood_bank' => app(BloodBankWorkflowService::class)->stageFlow(),
|
||||||
'ophthalmology' => app(OphthalmologyWorkflowService::class)->stageFlow(),
|
'ophthalmology' => app(OphthalmologyWorkflowService::class)->stageFlow(),
|
||||||
'physiotherapy' => app(PhysiotherapyWorkflowService::class)->stageFlow(),
|
'physiotherapy' => app(PhysiotherapyWorkflowService::class)->stageFlow(),
|
||||||
'maternity' => app(MaternityWorkflowService::class)->stageFlow(),
|
'womens_health' => app(WomensHealthWorkflowService::class)->stageFlow(),
|
||||||
'radiology' => app(RadiologyWorkflowService::class)->stageFlow(),
|
'radiology' => app(RadiologyWorkflowService::class)->stageFlow(),
|
||||||
'cardiology' => app(CardiologyWorkflowService::class)->stageFlow(),
|
'cardiology' => app(CardiologyWorkflowService::class)->stageFlow(),
|
||||||
'psychiatry' => app(PsychiatryWorkflowService::class)->stageFlow(),
|
'psychiatry' => app(PsychiatryWorkflowService::class)->stageFlow(),
|
||||||
@@ -179,33 +180,52 @@ class SpecialtyShellService
|
|||||||
/**
|
/**
|
||||||
* Catalog from config (authoritative template).
|
* Catalog from config (authoritative template).
|
||||||
*
|
*
|
||||||
* @return list<array{code: string, label: string, amount_minor: int, type: string}>
|
* @return list<array{code: string, label: string, amount_minor: int, type: string, service_line?: string}>
|
||||||
*/
|
*/
|
||||||
public function catalogServices(string $moduleKey): array
|
public function catalogServices(string $moduleKey, ?Organization $organization = null): array
|
||||||
{
|
{
|
||||||
|
$moduleKey = $this->modules->normalizeKey($moduleKey);
|
||||||
$services = $this->definition($moduleKey)['services'] ?? [];
|
$services = $this->definition($moduleKey)['services'] ?? [];
|
||||||
if (! is_array($services)) {
|
if (! is_array($services)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return array_values(array_map(function ($row) {
|
$enabledLines = $organization
|
||||||
return [
|
? $this->modules->enabledServiceLines($organization, $moduleKey)
|
||||||
|
: [];
|
||||||
|
|
||||||
|
$out = [];
|
||||||
|
foreach ($services as $row) {
|
||||||
|
if (! is_array($row)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$line = isset($row['service_line']) ? (string) $row['service_line'] : '';
|
||||||
|
if ($organization && $enabledLines !== [] && $line !== '') {
|
||||||
|
if (! ($enabledLines[$line] ?? false)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$out[] = [
|
||||||
'code' => (string) ($row['code'] ?? ''),
|
'code' => (string) ($row['code'] ?? ''),
|
||||||
'label' => (string) ($row['label'] ?? ''),
|
'label' => (string) ($row['label'] ?? ''),
|
||||||
'amount_minor' => (int) ($row['amount_minor'] ?? 0),
|
'amount_minor' => (int) ($row['amount_minor'] ?? 0),
|
||||||
'type' => (string) ($row['type'] ?? 'misc'),
|
'type' => (string) ($row['type'] ?? 'misc'),
|
||||||
|
'service_line' => $line,
|
||||||
];
|
];
|
||||||
}, $services));
|
}
|
||||||
|
|
||||||
|
return array_values($out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Seeded services stored on the organization when the module was activated.
|
* Seeded services stored on the organization when the module was activated.
|
||||||
*
|
*
|
||||||
* @return list<array{code: string, label: string, amount_minor: int, type: string}>
|
* @return list<array{code: string, label: string, amount_minor: int, type: string, service_line?: string}>
|
||||||
*/
|
*/
|
||||||
public function provisionedServices(Organization $organization, string $moduleKey): array
|
public function provisionedServices(Organization $organization, string $moduleKey): array
|
||||||
{
|
{
|
||||||
$catalog = collect($this->catalogServices($moduleKey))->keyBy(fn ($s) => (string) ($s['code'] ?? ''));
|
$moduleKey = $this->modules->normalizeKey($moduleKey);
|
||||||
|
$catalog = collect($this->catalogServices($moduleKey, $organization))->keyBy(fn ($s) => (string) ($s['code'] ?? ''));
|
||||||
$stored = data_get($organization->settings, "specialty_module_provisioning.{$moduleKey}.services");
|
$stored = data_get($organization->settings, "specialty_module_provisioning.{$moduleKey}.services");
|
||||||
if (is_array($stored)) {
|
if (is_array($stored)) {
|
||||||
foreach ($stored as $service) {
|
foreach ($stored as $service) {
|
||||||
@@ -213,6 +233,11 @@ class SpecialtyShellService
|
|||||||
if ($code === '') {
|
if ($code === '') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// Skip stored services for disabled service lines.
|
||||||
|
$line = (string) ($service['service_line'] ?? $catalog->get($code)['service_line'] ?? '');
|
||||||
|
if ($line !== '' && ! $this->modules->isServiceLineEnabled($organization, $moduleKey, $line)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$prior = $catalog->get($code, []);
|
$prior = $catalog->get($code, []);
|
||||||
$catalog->put($code, array_merge(is_array($prior) ? $prior : [], $service));
|
$catalog->put($code, array_merge(is_array($prior) ? $prior : [], $service));
|
||||||
}
|
}
|
||||||
@@ -427,7 +452,7 @@ class SpecialtyShellService
|
|||||||
) {
|
) {
|
||||||
$code = (string) ($stage['code'] ?? '');
|
$code = (string) ($stage['code'] ?? '');
|
||||||
|
|
||||||
if (in_array($moduleKey, ['dentistry', 'emergency', 'blood_bank', 'ophthalmology', 'physiotherapy', 'maternity', 'radiology', 'cardiology', 'psychiatry', 'pediatrics', 'orthopedics', 'ent', 'oncology', 'renal', 'surgery', 'vaccination', 'pathology', 'infusion', 'dermatology', 'podiatry', 'fertility', 'child_welfare', 'ambulance'], true) && $visitIds->isNotEmpty()) {
|
if (in_array($moduleKey, ['dentistry', 'emergency', 'blood_bank', 'ophthalmology', 'physiotherapy', 'womens_health', 'radiology', 'cardiology', 'psychiatry', 'pediatrics', 'orthopedics', 'ent', 'oncology', 'renal', 'surgery', 'vaccination', 'pathology', 'infusion', 'dermatology', 'podiatry', 'fertility', 'child_welfare', 'ambulance'], true) && $visitIds->isNotEmpty()) {
|
||||||
$count = Visit::owned($ownerRef)
|
$count = Visit::owned($ownerRef)
|
||||||
->where('organization_id', $organization->id)
|
->where('organization_id', $organization->id)
|
||||||
->whereIn('id', $visitIds)
|
->whereIn('id', $visitIds)
|
||||||
@@ -459,7 +484,7 @@ class SpecialtyShellService
|
|||||||
'blood_bank' => $clinical->countOpenByType($organization, 'blood_bank', 'blood_request', $branchScope),
|
'blood_bank' => $clinical->countOpenByType($organization, 'blood_bank', 'blood_request', $branchScope),
|
||||||
'ophthalmology' => $clinical->countOpenByType($organization, 'ophthalmology', 'eye_exam', $branchScope),
|
'ophthalmology' => $clinical->countOpenByType($organization, 'ophthalmology', 'eye_exam', $branchScope),
|
||||||
'physiotherapy' => $clinical->countOpenByType($organization, 'physiotherapy', 'pt_assessment', $branchScope),
|
'physiotherapy' => $clinical->countOpenByType($organization, 'physiotherapy', 'pt_assessment', $branchScope),
|
||||||
'maternity' => $clinical->countOpenByType($organization, 'maternity', 'anc_history', $branchScope),
|
'womens_health' => $clinical->countOpenByType($organization, 'womens_health', 'anc_history', $branchScope),
|
||||||
'radiology' => $clinical->countOpenByType($organization, 'radiology', 'imaging_request', $branchScope),
|
'radiology' => $clinical->countOpenByType($organization, 'radiology', 'imaging_request', $branchScope),
|
||||||
'cardiology' => $clinical->countOpenByType($organization, 'cardiology', 'cardiac_exam', $branchScope),
|
'cardiology' => $clinical->countOpenByType($organization, 'cardiology', 'cardiac_exam', $branchScope),
|
||||||
'psychiatry' => $clinical->countOpenByType($organization, 'psychiatry', 'mental_status', $branchScope),
|
'psychiatry' => $clinical->countOpenByType($organization, 'psychiatry', 'mental_status', $branchScope),
|
||||||
|
|||||||
@@ -112,11 +112,11 @@ class SpecialtyVisitStageService
|
|||||||
: ($stages[1] ?? ($stages[0] ?? null));
|
: ($stages[1] ?? ($stages[0] ?? null));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($moduleKey === 'maternity') {
|
if ($moduleKey === 'womens_health') {
|
||||||
$stages = $this->allowedStages($moduleKey);
|
$stages = $this->allowedStages($moduleKey);
|
||||||
|
|
||||||
return in_array(\App\Services\Care\Maternity\MaternityWorkflowService::STAGE_HISTORY, $stages, true)
|
return in_array(\App\Services\Care\WomensHealth\WomensHealthWorkflowService::STAGE_HISTORY, $stages, true)
|
||||||
? \App\Services\Care\Maternity\MaternityWorkflowService::STAGE_HISTORY
|
? \App\Services\Care\WomensHealth\WomensHealthWorkflowService::STAGE_HISTORY
|
||||||
: ($stages[1] ?? ($stages[0] ?? null));
|
: ($stages[1] ?? ($stages[0] ?? null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Services\Care\Maternity;
|
namespace App\Services\Care\WomensHealth;
|
||||||
|
|
||||||
use App\Models\Appointment;
|
use App\Models\Appointment;
|
||||||
use App\Models\Bill;
|
use App\Models\Bill;
|
||||||
@@ -12,7 +12,7 @@ use App\Services\Care\SpecialtyShellService;
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
class MaternityAnalyticsService
|
class WomensHealthAnalyticsService
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected SpecialtyShellService $shell,
|
protected SpecialtyShellService $shell,
|
||||||
@@ -42,7 +42,7 @@ class MaternityAnalyticsService
|
|||||||
$rangeFrom = $from ? Carbon::parse($from)->startOfDay() : now()->startOfMonth();
|
$rangeFrom = $from ? Carbon::parse($from)->startOfDay() : now()->startOfMonth();
|
||||||
$rangeTo = $to ? Carbon::parse($to)->endOfDay() : now()->endOfDay();
|
$rangeTo = $to ? Carbon::parse($to)->endOfDay() : now()->endOfDay();
|
||||||
|
|
||||||
$departmentIds = $this->shell->departmentIds($organization, 'maternity', $ownerRef, $branchId);
|
$departmentIds = $this->shell->departmentIds($organization, 'womens_health', $ownerRef, $branchId);
|
||||||
|
|
||||||
$appointmentBase = Appointment::owned($ownerRef)
|
$appointmentBase = Appointment::owned($ownerRef)
|
||||||
->where('organization_id', $organization->id)
|
->where('organization_id', $organization->id)
|
||||||
@@ -69,7 +69,7 @@ class MaternityAnalyticsService
|
|||||||
|
|
||||||
$highRiskOpen = SpecialtyClinicalRecord::owned($ownerRef)
|
$highRiskOpen = SpecialtyClinicalRecord::owned($ownerRef)
|
||||||
->where('organization_id', $organization->id)
|
->where('organization_id', $organization->id)
|
||||||
->where('module_key', 'maternity')
|
->where('module_key', 'womens_health')
|
||||||
->where('record_type', 'mat_plan')
|
->where('record_type', 'mat_plan')
|
||||||
->whereIn('visit_id', $openVisitIds->isEmpty() ? [0] : $openVisitIds)
|
->whereIn('visit_id', $openVisitIds->isEmpty() ? [0] : $openVisitIds)
|
||||||
->get()
|
->get()
|
||||||
@@ -82,7 +82,7 @@ class MaternityAnalyticsService
|
|||||||
|
|
||||||
$planRecords = SpecialtyClinicalRecord::owned($ownerRef)
|
$planRecords = SpecialtyClinicalRecord::owned($ownerRef)
|
||||||
->where('organization_id', $organization->id)
|
->where('organization_id', $organization->id)
|
||||||
->where('module_key', 'maternity')
|
->where('module_key', 'womens_health')
|
||||||
->where('record_type', 'mat_plan')
|
->where('record_type', 'mat_plan')
|
||||||
->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
|
->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
|
||||||
->whereBetween('recorded_at', [$rangeFrom, $rangeTo])
|
->whereBetween('recorded_at', [$rangeFrom, $rangeTo])
|
||||||
@@ -100,7 +100,7 @@ class MaternityAnalyticsService
|
|||||||
|
|
||||||
$postnatalRecords = SpecialtyClinicalRecord::owned($ownerRef)
|
$postnatalRecords = SpecialtyClinicalRecord::owned($ownerRef)
|
||||||
->where('organization_id', $organization->id)
|
->where('organization_id', $organization->id)
|
||||||
->where('module_key', 'maternity')
|
->where('module_key', 'womens_health')
|
||||||
->where('record_type', 'postnatal_note')
|
->where('record_type', 'postnatal_note')
|
||||||
->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
|
->when($branchId, fn ($q) => $q->where('branch_id', $branchId))
|
||||||
->whereBetween('recorded_at', [$rangeFrom, $rangeTo])
|
->whereBetween('recorded_at', [$rangeFrom, $rangeTo])
|
||||||
@@ -132,7 +132,7 @@ class MaternityAnalyticsService
|
|||||||
}), 1);
|
}), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$serviceLabels = collect($this->shell->provisionedServices($organization, 'maternity'))
|
$serviceLabels = collect($this->shell->provisionedServices($organization, 'womens_health'))
|
||||||
->pluck('label')
|
->pluck('label')
|
||||||
->filter()
|
->filter()
|
||||||
->values()
|
->values()
|
||||||
+3
-3
@@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Services\Care\Maternity;
|
namespace App\Services\Care\WomensHealth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map maternity / ANC clinical progress onto visit stages.
|
* Map Women's Health / ANC clinical progress onto visit stages.
|
||||||
*/
|
*/
|
||||||
class MaternityWorkflowService
|
class WomensHealthWorkflowService
|
||||||
{
|
{
|
||||||
public const STAGE_CHECK_IN = 'check_in';
|
public const STAGE_CHECK_IN = 'check_in';
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ final class DemoWorld
|
|||||||
'dentistry' => ['name' => 'Dr. Ama Dental', 'role' => 'dentist'],
|
'dentistry' => ['name' => 'Dr. Ama Dental', 'role' => 'dentist'],
|
||||||
'ophthalmology' => ['name' => 'Dr. Kofi Eye', 'role' => 'doctor'],
|
'ophthalmology' => ['name' => 'Dr. Kofi Eye', 'role' => 'doctor'],
|
||||||
'physiotherapy' => ['name' => 'Dr. Efua Physio', 'role' => 'physiotherapist'],
|
'physiotherapy' => ['name' => 'Dr. Efua Physio', 'role' => 'physiotherapist'],
|
||||||
'maternity' => ['name' => 'Abena Midwife', 'role' => 'midwife'],
|
'womens_health' => ['name' => 'Abena Midwife', 'role' => 'midwife'],
|
||||||
'radiology' => ['name' => 'Dr. Yaw Radiology', 'role' => 'radiologist'],
|
'radiology' => ['name' => 'Dr. Yaw Radiology', 'role' => 'radiologist'],
|
||||||
'cardiology' => ['name' => 'Dr. Kwesi Cardiology', 'role' => 'doctor'],
|
'cardiology' => ['name' => 'Dr. Kwesi Cardiology', 'role' => 'doctor'],
|
||||||
'psychiatry' => ['name' => 'Dr. Adwoa Psychiatry', 'role' => 'psychiatrist'],
|
'psychiatry' => ['name' => 'Dr. Adwoa Psychiatry', 'role' => 'psychiatrist'],
|
||||||
|
|||||||
+13
-4
@@ -24,6 +24,10 @@ return [
|
|||||||
'psychiatrist' => 'Psychiatrist',
|
'psychiatrist' => 'Psychiatrist',
|
||||||
'physiotherapist' => 'Physiotherapist',
|
'physiotherapist' => 'Physiotherapist',
|
||||||
'midwife' => 'Midwife',
|
'midwife' => 'Midwife',
|
||||||
|
'obstetrician' => 'Obstetrician',
|
||||||
|
'gynecologist' => 'Gynecologist',
|
||||||
|
'obgyn' => 'OB/GYN Consultant',
|
||||||
|
'labour_ward_nurse' => 'Labour Ward Nurse',
|
||||||
'pediatrician' => 'Pediatrician',
|
'pediatrician' => 'Pediatrician',
|
||||||
'oncologist' => 'Oncologist',
|
'oncologist' => 'Oncologist',
|
||||||
'cardiologist' => 'Cardiologist',
|
'cardiologist' => 'Cardiologist',
|
||||||
@@ -33,6 +37,8 @@ return [
|
|||||||
'orthopedist' => 'Orthopedist',
|
'orthopedist' => 'Orthopedist',
|
||||||
'podiatrist' => 'Podiatrist',
|
'podiatrist' => 'Podiatrist',
|
||||||
'fertility_specialist' => 'Fertility Specialist',
|
'fertility_specialist' => 'Fertility Specialist',
|
||||||
|
'embryologist' => 'Embryologist',
|
||||||
|
'fertility_nurse' => 'Fertility Nurse',
|
||||||
'dialysis_nurse' => 'Dialysis Nurse',
|
'dialysis_nurse' => 'Dialysis Nurse',
|
||||||
'ambulance_staff' => 'Ambulance Staff',
|
'ambulance_staff' => 'Ambulance Staff',
|
||||||
'nurse' => 'Nurse (legacy)',
|
'nurse' => 'Nurse (legacy)',
|
||||||
@@ -49,7 +55,8 @@ return [
|
|||||||
'laboratory' => 'Laboratory',
|
'laboratory' => 'Laboratory',
|
||||||
'radiology' => 'Radiology',
|
'radiology' => 'Radiology',
|
||||||
'pharmacy' => 'Pharmacy',
|
'pharmacy' => 'Pharmacy',
|
||||||
'maternity' => 'Maternity',
|
'womens_health' => "Women's Health (OB/GYN)",
|
||||||
|
'maternity' => 'Maternity (legacy)',
|
||||||
'dental' => 'Dental',
|
'dental' => 'Dental',
|
||||||
'ophthalmology' => 'Ophthalmology / Eye care',
|
'ophthalmology' => 'Ophthalmology / Eye care',
|
||||||
'physiotherapy' => 'Physiotherapy',
|
'physiotherapy' => 'Physiotherapy',
|
||||||
@@ -67,7 +74,7 @@ return [
|
|||||||
'infusion' => 'Infusion Centre',
|
'infusion' => 'Infusion Centre',
|
||||||
'dermatology' => 'Dermatology',
|
'dermatology' => 'Dermatology',
|
||||||
'podiatry' => 'Podiatry',
|
'podiatry' => 'Podiatry',
|
||||||
'fertility' => 'Fertility',
|
'fertility' => 'Fertility & Reproductive Medicine',
|
||||||
'child_welfare' => 'Child Welfare Clinic',
|
'child_welfare' => 'Child Welfare Clinic',
|
||||||
'ambulance' => 'Ambulance',
|
'ambulance' => 'Ambulance',
|
||||||
],
|
],
|
||||||
@@ -85,7 +92,8 @@ return [
|
|||||||
'Laboratory',
|
'Laboratory',
|
||||||
'Radiology',
|
'Radiology',
|
||||||
'Pharmacy',
|
'Pharmacy',
|
||||||
'Maternity',
|
"Women's Health (OB/GYN)",
|
||||||
|
'Maternity / Labour & Delivery',
|
||||||
'Dentistry',
|
'Dentistry',
|
||||||
'Ophthalmology / Eye care',
|
'Ophthalmology / Eye care',
|
||||||
'Physiotherapy',
|
'Physiotherapy',
|
||||||
@@ -313,7 +321,8 @@ return [
|
|||||||
'specialty_dentistry' => 'Dental document',
|
'specialty_dentistry' => 'Dental document',
|
||||||
'specialty_ophthalmology' => 'Eye care document',
|
'specialty_ophthalmology' => 'Eye care document',
|
||||||
'specialty_physiotherapy' => 'Physiotherapy document',
|
'specialty_physiotherapy' => 'Physiotherapy document',
|
||||||
'specialty_maternity' => 'Maternity document',
|
'specialty_maternity' => "Women's Health document",
|
||||||
|
'specialty_womens_health' => "Women's Health document",
|
||||||
'other' => 'Other',
|
'other' => 'Other',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ return [
|
|||||||
'session' => 'pt_session',
|
'session' => 'pt_session',
|
||||||
'exercises' => 'pt_home_program',
|
'exercises' => 'pt_home_program',
|
||||||
],
|
],
|
||||||
'maternity' => [
|
'womens_health' => [
|
||||||
'history' => 'anc_history',
|
'history' => 'anc_history',
|
||||||
'exam' => 'obstetric_exam',
|
'exam' => 'obstetric_exam',
|
||||||
'fetal' => 'fetal_notes',
|
'fetal' => 'fetal_notes',
|
||||||
@@ -341,7 +341,7 @@ return [
|
|||||||
['name' => 'next_review', 'label' => 'Next review', 'type' => 'text'],
|
['name' => 'next_review', 'label' => 'Next review', 'type' => 'text'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'maternity' => [
|
'womens_health' => [
|
||||||
'anc_history' => [
|
'anc_history' => [
|
||||||
['name' => 'gravida', 'label' => 'Gravida', 'type' => 'number', 'required' => true],
|
['name' => 'gravida', 'label' => 'Gravida', 'type' => 'number', 'required' => true],
|
||||||
['name' => 'para', 'label' => 'Para', 'type' => 'number'],
|
['name' => 'para', 'label' => 'Para', 'type' => 'number'],
|
||||||
|
|||||||
@@ -113,25 +113,44 @@ return [
|
|||||||
'refer_roles' => ['general_physician', 'doctor', 'receptionist'],
|
'refer_roles' => ['general_physician', 'doctor', 'receptionist'],
|
||||||
'specialist_keywords' => ['physio', 'rehab', 'therapy'],
|
'specialist_keywords' => ['physio', 'rehab', 'therapy'],
|
||||||
],
|
],
|
||||||
'maternity' => [
|
'womens_health' => [
|
||||||
'label' => 'Maternity / Antenatal',
|
'label' => "Women's Health (OB/GYN)",
|
||||||
'description' => 'Antenatal clinics, maternity wards, and related queues.',
|
'description' => 'Gynecology, obstetrics, antenatal, labour & delivery, postnatal, and related women\'s health clinics.',
|
||||||
'department_type' => 'maternity',
|
'department_type' => 'womens_health',
|
||||||
'department_name' => 'Maternity',
|
'department_name' => "Women's Health",
|
||||||
'queue_name' => 'Maternity',
|
'queue_name' => "Women's Health",
|
||||||
'queue_prefix' => 'MAT',
|
'queue_prefix' => 'WH',
|
||||||
'nav_label' => 'Maternity',
|
'nav_label' => "Women's Health",
|
||||||
'icon' => 'home',
|
'icon' => 'home',
|
||||||
'queue_keywords' => ['matern', 'antenatal', 'obstetric'],
|
'queue_keywords' => ['women', 'obgyn', 'ob/gyn', 'gynae', 'gynec', 'matern', 'antenatal', 'obstetric', 'labour', 'labor'],
|
||||||
'access' => 'limited',
|
'access' => 'limited',
|
||||||
'roles' => ['midwife', 'nurse'],
|
'roles' => [
|
||||||
|
'obstetrician', 'gynecologist', 'obgyn', 'midwife', 'labour_ward_nurse', 'nurse',
|
||||||
|
],
|
||||||
'view_roles' => [
|
'view_roles' => [
|
||||||
'midwife', 'nurse', 'general_physician', 'doctor', 'pharmacist', 'receptionist',
|
'obstetrician', 'gynecologist', 'obgyn', 'midwife', 'labour_ward_nurse', 'nurse',
|
||||||
|
'general_physician', 'doctor', 'pharmacist', 'receptionist',
|
||||||
],
|
],
|
||||||
'refer_roles' => [
|
'refer_roles' => [
|
||||||
'general_physician', 'doctor', 'pharmacist', 'receptionist',
|
'general_physician', 'doctor', 'pharmacist', 'receptionist',
|
||||||
],
|
],
|
||||||
'specialist_keywords' => ['matern', 'antenatal', 'obstetric', 'midwif'],
|
'specialist_keywords' => [
|
||||||
|
'women', 'obgyn', 'ob/gyn', 'gynae', 'gynecolog', 'obstetric', 'matern', 'antenatal', 'midwif',
|
||||||
|
],
|
||||||
|
// Configurable service lines (Settings → Modules → Women's Health).
|
||||||
|
// All default on so migrated maternity hospitals keep full surface.
|
||||||
|
'service_lines' => [
|
||||||
|
'gynecology' => ['label' => 'Gynecology', 'default_on' => true],
|
||||||
|
'obstetrics' => ['label' => 'Obstetrics', 'default_on' => true],
|
||||||
|
'antenatal' => ['label' => 'Antenatal Clinic', 'default_on' => true],
|
||||||
|
'labour_delivery' => ['label' => 'Labour & Delivery (Maternity)', 'default_on' => true],
|
||||||
|
'postnatal' => ['label' => 'Postnatal Care', 'default_on' => true],
|
||||||
|
'family_planning' => ['label' => 'Family Planning', 'default_on' => true],
|
||||||
|
'cervical_screening' => ['label' => 'Cervical Screening', 'default_on' => true],
|
||||||
|
'menopause' => ['label' => 'Menopause Clinic', 'default_on' => true],
|
||||||
|
'high_risk_pregnancy' => ['label' => 'High-Risk Pregnancy', 'default_on' => true],
|
||||||
|
'early_pregnancy' => ['label' => 'Early Pregnancy Assessment', 'default_on' => true],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'radiology' => [
|
'radiology' => [
|
||||||
'label' => 'Radiology',
|
'label' => 'Radiology',
|
||||||
@@ -415,23 +434,26 @@ return [
|
|||||||
'specialist_keywords' => ['podiat', 'foot'],
|
'specialist_keywords' => ['podiat', 'foot'],
|
||||||
],
|
],
|
||||||
'fertility' => [
|
'fertility' => [
|
||||||
'label' => 'Fertility',
|
'label' => 'Fertility & Reproductive Medicine',
|
||||||
'description' => 'Fertility / IVF clinics and reproductive health queues.',
|
'description' => 'IVF / fertility clinics, embryology, and reproductive medicine queues. Integrates with Women\'s Health via referrals.',
|
||||||
'department_type' => 'fertility',
|
'department_type' => 'fertility',
|
||||||
'department_name' => 'Fertility',
|
'department_name' => 'Fertility',
|
||||||
'queue_name' => 'Fertility',
|
'queue_name' => 'Fertility',
|
||||||
'queue_prefix' => 'FER',
|
'queue_prefix' => 'FER',
|
||||||
'nav_label' => 'Fertility',
|
'nav_label' => 'Fertility',
|
||||||
'icon' => 'sparkles',
|
'icon' => 'sparkles',
|
||||||
'queue_keywords' => ['fertil', 'ivf', 'reproduct'],
|
'queue_keywords' => ['fertil', 'ivf', 'reproduct', 'embryol'],
|
||||||
'access' => 'restricted',
|
'access' => 'restricted',
|
||||||
'roles' => ['fertility_specialist'],
|
'roles' => ['fertility_specialist', 'embryologist', 'fertility_nurse'],
|
||||||
'support_roles' => [],
|
'support_roles' => [],
|
||||||
'view_roles' => [
|
'view_roles' => [
|
||||||
'fertility_specialist', 'general_physician', 'doctor',
|
'fertility_specialist', 'embryologist', 'fertility_nurse',
|
||||||
|
'general_physician', 'doctor', 'obstetrician', 'gynecologist', 'obgyn',
|
||||||
],
|
],
|
||||||
'refer_roles' => ['general_physician', 'doctor'],
|
'refer_roles' => [
|
||||||
'specialist_keywords' => ['fertil', 'ivf', 'reproduct'],
|
'general_physician', 'doctor', 'obstetrician', 'gynecologist', 'obgyn', 'midwife',
|
||||||
|
],
|
||||||
|
'specialist_keywords' => ['fertil', 'ivf', 'reproduct', 'embryol'],
|
||||||
],
|
],
|
||||||
'child_welfare' => [
|
'child_welfare' => [
|
||||||
'label' => 'Child Welfare Clinic',
|
'label' => 'Child Welfare Clinic',
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ return [
|
|||||||
'completed' => 'overview',
|
'completed' => 'overview',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'maternity' => [
|
'womens_health' => [
|
||||||
'stages' => [
|
'stages' => [
|
||||||
['code' => 'check_in', 'label' => 'Check-in', 'queue_point' => 'waiting'],
|
['code' => 'check_in', 'label' => 'Check-in', 'queue_point' => 'waiting'],
|
||||||
['code' => 'history', 'label' => 'ANC history', 'queue_point' => 'waiting'],
|
['code' => 'history', 'label' => 'ANC history', 'queue_point' => 'waiting'],
|
||||||
@@ -261,12 +261,19 @@ return [
|
|||||||
['code' => 'completed', 'label' => 'Completed', 'queue_point' => null],
|
['code' => 'completed', 'label' => 'Completed', 'queue_point' => null],
|
||||||
],
|
],
|
||||||
'services' => [
|
'services' => [
|
||||||
['code' => 'mat.anc', 'label' => 'Antenatal visit', 'amount_minor' => 5000, 'type' => 'consultation'],
|
['code' => 'mat.anc', 'service_line' => 'antenatal', 'label' => 'Antenatal visit', 'amount_minor' => 5000, 'type' => 'consultation'],
|
||||||
['code' => 'mat.history', 'label' => 'Obstetric history intake', 'amount_minor' => 3500, 'type' => 'consultation'],
|
['code' => 'mat.history', 'service_line' => 'antenatal', 'label' => 'Obstetric history intake', 'amount_minor' => 3500, 'type' => 'consultation'],
|
||||||
['code' => 'mat.exam', 'label' => 'Obstetric examination', 'amount_minor' => 4500, 'type' => 'procedure'],
|
['code' => 'mat.exam', 'service_line' => 'obstetrics', 'label' => 'Obstetric examination', 'amount_minor' => 4500, 'type' => 'procedure'],
|
||||||
['code' => 'mat.ultrasound', 'label' => 'Obstetric ultrasound', 'amount_minor' => 12000, 'type' => 'imaging'],
|
['code' => 'mat.ultrasound', 'service_line' => 'obstetrics', 'label' => 'Obstetric ultrasound', 'amount_minor' => 12000, 'type' => 'imaging'],
|
||||||
['code' => 'mat.labs', 'label' => 'ANC investigations panel', 'amount_minor' => 8000, 'type' => 'procedure'],
|
['code' => 'mat.labs', 'service_line' => 'antenatal', 'label' => 'ANC investigations panel', 'amount_minor' => 8000, 'type' => 'procedure'],
|
||||||
['code' => 'mat.postnatal', 'label' => 'Postnatal review', 'amount_minor' => 5000, 'type' => 'consultation'],
|
['code' => 'mat.postnatal', 'service_line' => 'postnatal', 'label' => 'Postnatal review', 'amount_minor' => 5000, 'type' => 'consultation'],
|
||||||
|
['code' => 'wh.gyn.consult', 'service_line' => 'gynecology', 'label' => 'Gynecology consultation', 'amount_minor' => 5000, 'type' => 'consultation'],
|
||||||
|
['code' => 'wh.fp.consult', 'service_line' => 'family_planning', 'label' => 'Family planning visit', 'amount_minor' => 3500, 'type' => 'consultation'],
|
||||||
|
['code' => 'wh.cervical', 'service_line' => 'cervical_screening', 'label' => 'Cervical screening', 'amount_minor' => 4500, 'type' => 'procedure'],
|
||||||
|
['code' => 'wh.menopause', 'service_line' => 'menopause', 'label' => 'Menopause clinic visit', 'amount_minor' => 5000, 'type' => 'consultation'],
|
||||||
|
['code' => 'wh.high_risk', 'service_line' => 'high_risk_pregnancy', 'label' => 'High-risk pregnancy review', 'amount_minor' => 6000, 'type' => 'consultation'],
|
||||||
|
['code' => 'wh.epa', 'service_line' => 'early_pregnancy', 'label' => 'Early pregnancy assessment', 'amount_minor' => 5500, 'type' => 'consultation'],
|
||||||
|
['code' => 'wh.labour', 'service_line' => 'labour_delivery', 'label' => 'Labour & delivery attendance', 'amount_minor' => 15000, 'type' => 'procedure'],
|
||||||
],
|
],
|
||||||
'workspace_tabs' => [
|
'workspace_tabs' => [
|
||||||
'overview' => 'Overview',
|
'overview' => 'Overview',
|
||||||
|
|||||||
@@ -77,8 +77,8 @@ return [
|
|||||||
'modules' => ['pharmacy', 'billing'],
|
'modules' => ['pharmacy', 'billing'],
|
||||||
'default_template' => 'cashless_clinic',
|
'default_template' => 'cashless_clinic',
|
||||||
],
|
],
|
||||||
'maternity' => [
|
'womens_health' => [
|
||||||
'label' => 'Maternity home',
|
'label' => "Women's Health home",
|
||||||
'modules' => ['lab', 'pharmacy', 'billing'],
|
'modules' => ['lab', 'pharmacy', 'billing'],
|
||||||
'default_template' => 'private_hospital',
|
'default_template' => 'private_hospital',
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -156,7 +156,7 @@
|
|||||||
@if (empty($canUseSpecialtyModules))
|
@if (empty($canUseSpecialtyModules))
|
||||||
<span class="ml-2 rounded-full bg-amber-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-amber-700">Pro</span>
|
<span class="ml-2 rounded-full bg-amber-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-amber-700">Pro</span>
|
||||||
@endif
|
@endif
|
||||||
<span class="mt-0.5 block text-xs text-slate-500">Dentistry, eye care, physiotherapy, maternity, radiology — activate & set prices</span>
|
<span class="mt-0.5 block text-xs text-slate-500">Dentistry, eye care, physiotherapy, women's health, radiology — activate & set prices</span>
|
||||||
</span>
|
</span>
|
||||||
<span class="text-slate-400">→</span>
|
<span class="text-slate-400">→</span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -28,6 +28,37 @@
|
|||||||
</div>
|
</div>
|
||||||
</x-settings.card>
|
</x-settings.card>
|
||||||
|
|
||||||
|
@if (! empty($serviceLines) && $canUseSpecialtyModules)
|
||||||
|
<x-settings.card title="Service lines" description="Enable only the clinics and services this facility offers under {{ $definition['label'] ?? $moduleKey }}.">
|
||||||
|
<form method="POST" action="{{ route('care.settings.modules.service-lines.update', $moduleKey) }}" class="space-y-4">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
<div class="grid gap-2 sm:grid-cols-2">
|
||||||
|
@foreach ($serviceLines as $lineKey => $line)
|
||||||
|
<label class="flex items-start gap-2 rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
name="lines[{{ $lineKey }}]"
|
||||||
|
value="1"
|
||||||
|
class="mt-0.5 rounded border-slate-300 text-indigo-600"
|
||||||
|
@checked(old('lines.'.$lineKey, $enabledServiceLines[$lineKey] ?? ($line['default_on'] ?? true)))
|
||||||
|
@disabled(! $canManage)
|
||||||
|
>
|
||||||
|
<span>
|
||||||
|
<span class="font-medium">{{ $line['label'] }}</span>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
@if ($canManage)
|
||||||
|
<div class="flex justify-end">
|
||||||
|
<button type="submit" class="btn-primary">Save service lines</button>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</form>
|
||||||
|
</x-settings.card>
|
||||||
|
@endif
|
||||||
|
|
||||||
@if (! $canUseSpecialtyModules)
|
@if (! $canUseSpecialtyModules)
|
||||||
<x-settings.card title="Pro feature" description="Specialty module pricing requires Care Pro or Enterprise.">
|
<x-settings.card title="Pro feature" description="Specialty module pricing requires Care Pro or Enterprise.">
|
||||||
<a href="{{ route('care.pro.index') }}" class="btn-primary mt-2 inline-flex text-sm">View plans</a>
|
<a href="{{ route('care.pro.index') }}" class="btn-primary mt-2 inline-flex text-sm">View plans</a>
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
'dentistry' => 'chair',
|
'dentistry' => 'chair',
|
||||||
'ophthalmology' => 'check_in',
|
'ophthalmology' => 'check_in',
|
||||||
'physiotherapy' => 'check_in',
|
'physiotherapy' => 'check_in',
|
||||||
'maternity' => 'check_in',
|
'womens_health' => 'check_in',
|
||||||
'radiology' => 'check_in',
|
'radiology' => 'check_in',
|
||||||
'cardiology' => 'check_in',
|
'cardiology' => 'check_in',
|
||||||
'psychiatry' => 'check_in',
|
'psychiatry' => 'check_in',
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
'dentistry' => 'Seat at chair',
|
'dentistry' => 'Seat at chair',
|
||||||
'ophthalmology' => 'Start check-in',
|
'ophthalmology' => 'Start check-in',
|
||||||
'physiotherapy' => 'Start check-in',
|
'physiotherapy' => 'Start check-in',
|
||||||
'maternity' => 'Start check-in',
|
'womens_health' => 'Start check-in',
|
||||||
'radiology' => 'Start check-in',
|
'radiology' => 'Start check-in',
|
||||||
'cardiology' => 'Start check-in',
|
'cardiology' => 'Start check-in',
|
||||||
'psychiatry' => 'Start check-in',
|
'psychiatry' => 'Start check-in',
|
||||||
|
|||||||
@@ -65,8 +65,8 @@
|
|||||||
@include('care.specialty.ophthalmology.workspace-'.$activeTab)
|
@include('care.specialty.ophthalmology.workspace-'.$activeTab)
|
||||||
@elseif ($moduleKey === 'physiotherapy' && in_array($activeTab, ['overview', 'session'], true))
|
@elseif ($moduleKey === 'physiotherapy' && in_array($activeTab, ['overview', 'session'], true))
|
||||||
@include('care.specialty.physiotherapy.workspace-'.$activeTab)
|
@include('care.specialty.physiotherapy.workspace-'.$activeTab)
|
||||||
@elseif ($moduleKey === 'maternity' && in_array($activeTab, ['overview', 'postnatal'], true))
|
@elseif ($moduleKey === 'womens_health' && in_array($activeTab, ['overview', 'postnatal'], true))
|
||||||
@include('care.specialty.maternity.workspace-'.$activeTab)
|
@include('care.specialty.womens_health.workspace-'.$activeTab)
|
||||||
@elseif ($moduleKey === 'radiology' && in_array($activeTab, ['overview', 'verification'], true))
|
@elseif ($moduleKey === 'radiology' && in_array($activeTab, ['overview', 'verification'], true))
|
||||||
@include('care.specialty.radiology.workspace-'.$activeTab)
|
@include('care.specialty.radiology.workspace-'.$activeTab)
|
||||||
@elseif ($moduleKey === 'cardiology' && in_array($activeTab, ['overview', 'procedures'], true))
|
@elseif ($moduleKey === 'cardiology' && in_array($activeTab, ['overview', 'procedures'], true))
|
||||||
|
|||||||
@@ -40,8 +40,8 @@
|
|||||||
@if ($moduleKey === 'physiotherapy')
|
@if ($moduleKey === 'physiotherapy')
|
||||||
<a href="{{ route('care.specialty.physiotherapy.reports') }}" class="text-slate-600 hover:text-slate-900">Reports</a>
|
<a href="{{ route('care.specialty.physiotherapy.reports') }}" class="text-slate-600 hover:text-slate-900">Reports</a>
|
||||||
@endif
|
@endif
|
||||||
@if ($moduleKey === 'maternity')
|
@if ($moduleKey === 'womens_health')
|
||||||
<a href="{{ route('care.specialty.maternity.reports') }}" class="text-slate-600 hover:text-slate-900">Reports</a>
|
<a href="{{ route('care.specialty.womens_health.reports') }}" class="text-slate-600 hover:text-slate-900">Reports</a>
|
||||||
@endif
|
@endif
|
||||||
@if ($moduleKey === 'radiology')
|
@if ($moduleKey === 'radiology')
|
||||||
<a href="{{ route('care.specialty.radiology.reports') }}" class="text-slate-600 hover:text-slate-900">Reports</a>
|
<a href="{{ route('care.specialty.radiology.reports') }}" class="text-slate-600 hover:text-slate-900">Reports</a>
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Maternity summary · {{ $patient->fullName() }}</title>
|
<title>Women's Health summary · {{ $patient->fullName() }}</title>
|
||||||
<style>
|
<style>
|
||||||
body { font-family: system-ui, sans-serif; color: #0f172a; margin: 2rem; }
|
body { font-family: system-ui, sans-serif; color: #0f172a; margin: 2rem; }
|
||||||
h1 { font-size: 1.25rem; margin: 0 0 .25rem; }
|
h1 { font-size: 1.25rem; margin: 0 0 .25rem; }
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p class="no-print"><a href="{{ route('care.specialty.workspace', ['module' => 'maternity', 'visit' => $visit]) }}">Back</a></p>
|
<p class="no-print"><a href="{{ route('care.specialty.workspace', ['module' => 'womens_health', 'visit' => $visit]) }}">Back</a></p>
|
||||||
|
|
||||||
<h1>{{ $patient->fullName() }}</h1>
|
<h1>{{ $patient->fullName() }}</h1>
|
||||||
<p class="meta">
|
<p class="meta">
|
||||||
+6
-6
@@ -1,11 +1,11 @@
|
|||||||
<x-app-layout title="Maternity reports">
|
<x-app-layout title="Women's Health reports">
|
||||||
<div class="space-y-6">
|
<div class="space-y-6">
|
||||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||||
<div>
|
<div>
|
||||||
<h1 class="text-xl font-semibold text-slate-900">Maternity reports</h1>
|
<h1 class="text-xl font-semibold text-slate-900">Women's Health reports</h1>
|
||||||
<p class="mt-1 text-sm text-slate-500">Arrivals, high-risk ANC, risk categories, postnatal outcomes, length of stay, and maternity service revenue.</p>
|
<p class="mt-1 text-sm text-slate-500">Arrivals, high-risk ANC, risk categories, postnatal outcomes, length of stay, and Women's Health service revenue.</p>
|
||||||
</div>
|
</div>
|
||||||
<a href="{{ route('care.specialty.show', 'maternity') }}" class="text-sm font-medium text-indigo-600">← Specialty home</a>
|
<a href="{{ route('care.specialty.show', 'womens_health') }}" class="text-sm font-medium text-indigo-600">← Specialty home</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form method="GET" class="flex flex-wrap items-end gap-3 rounded-2xl border border-slate-200 bg-white p-4">
|
<form method="GET" class="flex flex-wrap items-end gap-3 rounded-2xl border border-slate-200 bg-white p-4">
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section class="rounded-2xl border border-slate-200 bg-white p-5">
|
<section class="rounded-2xl border border-slate-200 bg-white p-5">
|
||||||
<h2 class="text-sm font-semibold text-slate-900">Maternity service revenue</h2>
|
<h2 class="text-sm font-semibold text-slate-900">Women's Health service revenue</h2>
|
||||||
<ul class="mt-3 space-y-2 text-sm">
|
<ul class="mt-3 space-y-2 text-sm">
|
||||||
@forelse ($report['revenue_by_service'] as $row)
|
@forelse ($report['revenue_by_service'] as $row)
|
||||||
<li class="flex justify-between gap-3">
|
<li class="flex justify-between gap-3">
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
<span class="tabular-nums">{{ $currency }} {{ number_format($row->amount_minor / 100, 2) }}</span>
|
<span class="tabular-nums">{{ $currency }} {{ number_format($row->amount_minor / 100, 2) }}</span>
|
||||||
</li>
|
</li>
|
||||||
@empty
|
@empty
|
||||||
<li class="text-slate-500">No billed maternity services in range.</li>
|
<li class="text-slate-500">No billed Women's Health services in range.</li>
|
||||||
@endforelse
|
@endforelse
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
+3
-3
@@ -8,12 +8,12 @@
|
|||||||
<section class="rounded-2xl border border-slate-200 bg-white p-5">
|
<section class="rounded-2xl border border-slate-200 bg-white p-5">
|
||||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||||
<div>
|
<div>
|
||||||
<h3 class="text-sm font-semibold text-slate-900">Maternity overview</h3>
|
<h3 class="text-sm font-semibold text-slate-900">Women's Health overview</h3>
|
||||||
<p class="mt-0.5 text-xs text-slate-500">ANC history, exam, fetal notes, and care plan for this episode.</p>
|
<p class="mt-0.5 text-xs text-slate-500">ANC history, exam, fetal notes, and care plan for this episode.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-wrap gap-3 text-sm">
|
<div class="flex flex-wrap gap-3 text-sm">
|
||||||
<a href="{{ route('care.specialty.maternity.print', $workspaceVisit) }}" target="_blank" class="font-medium text-indigo-600">Print summary</a>
|
<a href="{{ route('care.specialty.womens_health.print', $workspaceVisit) }}" target="_blank" class="font-medium text-indigo-600">Print summary</a>
|
||||||
<a href="{{ route('care.specialty.maternity.reports') }}" class="font-medium text-indigo-600">Maternity reports</a>
|
<a href="{{ route('care.specialty.womens_health.reports') }}" class="font-medium text-indigo-600">Women's Health reports</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
+2
-2
@@ -10,11 +10,11 @@
|
|||||||
<h3 class="text-sm font-semibold text-slate-900">Delivery / postnatal</h3>
|
<h3 class="text-sm font-semibold text-slate-900">Delivery / postnatal</h3>
|
||||||
<p class="mt-0.5 text-xs text-slate-500">Clinic delivery notes and postnatal review. Discharge outcomes can close the visit.</p>
|
<p class="mt-0.5 text-xs text-slate-500">Clinic delivery notes and postnatal review. Discharge outcomes can close the visit.</p>
|
||||||
</div>
|
</div>
|
||||||
<a href="{{ route('care.specialty.maternity.print', $workspaceVisit) }}" target="_blank" class="text-sm font-medium text-indigo-600">Print summary</a>
|
<a href="{{ route('care.specialty.womens_health.print', $workspaceVisit) }}" target="_blank" class="text-sm font-medium text-indigo-600">Print summary</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if ($canManage)
|
@if ($canManage)
|
||||||
<form method="POST" action="{{ route('care.specialty.maternity.postnatal', $workspaceVisit) }}" class="mt-4 space-y-4">
|
<form method="POST" action="{{ route('care.specialty.womens_health.postnatal', $workspaceVisit) }}" class="mt-4 space-y-4">
|
||||||
@csrf
|
@csrf
|
||||||
<input type="hidden" name="tab" value="postnatal">
|
<input type="hidden" name="tab" value="postnatal">
|
||||||
<div class="grid gap-3 sm:grid-cols-2">
|
<div class="grid gap-3 sm:grid-cols-2">
|
||||||
+7
-5
@@ -43,7 +43,7 @@ use App\Http\Controllers\Care\LabAdminController;
|
|||||||
use App\Http\Controllers\Care\EmergencyWorkspaceController;
|
use App\Http\Controllers\Care\EmergencyWorkspaceController;
|
||||||
use App\Http\Controllers\Care\OphthalmologyWorkspaceController;
|
use App\Http\Controllers\Care\OphthalmologyWorkspaceController;
|
||||||
use App\Http\Controllers\Care\PhysiotherapyWorkspaceController;
|
use App\Http\Controllers\Care\PhysiotherapyWorkspaceController;
|
||||||
use App\Http\Controllers\Care\MaternityWorkspaceController;
|
use App\Http\Controllers\Care\WomensHealthWorkspaceController;
|
||||||
use App\Http\Controllers\Care\RadiologyWorkspaceController;
|
use App\Http\Controllers\Care\RadiologyWorkspaceController;
|
||||||
use App\Http\Controllers\Care\CardiologyWorkspaceController;
|
use App\Http\Controllers\Care\CardiologyWorkspaceController;
|
||||||
use App\Http\Controllers\Care\PsychiatryWorkspaceController;
|
use App\Http\Controllers\Care\PsychiatryWorkspaceController;
|
||||||
@@ -145,7 +145,8 @@ Route::middleware(['auth', 'platform.session'])->group(function () {
|
|||||||
Route::get('/specialty/blood-bank/reports', [BloodBankWorkspaceController::class, 'reports'])->name('care.specialty.blood-bank.reports');
|
Route::get('/specialty/blood-bank/reports', [BloodBankWorkspaceController::class, 'reports'])->name('care.specialty.blood-bank.reports');
|
||||||
Route::get('/specialty/ophthalmology/reports', [OphthalmologyWorkspaceController::class, 'reports'])->name('care.specialty.ophthalmology.reports');
|
Route::get('/specialty/ophthalmology/reports', [OphthalmologyWorkspaceController::class, 'reports'])->name('care.specialty.ophthalmology.reports');
|
||||||
Route::get('/specialty/physiotherapy/reports', [PhysiotherapyWorkspaceController::class, 'reports'])->name('care.specialty.physiotherapy.reports');
|
Route::get('/specialty/physiotherapy/reports', [PhysiotherapyWorkspaceController::class, 'reports'])->name('care.specialty.physiotherapy.reports');
|
||||||
Route::get('/specialty/maternity/reports', [MaternityWorkspaceController::class, 'reports'])->name('care.specialty.maternity.reports');
|
Route::get('/specialty/womens-health/reports', [WomensHealthWorkspaceController::class, 'reports'])->name('care.specialty.womens_health.reports');
|
||||||
|
Route::get('/specialty/maternity/reports', fn () => redirect()->route('care.specialty.womens_health.reports'));
|
||||||
Route::get('/specialty/radiology/reports', [RadiologyWorkspaceController::class, 'reports'])->name('care.specialty.radiology.reports');
|
Route::get('/specialty/radiology/reports', [RadiologyWorkspaceController::class, 'reports'])->name('care.specialty.radiology.reports');
|
||||||
Route::get('/specialty/cardiology/reports', [CardiologyWorkspaceController::class, 'reports'])->name('care.specialty.cardiology.reports');
|
Route::get('/specialty/cardiology/reports', [CardiologyWorkspaceController::class, 'reports'])->name('care.specialty.cardiology.reports');
|
||||||
Route::get('/specialty/psychiatry/reports', [PsychiatryWorkspaceController::class, 'reports'])->name('care.specialty.psychiatry.reports');
|
Route::get('/specialty/psychiatry/reports', [PsychiatryWorkspaceController::class, 'reports'])->name('care.specialty.psychiatry.reports');
|
||||||
@@ -202,9 +203,9 @@ Route::middleware(['auth', 'platform.session'])->group(function () {
|
|||||||
Route::post('/specialty/physiotherapy/workspace/{visit}/stage', [PhysiotherapyWorkspaceController::class, 'setStage'])->name('care.specialty.physiotherapy.stage');
|
Route::post('/specialty/physiotherapy/workspace/{visit}/stage', [PhysiotherapyWorkspaceController::class, 'setStage'])->name('care.specialty.physiotherapy.stage');
|
||||||
Route::post('/specialty/physiotherapy/workspace/{visit}/session', [PhysiotherapyWorkspaceController::class, 'saveSession'])->name('care.specialty.physiotherapy.session');
|
Route::post('/specialty/physiotherapy/workspace/{visit}/session', [PhysiotherapyWorkspaceController::class, 'saveSession'])->name('care.specialty.physiotherapy.session');
|
||||||
Route::get('/specialty/physiotherapy/workspace/{visit}/print', [PhysiotherapyWorkspaceController::class, 'printSummary'])->name('care.specialty.physiotherapy.print');
|
Route::get('/specialty/physiotherapy/workspace/{visit}/print', [PhysiotherapyWorkspaceController::class, 'printSummary'])->name('care.specialty.physiotherapy.print');
|
||||||
Route::post('/specialty/maternity/workspace/{visit}/stage', [MaternityWorkspaceController::class, 'setStage'])->name('care.specialty.maternity.stage');
|
Route::post('/specialty/womens-health/workspace/{visit}/stage', [WomensHealthWorkspaceController::class, 'setStage'])->name('care.specialty.womens_health.stage');
|
||||||
Route::post('/specialty/maternity/workspace/{visit}/postnatal', [MaternityWorkspaceController::class, 'savePostnatal'])->name('care.specialty.maternity.postnatal');
|
Route::post('/specialty/womens-health/workspace/{visit}/postnatal', [WomensHealthWorkspaceController::class, 'savePostnatal'])->name('care.specialty.womens_health.postnatal');
|
||||||
Route::get('/specialty/maternity/workspace/{visit}/print', [MaternityWorkspaceController::class, 'printSummary'])->name('care.specialty.maternity.print');
|
Route::get('/specialty/womens-health/workspace/{visit}/print', [WomensHealthWorkspaceController::class, 'printSummary'])->name('care.specialty.womens_health.print');
|
||||||
Route::post('/specialty/radiology/workspace/{visit}/stage', [RadiologyWorkspaceController::class, 'setStage'])->name('care.specialty.radiology.stage');
|
Route::post('/specialty/radiology/workspace/{visit}/stage', [RadiologyWorkspaceController::class, 'setStage'])->name('care.specialty.radiology.stage');
|
||||||
Route::post('/specialty/radiology/workspace/{visit}/verification', [RadiologyWorkspaceController::class, 'saveVerification'])->name('care.specialty.radiology.verification');
|
Route::post('/specialty/radiology/workspace/{visit}/verification', [RadiologyWorkspaceController::class, 'saveVerification'])->name('care.specialty.radiology.verification');
|
||||||
Route::get('/specialty/radiology/workspace/{visit}/print', [RadiologyWorkspaceController::class, 'printSummary'])->name('care.specialty.radiology.print');
|
Route::get('/specialty/radiology/workspace/{visit}/print', [RadiologyWorkspaceController::class, 'printSummary'])->name('care.specialty.radiology.print');
|
||||||
@@ -360,6 +361,7 @@ Route::middleware(['auth', 'platform.session'])->group(function () {
|
|||||||
Route::put('/settings/modules', [SettingsModulesController::class, 'update'])->name('care.settings.modules.update');
|
Route::put('/settings/modules', [SettingsModulesController::class, 'update'])->name('care.settings.modules.update');
|
||||||
Route::get('/settings/modules/{module}', [SettingsModulesController::class, 'show'])->name('care.settings.modules.show');
|
Route::get('/settings/modules/{module}', [SettingsModulesController::class, 'show'])->name('care.settings.modules.show');
|
||||||
Route::put('/settings/modules/{module}/services', [SettingsModulesController::class, 'updateServices'])->name('care.settings.modules.services.update');
|
Route::put('/settings/modules/{module}/services', [SettingsModulesController::class, 'updateServices'])->name('care.settings.modules.services.update');
|
||||||
|
Route::put('/settings/modules/{module}/service-lines', [SettingsModulesController::class, 'updateServiceLines'])->name('care.settings.modules.service-lines.update');
|
||||||
|
|
||||||
Route::get('/integrations', [IntegrationsController::class, 'edit'])->name('care.integrations');
|
Route::get('/integrations', [IntegrationsController::class, 'edit'])->name('care.integrations');
|
||||||
Route::post('/integrations/sms', [IntegrationsController::class, 'saveSms'])->name('care.integrations.sms.save');
|
Route::post('/integrations/sms', [IntegrationsController::class, 'saveSms'])->name('care.integrations.sms.save');
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class CareSpecialtyAccessTest extends TestCase
|
|||||||
|
|
||||||
public function test_nurse_and_pharmacist_manage_general_modules(): void
|
public function test_nurse_and_pharmacist_manage_general_modules(): void
|
||||||
{
|
{
|
||||||
foreach (['vaccination', 'child_welfare', 'maternity'] as $key) {
|
foreach (['vaccination', 'child_welfare', 'womens_health'] as $key) {
|
||||||
$this->modules->activate($this->organization->fresh(), $this->owner->public_id, $key);
|
$this->modules->activate($this->organization->fresh(), $this->owner->public_id, $key);
|
||||||
}
|
}
|
||||||
$this->organization->refresh();
|
$this->organization->refresh();
|
||||||
@@ -106,12 +106,12 @@ class CareSpecialtyAccessTest extends TestCase
|
|||||||
[, $lab] = $this->makeStaff('lab_technician', 'lab1');
|
[, $lab] = $this->makeStaff('lab_technician', 'lab1');
|
||||||
[, $receptionist] = $this->makeStaff('receptionist', 'rec1');
|
[, $receptionist] = $this->makeStaff('receptionist', 'rec1');
|
||||||
|
|
||||||
// Legacy floor nurse: vaccination / CWC / infusion / maternity manage; emergency refer only.
|
// Legacy floor nurse: vaccination / CWC / infusion / Women's Health manage; emergency refer only.
|
||||||
$this->assertFalse($this->modules->memberCanManage($this->organization, $nurse, 'emergency'));
|
$this->assertFalse($this->modules->memberCanManage($this->organization, $nurse, 'emergency'));
|
||||||
$this->assertTrue($this->modules->memberCanRefer($this->organization, $nurse, 'emergency'));
|
$this->assertTrue($this->modules->memberCanRefer($this->organization, $nurse, 'emergency'));
|
||||||
$this->assertTrue($this->modules->memberCanManage($this->organization, $nurse, 'vaccination'));
|
$this->assertTrue($this->modules->memberCanManage($this->organization, $nurse, 'vaccination'));
|
||||||
$this->assertTrue($this->modules->memberCanManage($this->organization, $nurse, 'infusion'));
|
$this->assertTrue($this->modules->memberCanManage($this->organization, $nurse, 'infusion'));
|
||||||
$this->assertTrue($this->modules->memberCanManage($this->organization, $nurse, 'maternity'));
|
$this->assertTrue($this->modules->memberCanManage($this->organization, $nurse, 'womens_health'));
|
||||||
// ED nurse matrix apps: Emergency, Blood Bank, Radiology, Pathology.
|
// ED nurse matrix apps: Emergency, Blood Bank, Radiology, Pathology.
|
||||||
$this->assertTrue($this->modules->memberCanManage($this->organization, $edNurse, 'emergency'));
|
$this->assertTrue($this->modules->memberCanManage($this->organization, $edNurse, 'emergency'));
|
||||||
$this->assertTrue($this->modules->memberCanManage($this->organization, $edNurse, 'pathology'));
|
$this->assertTrue($this->modules->memberCanManage($this->organization, $edNurse, 'pathology'));
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ class CareSpecialtyModulesTest extends TestCase
|
|||||||
->assertSee('Dentistry')
|
->assertSee('Dentistry')
|
||||||
->assertSee('Eye care')
|
->assertSee('Eye care')
|
||||||
->assertSee('Physiotherapy')
|
->assertSee('Physiotherapy')
|
||||||
->assertSee('Maternity')
|
->assertSee("Women's Health")
|
||||||
->assertSee('Radiology');
|
->assertSee('Radiology');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,8 +91,8 @@ class CareSpecialtyShellTest extends TestCase
|
|||||||
$this->assertSame('assessment', $shell->workspaceTabForStage('physiotherapy', 'assessment'));
|
$this->assertSame('assessment', $shell->workspaceTabForStage('physiotherapy', 'assessment'));
|
||||||
$this->assertSame('session', $shell->workspaceTabForStage('physiotherapy', 'session'));
|
$this->assertSame('session', $shell->workspaceTabForStage('physiotherapy', 'session'));
|
||||||
$this->assertSame('exercises', $shell->workspaceTabForStage('physiotherapy', 'progress'));
|
$this->assertSame('exercises', $shell->workspaceTabForStage('physiotherapy', 'progress'));
|
||||||
$this->assertSame('history', $shell->workspaceTabForStage('maternity', 'history'));
|
$this->assertSame('history', $shell->workspaceTabForStage('womens_health', 'history'));
|
||||||
$this->assertSame('postnatal', $shell->workspaceTabForStage('maternity', 'postnatal'));
|
$this->assertSame('postnatal', $shell->workspaceTabForStage('womens_health', 'postnatal'));
|
||||||
$this->assertSame('odontogram', $shell->workspaceTabForStage('dentistry', 'chair'));
|
$this->assertSame('odontogram', $shell->workspaceTabForStage('dentistry', 'chair'));
|
||||||
$this->assertSame('issue', $shell->workspaceTabForStage('blood_bank', 'issue'));
|
$this->assertSame('issue', $shell->workspaceTabForStage('blood_bank', 'issue'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,157 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use App\Http\Middleware\EnsurePlatformSession;
|
||||||
|
use App\Models\Branch;
|
||||||
|
use App\Models\Member;
|
||||||
|
use App\Models\Organization;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Services\Care\SpecialtyModuleService;
|
||||||
|
use App\Services\Care\SpecialtyShellService;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class CareWomensHealthAccessTest extends TestCase
|
||||||
|
{
|
||||||
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
protected User $owner;
|
||||||
|
|
||||||
|
protected Organization $organization;
|
||||||
|
|
||||||
|
protected SpecialtyModuleService $modules;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
$this->withoutMiddleware(EnsurePlatformSession::class);
|
||||||
|
|
||||||
|
$this->owner = User::create([
|
||||||
|
'public_id' => 'wh-access-owner',
|
||||||
|
'name' => 'Owner',
|
||||||
|
'email' => 'wh-access-owner@example.com',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->organization = Organization::create([
|
||||||
|
'owner_ref' => $this->owner->public_id,
|
||||||
|
'name' => 'WH Clinic',
|
||||||
|
'slug' => 'wh-access-clinic',
|
||||||
|
'settings' => [
|
||||||
|
'onboarded' => true,
|
||||||
|
'plan' => 'pro',
|
||||||
|
'plan_expires_at' => now()->addMonth()->toIso8601String(),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
Member::create([
|
||||||
|
'owner_ref' => $this->owner->public_id,
|
||||||
|
'organization_id' => $this->organization->id,
|
||||||
|
'user_ref' => $this->owner->public_id,
|
||||||
|
'role' => 'hospital_admin',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Branch::create([
|
||||||
|
'owner_ref' => $this->owner->public_id,
|
||||||
|
'organization_id' => $this->organization->id,
|
||||||
|
'name' => 'Main',
|
||||||
|
'is_active' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->modules = app(SpecialtyModuleService::class);
|
||||||
|
$this->modules->activate($this->organization, $this->owner->public_id, 'womens_health');
|
||||||
|
$this->modules->activate($this->organization->fresh(), $this->owner->public_id, 'fertility');
|
||||||
|
$this->organization->refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function makeStaff(string $role, string $suffix): Member
|
||||||
|
{
|
||||||
|
$user = User::create([
|
||||||
|
'public_id' => 'wh-'.$suffix,
|
||||||
|
'name' => $role,
|
||||||
|
'email' => $suffix.'@example.com',
|
||||||
|
]);
|
||||||
|
|
||||||
|
return Member::create([
|
||||||
|
'owner_ref' => $this->owner->public_id,
|
||||||
|
'organization_id' => $this->organization->id,
|
||||||
|
'user_ref' => $user->public_id,
|
||||||
|
'role' => $role,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_obgyn_roles_manage_womens_health(): void
|
||||||
|
{
|
||||||
|
foreach (['obstetrician', 'gynecologist', 'obgyn', 'midwife', 'labour_ward_nurse'] as $role) {
|
||||||
|
$member = $this->makeStaff($role, $role.'1');
|
||||||
|
$this->assertTrue(
|
||||||
|
$this->modules->memberCanManage($this->organization, $member, 'womens_health'),
|
||||||
|
"{$role} should manage womens_health",
|
||||||
|
);
|
||||||
|
$this->assertFalse(
|
||||||
|
$this->modules->memberCanManage($this->organization, $member, 'fertility'),
|
||||||
|
"{$role} should not manage fertility",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_fertility_roles_manage_fertility_only(): void
|
||||||
|
{
|
||||||
|
foreach (['fertility_specialist', 'embryologist', 'fertility_nurse'] as $role) {
|
||||||
|
$member = $this->makeStaff($role, $role.'1');
|
||||||
|
$this->assertTrue($this->modules->memberCanManage($this->organization, $member, 'fertility'));
|
||||||
|
$this->assertFalse($this->modules->memberCanManage($this->organization, $member, 'womens_health'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_maternity_settings_migrate_to_womens_health(): void
|
||||||
|
{
|
||||||
|
$org = Organization::create([
|
||||||
|
'owner_ref' => $this->owner->public_id,
|
||||||
|
'name' => 'Legacy Mat',
|
||||||
|
'slug' => 'legacy-mat',
|
||||||
|
'settings' => [
|
||||||
|
'onboarded' => true,
|
||||||
|
'plan' => 'pro',
|
||||||
|
'plan_expires_at' => now()->addMonth()->toIso8601String(),
|
||||||
|
'specialty_modules' => ['maternity' => true],
|
||||||
|
'specialty_module_provisioning' => [
|
||||||
|
'maternity' => ['active' => true, 'services' => [['code' => 'mat.anc', 'label' => 'ANC', 'amount_minor' => 100, 'type' => 'consultation']]],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertTrue($this->modules->isEnabled($org, 'womens_health'));
|
||||||
|
$org->refresh();
|
||||||
|
$this->assertTrue((bool) data_get($org->settings, 'specialty_modules.womens_health'));
|
||||||
|
$this->assertFalse((bool) data_get($org->settings, 'specialty_modules.maternity'));
|
||||||
|
$this->assertNotNull(data_get($org->settings, 'specialty_module_provisioning.womens_health'));
|
||||||
|
$this->assertNull(data_get($org->settings, 'specialty_module_provisioning.maternity'));
|
||||||
|
$this->assertSame('womens_health', $this->modules->normalizeKey('maternity'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_service_line_toggle_filters_catalog_services(): void
|
||||||
|
{
|
||||||
|
$shell = app(SpecialtyShellService::class);
|
||||||
|
$before = collect($shell->catalogServices('womens_health', $this->organization))->pluck('code')->all();
|
||||||
|
$this->assertContains('wh.gyn.consult', $before);
|
||||||
|
|
||||||
|
$this->modules->syncServiceLines($this->organization, 'womens_health', [
|
||||||
|
'gynecology' => false,
|
||||||
|
'obstetrics' => true,
|
||||||
|
'antenatal' => true,
|
||||||
|
'labour_delivery' => true,
|
||||||
|
'postnatal' => true,
|
||||||
|
'family_planning' => false,
|
||||||
|
'cervical_screening' => false,
|
||||||
|
'menopause' => false,
|
||||||
|
'high_risk_pregnancy' => false,
|
||||||
|
'early_pregnancy' => false,
|
||||||
|
]);
|
||||||
|
$this->organization->refresh();
|
||||||
|
|
||||||
|
$after = collect($shell->catalogServices('womens_health', $this->organization->fresh()))->pluck('code')->all();
|
||||||
|
$this->assertNotContains('wh.gyn.consult', $after);
|
||||||
|
$this->assertContains('mat.anc', $after);
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
-22
@@ -16,7 +16,7 @@ use App\Services\Care\SpecialtyModuleService;
|
|||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class CareMaternitySuiteTest extends TestCase
|
class CareWomensHealthSuiteTest extends TestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
@@ -36,15 +36,15 @@ class CareMaternitySuiteTest extends TestCase
|
|||||||
$this->withoutMiddleware(EnsurePlatformSession::class);
|
$this->withoutMiddleware(EnsurePlatformSession::class);
|
||||||
|
|
||||||
$this->owner = User::create([
|
$this->owner = User::create([
|
||||||
'public_id' => 'mat-owner',
|
'public_id' => 'wh-owner',
|
||||||
'name' => 'Owner',
|
'name' => 'Owner',
|
||||||
'email' => 'mat-owner@example.com',
|
'email' => 'wh-owner@example.com',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->organization = Organization::create([
|
$this->organization = Organization::create([
|
||||||
'owner_ref' => $this->owner->public_id,
|
'owner_ref' => $this->owner->public_id,
|
||||||
'name' => 'Maternity Clinic',
|
'name' => "Women's Health Clinic",
|
||||||
'slug' => 'maternity-clinic',
|
'slug' => 'womens-health-clinic',
|
||||||
'settings' => [
|
'settings' => [
|
||||||
'onboarded' => true,
|
'onboarded' => true,
|
||||||
'facility_type' => 'clinic',
|
'facility_type' => 'clinic',
|
||||||
@@ -72,12 +72,12 @@ class CareMaternitySuiteTest extends TestCase
|
|||||||
app(SpecialtyModuleService::class)->activate(
|
app(SpecialtyModuleService::class)->activate(
|
||||||
$this->organization,
|
$this->organization,
|
||||||
$this->owner->public_id,
|
$this->owner->public_id,
|
||||||
'maternity',
|
'womens_health',
|
||||||
);
|
);
|
||||||
|
|
||||||
$department = Department::query()
|
$department = Department::query()
|
||||||
->where('branch_id', $this->branch->id)
|
->where('branch_id', $this->branch->id)
|
||||||
->where('type', 'maternity')
|
->where('type', 'womens_health')
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
|
||||||
$this->patient = Patient::create([
|
$this->patient = Patient::create([
|
||||||
@@ -121,21 +121,21 @@ class CareMaternitySuiteTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->actingAs($this->owner)
|
$this->actingAs($this->owner)
|
||||||
->get(route('care.specialty.workspace', [
|
->get(route('care.specialty.workspace', [
|
||||||
'module' => 'maternity',
|
'module' => 'womens_health',
|
||||||
'visit' => $this->visit,
|
'visit' => $this->visit,
|
||||||
'tab' => 'overview',
|
'tab' => 'overview',
|
||||||
]))
|
]))
|
||||||
->assertOk()
|
->assertOk()
|
||||||
->assertSee('Maternity overview')
|
->assertSee('Health overview')
|
||||||
->assertSee('data-care-stage-bar', false)
|
->assertSee('data-care-stage-bar', false)
|
||||||
->assertSee('Check-in')
|
->assertSee('Check-in')
|
||||||
->assertSee('ANC history')
|
->assertSee('ANC history')
|
||||||
->assertSee('Start ANC history')
|
->assertSee('Start ANC history')
|
||||||
->assertSee('Maternity reports');
|
->assertSee('Health reports');
|
||||||
|
|
||||||
$this->actingAs($this->owner)
|
$this->actingAs($this->owner)
|
||||||
->get(route('care.specialty.workspace', [
|
->get(route('care.specialty.workspace', [
|
||||||
'module' => 'maternity',
|
'module' => 'womens_health',
|
||||||
'visit' => $this->visit,
|
'visit' => $this->visit,
|
||||||
'tab' => 'history',
|
'tab' => 'history',
|
||||||
]))
|
]))
|
||||||
@@ -148,7 +148,7 @@ class CareMaternitySuiteTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->actingAs($this->owner)
|
$this->actingAs($this->owner)
|
||||||
->post(route('care.specialty.clinical.save', [
|
->post(route('care.specialty.clinical.save', [
|
||||||
'module' => 'maternity',
|
'module' => 'womens_health',
|
||||||
'visit' => $this->visit,
|
'visit' => $this->visit,
|
||||||
]), [
|
]), [
|
||||||
'tab' => 'exam',
|
'tab' => 'exam',
|
||||||
@@ -177,11 +177,11 @@ class CareMaternitySuiteTest extends TestCase
|
|||||||
public function test_stage_advance_and_postnatal_completes_visit(): void
|
public function test_stage_advance_and_postnatal_completes_visit(): void
|
||||||
{
|
{
|
||||||
$this->actingAs($this->owner)
|
$this->actingAs($this->owner)
|
||||||
->post(route('care.specialty.maternity.stage', $this->visit), [
|
->post(route('care.specialty.womens_health.stage', $this->visit), [
|
||||||
'stage' => 'postnatal',
|
'stage' => 'postnatal',
|
||||||
])
|
])
|
||||||
->assertRedirect(route('care.specialty.workspace', [
|
->assertRedirect(route('care.specialty.workspace', [
|
||||||
'module' => 'maternity',
|
'module' => 'womens_health',
|
||||||
'visit' => $this->visit,
|
'visit' => $this->visit,
|
||||||
'tab' => 'postnatal',
|
'tab' => 'postnatal',
|
||||||
]));
|
]));
|
||||||
@@ -189,7 +189,7 @@ class CareMaternitySuiteTest extends TestCase
|
|||||||
$this->assertSame('postnatal', $this->visit->fresh()->specialty_stage);
|
$this->assertSame('postnatal', $this->visit->fresh()->specialty_stage);
|
||||||
|
|
||||||
$this->actingAs($this->owner)
|
$this->actingAs($this->owner)
|
||||||
->post(route('care.specialty.maternity.postnatal', $this->visit), [
|
->post(route('care.specialty.womens_health.postnatal', $this->visit), [
|
||||||
'tab' => 'postnatal',
|
'tab' => 'postnatal',
|
||||||
'payload' => [
|
'payload' => [
|
||||||
'episode_type' => 'Postnatal review',
|
'episode_type' => 'Postnatal review',
|
||||||
@@ -201,7 +201,7 @@ class CareMaternitySuiteTest extends TestCase
|
|||||||
],
|
],
|
||||||
])
|
])
|
||||||
->assertRedirect(route('care.specialty.workspace', [
|
->assertRedirect(route('care.specialty.workspace', [
|
||||||
'module' => 'maternity',
|
'module' => 'womens_health',
|
||||||
'visit' => $this->visit,
|
'visit' => $this->visit,
|
||||||
'tab' => 'postnatal',
|
'tab' => 'postnatal',
|
||||||
]));
|
]));
|
||||||
@@ -218,23 +218,23 @@ class CareMaternitySuiteTest extends TestCase
|
|||||||
public function test_reports_and_print(): void
|
public function test_reports_and_print(): void
|
||||||
{
|
{
|
||||||
$this->actingAs($this->owner)
|
$this->actingAs($this->owner)
|
||||||
->get(route('care.specialty.maternity.reports'))
|
->get(route('care.specialty.womens_health.reports'))
|
||||||
->assertOk()
|
->assertOk()
|
||||||
->assertSee('Maternity reports')
|
->assertSee('Health reports')
|
||||||
->assertSee('Arrivals today');
|
->assertSee('Arrivals today');
|
||||||
|
|
||||||
$this->actingAs($this->owner)
|
$this->actingAs($this->owner)
|
||||||
->get(route('care.specialty.maternity.print', $this->visit))
|
->get(route('care.specialty.womens_health.print', $this->visit))
|
||||||
->assertOk()
|
->assertOk()
|
||||||
->assertSee('Maternity summary')
|
->assertSee('Health summary')
|
||||||
->assertSee($this->patient->fullName());
|
->assertSee($this->patient->fullName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_list_index_does_not_auto_open_patient(): void
|
public function test_list_index_does_not_auto_open_patient(): void
|
||||||
{
|
{
|
||||||
$this->actingAs($this->owner)
|
$this->actingAs($this->owner)
|
||||||
->get(route('care.specialty.show', 'maternity'))
|
->get(route('care.specialty.show', 'womens_health'))
|
||||||
->assertOk()
|
->assertOk()
|
||||||
->assertDontSee('Maternity overview');
|
->assertDontSee('Health overview');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -447,7 +447,9 @@ class DemoSeedCommandTest extends TestCase
|
|||||||
$this->assertSame((int) $member->branch_id, (int) $linked->first()->branch_id);
|
$this->assertSame((int) $member->branch_id, (int) $linked->first()->branch_id);
|
||||||
|
|
||||||
$modules = app(\App\Services\Care\SpecialtyModuleService::class);
|
$modules = app(\App\Services\Care\SpecialtyModuleService::class);
|
||||||
$this->assertTrue($modules->isDeskSpecialist($org, $member));
|
// Dedicated specialist roles (dentist) use primary apps, not legacy desk-specialist matching.
|
||||||
|
$this->assertFalse($modules->isDeskSpecialist($org, $member));
|
||||||
|
$this->assertSame(['dentistry'], app(\App\Services\Care\CarePermissions::class)->primaryAppsFor($member));
|
||||||
$keys = collect($modules->enabledModulesForMember($org, $member))->pluck('key')->all();
|
$keys = collect($modules->enabledModulesForMember($org, $member))->pluck('key')->all();
|
||||||
$this->assertSame(['dentistry'], $keys);
|
$this->assertSame(['dentistry'], $keys);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user