fix areageo

This commit is contained in:
mahdahar 2025-12-02 12:52:23 +07:00
parent d5fd300b6a
commit d4f5e8b16a
12 changed files with 850 additions and 767 deletions

View File

@ -16,7 +16,11 @@ class AreaGeo extends BaseController {
public function index() {
try {
$rows = $this->model->getAreaGeos();
$filters = [
'AreaGeoID' => $this->request->getVar('AreaGeoID') ?? null,
'AreaName' => $this->request->getVar('AreaName') ?? null
];
$rows = $this->model->getAreaGeos( $filters );
if(empty($rows)){return $this->respond(['status'=>'success', 'message'=>"no data found.", 'data'=>$rows], 200);}
return $this->respond(['status'=>'success', 'message'=>"data fetched successfully", 'data'=>$rows], 200);
@ -27,23 +31,13 @@ class AreaGeo extends BaseController {
}
public function getProvinces() {
$filters = [
'AreaGeoID' => $this->request->getVar('AreaGeoID') ?? null,
'AreaName' => $this->request->getVar('AreaName') ?? null
];
$rows = $this->model->getProvinces();
if (empty($rows)) { return $this->respond([ 'status' => 'success', 'message' => "data not found", 'data' => [] ], 200); }
return $this->respond([ 'status' => 'success', 'message'=> "Data fetched successfully", 'data' => $rows ], 200);
if (empty($rows)) { return $this->respond([ 'status' => 'success', 'message' => "data not found", 'data' => '' ], 200); }
return $this->respond([ 'status' => 'success', 'message'=> "Data fetched successfully", 'data' => [ $rows ] ], 200);
}
public function getCities() {
$filter = [
'AreaGeoID' => $this->request->getVar('AreaGeoID') ?? null
];
$rows = $this->model->getCities($filter);
$rows = $this->model->getCities();
if (empty($rows)) { return $this->respond([ 'status' => 'success', 'message' => "data not found", 'data' => [] ], 200); }
return $this->respond([ 'status' => 'success', 'message'=> "Data fetched successfully", 'data' => $rows ], 200);

View File

@ -14,7 +14,7 @@ class CreateLocationTable extends Migration {
'Parent' => ['type' => 'INT', 'null' => true],
'LocFull' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
'Description' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
'LocType' => ['type' => 'varchar', 'constraint' => 11, 'null' => true],
'LocType' => ['type' => 'int', 'null' => true],
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
'EndDate' => ['type' => 'DATETIME', 'null' => true]
]);

View File

@ -57,14 +57,13 @@ class CreateContactTable extends Migration {
$this->forge->createTable('occupation');
$this->forge->addField([
'SpecialtyID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
'SpecialtyText' => ['type' => 'varchar', 'constraint' => 20, 'null' => true],
'SpecialtyID' => ['type' => 'INT', 'unsigned' => true, 'auto_increment' => true],
'SpecialtyText' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
'Parent' => ['type' => 'int', 'null' => true],
'Title' => ['type' => 'VARCHAR', 'constraint' => 100, 'null' => false],
'CreateDate' => ['type' => 'datetime', 'null' => true],
'EndDate' => ['type' => 'datetime', 'null' => true],
]);
$this->forge->addKey('SpecialtyID', true);
$this->forge->createTable('medicalspecialty');
}

View File

@ -0,0 +1,119 @@
<?php
namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder;
use App\Models\ValueSet\ValueSetModel;
class ContactSeeder extends Seeder {
public function run() {
$now = date('Y-m-d H:i:s');
$vsModel = new ValueSetModel();
$rows = $vsModel->select("VID, VSetID, VValue")->findAll();
$vs = [];
foreach ($rows as $row) {
$vs[$row['VSetID']][$row['VValue']] = $row['VID'];
}
// contact
$data = [
['ContactID'=>1, 'NameFirst'=>'Default', 'NameLast'=>'Doctor', 'Title'=>'', 'Initial'=>'DEFDOC',
'Birthdate'=>'', 'EmailAddress1'=>'', 'EmailAddress2'=>'', 'Phone'=>'', 'MobilePhone1'=>'', 'MobilePhone2'=>'', 'Specialty'=>'', 'SubSpecialty'=>'', 'CreateDate'=> "$now" ],
['ContactID'=>2, 'NameFirst'=>'Dummy', 'NameLast'=>'Doctor', 'Title'=>'', 'Initial'=>'QDOC',
'Birthdate'=>'', 'EmailAddress1'=>'', 'EmailAddress2'=>'', 'Phone'=>'', 'MobilePhone1'=>'', 'MobilePhone2'=>'', 'Specialty'=>'', 'SubSpecialty'=>'', 'CreateDate'=> "$now" ]
];
$this->db->table('contact')->insertBatch($data);
$data = [
['SiteID'=>1,'ContactID'=>1, 'ContactCode'=>'DEFDOC', 'ContactEmail'=>'defdoc@email.com', 'OccupationID'=>'', 'JobTitle'=>'', 'Department'=>'Jantung Sehat' ],
['SiteID'=>2,'ContactID'=>1, 'ContactCode'=>'QDOC', 'ContactEmail'=>'qdoc@email.com', 'OccupationID'=>'', 'JobTitle'=>'', 'Department'=>'Hati Sehat' ],
['SiteID'=>1,'ContactID'=>2, 'ContactCode'=>'S923', 'ContactEmail'=>'defdoc@email.com', 'OccupationID'=>'', 'JobTitle'=>'', 'Department'=>'Jantung Sehat' ],
['SiteID'=>2,'ContactID'=>2, 'ContactCode'=>'B231', 'ContactEmail'=>'defdoc@email.com', 'OccupationID'=>'', 'JobTitle'=>'', 'Department'=>'Ginjal Sehat' ],
['SiteID'=>3,'ContactID'=>2, 'ContactCode'=>'C342', 'ContactEmail'=>'qdoc@email.com', 'OccupationID'=>'', 'JobTitle'=>'', 'Department'=>'Hati Sehat' ]
];
$this->db->table('contactdetail')->insertBatch($data);
$data = [
['OccupationID'=>1, 'OccCode'=>'OC001', 'OccText'=>'Medical Doctor', 'Description'=>'Diagnoses and treats, injuries and illnesses', 'CreateDate'=> "$now" ],
['OccupationID'=>2, 'OccCode'=>'OC002', 'OccText'=>'Trainee Medical Technician', 'Description'=>'Performing basic laboratory task', 'CreateDate'=> "$now" ],
['OccupationID'=>3, 'OccCode'=>'OC003', 'OccText'=>'Medical Laboratory Technician', 'Description'=>'Perform routine laboratory tests', 'CreateDate'=> "$now" ]
];
$this->db->table('occupation')->insertBatch($data);
$data = [
['SpecialtyID' => '1','SpecialtyText' => 'Anak','Parent' => '','Title' => 'Sp. A', 'CreateDate' => "$now"],
['SpecialtyID' => '2','SpecialtyText' => 'Andrologi','Parent' => '','Title' => 'Sp. And', 'CreateDate' => "$now"],
['SpecialtyID' => '3','SpecialtyText' => 'Anestesiologi dan Terapi Intensif','Parent' => '','Title' => 'Sp.An-TI', 'CreateDate' => "$now"],
['SpecialtyID' => '4','SpecialtyText' => 'Akupunktur Medik','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '5','SpecialtyText' => 'Bedah','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '6','SpecialtyText' => 'Bedah Anak','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '7','SpecialtyText' => 'Bedah Plastik, Rekonstruksi, dan Estetik','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '8','SpecialtyText' => 'Bedah Saraf','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '9','SpecialtyText' => 'Bedah Toraks, Kardiak, dan Vaskular','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '10','SpecialtyText' => 'Dermatologi Venereologi Estetika','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '11','SpecialtyText' => 'Emergency Medicine (Kegawatdaruratan Medik)','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '12','SpecialtyText' => 'Farmakologi Klinik','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '13','SpecialtyText' => 'Forensik dan Medikolegal','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '14','SpecialtyText' => 'Gizi Klinik','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '15','SpecialtyText' => 'Jantung dan Pembuluh Darah','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '16','SpecialtyText' => 'Kedokteran Fisik dan Rehabilitasi','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '17','SpecialtyText' => 'Kedokteran Jiwa','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '18','SpecialtyText' => 'Kedokteran Kelautan','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '19','SpecialtyText' => 'Kedokteran Keluarga Layanan Primer','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '20','SpecialtyText' => 'Kedokteran Nuklir dan Teranostik Molekuler','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '21','SpecialtyText' => 'Kedokteran Okupasi','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '22','SpecialtyText' => 'Kedokteran Olahraga','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '23','SpecialtyText' => 'Kedokteran Penerbangan','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '24','SpecialtyText' => 'Mikrobiologi Klinik','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '25','SpecialtyText' => 'Neurologi','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '26','SpecialtyText' => 'Obstetri dan Ginekologi','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '27','SpecialtyText' => 'Oftalmologi','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '28','SpecialtyText' => 'Onkologi Radiasi','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '29','SpecialtyText' => 'Orthopaedi dan Traumatologi','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '30','SpecialtyText' => 'Parasitologi Klinik','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '31','SpecialtyText' => 'Patologi Anatomi','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '32','SpecialtyText' => 'Patologi Klinik','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '33','SpecialtyText' => 'Penyakit Dalam','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '34','SpecialtyText' => 'Pulmonologi dan Kedokteran Respirasi','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '35','SpecialtyText' => 'Radiologi','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '36','SpecialtyText' => 'Telinga Hidung Tenggorok Bedah Kepala Leher','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '37','SpecialtyText' => 'Urologi','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '38','SpecialtyText' => 'Bedah Mulut dan Maksilofasial','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '39','SpecialtyText' => 'Kedokteran Gigi Anak','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '40','SpecialtyText' => 'Konservasi Gigi','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '41','SpecialtyText' => 'Odontologi Forensik','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '42','SpecialtyText' => 'Ortodonsia','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '43','SpecialtyText' => 'Patologi Mulut dan Maksilofasial','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '44','SpecialtyText' => 'Penyakit Mulut','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '45','SpecialtyText' => 'Periodonsia','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '46','SpecialtyText' => 'Prostodonsia','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '47','SpecialtyText' => 'Radiologi Kedokteran Gigi','Parent' => '','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '48','SpecialtyText' => 'Alergi-Immunologi Klinik','Parent' => '33','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '49','SpecialtyText' => 'Gastroenterologi-Hepatologi','Parent' => '33','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '50','SpecialtyText' => 'Geriatri','Parent' => '33','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '51','SpecialtyText' => 'Ginjal-Hipertensi','Parent' => '33','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '52','SpecialtyText' => 'Hematologi-Onkologi Medik','Parent' => '33','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '53','SpecialtyText' => 'Kardiovaskular','Parent' => '33','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '54','SpecialtyText' => 'Endokrin-Metabolik-Diabetes','Parent' => '33','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '55','SpecialtyText' => 'Psikosomatik dan Paliatif Medik','Parent' => '33','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '56','SpecialtyText' => 'Pulmonologi dan Medik Kritis','Parent' => '33','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '57','SpecialtyText' => 'Reumatologi','Parent' => '33','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '58','SpecialtyText' => 'Penyakit Tropik-Infeksi','Parent' => '33','Title' => '', 'CreateDate' => "$now"],
['SpecialtyID' => '59','SpecialtyText' => 'Alergi Imunologi','Parent' => '1','Title' => 'Subsp.AI', 'CreateDate' => "$now"],
['SpecialtyID' => '60','SpecialtyText' => 'Endokrinologi','Parent' => '1','Title' => 'Subsp.End', 'CreateDate' => "$now"],
['SpecialtyID' => '61','SpecialtyText' => 'Gastro-Hepatologi','Parent' => '1','Title' => 'Subsp.GH', 'CreateDate' => "$now"],
['SpecialtyID' => '62','SpecialtyText' => 'Hematologi Onkologi','Parent' => '1','Title' => 'Subsp.HO', 'CreateDate' => "$now"],
['SpecialtyID' => '63','SpecialtyText' => 'Infeksi dan Pediatri Tropis','Parent' => '1','Title' => 'Subsp.IPT', 'CreateDate' => "$now"],
['SpecialtyID' => '64','SpecialtyText' => 'Kardiologi','Parent' => '1','Title' => 'Subsp.Kardio', 'CreateDate' => "$now"],
['SpecialtyID' => '65','SpecialtyText' => 'Nefrologi','Parent' => '1','Title' => 'Subsp.Nefro', 'CreateDate' => "$now"],
['SpecialtyID' => '66','SpecialtyText' => 'Neurologi','Parent' => '1','Title' => 'Subsp.Neuro', 'CreateDate' => "$now"],
['SpecialtyID' => '67','SpecialtyText' => 'Nutrisi dan Penyakit Metabolik','Parent' => '1','Title' => 'Subsp.NPM', 'CreateDate' => "$now"],
['SpecialtyID' => '68','SpecialtyText' => 'Emergensi dan Rawat Intensif Anak','Parent' => '1','Title' => 'Subsp.ERIA', 'CreateDate' => "$now"],
['SpecialtyID' => '69','SpecialtyText' => 'Pencitraan','Parent' => '1','Title' => 'Subsp.PCT', 'CreateDate' => "$now"],
['SpecialtyID' => '70','SpecialtyText' => 'Neonatologi','Parent' => '1','Title' => 'Subsp.Neo', 'CreateDate' => "$now"],
['SpecialtyID' => '71','SpecialtyText' => 'Respirologi','Parent' => '1','Title' => 'Subsp.Resp', 'CreateDate' => "$now"],
['SpecialtyID' => '72','SpecialtyText' => 'Tumbuh Kembang Pediatri Sosial','Parent' => '1','Title' => 'Subsp.TKPS', 'CreateDate' => "$now"],
];
$this->db->table('medicalspecialty')->insertBatch($data);
}
}

View File

@ -8,8 +8,12 @@ class DBSeeder extends Seeder {
public function run() {
$this->call('ValueSetSeeder');
$this->call('ValueSetCountrySeeder');
$this->call('OrganizationSeeder');
$this->call('CounterSeeder');
$this->call('ContactSeeder');
$this->call('LocationSeeder');
$this->call('SpecimenSeeder');
$this->call('TestSeeder');
$this->call('DummySeeder');
$this->call('DummyTestSeeder');
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,34 @@
<?php
namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder;
use App\Models\ValueSet\ValueSetModel;
class LocationSeeder extends Seeder {
protected array $map = [];
public function run() {
$now = date('Y-m-d H:i:s');
$vsModel = new ValueSetModel();
$rows = $vsModel->select("VID, VSetID, VValue")->findAll();
$vs = [];
foreach ($rows as $row) {
$vs[$row['VSetID']][$row['VValue']] = $row['VID'];
}
// location
$data = [
['LocationID'=>1, 'LocCode'=>'QLOC', 'LocFull'=>'Dummy Location', 'LocType'=>$vs[12]['ROOM'], 'Description'=>'Location made for dummy testing', 'CreateDate'=> "$now" ],
['LocationID'=>2, 'LocCode'=>'DEFLOC', 'LocFull'=>'Default Location', 'LocType'=>$vs[12]['ROOM'], 'Description'=>'Default location', 'CreateDate'=> "$now" ]
];
$this->db->table('location')->insertBatch($data);
$data = [
['LocationID'=>1, 'Street1'=>'Jalan Nginden', 'Street2'=>'Intan Raya', 'City'=>'Surabaya', 'Province'=>'East Java', 'PostCode'=>'60222', 'CreateDate'=> "$now"],
['LocationID'=>2, 'Street1'=>'Jalan ', 'Street2'=>'Jalan jalan', 'City'=>'Depok', 'Province'=>'DKI Jakarta', 'PostCode'=>'10123', 'CreateDate'=> "$now"]
];
$this->db->table('locationaddress')->insertBatch($data);
}
}

View File

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

View File

@ -0,0 +1,41 @@
<?php
namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder;
use App\Models\ValueSet\ValueSetModel;
class SpecimenSeeder extends Seeder {
protected array $map = [];
public function run() {
$now = date('Y-m-d H:i:s');
$vsModel = new ValueSetModel();
$rows = $vsModel->select("VID, VSetID, VValue")->findAll();
$vs = [];
foreach ($rows as $row) {
$vs[$row['VSetID']][$row['VValue']] = $row['VID'];
}
// containerdef
$data = [
['ConCode' => '1','ConName' => 'SST', 'ConDesc' =>'Evacuated blood collection tube, gel separator', 'Additive' => "66", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '11','ConName' => 'Plain', 'ConDesc' =>'Evacuated blood collection tube, no additive/metal-free', 'Additive' => "67", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '12','ConName' => '2Hr PP', 'ConDesc' =>'Evacuated blood collection tube, untuk Glukosa 2 Jam PP', 'Additive' => "68", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '13','ConName' => 'Glukosa Sewaktu', 'ConDesc' =>'Evacuated blood collection tube, untuk Glukosa Sewaktu', 'Additive' => "69", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '14','ConName' => 'GTT 30 menit', 'ConDesc' =>'Evacuated blood collection tube, untuk GTT 30 menit', 'Additive' => "71", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '15','ConName' => 'GTT 60 menit', 'ConDesc' =>'Evacuated blood collection tube, untuk GTT 60 menit', 'Additive' => "71", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '16','ConName' => 'GTT 120 menit', 'ConDesc' =>'Evacuated blood collection tube, untuk GTT 90 menit', 'Additive' => "71", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '20','ConName' => 'RST', 'ConDesc' =>'Evacuated blood collection tube, thrombin/clot activator/gel separator', 'Additive' => "71", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '101','ConName' => 'EDTA - Hematologi', 'ConDesc' =>'Evacuated blood collection tube, K2EDTA/aprotinin', 'Additive' => "71", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '150','ConName' => 'Citrate - Koagulasi', 'ConDesc' =>'Evacuated blood collection tube, untuk koagulasi', 'Additive' => "71", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '200','ConName' => 'Aliquot', 'ConDesc' =>'General specimen container, no additive, non-sterile. Untuk aliquot', 'Additive' => "71", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '290','ConName' => 'Pot Urin', 'ConDesc' =>'Non-sterile urine specimen container IVD', 'Additive' => "71", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '295','ConName' => 'Urine Container', 'ConDesc' =>'Urine specimen container', 'Additive' => "71", 'ConClass' => '80', 'CreateDate'=> "$now"],
['ConCode' => '900','ConName' => 'Packing Pengiriman', 'ConDesc' =>'Specimen Transport Packaging', 'Additive' => "71", 'ConClass' => '81', 'CreateDate'=> "$now"],
];
$this->db->table('containerdef')->insertBatch($data);
}
}

View File

@ -5,10 +5,8 @@ namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder;
use App\Models\ValueSet\ValueSetModel;
class DummyTestSeeder extends Seeder {
class TestSeeder extends Seeder {
protected array $map = [];
public function run() {
$now = date('Y-m-d H:i:s');
$vsModel = new ValueSetModel();

View File

@ -9,24 +9,28 @@ class AreaGeoModel extends BaseModel {
protected $allowedFields = ['Parent', 'AreaCode', 'Class', 'AreaName'];
public function getAreaGeos() {
return $this->findAll();
if (!empty($filters['AreaGeoID'])) {
$this->where('AreaGeoID', $filters['AreaGeoID']);
}
if (!empty($filters['AreaName'])) {
$this->like('AreaName', $filters['AreaName'], 'both');
}
return $this->findAll();
}
public function getProvinces() {
$this->select('AreaGeoID, AreaName')->where('Parent IS NULL', null, false);
if (!empty($filters['AreaGeoID'])) {
$this->where('AreaGeoID', $filters['AreaGeoID']);
}
if (!empty($filters['AreaName'])) {
$this->like('AreaName', $filters['AreaName'], 'both');
}
return $this->findAll();
$rows = $this->select('AreaGeoID, AreaName')
->orGroupStart()
->where('Parent', null)
->orWhere('Parent', 0)
->groupEnd()->findAll();
return $rows;
}
public function getCities($filter = []) {
$rows = $this->select('AreaGeoID, AreaName')->where('Parent IS NOT NULL', null, false);
$this->select('AreaGeoID, AreaName')->where('Parent IS NOT NULL', null, false);
if (!empty($filter['AreaGeoID'])) {
$this->where('Parent', $filter['AreaGeoID']);

View File

@ -14,8 +14,8 @@ class LocationModel extends BaseModel {
protected $deletedField = 'EndDate';
public function getLocations($LocCode, $LocName) {
$sql = $this->select("LocationID, LocCode, Parent, LocFull, LocType, v.VDesc ")
->join("valueset v", "v.VSetID=12 and v.VValue=location.loctype", 'left');
$sql = $this->select("LocationID, LocCode, Parent, LocFull, LocType, v.VDesc as LocTypeText")
->join("valueset v", "v.VID=location.loctype", 'left');
if($LocName != '') { $sql->like('LocFull', $LocName, 'both'); }
if($LocCode != '') { $sql->like('LocCode', $LocCode, 'both'); }
$rows = $sql->findAll();
@ -27,7 +27,7 @@ class LocationModel extends BaseModel {
$rows = $this->select("location.*, la.Street1, la.Street2, la.PostCode, la.GeoLocationSystem, la.GeoLocationData,
v.*, prop.AreaGeoID as ProvinceID, prop.AreaName as Province, city.AreaGeoID as CityID, city.AreaName as City")
->join("locationaddress la", "location.LocationID=la.LocationID", "left")
->join("valueset v", "v.VSetID=12 and v.VValue=location.loctype", "left")
->join("valueset v", "v.VID=location.loctype", "left")
->join("areageo prop", "la.Province=prop.AreaGeoID", "left")
->join("areageo city", "la.City=city.AreaGeoID", "left")
->where('location.LocationID', (int) $LocationID)->findAll();