Include checked-in clinic visits on outpatient nursing boards.
Deploy Ladill Care / deploy (push) Successful in 2m12s
Deploy Ladill Care / deploy (push) Successful in 2m12s
OPD/service units list open department appointments without manual place; nursing actions soft-place the visit onto the unit. Inpatient wards stay placement-only. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -9,6 +9,7 @@ use App\Models\Department;
|
||||
use App\Models\Visit;
|
||||
use App\Services\Care\AuditLogger;
|
||||
use App\Services\Care\CarePermissions;
|
||||
use App\Services\Care\CareUnitCensusService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\Rule;
|
||||
@@ -110,13 +111,8 @@ class CareUnitController extends Controller
|
||||
|
||||
$careUnit->load(['department.branch', 'beds']);
|
||||
|
||||
$placedVisits = Visit::owned($this->ownerRef($request))
|
||||
->where('organization_id', $organization->id)
|
||||
->where('care_unit_id', $careUnit->id)
|
||||
->whereIn('status', [Visit::STATUS_OPEN, Visit::STATUS_IN_PROGRESS])
|
||||
->with(['patient', 'bed'])
|
||||
->orderBy('placed_at')
|
||||
->get();
|
||||
$census = app(CareUnitCensusService::class);
|
||||
$placedVisits = $census->visitsForUnit($careUnit, $this->ownerRef($request));
|
||||
|
||||
$placeableVisits = Visit::owned($this->ownerRef($request))
|
||||
->where('organization_id', $organization->id)
|
||||
@@ -126,6 +122,7 @@ class CareUnitController extends Controller
|
||||
$q->whereNull('care_unit_id')
|
||||
->orWhere('care_unit_id', '!=', $careUnit->id);
|
||||
})
|
||||
->whereNotIn('id', $placedVisits->pluck('id')->all() ?: [0])
|
||||
->with(['patient', 'careUnit'])
|
||||
->orderByDesc('checked_in_at')
|
||||
->limit(50)
|
||||
@@ -146,6 +143,7 @@ class CareUnitController extends Controller
|
||||
'placeableVisits' => $placeableVisits,
|
||||
'availableBeds' => $availableBeds,
|
||||
'canPlace' => $canPlace,
|
||||
'isClinicUnit' => $census->isClinicUnit($careUnit),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user