feat: add urine workstations and test specimen mappings to seeders
This commit is contained in:
parent
707d548db0
commit
3a30629e15
@ -60,6 +60,8 @@ class OrganizationSeeder extends Seeder
|
||||
['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"],
|
||||
['WorkstationID' => '8', 'DepartmentID' => '6', 'WorkstationCode' => 'UAUTO', 'WorkstationName' => 'Urin Auto', 'Type' => '0', 'LinkTo' => '', 'Enable' => '1', 'CreateDate' => "$now"],
|
||||
['WorkstationID' => '9', 'DepartmentID' => '6', 'WorkstationCode' => 'UMAN', 'WorkstationName' => 'Urin Manual', 'Type' => '0', 'LinkTo' => '', 'Enable' => '1', 'CreateDate' => "$now"],
|
||||
];
|
||||
$this->db->table('workstation')->insertBatch($data);
|
||||
}
|
||||
|
||||
@ -203,5 +203,172 @@ class TestSeeder extends Seeder
|
||||
$data = ['SiteID' => '1', 'TestSiteCode' => 'PH', 'TestSiteName' => 'Urine pH', 'TestType' => 'TEST', 'Description' => 'pH Urine', 'SeqScr' => '34', 'SeqRpt' => '34', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '4', 'DepartmentID' => '4', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '10', 'ReqQtyUnit' => 'mL', 'Unit1' => '', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'Method' => 'Dipstick', 'CreateDate' => "$now"];
|
||||
$this->db->table('testdefsite')->insert($data);
|
||||
$tIDs['PH'] = $this->db->insertID();
|
||||
|
||||
// ========================================
|
||||
// TEST MAP - Specimen Mapping
|
||||
// Maps tests to workstations and containers
|
||||
// ========================================
|
||||
|
||||
// Get container IDs (inserted by SpecimenSeeder in order)
|
||||
// ConCode order: 1, 11, 12, 13, 14, 15, 16, 20, 101, 150, 200, 290, 295, 900
|
||||
$conSST = 1; // SST (Serum Separator Tube)
|
||||
$conEDTA = 9; // EDTA - Hematology
|
||||
$conCitrate = 10; // Citrate - Koagulasi
|
||||
$conPotUrin = 12; // Pot Urin
|
||||
$conUrine = 13; // Urine Container
|
||||
|
||||
// Workstation IDs from OrganizationSeeder
|
||||
$wsHAuto = 1; // Hematologi Auto
|
||||
$wsCAuto = 3; // Kimia Auto
|
||||
$wsIAuto = 6; // Imunologi Auto
|
||||
$wsUAuto = 8; // Urin Auto
|
||||
|
||||
$testMaps = [];
|
||||
|
||||
// Hematology tests → HAUTO workstation + EDTA container
|
||||
$hematologyTests = ['HB', 'HCT', 'RBC', 'WBC', 'PLT', 'MCV', 'MCH', 'MCHC'];
|
||||
foreach ($hematologyTests as $testCode) {
|
||||
$testMaps[] = [
|
||||
'TestSiteID' => $tIDs[$testCode],
|
||||
'HostType' => 'SITE',
|
||||
'HostID' => '1',
|
||||
'HostTestCode' => $testCode,
|
||||
'HostTestName' => $testCode,
|
||||
'ClientType' => 'WORKSTATION',
|
||||
'ClientID' => (string)$wsHAuto,
|
||||
'ConDefID' => $conEDTA,
|
||||
'ClientTestCode' => $testCode,
|
||||
'ClientTestName' => $testCode,
|
||||
'CreateDate' => $now
|
||||
];
|
||||
}
|
||||
|
||||
// Chemistry tests → CAUTO workstation + SST container
|
||||
$chemistryTests = ['GLU', 'CREA', 'UREA', 'SGOT', 'SGPT', 'CHOL', 'TG', 'HDL', 'LDL'];
|
||||
foreach ($chemistryTests as $testCode) {
|
||||
$testMaps[] = [
|
||||
'TestSiteID' => $tIDs[$testCode],
|
||||
'HostType' => 'SITE',
|
||||
'HostID' => '1',
|
||||
'HostTestCode' => $testCode,
|
||||
'HostTestName' => $testCode,
|
||||
'ClientType' => 'WORKSTATION',
|
||||
'ClientID' => (string)$wsCAuto,
|
||||
'ConDefID' => $conSST,
|
||||
'ClientTestCode' => $testCode,
|
||||
'ClientTestName' => $testCode,
|
||||
'CreateDate' => $now
|
||||
];
|
||||
}
|
||||
|
||||
// Calculated chemistry tests → CAUTO workstation + SST container (inherited from parents)
|
||||
$calcChemistryTests = ['EGFR', 'LDLCALC'];
|
||||
foreach ($calcChemistryTests as $testCode) {
|
||||
$testMaps[] = [
|
||||
'TestSiteID' => $tIDs[$testCode],
|
||||
'HostType' => 'SITE',
|
||||
'HostID' => '1',
|
||||
'HostTestCode' => $testCode,
|
||||
'HostTestName' => $testCode,
|
||||
'ClientType' => 'WORKSTATION',
|
||||
'ClientID' => (string)$wsCAuto,
|
||||
'ConDefID' => $conSST,
|
||||
'ClientTestCode' => $testCode,
|
||||
'ClientTestName' => $testCode,
|
||||
'CreateDate' => $now
|
||||
];
|
||||
}
|
||||
|
||||
// Urinalysis tests → UAUTO workstation + Pot Urin container
|
||||
$urineTests = ['UCOLOR', 'UGLUC', 'UPROT', 'PH'];
|
||||
foreach ($urineTests as $testCode) {
|
||||
$testMaps[] = [
|
||||
'TestSiteID' => $tIDs[$testCode],
|
||||
'HostType' => 'SITE',
|
||||
'HostID' => '1',
|
||||
'HostTestCode' => $testCode,
|
||||
'HostTestName' => $testCode,
|
||||
'ClientType' => 'WORKSTATION',
|
||||
'ClientID' => (string)$wsUAuto,
|
||||
'ConDefID' => $conPotUrin,
|
||||
'ClientTestCode' => $testCode,
|
||||
'ClientTestName' => $testCode,
|
||||
'CreateDate' => $now
|
||||
];
|
||||
}
|
||||
|
||||
// Panel/Group tests - map to primary container (EDTA for CBC, SST for LIPID/LFT/RFT)
|
||||
$testMaps[] = [
|
||||
'TestSiteID' => $tIDs['CBC'],
|
||||
'HostType' => 'SITE',
|
||||
'HostID' => '1',
|
||||
'HostTestCode' => 'CBC',
|
||||
'HostTestName' => 'CBC',
|
||||
'ClientType' => 'WORKSTATION',
|
||||
'ClientID' => (string)$wsHAuto,
|
||||
'ConDefID' => $conEDTA,
|
||||
'ClientTestCode' => 'CBC',
|
||||
'ClientTestName' => 'CBC',
|
||||
'CreateDate' => $now
|
||||
];
|
||||
|
||||
$testMaps[] = [
|
||||
'TestSiteID' => $tIDs['LIPID'],
|
||||
'HostType' => 'SITE',
|
||||
'HostID' => '1',
|
||||
'HostTestCode' => 'LIPID',
|
||||
'HostTestName' => 'LIPID',
|
||||
'ClientType' => 'WORKSTATION',
|
||||
'ClientID' => (string)$wsCAuto,
|
||||
'ConDefID' => $conSST,
|
||||
'ClientTestCode' => 'LIPID',
|
||||
'ClientTestName' => 'LIPID',
|
||||
'CreateDate' => $now
|
||||
];
|
||||
|
||||
$testMaps[] = [
|
||||
'TestSiteID' => $tIDs['LFT'],
|
||||
'HostType' => 'SITE',
|
||||
'HostID' => '1',
|
||||
'HostTestCode' => 'LFT',
|
||||
'HostTestName' => 'LFT',
|
||||
'ClientType' => 'WORKSTATION',
|
||||
'ClientID' => (string)$wsCAuto,
|
||||
'ConDefID' => $conSST,
|
||||
'ClientTestCode' => 'LFT',
|
||||
'ClientTestName' => 'LFT',
|
||||
'CreateDate' => $now
|
||||
];
|
||||
|
||||
$testMaps[] = [
|
||||
'TestSiteID' => $tIDs['RFT'],
|
||||
'HostType' => 'SITE',
|
||||
'HostID' => '1',
|
||||
'HostTestCode' => 'RFT',
|
||||
'HostTestName' => 'RFT',
|
||||
'ClientType' => 'WORKSTATION',
|
||||
'ClientID' => (string)$wsCAuto,
|
||||
'ConDefID' => $conSST,
|
||||
'ClientTestCode' => 'RFT',
|
||||
'ClientTestName' => 'RFT',
|
||||
'CreateDate' => $now
|
||||
];
|
||||
|
||||
// BMI parameter - no container needed (calculated from parameters)
|
||||
$testMaps[] = [
|
||||
'TestSiteID' => $tIDs['BMI'],
|
||||
'HostType' => 'SITE',
|
||||
'HostID' => '1',
|
||||
'HostTestCode' => 'BMI',
|
||||
'HostTestName' => 'BMI',
|
||||
'ClientType' => 'WORKSTATION',
|
||||
'ClientID' => (string)$wsCAuto,
|
||||
'ConDefID' => null,
|
||||
'ClientTestCode' => 'BMI',
|
||||
'ClientTestName' => 'BMI',
|
||||
'CreateDate' => $now
|
||||
];
|
||||
|
||||
$this->db->table('testmap')->insertBatch($testMaps);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user