Add full Dermatology, Podiatry, and Fertility specialty clinical suites.
Deploy Ladill Care / deploy (push) Successful in 35s
Deploy Ladill Care / deploy (push) Successful in 35s
Bring thin catalog modules to the same depth as Cardiology with stages, clinical tabs, reports/print, demo seed, and suite tests. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Http\Middleware\EnsurePlatformSession;
|
||||
use App\Models\Appointment;
|
||||
use App\Models\Branch;
|
||||
use App\Models\Department;
|
||||
use App\Models\Member;
|
||||
use App\Models\Organization;
|
||||
use App\Models\Patient;
|
||||
use App\Models\SpecialtyClinicalRecord;
|
||||
use App\Models\User;
|
||||
use App\Models\Visit;
|
||||
use App\Services\Care\SpecialtyModuleService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class CareDermatologySuiteTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected User $owner;
|
||||
|
||||
protected Organization $organization;
|
||||
|
||||
protected Branch $branch;
|
||||
|
||||
protected Patient $patient;
|
||||
|
||||
protected Visit $visit;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->withoutMiddleware(EnsurePlatformSession::class);
|
||||
|
||||
$this->owner = User::create([
|
||||
'public_id' => 'der-owner',
|
||||
'name' => 'Owner',
|
||||
'email' => 'der-owner@example.com',
|
||||
]);
|
||||
|
||||
$this->organization = Organization::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'name' => 'Dermatology Clinic',
|
||||
'slug' => 'dermatology-clinic',
|
||||
'settings' => [
|
||||
'onboarded' => true,
|
||||
'facility_type' => 'clinic',
|
||||
'plan' => 'pro',
|
||||
'plan_expires_at' => now()->addMonth()->toIso8601String(),
|
||||
'queue_integration_enabled' => true,
|
||||
],
|
||||
]);
|
||||
|
||||
Member::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'user_ref' => $this->owner->public_id,
|
||||
'role' => 'hospital_admin',
|
||||
'branch_id' => null,
|
||||
]);
|
||||
|
||||
$this->branch = Branch::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'name' => 'Main',
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
app(SpecialtyModuleService::class)->activate(
|
||||
$this->organization,
|
||||
$this->owner->public_id,
|
||||
'dermatology',
|
||||
);
|
||||
|
||||
$department = Department::query()
|
||||
->where('branch_id', $this->branch->id)
|
||||
->where('type', 'dermatology')
|
||||
->firstOrFail();
|
||||
|
||||
$this->patient = Patient::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $this->branch->id,
|
||||
'patient_number' => 'P-DER-SUITE',
|
||||
'first_name' => 'Ama',
|
||||
'last_name' => 'Mensah',
|
||||
'gender' => 'female',
|
||||
'date_of_birth' => '1988-05-12',
|
||||
]);
|
||||
|
||||
$this->visit = Visit::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $this->branch->id,
|
||||
'patient_id' => $this->patient->id,
|
||||
'status' => Visit::STATUS_IN_PROGRESS,
|
||||
'checked_in_at' => now(),
|
||||
'specialty_stage' => 'check_in',
|
||||
]);
|
||||
|
||||
Appointment::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $this->branch->id,
|
||||
'patient_id' => $this->patient->id,
|
||||
'department_id' => $department->id,
|
||||
'visit_id' => $this->visit->id,
|
||||
'type' => Appointment::TYPE_WALK_IN,
|
||||
'status' => Appointment::STATUS_IN_CONSULTATION,
|
||||
'scheduled_at' => now(),
|
||||
'waiting_at' => now(),
|
||||
'checked_in_at' => now(),
|
||||
'started_at' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_overview_and_exam_tabs_render(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.workspace', [
|
||||
'module' => 'dermatology',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'overview',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('Dermatology overview')
|
||||
->assertSee('data-care-stage-bar', false)
|
||||
->assertSee('Skin exam')
|
||||
->assertSee('Start history')
|
||||
->assertSee('Dermatology reports');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.workspace', [
|
||||
'module' => 'dermatology',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'exam',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('Chief complaint')
|
||||
->assertSee('Lesion morphology');
|
||||
}
|
||||
|
||||
public function test_exam_sets_stage_and_urgency_alert(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.clinical.save', [
|
||||
'module' => 'dermatology',
|
||||
'visit' => $this->visit,
|
||||
]), [
|
||||
'tab' => 'exam',
|
||||
'payload' => [
|
||||
'chief_complaint' => 'Changing mole',
|
||||
'urgency' => 'Suspected malignancy',
|
||||
'duration' => '3 months',
|
||||
'distribution' => 'Left forearm',
|
||||
'morphology' => 'Asymmetric pigmented lesion with irregular border',
|
||||
'itch_pain' => 'None',
|
||||
'dermoscopy' => 'Atypical network',
|
||||
'differential' => 'Melanoma vs atypical naevus',
|
||||
],
|
||||
])
|
||||
->assertRedirect();
|
||||
|
||||
$this->assertSame('exam', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
$record = SpecialtyClinicalRecord::query()
|
||||
->where('visit_id', $this->visit->id)
|
||||
->where('record_type', 'skin_exam')
|
||||
->firstOrFail();
|
||||
|
||||
$codes = collect($record->alerts)->pluck('code')->all();
|
||||
$this->assertContains('der.urgency_high', $codes);
|
||||
}
|
||||
|
||||
public function test_stage_advance_and_procedure_completes_visit(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.dermatology.stage', $this->visit), [
|
||||
'stage' => 'procedure',
|
||||
])
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'dermatology',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'procedure',
|
||||
]));
|
||||
|
||||
$this->assertSame('procedure', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.dermatology.procedure', $this->visit), [
|
||||
'tab' => 'procedure',
|
||||
'payload' => [
|
||||
'procedure' => 'Excision biopsy',
|
||||
'indication' => 'Suspected melanoma',
|
||||
'outcome' => 'Completed uneventfully',
|
||||
'post_procedure_plan' => 'Wound care; await histology',
|
||||
],
|
||||
])
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'dermatology',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'procedure',
|
||||
]));
|
||||
|
||||
$this->assertSame('completed', $this->visit->fresh()->specialty_stage);
|
||||
$this->assertSame(Visit::STATUS_COMPLETED, $this->visit->fresh()->status);
|
||||
$this->assertDatabaseHas('care_specialty_clinical_records', [
|
||||
'visit_id' => $this->visit->id,
|
||||
'record_type' => 'derm_procedure',
|
||||
'status' => SpecialtyClinicalRecord::STATUS_COMPLETED,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_reports_and_print(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.dermatology.reports'))
|
||||
->assertOk()
|
||||
->assertSee('Dermatology reports')
|
||||
->assertSee('Arrivals today');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.dermatology.print', $this->visit))
|
||||
->assertOk()
|
||||
->assertSee('Dermatology summary')
|
||||
->assertSee($this->patient->fullName());
|
||||
}
|
||||
|
||||
public function test_list_index_does_not_auto_open_patient(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.show', 'dermatology'))
|
||||
->assertOk()
|
||||
->assertDontSee('Dermatology overview');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Http\Middleware\EnsurePlatformSession;
|
||||
use App\Models\Appointment;
|
||||
use App\Models\Branch;
|
||||
use App\Models\Department;
|
||||
use App\Models\Member;
|
||||
use App\Models\Organization;
|
||||
use App\Models\Patient;
|
||||
use App\Models\SpecialtyClinicalRecord;
|
||||
use App\Models\User;
|
||||
use App\Models\Visit;
|
||||
use App\Services\Care\SpecialtyModuleService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class CareFertilitySuiteTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected User $owner;
|
||||
|
||||
protected Organization $organization;
|
||||
|
||||
protected Branch $branch;
|
||||
|
||||
protected Patient $patient;
|
||||
|
||||
protected Visit $visit;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->withoutMiddleware(EnsurePlatformSession::class);
|
||||
|
||||
$this->owner = User::create([
|
||||
'public_id' => 'fer-owner',
|
||||
'name' => 'Owner',
|
||||
'email' => 'fer-owner@example.com',
|
||||
]);
|
||||
|
||||
$this->organization = Organization::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'name' => 'Fertility Clinic',
|
||||
'slug' => 'fertility-clinic',
|
||||
'settings' => [
|
||||
'onboarded' => true,
|
||||
'facility_type' => 'clinic',
|
||||
'plan' => 'pro',
|
||||
'plan_expires_at' => now()->addMonth()->toIso8601String(),
|
||||
'queue_integration_enabled' => true,
|
||||
],
|
||||
]);
|
||||
|
||||
Member::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'user_ref' => $this->owner->public_id,
|
||||
'role' => 'hospital_admin',
|
||||
'branch_id' => null,
|
||||
]);
|
||||
|
||||
$this->branch = Branch::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'name' => 'Main',
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
app(SpecialtyModuleService::class)->activate(
|
||||
$this->organization,
|
||||
$this->owner->public_id,
|
||||
'fertility',
|
||||
);
|
||||
|
||||
$department = Department::query()
|
||||
->where('branch_id', $this->branch->id)
|
||||
->where('type', 'fertility')
|
||||
->firstOrFail();
|
||||
|
||||
$this->patient = Patient::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $this->branch->id,
|
||||
'patient_number' => 'P-FER-SUITE',
|
||||
'first_name' => 'Abena',
|
||||
'last_name' => 'Owusu',
|
||||
'gender' => 'female',
|
||||
'date_of_birth' => '1992-11-18',
|
||||
]);
|
||||
|
||||
$this->visit = Visit::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $this->branch->id,
|
||||
'patient_id' => $this->patient->id,
|
||||
'status' => Visit::STATUS_IN_PROGRESS,
|
||||
'checked_in_at' => now(),
|
||||
'specialty_stage' => 'check_in',
|
||||
]);
|
||||
|
||||
Appointment::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $this->branch->id,
|
||||
'patient_id' => $this->patient->id,
|
||||
'department_id' => $department->id,
|
||||
'visit_id' => $this->visit->id,
|
||||
'type' => Appointment::TYPE_WALK_IN,
|
||||
'status' => Appointment::STATUS_IN_CONSULTATION,
|
||||
'scheduled_at' => now(),
|
||||
'waiting_at' => now(),
|
||||
'checked_in_at' => now(),
|
||||
'started_at' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_overview_and_exam_tabs_render(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.workspace', [
|
||||
'module' => 'fertility',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'overview',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('Fertility overview')
|
||||
->assertSee('data-care-stage-bar', false)
|
||||
->assertSee('Cycle note')
|
||||
->assertSee('Start history')
|
||||
->assertSee('Fertility reports');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.workspace', [
|
||||
'module' => 'fertility',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'exam',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('Chief complaint')
|
||||
->assertSee('Exam findings');
|
||||
}
|
||||
|
||||
public function test_exam_sets_stage_and_priority_alert(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.clinical.save', [
|
||||
'module' => 'fertility',
|
||||
'visit' => $this->visit,
|
||||
]), [
|
||||
'tab' => 'exam',
|
||||
'payload' => [
|
||||
'chief_complaint' => 'Primary infertility',
|
||||
'priority' => 'Time-sensitive',
|
||||
'partner_present' => '1',
|
||||
'cycle_day' => 3,
|
||||
'bmi' => 24,
|
||||
'exam_findings' => 'Pelvic exam unremarkable',
|
||||
'notes' => 'Discussed workup timeline',
|
||||
],
|
||||
])
|
||||
->assertRedirect();
|
||||
|
||||
$this->assertSame('exam', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
$record = SpecialtyClinicalRecord::query()
|
||||
->where('visit_id', $this->visit->id)
|
||||
->where('record_type', 'fert_exam')
|
||||
->firstOrFail();
|
||||
|
||||
$codes = collect($record->alerts)->pluck('code')->all();
|
||||
$this->assertContains('fer.priority_high', $codes);
|
||||
}
|
||||
|
||||
public function test_stage_advance_and_cycle_completes_visit(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.fertility.stage', $this->visit), [
|
||||
'stage' => 'cycle',
|
||||
])
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'fertility',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'cycle',
|
||||
]));
|
||||
|
||||
$this->assertSame('cycle', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.fertility.cycle', $this->visit), [
|
||||
'tab' => 'cycle',
|
||||
'payload' => [
|
||||
'cycle_type' => 'IUI',
|
||||
'cycle_day' => 14,
|
||||
'outcome' => 'Completed uneventfully',
|
||||
'notes' => 'IUI performed; luteal support started',
|
||||
'next_steps' => 'Pregnancy test in 14 days',
|
||||
],
|
||||
])
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'fertility',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'cycle',
|
||||
]));
|
||||
|
||||
$this->assertSame('completed', $this->visit->fresh()->specialty_stage);
|
||||
$this->assertSame(Visit::STATUS_COMPLETED, $this->visit->fresh()->status);
|
||||
$this->assertDatabaseHas('care_specialty_clinical_records', [
|
||||
'visit_id' => $this->visit->id,
|
||||
'record_type' => 'fert_cycle',
|
||||
'status' => SpecialtyClinicalRecord::STATUS_COMPLETED,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_reports_and_print(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.fertility.reports'))
|
||||
->assertOk()
|
||||
->assertSee('Fertility reports')
|
||||
->assertSee('Arrivals today');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.fertility.print', $this->visit))
|
||||
->assertOk()
|
||||
->assertSee('Fertility summary')
|
||||
->assertSee($this->patient->fullName());
|
||||
}
|
||||
|
||||
public function test_list_index_does_not_auto_open_patient(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.show', 'fertility'))
|
||||
->assertOk()
|
||||
->assertDontSee('Fertility overview');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Http\Middleware\EnsurePlatformSession;
|
||||
use App\Models\Appointment;
|
||||
use App\Models\Branch;
|
||||
use App\Models\Department;
|
||||
use App\Models\Member;
|
||||
use App\Models\Organization;
|
||||
use App\Models\Patient;
|
||||
use App\Models\SpecialtyClinicalRecord;
|
||||
use App\Models\User;
|
||||
use App\Models\Visit;
|
||||
use App\Services\Care\SpecialtyModuleService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class CarePodiatrySuiteTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected User $owner;
|
||||
|
||||
protected Organization $organization;
|
||||
|
||||
protected Branch $branch;
|
||||
|
||||
protected Patient $patient;
|
||||
|
||||
protected Visit $visit;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->withoutMiddleware(EnsurePlatformSession::class);
|
||||
|
||||
$this->owner = User::create([
|
||||
'public_id' => 'pod-owner',
|
||||
'name' => 'Owner',
|
||||
'email' => 'pod-owner@example.com',
|
||||
]);
|
||||
|
||||
$this->organization = Organization::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'name' => 'Podiatry Clinic',
|
||||
'slug' => 'podiatry-clinic',
|
||||
'settings' => [
|
||||
'onboarded' => true,
|
||||
'facility_type' => 'clinic',
|
||||
'plan' => 'pro',
|
||||
'plan_expires_at' => now()->addMonth()->toIso8601String(),
|
||||
'queue_integration_enabled' => true,
|
||||
],
|
||||
]);
|
||||
|
||||
Member::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'user_ref' => $this->owner->public_id,
|
||||
'role' => 'hospital_admin',
|
||||
'branch_id' => null,
|
||||
]);
|
||||
|
||||
$this->branch = Branch::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'name' => 'Main',
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
app(SpecialtyModuleService::class)->activate(
|
||||
$this->organization,
|
||||
$this->owner->public_id,
|
||||
'podiatry',
|
||||
);
|
||||
|
||||
$department = Department::query()
|
||||
->where('branch_id', $this->branch->id)
|
||||
->where('type', 'podiatry')
|
||||
->firstOrFail();
|
||||
|
||||
$this->patient = Patient::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $this->branch->id,
|
||||
'patient_number' => 'P-POD-SUITE',
|
||||
'first_name' => 'Kofi',
|
||||
'last_name' => 'Asante',
|
||||
'gender' => 'male',
|
||||
'date_of_birth' => '1965-08-03',
|
||||
]);
|
||||
|
||||
$this->visit = Visit::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $this->branch->id,
|
||||
'patient_id' => $this->patient->id,
|
||||
'status' => Visit::STATUS_IN_PROGRESS,
|
||||
'checked_in_at' => now(),
|
||||
'specialty_stage' => 'check_in',
|
||||
]);
|
||||
|
||||
Appointment::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $this->branch->id,
|
||||
'patient_id' => $this->patient->id,
|
||||
'department_id' => $department->id,
|
||||
'visit_id' => $this->visit->id,
|
||||
'type' => Appointment::TYPE_WALK_IN,
|
||||
'status' => Appointment::STATUS_IN_CONSULTATION,
|
||||
'scheduled_at' => now(),
|
||||
'waiting_at' => now(),
|
||||
'checked_in_at' => now(),
|
||||
'started_at' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_overview_and_exam_tabs_render(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.workspace', [
|
||||
'module' => 'podiatry',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'overview',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('Podiatry overview')
|
||||
->assertSee('data-care-stage-bar', false)
|
||||
->assertSee('Foot exam')
|
||||
->assertSee('Start history')
|
||||
->assertSee('Podiatry reports');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.workspace', [
|
||||
'module' => 'podiatry',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'exam',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('Chief complaint')
|
||||
->assertSee('Diabetic foot risk');
|
||||
}
|
||||
|
||||
public function test_exam_sets_stage_and_diabetes_alert(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.clinical.save', [
|
||||
'module' => 'podiatry',
|
||||
'visit' => $this->visit,
|
||||
]), [
|
||||
'tab' => 'exam',
|
||||
'payload' => [
|
||||
'chief_complaint' => 'Plantar ulcer',
|
||||
'side' => 'Right',
|
||||
'diabetes' => 'Active ulcer',
|
||||
'pulses' => 'Dorsalis pedis weak',
|
||||
'sensation' => 'Reduced monofilament',
|
||||
'skin_nails' => 'Callus surrounding ulcer',
|
||||
'ulcer' => '2cm plantar ulcer, clean base',
|
||||
'offloading' => 'Total contact cast planned',
|
||||
],
|
||||
])
|
||||
->assertRedirect();
|
||||
|
||||
$this->assertSame('exam', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
$record = SpecialtyClinicalRecord::query()
|
||||
->where('visit_id', $this->visit->id)
|
||||
->where('record_type', 'foot_exam')
|
||||
->firstOrFail();
|
||||
|
||||
$codes = collect($record->alerts)->pluck('code')->all();
|
||||
$this->assertContains('pod.diabetes_high', $codes);
|
||||
}
|
||||
|
||||
public function test_stage_advance_and_procedure_completes_visit(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.podiatry.stage', $this->visit), [
|
||||
'stage' => 'procedure',
|
||||
])
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'podiatry',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'procedure',
|
||||
]));
|
||||
|
||||
$this->assertSame('procedure', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.podiatry.procedure', $this->visit), [
|
||||
'tab' => 'procedure',
|
||||
'payload' => [
|
||||
'procedure' => 'Sharp debridement',
|
||||
'indication' => 'Diabetic foot ulcer',
|
||||
'outcome' => 'Completed uneventfully',
|
||||
'post_procedure_plan' => 'Dressing; offloading; review 1 week',
|
||||
],
|
||||
])
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'podiatry',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'procedure',
|
||||
]));
|
||||
|
||||
$this->assertSame('completed', $this->visit->fresh()->specialty_stage);
|
||||
$this->assertSame(Visit::STATUS_COMPLETED, $this->visit->fresh()->status);
|
||||
$this->assertDatabaseHas('care_specialty_clinical_records', [
|
||||
'visit_id' => $this->visit->id,
|
||||
'record_type' => 'pod_procedure',
|
||||
'status' => SpecialtyClinicalRecord::STATUS_COMPLETED,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_reports_and_print(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.podiatry.reports'))
|
||||
->assertOk()
|
||||
->assertSee('Podiatry reports')
|
||||
->assertSee('Arrivals today');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.podiatry.print', $this->visit))
|
||||
->assertOk()
|
||||
->assertSee('Podiatry summary')
|
||||
->assertSee($this->patient->fullName());
|
||||
}
|
||||
|
||||
public function test_list_index_does_not_auto_open_patient(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.show', 'podiatry'))
|
||||
->assertOk()
|
||||
->assertDontSee('Podiatry overview');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user