74 lines
5.8 KiB
PHP
74 lines
5.8 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Seeds;
|
|
|
|
use CodeIgniter\Database\Seeder;
|
|
use App\Models\ValueSet\ValueSetModel;
|
|
|
|
class OrganizationSeeder extends Seeder {
|
|
|
|
protected array $map = [];
|
|
|
|
public function run() {
|
|
$now = date('Y-m-d H:i:s');
|
|
$vsModel = new ValueSetModel();
|
|
$rows = $vsModel->select("VID, VSetID, VValue")->findAll();
|
|
$vs = [];
|
|
foreach ($rows as $row) {
|
|
$vs[$row['VSetID']][$row['VValue']] = $row['VID'];
|
|
}
|
|
|
|
// Organization
|
|
$data = [
|
|
[ 'AccountID' => 1, 'Parent' => null, 'AccountName' => 'Dummy Account', 'Initial'=>'QAC', 'Street_1'=>'Dummy Address', 'EmailAddress1'=>'dummy@summit.co.id', 'Phone'=>'092029', 'Fax'=>'092029', 'CreateDate' => "$now" ],
|
|
[ 'AccountID' => 2, 'Parent' => null, 'AccountName' => 'Dummy Account', 'Initial'=>'QAC', 'Street_1'=>'Dummy Address', 'EmailAddress1'=>'dummy@summit.co.id', 'Phone'=>'092029', 'Fax'=>'092029', 'CreateDate' => "$now" ],
|
|
[ 'AccountID' => 3, 'Parent' => null, 'AccountName' => 'Dummy Account', 'Initial'=>'QAC', 'Street_1'=>'Dummy Address', 'EmailAddress1'=>'dummy@summit.co.id', 'Phone'=>'092029', 'Fax'=>'092029', 'CreateDate' => "$now" ]
|
|
];
|
|
$this->db->table('account')->insertBatch($data);
|
|
|
|
$data = [
|
|
[ 'SiteID' => 1, 'SiteCode' => 'QSIT', 'SiteName' => 'Dummy Site', 'AccountID'=>1, 'Parent'=>null, 'CreateDate' => "$now" ],
|
|
[ 'SiteID' => 2, 'SiteCode' => 'XSIT', 'SiteName' => 'Dummy Child Site', 'AccountID'=>1, 'Parent'=>1, 'CreateDate' => "$now" ],
|
|
];
|
|
$this->db->table('site')->insertBatch($data);
|
|
|
|
$data = [
|
|
['DisciplineID' => '1','DisciplineCode' => 'HEMA', 'DisciplineName' =>'Hematology', 'Parent' => null, 'CreateDate' => "$now"],
|
|
['DisciplineID' => '2','DisciplineCode' => 'CHEM', 'DisciplineName' =>'Clinical Chemistry', 'Parent' => null, 'CreateDate' => "$now"],
|
|
['DisciplineID' => '3','DisciplineCode' => 'IMSR', 'DisciplineName' =>'Immunology/Serology', 'Parent' => null, 'CreateDate' => "$now"],
|
|
['DisciplineID' => '4','DisciplineCode' => 'URIN', 'DisciplineName' =>'Urinalysis', 'Parent' => null, 'CreateDate' => "$now"],
|
|
['DisciplineID' => '5','DisciplineCode' => 'FECAL', 'DisciplineName' =>'Fecal Analysis', 'Parent' => null, 'CreateDate' => "$now"],
|
|
['DisciplineID' => '6','DisciplineCode' => 'HC', 'DisciplineName' =>'Pathology/Cytology', 'Parent' => null, 'CreateDate' => "$now"],
|
|
['DisciplineID' => '7','DisciplineCode' => 'MICRO', 'DisciplineName' =>'Microbiology', 'Parent' => null, 'CreateDate' => "$now"],
|
|
['DisciplineID' => '8','DisciplineCode' => 'TXC', 'DisciplineName' =>'Toxicology', 'Parent' => null, 'CreateDate' => "$now"],
|
|
['DisciplineID' => '9','DisciplineCode' => 'LF', 'DisciplineName' =>'Life Sciences', 'Parent' => null, 'CreateDate' => "$now"],
|
|
['DisciplineID' => '10','DisciplineCode' => 'ND', 'DisciplineName' =>'Non-discipline', 'Parent' => null, 'CreateDate' => "$now"],
|
|
['DisciplineID' => '11','DisciplineCode' => 'HEMO', 'DisciplineName' =>'Hemostasis', 'Parent' => '1', 'CreateDate' => "$now"],
|
|
['DisciplineID' => '12','DisciplineCode' => 'BLGLU', 'DisciplineName' =>'Blood Glucose', 'Parent' => '2', 'CreateDate' => "$now"],
|
|
['DisciplineID' => '13','DisciplineCode' => 'KIDF', 'DisciplineName' =>'Kidney Function', 'Parent' => '2', 'CreateDate' => "$now"],
|
|
];
|
|
$this->db->table('discipline')->insertBatch($data);
|
|
|
|
$data = [
|
|
['DepartmentID' => '1','DisciplineID' => '1','SiteID' => '165','DepartmentCode' => 'HRTN', 'DepartmentName' =>'Hematologi Rutin', 'CreateDate' => "$now"],
|
|
['DepartmentID' => '2','DisciplineID' => '1','SiteID' => '165','DepartmentCode' => 'HKHS', 'DepartmentName' =>'Hematologi Khusus', 'CreateDate' => "$now"],
|
|
['DepartmentID' => '3','DisciplineID' => '2','SiteID' => '165','DepartmentCode' => 'KK', 'DepartmentName' =>'Kimia Klinik', 'CreateDate' => "$now"],
|
|
['DepartmentID' => '4','DisciplineID' => '3','SiteID' => '165','DepartmentCode' => 'IMS', 'DepartmentName' =>'Imunologi', 'CreateDate' => "$now"],
|
|
['DepartmentID' => '5','DisciplineID' => '3','SiteID' => '165','DepartmentCode' => 'SRL', 'DepartmentName' =>'Serologi', 'CreateDate' => "$now"],
|
|
['DepartmentID' => '6','DisciplineID' => '4','SiteID' => '165','DepartmentCode' => 'UF', 'DepartmentName' =>'Urin', 'CreateDate' => "$now"]
|
|
];
|
|
$this->db->table('department')->insertBatch($data);
|
|
|
|
$data = [
|
|
['WorkstationID' => '1','DepartmentID' => '1','WorkstationCode' => 'HAUTO','WorkstationName' => 'Hematologi Auto','Type' => $vs[1][0],'LinkTo' => '', 'Enable' =>$vs[2][1], 'CreateDate' => "$now"],
|
|
['WorkstationID' => '2','DepartmentID' => '1','WorkstationCode' => 'HBACK','WorkstationName' => 'Hematologi Backup','Type' => $vs[1][1],'LinkTo' => '1', 'Enable' =>$vs[2][1], 'CreateDate' => "$now"],
|
|
['WorkstationID' => '3','DepartmentID' => '3','WorkstationCode' => 'CAUTO','WorkstationName' => 'Kimia Auto','Type' => $vs[1][0],'LinkTo' => '', 'Enable' =>$vs[2][1], 'CreateDate' => "$now"],
|
|
['WorkstationID' => '4','DepartmentID' => '3','WorkstationCode' => 'CBACK','WorkstationName' => 'Kimia Backup','Type' => $vs[1][1],'LinkTo' => '3', 'Enable' =>$vs[2][1], 'CreateDate' => "$now"],
|
|
['WorkstationID' => '5','DepartmentID' => '3','WorkstationCode' => 'CMAN','WorkstationName' => 'Kimia Manual','Type' => $vs[1][0],'LinkTo' => '', 'Enable' =>$vs[2][1], 'CreateDate' => "$now"],
|
|
['WorkstationID' => '6','DepartmentID' => '4','WorkstationCode' => 'IAUTO','WorkstationName' => 'Imunologi Auto','Type' => $vs[1][0],'LinkTo' => '', 'Enable' =>$vs[2][1], 'CreateDate' => "$now"],
|
|
['WorkstationID' => '7','DepartmentID' => '4','WorkstationCode' => 'IMAN','WorkstationName' => 'Imunologi Manual','Type' => $vs[1][0],'LinkTo' => '', 'Enable' =>$vs[2][1], 'CreateDate' => "$now"],
|
|
];
|
|
$this->db->table('workstation')->insertBatch($data);
|
|
|
|
}
|
|
} |