clqms-be/app/Database/Seeds/OrganizationSeeder.php
mahdahar e36e390f71 refactor: consolidate ValueSet API and simplify seeders
- Consolidate ValueSet routes from multiple nested groups to flat structure
- Delete deprecated ValueSet\ namespaced controllers (ValueSetController, ValueSetDefController)
- Remove ValueSetSeeder and ValueSetCountrySeeder from DBSeeder
- Simplify seeders (LocationSeeder, OrganizationSeeder, PatientSeeder, TestSeeder)
  to use literal string values instead of ValueSet lookups
- Add new ValueSetController and ValueSetDefController in root namespace
- Update test files for new controller structure
The key changes are:
1. Routes: Consolidated from nested ValueSet\ namespace routes to flat ValueSetController routes with /items sub-endpoints
2. Controllers: Deleted old app/Controllers/ValueSet/ directory, created new root-level controllers
3. Seeders: Removed ValueSet dependencies, using literal values like 'ROOM', '1', 'TEST' instead of [12]['ROOM'] etc.
4. Tests: Updated tests to match new controller structure
2026-01-13 16:48:43 +07:00

67 lines
5.6 KiB
PHP

<?php
namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder;
use App\Libraries\ValueSet;
class OrganizationSeeder extends Seeder
{
public function run()
{
$now = date('Y-m-d H:i:s');
// 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' => '0', 'LinkTo' => '', 'Enable' => '1', 'CreateDate' => "$now"],
['WorkstationID' => '2', 'DepartmentID' => '1', 'WorkstationCode' => 'HBACK', 'WorkstationName' => 'Hematologi Backup', 'Type' => '1', 'LinkTo' => '1', 'Enable' => '1', 'CreateDate' => "$now"],
['WorkstationID' => '3', 'DepartmentID' => '3', 'WorkstationCode' => 'CAUTO', 'WorkstationName' => 'Kimia Auto', 'Type' => '0', 'LinkTo' => '', 'Enable' => '1', 'CreateDate' => "$now"],
['WorkstationID' => '4', 'DepartmentID' => '3', 'WorkstationCode' => 'CBACK', 'WorkstationName' => 'Kimia Backup', 'Type' => '1', 'LinkTo' => '3', 'Enable' => '1', 'CreateDate' => "$now"],
['WorkstationID' => '5', 'DepartmentID' => '3', 'WorkstationCode' => 'CMAN', 'WorkstationName' => 'Kimia Manual', 'Type' => '0', 'LinkTo' => '', 'Enable' => '1', 'CreateDate' => "$now"],
['WorkstationID' => '6', 'DepartmentID' => '4', 'WorkstationCode' => 'IAUTO', 'WorkstationName' => 'Imunologi Auto', 'Type' => '0', 'LinkTo' => '', 'Enable' => '1', 'CreateDate' => "$now"],
['WorkstationID' => '7', 'DepartmentID' => '4', 'WorkstationCode' => 'IMAN', 'WorkstationName' => 'Imunologi Manual', 'Type' => '0', 'LinkTo' => '', 'Enable' => '1', 'CreateDate' => "$now"],
];
$this->db->table('workstation')->insertBatch($data);
}
}