Compare commits
10 Commits
0da8e2bc34
...
8e3798b32b
Author | SHA1 | Date | |
---|---|---|---|
8e3798b32b | |||
7f5d594a24 | |||
05b615fc75 | |||
6a1dd35da5 | |||
ef2dd84cfb | |||
8565d35fe9 | |||
7e1d141338 | |||
fcfe1278f7 | |||
3ad9e8633e | |||
10c96a54c4 |
@ -36,16 +36,11 @@ function array_purge(array $ary): array
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! function_exists('array_trim_strings')) {
|
if (! function_exists('array_trim_strings')) {
|
||||||
function array_trim_strings(array $ary): array
|
function array_trim_strings(array $ary, bool $null_if_blank = false): array
|
||||||
{
|
{
|
||||||
return array_filter($ary, function ($v) {
|
$trimmed = array_map(static fn ($v) => is_string($v) ? trim($v) : $v, $ary);
|
||||||
if (! is_string($v)) {
|
|
||||||
return $v;
|
|
||||||
}
|
|
||||||
$v = trim($v);
|
|
||||||
|
|
||||||
return blank($v) ? null : $v;
|
return $null_if_blank ? array_map(static fn ($v) => empty($v) ? null : $v, $trimmed) : $trimmed;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
database/data/departments.csv
Normal file
3
database/data/departments.csv
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
is_active,organization,name
|
||||||
|
1,Chevron Panchlaish,DR
|
||||||
|
1,Chevron Panchlaish,Imaging
|
|
3
database/data/dicom-servers.csv
Normal file
3
database/data/dicom-servers.csv
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
is_active,server_name,geo_code,host,http_port,dicom_port,rest_api_endpoint,ae_title,username,password,wado_path,stone_viewer_path,ohif_viewer_path,meddream_viewer_path,organization,department
|
||||||
|
1,CTG-1,BD,cgp1.telerad24.com,8042,4242,http://cgp1.telerad24.com:8042/,BLACKFISH,,,dicom-web,stone-webviewer/index.html,ohif/viewer,,,
|
||||||
|
1,NBG-1,DE,de1.telerad24.com,8042,4242,http://de1.telerad24.com:8042/,BLACKFISH,,,dicom-web,stone-webviewer/index.html,ohif/viewer,,,
|
|
5
database/data/organizations.csv
Normal file
5
database/data/organizations.csv
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
name,is_active
|
||||||
|
CATCH-ALL,1
|
||||||
|
Chevron Panchlaish,1
|
||||||
|
Chevron Boropole,1
|
||||||
|
Chevron Shantibag,1
|
|
27
database/data/users.csv
Normal file
27
database/data/users.csv
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
DNAME,PREFIX,FNAME,LNAME,DEGREE,USERNAME,EMAIL,PHONE,ROLE,ORG,DEPT,SIGN_IMG
|
||||||
|
Dr. Sadrul ,Dr.,Sadrul ,Amin ,"MBBS, FCPS, M-Phil, MD (Radiology & Imaging), Ex-Associate Professor, Department of Radiology & Imaging, Bangabandhu Sheikh Mujib Medical University, BMDC Reg. No: A-26619",aminsadrul@gmail.com,aminsadrul@gmail.com,8801711362820,RAD,,,sadrul-amin.png
|
||||||
|
Prof. Dr. Subash ,Prof. Dr.,Subash ,Mazumder,"MBBS, MD, HOD (Radiology & Imaging), Chittagong Medical College Hospital. BMDC Reg. No: A 23715",subashmajumder@yahoo.com,subashmajumder@yahoo.com,8801819329484,RAD,,,subash.png
|
||||||
|
Dr. Goutam ,Dr.,Goutam,Chowdhury ,"MBBS, M.MED, MRCR (London), Fellow Radiology, Act (Neuro-Radiology), Consultant, Radiology & Imaging. BMDC Reg. No: A-32086",drgoutam,,,RAD,,,
|
||||||
|
Brig. Gen. Khairul,Brig. Gen. Dr.,Md. Khairul ,Islam,"MBBS, FCPS (Radiology & Imaging), Advanced Training on MRI, CT & Coronary CT Angiogram (India). Senior Consultant, Radiology & Imaging",drkhairul,,8801715059151,RAD,,,khairul-islam.png
|
||||||
|
Prof. Dr. Col. Nasir,Prof. Dr.Col. (Retd),Md. Nasir ,Uddin,"MBBS, FCPS, ARDMS, RVT, ARMRIT (USA), TMSS Medical College & Hospital, Bogura, Consultant Radiologist, Popular Diagnostic Center. BMDC Reg. No: A-21609",drnasir770@gmail.com,drnasir770@gmail.com,8801715748987,RAD,,,nasir-uddin.png
|
||||||
|
Prof. Brig. Gen. Saad ,Prof. (Brig. Gen),A M Hossain,Saad,"Classified Specialist, Radiology & Imaging, Armed Forces Medical College, Dhaka Cantonment. MBBS, FCPS. Fellow CT Scan (Dublin & Germany). Fellow MRI (KSA)",drsaad,,8801715059151,RAD,,,hossain-saad.png
|
||||||
|
Brig. Gen. Anwarul,Brig. Gen. (Retd),M Anwarul ,Haque,"MBBS. FCPS.(Radiology). Advance Training in CT & MRI (KSA), BMDC Reg. No: A -13336",dr.mahaque60@gmail.com,dr.mahaque60@gmail.com,8801911302505,RAD,,,
|
||||||
|
Dr. Moinul ,Dr.,Mohammad Moinul,Hossain,"MBBS, MD (Radiology & Imaging)-BSMMU, Consultant (Radiology & Imaging), Radiology & Imaging Specialist, BMDC Reg. No: A-33097",mmhossainsa06@gmail.com,mmhossainsa06@gmail.com,8801715129437,RAD,,,
|
||||||
|
Prof. Rabeya ,Asst. Prof. Dr. ,Rabeya,Khatoon,"MBBS, MCPS, MD (BSMMU), Consultant, Radiolgoy & Imaging, BIRDEM, Dhaka. BMDC Reg. No: A-47981",drrabeya,,,RAD,,,rabeya-khatoon.png
|
||||||
|
Prof. Col. Anowar,Prof. Col. Dr.,Anowar ,Hossain,"MBBS,FCPS (Radiology & Imaging), Fellow Cardiovascular Imaging (CT and MRI). All India Institute of Medical Science, New Delhi, India. Department of Radiology & Imaging Armed Forces Medical College & CMH Dhaka, BMDC Reg No : A-32496",dranowar,,8801795430240,RAD,,,
|
||||||
|
Dr. Hamid,Dr.,Hamid ,Alam ,,drhamid,,16462956323,RAD,,,
|
||||||
|
Dr. Shabiha ,Dr.,Shabiha,Quadir ,,dr.shabihaquadir@gmail.com,dr.shabihaquadir@gmail.com,8801819876760,RAD,,,
|
||||||
|
Dr. Ehsan,Dr.,Ehsan S,Choudhury,,ehsanchy@gmail.com,ehsanchy@gmail.com,8801711898269,RAD,,,
|
||||||
|
Dr. Mobin,Dr.,Mobinul Alam,Chowdhury ,,mobinchy@hotmail.com,mobinchy@hotmail.com,8801819775757,RAD,,,
|
||||||
|
Noor Mohammad ,,Noor ,Mohammad ,,noor.mohammad024@gmail.com,noor.mohammad024@gmail.com,8801716817712,TECH,Chevron Panchlaish,Imaging,
|
||||||
|
Ali Akbar ,,Ali ,Akbar ,,ali.akbar.ri@gmail.com,ali.akbar.ri@gmail.com,8801816913564,TECH,Chevron Panchlaish,Imaging,
|
||||||
|
Bulbul,,Mahbubul ,Islam ,,bulbulislam10@gmail.com,bulbulislam10@gmail.com,8801761587552,TECH,Chevron Panchlaish,Imaging,
|
||||||
|
Zulhas,,Zillur Rahman,Zulhas,,rahmanmdzillur9@gmail.com,rahmanmdzillur9@gmail.com,8801868658028,TECH,Chevron Panchlaish,Imaging,
|
||||||
|
Dr. Masroor,Dr.,Masroor Ehsan,Choudhury,,masroor,masroore@gmail.com,8801733938582,ADMIN,,,
|
||||||
|
Sumit,,Sumit,Majumder,,sumit.chvrnit@gmail.com,sumit.chvrnit@gmail.com,8801822224492,ADMIN,,,
|
||||||
|
Saiful,,Saiful,Islam,,saiful,,8801824534945,TECH,Chevron Panchlaish,Imaging,
|
||||||
|
Apon,,Apon,,,apon,,8801627970974,TECH,Chevron Panchlaish,Imaging,
|
||||||
|
Chevron CR,,X-ray,Tech,,chevroncr,,,TECH,Chevron Panchlaish,DR,
|
||||||
|
Dr. Gopinathan,Dr.,Gopinathan,,"MBBS, MDRD, Reg No.62980",drgopinathan,,,RAD,,,
|
||||||
|
Dr. Sudha,Dr.,K Sudha,,"MBBS, MDRD",drsudha,,,RAD,,,
|
||||||
|
Dr. Rajkumar,Dr.,Rajkumar,,MBBS MDRD Reg No.TMMC130572,drrajkumar,,,RAD,,,
|
|
@ -15,9 +15,10 @@ public function run(): void
|
|||||||
$this->call([
|
$this->call([
|
||||||
RoleSeeder::class,
|
RoleSeeder::class,
|
||||||
OrganizationSeeder::class,
|
OrganizationSeeder::class,
|
||||||
|
DicomServerSeeder::class,
|
||||||
|
DicomRoutingRuleSeeder::class,
|
||||||
UserSeeder::class,
|
UserSeeder::class,
|
||||||
ModalityProcedureSeeder::class,
|
ModalityProcedureSeeder::class,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
43
database/seeders/DicomRoutingRuleSeeder.php
Normal file
43
database/seeders/DicomRoutingRuleSeeder.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\Department;
|
||||||
|
use App\Models\DicomRoutingRule;
|
||||||
|
use App\Models\Organization;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class DicomRoutingRuleSeeder extends Seeder
|
||||||
|
{
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
$chev = Organization::where('name', 'Chevron Panchlaish')->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,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
43
database/seeders/DicomServerSeeder.php
Normal file
43
database/seeders/DicomServerSeeder.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\DicomServer;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class DicomServerSeeder extends Seeder
|
||||||
|
{
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
$skip_first = true;
|
||||||
|
$csv_file = fopen(base_path('database/data/dicom-servers.csv'), 'r');
|
||||||
|
while (($data = fgetcsv($csv_file, 2000, ',')) !== false) {
|
||||||
|
if ($skip_first) {
|
||||||
|
$skip_first = false;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$data = array_trim_strings($data, true);
|
||||||
|
DicomServer::create([
|
||||||
|
'is_active' => (bool) $data['0'],
|
||||||
|
'server_name' => strtoupper($data['1']),
|
||||||
|
'geo_code' => $data['2'],
|
||||||
|
'host' => $data['3'],
|
||||||
|
'http_port' => $data['4'],
|
||||||
|
'dicom_port' => $data['5'],
|
||||||
|
'rest_api_endpoint' => $data['6'],
|
||||||
|
'ae_title' => strtoupper($data['7']),
|
||||||
|
'username' => strtolower($data['8'] ?? ''),
|
||||||
|
'password' => $data['9'],
|
||||||
|
'wado_path' => $data['10'],
|
||||||
|
'stone_viewer_path' => $data['11'],
|
||||||
|
'ohif_viewer_path' => $data['12'],
|
||||||
|
'meddream_viewer_path' => $data['13'],
|
||||||
|
// 'organization' => $data['14'],
|
||||||
|
// 'department' => $data['15'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
fclose($csv_file);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -3,8 +3,6 @@
|
|||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\Department;
|
use App\Models\Department;
|
||||||
use App\Models\DicomRoutingRule;
|
|
||||||
use App\Models\DicomServer;
|
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
@ -12,157 +10,39 @@ class OrganizationSeeder extends Seeder
|
|||||||
{
|
{
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
Organization::create([
|
$organizations = [];
|
||||||
'name' => 'CATCH-ALL',
|
|
||||||
'is_active' => true,
|
|
||||||
]);
|
|
||||||
$chev = Organization::create([
|
|
||||||
'name' => 'Chevron',
|
|
||||||
'is_active' => true,
|
|
||||||
]);
|
|
||||||
$cmch = Organization::create([
|
|
||||||
'name' => 'CMCH',
|
|
||||||
'is_active' => true,
|
|
||||||
]);
|
|
||||||
$dummy = Organization::create([
|
|
||||||
'name' => 'Dummy Site',
|
|
||||||
'is_active' => false,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$dept_chev_xr = Department::create(
|
$skip_first = true;
|
||||||
[
|
$org_csv = fopen(base_path('database/data/organizations.csv'), 'r');
|
||||||
'is_active' => true,
|
while (($data = fgetcsv($org_csv, 2000, ',')) !== false) {
|
||||||
'name' => 'Chev-CR',
|
if (! $skip_first) {
|
||||||
'organization_id' => $chev->id,
|
$data = array_trim_strings($data);
|
||||||
]
|
$name = $data['0'];
|
||||||
);
|
$organizations[$name] = Organization::create([
|
||||||
$chev_dep_ct_mr = Department::create(
|
'name' => $name,
|
||||||
[
|
'is_active' => (bool) $data['1'],
|
||||||
'is_active' => true,
|
]);
|
||||||
'name' => 'Chev-MR',
|
}
|
||||||
'organization_id' => $chev->id,
|
$skip_first = false;
|
||||||
]
|
}
|
||||||
);
|
fclose($org_csv);
|
||||||
$dept_cmch_mr = Department::create(
|
|
||||||
[
|
|
||||||
'is_active' => false,
|
|
||||||
'name' => 'CMCH MR',
|
|
||||||
'organization_id' => $cmch->id,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$rul_chev_mr_ct = DicomRoutingRule::create(
|
$dept_csv = fopen(base_path('database/data/departments.csv'), 'r');
|
||||||
[
|
$skip_first = true;
|
||||||
'is_active' => true,
|
while (($data = fgetcsv($dept_csv, 2000, ',')) !== false) {
|
||||||
'name' => 'Chevron MR/CT',
|
if (! $skip_first) {
|
||||||
'organization_id' => $chev->id,
|
$data = array_trim_strings($data, true);
|
||||||
'department_id' => $chev_dep_ct_mr->id,
|
$name = $data['2'];
|
||||||
'condition' => '(study.institution_name ?? "" starts with "chevron") and (study.modality not in ["CR", "DX", "MG"])',
|
$org_name = $data['1'];
|
||||||
]
|
$org = $organizations[$org_name];
|
||||||
);
|
Department::create([
|
||||||
|
'name' => $name,
|
||||||
$rul_chev_xr = DicomRoutingRule::create(
|
'is_active' => (bool) $data['0'],
|
||||||
[
|
'organization_id' => $org->id,
|
||||||
'is_active' => true,
|
]);
|
||||||
'name' => 'Chevron X-ray',
|
}
|
||||||
'organization_id' => $chev->id,
|
$skip_first = false;
|
||||||
'department_id' => $dept_chev_xr->id,
|
}
|
||||||
'condition' => '(study.institution_name ?? "" starts with "chevron") and (study.modality in ["CR", "DX", "MG"])',
|
fclose($dept_csv);
|
||||||
'priority' => 99,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
DicomServer::create(
|
|
||||||
[
|
|
||||||
'is_active' => true,
|
|
||||||
'server_name' => 'CTG-1',
|
|
||||||
'geo_code' => 'BD',
|
|
||||||
'host' => 'pacs.mylabctg.com',
|
|
||||||
'http_port' => 8042,
|
|
||||||
'dicom_port' => 4242,
|
|
||||||
'rest_api_endpoint' => 'http://pacs.mylabctg.com:8042/',
|
|
||||||
'wado_path' => 'dicom-web',
|
|
||||||
'ae_title' => 'BLACKFISH',
|
|
||||||
'stone_viewer_path' => 'stone-webviewer/index.html',
|
|
||||||
'ohif_viewer_path' => 'ohif/viewer',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
DicomServer::create(
|
|
||||||
[
|
|
||||||
'is_active' => true,
|
|
||||||
'server_name' => 'HEL-1',
|
|
||||||
'geo_code' => 'FI',
|
|
||||||
'host' => 'helsinki.mylabctg.com',
|
|
||||||
'http_port' => 8042,
|
|
||||||
'dicom_port' => 4242,
|
|
||||||
'rest_api_endpoint' => 'http://helsinki.mylabctg.com:8042/',
|
|
||||||
'wado_path' => 'dicom-web',
|
|
||||||
'ae_title' => 'BLACKFISH',
|
|
||||||
'stone_viewer_path' => 'stone-webviewer/index.html',
|
|
||||||
'ohif_viewer_path' => 'ohif/viewer',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
DicomServer::create(
|
|
||||||
[
|
|
||||||
'is_active' => true,
|
|
||||||
'server_name' => 'SGP-1',
|
|
||||||
'geo_code' => 'SG',
|
|
||||||
'host' => 'singapore.mylabctg.com',
|
|
||||||
'http_port' => 8042,
|
|
||||||
'dicom_port' => 4242,
|
|
||||||
'rest_api_endpoint' => 'http://singapore.mylabctg.com:8042/',
|
|
||||||
'wado_path' => 'dicom-web',
|
|
||||||
'ae_title' => 'BLACKFISH',
|
|
||||||
'stone_viewer_path' => 'stone-webviewer/index.html',
|
|
||||||
'ohif_viewer_path' => 'ohif/viewer',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
DicomServer::create(
|
|
||||||
[
|
|
||||||
'is_active' => true,
|
|
||||||
'server_name' => 'Texas',
|
|
||||||
'geo_code' => 'US',
|
|
||||||
'host' => 'texas.mylabctg.com',
|
|
||||||
'http_port' => 8042,
|
|
||||||
'dicom_port' => 4242,
|
|
||||||
'rest_api_endpoint' => 'http://texas.mylabctg.com:8042/',
|
|
||||||
'wado_path' => 'dicom-web',
|
|
||||||
'ae_title' => 'BLACKFISH',
|
|
||||||
'stone_viewer_path' => 'stone-webviewer/index.html',
|
|
||||||
'ohif_viewer_path' => 'ohif/viewer',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
DicomServer::create(
|
|
||||||
[
|
|
||||||
'is_active' => false,
|
|
||||||
'server_name' => 'San Jose',
|
|
||||||
'geo_code' => 'US',
|
|
||||||
'host' => 'san-jose.mylabctg.com',
|
|
||||||
'http_port' => 8042,
|
|
||||||
'dicom_port' => 4242,
|
|
||||||
'rest_api_endpoint' => 'http://san-jose.mylabctg.com:8042/',
|
|
||||||
'wado_path' => 'dicom-web',
|
|
||||||
'ae_title' => 'BLACKFISH',
|
|
||||||
'stone_viewer_path' => 'stone-webviewer/index.html',
|
|
||||||
'ohif_viewer_path' => 'ohif/viewer',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
DicomServer::create(
|
|
||||||
[
|
|
||||||
'is_active' => false,
|
|
||||||
'server_name' => 'MAA-1',
|
|
||||||
'host' => 'pacs.mylabctg.com',
|
|
||||||
'geo_code' => 'IN',
|
|
||||||
'http_port' => 8043,
|
|
||||||
'dicom_port' => 4242,
|
|
||||||
'rest_api_endpoint' => 'http://pacs.mylabctg.com:8042/',
|
|
||||||
'ae_title' => 'BLACKFISH',
|
|
||||||
'wado_path' => 'dicom-web',
|
|
||||||
'stone_viewer_path' => 'stone-webviewer/index.html',
|
|
||||||
'ohif_viewer_path' => 'ohif/viewer',
|
|
||||||
'organization_id' => $chev->id,
|
|
||||||
'department_id' => $dept_chev_xr->id,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,6 @@ class UserSeeder extends Seeder
|
|||||||
{
|
{
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
// User::factory(10)->create();
|
|
||||||
|
|
||||||
$usr = User::factory()->create([
|
$usr = User::factory()->create([
|
||||||
'first_name' => 'PACS Agent',
|
'first_name' => 'PACS Agent',
|
||||||
'display_name' => 'PACS Agent',
|
'display_name' => 'PACS Agent',
|
||||||
@ -24,75 +22,63 @@ public function run(): void
|
|||||||
]);
|
]);
|
||||||
$usr->assignRole(Role::SystemAgent);
|
$usr->assignRole(Role::SystemAgent);
|
||||||
|
|
||||||
$usr = User::factory()->create([
|
$orgs = Organization::pluck('id', 'name');
|
||||||
'first_name' => 'Administrator',
|
$depts = Department::pluck('id', 'name');
|
||||||
'display_name' => 'Admin',
|
|
||||||
'username' => 'admin',
|
$skip_first = true;
|
||||||
'email' => 'admin@example.com',
|
$csv_file = fopen(base_path('database/data/users.csv'), 'r');
|
||||||
'email_verified_at' => now(),
|
while (($data = fgetcsv($csv_file, 2 * 1024, ',')) !== false) {
|
||||||
'phone' => '+8801733938582',
|
if ($skip_first) {
|
||||||
|
$skip_first = false;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array_trim_strings($data, true);
|
||||||
|
$role = Role::from(strtolower($data[8]));
|
||||||
|
$org_id = $data[9] ? $orgs[$data[9]] : null;
|
||||||
|
$dept_id = $data[10] ? $depts[$data[10]] : null;
|
||||||
|
$image = $data[11] ? 'signatures/' . $data[11] : null;
|
||||||
|
|
||||||
|
$user = User::create([
|
||||||
'is_active' => true,
|
'is_active' => true,
|
||||||
|
'display_name' => $data[0],
|
||||||
|
'prefix' => $data[1],
|
||||||
|
'first_name' => $data[2],
|
||||||
|
'last_name' => $data[3],
|
||||||
|
'signature_text' => $data[4],
|
||||||
|
'signature_image_path' => $image,
|
||||||
|
'username' => $data[5],
|
||||||
|
'email' => strtolower($data[6]),
|
||||||
|
'phone' => (string) $data[7],
|
||||||
|
'email_verified_at' => $data[6] ? now() : null,
|
||||||
|
'password' => bcrypt('password'),
|
||||||
|
'organization_id' => $org_id,
|
||||||
|
'department_id' => $dept_id,
|
||||||
]);
|
]);
|
||||||
$usr->assignRole(Role::Admin);
|
$user->assignRole($role->value);
|
||||||
|
}
|
||||||
|
fclose($csv_file);
|
||||||
|
|
||||||
$chevron = Organization::where('name', 'Chevron')->first();
|
$this->copySignatureImages();
|
||||||
$cmch = Organization::where('name', 'CMCH')->first();
|
}
|
||||||
|
|
||||||
$chev_xr = Department::where('organization_id', $chevron->id)->first();
|
private function copySignatureImages()
|
||||||
User::factory(4)
|
{
|
||||||
->create([
|
$sourcePath = base_path('resources/report/signatures');
|
||||||
'organization_id' => $chevron->id,
|
$dest = storage_path('app/public/signatures');
|
||||||
])
|
|
||||||
->each(function ($u, $key) {
|
|
||||||
$u->assignRole(Role::Technician);
|
|
||||||
$u->update([
|
|
||||||
'username' => sprintf('tech%d', $key + 1),
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
User::factory(4)
|
if (! is_dir($dest)) {
|
||||||
->create([
|
mkdir($dest, 0755, true);
|
||||||
'organization_id' => $chevron->id,
|
}
|
||||||
'department_id' => $chev_xr->id,
|
|
||||||
])
|
|
||||||
->each(function ($u, $key) {
|
|
||||||
$u->assignRole(Role::Technician);
|
|
||||||
$u->update([
|
|
||||||
'username' => sprintf('xrt%d', $key + 1),
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
User::factory(4)
|
$files = scandir($sourcePath);
|
||||||
->create([
|
foreach ($files as $file) {
|
||||||
'organization_id' => $cmch->id,
|
if (in_array($file, ['.', '..'])) {
|
||||||
])
|
continue;
|
||||||
->each(function ($u, $key) {
|
}
|
||||||
$u->assignRole(Role::Technician);
|
|
||||||
$u->update([
|
|
||||||
'username' => sprintf('cmctech%d', $key + 1),
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
$images = [
|
copy("{$sourcePath}/{$file}", "{$dest}/{$file}");
|
||||||
'hossain-saad.png', 'nasir-uddin.png', 'sadrul-amin.png',
|
}
|
||||||
'khairul-islam.png', 'rabeya-khatoon.png', 'subash.png',
|
|
||||||
];
|
|
||||||
|
|
||||||
User::factory(9)
|
|
||||||
->create()
|
|
||||||
->each(function (User $u, $key) use ($images) {
|
|
||||||
$u->assignRole(Role::Radiologist);
|
|
||||||
$u->update([
|
|
||||||
'display_name' => sprintf('Dr. %s.%d', $u->first_name, $key + 1),
|
|
||||||
'username' => sprintf('rad%d', $key + 1),
|
|
||||||
'signature_image_path' => 'signatures/' . fake()->randomElement($images),
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
User::factory(3)
|
|
||||||
->create()
|
|
||||||
->each(function ($u) {
|
|
||||||
$u->assignRole(Role::Guest);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user