diff --git a/app/Config/Routes.php b/app/Config/Routes.php index bcb31f7..60ec1ac 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -20,12 +20,11 @@ $routes->get('/logout', 'Auth::logout'); // ------------------------------------------------------Page Based on Role------------------------------------------------------ // $routes->group('admin', ['filter' => 'role:1'], function($routes) { $routes->get('/', 'Admin::index'); + $routes->get('modal_specimen', 'Admin::modal_specimen'); $routes->get('user', 'User::index'); $routes->post('user/create', 'User::create'); $routes->post('user/update', 'User::update'); $routes->post('user/delete', 'User::delete'); - $routes->get('specimenDetail', 'Admin::specimenDetailApi'); //Ini Api ya ges ya - }); $routes->group('doctor', ['filter' => 'role:2'], function($routes) { @@ -41,4 +40,5 @@ $routes->group('cs', ['filter' => 'role:4'], function($routes) { }); // ------------------------------------------------------For API------------------------------------------------------ // -// $routes->get('/api/dashboard', 'ApiDashboard::index'); \ No newline at end of file +// $routes->get('/api/dashboard', 'ApiDashboard::index'); +$routes->get('api/specimen/(:any)', 'Specimen::show/$1'); \ No newline at end of file diff --git a/app/Controllers/Admin.php b/app/Controllers/Admin.php index aeb3726..c25dc64 100644 --- a/app/Controllers/Admin.php +++ b/app/Controllers/Admin.php @@ -96,59 +96,7 @@ class Admin extends BaseController return view('admin/index', $data); } - // Khusus Untuk API - public function specimenDetailApi() - { - $access = $this->request->getGet('access'); - $db = \Config\Database::connect(); - - $sql = "SELECT right(p.PATNUMBER,16) as [Rm], ISNULL(p.FIRSTNAME,'') + ' ' + ISNULL(p.NAME,'') as [Name], - case when format(p.BIRTHDATE,'MMdd')=format(spr.COLLECTIONDATE,'MMdd') then DATEDIFF(YEAR,p.BIRTHDATE, spr.COLLECTIONDATE) - else FLOOR(DATEDIFF(DAY, p.BIRTHDATE, spr.COLLECTIONDATE) / 365.25) end , - [Gender] = case - when p.SEX = 1 then 'Male' - when p.SEX = 2 then 'Female' - else '' - end, spr.REQDATE, spo.COMMENTTEXT, dmg.DMG_CKTPNO, dmg.DMG_CPLACEOFBIRTH - from SP_REQUESTS spr - left join PATIENTS p on p.PATID=spr.PATID - left join SP_REQUESTS_OCOM spo on spr.SP_ACCESSNUMBER=spo.SP_ACCESSNUMBER - left join GDC_CMOD.dbo.TDL_DEMOGRAPHIC dmg on right(dmg.DMG_CPATNUMBER,15)=right(p.PATNUMBER,15) - where spr.PATID=p.PATID and spr.SP_ACCESSNUMBER='$access'"; - $query = $db->query($sql); - $results = $query->getRowArray(); - $patientIdentity = [ - 'rm' => $results["Rm"], - 'age' => $results[""], // key kosong - 'name' => $results['Name'] ?? '', - 'reqdate' => $results['REQDATE'] ?? '', - 'gender' => $results['Gender'] ?? '', - 'placeofbirth' => $results['DMG_CPLACEOFBIRTH'] ?? '', - 'ktp' => $results['DMG_CKTPNO'] ?? '', - 'comment' => $results['COMMENTTEXT'] ?? '', - ]; - - $samples = []; - $sql = "SELECT req.SAMPTYPEID, req.SAMPCODE, req.SHORTTEXT, tu.STATUS, st.TUBESTATUS - from GDC_CMOD.dbo.v_sp_reqtube req - left join GDC_CMOD.dbo.TUBES tu on req.SP_ACCESSNUMBER=tu.ACCESSNUMBER and req.SAMPCODE=tu.TUBENUMBER - left join glendb.dbo.SP_TUBES st on st.SP_ACCESSNUMBER=req.SP_ACCESSNUMBER and req.SAMPCODE=st.SAMPLETYPE - where req.SP_ACCESSNUMBER='$access'"; - $query = $db->query($sql); - $results = $query->getResultArray(); - foreach ($results as $row) { - $samples[] = [ - 'samptypeid' => $row['SAMPTYPEID'] ?? null, - 'sampcode' => $row['SAMPCODE'] ?? null, - 'name' => $row['SHORTTEXT'] ?? '', - 'colstatus' => $row['STATUS'] ?? '', - 'tubestatus' => $row['TUBESTATUS'] ?? '', - ]; - } - - $data = ['patientIdentity' => $patientIdentity, 'samples' => $samples]; - - return $this->response->setJSON($data); + public function modal_specimen() { + return view('admin/modal_specimen'); } - } diff --git a/app/Controllers/Specimen.php b/app/Controllers/Specimen.php new file mode 100644 index 0000000..34b665d --- /dev/null +++ b/app/Controllers/Specimen.php @@ -0,0 +1,57 @@ +query($sql); + $results = $query->getRowArray(); + $patientIdentity = [ + 'rm' => $results["Rm"], + 'age' => $results[""], // key kosong + 'name' => $results['Name'] ?? '', + 'reqdate' => $results['REQDATE'] ?? '', + 'gender' => $results['Gender'] ?? '', + 'placeofbirth' => $results['DMG_CPLACEOFBIRTH'] ?? '', + 'ktp' => $results['DMG_CKTPNO'] ?? '', + 'comment' => $results['COMMENTTEXT'] ?? '', + ]; + + $samples = []; + $sql = "SELECT req.SAMPTYPEID, req.SAMPCODE, req.SHORTTEXT, tu.STATUS, st.TUBESTATUS + from GDC_CMOD.dbo.v_sp_reqtube req + left join GDC_CMOD.dbo.TUBES tu on req.SP_ACCESSNUMBER=tu.ACCESSNUMBER and req.SAMPCODE=tu.TUBENUMBER + left join glendb.dbo.SP_TUBES st on st.SP_ACCESSNUMBER=req.SP_ACCESSNUMBER and req.SAMPCODE=st.SAMPLETYPE + where req.SP_ACCESSNUMBER='$access'"; + $query = $db->query($sql); + $results = $query->getResultArray(); + foreach ($results as $row) { + $samples[] = [ + 'samptypeid' => $row['SAMPTYPEID'] ?? null, + 'sampcode' => $row['SAMPCODE'] ?? null, + 'name' => $row['SHORTTEXT'] ?? '', + 'colstatus' => $row['STATUS'] ?? '', + 'tubestatus' => $row['TUBESTATUS'] ?? '', + ]; + } + + $data = ['patientIdentity' => $patientIdentity, 'samples' => $samples]; + + return $this->response->setJSON($data); + } + +} diff --git a/app/Views/_layouts/main.php b/app/Views/_layouts/main.php index 9735467..c17a38b 100644 --- a/app/Views/_layouts/main.php +++ b/app/Views/_layouts/main.php @@ -17,75 +17,6 @@ font-size: 0.7rem; } - body { - overflow-x: hidden; - } - - #sidebar { - width: 200px; - position: fixed; - top: 0; - left: 0; - height: 100vh; - background: #343a40; - color: #fff; - transition: all 0.3s; - overflow: hidden; - } - #sidebar.collapsed { - width: 70px; - } - #sidebar .nav-link { - color: #adb5bd; - display: flex; - align-items: center; - gap: 10px; - white-space: nowrap; - overflow: hidden; - transition: all 0.3s; - } - #sidebar.collapsed .nav-link span { - opacity: 0; - visibility: hidden; - width: 0; - } - #sidebar .nav-link.active { - background: #495057; - color: #fff; - } - #content { - margin-left: 200px; - transition: all 0.3s; - padding: 20px; - } - #content.fullwidth { - margin-left: 70px; - } - .toggle-btn { - position: fixed; - top: 15px; - left: 15px; - z-index: 999; - } - .main { - transition: margin-left 0.3s ease; - } - - .main.shifted { - margin-left: 200px; - } - - @media (max-width: 768px) { - .sidebar { - width: 150px; - } - - .main.shifted { - margin-left: 150px; - } - } - - /* Untuk Card Status Counter */ .status-card { width: 123px; @@ -202,79 +133,17 @@
+ = $this->renderSection('content'); ?> - - - - -| S | +Order Datetime | +Patient Name | +No Lab | +No Register | +Reff | +Doctor | +Tests | +Result To | +Validation | +Status | ++ | + |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| + = esc($row['statscode']) ?> + | + ++ = esc($row['reqdate']) ?> + | ++ = esc($row['patname']) ?> + | ++ = esc($row['sp_accessnumber']) ?> + | ++ = esc($row['hostordernumber']) ?> + | ++ = esc($row['reff']) ?> + | ++ = esc($row['doc']) ?> + | ++ = esc($row['tests']) ?> + | ++ = esc($row['odr_cresult_to']) ?> + | +
+ + + _ + ++ Result+ Invalidation + |
+ + = esc($row['stats']) ?> + | +
+ Preview + + Print | Eng + Pdf + |
+
+ Printed + Hardcopy + |
+