Add full Vaccination, Pathology, and Infusion specialty clinical suites.
Deploy Ladill Care / deploy (push) Successful in 34s
Deploy Ladill Care / deploy (push) Successful in 34s
Mirror Oncology-depth stage flows, workspace controllers, clinical forms, reports/print, demo seed, and suite tests. Pathology stays clinic specialty complementary to the Lab app. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,230 @@
|
||||
<?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 CareInfusionSuiteTest 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' => 'inf-owner',
|
||||
'name' => 'Owner',
|
||||
'email' => 'inf-owner@example.com',
|
||||
]);
|
||||
|
||||
$this->organization = Organization::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'name' => 'Infusion Clinic',
|
||||
'slug' => 'inf-owner-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,
|
||||
'infusion',
|
||||
);
|
||||
|
||||
$department = Department::query()
|
||||
->where('branch_id', $this->branch->id)
|
||||
->where('type', 'infusion')
|
||||
->firstOrFail();
|
||||
|
||||
$this->patient = Patient::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $this->branch->id,
|
||||
'patient_number' => 'P-INF-SUITE',
|
||||
'first_name' => 'Efua',
|
||||
'last_name' => 'Infusion',
|
||||
'gender' => 'female',
|
||||
'date_of_birth' => '1992-11-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_clinical_tabs_render(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.workspace', [
|
||||
'module' => 'infusion',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'overview',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('Infusion overview')
|
||||
->assertSee('data-care-stage-bar', false)
|
||||
->assertSee('Start assessment')
|
||||
->assertSee('Infusion reports');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.workspace', [
|
||||
'module' => 'infusion',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'assessment',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('Fit for infusion');
|
||||
}
|
||||
|
||||
public function test_clinical_save_sets_stage_and_alerts(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.clinical.save', [
|
||||
'module' => 'infusion',
|
||||
'visit' => $this->visit,
|
||||
]), [
|
||||
'tab' => 'assessment',
|
||||
'payload' => [
|
||||
'indication' => 'IV iron',
|
||||
'history' => 'Symptomatic anaemia',
|
||||
'fit_for_infusion' => '0',
|
||||
],
|
||||
])
|
||||
->assertRedirect();
|
||||
|
||||
$this->assertSame('assessment', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
$record = SpecialtyClinicalRecord::query()
|
||||
->where('visit_id', $this->visit->id)
|
||||
->firstOrFail();
|
||||
|
||||
$codes = collect($record->alerts)->pluck('code')->all();
|
||||
$this->assertContains('inf.not_fit', $codes);
|
||||
}
|
||||
|
||||
public function test_stage_advance_and_terminal_completes_visit(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.infusion.stage', $this->visit), [
|
||||
'stage' => 'monitoring',
|
||||
])
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'infusion',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'monitoring',
|
||||
]));
|
||||
|
||||
$this->assertSame('monitoring', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.infusion.monitoring', $this->visit), [
|
||||
'tab' => 'monitoring',
|
||||
'payload' => [
|
||||
'post_vitals' => 'Stable',
|
||||
'reaction' => 'None',
|
||||
'advice' => 'Return if fever',
|
||||
'outcome' => 'Completed — discharged',
|
||||
],
|
||||
])
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'infusion',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'monitoring',
|
||||
]));
|
||||
|
||||
$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' => 'infusion_monitoring',
|
||||
'status' => SpecialtyClinicalRecord::STATUS_COMPLETED,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_reports_and_print(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.infusion.reports'))
|
||||
->assertOk()
|
||||
->assertSee('Infusion reports')
|
||||
->assertSee('Arrivals today');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.infusion.print', $this->visit))
|
||||
->assertOk()
|
||||
->assertSee($this->patient->fullName());
|
||||
}
|
||||
|
||||
public function test_list_index_does_not_auto_open_patient(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.show', 'infusion'))
|
||||
->assertOk()
|
||||
->assertDontSee('Infusion overview');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
<?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 CarePathologySuiteTest 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' => 'path-owner',
|
||||
'name' => 'Owner',
|
||||
'email' => 'path-owner@example.com',
|
||||
]);
|
||||
|
||||
$this->organization = Organization::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'name' => 'Pathology Clinic',
|
||||
'slug' => 'path-owner-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,
|
||||
'pathology',
|
||||
);
|
||||
|
||||
$department = Department::query()
|
||||
->where('branch_id', $this->branch->id)
|
||||
->where('type', 'pathology')
|
||||
->firstOrFail();
|
||||
|
||||
$this->patient = Patient::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $this->branch->id,
|
||||
'patient_number' => 'P-PATH-SUITE',
|
||||
'first_name' => 'Ama',
|
||||
'last_name' => 'Biopsy',
|
||||
'gender' => 'female',
|
||||
'date_of_birth' => '1985-08-20',
|
||||
]);
|
||||
|
||||
$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_clinical_tabs_render(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.workspace', [
|
||||
'module' => 'pathology',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'overview',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('Pathology overview')
|
||||
->assertSee('data-care-stage-bar', false)
|
||||
->assertSee('Start request')
|
||||
->assertSee('Pathology reports');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.workspace', [
|
||||
'module' => 'pathology',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'request',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('Specimen type');
|
||||
}
|
||||
|
||||
public function test_clinical_save_sets_stage_and_alerts(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.clinical.save', [
|
||||
'module' => 'pathology',
|
||||
'visit' => $this->visit,
|
||||
]), [
|
||||
'tab' => 'request',
|
||||
'payload' => [
|
||||
'specimen_type' => 'Breast core biopsy',
|
||||
'site' => 'Left breast',
|
||||
'clinical_history' => 'Palpable mass',
|
||||
'urgency' => 'Urgent',
|
||||
'tests_requested' => 'Histo',
|
||||
],
|
||||
])
|
||||
->assertRedirect();
|
||||
|
||||
$this->assertSame('request', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
$record = SpecialtyClinicalRecord::query()
|
||||
->where('visit_id', $this->visit->id)
|
||||
->firstOrFail();
|
||||
|
||||
$codes = collect($record->alerts)->pluck('code')->all();
|
||||
$this->assertContains('path.urgent', $codes);
|
||||
}
|
||||
|
||||
public function test_stage_advance_and_terminal_completes_visit(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.pathology.stage', $this->visit), [
|
||||
'stage' => 'verified',
|
||||
])
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'pathology',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'verification',
|
||||
]));
|
||||
|
||||
$this->assertSame('verified', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.pathology.verification', $this->visit), [
|
||||
'tab' => 'verification',
|
||||
'payload' => [
|
||||
'verified' => '1',
|
||||
'verified_by' => 'Dr Path',
|
||||
'released' => '1',
|
||||
'outcome' => 'Completed — released',
|
||||
],
|
||||
])
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'pathology',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'verification',
|
||||
]));
|
||||
|
||||
$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' => 'path_verification',
|
||||
'status' => SpecialtyClinicalRecord::STATUS_COMPLETED,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_reports_and_print(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.pathology.reports'))
|
||||
->assertOk()
|
||||
->assertSee('Pathology reports')
|
||||
->assertSee('Arrivals today');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.pathology.print', $this->visit))
|
||||
->assertOk()
|
||||
->assertSee($this->patient->fullName());
|
||||
}
|
||||
|
||||
public function test_list_index_does_not_auto_open_patient(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.show', 'pathology'))
|
||||
->assertOk()
|
||||
->assertDontSee('Pathology overview');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
<?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 CareVaccinationSuiteTest 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' => 'vax-owner',
|
||||
'name' => 'Owner',
|
||||
'email' => 'vax-owner@example.com',
|
||||
]);
|
||||
|
||||
$this->organization = Organization::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'name' => 'Vaccination Clinic',
|
||||
'slug' => 'vax-owner-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,
|
||||
'vaccination',
|
||||
);
|
||||
|
||||
$department = Department::query()
|
||||
->where('branch_id', $this->branch->id)
|
||||
->where('type', 'vaccination')
|
||||
->firstOrFail();
|
||||
|
||||
$this->patient = Patient::create([
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $this->branch->id,
|
||||
'patient_number' => 'P-VAX-SUITE',
|
||||
'first_name' => 'Kwame',
|
||||
'last_name' => 'Vaccine',
|
||||
'gender' => 'male',
|
||||
'date_of_birth' => '1990-04-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_clinical_tabs_render(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.workspace', [
|
||||
'module' => 'vaccination',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'overview',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('Vaccination overview')
|
||||
->assertSee('data-care-stage-bar', false)
|
||||
->assertSee('Start eligibility')
|
||||
->assertSee('Vaccination reports');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.workspace', [
|
||||
'module' => 'vaccination',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'eligibility',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('Cleared to vaccinate');
|
||||
}
|
||||
|
||||
public function test_clinical_save_sets_stage_and_alerts(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.clinical.save', [
|
||||
'module' => 'vaccination',
|
||||
'visit' => $this->visit,
|
||||
]), [
|
||||
'tab' => 'eligibility',
|
||||
'payload' => [
|
||||
'vaccine' => 'Yellow fever',
|
||||
'schedule' => 'Travel',
|
||||
'contraindications' => '1',
|
||||
'fever_today' => '1',
|
||||
'cleared' => '0',
|
||||
],
|
||||
])
|
||||
->assertRedirect();
|
||||
|
||||
$this->assertSame('eligibility', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
$record = SpecialtyClinicalRecord::query()
|
||||
->where('visit_id', $this->visit->id)
|
||||
->firstOrFail();
|
||||
|
||||
$codes = collect($record->alerts)->pluck('code')->all();
|
||||
$this->assertContains('vax.not_cleared', $codes);
|
||||
}
|
||||
|
||||
public function test_stage_advance_and_terminal_completes_visit(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.vaccination.stage', $this->visit), [
|
||||
'stage' => 'observation',
|
||||
])
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'vaccination',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'observation',
|
||||
]));
|
||||
|
||||
$this->assertSame('observation', $this->visit->fresh()->specialty_stage);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.specialty.vaccination.observation', $this->visit), [
|
||||
'tab' => 'observation',
|
||||
'payload' => [
|
||||
'observation_minutes' => '15',
|
||||
'vitals' => 'Stable',
|
||||
'aefi' => 'None',
|
||||
'advice' => 'Paracetamol PRN',
|
||||
'outcome' => 'Completed — discharged',
|
||||
],
|
||||
])
|
||||
->assertRedirect(route('care.specialty.workspace', [
|
||||
'module' => 'vaccination',
|
||||
'visit' => $this->visit,
|
||||
'tab' => 'observation',
|
||||
]));
|
||||
|
||||
$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' => 'vax_observation',
|
||||
'status' => SpecialtyClinicalRecord::STATUS_COMPLETED,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_reports_and_print(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.vaccination.reports'))
|
||||
->assertOk()
|
||||
->assertSee('Vaccination reports')
|
||||
->assertSee('Arrivals today');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.vaccination.print', $this->visit))
|
||||
->assertOk()
|
||||
->assertSee($this->patient->fullName());
|
||||
}
|
||||
|
||||
public function test_list_index_does_not_auto_open_patient(): void
|
||||
{
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.show', 'vaccination'))
|
||||
->assertOk()
|
||||
->assertDontSee('Vaccination overview');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user