clqms-be/app/Database/Seeds/DummySeeder.php
2025-11-27 11:52:39 +07:00

173 lines
14 KiB
PHP

<?php
namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder;
use App\Models\ValueSet\ValueSetModel;
class DummySeeder 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'];
}
// containerdef
$data = [
['ConCode' => '1','ConName' => 'SST', 'ConDesc' =>'Evacuated blood collection tube, gel separator', 'Additive' => "66", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '11','ConName' => 'Plain', 'ConDesc' =>'Evacuated blood collection tube, no additive/metal-free', 'Additive' => "67", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '12','ConName' => '2Hr PP', 'ConDesc' =>'Evacuated blood collection tube, untuk Glukosa 2 Jam PP', 'Additive' => "68", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '13','ConName' => 'Glukosa Sewaktu', 'ConDesc' =>'Evacuated blood collection tube, untuk Glukosa Sewaktu', 'Additive' => "69", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '14','ConName' => 'GTT 30 menit', 'ConDesc' =>'Evacuated blood collection tube, untuk GTT 30 menit', 'Additive' => "71", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '15','ConName' => 'GTT 60 menit', 'ConDesc' =>'Evacuated blood collection tube, untuk GTT 60 menit', 'Additive' => "71", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '16','ConName' => 'GTT 120 menit', 'ConDesc' =>'Evacuated blood collection tube, untuk GTT 90 menit', 'Additive' => "71", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '20','ConName' => 'RST', 'ConDesc' =>'Evacuated blood collection tube, thrombin/clot activator/gel separator', 'Additive' => "71", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '101','ConName' => 'EDTA - Hematologi', 'ConDesc' =>'Evacuated blood collection tube, K2EDTA/aprotinin', 'Additive' => "71", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '150','ConName' => 'Citrate - Koagulasi', 'ConDesc' =>'Evacuated blood collection tube, untuk koagulasi', 'Additive' => "71", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '200','ConName' => 'Aliquot', 'ConDesc' =>'General specimen container, no additive, non-sterile. Untuk aliquot', 'Additive' => "71", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '290','ConName' => 'Pot Urin', 'ConDesc' =>'Non-sterile urine specimen container IVD', 'Additive' => "71", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '295','ConName' => 'Urine Container', 'ConDesc' =>'Urine specimen container', 'Additive' => "71", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '900','ConName' => 'Packing Pengiriman', 'ConDesc' =>'Specimen Transport Packaging', 'Additive' => "71", 'ConClass' => '81', 'CreateDate'=> "$now"],
];
$this->db->table('containerdef')->insertBatch($data);
// location
$data = [
['LocationID'=>1, 'LocCode'=>'QLOC', 'LocFull'=>'Dummy Location', 'LocType'=>'ROOM', 'Description'=>'Location made for dummy testing', 'CreateDate'=> "$now" ],
['LocationID'=>2, 'LocCode'=>'DEFLOC', 'LocFull'=>'Default Location', 'LocType'=>'ROOM', 'Description'=>'Default location', 'CreateDate'=> "$now" ]
];
$this->db->table('location')->insertBatch($data);
$data = [
['LocationID'=>1, 'Street1'=>'Jalan Nginden', 'Street2'=>'Intan Raya', 'City'=>'Surabaya', 'Province'=>'East Java', 'PostCode'=>'60222', 'CreateDate'=> "$now"],
['LocationID'=>2, 'Street1'=>'Jalan ', 'Street2'=>'Jalan jalan', 'City'=>'Depok', 'Province'=>'DKI Jakarta', 'PostCode'=>'10123', 'CreateDate'=> "$now"]
];
$this->db->table('locationaddress')->insertBatch($data);
// users
$data = [
['id'=>1, 'role_id'=>1, 'username'=>'zaka', 'password'=>'$2y$12$vSB7PpKOUKEyFKbeExiGkuujRfQbR.yl6YVudDpfy24FemZopBG0m'],
['id'=>2, 'role_id'=>1, 'username'=>'tes' , 'password'=>'$2y$12$KwPedIPb7K/0IR/8/FcwdOMG4eBNNAXSjXnbkB26SwjH4Nf7PaYBe'],
['id'=>3, 'role_id'=>1, 'username'=>'tes2', 'password'=>'$2y$12$vSB7PpKOUKEyFKbeExiGkuujRfQbR.yl6YVudDpfy24FemZopBG0m'],
];
$this->db->table('users')->insertBatch($data);
// contact
$data = [
['ContactID'=>1, 'NameFirst'=>'Default', 'NameLast'=>'Doctor', 'Title'=>'', 'Initial'=>'DEFDOC',
'Birthdate'=>'', 'EmailAddress1'=>'', 'EmailAddress2'=>'', 'Phone'=>'', 'MobilePhone1'=>'', 'MobilePhone2'=>'', 'Specialty'=>'', 'SubSpecialty'=>'', 'CreateDate'=> "$now" ],
['ContactID'=>2, 'NameFirst'=>'Dummy', 'NameLast'=>'Doctor', 'Title'=>'', 'Initial'=>'QDOC',
'Birthdate'=>'', 'EmailAddress1'=>'', 'EmailAddress2'=>'', 'Phone'=>'', 'MobilePhone1'=>'', 'MobilePhone2'=>'', 'Specialty'=>'', 'SubSpecialty'=>'', 'CreateDate'=> "$now" ]
];
$this->db->table('contact')->insertBatch($data);
$data = [
['SiteID'=>1,'ContactID'=>1, 'ContactCode'=>'DEFDOC', 'ContactEmail'=>'defdoc@email.com', 'OccupationID'=>'', 'JobTitle'=>'', 'Department'=>'Jantung Sehat' ],
['SiteID'=>2,'ContactID'=>1, 'ContactCode'=>'QDOC', 'ContactEmail'=>'qdoc@email.com', 'OccupationID'=>'', 'JobTitle'=>'', 'Department'=>'Hati Sehat' ],
['SiteID'=>1,'ContactID'=>2, 'ContactCode'=>'S923', 'ContactEmail'=>'defdoc@email.com', 'OccupationID'=>'', 'JobTitle'=>'', 'Department'=>'Jantung Sehat' ],
['SiteID'=>2,'ContactID'=>2, 'ContactCode'=>'B231', 'ContactEmail'=>'defdoc@email.com', 'OccupationID'=>'', 'JobTitle'=>'', 'Department'=>'Ginjal Sehat' ],
['SiteID'=>3,'ContactID'=>2, 'ContactCode'=>'C342', 'ContactEmail'=>'qdoc@email.com', 'OccupationID'=>'', 'JobTitle'=>'', 'Department'=>'Hati Sehat' ]
];
$this->db->table('contactdetail')->insertBatch($data);
$data = [
['OccupationID'=>1, 'OccCode'=>'OC001', 'OccText'=>'Medical Doctor', 'Description'=>'Diagnoses and treats, injuries and illnesses', 'CreateDate'=> "$now" ],
['OccupationID'=>2, 'OccCode'=>'OC002', 'OccText'=>'Trainee Medical Technician', 'Description'=>'Performing basic laboratory task', 'CreateDate'=> "$now" ],
['OccupationID'=>3, 'OccCode'=>'OC003', 'OccText'=>'Medical Laboratory Technician', 'Description'=>'Perform routine laboratory tests', 'CreateDate'=> "$now" ]
];
$this->db->table('occupation')->insertBatch($data);
// patient
$data = [
[ 'InternalPID'=>1, 'PatientID'=>'SMAJ1', 'NameFirst'=>'Dummy', 'Gender' => 5, 'NameLast' => 'Patient M', 'BirthDate'=>'1991-09-09', 'Street_1'=>'Makati', 'EmailAddress1'=>'smaj1@5panda.id', 'CreateDate'=> "$now"],
[ 'InternalPID'=>2, 'PatientID'=>'SMAJ2', 'NameFirst'=>'Dummy', 'Gender' => 6, 'NameLast' => 'Patient F', 'BirthDate'=>'1997-02-02', 'Street_1'=>'Manila', 'EmailAddress1'=>'smaj2@5panda.id', 'CreateDate'=> "$now"],
[ 'InternalPID'=>3, 'PatientID'=>'SMAJ3', 'NameFirst'=>'Dummy', 'Gender' => 5, 'NameLast' => 'Patient L', 'BirthDate'=>'1997-02-02', 'Street_1'=>'Manila', 'EmailAddress1'=>'smaj3@5panda.id', 'CreateDate'=> "$now"]
];
$this->db->table('patient')->insertBatch($data);
$data = [
[ 'InternalPID'=>1, 'IdentifierType'=>'KTP', 'Identifier'=>'9901', 'CreateDate'=> "$now" ],
[ 'InternalPID'=>3, 'IdentifierType'=>'KTP', 'Identifier'=>'9903', 'CreateDate'=> "$now" ]
];
$this->db->table('patidt')->insertBatch($data);
$data = [
[ "InternalPID" => 1, "Address" => "/api/upload/assasasasd" . 1 . ".jpg", 'CreateDate'=> "$now" ],
[ "InternalPID" => 1, "Address" => "/api/upload/adsasasds" . 2 . ".jpg", 'CreateDate'=> "$now" ],
[ "InternalPID" => 1, "Address" => "/api/upload/sasaasadjs" . 6 . ".jpg", 'CreateDate'=> "$now" ],
[ "InternalPID" => 1, "Address" => "/api/upload/sdjasass" . 5 . ".jpg", 'CreateDate'=> "$now" ],
[ "InternalPID" => 1, "Address" => "/api/upload/sdasasjs" . 4 . ".jpg", 'CreateDate'=> "$now" ],
];
$this->db->table('patatt')->insertBatch($data);
// patvisit
$data = [
['InternalPVID'=>1, "PVID"=>"XLAB0001", "InternalPID"=>1, "EpisodeID"=>1, "CreateDate"=>"$now"],
['InternalPVID'=>2, "PVID"=>"XLAB0002", "InternalPID"=>1, "EpisodeID"=>1, "CreateDate"=>"$now"],
];
$this->db->table('patvisit')->insertBatch($data);
$data = [
['InternalPVID'=>1, "ADTCode"=>"X01", "LocationID"=>1, "AttDoc"=>null, "CreateDate"=>"$now"],
['InternalPVID'=>1, "ADTCode"=>"X02", "LocationID"=>null, "AttDoc"=>1, "CreateDate"=>"$now"],
['InternalPVID'=>1, "ADTCode"=>"X01", "LocationID"=>2, "AttDoc"=>null, "CreateDate"=>"$now"],
['InternalPVID'=>1, "ADTCode"=>"X02", "LocationID"=>null, "AttDoc"=>2, "CreateDate"=>"$now"],
['InternalPVID'=>2, "ADTCode"=>"X01", "LocationID"=>1, "AttDoc"=>null, "CreateDate"=>"$now"],
['InternalPVID'=>2, "ADTCode"=>"X02", "LocationID"=>null, "AttDoc"=>1, "CreateDate"=>"$now"],
['InternalPVID'=>2, "ADTCode"=>"X01", "LocationID"=>2, "AttDoc"=>null, "CreateDate"=>"$now"],
['InternalPVID'=>2, "ADTCode"=>"X02", "LocationID"=>null, "AttDoc"=>2, "CreateDate"=>"$now"],
];
$this->db->table('patvisitadt')->insertBatch($data);
// 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', 'CreateDate' => "$now"],
['DisciplineID' => '2','DisciplineCode' => 'CHEM', 'DisciplineName' =>'Clinical Chemistry', 'CreateDate' => "$now"],
['DisciplineID' => '3','DisciplineCode' => 'IMSR', 'DisciplineName' =>'Immunology/Serology', 'CreateDate' => "$now"],
['DisciplineID' => '4','DisciplineCode' => 'URIN', 'DisciplineName' =>'Urinalysis', 'CreateDate' => "$now"],
['DisciplineID' => '5','DisciplineCode' => 'FECAL', 'DisciplineName' =>'Fecal Analysis', 'CreateDate' => "$now"],
['DisciplineID' => '6','DisciplineCode' => 'HC', 'DisciplineName' =>'Pathology/Cytology', 'CreateDate' => "$now"],
['DisciplineID' => '7','DisciplineCode' => 'MICRO', 'DisciplineName' =>'Microbiology', 'CreateDate' => "$now"],
['DisciplineID' => '8','DisciplineCode' => 'TXC', 'DisciplineName' =>'Toxicology', 'CreateDate' => "$now"],
['DisciplineID' => '9','DisciplineCode' => 'LF', 'DisciplineName' =>'Life Sciences', 'CreateDate' => "$now"],
['DisciplineID' => '10','DisciplineCode' => 'ND', 'DisciplineName' =>'Non-discipline', '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);
}
}