separate req n res, fix BV SV to only B / S
This commit is contained in:
parent
b05d9d99e7
commit
f9e5e4d9f7
@ -6,5 +6,5 @@ use CodeIgniter\Router\RouteCollection;
|
|||||||
* @var RouteCollection $routes
|
* @var RouteCollection $routes
|
||||||
*/
|
*/
|
||||||
$routes->get('/', 'Pages::home');
|
$routes->get('/', 'Pages::home');
|
||||||
$routes->post('/api/requests/', 'API::requests');
|
$routes->post('/api/requests/', 'API_Requests::requests');
|
||||||
$routes->get('/api/results/(:any)', 'API::results/$1');
|
$routes->get('/api/results/(:any)', 'API_Results::results/$1');
|
||||||
|
|||||||
@ -4,7 +4,7 @@ namespace App\Controllers;
|
|||||||
use CodeIgniter\RESTful\ResourceController;
|
use CodeIgniter\RESTful\ResourceController;
|
||||||
use CodeIgniter\I18n\Time;
|
use CodeIgniter\I18n\Time;
|
||||||
|
|
||||||
class API extends ResourceController {
|
class API_Requests extends ResourceController {
|
||||||
|
|
||||||
public function requests() {
|
public function requests() {
|
||||||
$db = \Config\Database::connect();
|
$db = \Config\Database::connect();
|
||||||
@ -107,105 +107,4 @@ class API extends ResourceController {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public function results($accessnumber) {
|
|
||||||
$db = \Config\Database::connect();
|
|
||||||
|
|
||||||
// $sql = "select HOSTORDERNUMBER as HISNO from SP_REQUESTS where SP_ACCESSNUMBER='$accessnumber'";
|
|
||||||
// $query = $db->query($sql);
|
|
||||||
// $results = $query->getResultArray();
|
|
||||||
// $data['LISNO'] = $accessnumber;
|
|
||||||
// $hisno = $results[0]['HISNO'];
|
|
||||||
// $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'];
|
|
||||||
|
|
||||||
$sql = "select
|
|
||||||
dc.CHAPID,
|
|
||||||
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.DEPTH as text_depth,
|
|
||||||
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 t.TESTORDER";
|
|
||||||
$query = $db->query($sql);
|
|
||||||
$test_results = $query->getResultArray();
|
|
||||||
|
|
||||||
// $uuid24 = $this->generateUUID24();
|
|
||||||
$response = [
|
|
||||||
"headers" => [
|
|
||||||
"Content-Type" => "application/json",
|
|
||||||
"Authorization" => "Transmedic api key"
|
|
||||||
],
|
|
||||||
"data" => [
|
|
||||||
"reference_id" => "",
|
|
||||||
"created" => "2024-10-19T02:11:06.424654Z",
|
|
||||||
"company_name" => $payer_name,
|
|
||||||
"branch" => $location,
|
|
||||||
"test_results" => []
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
// Digunakan Untuk Hasil test
|
|
||||||
foreach ($test_results as $result) {
|
|
||||||
|
|
||||||
// var_dump($result);die();
|
|
||||||
|
|
||||||
if ($result['text_depth'] == 0) {
|
|
||||||
// $uuid32 = $this->generateUUID32();
|
|
||||||
$uuid24 = $this->generateUUID24();
|
|
||||||
|
|
||||||
$data = [
|
|
||||||
"test_ref_id"=> $uuid24,
|
|
||||||
"service_id"=> "",
|
|
||||||
"service_name"=> $result['test_eng'],
|
|
||||||
"test_medium"=> $result['serum_type'],
|
|
||||||
"test_container"=> "",
|
|
||||||
"chapter_type"=> $result['chap_eng'],
|
|
||||||
"test_summary"=> "",
|
|
||||||
"status"=> "",
|
|
||||||
];
|
|
||||||
|
|
||||||
array_push($response['data']['test_results'], $data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return $this->respond($response,200);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
110
app/Controllers/API_Results.php
Normal file
110
app/Controllers/API_Results.php
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use CodeIgniter\RESTful\ResourceController;
|
||||||
|
use CodeIgniter\I18n\Time;
|
||||||
|
|
||||||
|
class API_Results extends ResourceController {
|
||||||
|
|
||||||
|
public function results($accessnumber) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
// $sql = "select HOSTORDERNUMBER as HISNO from SP_REQUESTS where SP_ACCESSNUMBER='$accessnumber'";
|
||||||
|
// $query = $db->query($sql);
|
||||||
|
// $results = $query->getResultArray();
|
||||||
|
// $data['LISNO'] = $accessnumber;
|
||||||
|
// $hisno = $results[0]['HISNO'];
|
||||||
|
// $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'];
|
||||||
|
|
||||||
|
$sql = "select
|
||||||
|
dc.CHAPID,
|
||||||
|
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.DEPTH as text_depth,
|
||||||
|
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 t.TESTORDER";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$test_results = $query->getResultArray();
|
||||||
|
|
||||||
|
// $uuid24 = $this->generateUUID24();
|
||||||
|
$response = [
|
||||||
|
"headers" => [
|
||||||
|
"Content-Type" => "application/json",
|
||||||
|
"Authorization" => "Transmedic api key"
|
||||||
|
],
|
||||||
|
"data" => [
|
||||||
|
"reference_id" => "",
|
||||||
|
"created" => "2024-10-19T02:11:06.424654Z",
|
||||||
|
"company_name" => $payer_name,
|
||||||
|
"branch" => $location,
|
||||||
|
"test_results" => []
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
// Digunakan Untuk Hasil test
|
||||||
|
foreach ($test_results as $result) {
|
||||||
|
|
||||||
|
// var_dump($result);die();
|
||||||
|
|
||||||
|
if ($result['text_depth'] == 0) {
|
||||||
|
// $uuid32 = $this->generateUUID32();
|
||||||
|
$uuid24 = $this->generateUUID24();
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
"test_ref_id"=> $uuid24,
|
||||||
|
"service_id"=> "",
|
||||||
|
"service_name"=> $result['test_eng'],
|
||||||
|
"test_medium"=> $result['serum_type'],
|
||||||
|
"test_container"=> "",
|
||||||
|
"chapter_type"=> $result['chap_eng'],
|
||||||
|
"test_summary"=> "",
|
||||||
|
"status"=> "",
|
||||||
|
];
|
||||||
|
|
||||||
|
array_push($response['data']['test_results'], $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond($response,200);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
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');
|
||||||
|
}
|
||||||
|
}
|
||||||
69
env
Normal file
69
env
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Example Environment Configuration file
|
||||||
|
#
|
||||||
|
# This file can be used as a starting point for your own
|
||||||
|
# custom .env files, and contains most of the possible settings
|
||||||
|
# available in a default install.
|
||||||
|
#
|
||||||
|
# By default, all of the settings are commented out. If you want
|
||||||
|
# to override the setting, you must un-comment it by removing the '#'
|
||||||
|
# at the beginning of the line.
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# ENVIRONMENT
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# CI_ENVIRONMENT = production
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# APP
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# app.baseURL = ''
|
||||||
|
# If you have trouble with `.`, you could also use `_`.
|
||||||
|
# app_baseURL = ''
|
||||||
|
# app.forceGlobalSecureRequests = false
|
||||||
|
# app.CSPEnabled = false
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# DATABASE
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# database.default.hostname = localhost
|
||||||
|
# database.default.database = ci4
|
||||||
|
# database.default.username = root
|
||||||
|
# database.default.password = root
|
||||||
|
# database.default.DBDriver = MySQLi
|
||||||
|
# database.default.DBPrefix =
|
||||||
|
# database.default.port = 3306
|
||||||
|
|
||||||
|
# If you use MySQLi as tests, first update the values of Config\Database::$tests.
|
||||||
|
# database.tests.hostname = localhost
|
||||||
|
# database.tests.database = ci4_test
|
||||||
|
# database.tests.username = root
|
||||||
|
# database.tests.password = root
|
||||||
|
# database.tests.DBDriver = MySQLi
|
||||||
|
# database.tests.DBPrefix =
|
||||||
|
# database.tests.charset = utf8mb4
|
||||||
|
# database.tests.DBCollat = utf8mb4_general_ci
|
||||||
|
# database.tests.port = 3306
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# ENCRYPTION
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# encryption.key =
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# SESSION
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# session.driver = 'CodeIgniter\Session\Handlers\FileHandler'
|
||||||
|
# session.savePath = null
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# LOGGER
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# logger.threshold = 4
|
||||||
@ -14,7 +14,6 @@ Options -Indexes
|
|||||||
# If you installed CodeIgniter in a subfolder, you will need to
|
# If you installed CodeIgniter in a subfolder, you will need to
|
||||||
# change the following line to match the subfolder you need.
|
# change the following line to match the subfolder you need.
|
||||||
# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
|
# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
|
||||||
# RewriteBase /
|
|
||||||
|
|
||||||
# Redirect Trailing Slashes...
|
# Redirect Trailing Slashes...
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
@ -35,7 +34,6 @@ Options -Indexes
|
|||||||
|
|
||||||
# Ensure Authorization header is passed along
|
# Ensure Authorization header is passed along
|
||||||
RewriteCond %{HTTP:Authorization} .
|
RewriteCond %{HTTP:Authorization} .
|
||||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
||||||
<IfModule !mod_rewrite.c>
|
<IfModule !mod_rewrite.c>
|
||||||
|
|||||||
33
public/web.config
Normal file
33
public/web.config
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<system.webServer>
|
||||||
|
<rewrite>
|
||||||
|
<rules>
|
||||||
|
<rule name="Imported Rule 1" stopProcessing="true">
|
||||||
|
<match url="^" ignoreCase="false" />
|
||||||
|
<conditions logicalGrouping="MatchAll">
|
||||||
|
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
|
||||||
|
<add input="{URL}" pattern="(.+)/$" ignoreCase="false" />
|
||||||
|
</conditions>
|
||||||
|
<action type="Redirect" url="{C:1}" redirectType="Permanent" />
|
||||||
|
</rule>
|
||||||
|
<rule name="Imported Rule 2" stopProcessing="true">
|
||||||
|
<match url="^" ignoreCase="false" />
|
||||||
|
<conditions logicalGrouping="MatchAll">
|
||||||
|
<add input="{HTTPS}" pattern="^on$" ignoreCase="false" negate="true" />
|
||||||
|
<add input="{HTTP_HOST}" pattern="^www\.(.+)$" />
|
||||||
|
</conditions>
|
||||||
|
<action type="Redirect" url="http://{C:1}{URL}" redirectType="Permanent" />
|
||||||
|
</rule>
|
||||||
|
<rule name="Imported Rule 3" stopProcessing="true">
|
||||||
|
<match url="^([\s\S]*)$" />
|
||||||
|
<conditions logicalGrouping="MatchAll">
|
||||||
|
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
|
||||||
|
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
|
||||||
|
</conditions>
|
||||||
|
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
|
||||||
|
</rule>
|
||||||
|
</rules>
|
||||||
|
</rewrite>
|
||||||
|
</system.webServer>
|
||||||
|
</configuration>
|
||||||
Loading…
x
Reference in New Issue
Block a user