Add full Pediatrics, Orthopedics, and ENT specialty clinical suites.
Deploy Ladill Care / deploy (push) Successful in 43s
Deploy Ladill Care / deploy (push) Successful in 43s
Mirror Cardiology-depth stage flows, workspace tabs, reports/print, clinical alerts, demo seeds, and PHPUnit coverage for child health, fracture clinic, and ENT pathways. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,234 @@
|
||||
<?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 CareEntSuiteTest 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' => 'ent-owner',
|
||||
'name' => 'Owner',
|
||||
'email' => 'ent-owner@example.com',
|
||||
]);
|
||||
|
||||
$this->organization = Organization::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'name' => 'ENT Clinic',
|
||||
'slug' => 'ent-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,
|
||||
'ent',
|
||||
);
|
||||
|
||||
$department = Department::query()
|
||||
->where('branch_id', $this->branch->id)
|
||||
->where('type', 'ent')
|
||||
->firstOrFail();
|
||||
|
||||
$this->patient = Patient::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $this->branch->id,
|
||||
'patient_number' => 'P-ENT-SUITE',
|
||||
'first_name' => 'Esi',
|
||||
'last_name' => 'Throat',
|
||||
'gender' => 'female',
|
||||
'date_of_birth' => '1988-09-02',
|
||||
]);
|
||||
|
||||
$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' => 'ent',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'overview',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('ENT overview')
|
||||
->assertSee('data-care-stage-bar', false)
|
||||
->assertSee('Start history')
|
||||
->assertSee('ENT reports');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.workspace', [
|
||||
'module' => 'ent',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'exam',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('Chief complaint')
|
||||
->assertSee('Airway concern');
|
||||
}
|
||||
|
||||
public function test_exam_sets_stage_and_airway_alert(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.clinical.save', [
|
||||
'module' => 'ent',
|
||||
'visit' => $this->visit,
|
||||
]), [
|
||||
'tab' => 'exam',
|
||||
'payload' => [
|
||||
'chief_complaint' => 'Sore throat with muffled voice',
|
||||
'throat_findings' => 'Unilateral tonsillar bulge',
|
||||
'airway_concern' => '1',
|
||||
'exam_summary' => 'Possible peritonsillar abscess',
|
||||
],
|
||||
])
|
||||
->assertRedirect();
|
||||
|
||||
$this->assertSame('exam', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
$record = SpecialtyClinicalRecord::query()
|
||||
->where('visit_id', $this->visit->id)
|
||||
->where('record_type', 'ent_exam')
|
||||
->firstOrFail();
|
||||
|
||||
$codes = collect($record->alerts)->pluck('code')->all();
|
||||
$this->assertContains('ent.airway_concern', $codes);
|
||||
}
|
||||
|
||||
public function test_stage_advance_and_procedure_completes_visit(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.ent.stage', $this->visit), [
|
||||
'stage' => 'procedure',
|
||||
])
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'ent',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'procedure',
|
||||
]));
|
||||
|
||||
$this->assertSame('procedure', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.ent.procedure', $this->visit), [
|
||||
'tab' => 'procedure',
|
||||
'payload' => [
|
||||
'procedure' => 'Needle aspiration of PTA',
|
||||
'indication' => 'Peritonsillar abscess',
|
||||
'outcome' => 'Completed uneventfully',
|
||||
'post_procedure_plan' => 'IV antibiotics; airway observation',
|
||||
],
|
||||
])
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'ent',
|
||||
'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' => 'ent_procedure',
|
||||
'status' => SpecialtyClinicalRecord::STATUS_COMPLETED,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_reports_and_print(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.ent.reports'))
|
||||
->assertOk()
|
||||
->assertSee('ENT reports')
|
||||
->assertSee('Arrivals today');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.ent.print', $this->visit))
|
||||
->assertOk()
|
||||
->assertSee('ENT 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', 'ent'))
|
||||
->assertOk()
|
||||
->assertDontSee('ENT overview');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
<?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 CareOrthopedicsSuiteTest 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' => 'ort-owner',
|
||||
'name' => 'Owner',
|
||||
'email' => 'ort-owner@example.com',
|
||||
]);
|
||||
|
||||
$this->organization = Organization::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'name' => 'Orthopedics Clinic',
|
||||
'slug' => 'orthopedics-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,
|
||||
'orthopedics',
|
||||
);
|
||||
|
||||
$department = Department::query()
|
||||
->where('branch_id', $this->branch->id)
|
||||
->where('type', 'orthopedics')
|
||||
->firstOrFail();
|
||||
|
||||
$this->patient = Patient::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $this->branch->id,
|
||||
'patient_number' => 'P-ORT-SUITE',
|
||||
'first_name' => 'Kofi',
|
||||
'last_name' => 'Fracture',
|
||||
'gender' => 'male',
|
||||
'date_of_birth' => '1990-06-10',
|
||||
]);
|
||||
|
||||
$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' => 'orthopedics',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'overview',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('Orthopedics overview')
|
||||
->assertSee('data-care-stage-bar', false)
|
||||
->assertSee('Procedure / cast')
|
||||
->assertSee('Start history')
|
||||
->assertSee('Orthopedics reports');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.workspace', [
|
||||
'module' => 'orthopedics',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'exam',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('Chief complaint')
|
||||
->assertSee('Neurovascular status');
|
||||
}
|
||||
|
||||
public function test_exam_sets_stage_and_nv_alert(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.clinical.save', [
|
||||
'module' => 'orthopedics',
|
||||
'visit' => $this->visit,
|
||||
]), [
|
||||
'tab' => 'exam',
|
||||
'payload' => [
|
||||
'chief_complaint' => 'Wrist deformity',
|
||||
'side' => 'Right',
|
||||
'region' => 'Distal radius',
|
||||
'neurovascular' => 'Sensory deficit',
|
||||
'exam_findings' => 'Closed injury',
|
||||
],
|
||||
])
|
||||
->assertRedirect();
|
||||
|
||||
$this->assertSame('exam', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
$record = SpecialtyClinicalRecord::query()
|
||||
->where('visit_id', $this->visit->id)
|
||||
->where('record_type', 'ortho_exam')
|
||||
->firstOrFail();
|
||||
|
||||
$codes = collect($record->alerts)->pluck('code')->all();
|
||||
$this->assertContains('ort.nv_deficit', $codes);
|
||||
}
|
||||
|
||||
public function test_stage_advance_and_procedure_completes_visit(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.orthopedics.stage', $this->visit), [
|
||||
'stage' => 'procedure',
|
||||
])
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'orthopedics',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'procedure',
|
||||
]));
|
||||
|
||||
$this->assertSame('procedure', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.orthopedics.procedure', $this->visit), [
|
||||
'tab' => 'procedure',
|
||||
'payload' => [
|
||||
'procedure' => 'Closed reduction + cast',
|
||||
'indication' => 'Displaced distal radius fracture',
|
||||
'outcome' => 'Completed uneventfully',
|
||||
'post_procedure_plan' => 'Elevate; cast check in 1 week',
|
||||
],
|
||||
])
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'orthopedics',
|
||||
'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' => 'ortho_procedure',
|
||||
'status' => SpecialtyClinicalRecord::STATUS_COMPLETED,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_reports_and_print(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.orthopedics.reports'))
|
||||
->assertOk()
|
||||
->assertSee('Orthopedics reports')
|
||||
->assertSee('Arrivals today');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.orthopedics.print', $this->visit))
|
||||
->assertOk()
|
||||
->assertSee('Orthopedics 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', 'orthopedics'))
|
||||
->assertOk()
|
||||
->assertDontSee('Orthopedics overview');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
<?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 CarePediatricsSuiteTest 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' => 'ped-owner',
|
||||
'name' => 'Owner',
|
||||
'email' => 'ped-owner@example.com',
|
||||
]);
|
||||
|
||||
$this->organization = Organization::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'name' => 'Pediatrics Clinic',
|
||||
'slug' => 'pediatrics-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,
|
||||
'pediatrics',
|
||||
);
|
||||
|
||||
$department = Department::query()
|
||||
->where('branch_id', $this->branch->id)
|
||||
->where('type', 'pediatrics')
|
||||
->firstOrFail();
|
||||
|
||||
$this->patient = Patient::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $this->branch->id,
|
||||
'patient_number' => 'P-PED-SUITE',
|
||||
'first_name' => 'Ama',
|
||||
'last_name' => 'Child',
|
||||
'gender' => 'female',
|
||||
'date_of_birth' => '2024-01-15',
|
||||
]);
|
||||
|
||||
$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_growth_tabs_render(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.workspace', [
|
||||
'module' => 'pediatrics',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'overview',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('Pediatrics overview')
|
||||
->assertSee('data-care-stage-bar', false)
|
||||
->assertSee('Exam / growth')
|
||||
->assertSee('Start history')
|
||||
->assertSee('Pediatrics reports');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.workspace', [
|
||||
'module' => 'pediatrics',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'growth',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('Chief complaint')
|
||||
->assertSee('Growth concern');
|
||||
}
|
||||
|
||||
public function test_exam_sets_stage_and_growth_alert(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.clinical.save', [
|
||||
'module' => 'pediatrics',
|
||||
'visit' => $this->visit,
|
||||
]), [
|
||||
'tab' => 'growth',
|
||||
'payload' => [
|
||||
'chief_complaint' => 'Fever',
|
||||
'weight_kg' => 8.2,
|
||||
'temperature_c' => 39.2,
|
||||
'growth_concern' => 'Underweight',
|
||||
'examination' => 'Irritable; mild dehydration',
|
||||
],
|
||||
])
|
||||
->assertRedirect();
|
||||
|
||||
$this->assertSame('exam', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
$record = SpecialtyClinicalRecord::query()
|
||||
->where('visit_id', $this->visit->id)
|
||||
->where('record_type', 'pediatric_exam')
|
||||
->firstOrFail();
|
||||
|
||||
$codes = collect($record->alerts)->pluck('code')->all();
|
||||
$this->assertContains('ped.growth_concern', $codes);
|
||||
$this->assertContains('ped.fever_high', $codes);
|
||||
}
|
||||
|
||||
public function test_stage_advance_and_treatment_completes_visit(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.pediatrics.stage', $this->visit), [
|
||||
'stage' => 'treatment',
|
||||
])
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'pediatrics',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'treatment',
|
||||
]));
|
||||
|
||||
$this->assertSame('treatment', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.pediatrics.treatment', $this->visit), [
|
||||
'tab' => 'treatment',
|
||||
'payload' => [
|
||||
'treatment' => 'Measles immunization',
|
||||
'vaccine_or_procedure' => 'Measles dose 1',
|
||||
'site_route' => 'Left upper arm / IM',
|
||||
'outcome' => 'Completed uneventfully',
|
||||
'post_treatment_plan' => 'Observe 15 minutes; fever advice',
|
||||
],
|
||||
])
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'pediatrics',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'treatment',
|
||||
]));
|
||||
|
||||
$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' => 'ped_treatment',
|
||||
'status' => SpecialtyClinicalRecord::STATUS_COMPLETED,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_reports_and_print(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.pediatrics.reports'))
|
||||
->assertOk()
|
||||
->assertSee('Pediatrics reports')
|
||||
->assertSee('Arrivals today');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.pediatrics.print', $this->visit))
|
||||
->assertOk()
|
||||
->assertSee('Pediatrics 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', 'pediatrics'))
|
||||
->assertOk()
|
||||
->assertDontSee('Pediatrics overview');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user