Compare commits
No commits in common. "main" and "zakaria" have entirely different histories.
133
.gitignore
vendored
133
.gitignore
vendored
@ -1,126 +1,7 @@
|
|||||||
#-------------------------
|
/*
|
||||||
# Operating Specific Junk Files
|
!app/
|
||||||
#-------------------------
|
!public/
|
||||||
|
!cretab.sql
|
||||||
# OS X
|
!.gitignore
|
||||||
.DS_Store
|
!docs/
|
||||||
.AppleDouble
|
!env
|
||||||
.LSOverride
|
|
||||||
|
|
||||||
# OS X Thumbnails
|
|
||||||
._*
|
|
||||||
|
|
||||||
# Windows image file caches
|
|
||||||
Thumbs.db
|
|
||||||
ehthumbs.db
|
|
||||||
Desktop.ini
|
|
||||||
|
|
||||||
# Recycle Bin used on file shares
|
|
||||||
$RECYCLE.BIN/
|
|
||||||
|
|
||||||
# Windows Installer files
|
|
||||||
*.cab
|
|
||||||
*.msi
|
|
||||||
*.msm
|
|
||||||
*.msp
|
|
||||||
|
|
||||||
# Windows shortcuts
|
|
||||||
*.lnk
|
|
||||||
|
|
||||||
# Linux
|
|
||||||
*~
|
|
||||||
|
|
||||||
# KDE directory preferences
|
|
||||||
.directory
|
|
||||||
|
|
||||||
# Linux trash folder which might appear on any partition or disk
|
|
||||||
.Trash-*
|
|
||||||
|
|
||||||
#-------------------------
|
|
||||||
# Environment Files
|
|
||||||
#-------------------------
|
|
||||||
# These should never be under version control,
|
|
||||||
# as it poses a security risk.
|
|
||||||
.env
|
|
||||||
.vagrant
|
|
||||||
Vagrantfile
|
|
||||||
|
|
||||||
#-------------------------
|
|
||||||
# Temporary Files
|
|
||||||
#-------------------------
|
|
||||||
writable/cache/*
|
|
||||||
!writable/cache/index.html
|
|
||||||
|
|
||||||
writable/logs/*
|
|
||||||
!writable/logs/index.html
|
|
||||||
|
|
||||||
writable/session/*
|
|
||||||
!writable/session/index.html
|
|
||||||
|
|
||||||
writable/uploads/*
|
|
||||||
!writable/uploads/index.html
|
|
||||||
|
|
||||||
writable/debugbar/*
|
|
||||||
!writable/debugbar/.gitkeep
|
|
||||||
|
|
||||||
php_errors.log
|
|
||||||
|
|
||||||
#-------------------------
|
|
||||||
# User Guide Temp Files
|
|
||||||
#-------------------------
|
|
||||||
user_guide_src/build/*
|
|
||||||
user_guide_src/cilexer/build/*
|
|
||||||
user_guide_src/cilexer/dist/*
|
|
||||||
user_guide_src/cilexer/pycilexer.egg-info/*
|
|
||||||
|
|
||||||
#-------------------------
|
|
||||||
# Test Files
|
|
||||||
#-------------------------
|
|
||||||
tests/coverage*
|
|
||||||
|
|
||||||
# Don't save phpunit under version control.
|
|
||||||
phpunit
|
|
||||||
|
|
||||||
#-------------------------
|
|
||||||
# Composer
|
|
||||||
#-------------------------
|
|
||||||
vendor/
|
|
||||||
|
|
||||||
#-------------------------
|
|
||||||
# IDE / Development Files
|
|
||||||
#-------------------------
|
|
||||||
|
|
||||||
# Modules Testing
|
|
||||||
_modules/*
|
|
||||||
|
|
||||||
# phpenv local config
|
|
||||||
.php-version
|
|
||||||
|
|
||||||
# Jetbrains editors (PHPStorm, etc)
|
|
||||||
.idea/
|
|
||||||
*.iml
|
|
||||||
|
|
||||||
# NetBeans
|
|
||||||
/nbproject/
|
|
||||||
/build/
|
|
||||||
/nbbuild/
|
|
||||||
/dist/
|
|
||||||
/nbdist/
|
|
||||||
/nbactions.xml
|
|
||||||
/nb-configuration.xml
|
|
||||||
/.nb-gradle/
|
|
||||||
|
|
||||||
# Sublime Text
|
|
||||||
*.tmlanguage.cache
|
|
||||||
*.tmPreferences.cache
|
|
||||||
*.stTheme.cache
|
|
||||||
*.sublime-workspace
|
|
||||||
*.sublime-project
|
|
||||||
.phpintel
|
|
||||||
/api/
|
|
||||||
|
|
||||||
# Visual Studio Code
|
|
||||||
.vscode/
|
|
||||||
|
|
||||||
/results/
|
|
||||||
/phpunit*.xml
|
|
||||||
22
LICENSE
22
LICENSE
@ -1,22 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2014-2019 British Columbia Institute of Technology
|
|
||||||
Copyright (c) 2019-2024 CodeIgniter Foundation
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
21
README.md
21
README.md
@ -1,21 +0,0 @@
|
|||||||
buat rule cmod-rest
|
|
||||||
|
|
||||||
-order baru
|
|
||||||
|
|
||||||
-klo ref baru > ok
|
|
||||||
|
|
||||||
-klo ref dan mr+nama sama -> ok
|
|
||||||
|
|
||||||
-klo ref sama cek mr dan nama beda di lis -> (kirim error balik)
|
|
||||||
|
|
||||||
-order tambahan
|
|
||||||
|
|
||||||
-ref sama , cekmr dan nama pasien harus sama + status receive di lis = 0 > ok
|
|
||||||
|
|
||||||
-kalo mr dan nama beda atau receive = 1 -> tolak (kirim error balik)
|
|
||||||
|
|
||||||
-order cancel
|
|
||||||
|
|
||||||
-klo ref sama status cancel=1 dan status receive di lis = 0 - ok
|
|
||||||
|
|
||||||
-klo ref sama sattus cancel=1 dan status receive di lis = 1 - tolak (kirim error balik
|
|
||||||
@ -41,6 +41,8 @@ class Autoload extends AutoloadConfig
|
|||||||
*/
|
*/
|
||||||
public $psr4 = [
|
public $psr4 = [
|
||||||
APP_NAMESPACE => APPPATH,
|
APP_NAMESPACE => APPPATH,
|
||||||
|
// Untuk UUID
|
||||||
|
'Ramsey\Uuid' => ROOTPATH . 'vendor/ramsey/uuid/src',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -76,7 +76,6 @@ class Filters extends BaseFilters
|
|||||||
'after' => [
|
'after' => [
|
||||||
// 'honeypot',
|
// 'honeypot',
|
||||||
// 'secureheaders',
|
// 'secureheaders',
|
||||||
//'toolbar' => ['except' => ['api/*']]
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -6,26 +6,6 @@ use CodeIgniter\Router\RouteCollection;
|
|||||||
* @var RouteCollection $routes
|
* @var RouteCollection $routes
|
||||||
*/
|
*/
|
||||||
$routes->get('/', 'Pages::home');
|
$routes->get('/', 'Pages::home');
|
||||||
//$routes->get('/loginsby', 'Auths::loginSBY');
|
$routes->post('/api/requests/', 'API_Requests::requests');
|
||||||
//$routes->get('/logindps', 'Auths::loginDPS');
|
$routes->get('/api/requests/orm/(:any)', 'API_Requests::orm/$1');
|
||||||
//$routes->get('/tests', 'Auths::tests');
|
$routes->get('/api/results/(:any)', 'API_Results::results/$1');
|
||||||
$routes->post('/api/requests/', 'API_TM::requests');
|
|
||||||
$routes->post('/api/requests1/', 'API_TM::requests1');
|
|
||||||
$routes->get('/api/requests/orm/(:any)', 'API_TM::orm/$1');
|
|
||||||
$routes->get('/api/requests/oc/(:any)/(:any)', 'API_TM::oc/$1/$2');
|
|
||||||
$routes->get('/api/results/(:any)', 'API_TM::results_send/$1');
|
|
||||||
$routes->get('/api/results_preview/(:any)', 'API_TM::results_preview/$1');
|
|
||||||
|
|
||||||
// dashboard message from TM
|
|
||||||
// dashboard request TM - TD
|
|
||||||
// resend orm
|
|
||||||
// resend result
|
|
||||||
// send oc
|
|
||||||
// send new master
|
|
||||||
|
|
||||||
$routes->get('/admin', 'AdminPages::HISRequests');
|
|
||||||
$routes->get('/admin/HISRequests', 'AdminPages::HISRequests');
|
|
||||||
$routes->get('/admin/HISMessages', 'AdminPages::HISMessages');
|
|
||||||
$routes->post('/admin/api/HISRequests', 'API_Admin::HISRequests_index');
|
|
||||||
$routes->post('/admin/api/HISMessages', 'API_Admin::HISMessages_index');
|
|
||||||
$routes->get('/admin/api/resendJSON/(:any)', 'API_Admin::resendJSON/$1');
|
|
||||||
|
|||||||
@ -1,88 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace App\Controllers;
|
|
||||||
|
|
||||||
use CodeIgniter\RESTful\ResourceController;
|
|
||||||
|
|
||||||
class API_Admin extends ResourceController {
|
|
||||||
|
|
||||||
public function __construct() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function HISRequests_index() {
|
|
||||||
$db = \Config\Database::connect();
|
|
||||||
$date1 = $this->request->getPost('date1');
|
|
||||||
$date2 = $this->request->getPost('date2');
|
|
||||||
|
|
||||||
$sql = "select r.SP_ACCESSNUMBER, r.HOSTORDERNUMBER, PATNUMBER=right(p.PATNUMBER,8), p.FIRSTNAME, p.NAME, tr.*,
|
|
||||||
STUFF(
|
|
||||||
( select ', '+ SP_TESTCODE from SP_TESTS
|
|
||||||
where SP_ACCESSNUMBER=r.SP_ACCESSNUMBER and DEPTH=0
|
|
||||||
FOR XML PATH('')
|
|
||||||
), 1, 1, ''
|
|
||||||
) AS TESTS
|
|
||||||
from cmod.dbo.CM_TM_REQUESTS tr
|
|
||||||
left join SP_REQUESTS r on r.HOSTORDERNUMBER=tr.REFFID
|
|
||||||
left join PATIENTS p on p.PATID=r.PATID
|
|
||||||
where tr.REQDATE between '".$date1."T00:00' and '".$date2."T23:59'
|
|
||||||
order by tr.REQDATE";
|
|
||||||
$query = $db->query($sql);
|
|
||||||
$results = $query->getResultArray();
|
|
||||||
|
|
||||||
return $this->respond([
|
|
||||||
'data' => $results
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function HISMessages_index() {
|
|
||||||
$db = \Config\Database::connect();
|
|
||||||
$date1 = $this->request->getPost('date1');
|
|
||||||
$date2 = $this->request->getPost('date2');
|
|
||||||
|
|
||||||
$sql = "select LOGID, BODY, LOGDATE from cmod.dbo.CM_TM_LOGS where LOGDATE between '$date1 00:00' and '$date2 23:59'";
|
|
||||||
$query = $db->query($sql);
|
|
||||||
$results = $query->getResultArray();
|
|
||||||
|
|
||||||
return $this->respond([
|
|
||||||
'data' => $results
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function resendJSON($logid) {
|
|
||||||
$db = \Config\Database::connect();
|
|
||||||
$sql = "select BODY from cmod.dbo.CM_TM_LOGS where LOGID='$logid'";
|
|
||||||
$query = $db->query($sql);
|
|
||||||
$results = $query->getResultArray();
|
|
||||||
|
|
||||||
$json = $results[0]['BODY'];
|
|
||||||
|
|
||||||
$headers = [ "Content-Type" => "application/json" ];
|
|
||||||
$method = "POST";
|
|
||||||
$message = [
|
|
||||||
"headers" => $headers,
|
|
||||||
"body" => $json
|
|
||||||
];
|
|
||||||
$url = base_url()."api/requests";
|
|
||||||
//echo "<pre>$url<br/>";
|
|
||||||
//print_r($message);
|
|
||||||
$this->sendjson($method, $url, $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function sendjson( $method, $url, $message ) {
|
|
||||||
$client = \Config\Services::curlrequest();
|
|
||||||
try {
|
|
||||||
$response = $client->request($method, $url, $message);
|
|
||||||
|
|
||||||
if ($response->getStatusCode() == 200) {
|
|
||||||
print_r($response);
|
|
||||||
} else {
|
|
||||||
print_r($response);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
//echo "<pre> \n".json_encode($json)."\n";
|
|
||||||
echo "Error: " . $e->getMessage();
|
|
||||||
log_message('error', 'API request exception: ' . $e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
280
app/Controllers/API_Requests.php
Normal file
280
app/Controllers/API_Requests.php
Normal file
@ -0,0 +1,280 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use CodeIgniter\RESTful\ResourceController;
|
||||||
|
use CodeIgniter\I18n\Time;
|
||||||
|
|
||||||
|
class API_Requests extends ResourceController {
|
||||||
|
|
||||||
|
public function requests() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$raw = $this->request->getVar();
|
||||||
|
|
||||||
|
// log to cm_tm_logs
|
||||||
|
$data = json_encode($raw);
|
||||||
|
$sql = "INSERT INTO cmod.dbo.CM_TM_LOGS (URL, METHOD, BODY, LOGDATE) VALUES ('API/REQUESTS', 'POST', '$data', GETDATE())";
|
||||||
|
$db->query($sql);
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$qdata = (array)$raw;
|
||||||
|
$qpat = (array)$qdata['patient'];
|
||||||
|
|
||||||
|
//patdata
|
||||||
|
$rm = $qpat['rm_number'];
|
||||||
|
$firstname = $qpat['patient_first_name'];
|
||||||
|
$lastname = $qpat['patient_last_name'];
|
||||||
|
$dob = $qpat['patient_dob'];
|
||||||
|
$sex = $qpat['patient_sex'];
|
||||||
|
$phone = $qpat['patient_phone'];
|
||||||
|
|
||||||
|
$sql = "select PATID from cmod.dbo.CM_TM_PATIENTS where PATNUMBER='$rm'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
if(!isset($results[0])) {
|
||||||
|
$sql = "INSERT INTO cmod.dbo.CM_TM_PATIENTS (PATNUMBER, FIRSTNAME, LASTNAME, BIRTHDATE, SEX, PHONE ) VALUES ('$rm', '$firstname', '$lastname', '$dob', '$sex', '$phone' )";
|
||||||
|
$db->query($sql);
|
||||||
|
$patid = $db->insertID();
|
||||||
|
} else {
|
||||||
|
$patid = $results[0]['PATID'];
|
||||||
|
$sql = "UPDATE cmod.dbo.CM_TM_PATIENTS SET FIRSTNAME='$firstname', LASTNAME='$lastname', BIRTHDATE='$dob', SEX='$sex', PHONE='$phone' where PATID='$patid'";
|
||||||
|
$db->query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
//reqdata
|
||||||
|
$reffid = $qdata['reference_id'];
|
||||||
|
$visitnum = $qpat['visit_number'];
|
||||||
|
$visitdesc = $qpat['visit_description'];
|
||||||
|
$visitdt = $qpat['visit_date_time'];
|
||||||
|
$agent = $qpat['agent'];
|
||||||
|
$agentname = $qpat['agent_name'];
|
||||||
|
$visittype = $qpat['visit_type'];
|
||||||
|
$company_name = $qdata['company_name'];
|
||||||
|
$loc = $qdata['branch'];
|
||||||
|
$doc = $qpat['treating_doctor'];
|
||||||
|
$createdt = $qdata['created'];
|
||||||
|
/*
|
||||||
|
$time = Time::createFromFormat('Y-m-d\TH:i:s.u\Z', $utcdt, 'UTC'); //2024-10-19T00:47:06.424654Z
|
||||||
|
$time = $time->setTimezone('Asia/Shanghai');
|
||||||
|
$orderdt = $time->toDateTimeString();
|
||||||
|
*/
|
||||||
|
$sql = "select REQID from cmod.dbo.CM_TM_REQUESTS where REFFID='$reffid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
if(!isset($results[0])) {
|
||||||
|
$sql = "INSERT INTO cmod.dbo.CM_TM_REQUESTS (REFFID, REQNUMBER, REQDESC, REQTYPE, REQDATE, AGENT, DOC, LOC, PATID, COMPANY, ISTAKEN, LOGDATE) VALUES ('$reffid', '$visitnum', '$visitdesc', '$visittype', '$visitdt', '$agentname', '$doc', '$loc', '$patid', '$company_name', null, '$createdt' )";
|
||||||
|
$db->query($sql);
|
||||||
|
$reqid = $db->insertID();
|
||||||
|
} else {
|
||||||
|
$reqid = $results[0]['REQID'];
|
||||||
|
$sql = "UPDATE cmod.dbo.CM_TM_REQUESTS SET REQNUMBER='$visitnum', REQDESC='$visitdesc', REQTYPE='$visittype', REQDATE='$visitdt', AGENT='$agentname', DOC='$doc', LOC='$loc', PATID='$patid' where REQID='$reqid'";
|
||||||
|
$db->query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
// tests
|
||||||
|
$tests = json_decode(json_encode($qpat['tests']), true);;
|
||||||
|
$string = '';
|
||||||
|
foreach($tests as $test) {
|
||||||
|
$testcode = $test['service_id'];
|
||||||
|
$testreffid = $test['test_ref_id'];
|
||||||
|
if(isset($test['status'])) { $teststatus = $test['status'];}
|
||||||
|
else { $teststatus = ''; }
|
||||||
|
$string .= "( '$testreffid', '$reqid', '$testcode', '$teststatus' ),";
|
||||||
|
}
|
||||||
|
$string = rtrim($string, ',');
|
||||||
|
//$sql = "INSERT INTO cmod.dbo.CM_TM_TESTS(REFFID, REQID, HISCODE) VALUES $string";
|
||||||
|
$sql = "INSERT INTO cmod.dbo.CM_TM_TESTS (REFFTESTID, REQID, HISCODE, TESTSTATUS)
|
||||||
|
SELECT S.REFFTESTID, S.REQID, S.HISCODE, S.TESTSTATUS FROM ( VALUES $string ) AS S (REFFTESTID, REQID, HISCODE, TESTSTATUS)
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM cmod.dbo.CM_TM_TESTS T WHERE T.REQID = S.REQID AND T.HISCODE = S.HISCODE );";
|
||||||
|
$db->query($sql);
|
||||||
|
|
||||||
|
$sql = "UPDATE cmod.dbo.CM_TM_TESTS SET TESTSTATUS = S.TESTSTATUS
|
||||||
|
FROM cmod.dbo.CM_TM_TESTS T
|
||||||
|
INNER JOIN ( VALUES $string ) AS S (REFFTESTID, REQID, HISCODE, TESTSTATUS)
|
||||||
|
ON T.REQID = S.REQID AND T.HISCODE = S.HISCODE;";
|
||||||
|
$db->query($sql);
|
||||||
|
|
||||||
|
|
||||||
|
return $this->respond(201);
|
||||||
|
/*
|
||||||
|
if( $db->query($sql) ) {
|
||||||
|
return $this->respond(201);
|
||||||
|
} else {
|
||||||
|
$response = [
|
||||||
|
'errors' => $db->errors(), 'message' => 'Invalid Messages'
|
||||||
|
];
|
||||||
|
return $this->fail($response , 409);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public function orm($reqid) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "select r.REFFID, r.LOC, p.PATNUMBER, p.FIRSTNAME, p.LASTNAME, p.BIRTHDATE, p.SEX, r.REQNUMBER, r.REQDATE, r.AGENT, r.DOC
|
||||||
|
from cmod.dbo.CM_TM_REQUESTS r
|
||||||
|
left join cmod.dbo.CM_TM_PATIENTS p on p.PATID=r.PATID
|
||||||
|
where r.REQID='$reqid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$res = $results[0];
|
||||||
|
|
||||||
|
$reffid = $res['REFFID'];
|
||||||
|
$patnumber = $res['PATNUMBER'];
|
||||||
|
$loc = $res['LOC'];
|
||||||
|
$firstname = $res['FIRSTNAME'];
|
||||||
|
$lastname = $res['LASTNAME'];
|
||||||
|
$dob = $res['BIRTHDATE'];
|
||||||
|
$sex = $res['SEX'];
|
||||||
|
$hosp = $res['REQNUMBER'];
|
||||||
|
$reqdate = $res['REQDATE'];
|
||||||
|
$time = Time::createFromFormat('Y-m-d\TH:i:s.u\Z', $reqdate, 'UTC'); //2024-10-19T00:47:06.424654Z
|
||||||
|
// Denpasar
|
||||||
|
$time = $time->setTimezone('Asia/Shanghai');
|
||||||
|
$reqdate= date_format($time, 'YmdHi');
|
||||||
|
$agent = $res['AGENT'];
|
||||||
|
$doc = $res['DOC'];
|
||||||
|
$orm = "MSH|^~\&|PBMC|TM|TDNL||||ORM^O01^|||2.3||||\r";
|
||||||
|
$orm .= "PID|1||$patnumber^^^^PATNUMBER||$firstname^$lastname^^^^^L||$dob|$sex||^|^^||||||^||||||||||||||||\r";
|
||||||
|
$orm .= "PV1|||$loc^^^||||$doc|$doc||||||||||||||||||||||||||||||||||||$reqdate||||||||||\r";
|
||||||
|
#$orm +=
|
||||||
|
|
||||||
|
$sql = "select t.TESTSTATUS, m.LISCODE from cmod.dbo.CM_TM_TESTS t
|
||||||
|
left join cmod.dbo.CM_DICT_MAPPINGS m on m.HISCODE=t.HISCODE
|
||||||
|
where t.REQID='$reqid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$i = 1;
|
||||||
|
foreach($results as $qdata) {
|
||||||
|
$liscode = $qdata['LISCODE'];
|
||||||
|
$status = $qdata['TESTSTATUS'];
|
||||||
|
if($liscode != '') {
|
||||||
|
if($status!=1 || $status !=2) {$status="NW";} else {$status="CA";}
|
||||||
|
$orm .= "ORC|$status|$reffid||$reffid|||^^^$reqdate|||||$loc|$doc||$reqdate|||||||||\r";
|
||||||
|
$orm .= "OBR|$i|||$liscode|||||||R|||$reqdate||$loc|||||||||||^^^^^R||||||||||||||\r";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<pre>$orm \r";
|
||||||
|
|
||||||
|
/*
|
||||||
|
MSH|^~\&|LISTHOST|LISTHOST.SEND|||202501171415||ORM^O01|01250101080|P|2.3
|
||||||
|
PID|||0111126100014955^^^^PATNUMBER||TJOENG VINCENTIUS MINARDI, MR^^^^^^L||19611211|M|||GRAHA FAMILY PP-9^^SURABAYA||0811300341^^TELEPHON~^^TELEPHON2~^^FAX~^^EMAIL^BERTINAMARTEN@GMAIL.COM|||||||||||||||||||
|
||||||
|
PV1|||WALK^2^^||||L0038|L0038||||||||||||||||||||||||||||||||||||202501171102||||||||||
|
||||||
|
ORC|CA|01250101080||01250101080|||^^^202501170000|||||L0038|WALK||202501171102|||||||||
|
||||||
|
OBR|1|||16549^^Konsultasi dr.Nunki|||||||R|||202501171102||L0038|||||||||||^^^^^R||||||||||||||
|
||||||
|
|
||||||
|
MSH|^~\&|RSML|HOST|TD-Synergy|202501201926|||ORM^O01||||||||||||
|
||||||
|
PID|||75.91.81^^^^PATNUMBER||Kasiyani Ny^^^^^^L||19480806|F|||Sumberwudi RT5 RW2 Sumberwudi Karanggeneng Lamonga^^^^^||^^~^^||||||||||||||
|
||||||
|
NTE|||Tamise Ny/Kardiyo Tn
|
||||||
|
PV1|||IGD||||1644||||||||||||2596973|||||||||||||||||||||||||202501201926||||||||
|
||||||
|
ORC|NW|||1319798|||^^^202501201926|||||1644|IGD||||202501201926||||||||
|
||||||
|
NTE|||-
|
||||||
|
NTE|||Candra Dewi K. dr. Sp.PK
|
||||||
|
NTE|||
|
||||||
|
OBR|1|||UREA||||||||||||||||||||||||||||||||||||
|
||||||
|
ORC|NW|||1319798|||^^^202501201926|||||1644|IGD||||202501201926||||||||
|
||||||
|
OBR|2|||CL||||||||||||||||||||||||||||||||||||
|
||||||
|
ORC|NW|||1319798|||^^^202501201926|||||1644|IGD||||202501201926||||||||
|
||||||
|
OBR|3|||AGDG||||||||||||||||||||||||||||||||||||
|
||||||
|
ORC|NW|||1319798|||^^^202501201926|||||1644|IGD||||202501201926||||||||
|
||||||
|
OBR|4|||GGPH||||||||||||||||||||||||||||||||||||
|
||||||
|
|
||||||
|
MSH|^~\&|PBMC|TM|TDNL||||ORM^O01^|||2.3||||
|
||||||
|
PID|1||^^^^PATNUMBER||^^^^^^L|||||^|^^||||||^||||||||||||||||
|
||||||
|
PV1|1||||||||||||||||||||||||||||||||||||||||||||
|
||||||
|
ORC|NW||||||^^^|||||||||||||
|
||||||
|
OBR|||||||||||||||||||||||||||^^^^^R|
|
||||||
|
|
||||||
|
var reqid = msg['reqid'].toString();
|
||||||
|
var reffid = msg['reffid'].toString();
|
||||||
|
var reqnumber = msg['reqnumber'].toString();
|
||||||
|
var patnumber = msg['patnumber'].toString();
|
||||||
|
var loc = msg['loc'].toString();
|
||||||
|
var doc = msg['doc'].toString();
|
||||||
|
var firstname = msg['firstname'].toString();
|
||||||
|
var lastname = msg['lastname'].toString();
|
||||||
|
var birthdate = msg['birthdate'].toString();
|
||||||
|
var sex = msg['sex'].toString();
|
||||||
|
sex = sex.substr(0,1);
|
||||||
|
var reqdate = msg['reqdate'].toString();
|
||||||
|
var agent = msg['agent'].toString();
|
||||||
|
|
||||||
|
curdate = DateUtil.getCurrentDate('yyyyMMddHHmm');
|
||||||
|
if(loc=='PBMC Bali') {
|
||||||
|
location = 'PADMA'; doctor='PBDPS';
|
||||||
|
} else {
|
||||||
|
location = 'PBSBY'; doctor='PBSBY';
|
||||||
|
curdate = curdate-100;
|
||||||
|
}
|
||||||
|
|
||||||
|
//DOB
|
||||||
|
var DOB = birthdate;
|
||||||
|
DOB=DOB.substr(0,4)+DOB.substr(5,2)+DOB.substr(8,2);
|
||||||
|
tmp['PID']['PID.7']['PID.7.1'] = DOB;
|
||||||
|
|
||||||
|
//ADT
|
||||||
|
tmp['MSH']['MSH.9']['MSH.9.1'] = 'ADT';
|
||||||
|
tmp['MSH']['MSH.9']['MSH.9.2'] = 'A08';
|
||||||
|
tmp['MSH']['MSH.7']['MSH.7.1'] = curdate;//timestamp
|
||||||
|
tmp['PV1']['PV1.44']['PV1.44.1'] = curdate;//admitdatetime
|
||||||
|
tmp['PID']['PID.3']['PID.3.1'] = patnumber;//patnum
|
||||||
|
tmp['PID']['PID.5']['PID.5.1'] = firstname;//firstname
|
||||||
|
tmp['PID']['PID.5']['PID.5.2'] = lastname;//lastname
|
||||||
|
tmp['PID']['PID.7']['PID.7.1'] = DOB;//Date of Birth
|
||||||
|
tmp['PID']['PID.8']['PID.8.1'] = sex.toUpperCase();//sex
|
||||||
|
|
||||||
|
tmp['PV1']['PV1.3']['PV1.3.1'] = location;//lokasi
|
||||||
|
tmp['PV1']['PV1.7']['PV1.7.1'] = doctor;//dokter
|
||||||
|
tmp['PV1']['PV1.8']['PV1.8.1'] = doctor;//dokter
|
||||||
|
tmp['PV1']['PV1.19']['PV1.19.1'] = reqnumber;
|
||||||
|
tmp['ORC']['ORC.2']['ORC.2.1'] = reffid;
|
||||||
|
tmp['ORC']['ORC.4']['ORC.4.1'] = reffid;
|
||||||
|
tmp['ORC']['ORC.7']['ORC.7.4'] = curdate;//coldatetime
|
||||||
|
tmp['ORC']['ORC.12']['ORC.12.1'] = doctor;//dokter
|
||||||
|
tmp['ORC']['ORC.13']['ORC.13.1'] = location;//lokasi
|
||||||
|
tmp['ORC']['ORC.15']['ORC.15.1'] = curdate;//timestamp
|
||||||
|
|
||||||
|
//var ADT = '<HL7Message>'+tmp['MSH']+tmp['PID']+tmp['PV1']+'</HL7Message>';
|
||||||
|
//logger.info(ADT);
|
||||||
|
//ADT = SerializerFactory.getSerializer('HL7V2').fromXML(ADT);
|
||||||
|
//channelMap.put('ADT',ADT);
|
||||||
|
|
||||||
|
//ORM
|
||||||
|
tmp['MSH']['MSH.9']['MSH.9.1'] = 'ORM';
|
||||||
|
tmp['MSH']['MSH.9']['MSH.9.2'] = 'O01';
|
||||||
|
tmp['MSH']['MSH.10']['MSH.10.1'] = reffid;
|
||||||
|
|
||||||
|
var sql = "select t.*, m.LISCODE from cmod.dbo.CM_TM_TESTS t"+
|
||||||
|
" left join cmod.dbo.CM_DICT_MAPPINGS m on m.HISCODE=t.HISCODE"+
|
||||||
|
" where t.REQID='"+reqid+"'";
|
||||||
|
var results = dbConn.executeCachedQuery(sql);
|
||||||
|
|
||||||
|
var i=0;
|
||||||
|
var obr = tmp['OBR'];
|
||||||
|
var orc = tmp['ORC'];
|
||||||
|
|
||||||
|
while(results.next()) {
|
||||||
|
var testcode=results.getString('LISCODE');
|
||||||
|
var status = results.getString('TESTSTATUS');
|
||||||
|
if(testcode != '' && testcode != null) {
|
||||||
|
tmp['ORC'][i]=orc;
|
||||||
|
if(status == '1' || status == '2') {
|
||||||
|
tmp['ORC'][i]['ORC.1']['ORC.1.1']="CA";
|
||||||
|
} else {
|
||||||
|
tmp['ORC'][i]['ORC.1']['ORC.1.1']="NW";
|
||||||
|
}
|
||||||
|
tmp['OBR'][i]=obr;
|
||||||
|
tmp['OBR'][i]['OBR.1']['OBR.1.1']=i+1;
|
||||||
|
tmp['OBR'][i]['OBR.4']['OBR.4.1']=testcode;
|
||||||
|
tmp['OBR'][i]['OBR.14']['OBR.14.1']=curdate;
|
||||||
|
tmp['OBR'][i]['OBR.16']['OBR.16.1']=doctor;
|
||||||
|
tmp['OBR'][i]['OBR.27']['OBR.27.6']='R';
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
130
app/Controllers/API_Results.php
Normal file
130
app/Controllers/API_Results.php
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use CodeIgniter\RESTful\ResourceController;
|
||||||
|
use CodeIgniter\I18n\Time;
|
||||||
|
use Ramsey\Uuid\Uuid;
|
||||||
|
|
||||||
|
class API_Results extends ResourceController {
|
||||||
|
|
||||||
|
public function results($accessnumber) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
$sql = "select HOSTORDERNUMBER as VISITNUMBER from SP_REQUESTS where SP_ACCESSNUMBER='$accessnumber'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
|
||||||
|
$visitnumber = $results[0]['VISITNUMBER'];
|
||||||
|
|
||||||
|
// $sql = "select TESTCODE, TESTORDER, RESTYPE, RESVALUE, RESFLAG, UNIT, REFRANGE, USERVAL, RESDATE
|
||||||
|
// from cmod.dbo.CM_RESULTS r
|
||||||
|
// where ACCESSNUMBER='$accessnumber'
|
||||||
|
// order by TESTORDER";
|
||||||
|
// $query = $db->query($sql);
|
||||||
|
// $results = $query->getResultArray();
|
||||||
|
|
||||||
|
|
||||||
|
$sql = "SELECT sp.HOSTORDERNUMBER, hiso.LOC, hiso.PAYERNAME
|
||||||
|
FROM dbo.SP_REQUESTS sp
|
||||||
|
LEFT JOIN cmod.dbo.CM_HIS_ORDERS hiso ON hiso.VISITNUMBER = sp.HOSTORDERNUMBER
|
||||||
|
WHERE SP_ACCESSNUMBER = '$accessnumber'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
|
||||||
|
|
||||||
|
$location = $results[0]['LOC'] == null ? 'PBMC Bali' : 'PBMC Surabaya';
|
||||||
|
$payer_name = $results[0]['PAYERNAME'] == null ? '' : $results[0]['PAYERNAME'];
|
||||||
|
|
||||||
|
$response = [
|
||||||
|
"headers" => [
|
||||||
|
"Content-Type" => "application/json",
|
||||||
|
"Authorization" => "Transmedic api key"
|
||||||
|
],
|
||||||
|
"data" => [
|
||||||
|
"reference_id" => " - ",
|
||||||
|
"created" => " - ",
|
||||||
|
"company_name" => $payer_name,
|
||||||
|
"branch" => $location,
|
||||||
|
"test_results" => []
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$sql = "select
|
||||||
|
dc.CHAPID,
|
||||||
|
t.DEPTH as depth_test,
|
||||||
|
dc.FULLTEXT as chap_eng,
|
||||||
|
dc.FULLTEXT as chap_ind,
|
||||||
|
st.FULLTEXT as serum_type,
|
||||||
|
cdt.TEXT1 as test_eng,
|
||||||
|
cdt.TEXT2 as test_ind,
|
||||||
|
cdt.UNIT as UNITTEXT,
|
||||||
|
cdt.REFFTEXT,
|
||||||
|
t.NOTPRINTABLE,
|
||||||
|
t.TESTORDER,
|
||||||
|
t.RESTYPE as code_type,
|
||||||
|
t.VALIDATIONINITIALS as validator,
|
||||||
|
dt.SHORTTEXT,
|
||||||
|
RESULT = case when t.RESVALUE is null then tx.FULLTEXT else t.RESVALUE end,
|
||||||
|
cr.*
|
||||||
|
from REQUESTS r
|
||||||
|
left join TESTS t on t.REQUESTID = r.REQUESTID
|
||||||
|
left join DICT_TESTS dt on dt.ENDVALIDDATE is null and t.TESTID=dt.TESTID
|
||||||
|
left join DICT_TEXTS tx on tx.TEXTID=t.CODEDRESULTID
|
||||||
|
left join DICT_CHAPTERS dc on dc.CHAPID=dt.CHAPID and dc.ENDVALIDDATE is null
|
||||||
|
left join DICT_TEST_SAMPLES ts on ts.TESTID=t.TESTID and dt.TESTID=ts.TESTID
|
||||||
|
left join DICT_SAMPLES_TYPES st on st.SAMPTYPEID=ts.SAMPTYPEID
|
||||||
|
left join cmod.dbo.CM_DICT_TESTS cdt on dt.TESTCODE=cdt.TESTCODE
|
||||||
|
left join cmod.dbo.CM_RESULTS cr on cr.ACCESSNUMBER=r.ACCESSNUMBER and cr.TESTCODE=cdt.TESTCODE and cr.TESTCODE=dt.TESTCODE
|
||||||
|
where r.ACCESSNUMBER='$accessnumber'
|
||||||
|
ORDER BY dc.CHAPID, depth_test, t.TESTORDER";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$test_results = $query->getResultArray();
|
||||||
|
// 5010200007
|
||||||
|
// Digunakan Untuk Hasil test
|
||||||
|
foreach ($test_results as $result) {
|
||||||
|
|
||||||
|
if ($result['depth_test'] === 0) {
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
"test_ref_id"=> " - TM ",
|
||||||
|
"service_id"=> "",
|
||||||
|
"service_name"=> $result['test_eng'],
|
||||||
|
"test_medium"=> $result['serum_type'],
|
||||||
|
"test_container"=> "",
|
||||||
|
"chapter_type"=> $result['chap_eng'],
|
||||||
|
"test_summary"=> "",
|
||||||
|
"status"=> "",
|
||||||
|
"subtest_results" => [],
|
||||||
|
];
|
||||||
|
|
||||||
|
array_push($response['data']['test_results'], $data);
|
||||||
|
|
||||||
|
} else if ($result['depth_test'] === 1) {
|
||||||
|
|
||||||
|
// $uuid = Uuid::uuid4()->toString();
|
||||||
|
|
||||||
|
// $data = [
|
||||||
|
// "subtest_ref_id"=> $uuid,
|
||||||
|
// "subtest_name"=> $result['SHORTTEXT'],
|
||||||
|
// "subtest_uom"=> $result['TESTCODE'],
|
||||||
|
// "subtest_lower_limit"=> "",
|
||||||
|
// "subtest_upper_limit"=> "",
|
||||||
|
// "subtest_critical_lower_limit"=> "",
|
||||||
|
// "subtest_critiacl_upper_limit"=> "",
|
||||||
|
// "subtest_result"=> "",
|
||||||
|
// "subtest_summary"=> "",
|
||||||
|
// "sub_subtest_results" => [],
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// array_push($response['data']['test_results']['subtest_results'], $data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this->respond($response,200);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,585 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace App\Controllers;
|
|
||||||
|
|
||||||
use CodeIgniter\RESTful\ResourceController;
|
|
||||||
use CodeIgniter\I18n\Time;
|
|
||||||
|
|
||||||
class API_TM extends ResourceController {
|
|
||||||
|
|
||||||
public function __construct() {
|
|
||||||
$this->url_resultSBY = 'http://10.10.4.123:8001/api/webhook/lis?tenant=PadmaSurabaya';
|
|
||||||
$this->url_resultDPS = 'http://10.10.4.123:8001/api/webhook/lis?tenant=PadmaBali';
|
|
||||||
$this->url_masterSBY = "http://10.10.4.123:8001/api/webhook/lis-new-master?tenant=PadmaSurabaya";
|
|
||||||
$this->url_masterDPS = "http://10.10.4.123:8001/api/webhook/lis-new-master?tenant=PadmaBali";
|
|
||||||
}
|
|
||||||
|
|
||||||
public function sendHL7Message($host, $port, $message, $timeout = 5) {
|
|
||||||
try {
|
|
||||||
// Create a TCP/IP socket
|
|
||||||
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
|
||||||
if ($socket === false) {
|
|
||||||
throw new Exception("socket_create() failed: " . socket_strerror(socket_last_error()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set socket options (timeout)
|
|
||||||
socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array("sec" => $timeout, "usec" => 0));
|
|
||||||
socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array("sec" => $timeout, "usec" => 0));
|
|
||||||
|
|
||||||
// Connect to the remote host
|
|
||||||
$result = socket_connect($socket, $host, $port);
|
|
||||||
if ($result === false) {
|
|
||||||
throw new Exception("socket_connect() failed: " . socket_strerror(socket_last_error($socket)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add MLLP framing (Minimal Lower Layer Protocol)
|
|
||||||
$mllpMessage = chr(0x0B) . $message . chr(0x1C) . chr(0x0D);
|
|
||||||
|
|
||||||
// Send the message
|
|
||||||
$bytesSent = socket_write($socket, $mllpMessage, strlen($mllpMessage));
|
|
||||||
if ($bytesSent === false) {
|
|
||||||
throw new Exception("socket_write() failed: " . socket_strerror(socket_last_error($socket)));
|
|
||||||
}
|
|
||||||
if($bytesSent != strlen($mllpMessage)){
|
|
||||||
throw new Exception("socket_write() only sent $bytesSent bytes out of ". strlen($mllpMessage));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read the acknowledgement (optional but recommended)
|
|
||||||
$ack = socket_read($socket, 8192); // Adjust buffer size as needed
|
|
||||||
if ($ack === false) {
|
|
||||||
// Handle cases where no ACK is received within the timeout
|
|
||||||
throw new Exception("socket_read() failed or timed out: " . socket_strerror(socket_last_error($socket)));
|
|
||||||
}
|
|
||||||
|
|
||||||
//Close the socket
|
|
||||||
socket_close($socket);
|
|
||||||
|
|
||||||
//Basic ACK check. More robust parsing is recommended.
|
|
||||||
if (strpos($ack, "MSA") !== false) {
|
|
||||||
return true; // Success (basic ACK check)
|
|
||||||
} else {
|
|
||||||
error_log("Unexpected ACK: " . $ack); // Log the unexpected ACK
|
|
||||||
return false; // Failure (unexpected ACK)
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception $e) {
|
|
||||||
error_log("HL7 Sending Error: " . $e->getMessage()); // Log the error
|
|
||||||
if(isset($socket)){
|
|
||||||
socket_close($socket); // Ensure socket closure on error
|
|
||||||
}
|
|
||||||
return false; // Indicate failure
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function requests() {
|
|
||||||
$db = \Config\Database::connect();
|
|
||||||
$raw = $this->request->getVar();
|
|
||||||
|
|
||||||
// log to cm_tm_logs
|
|
||||||
$data = str_replace("'","''",json_encode($raw));
|
|
||||||
$sql = "INSERT INTO cmod.dbo.CM_TM_LOGS (URL, METHOD, BODY, LOGDATE) VALUES ('API/REQUESTS', 'POST', '$data', GETDATE())";
|
|
||||||
$db->query($sql);
|
|
||||||
|
|
||||||
$data = array();
|
|
||||||
$qdata = (array)$raw;
|
|
||||||
$qpat = (array)$qdata['patient'];
|
|
||||||
|
|
||||||
//patdata
|
|
||||||
$rm = $qpat['rm_number'];
|
|
||||||
$firstname = str_replace("'","''",$qpat['patient_first_name']);
|
|
||||||
$lastname = str_replace("'","''",$qpat['patient_last_name']);
|
|
||||||
$dob = $qpat['patient_dob'];
|
|
||||||
$dob = str_replace("-","",$dob);
|
|
||||||
$sex = $qpat['patient_sex'];
|
|
||||||
$phone = $qpat['patient_phone'];
|
|
||||||
|
|
||||||
//reqdata
|
|
||||||
$reffid = $qdata['reference_id'];
|
|
||||||
$company = $qdata['company_name'];
|
|
||||||
$loc = $qdata['branch'];
|
|
||||||
if(isset($qdata['status'])) {
|
|
||||||
$status = $qdata['status'];
|
|
||||||
} else { $status='order'; }
|
|
||||||
if($status == 'order') { $reqstatus = '0'; }
|
|
||||||
else { $reqstatus = '1'; }
|
|
||||||
|
|
||||||
$visitnum = $qpat['visit_number'];
|
|
||||||
$visitdesc = $qpat['visit_description'];
|
|
||||||
$visittype = $qpat['visit_type'];
|
|
||||||
$visitdt = $qpat['visit_date_time'];
|
|
||||||
$agentname = str_replace("'","''",$qpat['agent_name']);
|
|
||||||
$doc = str_replace("'","''",$qpat['treating_doctor']);
|
|
||||||
|
|
||||||
$createdt = $qdata['created'];
|
|
||||||
$qant = (array)$qpat['anthropometry'];
|
|
||||||
$bw = $qant['weight'];
|
|
||||||
$bh = $qant['height'];
|
|
||||||
|
|
||||||
$sql = "select PATID, FIRSTNAME, LASTNAME from cmod.dbo.CM_TM_PATIENTS where PATNUMBER='$rm'";
|
|
||||||
$query = $db->query($sql);
|
|
||||||
$result = $query->getResultArray();
|
|
||||||
if(isset($result[0])) {
|
|
||||||
$patid = $result[0]['PATID'];
|
|
||||||
$rfirstname = str_replace("'","''",$result[0]['FIRSTNAME']);
|
|
||||||
$rlastname = str_replace("'","''",$result[0]['LASTNAME']);
|
|
||||||
} else { $patid = ''; }
|
|
||||||
|
|
||||||
$sql = "select REQID, PATID, REQNUMBER from cmod.dbo.CM_TM_REQUESTS where REFFID='$reffid'";
|
|
||||||
$query = $db->query($sql);
|
|
||||||
$result = $query->getResultArray();
|
|
||||||
if(isset($result[0])) {
|
|
||||||
$reqid = $result[0]['REQID'];
|
|
||||||
$rpatid = $result[0]['PATID'];
|
|
||||||
$rvisitnum = $result[0]['REQNUMBER'];
|
|
||||||
}
|
|
||||||
else { $reqid = ''; $rpatid = ''; }
|
|
||||||
|
|
||||||
//echo "$patid<br/>$reqid - $rpatid";
|
|
||||||
|
|
||||||
//check receive
|
|
||||||
$sql = "select recv=case when exists (select * from PADMA.dbo.SP_TUBES t
|
|
||||||
left join PADMA.dbo.SP_REQUESTS r on r.SP_ACCESSNUMBER=t.SP_ACCESSNUMBER
|
|
||||||
where r.HOSTORDERNUMBER='$reffid' and TUBESTATUS=4) then 1 else 0 end";
|
|
||||||
$query = $db->query($sql);
|
|
||||||
$result = $query->getResultArray();
|
|
||||||
$recv = $result[0]['recv'];
|
|
||||||
|
|
||||||
// check data patient
|
|
||||||
if($patid == '') { // new patient
|
|
||||||
$sql = "INSERT INTO cmod.dbo.CM_TM_PATIENTS (PATNUMBER, FIRSTNAME, LASTNAME, BIRTHDATE, SEX, PHONE ) VALUES ('$rm', '$firstname', '$lastname', '$dob', '$sex', '$phone' )";
|
|
||||||
$db->query($sql); $patid = $db->insertID();
|
|
||||||
} else { // existing patient
|
|
||||||
if( $rfirstname==$firstname && $rlastname == $lastname ) { // if patient is the same
|
|
||||||
if($recv == 0) {
|
|
||||||
$sql = "UPDATE cmod.dbo.CM_TM_PATIENTS SET FIRSTNAME='$firstname', LASTNAME='$lastname', BIRTHDATE='$dob', SEX='$sex', PHONE='$phone' where PATID='$patid'";
|
|
||||||
$db->query($sql);
|
|
||||||
} else {
|
|
||||||
return $this->failForbidden('Error. Sample already received, cannot update patient data. ');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return $this->failForbidden("Error. Invalid patient data. $rfirstname <> $firstname.$rlastname <> $lastname");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check f-in visit#
|
|
||||||
if(isset($rvisitnum)) {
|
|
||||||
if($rvisitnum != '' && $rvisitnum != $visitnum) {
|
|
||||||
return $this->failForbidden("Error. Invalid Visit#.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if($reqstatus != 1) { // reqstatus = order
|
|
||||||
if( $reqid == '' ) { // new request
|
|
||||||
$sql = "INSERT INTO cmod.dbo.CM_TM_REQUESTS (REFFID, REQNUMBER, REQDATE, AGENT, DOC, LOC, PATID, COMPANY, LOGDATE, BW, BH, VISITDESC, VISITTYPE, REQSTATUS)
|
|
||||||
VALUES ('$reffid', '$visitnum', '$visitdt', '$agentname', '$doc', '$loc', '$patid', '$company', '$createdt', '$bw', '$bh', '$visitdesc', '$visittype', '$reqstatus' )";
|
|
||||||
$db->query($sql);
|
|
||||||
$reqid = $db->insertID();
|
|
||||||
} else { // existing request
|
|
||||||
if($recv == 0) {
|
|
||||||
$sql = "UPDATE cmod.dbo.CM_TM_REQUESTS SET REQNUMBER='$visitnum', REQDATE='$visitdt', AGENT='$agentname', DOC='$doc', LOC='$loc', PATID='$patid',
|
|
||||||
COMPANY='$company',LOGDATE='$createdt', BW='$bw', BH='$bh', VISITDESC='$visitdesc', VISITTYPE='$visittype', REQSTATUS='$reqstatus'
|
|
||||||
where REQID='$reqid'";
|
|
||||||
$db->query($sql);
|
|
||||||
} else {
|
|
||||||
return $this->failForbidden('Error. Sample already received, cannot update request data. ');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
if($patid == '') { // new patient
|
|
||||||
$sql = "INSERT INTO cmod.dbo.CM_TM_PATIENTS (PATNUMBER, FIRSTNAME, LASTNAME, BIRTHDATE, SEX, PHONE ) VALUES ('$rm', '$firstname', '$lastname', '$dob', '$sex', '$phone' )";
|
|
||||||
$db->query($sql); $patid = $db->insertID();
|
|
||||||
} else { // existing patient
|
|
||||||
$sql = "UPDATE cmod.dbo.CM_TM_PATIENTS SET FIRSTNAME='$firstname', LASTNAME='$lastname', BIRTHDATE='$dob', SEX='$sex', PHONE='$phone' where PATID='$patid'";
|
|
||||||
$db->query($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($reqstatus != 1) { // reqstatus = order
|
|
||||||
if( $reqid == '' ) { // new request
|
|
||||||
$sql = "INSERT INTO cmod.dbo.CM_TM_REQUESTS (REFFID, REQNUMBER, REQDATE, AGENT, DOC, LOC, PATID, COMPANY, LOGDATE, BW, BH, VISITDESC, VISITTYPE, REQSTATUS)
|
|
||||||
VALUES ('$reffid', '$visitnum', '$visitdt', '$agentname', '$doc', '$loc', '$patid', '$company', '$createdt', '$bw', '$bh', '$visitdesc', '$visittype', '$reqstatus' )";
|
|
||||||
$db->query($sql);
|
|
||||||
$reqid = $db->insertID();
|
|
||||||
} else { // existing request
|
|
||||||
$sql = "UPDATE cmod.dbo.CM_TM_REQUESTS SET REQNUMBER='$visitnum', REQDATE='$visitdt', AGENT='$agentname', DOC='$doc', LOC='$loc', PATID='$patid',
|
|
||||||
COMPANY='$company',LOGDATE='$createdt', BW='$bw', BH='$bh', VISITDESC='$visitdesc', VISITTYPE='$visittype', REQSTATUS='$reqstatus'
|
|
||||||
where REQID='$reqid'";
|
|
||||||
$db->query($sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// tests
|
|
||||||
$tests = json_decode(json_encode($qpat['tests']), true);;
|
|
||||||
$string = '';
|
|
||||||
if($status=='order') { $teststatus = 0;}
|
|
||||||
else { $teststatus = 1; }
|
|
||||||
foreach($tests as $test) {
|
|
||||||
$testcode = $test['service_id'];
|
|
||||||
$testreffid = $test['test_ref_id'];
|
|
||||||
$string .= "( '$testreffid', '$reqid', '$testcode', '$teststatus' ),";
|
|
||||||
}
|
|
||||||
$string = rtrim($string, ',');
|
|
||||||
//$sql = "INSERT INTO cmod.dbo.CM_TM_TESTS(REFFID, REQID, HISCODE) VALUES $string";
|
|
||||||
$sql = "INSERT INTO cmod.dbo.CM_TM_TESTS (REFFTESTID, REQID, HISCODE, TESTSTATUS)
|
|
||||||
SELECT S.REFFTESTID, S.REQID, S.HISCODE, S.TESTSTATUS FROM ( VALUES $string ) AS S (REFFTESTID, REQID, HISCODE, TESTSTATUS)
|
|
||||||
WHERE NOT EXISTS ( SELECT 1 FROM cmod.dbo.CM_TM_TESTS T WHERE T.REQID = S.REQID AND T.HISCODE = S.HISCODE );";
|
|
||||||
$db->query($sql);
|
|
||||||
|
|
||||||
$sql = "UPDATE cmod.dbo.CM_TM_TESTS SET TESTSTATUS = S.TESTSTATUS
|
|
||||||
FROM cmod.dbo.CM_TM_TESTS T
|
|
||||||
INNER JOIN ( VALUES $string ) AS S (REFFTESTID, REQID, HISCODE, TESTSTATUS)
|
|
||||||
ON T.REQID = S.REQID AND T.HISCODE = S.HISCODE;";
|
|
||||||
$db->query($sql);
|
|
||||||
|
|
||||||
//sendORM
|
|
||||||
$this->orm($reqid);
|
|
||||||
|
|
||||||
return $this->respond(201);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function orm($reqid) {
|
|
||||||
$db = \Config\Database::connect();
|
|
||||||
$sql = "select r.REFFID, r.LOC, p.PATNUMBER, p.FIRSTNAME, p.LASTNAME, p.BIRTHDATE, p.SEX, p.PHONE,
|
|
||||||
r.REQNUMBER, r.REQDATE, r.AGENT, r.DOC, r.BW, r.BH
|
|
||||||
from cmod.dbo.CM_TM_REQUESTS r
|
|
||||||
left join cmod.dbo.CM_TM_PATIENTS p on p.PATID=r.PATID
|
|
||||||
where r.REQID='$reqid'";
|
|
||||||
$query = $db->query($sql);
|
|
||||||
$results = $query->getResultArray();
|
|
||||||
$res = $results[0];
|
|
||||||
|
|
||||||
$reffid = $res['REFFID'];
|
|
||||||
$patnumber = $res['PATNUMBER'];
|
|
||||||
$loc = $res['LOC'];
|
|
||||||
$doc = $res['DOC'];
|
|
||||||
$firstname = $res['FIRSTNAME'];
|
|
||||||
$lastname = $res['LASTNAME'];
|
|
||||||
$dob = $res['BIRTHDATE'];
|
|
||||||
$sex = substr($res['SEX'],0,1);
|
|
||||||
$hosp = $res['REQNUMBER'];
|
|
||||||
$reqdate = $res['REQDATE'];
|
|
||||||
$time = Time::createFromFormat('Y-m-d\TH:i:s.u\Z', $reqdate, 'UTC'); //2024-10-19T00:47:06.424654Z
|
|
||||||
$agent = $res['AGENT'];
|
|
||||||
$bw = $res['BW'];
|
|
||||||
$bh = $res['BH'];
|
|
||||||
$phone = $res['PHONE'];
|
|
||||||
|
|
||||||
// LOC
|
|
||||||
//if($loc == "PBMC Bali") {
|
|
||||||
if($loc == "PMG Bali" || $loc == "PBMC Bali") {
|
|
||||||
$loc = "PADMA"; $doc = "PBDPS";
|
|
||||||
$time = $time->setTimezone('Asia/Shanghai');
|
|
||||||
$reqdate= date_format($time, 'YmdHi');
|
|
||||||
$port = "8101";
|
|
||||||
} else {
|
|
||||||
$loc = "PBSBY"; $doc = "PBSBY";
|
|
||||||
$time = $time->setTimezone('Asia/Jakarta');
|
|
||||||
$reqdate= date_format($time, 'YmdHi');
|
|
||||||
$port = "8201";
|
|
||||||
}
|
|
||||||
|
|
||||||
$orm = "MSH|^~\&|PBMC|TM|TDNL||||ORM^O01^|||2.3||||\r";
|
|
||||||
$orm .= "PID|1||$patnumber^^^^PATNUMBER||$lastname^$firstname^^^^^L||$dob|$sex||^|^^||$phone^^TELEPHON||||^||||||||||||||||\r";
|
|
||||||
//$orm .= "PV1|||$loc^^^||||$doc|$doc|||||||||||$hosp|||||||||||||||||||||||||$reqdate||||||||||\r";
|
|
||||||
$orm .= "PV1|||$loc^^^||||$doc|$doc||||||||||||||||||||||||||||||||||||$reqdate||||||||||\r";
|
|
||||||
|
|
||||||
$sql = "select t.TESTSTATUS, m.LISCODE from cmod.dbo.CM_TM_TESTS t
|
|
||||||
left join cmod.dbo.CM_DICT_MAPPINGS m on m.HISCODE=t.HISCODE
|
|
||||||
where t.REQID='$reqid'";
|
|
||||||
$query = $db->query($sql);
|
|
||||||
$results = $query->getResultArray();
|
|
||||||
$i = 1;
|
|
||||||
foreach($results as $qdata) {
|
|
||||||
$liscode = $qdata['LISCODE'];
|
|
||||||
$status = $qdata['TESTSTATUS'];
|
|
||||||
if($liscode != '') {
|
|
||||||
if($status!=1 || $status !=2) {$status="NW";} else {$status="CA";}
|
|
||||||
//if($status!='CANCEL') {$status="NW";} else {$status="CA";}
|
|
||||||
$orm .= "ORC|$status|$reffid||$reffid|||^^^$reqdate|||||$doc|$loc||$reqdate|||||||||\r";
|
|
||||||
if($i==1) { $orm .= "NTE|1||$hosp|\r"; }
|
|
||||||
$orm .= "OBR|$i|||$liscode|||||||R|||||$doc|||||||||||||||||||||||||\r";
|
|
||||||
$i++;
|
|
||||||
if($liscode=="EGFR") {
|
|
||||||
$orm .= "OBX||NM|BW||$bw|\r";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//echo "$orm";
|
|
||||||
//sendHL7Message($host, $port, $message, $timeout = 5);
|
|
||||||
$this->sendHL7Message( "localhost", $port, $orm, $timeout = 5);
|
|
||||||
//$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function create_result_json($accessnumber) {
|
|
||||||
$db = \Config\Database::connect();
|
|
||||||
$sql = "select r.HOSTORDERNUMBER, r.SP_HOSPNUMBER, cr.REQNUMBER, cr.LOC, cr.COMPANY, cr.AGENT, cr.VISITDESC, cr.VISITTYPE,
|
|
||||||
p.PATNUMBER, cp.LASTNAME, cp.FIRSTNAME, p.BIRTHDATE, p.SEX, p.TELEPHON, r.COLLECTIONDATE, cr.AGENT, cr.DOC, cr.BW, cr.BH
|
|
||||||
from SP_REQUESTS r
|
|
||||||
left join cmod.dbo.CM_TM_REQUESTS cr on cr.REFFID=r.HOSTORDERNUMBER
|
|
||||||
left join PATIENTS p on p.PATID=r.PATID
|
|
||||||
left join cmod.dbo.CM_TM_PATIENTS cp on cp.PATNUMBER=right(p.PATNUMBER,8)
|
|
||||||
where r.SP_ACCESSNUMBER='$accessnumber'";
|
|
||||||
$query = $db->query($sql);
|
|
||||||
$results = $query->getResultArray();
|
|
||||||
|
|
||||||
$visitnumber = $results[0]['REQNUMBER'];
|
|
||||||
$reffid = $results[0]['HOSTORDERNUMBER'];
|
|
||||||
$location = $results[0]['LOC'];
|
|
||||||
$payer_name = $results[0]['AGENT'];
|
|
||||||
$company = $results[0]['COMPANY'];
|
|
||||||
$createdt = gmdate('Y-m-d\TH:i:s.v\Z');
|
|
||||||
$patnumber = substr($results[0]['PATNUMBER'],-9);
|
|
||||||
$firstname = $results[0]['FIRSTNAME'];
|
|
||||||
$lastname = $results[0]['LASTNAME'];
|
|
||||||
$dob = $results[0]['BIRTHDATE'];
|
|
||||||
$sex = $results[0]['SEX'];
|
|
||||||
$phone = $results[0]['TELEPHON'];
|
|
||||||
$visitdesc = $results[0]['VISITDESC'];
|
|
||||||
$visittype = $results[0]['VISITTYPE'];
|
|
||||||
$visitdt = $results[0]['COLLECTIONDATE'];
|
|
||||||
$agent = $results[0]['AGENT'];
|
|
||||||
if($agent != '') {$bagent = true;}
|
|
||||||
else {$bagent=false;}
|
|
||||||
$doctor = $results[0]['DOC'];
|
|
||||||
$bw = $results[0]['BW'];
|
|
||||||
$bh = $results[0]['BH'];
|
|
||||||
|
|
||||||
|
|
||||||
$json = [
|
|
||||||
"reference_id" => "$reffid",
|
|
||||||
"created" => "$createdt",
|
|
||||||
"company_name" => $company,
|
|
||||||
"branch" => $location,
|
|
||||||
"visit_number" => $visitnumber,
|
|
||||||
"patient" => [
|
|
||||||
"rm_number" => $patnumber,
|
|
||||||
"patient_first_name" => $firstname,
|
|
||||||
"patient_last_name" => $lastname,
|
|
||||||
"patient_dob" => $dob,
|
|
||||||
"patient_sex" => $sex,
|
|
||||||
"patient_phone" => $phone,
|
|
||||||
"visit_number" => $visitnumber,
|
|
||||||
"visit_description"=> $visitdesc,
|
|
||||||
"visit_date_time" => $visitdt,
|
|
||||||
"agent_name" => $agent,
|
|
||||||
"agent" => $bagent,
|
|
||||||
"treating_doctor" => $doctor,
|
|
||||||
"visit_type" => $visittype,
|
|
||||||
"anthropometry" => [
|
|
||||||
"weight" => $bw,
|
|
||||||
"height" => $bh,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
"test_results" => [],
|
|
||||||
"collects" => [],
|
|
||||||
"receives" => []
|
|
||||||
];
|
|
||||||
|
|
||||||
$sql = "select dc.CHAPID, t.DEPTH as depth_test, dc.FULLTEXT as chap_eng, dc.FULLTEXT as chap_ind, st.FULLTEXT as serum_type,
|
|
||||||
cdt.TEXT1 as test_eng, cdt.TEXT2 as test_ind, cdt.UNIT as UNITTEXT, cdt.REFFTEXT, t.NOTPRINTABLE, cr.RESSTATUS,
|
|
||||||
t.TESTORDER, t.RESTYPE as code_type, t.VALIDATIONINITIALS as validator, dt.SHORTTEXT,
|
|
||||||
RESULT = case when t.RESVALUE is null then tx.FULLTEXT else t.RESVALUE end, ct.REFFTESTID, m.HISCODE, m.LISCODE,
|
|
||||||
tub.TUBENAME, cr.REFRANGE, dt.TESTCODE, t.TESTORDER, dt.UNITS, cr.RESDATE, cr.USERVAL, u.USERNAME
|
|
||||||
from REQUESTS r
|
|
||||||
left join TESTS t on t.REQUESTID = r.REQUESTID
|
|
||||||
left join DICT_TESTS dt on dt.ENDVALIDDATE is null and t.TESTID=dt.TESTID
|
|
||||||
left join DICT_TEXTS tx on tx.TEXTID=t.CODEDRESULTID
|
|
||||||
left join DICT_CHAPTERS dc on dc.CHAPID=dt.CHAPID and dc.ENDVALIDDATE is null
|
|
||||||
left join DICT_TEST_SAMPLES ts on ts.TESTID=t.TESTID and dt.TESTID=ts.TESTID
|
|
||||||
left join DICT_SAMPLES_TYPES st on st.SAMPTYPEID=ts.SAMPTYPEID
|
|
||||||
left join cmod.dbo.CM_DICT_TESTS cdt on dt.TESTCODE=cdt.TESTCODE
|
|
||||||
left join cmod.dbo.CM_RESULTS cr on cr.ACCESSNUMBER=r.ACCESSNUMBER and cr.TESTCODE=cdt.TESTCODE and cr.TESTCODE=dt.TESTCODE and t.RESUPDDATE=cr.RESDATE
|
|
||||||
left join cmod.dbo.CM_TM_REQUESTS cq on cq.REFFID=r.EXTERNALORDERNUMBER
|
|
||||||
left join cmod.dbo.CM_TM_TESTS ct on ct.REQID=cq.REQID
|
|
||||||
left join cmod.dbo.CM_DICT_MAPPINGS m on m.LISCODE=cr.TESTCODE and m.HISCODE=ct.HISCODE
|
|
||||||
left join cmod.dbo.CM_DICT_TUBES tub on tub.TUBEID=m.TUBEID
|
|
||||||
left join USERS u on u.USERINITIALS=cr.USERVAL
|
|
||||||
where r.ACCESSNUMBER='$accessnumber' and t.NOTPRINTABLE is null ORDER BY t.TESTORDER";
|
|
||||||
$query = $db->query($sql);
|
|
||||||
$test_results = $query->getResultArray();
|
|
||||||
$d0=-1; $d1=-1; $d2=-1; $d3=-1;
|
|
||||||
foreach ($test_results as $result) {
|
|
||||||
$refftestid = trim($result['REFFTESTID']);
|
|
||||||
$testorder = $result['TESTORDER'];
|
|
||||||
if($refftestid == '') { $refftestid = $accessnumber . str_pad($testorder,3,0, STR_PAD_LEFT); }
|
|
||||||
$hiscode = $result['HISCODE'];
|
|
||||||
$tubename = $result['TUBENAME'];
|
|
||||||
$depth = $result['depth_test'];
|
|
||||||
$liscode = $result['LISCODE'];
|
|
||||||
$testcode = $result['TESTCODE'];
|
|
||||||
$testname = $result['test_eng'];
|
|
||||||
$sampletype = $result['serum_type'];
|
|
||||||
$chapter = $result['chap_eng'];
|
|
||||||
$testresult = $result['RESULT'];
|
|
||||||
$unit = $result['UNITS'];
|
|
||||||
$unittext = $result['UNITTEXT'];
|
|
||||||
$testunit = $unit;
|
|
||||||
if($unittext != '') { $testunit = $unittext; }
|
|
||||||
$refrange = $result['REFRANGE'];
|
|
||||||
$refftext = $result['REFFTEXT'];
|
|
||||||
$resstatus = $result['RESSTATUS'];
|
|
||||||
if($resstatus == 'F') { $testsum = 'APPROVE'; }
|
|
||||||
elseif($resstatus == 'C') { $testsum = 'PENDING'; }
|
|
||||||
else { $testsum = null; }
|
|
||||||
if($refftext != '') { $testreff = $refftext; }
|
|
||||||
else { $testreff = $refrange; }
|
|
||||||
if($liscode == '') {$liscode = $testcode;}
|
|
||||||
$resdate = $result['RESDATE'];
|
|
||||||
if($resdate == "1900-01-01 00:00:00.000") { $resdate =''; }
|
|
||||||
$userval = $result['USERVAL'];
|
|
||||||
$username = $result['USERNAME'];
|
|
||||||
$data = [
|
|
||||||
"test_ref_id"=> "$refftestid",
|
|
||||||
"hiscode"=> "$hiscode",
|
|
||||||
"liscode"=> "$liscode",
|
|
||||||
"service_name"=> "$testname",
|
|
||||||
"test_medium"=> "$sampletype",
|
|
||||||
"test_container"=> "$tubename",
|
|
||||||
"chapter_type"=> "$chapter",
|
|
||||||
"test_result"=> "$testresult",
|
|
||||||
"test_unit"=> "$testunit",
|
|
||||||
"test_reff" => "$testreff",
|
|
||||||
"test_summary"=> "$testsum",
|
|
||||||
"resdate"=> "$resdate",
|
|
||||||
"userval"=> "$userval",
|
|
||||||
"username"=> "$username",
|
|
||||||
];
|
|
||||||
if ( $depth == 0 || $depth == '' ) { // depth 0
|
|
||||||
$d0++;
|
|
||||||
$d1=-1;
|
|
||||||
$json['test_results'][] = $data;
|
|
||||||
} else if ($depth == 1) { // depth 1
|
|
||||||
$d1++;
|
|
||||||
$d2=-1;
|
|
||||||
$json['test_results'][$d0]['subtest_results'][] = $data;
|
|
||||||
} else if ($depth == 2) { // depth 2
|
|
||||||
$d2++;
|
|
||||||
$d3=-1;
|
|
||||||
$json['test_results'][$d0]['subtest_results'][$d1]['subtest_results'][] = $data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "SELECT ds.SHORTTEXT,
|
|
||||||
FORMAT(tu.COLLECTIONDATE, 'dd-MM-yyyy') AS RECVDATE,
|
|
||||||
FORMAT(tu.COLLECTIONDATE, 'HH:mm') AS RECVTIME,
|
|
||||||
FORMAT(ct.COLLECTIONDATE, 'dd-MM-yyyy') AS COLLDATE,
|
|
||||||
FORMAT(ct.COLLECTIONDATE, 'HH:mm') AS COLLTIME
|
|
||||||
FROM SP_TUBES tu
|
|
||||||
LEFT JOIN DICT_SAMPLES_TYPES ds ON ds.SAMPCODE = tu.SAMPLETYPE
|
|
||||||
LEFT JOIN cmod.dbo.CM_TUBES ct ON ct.SAMPLETYPE = tu.SAMPLETYPE AND ct.ACCESSNUMBER = tu.SP_ACCESSNUMBER
|
|
||||||
WHERE tu.SP_ACCESSNUMBER = '$accessnumber';";
|
|
||||||
$query = $db->query($sql);
|
|
||||||
$samples = $query->getResultArray();
|
|
||||||
foreach ($samples as $data) {
|
|
||||||
$sample = $data['SHORTTEXT'];
|
|
||||||
$recvdate = $data['RECVDATE'];
|
|
||||||
$recvtime = $data['RECVTIME'];
|
|
||||||
$colldate = $data['COLLDATE'];
|
|
||||||
$colltime = $data['COLLTIME'];
|
|
||||||
$json['collects'][] = [ "sample" => "$sample", "colldate" => "$colldate", "colltime" => "$colltime" ];
|
|
||||||
$json['receives'][] = [ "sample" => "$sample", "recvdate" => "$recvdate", "recvtime" => "$recvtime" ];
|
|
||||||
}
|
|
||||||
return $json;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function sendjson( $method, $url, $message ) {
|
|
||||||
$client = \Config\Services::curlrequest();
|
|
||||||
try {
|
|
||||||
$response = $client->request($method, $url, $message);
|
|
||||||
|
|
||||||
if ($response->getStatusCode() == 200) {
|
|
||||||
print_r($response);
|
|
||||||
} else {
|
|
||||||
print_r($response);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
//echo "<pre> \n".json_encode($json)."\n";
|
|
||||||
echo "Error: " . $e->getMessage();
|
|
||||||
log_message('error', 'API request exception: ' . $e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public function results_send($accessnumber) {
|
|
||||||
//$TMBali_bearerToken = file_get_contents('tokens/pbmc_dps.txt');
|
|
||||||
//$TMSby_bearerToken = file_get_contents('tokens/pbmc_sby.txt');
|
|
||||||
|
|
||||||
$json = $this->create_result_json($accessnumber);
|
|
||||||
$location = $json['branch'];
|
|
||||||
$headers = [ "Content-Type" => "application/json" ];
|
|
||||||
if($location == 'PBMC Surabaya') {
|
|
||||||
//$token = $TMSby_bearerToken;
|
|
||||||
$url = $this->url_resultSBY;
|
|
||||||
} else {
|
|
||||||
//$token = $TMBali_bearerToken;
|
|
||||||
$url = $this->url_resultDPS;
|
|
||||||
}
|
|
||||||
|
|
||||||
$method = "POST";
|
|
||||||
|
|
||||||
$message = [
|
|
||||||
"headers" => $headers,
|
|
||||||
"body" => json_encode($json),
|
|
||||||
"verify" => false
|
|
||||||
];
|
|
||||||
echo "<pre>";
|
|
||||||
//print_r($message);
|
|
||||||
$this->sendjson($method, $url, $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function results_preview($accessnumber) {
|
|
||||||
$json = $this->create_result_json($accessnumber);
|
|
||||||
return $this->respond($json);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function oc ($hon, $test) {
|
|
||||||
$db = \Config\Database::connect();
|
|
||||||
$sql = "select r.*, p.*, t.* from cmod.dbo.CM_TM_REQUESTS r
|
|
||||||
left join cmod.dbo.CM_TM_PATIENTS p on r.PATID=p.PATID
|
|
||||||
left join cmod.dbo.CM_DICT_MAPPINGS m on m.LISCODE='$test'
|
|
||||||
left join cmod.dbo.CM_TM_TESTS t on t.REQID=r.REQID and t.HISCODE=m.HISCODE
|
|
||||||
where r.REFFID='$hon' ";
|
|
||||||
$query = $db->query($sql);
|
|
||||||
$results = $query->getResultArray();
|
|
||||||
$visitnumber = $results[0]['REQNUMBER'];
|
|
||||||
$location = $results[0]['LOC'];
|
|
||||||
$patnumber = $results[0]['PATNUMBER'];
|
|
||||||
$firstname = $results[0]['FIRSTNAME'];
|
|
||||||
$lastname = $results[0]['LASTNAME'];
|
|
||||||
$hiscode = $results[0]['HISCODE'];
|
|
||||||
$refftestid = $results[0]['REFFTESTID'];
|
|
||||||
|
|
||||||
$method = "POST";
|
|
||||||
if($location == "PBMC Bali") { $url = $this->url_resultDPS; }
|
|
||||||
else { $url = $this->url_resultSBY; }
|
|
||||||
|
|
||||||
$headers = [ "Content-Type" => "application/json" ];
|
|
||||||
$json = [
|
|
||||||
"reference_id" => "$hon",
|
|
||||||
"company_name" => "Padma Medical Group",
|
|
||||||
"branch" => "$location",
|
|
||||||
"status" => "cancel",
|
|
||||||
"patient" => [
|
|
||||||
"rm_number" => "$patnumber",
|
|
||||||
"patient_first_name" => "$firstname",
|
|
||||||
"patient_last_name" => "$lastname",
|
|
||||||
"visit_number" => "$visitnumber"
|
|
||||||
],
|
|
||||||
"tests" => [
|
|
||||||
"test_ref_id" => trim($refftestid),
|
|
||||||
"service_id" => "$hiscode"
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
//return $this->respond($json);
|
|
||||||
$message = [
|
|
||||||
"headers" => $headers,
|
|
||||||
"body" => json_encode($json),
|
|
||||||
"verify" => false
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->sendjson($method, $url, $message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Controllers;
|
|
||||||
|
|
||||||
class AdminPages extends BaseController {
|
|
||||||
|
|
||||||
public function HISRequests() {
|
|
||||||
return view('admin/HISRequests');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function HISMessages() {
|
|
||||||
return view('admin/HISMessages');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
11
app/Controllers/Home.php
Normal file
11
app/Controllers/Home.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
class Home extends BaseController
|
||||||
|
{
|
||||||
|
public function index(): string
|
||||||
|
{
|
||||||
|
return view('welcome_message');
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,13 +5,7 @@ namespace App\Controllers;
|
|||||||
class Pages extends BaseController {
|
class Pages extends BaseController {
|
||||||
|
|
||||||
public function home() {
|
public function home() {
|
||||||
$db = \Config\Database::connect();
|
echo "this site is made for Technidata integration with Transmedic";
|
||||||
$sql = "select top 10 * from cmod.dbo.CM_TM_LOGS order by LOGDATE desc";
|
|
||||||
$query = $db->query($sql);
|
|
||||||
$results = $query->getResultArray();
|
|
||||||
$data['messages'] = $results;
|
|
||||||
|
|
||||||
return view('recent_messages', $data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,104 +0,0 @@
|
|||||||
<?= $this->extend('admin/layout') ?>
|
|
||||||
|
|
||||||
<?= $this->section('content') ?>
|
|
||||||
<div class='container-fluid'>
|
|
||||||
<div class="card bg-light">
|
|
||||||
<div class="card-body">
|
|
||||||
<h5 class="card-title">Messages</h5>
|
|
||||||
<form class="row g-2 align-items-center" id="myForm">
|
|
||||||
<div class="col-auto">
|
|
||||||
<label for="startDate" class="col-form-label">Date</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-auto">
|
|
||||||
<input type="date" class="form-control form-control-sm" id="date1" name='date1'>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-auto">
|
|
||||||
<span>-</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-auto">
|
|
||||||
<input type="date" class="form-control form-control-sm" id="date2" name='date2'>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-auto">
|
|
||||||
<button type="button" class="btn btn-sm btn-primary" onclick='searchMessages()'>Search</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<div class='table-responsive'>
|
|
||||||
<table class='table table-striped table-bordered' id='dataTable'>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>#</th> <th>Messages</th> <th>Action</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody id='tbody'>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?= $this->endSection() ?>
|
|
||||||
|
|
||||||
<?= $this->section('script') ?>
|
|
||||||
<script>
|
|
||||||
let curDate = new Date().toJSON().slice(0, 10);
|
|
||||||
$('#date1').val(curDate);
|
|
||||||
$('#date2').val(curDate);
|
|
||||||
|
|
||||||
function searchMessages() {
|
|
||||||
const url = '<?=base_url('');?>admin/api/HISMessages';
|
|
||||||
const form = document.getElementById('myForm');
|
|
||||||
const formData = new FormData(form);
|
|
||||||
|
|
||||||
fetch(url, {
|
|
||||||
method: 'POST',
|
|
||||||
body: formData
|
|
||||||
}).then(response => {
|
|
||||||
if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); }
|
|
||||||
return response.json();
|
|
||||||
}).then(data => {
|
|
||||||
$("#dataTable").DataTable().destroy();
|
|
||||||
$("#tbody").html("");
|
|
||||||
let i = 1;
|
|
||||||
data.data.forEach(item => {
|
|
||||||
const row = `<tr>
|
|
||||||
<td>LogID : <b>${item.LOGID}</b><br />${item.LOGDATE}</td>
|
|
||||||
<td><a href="#" class="show-more" onclick='showmore(this)'>Show More</a> <span class='text-limit'>${item.BODY}</span> </td>
|
|
||||||
<td><button class="btn btn-sm btn-primary" onclick="resendJSON(${item.LOGID})">resend JSON</button></td>
|
|
||||||
</tr>`;
|
|
||||||
$("#tbody").append(row);
|
|
||||||
});
|
|
||||||
$('#dataTable').DataTable({
|
|
||||||
"pageLength": 20,
|
|
||||||
"lengthMenu": [10, 20, 50, 100]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showmore(element) {
|
|
||||||
event.preventDefault();
|
|
||||||
const limitedTextSpan = element.nextElementSibling;
|
|
||||||
console.log(limitedTextSpan.style.whiteSpace);
|
|
||||||
if (limitedTextSpan.style.whiteSpace == 'nowrap' || limitedTextSpan.style.whiteSpace == '') {
|
|
||||||
limitedTextSpan.style.whiteSpace = 'normal';
|
|
||||||
limitedTextSpan.style.overflow = 'visible';
|
|
||||||
element.textContent = 'Show Less';
|
|
||||||
console.log('show less');
|
|
||||||
} else {
|
|
||||||
limitedTextSpan.style.whiteSpace = 'nowrap';
|
|
||||||
limitedTextSpan.style.overflow = 'hidden';
|
|
||||||
element.textContent = 'Show More';
|
|
||||||
console.log('show more');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function resendJSON(logid) {
|
|
||||||
var url = '<?=base_url('');?>admin/api/resendJSON/'+logid;
|
|
||||||
fetch(url, { method: 'GET' });
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?= $this->endSection() ?>
|
|
||||||
@ -1,83 +0,0 @@
|
|||||||
<?= $this->extend('admin/layout') ?>
|
|
||||||
|
|
||||||
<?= $this->section('content') ?>
|
|
||||||
<div class='container-fluid'>
|
|
||||||
<div class="card bg-light">
|
|
||||||
<div class="card-body">
|
|
||||||
<h5 class="card-title">Requests</h5>
|
|
||||||
<form class="row g-2 align-items-center" id="myForm">
|
|
||||||
<div class="col-auto">
|
|
||||||
<label for="startDate" class="col-form-label">Date</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-auto">
|
|
||||||
<input type="date" class="form-control form-control-sm" id="date1" name='date1'>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-auto">
|
|
||||||
<span>-</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-auto">
|
|
||||||
<input type="date" class="form-control form-control-sm" id="date2" name='date2'>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-auto">
|
|
||||||
<button type="button" class="btn btn-sm btn-primary" onclick='searchRequests()'>Search</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<div class='table-responsive'>
|
|
||||||
<table class='table table-striped table-bordered' id='dataTable'>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>ID#</th> <th>Pat#</th> <th>PatName</th> <th>Loc</th> <th>Test</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody id='tbody'>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?= $this->endSection() ?>
|
|
||||||
<?= $this->section('script') ?>
|
|
||||||
<script>
|
|
||||||
let curDate = new Date().toJSON().slice(0, 10);
|
|
||||||
$('#date1').val(curDate);
|
|
||||||
$('#date2').val(curDate);
|
|
||||||
|
|
||||||
function searchRequests() {
|
|
||||||
const url = '<?=base_url('');?>admin/api/HISRequests';
|
|
||||||
const form = document.getElementById('myForm');
|
|
||||||
const formData = new FormData(form);
|
|
||||||
|
|
||||||
fetch(url, {
|
|
||||||
method: 'POST',
|
|
||||||
body: formData
|
|
||||||
}).then(response => {
|
|
||||||
if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); }
|
|
||||||
return response.json();
|
|
||||||
}).then(data => {
|
|
||||||
$("#dataTable").DataTable().destroy();
|
|
||||||
$("#tbody").html("");
|
|
||||||
data.data.forEach(item => {
|
|
||||||
const row = `<tr>
|
|
||||||
<td class='text-nowrap'>Access# : ${item.SP_ACCESSNUMBER}<br/>Reff# : ${item.REFFID} | Visit : ${item.REQNUMBER}</td>
|
|
||||||
<td>${item.PATNUMBER}</td>
|
|
||||||
<td>${item.FIRSTNAME} ${item.NAME}</td>
|
|
||||||
<td>${item.LOC}</td>
|
|
||||||
<td>${item.TESTS}</td>
|
|
||||||
</tr>`;
|
|
||||||
$("#tbody").append(row);
|
|
||||||
});
|
|
||||||
$('#dataTable').DataTable({
|
|
||||||
"pageLength": 20,
|
|
||||||
"lengthMenu": [10, 20, 50, 100]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?= $this->endSection() ?>
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>CMOD-Rest Administrator</title>
|
|
||||||
<link href="<?=base_url();?>assets/bootstrap.min.css" rel="stylesheet" />
|
|
||||||
<link href="<?=base_url();?>assets/datatables.min.css" rel="stylesheet">
|
|
||||||
<script src="<?=base_url();?>assets/jquery-3.7.1.slim.min.js"></script>
|
|
||||||
<script src="<?=base_url();?>assets/bootstrap.bundle.min.js"></script>
|
|
||||||
<script src="<?=base_url();?>assets/datatables.min.js"></script>
|
|
||||||
<style>
|
|
||||||
html {font-size:11px;}
|
|
||||||
.nav-link, .navbar-brand { color:white; }
|
|
||||||
a:hover { background-color:white;color:black; }
|
|
||||||
|
|
||||||
/* HIS Messages */
|
|
||||||
.text-limit { display: block; max-width: 950px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body class='bg-secondary'>
|
|
||||||
<nav class="navbar navbar-sm navbar-expand-lg border-bottom py-0">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="collapse navbar-collapse" id="navbarNav">
|
|
||||||
<ul class="navbar-nav">
|
|
||||||
<li class="nav-item"> <a class="nav-link" href="<?=base_url();?>admin/HISRequests">HIS Requests</a> </li>
|
|
||||||
<li class="nav-item"> <a class="nav-link" href="<?=base_url();?>admin/HISMessages">HIS Messages</a> </li>
|
|
||||||
<li class="nav-item"> <a class="nav-link" href="<?=base_url();?>admin/SendJSON">Custom JSON</a> </li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="navbar-brand" href="#">CMOD-Rest Administrator</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
<main class='m-3'>
|
|
||||||
<?= $this->renderSection('content') ?>
|
|
||||||
</main>
|
|
||||||
</body>
|
|
||||||
<?= $this->renderSection('script') ?>
|
|
||||||
</html>
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>403 Forbidden</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<title>Your Page Title</title>
|
|
||||||
<meta name="description" content="Technidata with Transmedic">
|
|
||||||
<meta name="author" content="miluzakaria">
|
|
||||||
<link rel="icon" href="assets/favicon.ico" type="image/x-icon">
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
font-family: Arial, sans-serif;
|
|
||||||
margin: 20px;
|
|
||||||
}
|
|
||||||
pre {
|
|
||||||
background: #f4f4f4;
|
|
||||||
padding: 10px;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h3>Recent Request from TM</h3>
|
|
||||||
<?php
|
|
||||||
foreach($messages as $data) {
|
|
||||||
$logdate = $data['LOGDATE'];
|
|
||||||
$body = $data['BODY'];
|
|
||||||
if (!empty($body)) {
|
|
||||||
$msg = json_decode($body);
|
|
||||||
if (json_last_error() === JSON_ERROR_NONE) {
|
|
||||||
$prettyjson = json_encode($msg, JSON_PRETTY_PRINT);
|
|
||||||
echo "<p> date : $logdate<pre>".htmlspecialchars($prettyjson)."</pre> </p>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
331
app/Views/welcome_message.php
Normal file
331
app/Views/welcome_message.php
Normal file
File diff suppressed because one or more lines are too long
125
builds
125
builds
@ -1,125 +0,0 @@
|
|||||||
#!/usr/bin/env php
|
|
||||||
<?php
|
|
||||||
|
|
||||||
define('LATEST_RELEASE', '^4.0');
|
|
||||||
define('GITHUB_URL', 'https://github.com/codeigniter4/codeigniter4');
|
|
||||||
|
|
||||||
/*
|
|
||||||
* --------------------------------------------------------------------
|
|
||||||
* Stability Toggle
|
|
||||||
* --------------------------------------------------------------------
|
|
||||||
* Use this script to toggle the CodeIgniter dependency between the
|
|
||||||
* latest stable release and the most recent development update.
|
|
||||||
*
|
|
||||||
* Usage: php builds [release|development]
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Determine the requested stability
|
|
||||||
if (empty($argv[1]) || ! in_array($argv[1], ['release', 'development'], true)) {
|
|
||||||
echo 'Usage: php builds [release|development]' . PHP_EOL;
|
|
||||||
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$dev = $argv[1] === 'development';
|
|
||||||
|
|
||||||
$modified = [];
|
|
||||||
|
|
||||||
// Locate each file and update it for the requested stability
|
|
||||||
|
|
||||||
$file = __DIR__ . DIRECTORY_SEPARATOR . 'composer.json';
|
|
||||||
|
|
||||||
if (is_file($file)) {
|
|
||||||
$contents = file_get_contents($file);
|
|
||||||
|
|
||||||
if ((string) $contents !== '') {
|
|
||||||
$array = json_decode($contents, true);
|
|
||||||
|
|
||||||
if (is_array($array)) {
|
|
||||||
if ($dev) {
|
|
||||||
$array['minimum-stability'] = 'dev';
|
|
||||||
$array['prefer-stable'] = true;
|
|
||||||
$array['repositories'] ??= [];
|
|
||||||
|
|
||||||
$found = false;
|
|
||||||
|
|
||||||
foreach ($array['repositories'] as $repository) {
|
|
||||||
if ($repository['url'] === GITHUB_URL) {
|
|
||||||
$found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $found) {
|
|
||||||
$array['repositories'][] = [
|
|
||||||
'type' => 'vcs',
|
|
||||||
'url' => GITHUB_URL,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$array['require']['codeigniter4/codeigniter4'] = 'dev-develop';
|
|
||||||
unset($array['require']['codeigniter4/framework']);
|
|
||||||
} else {
|
|
||||||
unset($array['minimum-stability']);
|
|
||||||
|
|
||||||
if (isset($array['repositories'])) {
|
|
||||||
foreach ($array['repositories'] as $i => $repository) {
|
|
||||||
if ($repository['url'] === GITHUB_URL) {
|
|
||||||
unset($array['repositories'][$i]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($array['repositories'])) {
|
|
||||||
unset($array['repositories']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$array['require']['codeigniter4/framework'] = LATEST_RELEASE;
|
|
||||||
unset($array['require']['codeigniter4/codeigniter4']);
|
|
||||||
}
|
|
||||||
|
|
||||||
file_put_contents($file, json_encode($array, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL);
|
|
||||||
|
|
||||||
$modified[] = $file;
|
|
||||||
} else {
|
|
||||||
echo 'Warning: Unable to decode composer.json! Skipping...' . PHP_EOL;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
echo 'Warning: Unable to read composer.json! Skipping...' . PHP_EOL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$files = [
|
|
||||||
__DIR__ . DIRECTORY_SEPARATOR . 'app/Config/Paths.php',
|
|
||||||
__DIR__ . DIRECTORY_SEPARATOR . 'phpunit.xml.dist',
|
|
||||||
__DIR__ . DIRECTORY_SEPARATOR . 'phpunit.xml',
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($files as $file) {
|
|
||||||
if (is_file($file)) {
|
|
||||||
$contents = file_get_contents($file);
|
|
||||||
|
|
||||||
if ($dev) {
|
|
||||||
$contents = str_replace('vendor/codeigniter4/framework', 'vendor/codeigniter4/codeigniter4', $contents);
|
|
||||||
} else {
|
|
||||||
$contents = str_replace('vendor/codeigniter4/codeigniter4', 'vendor/codeigniter4/framework', $contents);
|
|
||||||
}
|
|
||||||
|
|
||||||
file_put_contents($file, $contents);
|
|
||||||
|
|
||||||
$modified[] = $file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($modified === []) {
|
|
||||||
echo 'No files modified.' . PHP_EOL;
|
|
||||||
} else {
|
|
||||||
echo 'The following files were modified:' . PHP_EOL;
|
|
||||||
|
|
||||||
foreach ($modified as $file) {
|
|
||||||
echo " * {$file}" . PHP_EOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo 'Run `composer update` to sync changes with your vendor folder.' . PHP_EOL;
|
|
||||||
}
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "codeigniter4/appstarter",
|
|
||||||
"description": "CodeIgniter4 starter app",
|
|
||||||
"license": "MIT",
|
|
||||||
"type": "project",
|
|
||||||
"homepage": "https://codeigniter.com",
|
|
||||||
"support": {
|
|
||||||
"forum": "https://forum.codeigniter.com/",
|
|
||||||
"source": "https://github.com/codeigniter4/CodeIgniter4",
|
|
||||||
"slack": "https://codeigniterchat.slack.com"
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": "^8.1",
|
|
||||||
"codeigniter4/framework": "^4.0",
|
|
||||||
"michalsn/codeigniter4-uuid": "^1.1"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"fakerphp/faker": "^1.9",
|
|
||||||
"mikey179/vfsstream": "^1.6",
|
|
||||||
"phpunit/phpunit": "^10.5.16"
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"App\\": "app/",
|
|
||||||
"Config\\": "app/Config/"
|
|
||||||
},
|
|
||||||
"exclude-from-classmap": [
|
|
||||||
"**/Database/Migrations/**"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"autoload-dev": {
|
|
||||||
"psr-4": {
|
|
||||||
"Tests\\Support\\": "tests/_support"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"config": {
|
|
||||||
"optimize-autoloader": true,
|
|
||||||
"preferred-install": "dist",
|
|
||||||
"sort-packages": true
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "phpunit"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
2361
composer.lock
generated
2361
composer.lock
generated
File diff suppressed because it is too large
Load Diff
72
cretab.sql
Normal file
72
cretab.sql
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
USE [cmod]
|
||||||
|
GO
|
||||||
|
DROP TABLE CM_TM_LOGS;
|
||||||
|
DROP TABLE CM_TM_REQUESTS;
|
||||||
|
DROP TABLE CM_TM_PATIENTS;
|
||||||
|
DROP TABLE CM_TM_TESTS;
|
||||||
|
/****** Object: Table [dbo].[CM_TM_LOGS] Script Date: 13/01/2025 16:49:08 ******/
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
GO
|
||||||
|
CREATE TABLE [dbo].[CM_TM_LOGS](
|
||||||
|
[LOGID] [int] IDENTITY(1,1) NOT NULL,
|
||||||
|
[URL] [varchar](150) NULL,
|
||||||
|
[METHOD] [varchar](10) NULL,
|
||||||
|
[BODY] [text] NULL,
|
||||||
|
[LOGDATE] [datetime] NULL,
|
||||||
|
CONSTRAINT [PK_CM_TM_LOGS] PRIMARY KEY CLUSTERED
|
||||||
|
(
|
||||||
|
[LOGID] ASC
|
||||||
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
|
||||||
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||||||
|
GO
|
||||||
|
/****** Object: Table [dbo].[CM_TM_PATIENTS] Script Date: 13/01/2025 16:49:08 ******/
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
GO
|
||||||
|
CREATE TABLE [dbo].[CM_TM_PATIENTS](
|
||||||
|
[PATID] [int] IDENTITY(1,1) NOT NULL,
|
||||||
|
[PATNUMBER] [varchar](50) NULL,
|
||||||
|
[FIRSTNAME] [varchar](100) NULL,
|
||||||
|
[LASTNAME] [varchar](100) NULL,
|
||||||
|
[BIRTHDATE] [date] NULL,
|
||||||
|
[SEX] [varchar](10) NULL,
|
||||||
|
[PHONE] [varchar](50) NULL,
|
||||||
|
[TAKEN] [varchar](1) NULL
|
||||||
|
) ON [PRIMARY]
|
||||||
|
GO
|
||||||
|
/****** Object: Table [dbo].[CM_TM_REQUESTS] Script Date: 13/01/2025 16:49:08 ******/
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
GO
|
||||||
|
CREATE TABLE [dbo].[CM_TM_REQUESTS](
|
||||||
|
[REQID] [int] IDENTITY(1,1) NOT NULL,
|
||||||
|
[REFFID] [text] NULL,
|
||||||
|
[REQNUMBER] [varchar](10) NULL,
|
||||||
|
[REQTYPE] [varchar](10) NULL,
|
||||||
|
[REQDATE] [datetime] NULL,
|
||||||
|
[AGENT] [varchar](100) NULL,
|
||||||
|
[DOC] [varchar](100) NULL,
|
||||||
|
[LOC] [varchar](10) NULL,
|
||||||
|
[PATID] [int] NULL,
|
||||||
|
[COMPANY] [varchar](50) NULL,
|
||||||
|
[REQDESC] [varchar](50) NULL,
|
||||||
|
[TAKEN] [varchar](1) NULL
|
||||||
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||||||
|
GO
|
||||||
|
/****** Object: Table [dbo].[CM_TM_TESTS] Script Date: 13/01/2025 16:49:08 ******/
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
GO
|
||||||
|
CREATE TABLE [dbo].[CM_TM_TESTS](
|
||||||
|
[REQTESTID] [int] IDENTITY(1,1) NOT NULL,
|
||||||
|
[REFFID] [text] NULL,
|
||||||
|
[REQID] [int] NOT NULL,
|
||||||
|
[HISCODE] [varchar](10) NOT NULL,
|
||||||
|
[TESTSTATUS] [char](1) NULL
|
||||||
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||||||
|
GO
|
||||||
@ -1,63 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<phpunit
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
|
|
||||||
bootstrap="vendor/codeigniter4/framework/system/Test/bootstrap.php"
|
|
||||||
backupGlobals="false"
|
|
||||||
beStrictAboutOutputDuringTests="true"
|
|
||||||
colors="true"
|
|
||||||
columns="max"
|
|
||||||
failOnRisky="true"
|
|
||||||
failOnWarning="true"
|
|
||||||
cacheDirectory="build/.phpunit.cache">
|
|
||||||
<coverage
|
|
||||||
includeUncoveredFiles="true"
|
|
||||||
pathCoverage="false"
|
|
||||||
ignoreDeprecatedCodeUnits="true"
|
|
||||||
disableCodeCoverageIgnore="true">
|
|
||||||
<report>
|
|
||||||
<clover outputFile="build/logs/clover.xml"/>
|
|
||||||
<html outputDirectory="build/logs/html"/>
|
|
||||||
<php outputFile="build/logs/coverage.serialized"/>
|
|
||||||
<text outputFile="php://stdout" showUncoveredFiles="false"/>
|
|
||||||
</report>
|
|
||||||
</coverage>
|
|
||||||
<testsuites>
|
|
||||||
<testsuite name="App">
|
|
||||||
<directory>./tests</directory>
|
|
||||||
</testsuite>
|
|
||||||
</testsuites>
|
|
||||||
<logging>
|
|
||||||
<testdoxHtml outputFile="build/logs/testdox.html"/>
|
|
||||||
<testdoxText outputFile="build/logs/testdox.txt"/>
|
|
||||||
<junit outputFile="build/logs/logfile.xml"/>
|
|
||||||
</logging>
|
|
||||||
<source>
|
|
||||||
<include>
|
|
||||||
<directory suffix=".php">./app</directory>
|
|
||||||
</include>
|
|
||||||
<exclude>
|
|
||||||
<directory suffix=".php">./app/Views</directory>
|
|
||||||
<file>./app/Config/Routes.php</file>
|
|
||||||
</exclude>
|
|
||||||
</source>
|
|
||||||
<php>
|
|
||||||
<server name="app.baseURL" value="http://example.com/"/>
|
|
||||||
<server name="CODEIGNITER_SCREAM_DEPRECATIONS" value="0"/>
|
|
||||||
<!-- Directory containing phpunit.xml -->
|
|
||||||
<const name="HOMEPATH" value="./"/>
|
|
||||||
<!-- Directory containing the Paths config file -->
|
|
||||||
<const name="CONFIGPATH" value="./app/Config/"/>
|
|
||||||
<!-- Directory containing the front controller (index.php) -->
|
|
||||||
<const name="PUBLICPATH" value="./public/"/>
|
|
||||||
<!-- Database configuration -->
|
|
||||||
<!-- Uncomment to provide your own database for testing
|
|
||||||
<env name="database.tests.hostname" value="localhost"/>
|
|
||||||
<env name="database.tests.database" value="tests"/>
|
|
||||||
<env name="database.tests.username" value="tests_user"/>
|
|
||||||
<env name="database.tests.password" value=""/>
|
|
||||||
<env name="database.tests.DBDriver" value="MySQLi"/>
|
|
||||||
<env name="database.tests.DBPrefix" value="tests_"/>
|
|
||||||
-->
|
|
||||||
</php>
|
|
||||||
</phpunit>
|
|
||||||
106
preload.php
106
preload.php
@ -1,106 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This file is part of CodeIgniter 4 framework.
|
|
||||||
*
|
|
||||||
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
*---------------------------------------------------------------
|
|
||||||
* Sample file for Preloading
|
|
||||||
*---------------------------------------------------------------
|
|
||||||
* See https://www.php.net/manual/en/opcache.preloading.php
|
|
||||||
*
|
|
||||||
* How to Use:
|
|
||||||
* 0. Copy this file to your project root folder.
|
|
||||||
* 1. Set the $paths property of the preload class below.
|
|
||||||
* 2. Set opcache.preload in php.ini.
|
|
||||||
* php.ini:
|
|
||||||
* opcache.preload=/path/to/preload.php
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Load the paths config file
|
|
||||||
require __DIR__ . '/app/Config/Paths.php';
|
|
||||||
|
|
||||||
// Path to the front controller
|
|
||||||
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);
|
|
||||||
|
|
||||||
class preload
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var array Paths to preload.
|
|
||||||
*/
|
|
||||||
private array $paths = [
|
|
||||||
[
|
|
||||||
'include' => __DIR__ . '/vendor/codeigniter4/framework/system', // Change this path if using manual installation
|
|
||||||
'exclude' => [
|
|
||||||
// Not needed if you don't use them.
|
|
||||||
'/system/Database/OCI8/',
|
|
||||||
'/system/Database/Postgre/',
|
|
||||||
'/system/Database/SQLite3/',
|
|
||||||
'/system/Database/SQLSRV/',
|
|
||||||
// Not needed for web apps.
|
|
||||||
'/system/Database/Seeder.php',
|
|
||||||
'/system/Test/',
|
|
||||||
'/system/CLI/',
|
|
||||||
'/system/Commands/',
|
|
||||||
'/system/Publisher/',
|
|
||||||
'/system/ComposerScripts.php',
|
|
||||||
// Not Class/Function files.
|
|
||||||
'/system/Config/Routes.php',
|
|
||||||
'/system/Language/',
|
|
||||||
'/system/bootstrap.php',
|
|
||||||
'/system/rewrite.php',
|
|
||||||
'/Views/',
|
|
||||||
// Errors occur.
|
|
||||||
'/system/ThirdParty/',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->loadAutoloader();
|
|
||||||
}
|
|
||||||
|
|
||||||
private function loadAutoloader(): void
|
|
||||||
{
|
|
||||||
$paths = new Config\Paths();
|
|
||||||
require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'Boot.php';
|
|
||||||
|
|
||||||
CodeIgniter\Boot::preload($paths);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load PHP files.
|
|
||||||
*/
|
|
||||||
public function load(): void
|
|
||||||
{
|
|
||||||
foreach ($this->paths as $path) {
|
|
||||||
$directory = new RecursiveDirectoryIterator($path['include']);
|
|
||||||
$fullTree = new RecursiveIteratorIterator($directory);
|
|
||||||
$phpFiles = new RegexIterator(
|
|
||||||
$fullTree,
|
|
||||||
'/.+((?<!Test)+\.php$)/i',
|
|
||||||
RecursiveRegexIterator::GET_MATCH
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($phpFiles as $key => $file) {
|
|
||||||
foreach ($path['exclude'] as $exclude) {
|
|
||||||
if (str_contains($file[0], $exclude)) {
|
|
||||||
continue 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once $file[0];
|
|
||||||
echo 'Loaded: ' . $file[0] . "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
(new preload())->load();
|
|
||||||
@ -1,538 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>CMOD-Rest Administrator</title>
|
|
||||||
<link href="assets/bootstrap.min.css" rel="stylesheet" />
|
|
||||||
<script src="assets/bootstrap.bundle.min.js"></script>
|
|
||||||
<script src="assets/jquery-3.7.1.slim.min.js"></script>
|
|
||||||
<link href="assets/datatables.min.css" rel="stylesheet">
|
|
||||||
<script src="assets/datatables.min.js"></script>
|
|
||||||
<style>
|
|
||||||
.nav-link, .navbar-brand { color:white; }
|
|
||||||
a:hover { background-color:white;color:black; }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body class='bg-secondary'>
|
|
||||||
<nav class="navbar navbar-sm navbar-expand-lg border-bottom py-0">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="collapse navbar-collapse" id="navbarNav">
|
|
||||||
<ul class="navbar-nav">
|
|
||||||
<li class="nav-item"> <a class="nav-link" href="#">LIS Requests</a> </li>
|
|
||||||
<li class="nav-item"> <a class="nav-link" href="#">HIS Requests</a> </li>
|
|
||||||
<li class="nav-item"> <a class="nav-link" href="#">HIS Messages</a> </li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="navbar-brand" href="#">CMOD-Rest Administrator</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
<main class='m-3'>
|
|
||||||
<div class='container-fluid'>
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
<h5 class="card-title">LIS Requests</h5>
|
|
||||||
<form class="row g-2 align-items-center">
|
|
||||||
<div class="col-auto">
|
|
||||||
<label for="startDate" class="col-form-label">Date</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-auto">
|
|
||||||
<input type="date" class="form-control form-control-sm" id="startDate" placeholder="dd/mm/yyyy">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-auto">
|
|
||||||
<span>-</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-auto">
|
|
||||||
<input type="date" class="form-control form-control-sm" id="endDate" placeholder="dd/mm/yyyy">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-auto">
|
|
||||||
<button type="submit" class="btn btn-sm btn-primary">Search</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div class='table-responsive mx-3'>
|
|
||||||
<table class='table table-striped table-bordered table-sm' id='example'>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Position</th>
|
|
||||||
<th>Office</th>
|
|
||||||
<th>Age</th>
|
|
||||||
<th>Start date</th>
|
|
||||||
<th>Salary</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>Tiger Nixon</td>
|
|
||||||
<td>System Architect</td>
|
|
||||||
<td>Edinburgh</td>
|
|
||||||
<td>61</td>
|
|
||||||
<td>2011-04-25</td>
|
|
||||||
<td>$320,800</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Garrett Winters</td>
|
|
||||||
<td>Accountant</td>
|
|
||||||
<td>Tokyo</td>
|
|
||||||
<td>63</td>
|
|
||||||
<td>2011-07-25</td>
|
|
||||||
<td>$170,750</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Ashton Cox</td>
|
|
||||||
<td>Junior Technical Author</td>
|
|
||||||
<td>San Francisco</td>
|
|
||||||
<td>66</td>
|
|
||||||
<td>2009-01-12</td>
|
|
||||||
<td>$86,000</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Cedric Kelly</td>
|
|
||||||
<td>Senior Javascript Developer</td>
|
|
||||||
<td>Edinburgh</td>
|
|
||||||
<td>22</td>
|
|
||||||
<td>2012-03-29</td>
|
|
||||||
<td>$433,060</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Airi Satou</td>
|
|
||||||
<td>Accountant</td>
|
|
||||||
<td>Tokyo</td>
|
|
||||||
<td>33</td>
|
|
||||||
<td>2008-11-28</td>
|
|
||||||
<td>$162,700</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Brielle Williamson</td>
|
|
||||||
<td>Integration Specialist</td>
|
|
||||||
<td>New York</td>
|
|
||||||
<td>61</td>
|
|
||||||
<td>2012-12-02</td>
|
|
||||||
<td>$372,000</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Herrod Chandler</td>
|
|
||||||
<td>Sales Assistant</td>
|
|
||||||
<td>San Francisco</td>
|
|
||||||
<td>59</td>
|
|
||||||
<td>2012-08-06</td>
|
|
||||||
<td>$137,500</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Rhona Davidson</td>
|
|
||||||
<td>Integration Specialist</td>
|
|
||||||
<td>Tokyo</td>
|
|
||||||
<td>55</td>
|
|
||||||
<td>2010-10-14</td>
|
|
||||||
<td>$327,900</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Colleen Hurst</td>
|
|
||||||
<td>Javascript Developer</td>
|
|
||||||
<td>San Francisco</td>
|
|
||||||
<td>39</td>
|
|
||||||
<td>2009-09-15</td>
|
|
||||||
<td>$205,500</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Sonya Frost</td>
|
|
||||||
<td>Software Engineer</td>
|
|
||||||
<td>Edinburgh</td>
|
|
||||||
<td>23</td>
|
|
||||||
<td>2008-12-13</td>
|
|
||||||
<td>$103,600</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Jena Gaines</td>
|
|
||||||
<td>Office Manager</td>
|
|
||||||
<td>London</td>
|
|
||||||
<td>30</td>
|
|
||||||
<td>2008-12-19</td>
|
|
||||||
<td>$90,560</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Quinn Flynn</td>
|
|
||||||
<td>Support Lead</td>
|
|
||||||
<td>Edinburgh</td>
|
|
||||||
<td>22</td>
|
|
||||||
<td>2013-03-03</td>
|
|
||||||
<td>$342,000</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Charde Marshall</td>
|
|
||||||
<td>Regional Director</td>
|
|
||||||
<td>San Francisco</td>
|
|
||||||
<td>36</td>
|
|
||||||
<td>2008-10-16</td>
|
|
||||||
<td>$470,600</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Haley Kennedy</td>
|
|
||||||
<td>Senior Marketing Designer</td>
|
|
||||||
<td>London</td>
|
|
||||||
<td>43</td>
|
|
||||||
<td>2012-12-18</td>
|
|
||||||
<td>$313,500</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Tatyana Fitzpatrick</td>
|
|
||||||
<td>Regional Director</td>
|
|
||||||
<td>London</td>
|
|
||||||
<td>19</td>
|
|
||||||
<td>2010-03-17</td>
|
|
||||||
<td>$385,750</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Michael Silva</td>
|
|
||||||
<td>Marketing Designer</td>
|
|
||||||
<td>London</td>
|
|
||||||
<td>66</td>
|
|
||||||
<td>2012-11-27</td>
|
|
||||||
<td>$198,500</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Paul Byrd</td>
|
|
||||||
<td>Chief Financial Officer (CFO)</td>
|
|
||||||
<td>New York</td>
|
|
||||||
<td>64</td>
|
|
||||||
<td>2010-06-09</td>
|
|
||||||
<td>$725,000</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Gloria Little</td>
|
|
||||||
<td>Systems Administrator</td>
|
|
||||||
<td>New York</td>
|
|
||||||
<td>59</td>
|
|
||||||
<td>2009-04-10</td>
|
|
||||||
<td>$237,500</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Bradley Greer</td>
|
|
||||||
<td>Software Engineer</td>
|
|
||||||
<td>London</td>
|
|
||||||
<td>41</td>
|
|
||||||
<td>2012-10-13</td>
|
|
||||||
<td>$132,000</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Dai Rios</td>
|
|
||||||
<td>Personnel Lead</td>
|
|
||||||
<td>Edinburgh</td>
|
|
||||||
<td>35</td>
|
|
||||||
<td>2012-09-26</td>
|
|
||||||
<td>$217,500</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Jenette Caldwell</td>
|
|
||||||
<td>Development Lead</td>
|
|
||||||
<td>New York</td>
|
|
||||||
<td>30</td>
|
|
||||||
<td>2011-09-03</td>
|
|
||||||
<td>$345,000</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Yuri Berry</td>
|
|
||||||
<td>Chief Marketing Officer (CMO)</td>
|
|
||||||
<td>New York</td>
|
|
||||||
<td>40</td>
|
|
||||||
<td>2009-06-25</td>
|
|
||||||
<td>$675,000</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Caesar Vance</td>
|
|
||||||
<td>Pre-Sales Support</td>
|
|
||||||
<td>New York</td>
|
|
||||||
<td>21</td>
|
|
||||||
<td>2011-12-12</td>
|
|
||||||
<td>$106,450</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Doris Wilder</td>
|
|
||||||
<td>Sales Assistant</td>
|
|
||||||
<td>Sydney</td>
|
|
||||||
<td>23</td>
|
|
||||||
<td>2010-09-20</td>
|
|
||||||
<td>$85,600</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Angelica Ramos</td>
|
|
||||||
<td>Chief Executive Officer (CEO)</td>
|
|
||||||
<td>London</td>
|
|
||||||
<td>47</td>
|
|
||||||
<td>2009-10-09</td>
|
|
||||||
<td>$1,200,000</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Gavin Joyce</td>
|
|
||||||
<td>Developer</td>
|
|
||||||
<td>Edinburgh</td>
|
|
||||||
<td>42</td>
|
|
||||||
<td>2010-12-22</td>
|
|
||||||
<td>$92,575</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Jennifer Chang</td>
|
|
||||||
<td>Regional Director</td>
|
|
||||||
<td>Singapore</td>
|
|
||||||
<td>28</td>
|
|
||||||
<td>2010-11-14</td>
|
|
||||||
<td>$357,650</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Brenden Wagner</td>
|
|
||||||
<td>Software Engineer</td>
|
|
||||||
<td>San Francisco</td>
|
|
||||||
<td>28</td>
|
|
||||||
<td>2011-06-07</td>
|
|
||||||
<td>$206,850</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Fiona Green</td>
|
|
||||||
<td>Chief Operating Officer (COO)</td>
|
|
||||||
<td>San Francisco</td>
|
|
||||||
<td>48</td>
|
|
||||||
<td>2010-03-11</td>
|
|
||||||
<td>$850,000</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Shou Itou</td>
|
|
||||||
<td>Regional Marketing</td>
|
|
||||||
<td>Tokyo</td>
|
|
||||||
<td>20</td>
|
|
||||||
<td>2011-08-14</td>
|
|
||||||
<td>$163,000</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Michelle House</td>
|
|
||||||
<td>Integration Specialist</td>
|
|
||||||
<td>Sydney</td>
|
|
||||||
<td>37</td>
|
|
||||||
<td>2011-06-02</td>
|
|
||||||
<td>$95,400</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Suki Burks</td>
|
|
||||||
<td>Developer</td>
|
|
||||||
<td>London</td>
|
|
||||||
<td>53</td>
|
|
||||||
<td>2009-10-22</td>
|
|
||||||
<td>$114,500</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Prescott Bartlett</td>
|
|
||||||
<td>Technical Author</td>
|
|
||||||
<td>London</td>
|
|
||||||
<td>27</td>
|
|
||||||
<td>2011-05-07</td>
|
|
||||||
<td>$145,000</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Gavin Cortez</td>
|
|
||||||
<td>Team Leader</td>
|
|
||||||
<td>San Francisco</td>
|
|
||||||
<td>22</td>
|
|
||||||
<td>2008-10-26</td>
|
|
||||||
<td>$235,500</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Martena Mccray</td>
|
|
||||||
<td>Post-Sales support</td>
|
|
||||||
<td>Edinburgh</td>
|
|
||||||
<td>46</td>
|
|
||||||
<td>2011-03-09</td>
|
|
||||||
<td>$324,050</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Unity Butler</td>
|
|
||||||
<td>Marketing Designer</td>
|
|
||||||
<td>San Francisco</td>
|
|
||||||
<td>47</td>
|
|
||||||
<td>2009-12-09</td>
|
|
||||||
<td>$85,675</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Howard Hatfield</td>
|
|
||||||
<td>Office Manager</td>
|
|
||||||
<td>San Francisco</td>
|
|
||||||
<td>51</td>
|
|
||||||
<td>2008-12-16</td>
|
|
||||||
<td>$164,500</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Hope Fuentes</td>
|
|
||||||
<td>Secretary</td>
|
|
||||||
<td>San Francisco</td>
|
|
||||||
<td>41</td>
|
|
||||||
<td>2010-02-12</td>
|
|
||||||
<td>$109,850</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Vivian Harrell</td>
|
|
||||||
<td>Financial Controller</td>
|
|
||||||
<td>San Francisco</td>
|
|
||||||
<td>62</td>
|
|
||||||
<td>2009-02-14</td>
|
|
||||||
<td>$452,500</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Timothy Mooney</td>
|
|
||||||
<td>Office Manager</td>
|
|
||||||
<td>London</td>
|
|
||||||
<td>37</td>
|
|
||||||
<td>2008-12-11</td>
|
|
||||||
<td>$136,200</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Jackson Bradshaw</td>
|
|
||||||
<td>Director</td>
|
|
||||||
<td>New York</td>
|
|
||||||
<td>65</td>
|
|
||||||
<td>2008-09-26</td>
|
|
||||||
<td>$645,750</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Olivia Liang</td>
|
|
||||||
<td>Support Engineer</td>
|
|
||||||
<td>Singapore</td>
|
|
||||||
<td>64</td>
|
|
||||||
<td>2011-02-03</td>
|
|
||||||
<td>$234,500</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Bruno Nash</td>
|
|
||||||
<td>Software Engineer</td>
|
|
||||||
<td>London</td>
|
|
||||||
<td>38</td>
|
|
||||||
<td>2011-05-03</td>
|
|
||||||
<td>$163,500</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Sakura Yamamoto</td>
|
|
||||||
<td>Support Engineer</td>
|
|
||||||
<td>Tokyo</td>
|
|
||||||
<td>37</td>
|
|
||||||
<td>2009-08-19</td>
|
|
||||||
<td>$139,575</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Thor Walton</td>
|
|
||||||
<td>Developer</td>
|
|
||||||
<td>New York</td>
|
|
||||||
<td>61</td>
|
|
||||||
<td>2013-08-11</td>
|
|
||||||
<td>$98,540</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Finn Camacho</td>
|
|
||||||
<td>Support Engineer</td>
|
|
||||||
<td>San Francisco</td>
|
|
||||||
<td>47</td>
|
|
||||||
<td>2009-07-07</td>
|
|
||||||
<td>$87,500</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Serge Baldwin</td>
|
|
||||||
<td>Data Coordinator</td>
|
|
||||||
<td>Singapore</td>
|
|
||||||
<td>64</td>
|
|
||||||
<td>2012-04-09</td>
|
|
||||||
<td>$138,575</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Zenaida Frank</td>
|
|
||||||
<td>Software Engineer</td>
|
|
||||||
<td>New York</td>
|
|
||||||
<td>63</td>
|
|
||||||
<td>2010-01-04</td>
|
|
||||||
<td>$125,250</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Zorita Serrano</td>
|
|
||||||
<td>Software Engineer</td>
|
|
||||||
<td>San Francisco</td>
|
|
||||||
<td>56</td>
|
|
||||||
<td>2012-06-01</td>
|
|
||||||
<td>$115,000</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Jennifer Acosta</td>
|
|
||||||
<td>Junior Javascript Developer</td>
|
|
||||||
<td>Edinburgh</td>
|
|
||||||
<td>43</td>
|
|
||||||
<td>2013-02-01</td>
|
|
||||||
<td>$75,650</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Cara Stevens</td>
|
|
||||||
<td>Sales Assistant</td>
|
|
||||||
<td>New York</td>
|
|
||||||
<td>46</td>
|
|
||||||
<td>2011-12-06</td>
|
|
||||||
<td>$145,600</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Hermione Butler</td>
|
|
||||||
<td>Regional Director</td>
|
|
||||||
<td>London</td>
|
|
||||||
<td>47</td>
|
|
||||||
<td>2011-03-21</td>
|
|
||||||
<td>$356,250</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Lael Greer</td>
|
|
||||||
<td>Systems Administrator</td>
|
|
||||||
<td>London</td>
|
|
||||||
<td>21</td>
|
|
||||||
<td>2009-02-27</td>
|
|
||||||
<td>$103,500</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Jonas Alexander</td>
|
|
||||||
<td>Developer</td>
|
|
||||||
<td>San Francisco</td>
|
|
||||||
<td>30</td>
|
|
||||||
<td>2010-07-14</td>
|
|
||||||
<td>$86,500</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Shad Decker</td>
|
|
||||||
<td>Regional Director</td>
|
|
||||||
<td>Edinburgh</td>
|
|
||||||
<td>51</td>
|
|
||||||
<td>2008-11-13</td>
|
|
||||||
<td>$183,000</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Michael Bruce</td>
|
|
||||||
<td>Javascript Developer</td>
|
|
||||||
<td>Singapore</td>
|
|
||||||
<td>29</td>
|
|
||||||
<td>2011-06-27</td>
|
|
||||||
<td>$183,000</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Donna Snider</td>
|
|
||||||
<td>Customer Support</td>
|
|
||||||
<td>New York</td>
|
|
||||||
<td>27</td>
|
|
||||||
<td>2011-01-25</td>
|
|
||||||
<td>$112,000</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
</body>
|
|
||||||
<script>
|
|
||||||
$('#example').dataTable( {
|
|
||||||
"pageLength": 20
|
|
||||||
} );
|
|
||||||
</script>
|
|
||||||
</html>
|
|
||||||
7
public/assets/bootstrap.bundle.min.js
vendored
7
public/assets/bootstrap.bundle.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
6
public/assets/bootstrap.min.css
vendored
6
public/assets/bootstrap.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
19
public/assets/datatables.min.css
vendored
19
public/assets/datatables.min.css
vendored
File diff suppressed because one or more lines are too long
22
public/assets/datatables.min.js
vendored
22
public/assets/datatables.min.js
vendored
File diff suppressed because one or more lines are too long
2
public/assets/jquery-3.7.1.slim.min.js
vendored
2
public/assets/jquery-3.7.1.slim.min.js
vendored
File diff suppressed because one or more lines are too long
84
spark
84
spark
@ -1,84 +0,0 @@
|
|||||||
#!/usr/bin/env php
|
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This file is part of CodeIgniter 4 framework.
|
|
||||||
*
|
|
||||||
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* --------------------------------------------------------------------
|
|
||||||
* CODEIGNITER COMMAND-LINE TOOLS
|
|
||||||
* --------------------------------------------------------------------
|
|
||||||
* The main entry point into the CLI system and allows you to run
|
|
||||||
* commands and perform maintenance on your application.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
*---------------------------------------------------------------
|
|
||||||
* CHECK SERVER API
|
|
||||||
*---------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Refuse to run when called from php-cgi
|
|
||||||
if (str_starts_with(PHP_SAPI, 'cgi')) {
|
|
||||||
exit("The cli tool is not supported when running php-cgi. It needs php-cli to function!\n\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
*---------------------------------------------------------------
|
|
||||||
* CHECK PHP VERSION
|
|
||||||
*---------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
$minPhpVersion = '8.1'; // If you update this, don't forget to update `public/index.php`.
|
|
||||||
if (version_compare(PHP_VERSION, $minPhpVersion, '<')) {
|
|
||||||
$message = sprintf(
|
|
||||||
'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s',
|
|
||||||
$minPhpVersion,
|
|
||||||
PHP_VERSION
|
|
||||||
);
|
|
||||||
|
|
||||||
exit($message);
|
|
||||||
}
|
|
||||||
|
|
||||||
// We want errors to be shown when using it from the CLI.
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
ini_set('display_errors', '1');
|
|
||||||
|
|
||||||
/*
|
|
||||||
*---------------------------------------------------------------
|
|
||||||
* SET THE CURRENT DIRECTORY
|
|
||||||
*---------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Path to the front controller
|
|
||||||
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);
|
|
||||||
|
|
||||||
// Ensure the current directory is pointing to the front controller's directory
|
|
||||||
chdir(FCPATH);
|
|
||||||
|
|
||||||
/*
|
|
||||||
*---------------------------------------------------------------
|
|
||||||
* BOOTSTRAP THE APPLICATION
|
|
||||||
*---------------------------------------------------------------
|
|
||||||
* This process sets up the path constants, loads and registers
|
|
||||||
* our autoloader, along with Composer's, loads our constants
|
|
||||||
* and fires up an environment-specific bootstrapping.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// LOAD OUR PATHS CONFIG FILE
|
|
||||||
// This is the line that might need to be changed, depending on your folder structure.
|
|
||||||
require FCPATH . '../app/Config/Paths.php';
|
|
||||||
// ^^^ Change this line if you move your application folder
|
|
||||||
|
|
||||||
$paths = new Config\Paths();
|
|
||||||
|
|
||||||
// LOAD THE FRAMEWORK BOOTSTRAP FILE
|
|
||||||
require $paths->systemDirectory . '/Boot.php';
|
|
||||||
|
|
||||||
exit(CodeIgniter\Boot::bootSpark($paths));
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
<IfModule authz_core_module>
|
|
||||||
Require all denied
|
|
||||||
</IfModule>
|
|
||||||
<IfModule !authz_core_module>
|
|
||||||
Deny from all
|
|
||||||
</IfModule>
|
|
||||||
118
tests/README.md
118
tests/README.md
@ -1,118 +0,0 @@
|
|||||||
# Running Application Tests
|
|
||||||
|
|
||||||
This is the quick-start to CodeIgniter testing. Its intent is to describe what
|
|
||||||
it takes to set up your application and get it ready to run unit tests.
|
|
||||||
It is not intended to be a full description of the test features that you can
|
|
||||||
use to test your application. Those details can be found in the documentation.
|
|
||||||
|
|
||||||
## Resources
|
|
||||||
|
|
||||||
* [CodeIgniter 4 User Guide on Testing](https://codeigniter.com/user_guide/testing/index.html)
|
|
||||||
* [PHPUnit docs](https://phpunit.de/documentation.html)
|
|
||||||
* [Any tutorials on Unit testing in CI4?](https://forum.codeigniter.com/showthread.php?tid=81830)
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
It is recommended to use the latest version of PHPUnit. At the time of this
|
|
||||||
writing, we are running version 9.x. Support for this has been built into the
|
|
||||||
**composer.json** file that ships with CodeIgniter and can easily be installed
|
|
||||||
via [Composer](https://getcomposer.org/) if you don't already have it installed globally.
|
|
||||||
|
|
||||||
```console
|
|
||||||
> composer install
|
|
||||||
```
|
|
||||||
|
|
||||||
If running under macOS or Linux, you can create a symbolic link to make running tests a touch nicer.
|
|
||||||
|
|
||||||
```console
|
|
||||||
> ln -s ./vendor/bin/phpunit ./phpunit
|
|
||||||
```
|
|
||||||
|
|
||||||
You also need to install [XDebug](https://xdebug.org/docs/install) in order
|
|
||||||
for code coverage to be calculated successfully. After installing `XDebug`, you must add `xdebug.mode=coverage` in the **php.ini** file to enable code coverage.
|
|
||||||
|
|
||||||
## Setting Up
|
|
||||||
|
|
||||||
A number of the tests use a running database.
|
|
||||||
In order to set up the database edit the details for the `tests` group in
|
|
||||||
**app/Config/Database.php** or **.env**.
|
|
||||||
Make sure that you provide a database engine that is currently running on your machine.
|
|
||||||
More details on a test database setup are in the
|
|
||||||
[Testing Your Database](https://codeigniter.com/user_guide/testing/database.html) section of the documentation.
|
|
||||||
|
|
||||||
## Running the tests
|
|
||||||
|
|
||||||
The entire test suite can be run by simply typing one command-line command from the main directory.
|
|
||||||
|
|
||||||
```console
|
|
||||||
> ./phpunit
|
|
||||||
```
|
|
||||||
|
|
||||||
If you are using Windows, use the following command.
|
|
||||||
|
|
||||||
```console
|
|
||||||
> vendor\bin\phpunit
|
|
||||||
```
|
|
||||||
|
|
||||||
You can limit tests to those within a single test directory by specifying the
|
|
||||||
directory name after phpunit.
|
|
||||||
|
|
||||||
```console
|
|
||||||
> ./phpunit app/Models
|
|
||||||
```
|
|
||||||
|
|
||||||
## Generating Code Coverage
|
|
||||||
|
|
||||||
To generate coverage information, including HTML reports you can view in your browser,
|
|
||||||
you can use the following command:
|
|
||||||
|
|
||||||
```console
|
|
||||||
> ./phpunit --colors --coverage-text=tests/coverage.txt --coverage-html=tests/coverage/ -d memory_limit=1024m
|
|
||||||
```
|
|
||||||
|
|
||||||
This runs all of the tests again collecting information about how many lines,
|
|
||||||
functions, and files are tested. It also reports the percentage of the code that is covered by tests.
|
|
||||||
It is collected in two formats: a simple text file that provides an overview as well
|
|
||||||
as a comprehensive collection of HTML files that show the status of every line of code in the project.
|
|
||||||
|
|
||||||
The text file can be found at **tests/coverage.txt**.
|
|
||||||
The HTML files can be viewed by opening **tests/coverage/index.html** in your favorite browser.
|
|
||||||
|
|
||||||
## PHPUnit XML Configuration
|
|
||||||
|
|
||||||
The repository has a ``phpunit.xml.dist`` file in the project root that's used for
|
|
||||||
PHPUnit configuration. This is used to provide a default configuration if you
|
|
||||||
do not have your own configuration file in the project root.
|
|
||||||
|
|
||||||
The normal practice would be to copy ``phpunit.xml.dist`` to ``phpunit.xml``
|
|
||||||
(which is git ignored), and to tailor it as you see fit.
|
|
||||||
For instance, you might wish to exclude database tests, or automatically generate
|
|
||||||
HTML code coverage reports.
|
|
||||||
|
|
||||||
## Test Cases
|
|
||||||
|
|
||||||
Every test needs a *test case*, or class that your tests extend. CodeIgniter 4
|
|
||||||
provides one class that you may use directly:
|
|
||||||
* `CodeIgniter\Test\CIUnitTestCase`
|
|
||||||
|
|
||||||
Most of the time you will want to write your own test cases that extend `CIUnitTestCase`
|
|
||||||
to hold functions and services common to your test suites.
|
|
||||||
|
|
||||||
## Creating Tests
|
|
||||||
|
|
||||||
All tests go in the **tests/** directory. Each test file is a class that extends a
|
|
||||||
**Test Case** (see above) and contains methods for the individual tests. These method
|
|
||||||
names must start with the word "test" and should have descriptive names for precisely what
|
|
||||||
they are testing:
|
|
||||||
`testUserCanModifyFile()` `testOutputColorMatchesInput()` `testIsLoggedInFailsWithInvalidUser()`
|
|
||||||
|
|
||||||
Writing tests is an art, and there are many resources available to help learn how.
|
|
||||||
Review the links above and always pay attention to your code coverage.
|
|
||||||
|
|
||||||
### Database Tests
|
|
||||||
|
|
||||||
Tests can include migrating, seeding, and testing against a mock or live database.
|
|
||||||
Be sure to modify the test case (or create your own) to point to your seed and migrations
|
|
||||||
and include any additional steps to be run before tests in the `setUp()` method.
|
|
||||||
See [Testing Your Database](https://codeigniter.com/user_guide/testing/database.html)
|
|
||||||
for details.
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Support\Database\Migrations;
|
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
|
||||||
|
|
||||||
class ExampleMigration extends Migration
|
|
||||||
{
|
|
||||||
protected $DBGroup = 'tests';
|
|
||||||
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
$this->forge->addField('id');
|
|
||||||
$this->forge->addField([
|
|
||||||
'name' => ['type' => 'varchar', 'constraint' => 31],
|
|
||||||
'uid' => ['type' => 'varchar', 'constraint' => 31],
|
|
||||||
'class' => ['type' => 'varchar', 'constraint' => 63],
|
|
||||||
'icon' => ['type' => 'varchar', 'constraint' => 31],
|
|
||||||
'summary' => ['type' => 'varchar', 'constraint' => 255],
|
|
||||||
'created_at' => ['type' => 'datetime', 'null' => true],
|
|
||||||
'updated_at' => ['type' => 'datetime', 'null' => true],
|
|
||||||
'deleted_at' => ['type' => 'datetime', 'null' => true],
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->forge->addKey('name');
|
|
||||||
$this->forge->addKey('uid');
|
|
||||||
$this->forge->addKey(['deleted_at', 'id']);
|
|
||||||
$this->forge->addKey('created_at');
|
|
||||||
|
|
||||||
$this->forge->createTable('factories');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
$this->forge->dropTable('factories');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Support\Database\Seeds;
|
|
||||||
|
|
||||||
use CodeIgniter\Database\Seeder;
|
|
||||||
|
|
||||||
class ExampleSeeder extends Seeder
|
|
||||||
{
|
|
||||||
public function run(): void
|
|
||||||
{
|
|
||||||
$factories = [
|
|
||||||
[
|
|
||||||
'name' => 'Test Factory',
|
|
||||||
'uid' => 'test001',
|
|
||||||
'class' => 'Factories\Tests\NewFactory',
|
|
||||||
'icon' => 'fas fa-puzzle-piece',
|
|
||||||
'summary' => 'Longer sample text for testing',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'Widget Factory',
|
|
||||||
'uid' => 'widget',
|
|
||||||
'class' => 'Factories\Tests\WidgetPlant',
|
|
||||||
'icon' => 'fas fa-puzzle-piece',
|
|
||||||
'summary' => 'Create widgets in your factory',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'Evil Factory',
|
|
||||||
'uid' => 'evil-maker',
|
|
||||||
'class' => 'Factories\Evil\MyFactory',
|
|
||||||
'icon' => 'fas fa-book-dead',
|
|
||||||
'summary' => 'Abandon all hope, ye who enter here',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
$builder = $this->db->table('factories');
|
|
||||||
|
|
||||||
foreach ($factories as $factory) {
|
|
||||||
$builder->insert($factory);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Support\Libraries;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ConfigReader
|
|
||||||
*
|
|
||||||
* An extension of BaseConfig that prevents the constructor from
|
|
||||||
* loading external values. Used to read actual local values from
|
|
||||||
* a config file.
|
|
||||||
*/
|
|
||||||
class ConfigReader extends \Config\App
|
|
||||||
{
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Support\Models;
|
|
||||||
|
|
||||||
use CodeIgniter\Model;
|
|
||||||
|
|
||||||
class ExampleModel extends Model
|
|
||||||
{
|
|
||||||
protected $table = 'factories';
|
|
||||||
protected $primaryKey = 'id';
|
|
||||||
protected $returnType = 'object';
|
|
||||||
protected $useSoftDeletes = false;
|
|
||||||
protected $allowedFields = [
|
|
||||||
'name',
|
|
||||||
'uid',
|
|
||||||
'class',
|
|
||||||
'icon',
|
|
||||||
'summary',
|
|
||||||
];
|
|
||||||
protected $useTimestamps = true;
|
|
||||||
protected $validationRules = [];
|
|
||||||
protected $validationMessages = [];
|
|
||||||
protected $skipValidation = false;
|
|
||||||
}
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use CodeIgniter\Test\CIUnitTestCase;
|
|
||||||
use CodeIgniter\Test\DatabaseTestTrait;
|
|
||||||
use Tests\Support\Database\Seeds\ExampleSeeder;
|
|
||||||
use Tests\Support\Models\ExampleModel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
final class ExampleDatabaseTest extends CIUnitTestCase
|
|
||||||
{
|
|
||||||
use DatabaseTestTrait;
|
|
||||||
|
|
||||||
protected $seed = ExampleSeeder::class;
|
|
||||||
|
|
||||||
public function testModelFindAll(): void
|
|
||||||
{
|
|
||||||
$model = new ExampleModel();
|
|
||||||
|
|
||||||
// Get every row created by ExampleSeeder
|
|
||||||
$objects = $model->findAll();
|
|
||||||
|
|
||||||
// Make sure the count is as expected
|
|
||||||
$this->assertCount(3, $objects);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSoftDeleteLeavesRow(): void
|
|
||||||
{
|
|
||||||
$model = new ExampleModel();
|
|
||||||
$this->setPrivateProperty($model, 'useSoftDeletes', true);
|
|
||||||
$this->setPrivateProperty($model, 'tempUseSoftDeletes', true);
|
|
||||||
|
|
||||||
/** @var stdClass $object */
|
|
||||||
$object = $model->first();
|
|
||||||
$model->delete($object->id);
|
|
||||||
|
|
||||||
// The model should no longer find it
|
|
||||||
$this->assertNull($model->find($object->id));
|
|
||||||
|
|
||||||
// ... but it should still be in the database
|
|
||||||
$result = $model->builder()->where('id', $object->id)->get()->getResult();
|
|
||||||
|
|
||||||
$this->assertCount(1, $result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>403 Forbidden</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use CodeIgniter\Test\CIUnitTestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
final class ExampleSessionTest extends CIUnitTestCase
|
|
||||||
{
|
|
||||||
public function testSessionSimple(): void
|
|
||||||
{
|
|
||||||
$session = service('session');
|
|
||||||
|
|
||||||
$session->set('logged_in', 123);
|
|
||||||
$this->assertSame(123, $session->get('logged_in'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use CodeIgniter\Test\CIUnitTestCase;
|
|
||||||
use Config\App;
|
|
||||||
use Tests\Support\Libraries\ConfigReader;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
final class HealthTest extends CIUnitTestCase
|
|
||||||
{
|
|
||||||
public function testIsDefinedAppPath(): void
|
|
||||||
{
|
|
||||||
$this->assertTrue(defined('APPPATH'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testBaseUrlHasBeenSet(): void
|
|
||||||
{
|
|
||||||
$validation = service('validation');
|
|
||||||
|
|
||||||
$env = false;
|
|
||||||
|
|
||||||
// Check the baseURL in .env
|
|
||||||
if (is_file(HOMEPATH . '.env')) {
|
|
||||||
$env = preg_grep('/^app\.baseURL = ./', file(HOMEPATH . '.env')) !== false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($env) {
|
|
||||||
// BaseURL in .env is a valid URL?
|
|
||||||
// phpunit.xml.dist sets app.baseURL in $_SERVER
|
|
||||||
// So if you set app.baseURL in .env, it takes precedence
|
|
||||||
$config = new App();
|
|
||||||
$this->assertTrue(
|
|
||||||
$validation->check($config->baseURL, 'valid_url'),
|
|
||||||
'baseURL "' . $config->baseURL . '" in .env is not valid URL'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the baseURL in app/Config/App.php
|
|
||||||
// You can't use Config\App, because phpunit.xml.dist sets app.baseURL
|
|
||||||
$reader = new ConfigReader();
|
|
||||||
|
|
||||||
// BaseURL in app/Config/App.php is a valid URL?
|
|
||||||
$this->assertTrue(
|
|
||||||
$validation->check($reader->baseURL, 'valid_url'),
|
|
||||||
'baseURL "' . $reader->baseURL . '" in app/Config/App.php is not valid URL'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
<IfModule authz_core_module>
|
|
||||||
Require all denied
|
|
||||||
</IfModule>
|
|
||||||
<IfModule !authz_core_module>
|
|
||||||
Deny from all
|
|
||||||
</IfModule>
|
|
||||||
11
writable/cache/index.html
vendored
11
writable/cache/index.html
vendored
@ -1,11 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>403 Forbidden</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>403 Forbidden</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>403 Forbidden</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>403 Forbidden</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>403 Forbidden</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
Loading…
x
Reference in New Issue
Block a user