refactor: standardize boolean field naming across API domains

Rename legacy boolean helpers to is* naming across test definitions, patient models, and infrastructure data to match rest of backend.

Update controllers, models, migrations, seeders, tests, and OpenAPI docs/bundled spec so contracts and runtime align.
This commit is contained in:
mahdahar 2026-03-25 11:37:17 +07:00
parent 7600989bed
commit 76ea22d841
22 changed files with 616 additions and 616 deletions

View File

@ -23,7 +23,7 @@ class EquipmentListController extends BaseController {
'InstrumentName' => $this->request->getVar('InstrumentName'),
'DepartmentID' => $this->request->getVar('DepartmentID'),
'WorkstationID' => $this->request->getVar('WorkstationID'),
'Enable' => $this->request->getVar('Enable'),
'isEnable' => $this->request->getVar('isEnable'),
];
$rows = $this->model->getEquipmentLists($filter);

View File

@ -42,11 +42,11 @@ class TestsController extends BaseController
{
$search = $this->request->getGet('search');
$filters = [
'SiteID' => $this->request->getGet('SiteID'),
'TestType' => $this->request->getGet('TestType'),
'VisibleScr' => $this->request->getGet('VisibleScr'),
'VisibleRpt' => $this->request->getGet('VisibleRpt'),
$filters = [
'SiteID' => $this->request->getGet('SiteID'),
'TestType' => $this->request->getGet('TestType'),
'isVisibleScr' => $this->request->getGet('isVisibleScr'),
'isVisibleRpt' => $this->request->getGet('isVisibleRpt'),
'TestSiteName' => $this->request->getGet('TestSiteName'),
'TestSiteCode' => $this->request->getGet('TestSiteCode'),
'search' => $search,
@ -162,10 +162,10 @@ class TestsController extends BaseController
'SeqScr' => $input['SeqScr'] ?? 0,
'SeqRpt' => $input['SeqRpt'] ?? 0,
'IndentLeft' => $input['IndentLeft'] ?? 0,
'FontStyle' => $input['FontStyle'] ?? null,
'VisibleScr' => $input['VisibleScr'] ?? 1,
'VisibleRpt' => $input['VisibleRpt'] ?? 1,
'CountStat' => $input['CountStat'] ?? 1,
'FontStyle' => $input['FontStyle'] ?? null,
'isVisibleScr' => $input['isVisibleScr'] ?? 1,
'isVisibleRpt' => $input['isVisibleRpt'] ?? 1,
'isCountStat' => $input['isCountStat'] ?? 1,
'StartDate' => $input['StartDate'] ?? date('Y-m-d H:i:s'),
];
@ -253,9 +253,9 @@ class TestsController extends BaseController
'SeqRpt',
'IndentLeft',
'FontStyle',
'VisibleScr',
'VisibleRpt',
'CountStat',
'isVisibleScr',
'isVisibleRpt',
'isCountStat',
'StartDate',
];

View File

@ -109,7 +109,7 @@ class CreateOrganization extends Migration {
'WorkstationName' => ['type' => 'varchar', 'constraint'=> 150, 'null'=> true],
'Type' => ['type' => 'VARCHAR', 'constraint' => 10, 'null'=> true],
'LinkTo' => ['type' => 'int', 'null'=> true],
'Enable' => ['type' => 'VARCHAR', 'constraint' => 10, 'null'=> true],
'isEnable' => ['type' => 'VARCHAR', 'constraint' => 10, 'null'=> true],
'CreateDate' => ['type'=>'DATETIME', 'null' => true],
'EndDate' => ['type'=>'DATETIME', 'null' => true]
]);

View File

