first(); $dept_chev_xr = Department::where('name', 'DR')->first(); $chev_dep_ct_mr = Department::where('name', 'Imaging')->first(); $dr_modalities = ['DR', 'CR', 'DX', 'MG', 'OT', 'RF', 'XA', 'XRF', 'DXA', 'DBT', 'OPT']; $dr = collect($dr_modalities)->map(fn ($modality) => sprintf('"%s"', $modality))->implode(', '); DicomRoutingRule::create( [ 'is_active' => true, 'name' => 'Chevron Panchlaish Imaging', 'organization_id' => $chev->id, 'department_id' => $chev_dep_ct_mr->id, 'condition' => sprintf('(study.institution_name ?? "" starts with "chevron") and (study.modality not in [%s])', $dr), ] ); DicomRoutingRule::create( [ 'is_active' => true, 'name' => 'Chevron Panchlaish X-ray', 'organization_id' => $chev->id, 'department_id' => $dept_chev_xr->id, 'condition' => sprintf('(study.institution_name ?? "" starts with "chevron") and (study.modality in [%s])', $dr), 'priority' => 99, ] ); } }