diff --git a/.gitignore b/.gitignore index c296bc4..6c63bf6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,4 @@ !.gitignore !env !cmod.sql -!pbmcDps_dict_tests.csv \ No newline at end of file +!cmod.bak \ No newline at end of file diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 164fc74..f32ba2a 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -47,4 +47,6 @@ $routes->post('/api/users/savePass/(:any)', 'Users::savePass/$1'); $routes->post('/api/users/saveRole/(:any)', 'Users::saveRole/$1'); // API - DictTests +$routes->POST('/api/dictTests/search', 'DictTests::search'); $routes->get('/api/dictTests/index', 'DictTests::index'); +$routes->get('/api/dictTests/detail/(:any)', 'DictTests::detail/$1'); diff --git a/app/Controllers/DictTests.php b/app/Controllers/DictTests.php index 86faf69..4982cc9 100644 --- a/app/Controllers/DictTests.php +++ b/app/Controllers/DictTests.php @@ -8,7 +8,7 @@ class DictTests extends ResourceController { public function index() { $db = \Config\Database::connect(); - $sql = "select TESTCODE, SHORTTEXT, TEXT1 from cmod.dbo.CM_DICT_TESTS"; + $sql = "select TESTCODE, TEXT1, TEXT2 from cmod.dbo.CM_DICT_TESTS"; $query = $db->query($sql); $results = $query->getResultArray(); $data['dictTests'] = $results; @@ -16,24 +16,51 @@ class DictTests extends ResourceController { return $this->respond($data, 200); } - public function detail($userroleid) { + public function search() { $db = \Config\Database::connect(); - $sql = "select * from cmod.dbo.CM_USERROLES where USERROLEID='$userroleid'"; + $testcode = $this->request->getPost('testcode'); + $shorttext = $this->request->getPost('shorttext'); + $sql = "select dt.TESTCODE, dt.SHORTTEXT, cdt.TEXT1, cdt.TEXT2, cdt.UNIT, cdt.REFFTEXT from DICT_TESTS dt + left join cmod.dbo.CM_DICT_TESTS cdt on dt.TESTCODE=cdt.TESTCODE"; + // Initialize a WHERE clause + $where= ''; + + // Check if either testcode or shorttext is provided + if (!empty($testcode) || !empty($shorttext)) { + $where= ' WHERE '; + if (!empty($testcode)) { $where .= "dt.TESTCODE like '%$testcode%'"; } + if (!empty($shorttext)) { + if (!empty($testcode)) { $where .= ' OR '; } + $where .= "LOWER(dt.SHORTTEXT) LIKE '%$shorttext%'"; + } + } + $sql .= $where; + $query = $db->query($sql); + $results = $query->getResultArray(); + $data['dictTests'] = $results; + + return $this->respond($data, 200); + } + + public function detail($testcode) { + $db = \Config\Database::connect(); + $sql = "select * from cmod.dbo.CM_DICT_TESTS where TESTCODE='$testcode'"; $query = $db->query($sql); $results = $query->getResultArray(); $data = $results[0]; return $this->respond($data, 200); } - public function save($userroleid) { - $userrolecode = $this->request->getPost('userrolecode'); - $userrolename = $this->request->getPost('userrolename'); + public function save($testcode) { + $text1 = $this->request->getPost('text1'); + $text2 = $this->request->getPost('text2'); + $refftext = $this->request->getPost('refftext'); $db = \Config\Database::connect(); - if($userroleid == 0) { // new - $sql = "INSERT INTO cmod.dbo.CM_USERROLES(USERROLECODE, USERROLENAME, CREATEDATE) VALUES ('$userrolecode', '$userrolename', GETDATE())"; + if($testcode == 0) { // new + $sql = "INSERT INTO cmod.dbo.CM_DICT_TESTS (TESTCODE, TEXT1, TEXT2, REFFTEXT, LOGDATE ) VALUES ('$testcode', '$text1', '$text2', '$refftext' GETDATE())"; } else { //update - $sql = "UPDATE cmod.dbo.CM_USERROLES set USERROLENAME='$userrolename', USERROLECODE='$userrolecode' where USERROLEID='$userroleid'"; + $sql = "UPDATE cmod.dbo.CM_DICT_TESTS set TEXT1='$text1', TEXT2='$text2', REFFTEXT='$refftext', LOGDATE=GETDATE() where TESTCODE='$testcode'"; } if( $db->query($sql) ) { diff --git a/app/Views/dictTests_index.php b/app/Views/dictTests_index.php index 34795b0..a000e77 100644 --- a/app/Views/dictTests_index.php +++ b/app/Views/dictTests_index.php @@ -1,17 +1,32 @@ extend('layouts/main.php') ?> section('content') ?> -
+
Dictionary Test
- +
+
Testcode
+
+
+
+
Shorttext
+
+
+ +
+
+ +
+
- + + + @@ -21,31 +36,132 @@ + +
Testcode ShorttextText 1TextUnitReff. Action
+ + + + + +
Testcode :
Text 1 :
Text 2 :
Reff. :
+ + +
+
+
+
+ + endSection() ?> section('script') ?> endSection() ?> \ No newline at end of file diff --git a/app/Views/userroles_index.php b/app/Views/userroles_index.php index 6a8ab22..951b706 100644 --- a/app/Views/userroles_index.php +++ b/app/Views/userroles_index.php @@ -60,7 +60,6 @@ function index() { for (var i = 0; i < data.length; i++) { let editBtn = ' '; //let deleteBtn = ''; - let datarow = '' + '' + data[i].USERROLEID + '' + '' + data[i].USERROLECODE+ '' + '' + data[i].USERROLENAME+ '' + '' + editBtn + '' + ''; diff --git a/cmod.bak b/cmod.bak new file mode 100644 index 0000000..8687d96 Binary files /dev/null and b/cmod.bak differ diff --git a/pbmcDps_dict_tests.csv b/pbmcDps_dict_tests.csv deleted file mode 100644 index 971b4ac..0000000 --- a/pbmcDps_dict_tests.csv +++ /dev/null @@ -1,168 +0,0 @@ -ABS;Antibody Screening;Penyaringan Antibodi -ACR;Albumin Creatinin Ratio;Rasio Albumin-Kreatinin -AHBS;Anti HBs;Anti HBs -AHCV;Anti HCV;Anti HCV -AHIV;Anti HIV;Anti HIV -ALB;Albumin;Albumin -ALCO;Alcohol Test;Tes Alkohol -ALP;Alkaline Phospatase;Alkaline Phosphatase -AMPHE;Amphetamine;Amfetamin -APTT;Activated Partial Thromb Time (APTT);Waktu Tromboplastin Parsial Teraktivasi (APTT) -BARBI;Barbiturate;Barbiturat -BAS;Basophil (Bas%);Basofil (Bas%) -BENZO;Benzodiazepine;Benzodiazepin -BILD;Direct Bilirubin;Bilirubin Direkt -BILT;Total Bilirubin;Bilirubin Total -BLOOD;Blood group for BBS;Golongan Darah untuk BBS -BSCC;Conclusion;Kesimpulan -BSPL;Trombocytes;Trombosit -BSRB;Erytrocytes;Eritrosit -BSSG;Suggestion;Saran -BSWB;Leucocytes;Leukosit -BT;Bleeding Time;Waktu Pendarahan -BUN;Blood Urea Nitrogen (BUN);Nitrogen Urea Darah (BUN) -CA;Calcium (Ca);Kalsium (Ca) -CHOL;Total Cholesterol;Kolesterol Total -CL;Chlorida (Cl);Klorida (Cl) -COCAI;Cocain;Kokain -CREA;Creatinin;Kreatinin -CT;Clotting Time;Waktu Pembekuan -DIFFC;Diff Count;Hitung Diferensial (Diff Count) -DRUT;Hematology Routine;Hematologi Rutin -ELEK;Electrolyte Test;Tes Elektrolit -EOS;Eosinophil (Eos%);Eosinofil (Eos%) -ESR;Erythrocyte Sedimentation Rate;Laju Endap Darah (LED) -FAS;Feces Analysist (Stool O & P);Analisis Feses (Stool O & P) -FCESC;Eschericia coli (Phatogen);Escherichia coli (Patogen) -FCSAL;Salmonella sp.;Salmonella sp. -FCSHI;Shigella sp.;Shigella sp. -FCVIB;Vibrio cholerae;Vibrio cholerae -FE;Ferittin;Ferritin -FJOUR;Fjour;Fjour -FMABL;Blood;Darah -FMACL;Color;Warna -FMAK;Macroscopic;Makroskopik -FMAKO;Consistency;Konsistensi -FMAMU;Mucos;Mukus -FMAOI;Oily;Minyak -FMASM;Smell;Bau -FMIAM;Amylum;Amylum -FMIBT;Bacteria;Bakteri -FMICY;Cyst Amoeba;Sista Amoeba -FMIER;Erytrocytes;Eritrosit -FMIFI;Fibers;Serat -FMIFT;Fat;Lemak -FMIHO;Hook Worm Egg;Telur Cacing Hookworm -FMIK;Microscopic;Mikroskopik -FMILE;Leukocytes;Leukosit -FMINE;Necator America Egg;Telur Necator Americanus -FMIOT;Other Worm Egg;Telur Cacing Lain -FMIOX;Oxyuris Vermicularis;Oxyuris Vermicularis -FMIPA;Parasite;Parasit -FMITR;Trichuris Trichura;Trichuris Trichura -FMIVE;Vegetative Amoeba;Amoeba Vegetatif -FOB;Fecal Occult Blood (FOB);Darah Tersembunyi dalam Feses (FOB) -FSC;Feces Culture;Kultur Feses -G2PP;2 Hours Posprandial Glucose;Glukosa 2 Jam Postprandial -GDS;Random Glucose;Glukosa Acak -GGT;Gamma GT;Gamma GT -GLUP;Fasting Glucose;Glukosa Puasa -GOLDA;Blood Group;Golongan Darah -GOLRH;Blood Type and Rhesus;Tipe Darah dan Rhesus -HAVG;IgG Anti HAV;IgG Anti HAV -HAVM;IgM Anti HAV;IgM Anti HAV -HAVT;Total Anti HAV;Total Anti HAV -HBA1C;HBa1C;Hba1C -HBSAG;HBsAg;HBsAg -HCT;Hematocrit (HCT);Hematokrit (HCT) -HDL;HDL Cholesterol;HDL Kolesterol -HDT;Blood Smear;Goresan Darah (Blood Smear) -HGB;Hemoglobin (HGB);Hemoglobin (HGB) -IGGMT;IgG/IgM Typhoid Test;Tes IgG/IgM Typhoid -IGGTB;IgG-TB Test;Tes IgG-TB -K;Potassium (K);Kalium (K) -K2;K2;K2 -KETAM;Ketamine;Ketamin -LDL;LDL Cholesterol;LDL Kolesterol -LYM;Lymphocyte (Lym%);Limfosit (Lym%) -MCH;MCH;MCH -MCHC;MCHC;MCHC -MCV;MCV;MCV -MDMA;K2MDMA;K2MDMA -MON;Monocyte (Mon%);Monosit (Mon%) -MPV;MPV;MPV -NA;Sodium (NA);Natrium (Na) -NEU;Neutrofil (Neu%);Neutrofil (Neu%) -NUMIS;Packs issued;Opiat -NUMXO;Packs X-matched;PCP -OPIAT;Opiate;Opium -PCP;PCP;PCP -PCT;PCT;PCT -PDW;PDW;PDW -PLT;Platelet (PLT);Trombosit (PLT) -PPT;Pregnancy Test;Tes Kehamilan -PSA;PSA;PSA -PT;Prothombin Time (PT);Waktu Prothrombin (PT) -QTES;dummy test 1;Tes Dummy 1 -QTES1;qtes1;qtes1 -QTES2;Dummy test 1;Tes Dummy 1 -QTES3;dummy test 3;Tes Dummy 3 -QTES4;dummy test 4;Tes Dummy 4 -QTES5;dummy test 5;Tes Dummy 5 -QTES6;dummy test 6;Tes Dummy 6 -QTES7;dummy test 7;Tes Dummy 7 -QTES8;dummy test 8;Tes Dummy 8 -QTES9;dummy test;Tes Dummy -QTESA;QTESA;QTESA -QTEST;Dummy;Dummy -QTS1;Dummy test 1;Tes Dummy 1 -QTS2;Dummy test 2;Tes Dummy 2 -RBC;Red Blood Cell (RBC);Sel Darah Merah (RBC) -RDWCV;RDW - CV;RDW-CV -RDWSD;RDW - SD;RDW-SD -RH;Rhesus;Rhesus -SALAH;Salmonella Paratyphi AH;Salmonella Paratyphi AH -SALAO;Salmonella Paratyphi AO;Salmonella Paratyphi AO -SALBH;Salmonella Paratyphi BH;Salmonella Paratyphi BH -SALBO;Salmonella Paratyphi BO;Salmonella Paratyphi BO -SALCH;Salmonella Paratyphi CH;Salmonella Paratyphi CH -SALCO;Salmonella Paratyphi CO;Salmonella Paratyphi CO -SALTH;Salmonella Typhi H;Salmonella Typhi H -SALTO;Salmonella Typhi O;Salmonella Typhi O -SGOT;SGOT (AST);SGOT (AST) -SGPT;SGPT (ALT);SGPT (ALT) -SI;Serum Iron;Serum Besi (Serum Iron) -SPBTA;Sputum BTA;BTA Sputum -SWTH;Throat Swab;Swab Tenggorokan -TEST;ref. test;Tes Referensi -TG;Triglyseride;Trigliserida -THC;THC;THC -TIBC;TIBC;TIBC -TOPO;TOPO;TOPO -TP;Total Protein (TP);Protein Total (TP) -TRANS;Transferrin Saturation;Saturasi Transferrin -TSH;TSH;TSH -UIBC;UIBC;UIBC -UL;Urinalysis;Urinalisis -UMABI;Urine Bilirubin;Bilirubin Urin -UMABJ;Density;Kepadatan -UMADR;Urine Blood;Darah Urin -UMAGU;Urine Glucose;Glukosa Urin -UMAK;Macroscopic;Makroskopik -UMAKT;Urine Ketones;Keton Urin -UMALE;Urine Leukocyte;Leukosit Urin -UMANI;Urine Nitrites;Nitrit Urin -UMAPH;pH;pH -UMAPT;Protein;Protein Urin -UMAUR;Urine Urobilinogen;Urobilinogen -UMAWR;Color;Warna -UMIER;Sediment Erythrocyte;Sedimen Eritrosit -UMIK;Microscopic;Mikroskopik -UMIKR;Crystal;Kristal -UMILE;Sediment Leukocyte;Sedimen Leukosit -UMILN;Others Sediment;Sedimen Lainnya -UMISL;Sediment Epithelia Cells;Sedimen Sel Epitel -URIC;Uric Acid;Asam Urat -VDRL;VDRL/Anti TP;VDRL/Anti-TP -WBC;White Blood Cell (WBC);Sel Darah Putih (WBC) -WIDAL;Widal Test;Tes Widal