@ -31,11 +31,11 @@ class CreateTestDefinitions extends Migration {
'SeqRpt' => ['type' => 'int', 'null' => true],
'IndentLeft' => ['type' => 'int', 'null' => true, 'default' => 0],
'FontStyle' => ['type' => 'varchar', 'constraint'=> 50, 'null' => true],
'VisibleScr' => ['type' => 'int', 'null' => true, 'default' => 1],
'VisibleRpt' => ['type' => 'int', 'null' => true, 'default' => 1],
'CountStat' => ['type' => 'int', 'null' => true, 'default' => 1],
'Level' => ['type' => 'int', 'null' => true],
'Requestable' => [ 'type' => 'TINYINT', 'constraint' => 1, 'null' => true, 'default' => 1, 'comment' => 'Flag indicating if test can be requested (1=yes, 0=no)' ],
'isVisibleScr' => ['type' => 'int', 'null' => true, 'default' => 1],
'isVisibleRpt' => ['type' => 'int', 'null' => true, 'default' => 1],
'isCountStat' => ['type' => 'int', 'null' => true, 'default' => 1],
'Level' => ['type' => 'int', 'null' => true],
'isRequestable' => [ 'type' => 'TINYINT', 'constraint' => 1, 'null' => true, 'default' => 1, 'comment' => 'Flag indicating if test can be requested (1=yes, 0=no)' ],
'CreateDate' => ['type' => 'Datetime', 'null' => true],
'StartDate' => ['type' => 'Datetime', 'null' => true],
'EndDate' => ['type' => 'Datetime', 'null' => true],

View File

@ -13,7 +13,7 @@ class CreateLabInfrastructure extends Migration {
'InstrumentID' => ['type' => 'varchar', 'constraint'=> 150, 'null'=> true],
'InstrumentName' => ['type' => 'varchar', 'constraint'=> 150, 'null'=> true],
'WorkstationID' => ['type' => 'int', 'unsigned' => true ],
'Enable' => ['type' => 'bit', 'null'=> false],
'isEnable' => ['type' => 'bit', 'null'=> false],
'EquipmentRole' => ['type' => 'varchar', 'constraint' => 1, 'null'=> false],
'CreateDate' => ['type'=>'DATETIME', 'null' => true],
'EndDate' => ['type'=>'DATETIME', 'null' => true]

View File

@ -38,7 +38,7 @@ class CreatePatientCore extends Migration {
'Religion' => ['type' => 'VARCHAR', 'constraint' => 10, 'null' => true],
'Ethnic' => ['type' => 'VARCHAR', 'constraint' => 10, 'null' => true],
'Citizenship' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'DeathIndicator'=> ['type' => 'VARCHAR', 'constraint' => 10, 'null' => true],
'isDead'=> ['type' => 'VARCHAR', 'constraint' => 10, 'null' => true],
'TimeOfDeath' => ['type' => 'DATETIME', 'null' => true],
'LinkTo' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'CreateDate' => ['type' => 'DATETIME', 'null' => true],

View File

@ -53,48 +53,48 @@ class OrganizationSeeder extends Seeder
$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"],
['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"],
['WorkstationID' => '1', 'DepartmentID' => '1', 'WorkstationCode' => 'HAUTO', 'WorkstationName' => 'Hematologi Auto', 'Type' => '0', 'LinkTo' => '', 'isEnable' => '1', 'CreateDate' => "$now"],
['WorkstationID' => '2', 'DepartmentID' => '1', 'WorkstationCode' => 'HBACK', 'WorkstationName' => 'Hematologi Backup', 'Type' => '1', 'LinkTo' => '1', 'isEnable' => '1', 'CreateDate' => "$now"],
['WorkstationID' => '3', 'DepartmentID' => '3', 'WorkstationCode' => 'CAUTO', 'WorkstationName' => 'Kimia Auto', 'Type' => '0', 'LinkTo' => '', 'isEnable' => '1', 'CreateDate' => "$now"],
['WorkstationID' => '4', 'DepartmentID' => '3', 'WorkstationCode' => 'CBACK', 'WorkstationName' => 'Kimia Backup', 'Type' => '1', 'LinkTo' => '3', 'isEnable' => '1', 'CreateDate' => "$now"],
['WorkstationID' => '5', 'DepartmentID' => '3', 'WorkstationCode' => 'CMAN', 'WorkstationName' => 'Kimia Manual', 'Type' => '0', 'LinkTo' => '', 'isEnable' => '1', 'CreateDate' => "$now"],
['WorkstationID' => '6', 'DepartmentID' => '4', 'WorkstationCode' => 'IAUTO', 'WorkstationName' => 'Imunologi Auto', 'Type' => '0', 'LinkTo' => '', 'isEnable' => '1', 'CreateDate' => "$now"],
['WorkstationID' => '7', 'DepartmentID' => '4', 'WorkstationCode' => 'IMAN', 'WorkstationName' => 'Imunologi Manual', 'Type' => '0', 'LinkTo' => '', 'isEnable' => '1', 'CreateDate' => "$now"],
['WorkstationID' => '8', 'DepartmentID' => '6', 'WorkstationCode' => 'UAUTO', 'WorkstationName' => 'Urin Auto', 'Type' => '0', 'LinkTo' => '', 'isEnable' => '1', 'CreateDate' => "$now"],
['WorkstationID' => '9', 'DepartmentID' => '6', 'WorkstationCode' => 'UMAN', 'WorkstationName' => 'Urin Manual', 'Type' => '0', 'LinkTo' => '', 'isEnable' => '1', 'CreateDate' => "$now"],
];
$this->db->table('workstation')->insertBatch($data);
// Equipment/Instruments for each workstation
$data = [
// Hematology Auto (WorkstationID: 1)
['EID' => 1, 'IEID' => 'EQ-HEM-001', 'DepartmentID' => '1', 'InstrumentID' => 'SYSMEX_XN1000', 'InstrumentName' => 'Sysmex XN-1000 Hematology Analyzer', 'WorkstationID' => 1, 'Enable' => 1, 'EquipmentRole' => 'A', 'CreateDate' => "$now"],
['EID' => 2, 'IEID' => 'EQ-HEM-002', 'DepartmentID' => '1', 'InstrumentID' => 'SYSMEX_XS1000', 'InstrumentName' => 'Sysmex XS-1000i', 'WorkstationID' => 1, 'Enable' => 1, 'EquipmentRole' => 'A', 'CreateDate' => "$now"],
['EID' => 1, 'IEID' => 'EQ-HEM-001', 'DepartmentID' => '1', 'InstrumentID' => 'SYSMEX_XN1000', 'InstrumentName' => 'Sysmex XN-1000 Hematology Analyzer', 'WorkstationID' => 1, 'isEnable' => 1, 'EquipmentRole' => 'A', 'CreateDate' => "$now"],
['EID' => 2, 'IEID' => 'EQ-HEM-002', 'DepartmentID' => '1', 'InstrumentID' => 'SYSMEX_XS1000', 'InstrumentName' => 'Sysmex XS-1000i', 'WorkstationID' => 1, 'isEnable' => 1, 'EquipmentRole' => 'A', 'CreateDate' => "$now"],
// Hematology Backup (WorkstationID: 2)
['EID' => 3, 'IEID' => 'EQ-HEM-003', 'DepartmentID' => '1', 'InstrumentID' => 'SYSMEX_XN550', 'InstrumentName' => 'Sysmex XN-550 Backup', 'WorkstationID' => 2, 'Enable' => 1, 'EquipmentRole' => 'B', 'CreateDate' => "$now"],
['EID' => 4, 'IEID' => 'EQ-HEM-004', 'DepartmentID' => '1', 'InstrumentID' => 'MANUAL_DIFF', 'InstrumentName' => 'Manual Differential Counter', 'WorkstationID' => 2, 'Enable' => 1, 'EquipmentRole' => 'M', 'CreateDate' => "$now"],
['EID' => 3, 'IEID' => 'EQ-HEM-003', 'DepartmentID' => '1', 'InstrumentID' => 'SYSMEX_XN550', 'InstrumentName' => 'Sysmex XN-550 Backup', 'WorkstationID' => 2, 'isEnable' => 1, 'EquipmentRole' => 'B', 'CreateDate' => "$now"],
['EID' => 4, 'IEID' => 'EQ-HEM-004', 'DepartmentID' => '1', 'InstrumentID' => 'MANUAL_DIFF', 'InstrumentName' => 'Manual Differential Counter', 'WorkstationID' => 2, 'isEnable' => 1, 'EquipmentRole' => 'M', 'CreateDate' => "$now"],
// Chemistry Auto (WorkstationID: 3)
['EID' => 5, 'IEID' => 'EQ-CHEM-001', 'DepartmentID' => '3', 'InstrumentID' => 'COBAS_C501', 'InstrumentName' => 'Roche Cobas C501 Chemistry Analyzer', 'WorkstationID' => 3, 'Enable' => 1, 'EquipmentRole' => 'A', 'CreateDate' => "$now"],
['EID' => 6, 'IEID' => 'EQ-CHEM-002', 'DepartmentID' => '3', 'InstrumentID' => 'COBAS_C311', 'InstrumentName' => 'Roche Cobas C311', 'WorkstationID' => 3, 'Enable' => 1, 'EquipmentRole' => 'A', 'CreateDate' => "$now"],
['EID' => 5, 'IEID' => 'EQ-CHEM-001', 'DepartmentID' => '3', 'InstrumentID' => 'COBAS_C501', 'InstrumentName' => 'Roche Cobas C501 Chemistry Analyzer', 'WorkstationID' => 3, 'isEnable' => 1, 'EquipmentRole' => 'A', 'CreateDate' => "$now"],
['EID' => 6, 'IEID' => 'EQ-CHEM-002', 'DepartmentID' => '3', 'InstrumentID' => 'COBAS_C311', 'InstrumentName' => 'Roche Cobas C311', 'WorkstationID' => 3, 'isEnable' => 1, 'EquipmentRole' => 'A', 'CreateDate' => "$now"],
// Chemistry Backup (WorkstationID: 4)
['EID' => 7, 'IEID' => 'EQ-CHEM-003', 'DepartmentID' => '3', 'InstrumentID' => 'COBAS_E411', 'InstrumentName' => 'Roche Cobas E411 Immunoassay', 'WorkstationID' => 4, 'Enable' => 1, 'EquipmentRole' => 'B', 'CreateDate' => "$now"],
['EID' => 7, 'IEID' => 'EQ-CHEM-003', 'DepartmentID' => '3', 'InstrumentID' => 'COBAS_E411', 'InstrumentName' => 'Roche Cobas E411 Immunoassay', 'WorkstationID' => 4, 'isEnable' => 1, 'EquipmentRole' => 'B', 'CreateDate' => "$now"],
// Chemistry Manual (WorkstationID: 5)
['EID' => 8, 'IEID' => 'EQ-CHEM-004', 'DepartmentID' => '3', 'InstrumentID' => 'SPEC_MANUAL', 'InstrumentName' => 'Spectrophotometer Manual', 'WorkstationID' => 5, 'Enable' => 1, 'EquipmentRole' => 'M', 'CreateDate' => "$now"],
['EID' => 8, 'IEID' => 'EQ-CHEM-004', 'DepartmentID' => '3', 'InstrumentID' => 'SPEC_MANUAL', 'InstrumentName' => 'Spectrophotometer Manual', 'WorkstationID' => 5, 'isEnable' => 1, 'EquipmentRole' => 'M', 'CreateDate' => "$now"],
// Immunology Auto (WorkstationID: 6)
['EID' => 9, 'IEID' => 'EQ-IMM-001', 'DepartmentID' => '4', 'InstrumentID' => 'ARCH_I2000', 'InstrumentName' => 'Architect i2000 Immunoassay', 'WorkstationID' => 6, 'Enable' => 1, 'EquipmentRole' => 'A', 'CreateDate' => "$now"],
['EID' => 10, 'IEID' => 'EQ-IMM-002', 'DepartmentID' => '4', 'InstrumentID' => 'COBAS_E601', 'InstrumentName' => 'Roche Cobas E601', 'WorkstationID' => 6, 'Enable' => 1, 'EquipmentRole' => 'A', 'CreateDate' => "$now"],
['EID' => 9, 'IEID' => 'EQ-IMM-001', 'DepartmentID' => '4', 'InstrumentID' => 'ARCH_I2000', 'InstrumentName' => 'Architect i2000 Immunoassay', 'WorkstationID' => 6, 'isEnable' => 1, 'EquipmentRole' => 'A', 'CreateDate' => "$now"],
['EID' => 10, 'IEID' => 'EQ-IMM-002', 'DepartmentID' => '4', 'InstrumentID' => 'COBAS_E601', 'InstrumentName' => 'Roche Cobas E601', 'WorkstationID' => 6, 'isEnable' => 1, 'EquipmentRole' => 'A', 'CreateDate' => "$now"],
// Immunology Manual (WorkstationID: 7)
['EID' => 11, 'IEID' => 'EQ-IMM-003', 'DepartmentID' => '4', 'InstrumentID' => 'ELISA_READER', 'InstrumentName' => 'ELISA Plate Reader', 'WorkstationID' => 7, 'Enable' => 1, 'EquipmentRole' => 'M', 'CreateDate' => "$now"],
['EID' => 12, 'IEID' => 'EQ-IMM-004', 'DepartmentID' => '4', 'InstrumentID' => 'FLUORIMETER', 'InstrumentName' => 'Fluorimeter Manual', 'WorkstationID' => 7, 'Enable' => 1, 'EquipmentRole' => 'M', 'CreateDate' => "$now"],
['EID' => 11, 'IEID' => 'EQ-IMM-003', 'DepartmentID' => '4', 'InstrumentID' => 'ELISA_READER', 'InstrumentName' => 'ELISA Plate Reader', 'WorkstationID' => 7, 'isEnable' => 1, 'EquipmentRole' => 'M', 'CreateDate' => "$now"],
['EID' => 12, 'IEID' => 'EQ-IMM-004', 'DepartmentID' => '4', 'InstrumentID' => 'FLUORIMETER', 'InstrumentName' => 'Fluorimeter Manual', 'WorkstationID' => 7, 'isEnable' => 1, 'EquipmentRole' => 'M', 'CreateDate' => "$now"],
// Urinalysis Auto (WorkstationID: 8)
['EID' => 13, 'IEID' => 'EQ-URI-001', 'DepartmentID' => '6', 'InstrumentID' => 'URISYS_1100', 'InstrumentName' => 'Urisys 1100 Urine Analyzer', 'WorkstationID' => 8, 'Enable' => 1, 'EquipmentRole' => 'A', 'CreateDate' => "$now"],
['EID' => 14, 'IEID' => 'EQ-URI-002', 'DepartmentID' => '6', 'InstrumentID' => 'CLINITEK', 'InstrumentName' => 'Clinitek Urine Chemistry', 'WorkstationID' => 8, 'Enable' => 1, 'EquipmentRole' => 'A', 'CreateDate' => "$now"],
['EID' => 13, 'IEID' => 'EQ-URI-001', 'DepartmentID' => '6', 'InstrumentID' => 'URISYS_1100', 'InstrumentName' => 'Urisys 1100 Urine Analyzer', 'WorkstationID' => 8, 'isEnable' => 1, 'EquipmentRole' => 'A', 'CreateDate' => "$now"],
['EID' => 14, 'IEID' => 'EQ-URI-002', 'DepartmentID' => '6', 'InstrumentID' => 'CLINITEK', 'InstrumentName' => 'Clinitek Urine Chemistry', 'WorkstationID' => 8, 'isEnable' => 1, 'EquipmentRole' => 'A', 'CreateDate' => "$now"],
// Urinalysis Manual (WorkstationID: 9)
['EID' => 15, 'IEID' => 'EQ-URI-003', 'DepartmentID' => '6', 'InstrumentID' => 'MICROSCOPE', 'InstrumentName' => 'Microscope Manual', 'WorkstationID' => 9, 'Enable' => 1, 'EquipmentRole' => 'M', 'CreateDate' => "$now"],
['EID' => 16, 'IEID' => 'EQ-URI-004', 'DepartmentID' => '6', 'InstrumentID' => 'CENTRIFUGE', 'InstrumentName' => 'Centrifuge Urine', 'WorkstationID' => 9, 'Enable' => 1, 'EquipmentRole' => 'M', 'CreateDate' => "$now"],
['EID' => 15, 'IEID' => 'EQ-URI-003', 'DepartmentID' => '6', 'InstrumentID' => 'MICROSCOPE', 'InstrumentName' => 'Microscope Manual', 'WorkstationID' => 9, 'isEnable' => 1, 'EquipmentRole' => 'M', 'CreateDate' => "$now"],
['EID' => 16, 'IEID' => 'EQ-URI-004', 'DepartmentID' => '6', 'InstrumentID' => 'CENTRIFUGE', 'InstrumentName' => 'Centrifuge Urine', 'WorkstationID' => 9, 'isEnable' => 1, 'EquipmentRole' => 'M', 'CreateDate' => "$now"],
// Additional equipment (disabled)
['EID' => 17, 'IEID' => 'EQ-HEM-005', 'DepartmentID' => '1', 'InstrumentID' => 'OLD_ANALYZER', 'InstrumentName' => 'Old Hematology Analyzer', 'WorkstationID' => 1, 'Enable' => 0, 'EquipmentRole' => 'B', 'CreateDate' => "$now"],
['EID' => 18, 'IEID' => 'EQ-CHEM-005', 'DepartmentID' => '3', 'InstrumentID' => 'MAINTENANCE', 'InstrumentName' => 'Chemistry Analyzer Under Maintenance', 'WorkstationID' => 3, 'Enable' => 0, 'EquipmentRole' => 'B', 'CreateDate' => "$now"],
['EID' => 17, 'IEID' => 'EQ-HEM-005', 'DepartmentID' => '1', 'InstrumentID' => 'OLD_ANALYZER', 'InstrumentName' => 'Old Hematology Analyzer', 'WorkstationID' => 1, 'isEnable' => 0, 'EquipmentRole' => 'B', 'CreateDate' => "$now"],
['EID' => 18, 'IEID' => 'EQ-CHEM-005', 'DepartmentID' => '3', 'InstrumentID' => 'MAINTENANCE', 'InstrumentName' => 'Chemistry Analyzer Under Maintenance', 'WorkstationID' => 3, 'isEnable' => 0, 'EquipmentRole' => 'B', 'CreateDate' => "$now"],
];
$this->db->table('equipmentlist')->insertBatch($data);
}

View File

@ -46,7 +46,7 @@ class PatientSeeder extends Seeder
'Religion' => 'ISLAM',
'Ethnic' => 'TNGHA',
'Citizenship' => 'WNI',
'DeathIndicator' => 'N',
'isDead' => '0',
'TimeOfDeath' => null,
'LinkTo' => null,
'CreateDate' => $now,
@ -84,7 +84,7 @@ class PatientSeeder extends Seeder
'Religion' => 'KRSTN',
'Ethnic' => 'TNGHA',
'Citizenship' => 'WNI',
'DeathIndicator' => 'N',
'isDead' => '0',
'TimeOfDeath' => null,
'LinkTo' => null,
'CreateDate' => $now,
@ -122,7 +122,7 @@ class PatientSeeder extends Seeder
'Religion' => 'ISLAM',
'Ethnic' => 'TNGHA',
'Citizenship' => 'WNI',
'DeathIndicator' => 'N',
'isDead' => '0',
'TimeOfDeath' => null,
'LinkTo' => '1,2',
'CreateDate' => $now,

View File

@ -2,9 +2,9 @@
namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder;
use App\Libraries\ValueSet;
use App\Services\RuleExpressionService;
use CodeIgniter\Database\Seeder;
use App\Libraries\ValueSet;
use App\Services\RuleExpressionService;
class TestSeeder extends Seeder
{
@ -71,42 +71,42 @@ class TestSeeder extends Seeder
// ========================================
// GROUP: CBC (Complete Blood Count)
$data = ['SiteID' => '1', 'TestSiteCode' => 'CBC', 'TestSiteName' => 'Complete Blood Count', 'TestType' => 'GROUP', 'Description' => 'Darah Lengkap', 'SeqScr' => '10', 'SeqRpt' => '10', 'IndentLeft' => '0', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'ResultType' => 'NORES', 'RefType' => 'NOREF', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'CBC', 'TestSiteName' => 'Complete Blood Count', 'TestType' => 'GROUP', 'Description' => 'Darah Lengkap', 'SeqScr' => '10', 'SeqRpt' => '10', 'IndentLeft' => '0', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'ResultType' => 'NORES', 'RefType' => 'NOREF', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['CBC'] = $this->db->insertID();
// PARAM: (none for Hematology)
// TEST: Hematology Tests
$data = ['SiteID' => '1', 'TestSiteCode' => 'HB', 'TestSiteName' => 'Hemoglobin', 'TestType' => 'TEST', 'Description' => '', 'SeqScr' => '100', 'SeqRpt' => '100', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '1', 'DepartmentID' => '1', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '500', 'ReqQtyUnit' => 'uL', 'Unit1' => 'g/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'Method' => 'CBC Analyzer', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'HB', 'TestSiteName' => 'Hemoglobin', 'TestType' => 'TEST', 'Description' => '', 'SeqScr' => '100', 'SeqRpt' => '100', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '1', 'DepartmentID' => '1', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '500', 'ReqQtyUnit' => 'uL', 'Unit1' => 'g/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'Method' => 'CBC Analyzer', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['HB'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'HCT', 'TestSiteName' => 'Hematocrit', 'TestType' => 'TEST', 'Description' => '', 'SeqScr' => '110', 'SeqRpt' => '110', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '1', 'DepartmentID' => '1', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '500', 'ReqQtyUnit' => 'uL', 'Unit1' => '%', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'Method' => 'CBC Analyzer', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'HCT', 'TestSiteName' => 'Hematocrit', 'TestType' => 'TEST', 'Description' => '', 'SeqScr' => '110', 'SeqRpt' => '110', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '1', 'DepartmentID' => '1', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '500', 'ReqQtyUnit' => 'uL', 'Unit1' => '%', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'Method' => 'CBC Analyzer', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['HCT'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'RBC', 'TestSiteName' => 'Red Blood Cell', 'TestType' => 'TEST', 'Description' => 'Eritrosit', 'SeqScr' => '120', 'SeqRpt' => '120', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '1', 'DepartmentID' => '1', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '500', 'ReqQtyUnit' => 'uL', 'Unit1' => 'x10^6/uL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '2', 'Method' => 'CBC Analyzer', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'RBC', 'TestSiteName' => 'Red Blood Cell', 'TestType' => 'TEST', 'Description' => 'Eritrosit', 'SeqScr' => '120', 'SeqRpt' => '120', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '1', 'DepartmentID' => '1', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '500', 'ReqQtyUnit' => 'uL', 'Unit1' => 'x10^6/uL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '2', 'Method' => 'CBC Analyzer', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['RBC'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'WBC', 'TestSiteName' => 'White Blood Cell', 'TestType' => 'TEST', 'Description' => 'Leukosit', 'SeqScr' => '130', 'SeqRpt' => '130', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '1', 'DepartmentID' => '1', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '500', 'ReqQtyUnit' => 'uL', 'Unit1' => 'x10^3/uL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '2', 'Method' => 'CBC Analyzer', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'WBC', 'TestSiteName' => 'White Blood Cell', 'TestType' => 'TEST', 'Description' => 'Leukosit', 'SeqScr' => '130', 'SeqRpt' => '130', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '1', 'DepartmentID' => '1', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '500', 'ReqQtyUnit' => 'uL', 'Unit1' => 'x10^3/uL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '2', 'Method' => 'CBC Analyzer', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['WBC'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'PLT', 'TestSiteName' => 'Platelet', 'TestType' => 'TEST', 'Description' => 'Trombosit', 'SeqScr' => '140', 'SeqRpt' => '140', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '1', 'DepartmentID' => '1', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '500', 'ReqQtyUnit' => 'uL', 'Unit1' => 'x10^3/uL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'Method' => 'CBC Analyzer', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'PLT', 'TestSiteName' => 'Platelet', 'TestType' => 'TEST', 'Description' => 'Trombosit', 'SeqScr' => '140', 'SeqRpt' => '140', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '1', 'DepartmentID' => '1', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '500', 'ReqQtyUnit' => 'uL', 'Unit1' => 'x10^3/uL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'Method' => 'CBC Analyzer', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['PLT'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'MCV', 'TestSiteName' => 'MCV', 'TestType' => 'TEST', 'Description' => 'Mean Corpuscular Volume', 'SeqScr' => '150', 'SeqRpt' => '150', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '1', 'DepartmentID' => '1', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '500', 'ReqQtyUnit' => 'uL', 'Unit1' => 'fL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'Method' => 'CBC Analyzer', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'MCV', 'TestSiteName' => 'MCV', 'TestType' => 'TEST', 'Description' => 'Mean Corpuscular Volume', 'SeqScr' => '150', 'SeqRpt' => '150', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '1', 'DepartmentID' => '1', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '500', 'ReqQtyUnit' => 'uL', 'Unit1' => 'fL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'Method' => 'CBC Analyzer', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['MCV'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'MCH', 'TestSiteName' => 'MCH', 'TestType' => 'TEST', 'Description' => 'Mean Corpuscular Hemoglobin', 'SeqScr' => '160', 'SeqRpt' => '160', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '1', 'DepartmentID' => '1', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '500', 'ReqQtyUnit' => 'uL', 'Unit1' => 'pg', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'Method' => 'CBC Analyzer', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'MCH', 'TestSiteName' => 'MCH', 'TestType' => 'TEST', 'Description' => 'Mean Corpuscular Hemoglobin', 'SeqScr' => '160', 'SeqRpt' => '160', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '1', 'DepartmentID' => '1', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '500', 'ReqQtyUnit' => 'uL', 'Unit1' => 'pg', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'Method' => 'CBC Analyzer', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['MCH'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'MCHC', 'TestSiteName' => 'MCHC', 'TestType' => 'TEST', 'Description' => 'Mean Corpuscular Hemoglobin Concentration', 'SeqScr' => '170', 'SeqRpt' => '170', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '1', 'DepartmentID' => '1', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '500', 'ReqQtyUnit' => 'uL', 'Unit1' => 'g/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'Method' => 'CBC Analyzer', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'MCHC', 'TestSiteName' => 'MCHC', 'TestType' => 'TEST', 'Description' => 'Mean Corpuscular Hemoglobin Concentration', 'SeqScr' => '170', 'SeqRpt' => '170', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '1', 'DepartmentID' => '1', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '500', 'ReqQtyUnit' => 'uL', 'Unit1' => 'g/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'Method' => 'CBC Analyzer', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['MCHC'] = $this->db->insertID();
@ -130,82 +130,82 @@ class TestSeeder extends Seeder
// ========================================
// GROUP: LIPID, LFT, RFT
$data = ['SiteID' => '1', 'TestSiteCode' => 'LIPID', 'TestSiteName' => 'Lipid Profile', 'TestType' => 'GROUP', 'Description' => 'Profil Lipid', 'SeqScr' => '10', 'SeqRpt' => '10', 'IndentLeft' => '0', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'ResultType' => 'NORES', 'RefType' => 'NOREF', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'LIPID', 'TestSiteName' => 'Lipid Profile', 'TestType' => 'GROUP', 'Description' => 'Profil Lipid', 'SeqScr' => '10', 'SeqRpt' => '10', 'IndentLeft' => '0', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'ResultType' => 'NORES', 'RefType' => 'NOREF', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['LIPID'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'LFT', 'TestSiteName' => 'Liver Function Test', 'TestType' => 'GROUP', 'Description' => 'Fungsi Hati', 'SeqScr' => '20', 'SeqRpt' => '20', 'IndentLeft' => '0', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'ResultType' => 'NORES', 'RefType' => 'NOREF', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'LFT', 'TestSiteName' => 'Liver Function Test', 'TestType' => 'GROUP', 'Description' => 'Fungsi Hati', 'SeqScr' => '20', 'SeqRpt' => '20', 'IndentLeft' => '0', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'ResultType' => 'NORES', 'RefType' => 'NOREF', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['LFT'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'RFT', 'TestSiteName' => 'Renal Function Test', 'TestType' => 'GROUP', 'Description' => 'Fungsi Ginjal', 'SeqScr' => '30', 'SeqRpt' => '30', 'IndentLeft' => '0', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'ResultType' => 'NORES', 'RefType' => 'NOREF', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'RFT', 'TestSiteName' => 'Renal Function Test', 'TestType' => 'GROUP', 'Description' => 'Fungsi Ginjal', 'SeqScr' => '30', 'SeqRpt' => '30', 'IndentLeft' => '0', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'ResultType' => 'NORES', 'RefType' => 'NOREF', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['RFT'] = $this->db->insertID();
// PARAM: (none for Chemistry)
// TEST: Chemistry Tests
$data = ['SiteID' => '1', 'TestSiteCode' => 'GLU', 'TestSiteName' => 'Glucose', 'TestType' => 'TEST', 'Description' => 'Glukosa Sewaktu', 'SeqScr' => '100', 'SeqRpt' => '100', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'mg/dL', 'Factor' => '0.0555', 'Unit2' => 'mmol/L', 'Decimal' => '0', 'Method' => 'Hexokinase', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'GLU', 'TestSiteName' => 'Glucose', 'TestType' => 'TEST', 'Description' => 'Glukosa Sewaktu', 'SeqScr' => '100', 'SeqRpt' => '100', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'mg/dL', 'Factor' => '0.0555', 'Unit2' => 'mmol/L', 'Decimal' => '0', 'Method' => 'Hexokinase', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['GLU'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'CREA', 'TestSiteName' => 'Creatinine', 'TestType' => 'TEST', 'Description' => 'Kreatinin', 'SeqScr' => '110', 'SeqRpt' => '110', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'mg/dL', 'Factor' => '88.4', 'Unit2' => 'umol/L', 'Decimal' => '2', 'Method' => 'Enzymatic', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'CREA', 'TestSiteName' => 'Creatinine', 'TestType' => 'TEST', 'Description' => 'Kreatinin', 'SeqScr' => '110', 'SeqRpt' => '110', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'mg/dL', 'Factor' => '88.4', 'Unit2' => 'umol/L', 'Decimal' => '2', 'Method' => 'Enzymatic', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['CREA'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'UREA', 'TestSiteName' => 'Blood Urea Nitrogen', 'TestType' => 'TEST', 'Description' => 'BUN', 'SeqScr' => '120', 'SeqRpt' => '120', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'mg/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'Method' => 'Urease-GLDH', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'UREA', 'TestSiteName' => 'Blood Urea Nitrogen', 'TestType' => 'TEST', 'Description' => 'BUN', 'SeqScr' => '120', 'SeqRpt' => '120', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'mg/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'Method' => 'Urease-GLDH', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['UREA'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'SGOT', 'TestSiteName' => 'AST (SGOT)', 'TestType' => 'TEST', 'Description' => 'Aspartate Aminotransferase', 'SeqScr' => '130', 'SeqRpt' => '130', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'U/L', 'Factor' => '0.017', 'Unit2' => 'ukat/L', 'Decimal' => '0', 'Method' => 'IFCC', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'SGOT', 'TestSiteName' => 'AST (SGOT)', 'TestType' => 'TEST', 'Description' => 'Aspartate Aminotransferase', 'SeqScr' => '130', 'SeqRpt' => '130', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'U/L', 'Factor' => '0.017', 'Unit2' => 'ukat/L', 'Decimal' => '0', 'Method' => 'IFCC', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['SGOT'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'SGPT', 'TestSiteName' => 'ALT (SGPT)', 'TestType' => 'TEST', 'Description' => 'Alanine Aminotransferase', 'SeqScr' => '140', 'SeqRpt' => '140', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'U/L', 'Factor' => '0.017', 'Unit2' => 'ukat/L', 'Decimal' => '0', 'Method' => 'IFCC', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'SGPT', 'TestSiteName' => 'ALT (SGPT)', 'TestType' => 'TEST', 'Description' => 'Alanine Aminotransferase', 'SeqScr' => '140', 'SeqRpt' => '140', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'U/L', 'Factor' => '0.017', 'Unit2' => 'ukat/L', 'Decimal' => '0', 'Method' => 'IFCC', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['SGPT'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'CHOL', 'TestSiteName' => 'Total Cholesterol', 'TestType' => 'TEST', 'Description' => 'Kolesterol Total', 'SeqScr' => '150', 'SeqRpt' => '150', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'mg/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'Method' => 'Enzymatic', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'CHOL', 'TestSiteName' => 'Total Cholesterol', 'TestType' => 'TEST', 'Description' => 'Kolesterol Total', 'SeqScr' => '150', 'SeqRpt' => '150', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'mg/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'Method' => 'Enzymatic', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['CHOL'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'TG', 'TestSiteName' => 'Triglycerides', 'TestType' => 'TEST', 'Description' => 'Trigliserida', 'SeqScr' => '160', 'SeqRpt' => '160', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'mg/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'Method' => 'GPO-PAP', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'TG', 'TestSiteName' => 'Triglycerides', 'TestType' => 'TEST', 'Description' => 'Trigliserida', 'SeqScr' => '160', 'SeqRpt' => '160', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'mg/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'Method' => 'GPO-PAP', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['TG'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'HDL', 'TestSiteName' => 'HDL Cholesterol', 'TestType' => 'TEST', 'Description' => 'Kolesterol HDL', 'SeqScr' => '170', 'SeqRpt' => '170', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'mg/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'Method' => 'Direct', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'HDL', 'TestSiteName' => 'HDL Cholesterol', 'TestType' => 'TEST', 'Description' => 'Kolesterol HDL', 'SeqScr' => '170', 'SeqRpt' => '170', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'mg/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'Method' => 'Direct', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['HDL'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'LDL', 'TestSiteName' => 'LDL Cholesterol', 'TestType' => 'TEST', 'Description' => 'Kolesterol LDL', 'SeqScr' => '180', 'SeqRpt' => '180', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'mg/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'Method' => 'Direct', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'LDL', 'TestSiteName' => 'LDL Cholesterol', 'TestType' => 'TEST', 'Description' => 'Kolesterol LDL', 'SeqScr' => '180', 'SeqRpt' => '180', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'mg/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'Method' => 'Direct', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['LDL'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'TBIL', 'TestSiteName' => 'Total Bilirubin', 'TestType' => 'TEST', 'Description' => 'Bilirubin Total', 'SeqScr' => '185', 'SeqRpt' => '185', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'mg/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '2', 'Method' => 'Diazo', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'TBIL', 'TestSiteName' => 'Total Bilirubin', 'TestType' => 'TEST', 'Description' => 'Bilirubin Total', 'SeqScr' => '185', 'SeqRpt' => '185', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'mg/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '2', 'Method' => 'Diazo', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['TBIL'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'DBIL', 'TestSiteName' => 'Direct Bilirubin', 'TestType' => 'TEST', 'Description' => 'Bilirubin Direk', 'SeqScr' => '186', 'SeqRpt' => '186', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'mg/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '2', 'Method' => 'Diazo', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'DBIL', 'TestSiteName' => 'Direct Bilirubin', 'TestType' => 'TEST', 'Description' => 'Bilirubin Direk', 'SeqScr' => '186', 'SeqRpt' => '186', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '2', 'DepartmentID' => '2', 'ResultType' => 'NMRIC', 'RefType' => 'RANGE', 'VSet' => '', 'ReqQty' => '300', 'ReqQtyUnit' => 'uL', 'Unit1' => 'mg/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '2', 'Method' => 'Diazo', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['DBIL'] = $this->db->insertID();
// CALC: Chemistry Calculated Tests
$data = ['SiteID' => '1', 'TestSiteCode' => 'EGFR', 'TestSiteName' => 'eGFR (CKD-EPI)', 'TestType' => 'CALC', 'Description' => 'Estimated Glomerular Filtration Rate', 'SeqScr' => '190', 'SeqRpt' => '190', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '0', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['EGFR'] = $this->db->insertID();
$data = ['TestSiteID' => $tIDs['EGFR'], 'DisciplineID' => '2', 'DepartmentID' => '2', 'FormulaCode' => '142 * (({CREA}/{KAPPA}) < 1 ? ({CREA}/{KAPPA}) : 1) ** {ALPHA} * (({CREA}/{KAPPA}) > 1 ? ({CREA}/{KAPPA}) : 1) ** -1.200 * (0.9938 ** {AGE}) * {SEXFAC}', 'RefType' => 'RANGE', 'Unit1' => 'mL/min/1.73m2', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'CreateDate' => "$now"];
$this->db->table('testdefcal')->insert($data);
$data = ['SiteID' => '1', 'TestSiteCode' => 'LDLCALC', 'TestSiteName' => 'LDL Cholesterol (Calculated)', 'TestType' => 'CALC', 'Description' => 'Friedewald formula: TC - HDL - (TG/5)', 'SeqScr' => '200', 'SeqRpt' => '200', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '0', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'EGFR', 'TestSiteName' => 'eGFR (CKD-EPI)', 'TestType' => 'CALC', 'Description' => 'Estimated Glomerular Filtration Rate', 'SeqScr' => '190', 'SeqRpt' => '190', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '0', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['LDLCALC'] = $this->db->insertID();
$data = ['TestSiteID' => $tIDs['LDLCALC'], 'DisciplineID' => '2', 'DepartmentID' => '2', 'FormulaCode' => '{CHOL} - {HDL} - ({TG}/5)', 'RefType' => 'RANGE', 'Unit1' => 'mg/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'CreateDate' => "$now"];
$tIDs['EGFR'] = $this->db->insertID();
$data = ['TestSiteID' => $tIDs['EGFR'], 'DisciplineID' => '2', 'DepartmentID' => '2', 'FormulaCode' => '142 * (({CREA}/{KAPPA}) < 1 ? ({CREA}/{KAPPA}) : 1) ** {ALPHA} * (({CREA}/{KAPPA}) > 1 ? ({CREA}/{KAPPA}) : 1) ** -1.200 * (0.9938 ** {AGE}) * {SEXFAC}', 'RefType' => 'RANGE', 'Unit1' => 'mL/min/1.73m2', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'CreateDate' => "$now"];
$this->db->table('testdefcal')->insert($data);
$data = ['SiteID' => '1', 'TestSiteCode' => 'IBIL', 'TestSiteName' => 'Indirect Bilirubin', 'TestType' => 'CALC', 'Description' => 'Bilirubin Indirek: TBIL - DBIL', 'SeqScr' => '210', 'SeqRpt' => '210', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '0', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'LDLCALC', 'TestSiteName' => 'LDL Cholesterol (Calculated)', 'TestType' => 'CALC', 'Description' => 'Friedewald formula: TC - HDL - (TG/5)', 'SeqScr' => '200', 'SeqRpt' => '200', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '0', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['LDLCALC'] = $this->db->insertID();
$data = ['TestSiteID' => $tIDs['LDLCALC'], 'DisciplineID' => '2', 'DepartmentID' => '2', 'FormulaCode' => '{CHOL} - {HDL} - ({TG}/5)', 'RefType' => 'RANGE', 'Unit1' => 'mg/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'CreateDate' => "$now"];
$this->db->table('testdefcal')->insert($data);
$data = ['SiteID' => '1', 'TestSiteCode' => 'IBIL', 'TestSiteName' => 'Indirect Bilirubin', 'TestType' => 'CALC', 'Description' => 'Bilirubin Indirek: TBIL - DBIL', 'SeqScr' => '210', 'SeqRpt' => '210', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '0', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['IBIL'] = $this->db->insertID();
$data = ['TestSiteID' => $tIDs['IBIL'], 'DisciplineID' => '2', 'DepartmentID' => '2', 'FormulaCode' => '{TBIL} - {DBIL}', 'RefType' => 'RANGE', 'Unit1' => 'mg/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '2', 'CreateDate' => "$now"];
$data = ['TestSiteID' => $tIDs['IBIL'], 'DisciplineID' => '2', 'DepartmentID' => '2', 'FormulaCode' => '{TBIL} - {DBIL}', 'RefType' => 'RANGE', 'Unit1' => 'mg/dL', 'Factor' => '', 'Unit2' => '', 'Decimal' => '2', 'CreateDate' => "$now"];
$this->db->table('testdefcal')->insert($data);
// CALC dependencies are grouped via testdefgrp
@ -251,19 +251,19 @@ class TestSeeder extends Seeder
// PARAM: (none for Urinalysis)
// TEST: Urinalysis Tests
$data = ['SiteID' => '1', 'TestSiteCode' => 'UCOLOR', 'TestSiteName' => 'Urine Color', 'TestType' => 'TEST', 'Description' => 'Warna Urine', 'SeqScr' => '100', 'SeqRpt' => '100', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '4', 'DepartmentID' => '4', 'ResultType' => 'VSET', 'RefType' => 'VSET', 'VSet' => '1001', 'ReqQty' => '10', 'ReqQtyUnit' => 'mL', 'Unit1' => '', 'Factor' => '', 'Unit2' => '', 'Decimal' => '', 'Method' => 'Visual', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'UCOLOR', 'TestSiteName' => 'Urine Color', 'TestType' => 'TEST', 'Description' => 'Warna Urine', 'SeqScr' => '100', 'SeqRpt' => '100', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '4', 'DepartmentID' => '4', 'ResultType' => 'VSET', 'RefType' => 'VSET', 'VSet' => '1001', 'ReqQty' => '10', 'ReqQtyUnit' => 'mL', 'Unit1' => '', 'Factor' => '', 'Unit2' => '', 'Decimal' => '', 'Method' => 'Visual', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['UCOLOR'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'UGLUC', 'TestSiteName' => 'Urine Glucose', 'TestType' => 'TEST', 'Description' => 'Glukosa Urine', 'SeqScr' => '110', 'SeqRpt' => '110', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '4', 'DepartmentID' => '4', 'ResultType' => 'VSET', 'RefType' => 'VSET', 'VSet' => '1002', 'ReqQty' => '10', 'ReqQtyUnit' => 'mL', 'Unit1' => '', 'Factor' => '', 'Unit2' => '', 'Decimal' => '', 'Method' => 'Dipstick', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'UGLUC', 'TestSiteName' => 'Urine Glucose', 'TestType' => 'TEST', 'Description' => 'Glukosa Urine', 'SeqScr' => '110', 'SeqRpt' => '110', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '4', 'DepartmentID' => '4', 'ResultType' => 'VSET', 'RefType' => 'VSET', 'VSet' => '1002', 'ReqQty' => '10', 'ReqQtyUnit' => 'mL', 'Unit1' => '', 'Factor' => '', 'Unit2' => '', 'Decimal' => '', 'Method' => 'Dipstick', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['UGLUC'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'UPROT', 'TestSiteName' => 'Urine Protein', 'TestType' => 'TEST', 'Description' => 'Protein Urine', 'SeqScr' => '120', 'SeqRpt' => '120', 'IndentLeft' => '1', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '1', 'DisciplineID' => '4', 'DepartmentID' => '4', 'ResultType' => 'VSET', 'RefType' => 'VSET', 'VSet' => '1003', 'ReqQty' => '10', 'ReqQtyUnit' => 'mL', 'Unit1' => '', 'Factor' => '', 'Unit2' => '', 'Decimal' => '', 'Method' => 'Dipstick', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'UPROT', 'TestSiteName' => 'Urine Protein', 'TestType' => 'TEST', 'Description' => 'Protein Urine', 'SeqScr' => '120', 'SeqRpt' => '120', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '1', 'DisciplineID' => '4', 'DepartmentID' => '4', 'ResultType' => 'VSET', 'RefType' => 'VSET', 'VSet' => '1003', 'ReqQty' => '10', 'ReqQtyUnit' => 'mL', 'Unit1' => '', 'Factor' => '', 'Unit2' => '', 'Decimal' => '', 'Method' => 'Dipstick', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['UPROT'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'PH', 'TestSiteName' => 'Urine pH', 'TestType' => 'TEST', 'Description' => 'pH Urine', 'SeqScr' => '130', 'SeqRpt' => '130', '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"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'PH', 'TestSiteName' => 'Urine pH', 'TestType' => 'TEST', 'Description' => 'pH Urine', 'SeqScr' => '130', 'SeqRpt' => '130', 'IndentLeft' => '1', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '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();
@ -277,109 +277,109 @@ class TestSeeder extends Seeder
// GROUP: (none for General)
// PARAM: General Parameters (< 100)
$data = ['SiteID' => '1', 'TestSiteCode' => 'HEIGHT', 'TestSiteName' => 'Height', 'TestType' => 'PARAM', 'Description' => 'Tinggi Badan', 'SeqScr' => '10', 'SeqRpt' => '10', 'IndentLeft' => '0', 'VisibleScr' => '1', 'VisibleRpt' => '0', 'CountStat' => '0', 'DisciplineID' => '10', 'DepartmentID' => '', 'ResultType' => 'NMRIC', 'RefType' => '', 'VSet' => '', 'ReqQty' => '', 'ReqQtyUnit' => '', 'Unit1' => 'cm', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'Method' => '', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'HEIGHT', 'TestSiteName' => 'Height', 'TestType' => 'PARAM', 'Description' => 'Tinggi Badan', 'SeqScr' => '10', 'SeqRpt' => '10', 'IndentLeft' => '0', 'isVisibleScr' => '1', 'isVisibleRpt' => '0', 'isCountStat' => '0', 'DisciplineID' => '10', 'DepartmentID' => '', 'ResultType' => 'NMRIC', 'RefType' => '', 'VSet' => '', 'ReqQty' => '', 'ReqQtyUnit' => '', 'Unit1' => 'cm', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'Method' => '', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['HEIGHT'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'WEIGHT', 'TestSiteName' => 'Weight', 'TestType' => 'PARAM', 'Description' => 'Berat Badan', 'SeqScr' => '20', 'SeqRpt' => '20', 'IndentLeft' => '0', 'VisibleScr' => '1', 'VisibleRpt' => '0', 'CountStat' => '0', 'DisciplineID' => '10', 'DepartmentID' => '', 'ResultType' => 'NMRIC', 'RefType' => '', 'VSet' => '', 'ReqQty' => '', 'ReqQtyUnit' => '', 'Unit1' => 'kg', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'Method' => '', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'WEIGHT', 'TestSiteName' => 'Weight', 'TestType' => 'PARAM', 'Description' => 'Berat Badan', 'SeqScr' => '20', 'SeqRpt' => '20', 'IndentLeft' => '0', 'isVisibleScr' => '1', 'isVisibleRpt' => '0', 'isCountStat' => '0', 'DisciplineID' => '10', 'DepartmentID' => '', 'ResultType' => 'NMRIC', 'RefType' => '', 'VSet' => '', 'ReqQty' => '', 'ReqQtyUnit' => '', 'Unit1' => 'kg', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'Method' => '', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['WEIGHT'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'AGE', 'TestSiteName' => 'Age', 'TestType' => 'PARAM', 'Description' => 'Usia', 'SeqScr' => '30', 'SeqRpt' => '30', 'IndentLeft' => '0', 'VisibleScr' => '1', 'VisibleRpt' => '0', 'CountStat' => '0', 'DisciplineID' => '10', 'DepartmentID' => '', 'ResultType' => 'NMRIC', 'RefType' => '', 'VSet' => '', 'ReqQty' => '', 'ReqQtyUnit' => '', 'Unit1' => 'years', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'Method' => '', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['AGE'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'ALPHA', 'TestSiteName' => 'Alpha', 'TestType' => 'PARAM', 'Description' => 'eGFR Alpha', 'SeqScr' => '35', 'SeqRpt' => '35', 'IndentLeft' => '0', 'VisibleScr' => '1', 'VisibleRpt' => '0', 'CountStat' => '0', 'DisciplineID' => '10', 'DepartmentID' => '', 'ResultType' => 'NMRIC', 'RefType' => '', 'VSet' => '', 'ReqQty' => '', 'ReqQtyUnit' => '', 'Unit1' => '', 'Factor' => '', 'Unit2' => '', 'Decimal' => '3', 'Method' => '', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['ALPHA'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'KAPPA', 'TestSiteName' => 'Kappa', 'TestType' => 'PARAM', 'Description' => 'eGFR Kappa', 'SeqScr' => '36', 'SeqRpt' => '36', 'IndentLeft' => '0', 'VisibleScr' => '1', 'VisibleRpt' => '0', 'CountStat' => '0', 'DisciplineID' => '10', 'DepartmentID' => '', 'ResultType' => 'NMRIC', 'RefType' => '', 'VSet' => '', 'ReqQty' => '', 'ReqQtyUnit' => '', 'Unit1' => '', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'Method' => '', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['KAPPA'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'SEXFAC', 'TestSiteName' => 'Sex Factor', 'TestType' => 'PARAM', 'Description' => 'eGFR Sex Factor', 'SeqScr' => '37', 'SeqRpt' => '37', 'IndentLeft' => '0', 'VisibleScr' => '1', 'VisibleRpt' => '0', 'CountStat' => '0', 'DisciplineID' => '10', 'DepartmentID' => '', 'ResultType' => 'NMRIC', 'RefType' => '', 'VSet' => '', 'ReqQty' => '', 'ReqQtyUnit' => '', 'Unit1' => '', 'Factor' => '', 'Unit2' => '', 'Decimal' => '3', 'Method' => '', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['SEXFAC'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'AGE', 'TestSiteName' => 'Age', 'TestType' => 'PARAM', 'Description' => 'Usia', 'SeqScr' => '30', 'SeqRpt' => '30', 'IndentLeft' => '0', 'isVisibleScr' => '1', 'isVisibleRpt' => '0', 'isCountStat' => '0', 'DisciplineID' => '10', 'DepartmentID' => '', 'ResultType' => 'NMRIC', 'RefType' => '', 'VSet' => '', 'ReqQty' => '', 'ReqQtyUnit' => '', 'Unit1' => 'years', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'Method' => '', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['AGE'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'SYSTL', 'TestSiteName' => 'Systolic BP', 'TestType' => 'PARAM', 'Description' => 'Tekanan Darah Sistolik', 'SeqScr' => '40', 'SeqRpt' => '40', 'IndentLeft' => '0', 'VisibleScr' => '1', 'VisibleRpt' => '0', 'CountStat' => '0', 'DisciplineID' => '10', 'DepartmentID' => '', 'ResultType' => 'NMRIC', 'RefType' => '', 'VSet' => '', 'ReqQty' => '', 'ReqQtyUnit' => '', 'Unit1' => 'mmHg', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'Method' => '', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['SYSTL'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'ALPHA', 'TestSiteName' => 'Alpha', 'TestType' => 'PARAM', 'Description' => 'eGFR Alpha', 'SeqScr' => '35', 'SeqRpt' => '35', 'IndentLeft' => '0', 'isVisibleScr' => '1', 'isVisibleRpt' => '0', 'isCountStat' => '0', 'DisciplineID' => '10', 'DepartmentID' => '', 'ResultType' => 'NMRIC', 'RefType' => '', 'VSet' => '', 'ReqQty' => '', 'ReqQtyUnit' => '', 'Unit1' => '', 'Factor' => '', 'Unit2' => '', 'Decimal' => '3', 'Method' => '', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['ALPHA'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'DIASTL', 'TestSiteName' => 'Diastolic BP', 'TestType' => 'PARAM', 'Description' => 'Tekanan Darah Diastolik', 'SeqScr' => '50', 'SeqRpt' => '50', 'IndentLeft' => '0', 'VisibleScr' => '1', 'VisibleRpt' => '0', 'CountStat' => '0', 'DisciplineID' => '10', 'DepartmentID' => '', 'ResultType' => 'NMRIC', 'RefType' => '', 'VSet' => '', 'ReqQty' => '', 'ReqQtyUnit' => '', 'Unit1' => 'mmHg', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'Method' => '', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'KAPPA', 'TestSiteName' => 'Kappa', 'TestType' => 'PARAM', 'Description' => 'eGFR Kappa', 'SeqScr' => '36', 'SeqRpt' => '36', 'IndentLeft' => '0', 'isVisibleScr' => '1', 'isVisibleRpt' => '0', 'isCountStat' => '0', 'DisciplineID' => '10', 'DepartmentID' => '', 'ResultType' => 'NMRIC', 'RefType' => '', 'VSet' => '', 'ReqQty' => '', 'ReqQtyUnit' => '', 'Unit1' => '', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'Method' => '', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['KAPPA'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'SEXFAC', 'TestSiteName' => 'Sex Factor', 'TestType' => 'PARAM', 'Description' => 'eGFR Sex Factor', 'SeqScr' => '37', 'SeqRpt' => '37', 'IndentLeft' => '0', 'isVisibleScr' => '1', 'isVisibleRpt' => '0', 'isCountStat' => '0', 'DisciplineID' => '10', 'DepartmentID' => '', 'ResultType' => 'NMRIC', 'RefType' => '', 'VSet' => '', 'ReqQty' => '', 'ReqQtyUnit' => '', 'Unit1' => '', 'Factor' => '', 'Unit2' => '', 'Decimal' => '3', 'Method' => '', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['SEXFAC'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'SYSTL', 'TestSiteName' => 'Systolic BP', 'TestType' => 'PARAM', 'Description' => 'Tekanan Darah Sistolik', 'SeqScr' => '40', 'SeqRpt' => '40', 'IndentLeft' => '0', 'isVisibleScr' => '1', 'isVisibleRpt' => '0', 'isCountStat' => '0', 'DisciplineID' => '10', 'DepartmentID' => '', 'ResultType' => 'NMRIC', 'RefType' => '', 'VSet' => '', 'ReqQty' => '', 'ReqQtyUnit' => '', 'Unit1' => 'mmHg', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'Method' => '', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['SYSTL'] = $this->db->insertID();
$data = ['SiteID' => '1', 'TestSiteCode' => 'DIASTL', 'TestSiteName' => 'Diastolic BP', 'TestType' => 'PARAM', 'Description' => 'Tekanan Darah Diastolik', 'SeqScr' => '50', 'SeqRpt' => '50', 'IndentLeft' => '0', 'isVisibleScr' => '1', 'isVisibleRpt' => '0', 'isCountStat' => '0', 'DisciplineID' => '10', 'DepartmentID' => '', 'ResultType' => 'NMRIC', 'RefType' => '', 'VSet' => '', 'ReqQty' => '', 'ReqQtyUnit' => '', 'Unit1' => 'mmHg', 'Factor' => '', 'Unit2' => '', 'Decimal' => '0', 'Method' => '', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['DIASTL'] = $this->db->insertID();
// TEST: (none for General)
// CALC: BMI (>= 100)
$data = ['SiteID' => '1', 'TestSiteCode' => 'BMI', 'TestSiteName' => 'Body Mass Index', 'TestType' => 'CALC', 'Description' => 'Indeks Massa Tubuh - weight/(height^2)', 'SeqScr' => '100', 'SeqRpt' => '100', 'IndentLeft' => '0', 'VisibleScr' => '1', 'VisibleRpt' => '1', 'CountStat' => '0', 'CreateDate' => "$now"];
$data = ['SiteID' => '1', 'TestSiteCode' => 'BMI', 'TestSiteName' => 'Body Mass Index', 'TestType' => 'CALC', 'Description' => 'Indeks Massa Tubuh - weight/(height^2)', 'SeqScr' => '100', 'SeqRpt' => '100', 'IndentLeft' => '0', 'isVisibleScr' => '1', 'isVisibleRpt' => '1', 'isCountStat' => '0', 'CreateDate' => "$now"];
$this->db->table('testdefsite')->insert($data);
$tIDs['BMI'] = $this->db->insertID();
$data = ['TestSiteID' => $tIDs['BMI'], 'DisciplineID' => '10', 'DepartmentID' => '', 'FormulaCode' => '{WEIGHT} / (({HEIGHT}/100) * ({HEIGHT}/100))', 'RefType' => 'RANGE', 'Unit1' => 'kg/m2', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'CreateDate' => "$now"];
$this->db->table('testdefcal')->insert($data);
$this->db->table('testdefgrp')->insertBatch([
['TestSiteID' => $tIDs['BMI'], 'Member' => $tIDs['WEIGHT'], 'CreateDate' => "$now"],
['TestSiteID' => $tIDs['BMI'], 'Member' => $tIDs['HEIGHT'], 'CreateDate' => "$now"],
['TestSiteID' => $tIDs['EGFR'], 'Member' => $tIDs['AGE'], 'CreateDate' => "$now"],
['TestSiteID' => $tIDs['EGFR'], 'Member' => $tIDs['ALPHA'], 'CreateDate' => "$now"],
['TestSiteID' => $tIDs['EGFR'], 'Member' => $tIDs['KAPPA'], 'CreateDate' => "$now"],
['TestSiteID' => $tIDs['EGFR'], 'Member' => $tIDs['SEXFAC'], 'CreateDate' => "$now"],
]);
// ========================================
// RULES: Auto-fill ALPHA/KAPPA by sex
// ========================================
$ruleExpr = new RuleExpressionService();
$ruleDefs = [
[
'RuleCode' => 'ALPHA_SEX',
'RuleName' => 'Set ALPHA from sex',
'Description' => 'Set ALPHA based on patient sex (M=-0.302, F/other=-0.241)',
'EventCode' => 'test_created',
'TestSiteID' => $tIDs['ALPHA'],
'Expr' => "if(sex('M'); set_result(-0.302); set_result(-0.241))",
],
[
'RuleCode' => 'KAPPA_SEX',
'RuleName' => 'Set KAPPA from sex',
'Description' => 'Set KAPPA based on patient sex (M=0.9, F/other=0.7)',
'EventCode' => 'test_created',
'TestSiteID' => $tIDs['KAPPA'],
'Expr' => "if(sex('M'); set_result(0.9); set_result(0.7))",
],
[
'RuleCode' => 'SEXFAC_SEX',
'RuleName' => 'Set SEXFAC from sex',
'Description' => 'Set SEXFAC based on patient sex (F=1.012, M/other=1)',
'EventCode' => 'test_created',
'TestSiteID' => $tIDs['SEXFAC'],
'Expr' => "if(sex('F'); set_result(1.012); set_result(1))",
],
];
foreach ($ruleDefs as $ruleDef) {
$compiled = $ruleExpr->compile($ruleDef['Expr']);
$data = [
'RuleCode' => $ruleDef['RuleCode'],
'RuleName' => $ruleDef['RuleName'],
'Description' => $ruleDef['Description'],
'EventCode' => $ruleDef['EventCode'],
'ConditionExpr' => $ruleDef['Expr'],
'ConditionExprCompiled' => json_encode($compiled),
'CreateDate' => $now,
'StartDate' => null,
'EndDate' => null,
];
$this->db->table('ruledef')->insert($data);
$ruleID = $this->db->insertID();
$this->db->table('testrule')->insert([
'RuleID' => $ruleID,
'TestSiteID' => $ruleDef['TestSiteID'],
'CreateDate' => $now,
]);
}
$data = ['TestSiteID' => $tIDs['BMI'], 'DisciplineID' => '10', 'DepartmentID' => '', 'FormulaCode' => '{WEIGHT} / (({HEIGHT}/100) * ({HEIGHT}/100))', 'RefType' => 'RANGE', 'Unit1' => 'kg/m2', 'Factor' => '', 'Unit2' => '', 'Decimal' => '1', 'CreateDate' => "$now"];
$this->db->table('testdefcal')->insert($data);
$this->db->table('testdefgrp')->insertBatch([
['TestSiteID' => $tIDs['BMI'], 'Member' => $tIDs['WEIGHT'], 'CreateDate' => "$now"],
['TestSiteID' => $tIDs['BMI'], 'Member' => $tIDs['HEIGHT'], 'CreateDate' => "$now"],
['TestSiteID' => $tIDs['EGFR'], 'Member' => $tIDs['AGE'], 'CreateDate' => "$now"],
['TestSiteID' => $tIDs['EGFR'], 'Member' => $tIDs['ALPHA'], 'CreateDate' => "$now"],
['TestSiteID' => $tIDs['EGFR'], 'Member' => $tIDs['KAPPA'], 'CreateDate' => "$now"],
['TestSiteID' => $tIDs['EGFR'], 'Member' => $tIDs['SEXFAC'], 'CreateDate' => "$now"],
]);
// ========================================
// RULES: Auto-fill ALPHA/KAPPA by sex
// ========================================
$ruleExpr = new RuleExpressionService();
$ruleDefs = [
[
'RuleCode' => 'ALPHA_SEX',
'RuleName' => 'Set ALPHA from sex',
'Description' => 'Set ALPHA based on patient sex (M=-0.302, F/other=-0.241)',
'EventCode' => 'test_created',
'TestSiteID' => $tIDs['ALPHA'],
'Expr' => "if(sex('M'); set_result(-0.302); set_result(-0.241))",
],
[
'RuleCode' => 'KAPPA_SEX',
'RuleName' => 'Set KAPPA from sex',
'Description' => 'Set KAPPA based on patient sex (M=0.9, F/other=0.7)',
'EventCode' => 'test_created',
'TestSiteID' => $tIDs['KAPPA'],
'Expr' => "if(sex('M'); set_result(0.9); set_result(0.7))",
],
[
'RuleCode' => 'SEXFAC_SEX',
'RuleName' => 'Set SEXFAC from sex',
'Description' => 'Set SEXFAC based on patient sex (F=1.012, M/other=1)',
'EventCode' => 'test_created',
'TestSiteID' => $tIDs['SEXFAC'],
'Expr' => "if(sex('F'); set_result(1.012); set_result(1))",
],
];
foreach ($ruleDefs as $ruleDef) {
$compiled = $ruleExpr->compile($ruleDef['Expr']);
$data = [
'RuleCode' => $ruleDef['RuleCode'],
'RuleName' => $ruleDef['RuleName'],
'Description' => $ruleDef['Description'],
'EventCode' => $ruleDef['EventCode'],
'ConditionExpr' => $ruleDef['Expr'],
'ConditionExprCompiled' => json_encode($compiled),
'CreateDate' => $now,
'StartDate' => null,
'EndDate' => null,
];
$this->db->table('ruledef')->insert($data);
$ruleID = $this->db->insertID();
$this->db->table('testrule')->insert([
'RuleID' => $ruleID,
'TestSiteID' => $ruleDef['TestSiteID'],
'CreateDate' => $now,
]);
}
// ========================================
// TEST MAP - Specimen Mapping

View File

@ -13,7 +13,7 @@ class EquipmentListModel extends BaseModel {
'InstrumentID',
'InstrumentName',
'WorkstationID',
'Enable',
'isEnable',
'EquipmentRole',
'CreateDate',
'EndDate'
@ -43,8 +43,8 @@ class EquipmentListModel extends BaseModel {
if (!empty($filter['WorkstationID'])) {
$builder->where('equipmentlist.WorkstationID', $filter['WorkstationID']);
}
if (isset($filter['Enable'])) {
$builder->where('equipmentlist.Enable', $filter['Enable']);
if (isset($filter['isEnable'])) {
$builder->where('equipmentlist.isEnable', $filter['isEnable']);
}
$rows = $builder->get()->getResultArray();

View File

@ -6,7 +6,7 @@ use App\Libraries\ValueSet;
class WorkstationModel extends BaseModel {
protected $table = 'workstation';
protected $primaryKey = 'WorkstationID';
protected $allowedFields = ['DepartmentID', 'WorkstationCode', 'WorkstationName', 'Type', 'LinkTo', 'Enable',
protected $allowedFields = ['DepartmentID', 'WorkstationCode', 'WorkstationName', 'Type', 'LinkTo', 'isEnable',
'EquipmentID', 'CreateDate', 'EndDate'];
protected $useTimestamps = true;
@ -41,7 +41,7 @@ class WorkstationModel extends BaseModel {
$row = ValueSet::transformLabels([$row], [
'Type' => 'ws_type',
'Enable' => 'enable_disable',
'isEnable' => 'enable_disable',
])[0];
return $row;

View File

@ -13,9 +13,9 @@ use App\Services\AuditService;
class PatientModel extends BaseModel {
protected $table = 'patient';
protected $primaryKey = 'InternalPID';
protected $allowedFields = ['PatientID', 'AlternatePID', 'Prefix', 'NameFirst', 'NameMiddle', 'NameMaiden', 'NameLast', 'Suffix', 'NameAlias', 'Sex', 'Birthdate', 'PlaceOfBirth', 'Street_1', 'Street_2', 'Street_3',
'City', 'Province', 'ZIP', 'EmailAddress1', 'EmailAddress2', 'Phone', 'MobilePhone', 'Custodian', 'AccountNumber', 'Country', 'Race', 'MaritalStatus', 'Religion', 'Ethnic', 'Citizenship',
'DeathIndicator', 'TimeOfDeath', 'LinkTo', 'CreateDate', 'DelDate' ];
protected $allowedFields = ['PatientID', 'AlternatePID', 'Prefix', 'NameFirst', 'NameMiddle', 'NameMaiden', 'NameLast', 'Suffix', 'NameAlias', 'Sex', 'Birthdate', 'PlaceOfBirth', 'Street_1', 'Street_2', 'Street_3',
'City', 'Province', 'ZIP', 'EmailAddress1', 'EmailAddress2', 'Phone', 'MobilePhone', 'Custodian', 'AccountNumber', 'Country', 'Race', 'MaritalStatus', 'Religion', 'Ethnic', 'Citizenship',
'isDead', 'TimeOfDeath', 'LinkTo', 'CreateDate', 'DelDate' ];
protected $useTimestamps = true;
protected $createdField = 'CreateDate';
@ -88,7 +88,7 @@ class PatientModel extends BaseModel {
'Race' => 'race',
'Religion' => 'religion',
'Ethnic' => 'ethnic',
'DeathIndicator' => 'death_indicator',
'isDead' => 'death_indicator',
'MaritalStatus' => 'marital_status',
])[0];

View File

@ -16,8 +16,8 @@ class TestDefSiteModel extends BaseModel {
'ResultType', 'RefType', 'Vset',
'Unit1', 'Factor', 'Unit2', 'Decimal',
'ReqQty', 'ReqQtyUnit', 'CollReq', 'Method', 'ExpectedTAT',
'SeqScr', 'SeqRpt', 'IndentLeft', 'FontStyle', 'VisibleScr', 'VisibleRpt',
'CountStat', 'Level', 'Requestable',
'SeqScr', 'SeqRpt', 'IndentLeft', 'FontStyle', 'isVisibleScr', 'isVisibleRpt',
'isCountStat', 'Level', 'isRequestable',
'CreateDate', 'StartDate','EndDate'
];
@ -28,9 +28,9 @@ class TestDefSiteModel extends BaseModel {
protected $deletedField = "EndDate";
public function getTests($siteId = null, $testType = null, $visibleScr = null, $visibleRpt = null, $search = null, $page = 1, $perPage = 20) {
$builder = $this->select("testdefsite.TestSiteID, testdefsite.TestSiteCode, testdefsite.TestSiteName, testdefsite.TestType,
testdefsite.SeqScr, testdefsite.SeqRpt, testdefsite.VisibleScr, testdefsite.VisibleRpt,
testdefsite.CountStat, testdefsite.StartDate, testdefsite.EndDate")
$builder = $this->select("testdefsite.TestSiteID, testdefsite.TestSiteCode, testdefsite.TestSiteName, testdefsite.TestType,
testdefsite.SeqScr, testdefsite.SeqRpt, testdefsite.isVisibleScr, testdefsite.isVisibleRpt,
testdefsite.isCountStat, testdefsite.StartDate, testdefsite.EndDate")
->where('testdefsite.EndDate IS NULL');
if ($siteId) {
@ -41,13 +41,13 @@ class TestDefSiteModel extends BaseModel {
$builder->where('testdefsite.TestType', $testType);
}
if ($visibleScr !== null) {
$builder->where('testdefsite.VisibleScr', $visibleScr);
}
if ($visibleRpt !== null) {
$builder->where('testdefsite.VisibleRpt', $visibleRpt);
}
if ($visibleScr !== null) {
$builder->where('testdefsite.isVisibleScr', $visibleScr);
}
if ($visibleRpt !== null) {
$builder->where('testdefsite.isVisibleRpt', $visibleRpt);
}
if ($search) {
$builder->groupStart()
@ -83,10 +83,10 @@ class TestDefSiteModel extends BaseModel {
*/
public function getTestsWithRelations($filters = []) {
$builder = $this->db->table('testdefsite')
->select(
"testdefsite.TestSiteID, testdefsite.TestSiteCode, testdefsite.TestSiteName, testdefsite.TestType,
testdefsite.SeqScr, testdefsite.SeqRpt, testdefsite.VisibleScr, testdefsite.VisibleRpt,
testdefsite.CountStat, testdefsite.StartDate, testdefsite.EndDate,
->select(
"testdefsite.TestSiteID, testdefsite.TestSiteCode, testdefsite.TestSiteName, testdefsite.TestType,
testdefsite.SeqScr, testdefsite.SeqRpt, testdefsite.isVisibleScr, testdefsite.isVisibleRpt,
testdefsite.isCountStat, testdefsite.StartDate, testdefsite.EndDate,
COALESCE(testdefsite.DisciplineID, cal.DisciplineID) as DisciplineID,
COALESCE(testdefsite.DepartmentID, cal.DepartmentID) as DepartmentID,
d.DisciplineName, dept.DepartmentName"
@ -104,13 +104,13 @@ class TestDefSiteModel extends BaseModel {
$builder->where('testdefsite.TestType', $filters['TestType']);
}
if (isset($filters['VisibleScr'])) {
$builder->where('testdefsite.VisibleScr', $filters['VisibleScr']);
}
if (isset($filters['VisibleRpt'])) {
$builder->where('testdefsite.VisibleRpt', $filters['VisibleRpt']);
}
if (isset($filters['isVisibleScr'])) {
$builder->where('testdefsite.isVisibleScr', $filters['isVisibleScr']);
}
if (isset($filters['isVisibleRpt'])) {
$builder->where('testdefsite.isVisibleRpt', $filters['isVisibleRpt']);
}
if (!empty($filters['TestSiteName'])) {
$builder->like('testdefsite.TestSiteName', $filters['TestSiteName']);

View File

@ -4416,7 +4416,7 @@ paths:
- GROUP
- TITLE
description: Filter by test type
- name: VisibleScr
- name: isVisibleScr
in: query
schema:
type: integer
@ -4424,7 +4424,7 @@ paths:
- 0
- 1
description: Filter by screen visibility (0=hidden, 1=visible)
- name: VisibleRpt
- name: isVisibleRpt
in: query
schema:
type: integer
@ -4472,9 +4472,9 @@ paths:
TestType: TEST
SeqScr: 11
SeqRpt: 11
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
StartDate: '2026-01-01 00:00:00'
EndDate: null
DisciplineID: 2
@ -4487,9 +4487,9 @@ paths:
TestType: TEST
SeqScr: 12
SeqRpt: 12
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
StartDate: '2026-01-01 00:00:00'
EndDate: null
DisciplineID: 2
@ -4579,11 +4579,11 @@ paths:
type: integer
FontStyle:
type: string
VisibleScr:
isVisibleScr:
type: integer
VisibleRpt:
isVisibleRpt:
type: integer
CountStat:
isCountStat:
type: integer
testdefcal:
type: object
@ -4634,9 +4634,9 @@ paths:
TestType: TEST
SeqScr: 500
SeqRpt: 500
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
DisciplineID: 2
DepartmentID: 2
Unit1: mg/dL
@ -4650,9 +4650,9 @@ paths:
TestType: PARAM
SeqScr: 10
SeqRpt: 10
VisibleScr: 1
VisibleRpt: 0
CountStat: 0
isVisibleScr: 1
isVisibleRpt: 0
isCountStat: 0
DisciplineID: 10
DepartmentID: 0
Unit1: cm
@ -4666,9 +4666,9 @@ paths:
TestType: TEST
SeqScr: 105
SeqRpt: 105
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
refnum:
- NumRefType: NMRC
RangeType: REF
@ -4695,9 +4695,9 @@ paths:
TestType: TEST
SeqScr: 110
SeqRpt: 110
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
refnum:
- NumRefType: NMRC
RangeType: REF
@ -4760,9 +4760,9 @@ paths:
TestType: TEST
SeqScr: 115
SeqRpt: 115
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
refnum:
- NumRefType: THOLD
RangeType: PANIC
@ -4787,9 +4787,9 @@ paths:
TestType: TEST
SeqScr: 120
SeqRpt: 120
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
refnum:
- NumRefType: THOLD
RangeType: PANIC
@ -4838,9 +4838,9 @@ paths:
TestType: TEST
SeqScr: 130
SeqRpt: 130
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
reftxt:
- SpcType: GEN
TxtRefType: TEXT
@ -4863,9 +4863,9 @@ paths:
TestType: TEST
SeqScr: 135
SeqRpt: 135
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
reftxt:
- SpcType: GEN
TxtRefType: TEXT
@ -4905,9 +4905,9 @@ paths:
TestType: TEST
SeqScr: 140
SeqRpt: 140
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
reftxt:
- SpcType: GEN
TxtRefType: VSET
@ -4930,9 +4930,9 @@ paths:
TestType: TEST
SeqScr: 145
SeqRpt: 145
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
reftxt:
- SpcType: GEN
TxtRefType: VSET
@ -4965,9 +4965,9 @@ paths:
TestType: TEST
SeqScr: 150
SeqRpt: 150
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
testmap:
- HostType: SITE
HostID: '1'
@ -4992,9 +4992,9 @@ paths:
TestType: CALC
SeqScr: 190
SeqRpt: 190
VisibleScr: 1
VisibleRpt: 1
CountStat: 0
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 0
DisciplineID: 2
DepartmentID: 2
testdefcal:
@ -5012,9 +5012,9 @@ paths:
TestType: CALC
SeqScr: 195
SeqRpt: 195
VisibleScr: 1
VisibleRpt: 1
CountStat: 0
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 0
refnum:
- NumRefType: NMRC
RangeType: REF
@ -5054,9 +5054,9 @@ paths:
TestType: GROUP
SeqScr: 10
SeqRpt: 10
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
testmap:
- HostType: SITE
HostID: '1'
@ -5183,11 +5183,11 @@ paths:
type: integer
FontStyle:
type: string
VisibleScr:
isVisibleScr:
type: integer
VisibleRpt:
isVisibleRpt:
type: integer
CountStat:
isCountStat:
type: integer
testdefcal:
type: object
@ -6289,12 +6289,12 @@ components:
$ref: '#/components/schemas/LinkedPatient'
Custodian:
$ref: '#/components/schemas/Custodian'
DeathIndicator:
isDead:
type: string
enum:
- 'Y'
- 'N'
description: 'Y: Yes (deceased), N: No (alive)'
- '0'
- '1'
description: '0: No (alive), 1: Yes (deceased)'
TimeOfDeath:
type: string
format: date-time
@ -6899,20 +6899,20 @@ components:
default: 0
FontStyle:
type: string
VisibleScr:
isVisibleScr:
type: integer
default: 1
description: Screen visibility (0=hidden, 1=visible)
VisibleRpt:
isVisibleRpt:
type: integer
default: 1
description: Report visibility (0=hidden, 1=visible)
CountStat:
isCountStat:
type: integer
default: 1
Level:
type: integer
Requestable:
isRequestable:
type: integer
default: 1
description: Flag indicating if test can be requested (1=yes, 0=no)
@ -7067,9 +7067,9 @@ components:
Method: Hexokinase
SeqScr: 11
SeqRpt: 11
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
refnum:
- RefNumID: 1
NumRefType: NMRC
@ -7105,9 +7105,9 @@ components:
Method: Hexokinase
SeqScr: 11
SeqRpt: 11
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
refnum:
- RefNumID: 2
NumRefType: THOLD
@ -7137,9 +7137,9 @@ components:
RefType: TEXT
SeqScr: 50
SeqRpt: 50
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
reftxt:
- RefTxtID: 1
TxtRefType: TEXT
@ -7164,9 +7164,9 @@ components:
Decimal: 0
SeqScr: 40
SeqRpt: 40
VisibleScr: 1
VisibleRpt: 0
CountStat: 0
isVisibleScr: 1
isVisibleRpt: 0
isCountStat: 0
CALC:
summary: Calculated test with reference
value:
@ -7181,9 +7181,9 @@ components:
Decimal: 0
SeqScr: 20
SeqRpt: 20
VisibleScr: 1
VisibleRpt: 1
CountStat: 0
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 0
testdefcal:
- TestCalID: 1
DisciplineID: 2
@ -7230,9 +7230,9 @@ components:
DepartmentID: 2
SeqScr: 51
SeqRpt: 51
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
testdefgrp:
- TestGrpID: 1
TestSiteID: 6
@ -7260,9 +7260,9 @@ components:
DepartmentID: 2
SeqScr: 100
SeqRpt: 100
VisibleScr: 1
VisibleRpt: 1
CountStat: 0
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 0
TestMap:
type: object
properties:
@ -8101,17 +8101,17 @@ components:
type: integer
SeqRpt:
type: integer
VisibleScr:
isVisibleScr:
type: integer
enum:
- 0
- 1
VisibleRpt:
isVisibleRpt:
type: integer
enum:
- 0
- 1
CountStat:
isCountStat:
type: integer
StartDate:
type: string

View File

@ -135,10 +135,10 @@ Patient:
$ref: 'patient.yaml#/LinkedPatient'
Custodian:
$ref: 'patient.yaml#/Custodian'
DeathIndicator:
type: string
enum: [Y, N]
description: 'Y: Yes (deceased), N: No (alive)'
isDead:
type: string
enum: ['0', '1']
description: '0: No (alive), 1: Yes (deceased)'
TimeOfDeath:
type: string
format: date-time

View File

@ -1,48 +1,48 @@
TestDefinitionListItem:
type: object
properties:
TestSiteID:
type: integer
TestSiteCode:
type: string
TestSiteName:
type: string
TestType:
type: string
enum: [TEST, PARAM, CALC, GROUP, TITLE]
SeqScr:
type: integer
SeqRpt:
type: integer
VisibleScr:
type: integer
enum: [0, 1]
VisibleRpt:
type: integer
enum: [0, 1]
CountStat:
type: integer
StartDate:
type: string
format: date-time
EndDate:
type: string
format: date-time
nullable: true
DisciplineID:
type: integer
nullable: true
DepartmentID:
type: integer
nullable: true
DisciplineName:
type: string
nullable: true
DepartmentName:
type: string
nullable: true
TestDefinition:
TestDefinitionListItem:
type: object
properties:
TestSiteID:
type: integer
TestSiteCode:
type: string
TestSiteName:
type: string
TestType:
type: string
enum: [TEST, PARAM, CALC, GROUP, TITLE]
SeqScr:
type: integer
SeqRpt:
type: integer
isVisibleScr:
type: integer
enum: [0, 1]
isVisibleRpt:
type: integer
enum: [0, 1]
isCountStat:
type: integer
StartDate:
type: string
format: date-time
EndDate:
type: string
format: date-time
nullable: true
DisciplineID:
type: integer
nullable: true
DepartmentID:
type: integer
nullable: true
DisciplineName:
type: string
nullable: true
DepartmentName:
type: string
nullable: true
TestDefinition:
type: object
properties:
TestSiteID:
@ -149,20 +149,20 @@ TestDefinition:
default: 0
FontStyle:
type: string
VisibleScr:
isVisibleScr:
type: integer
default: 1
description: Screen visibility (0=hidden, 1=visible)
VisibleRpt:
isVisibleRpt:
type: integer
default: 1
description: Report visibility (0=hidden, 1=visible)
CountStat:
isCountStat:
type: integer
default: 1
Level:
type: integer
Requestable:
isRequestable:
type: integer
default: 1
description: Flag indicating if test can be requested (1=yes, 0=no)
@ -313,9 +313,9 @@ TestDefinition:
Method: Hexokinase
SeqScr: 11
SeqRpt: 11
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
refnum:
- RefNumID: 1
NumRefType: NMRC
@ -351,9 +351,9 @@ TestDefinition:
Method: Hexokinase
SeqScr: 11
SeqRpt: 11
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
refnum:
- RefNumID: 2
NumRefType: THOLD
@ -383,9 +383,9 @@ TestDefinition:
RefType: TEXT
SeqScr: 50
SeqRpt: 50
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
reftxt:
- RefTxtID: 1
TxtRefType: TEXT
@ -410,9 +410,9 @@ TestDefinition:
Decimal: 0
SeqScr: 40
SeqRpt: 40
VisibleScr: 1
VisibleRpt: 0
CountStat: 0
isVisibleScr: 1
isVisibleRpt: 0
isCountStat: 0
CALC:
summary: Calculated test with reference
value:
@ -427,9 +427,9 @@ TestDefinition:
Decimal: 0
SeqScr: 20
SeqRpt: 20
VisibleScr: 1
VisibleRpt: 1
CountStat: 0
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 0
testdefcal:
- TestCalID: 1
DisciplineID: 2
@ -476,9 +476,9 @@ TestDefinition:
DepartmentID: 2
SeqScr: 51
SeqRpt: 51
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
testdefgrp:
- TestGrpID: 1
TestSiteID: 6
@ -506,9 +506,9 @@ TestDefinition:
DepartmentID: 2
SeqScr: 100
SeqRpt: 100
VisibleScr: 1
VisibleRpt: 1
CountStat: 0
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 0
TestMap:
type: object

View File

@ -28,13 +28,13 @@
type: string
enum: [TEST, PARAM, CALC, GROUP, TITLE]
description: Filter by test type
- name: VisibleScr
- name: isVisibleScr
in: query
schema:
type: integer
enum: [0, 1]
description: Filter by screen visibility (0=hidden, 1=visible)
- name: VisibleRpt
- name: isVisibleRpt
in: query
schema:
type: integer
@ -53,57 +53,57 @@
schema:
type: object
properties:
status:
type: string
message:
type: string
data:
type: array
items:
$ref: '../components/schemas/tests.yaml#/TestDefinitionListItem'
pagination:
type: object
properties:
total:
type: integer
description: Total number of records matching the query
examples:
list_flat:
summary: Flat list response from testdefsite
value:
status: success
message: Data fetched successfully
data:
- TestSiteID: 21
TestSiteCode: GLU
TestSiteName: Glucose
TestType: TEST
SeqScr: 11
SeqRpt: 11
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
StartDate: '2026-01-01 00:00:00'
EndDate: null
DisciplineID: 2
DepartmentID: 2
DisciplineName: Clinical Chemistry
DepartmentName: Laboratory
- TestSiteID: 22
TestSiteCode: CREA
TestSiteName: Creatinine
TestType: TEST
SeqScr: 12
SeqRpt: 12
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
StartDate: '2026-01-01 00:00:00'
EndDate: null
DisciplineID: 2
DepartmentID: 2
DisciplineName: Clinical Chemistry
DepartmentName: Laboratory
status:
type: string
message:
type: string
data:
type: array
items:
$ref: '../components/schemas/tests.yaml#/TestDefinitionListItem'
pagination:
type: object
properties:
total:
type: integer
description: Total number of records matching the query
examples:
list_flat:
summary: Flat list response from testdefsite
value:
status: success
message: Data fetched successfully
data:
- TestSiteID: 21
TestSiteCode: GLU
TestSiteName: Glucose
TestType: TEST
SeqScr: 11
SeqRpt: 11
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
StartDate: '2026-01-01 00:00:00'
EndDate: null
DisciplineID: 2
DepartmentID: 2
DisciplineName: Clinical Chemistry
DepartmentName: Laboratory
- TestSiteID: 22
TestSiteCode: CREA
TestSiteName: Creatinine
TestType: TEST
SeqScr: 12
SeqRpt: 12
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
StartDate: '2026-01-01 00:00:00'
EndDate: null
DisciplineID: 2
DepartmentID: 2
DisciplineName: Clinical Chemistry
DepartmentName: Laboratory
post:
tags: [Test]
@ -172,34 +172,34 @@
type: integer
FontStyle:
type: string
VisibleScr:
isVisibleScr:
type: integer
VisibleRpt:
isVisibleRpt:
type: integer
CountStat:
type: integer
testdefcal:
type: object
description: Calculated test metadata persisted in the `testdefcal` table.
properties:
FormulaCode:
type: string
description: Formula expression for calculated tests (e.g., "{TBIL} - {DBIL}")
testdefgrp:
type: object
description: Group member payload stored in the `testdefgrp` table.
properties:
members:
type: array
description: Array of member TestSiteIDs for CALC/GROUP definitions.
items:
type: object
properties:
TestSiteID:
type: integer
description: Foreign key referencing the member test's TestSiteID.
required:
- TestSiteID
isCountStat:
type: integer
testdefcal:
type: object
description: Calculated test metadata persisted in the `testdefcal` table.
properties:
FormulaCode:
type: string
description: Formula expression for calculated tests (e.g., "{TBIL} - {DBIL}")
testdefgrp:
type: object
description: Group member payload stored in the `testdefgrp` table.
properties:
members:
type: array
description: Array of member TestSiteIDs for CALC/GROUP definitions.
items:
type: object
properties:
TestSiteID:
type: integer
description: Foreign key referencing the member test's TestSiteID.
required:
- TestSiteID
refnum:
type: array
items:
@ -227,9 +227,9 @@
TestType: TEST
SeqScr: 500
SeqRpt: 500
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
DisciplineID: 2
DepartmentID: 2
Unit1: mg/dL
@ -243,9 +243,9 @@
TestType: PARAM
SeqScr: 10
SeqRpt: 10
VisibleScr: 1
VisibleRpt: 0
CountStat: 0
isVisibleScr: 1
isVisibleRpt: 0
isCountStat: 0
DisciplineID: 10
DepartmentID: 0
Unit1: cm
@ -259,9 +259,9 @@
TestType: TEST
SeqScr: 105
SeqRpt: 105
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
refnum:
- NumRefType: NMRC
RangeType: REF
@ -288,9 +288,9 @@
TestType: TEST
SeqScr: 110
SeqRpt: 110
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
refnum:
- NumRefType: NMRC
RangeType: REF
@ -353,9 +353,9 @@
TestType: TEST
SeqScr: 115
SeqRpt: 115
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
refnum:
- NumRefType: THOLD
RangeType: PANIC
@ -380,9 +380,9 @@
TestType: TEST
SeqScr: 120
SeqRpt: 120
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
refnum:
- NumRefType: THOLD
RangeType: PANIC
@ -431,9 +431,9 @@
TestType: TEST
SeqScr: 130
SeqRpt: 130
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
reftxt:
- SpcType: GEN
TxtRefType: TEXT
@ -456,9 +456,9 @@
TestType: TEST
SeqScr: 135
SeqRpt: 135
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
reftxt:
- SpcType: GEN
TxtRefType: TEXT
@ -498,9 +498,9 @@
TestType: TEST
SeqScr: 140
SeqRpt: 140
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
reftxt:
- SpcType: GEN
TxtRefType: VSET
@ -523,9 +523,9 @@
TestType: TEST
SeqScr: 145
SeqRpt: 145
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
reftxt:
- SpcType: GEN
TxtRefType: VSET
@ -558,9 +558,9 @@
TestType: TEST
SeqScr: 150
SeqRpt: 150
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
testmap:
- HostType: SITE
HostID: '1'
@ -585,9 +585,9 @@
TestType: CALC
SeqScr: 190
SeqRpt: 190
VisibleScr: 1
VisibleRpt: 1
CountStat: 0
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 0
DisciplineID: 2
DepartmentID: 2
testdefcal:
@ -605,9 +605,9 @@
TestType: CALC
SeqScr: 195
SeqRpt: 195
VisibleScr: 1
VisibleRpt: 1
CountStat: 0
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 0
refnum:
- NumRefType: NMRC
RangeType: REF
@ -647,9 +647,9 @@
TestType: GROUP
SeqScr: 10
SeqRpt: 10
VisibleScr: 1
VisibleRpt: 1
CountStat: 1
isVisibleScr: 1
isVisibleRpt: 1
isCountStat: 1
testmap:
- HostType: SITE
HostID: '1'
@ -762,34 +762,34 @@
type: integer
FontStyle:
type: string
VisibleScr:
isVisibleScr:
type: integer
VisibleRpt:
isVisibleRpt:
type: integer
CountStat:
type: integer
testdefcal:
type: object
description: Calculated test metadata persisted in the `testdefcal` table.
properties:
FormulaCode:
type: string
description: Formula expression for calculated tests (e.g., "{TBIL} - {DBIL}")
testdefgrp:
type: object
description: Group member payload stored in the `testdefgrp` table.
properties:
members:
type: array
description: Array of member TestSiteIDs for CALC/GROUP definitions.
items:
type: object
properties:
TestSiteID:
type: integer
description: Foreign key referencing the member test's TestSiteID.
required:
- TestSiteID
isCountStat:
type: integer
testdefcal:
type: object
description: Calculated test metadata persisted in the `testdefcal` table.
properties:
FormulaCode:
type: string
description: Formula expression for calculated tests (e.g., "{TBIL} - {DBIL}")
testdefgrp:
type: object
description: Group member payload stored in the `testdefgrp` table.
properties:
members:
type: array
description: Array of member TestSiteIDs for CALC/GROUP definitions.
items:
type: object
properties:
TestSiteID:
type: integer
description: Foreign key referencing the member test's TestSiteID.
required:
- TestSiteID
refnum:
type: array
items:

View File

@ -34,7 +34,7 @@ trait CreatesPatients
'Religion' => (string) $faker->numberBetween(206, 212),
'Ethnic' => (string) $faker->numberBetween(213, 220),
'Citizenship' => 'WNI',
'DeathIndicator' => (string) $faker->numberBetween(16, 17),
'isDead' => (string) $faker->numberBetween(0, 1),
'PatIdt' => [
'IdentifierType' => 'ID',
'Identifier' => $faker->numerify('################')
@ -45,7 +45,7 @@ trait CreatesPatients
'PatCom' => $faker->sentence,
], $overrides);
if ($patientPayload['DeathIndicator'] === '16') {
if ($patientPayload['isDead'] === '1') {
$patientPayload['DeathDateTime'] = $faker->date('Y-m-d H:i:s');
} else {
$patientPayload['DeathDateTime'] = null;

View File

@ -6,15 +6,15 @@ use CodeIgniter\Test\FeatureTestTrait;
use CodeIgniter\Test\CIUnitTestCase;
use Faker\Factory;
class PatientCreateTest extends CIUnitTestCase
{
use FeatureTestTrait;
protected $endpoint = 'api/patient';
class PatientCreateTest extends CIUnitTestCase
{
use FeatureTestTrait;
protected $endpoint = 'api/patient';
protected function setUp(): void
{
parent::setUp();
}
}
// 400 - Passed
// Validation Gagal - Array Tidak Complete
@ -81,7 +81,7 @@ class PatientCreateTest extends CIUnitTestCase
"Religion" => (string) $faker->numberBetween(206, 212),
"Ethnic" => (string) $faker->numberBetween(213, 220),
"Citizenship" => "WNI",
"DeathIndicator" => (string) $faker->numberBetween(16, 17),
"isDead" => (string) $faker->numberBetween(0, 1),
"LinkTo" => (string) $faker->numberBetween(2, 3),
"Custodian" => $i-1,
"PatIdt" => [
@ -93,7 +93,7 @@ class PatientCreateTest extends CIUnitTestCase
],
"PatCom" => $faker->sentence,
];
if($payload['DeathIndicator'] == '16') {
if($payload['isDead'] == '1') {
$payload['DeathDateTime'] = $faker->date('Y-m-d H:i:s');
} else {
$payload['DeathDateTime'] = null;
@ -142,7 +142,7 @@ class PatientCreateTest extends CIUnitTestCase
"Religion" => (string) $faker->numberBetween(206, 212),
"Ethnic" => (string) $faker->numberBetween(213, 220),
"Citizenship" => "WNI",
"DeathIndicator" => (string) $faker->numberBetween(16, 17),
"isDead" => (string) $faker->numberBetween(0, 1),
"LinkTo" => (string) $faker->numberBetween(2, 3),
"Custodian" => 1,
"PatIdt" => [
@ -156,7 +156,7 @@ class PatientCreateTest extends CIUnitTestCase
"PatCom" => $faker->sentence,
];
if($payload['DeathIndicator'] == '16') {
if($payload['isDead'] == '1') {
$payload['DeathDateTime'] = $faker->date('Y-m-d H:i:s');
} else {
$payload['DeathDateTime'] = null;
@ -201,7 +201,7 @@ class PatientCreateTest extends CIUnitTestCase
"Religion" => (string) $faker->numberBetween(206, 212),
"Ethnic" => (string) $faker->numberBetween(213, 220),
"Citizenship" => "WNI",
"DeathIndicator" => (string) $faker->numberBetween(16, 17),
"isDead" => (string) $faker->numberBetween(0, 1),
"LinkTo" => (string) $faker->numberBetween(2, 3),
"Custodian" => 1,
"PatIdt" => [
@ -212,7 +212,7 @@ class PatientCreateTest extends CIUnitTestCase
"PatCom" => $faker->sentence,
];
if($payload['DeathIndicator'] == '16') {
if($payload['isDead'] == '1') {
$payload['DeathDateTime'] = $faker->date('Y-m-d H:i:s');
} else {
$payload['DeathDateTime'] = null;
@ -257,7 +257,7 @@ class PatientCreateTest extends CIUnitTestCase
"Religion" => (string) $faker->numberBetween(206, 212),
"Ethnic" => (string) $faker->numberBetween(213, 220),
"Citizenship" => "WNI",
"DeathIndicator" => (string) $faker->numberBetween(16, 17),
"isDead" => (string) $faker->numberBetween(0, 1),
"LinkTo" => (string) $faker->numberBetween(2, 3),
"Custodian" => 1,
"PatIdt" => [
@ -272,7 +272,7 @@ class PatientCreateTest extends CIUnitTestCase
"PatCom" => null,
];
if($payload['DeathIndicator'] == '16') {
if($payload['isDead'] == '1') {
$payload['DeathDateTime'] = $faker->date('Y-m-d H:i:s');
} else {
$payload['DeathDateTime'] = null;
@ -317,7 +317,7 @@ class PatientCreateTest extends CIUnitTestCase
"Religion" => (string) $faker->numberBetween(206, 212),
"Ethnic" => (string) $faker->numberBetween(213, 220),
"Citizenship" => "WNI",
"DeathIndicator" => (string) $faker->numberBetween(16, 17),
"isDead" => (string) $faker->numberBetween(0, 1),
"LinkTo" => (string) $faker->numberBetween(2, 3),
"Custodian" => 1,
"PatIdt" => [
@ -332,7 +332,7 @@ class PatientCreateTest extends CIUnitTestCase
"PatCom" => [],
];
if($payload['DeathIndicator'] == '16') {
if($payload['isDead'] == '1') {
$payload['DeathDateTime'] = $faker->date('Y-m-d H:i:s');
} else {
$payload['DeathDateTime'] = null;

View File

@ -6,23 +6,23 @@ use CodeIgniter\Test\FeatureTestTrait;
use CodeIgniter\Test\CIUnitTestCase;
use Faker\Factory;
class PatientUpdateTest extends CIUnitTestCase
{
use FeatureTestTrait;
protected $endpoint = 'api/patient';
class PatientUpdateTest extends CIUnitTestCase
{
use FeatureTestTrait;
protected $endpoint = 'api/patient';
protected function setUp(): void
{
parent::setUp();
}
}
/**
* 400 - Validation Fail
* Coba update tanpa field wajib harus gagal validasi.
*/
public function testUpdatePatientValidationFail()
{
$payload = [ 'InternalPID' => null, 'NameFirst' => '' ]; // Tidak valid
$result = $this->withBodyFormat('json')->call('patch', $this->endpoint . '/1', $payload);
$payload = [ 'InternalPID' => null, 'NameFirst' => '' ]; // Tidak valid
$result = $this->withBodyFormat('json')->call('patch', $this->endpoint . '/1', $payload);
$result->assertStatus(400);
$json = $result->getJSON();
@ -38,12 +38,12 @@ class PatientUpdateTest extends CIUnitTestCase
{
$faker = Factory::create('id_ID');
$payload = [
"PatientID" => "SMAJ1",
"EmailAddress1" => 'asaas7890@gmail.com',
"Phone" => $faker->numerify('08##########'),
"MobilePhone" => $faker->numerify('08##########'),
'NameFirst' => $faker->firstName,
$payload = [
"PatientID" => "SMAJ1",
"EmailAddress1" => 'asaas7890@gmail.com',
"Phone" => $faker->numerify('08##########'),
"MobilePhone" => $faker->numerify('08##########'),
'NameFirst' => $faker->firstName,
'NameLast' => $faker->lastName,
'Sex' => '1',
'Birthdate' => $faker->date('Y-m-d'),
@ -54,7 +54,7 @@ class PatientUpdateTest extends CIUnitTestCase
],
];
$result = $this->withBodyFormat('json')->call('patch', $this->endpoint . '/999999', $payload);
$result = $this->withBodyFormat('json')->call('patch', $this->endpoint . '/999999', $payload);
$result->assertStatus(201); // Update returns success even if no rows found (depending on logic)
}
@ -69,11 +69,11 @@ class PatientUpdateTest extends CIUnitTestCase
// NOTE: Sebaiknya ambil InternalPID yang sudah ada (mock atau dari DB fixture)
// Untuk contoh ini kita asumsikan ada ID 1
$payload = [
"PatientID" => "SMAJ1",
'NameFirst' => $faker->firstName,
'NameMiddle' => $faker->firstName,
'NameLast' => $faker->lastName,
$payload = [
"PatientID" => "SMAJ1",
'NameFirst' => $faker->firstName,
'NameMiddle' => $faker->firstName,
'NameLast' => $faker->lastName,
'Sex' => '1',
'Birthdate' => $faker->date('Y-m-d'),
'EmailAddress1' => 'update_' . $faker->numberBetween(1,999) . '@gmail.com',
@ -86,19 +86,19 @@ class PatientUpdateTest extends CIUnitTestCase
'IdentifierType' => 'KTP',
'Identifier' => $faker->nik(),
],
"DeathIndicator" => (string) $faker->numberBetween(16, 17),
"isDead" => (string) $faker->numberBetween(0, 1),
'PatCom' => 'Update be',
'PatAtt' => [
[ 'Address' => '/api/upload/' . $faker->uuid . '.jpg' ],
],
];
if($payload['DeathIndicator'] == '16') {
if($payload['isDead'] == '1') {
$payload['DeathDateTime'] = $faker->date('Y-m-d H:i:s');
} else {
$payload['DeathDateTime'] = null;
}
$result = $this->withBodyFormat('json')->call('patch', $this->endpoint . '/1', $payload);
$result = $this->withBodyFormat('json')->call('patch', $this->endpoint . '/1', $payload);
$result->assertStatus(201);
$json = $result->getJSON();
$data = json_decode($json, true);
@ -112,11 +112,11 @@ class PatientUpdateTest extends CIUnitTestCase
{
$faker = Factory::create('id_ID');
$payload = [
"PatientID" => "SMAJ1",
'NameFirst' => $faker->firstName,
'NameMiddle' => $faker->firstName,
'NameLast' => $faker->lastName,
$payload = [
"PatientID" => "SMAJ1",
'NameFirst' => $faker->firstName,
'NameMiddle' => $faker->firstName,
'NameLast' => $faker->lastName,
'Sex' => '1',
'Birthdate' => $faker->date('Y-m-d'),
'EmailAddress1' => 'update_' . $faker->numberBetween(1,999) . '@gmail.com',
@ -128,19 +128,19 @@ class PatientUpdateTest extends CIUnitTestCase
'IdentifierType' => 'KTP',
'Identifier' => $faker->nik(),
],
"DeathIndicator" => (string) $faker->numberBetween(16, 17),
"isDead" => (string) $faker->numberBetween(0, 1),
'PatCom' => null,
'PatAtt' => [
[ 'Address' => '/api/upload/' . $faker->uuid . '.jpg' ],
],
];
if($payload['DeathIndicator'] == '16') {
if($payload['isDead'] == '1') {
$payload['DeathDateTime'] = $faker->date('Y-m-d H:i:s');
} else {
$payload['DeathDateTime'] = null;
}
$result = $this->withBodyFormat('json')->call('patch', $this->endpoint . '/1', $payload);
$result = $this->withBodyFormat('json')->call('patch', $this->endpoint . '/1', $payload);
$result->assertStatus(201);
}
@ -151,11 +151,11 @@ class PatientUpdateTest extends CIUnitTestCase
{
$faker = Factory::create('id_ID');
$payload = [
"PatientID" => "SMAJ1",
'NameFirst' => $faker->firstName,
'NameMiddle' => $faker->firstName,
'NameLast' => $faker->lastName,
$payload = [
"PatientID" => "SMAJ1",
'NameFirst' => $faker->firstName,
'NameMiddle' => $faker->firstName,
'NameLast' => $faker->lastName,
'Sex' => '1',
'Birthdate' => $faker->date('Y-m-d'),
'EmailAddress1' => 'update_' . $faker->numberBetween(1,999) . '@gmail.com',
@ -167,17 +167,17 @@ class PatientUpdateTest extends CIUnitTestCase
'IdentifierType' => 'KTP',
'Identifier' => $faker->nik(),
],
"DeathIndicator" => (string) $faker->numberBetween(16, 17),
"isDead" => (string) $faker->numberBetween(0, 1),
'PatCom' => null,
'PatAtt' => [],
];
if($payload['DeathIndicator'] == '16') {
if($payload['isDead'] == '1') {
$payload['DeathDateTime'] = $faker->date('Y-m-d H:i:s');
} else {
$payload['DeathDateTime'] = null;
}
$result = $this->withBodyFormat('json')->call('patch', $this->endpoint . '/1', $payload);
$result = $this->withBodyFormat('json')->call('patch', $this->endpoint . '/1', $payload);
$result->assertStatus(201);
}
@ -188,11 +188,11 @@ class PatientUpdateTest extends CIUnitTestCase
{
$faker = Factory::create('id_ID');
$payload = [
"PatientID" => "SMAJ1",
'NameFirst' => $faker->firstName,
'NameMiddle' => $faker->firstName,
'NameLast' => $faker->lastName,
$payload = [
"PatientID" => "SMAJ1",
'NameFirst' => $faker->firstName,
'NameMiddle' => $faker->firstName,
'NameLast' => $faker->lastName,
'Sex' => '1',
'Birthdate' => $faker->date('Y-m-d'),
'EmailAddress1' => 'update_' . $faker->numberBetween(1,999) . '@gmail.com',
@ -204,19 +204,19 @@ class PatientUpdateTest extends CIUnitTestCase
'IdentifierType' => 'KTP',
'Identifier' => $faker->nik(),
],
"DeathIndicator" => (string) $faker->numberBetween(16, 17),
"isDead" => (string) $faker->numberBetween(0, 1),
'PatCom' => null,
'PatAtt' => [
[ 'Address' => '/api/upload/' . $faker->uuid . '.jpg' ],
],
];
if($payload['DeathIndicator'] == '16') {
if($payload['isDead'] == '1') {
$payload['DeathDateTime'] = $faker->date('Y-m-d H:i:s');
} else {
$payload['DeathDateTime'] = null;
}
$result = $this->withBodyFormat('json')->call('patch', $this->endpoint . '/1', $payload);
$result = $this->withBodyFormat('json')->call('patch', $this->endpoint . '/1', $payload);
$result->assertStatus(201);
}
@ -227,11 +227,11 @@ class PatientUpdateTest extends CIUnitTestCase
{
$faker = Factory::create('id_ID');
$payload = [
"PatientID" => "SMAJ1",
'NameFirst' => $faker->firstName,
'NameMiddle' => $faker->firstName,
'NameLast' => $faker->lastName,
$payload = [
"PatientID" => "SMAJ1",
'NameFirst' => $faker->firstName,
'NameMiddle' => $faker->firstName,
'NameLast' => $faker->lastName,
'Sex' => '1',
'Birthdate' => $faker->date('Y-m-d'),
'EmailAddress1' => 'update_' . $faker->numberBetween(1,999) . '@gmail.com',
@ -243,19 +243,19 @@ class PatientUpdateTest extends CIUnitTestCase
'IdentifierType' => [],
'Identifier' => $faker->nik(),
],
"DeathIndicator" => (string) $faker->numberBetween(16, 17),
"isDead" => (string) $faker->numberBetween(0, 1),
'PatCom' => null,
'PatAtt' => [
[ 'Address' => '/api/upload/' . $faker->uuid . '.jpg' ],
],
];
if($payload['DeathIndicator'] == '16') {
if($payload['isDead'] == '1') {
$payload['DeathDateTime'] = $faker->date('Y-m-d H:i:s');
} else {
$payload['DeathDateTime'] = null;
}
$result = $this->withBodyFormat('json')->call('patch', $this->endpoint . '/1', $payload);
$result = $this->withBodyFormat('json')->call('patch', $this->endpoint . '/1', $payload);
$result->assertStatus(500);
$json = $result->getJSON();

View File

@ -234,9 +234,9 @@ class TestCreateVariantsTest extends CIUnitTestCase
'TestType' => $testType,
'SeqScr' => 900,
'SeqRpt' => 900,
'VisibleScr' => 1,
'VisibleRpt' => 1,
'CountStat' => 1,
'isVisibleScr' => 1,
'isVisibleRpt' => 1,
'isCountStat' => 1,
];
$payload['details'] = $this->normalizeDetails($details);
@ -253,9 +253,9 @@ class TestCreateVariantsTest extends CIUnitTestCase
'TestType' => 'CALC',
'SeqScr' => 1000,
'SeqRpt' => 1000,
'VisibleScr' => 1,
'VisibleRpt' => 1,
'CountStat' => 0,
'isVisibleScr' => 1,
'isVisibleRpt' => 1,
'isCountStat' => 0,
'details' => [
'DisciplineID' => 2,
'DepartmentID' => 2,
@ -276,9 +276,9 @@ class TestCreateVariantsTest extends CIUnitTestCase
'TestType' => 'GROUP',
'SeqScr' => 300,
'SeqRpt' => 300,
'VisibleScr' => 1,
'VisibleRpt' => 1,
'CountStat' => 1,
'isVisibleScr' => 1,
'isVisibleRpt' => 1,
'isCountStat' => 1,
'details' => [
'members' => array_map(fn ($id) => ['TestSiteID' => $id], $members),
],

View File

@ -197,20 +197,20 @@ class PatientModelTest extends CIUnitTestCase
$this->assertContains('MaritalStatus', $allowedFields);
}
/**
* Test Case 13: Model allowed fields contain death indicator
*/
public function testModelHasDeathIndicatorField()
{
$reflection = new \ReflectionClass($this->model);
$property = $reflection->getProperty('allowedFields');
$property->setAccessible(true);
$allowedFields = $property->getValue($this->model);
$this->assertContains('DeathIndicator', $allowedFields);
$this->assertContains('TimeOfDeath', $allowedFields);
}
/**
* Test Case 13: Model allowed fields contain death indicator
*/
public function testModelHasIsDeadField()
{
$reflection = new \ReflectionClass($this->model);
$property = $reflection->getProperty('allowedFields');
$property->setAccessible(true);
$allowedFields = $property->getValue($this->model);
$this->assertContains('isDead', $allowedFields);
$this->assertContains('TimeOfDeath', $allowedFields);
}
/**
* Test Case 14: Model has getPatients method