Merge branch 'zakaria'
This commit is contained in:
commit
f06b7a1984
@ -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',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -4,17 +4,19 @@ namespace App\Controllers;
|
|||||||
|
|
||||||
use CodeIgniter\RESTful\ResourceController;
|
use CodeIgniter\RESTful\ResourceController;
|
||||||
use CodeIgniter\I18n\Time;
|
use CodeIgniter\I18n\Time;
|
||||||
|
use Ramsey\Uuid\Uuid;
|
||||||
|
|
||||||
class API_Results extends ResourceController {
|
class API_Results extends ResourceController {
|
||||||
|
|
||||||
public function results($accessnumber) {
|
public function results($accessnumber) {
|
||||||
$db = \Config\Database::connect();
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
// $sql = "select HOSTORDERNUMBER as HISNO from SP_REQUESTS where SP_ACCESSNUMBER='$accessnumber'";
|
$sql = "select HOSTORDERNUMBER as VISITNUMBER from SP_REQUESTS where SP_ACCESSNUMBER='$accessnumber'";
|
||||||
// $query = $db->query($sql);
|
$query = $db->query($sql);
|
||||||
// $results = $query->getResultArray();
|
$results = $query->getResultArray();
|
||||||
// $data['LISNO'] = $accessnumber;
|
|
||||||
// $hisno = $results[0]['HISNO'];
|
$visitnumber = $results[0]['VISITNUMBER'];
|
||||||
|
|
||||||
// $sql = "select TESTCODE, TESTORDER, RESTYPE, RESVALUE, RESFLAG, UNIT, REFRANGE, USERVAL, RESDATE
|
// $sql = "select TESTCODE, TESTORDER, RESTYPE, RESVALUE, RESFLAG, UNIT, REFRANGE, USERVAL, RESDATE
|
||||||
// from cmod.dbo.CM_RESULTS r
|
// from cmod.dbo.CM_RESULTS r
|
||||||
// where ACCESSNUMBER='$accessnumber'
|
// where ACCESSNUMBER='$accessnumber'
|
||||||
@ -22,6 +24,7 @@ class API_Results extends ResourceController {
|
|||||||
// $query = $db->query($sql);
|
// $query = $db->query($sql);
|
||||||
// $results = $query->getResultArray();
|
// $results = $query->getResultArray();
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT sp.HOSTORDERNUMBER, hiso.LOC, hiso.PAYERNAME
|
$sql = "SELECT sp.HOSTORDERNUMBER, hiso.LOC, hiso.PAYERNAME
|
||||||
FROM dbo.SP_REQUESTS sp
|
FROM dbo.SP_REQUESTS sp
|
||||||
LEFT JOIN cmod.dbo.CM_HIS_ORDERS hiso ON hiso.VISITNUMBER = sp.HOSTORDERNUMBER
|
LEFT JOIN cmod.dbo.CM_HIS_ORDERS hiso ON hiso.VISITNUMBER = sp.HOSTORDERNUMBER
|
||||||
@ -29,11 +32,27 @@ class API_Results extends ResourceController {
|
|||||||
$query = $db->query($sql);
|
$query = $db->query($sql);
|
||||||
$results = $query->getResultArray();
|
$results = $query->getResultArray();
|
||||||
|
|
||||||
|
|
||||||
$location = $results[0]['LOC'] == null ? 'PBMC Bali' : 'PBMC Surabaya';
|
$location = $results[0]['LOC'] == null ? 'PBMC Bali' : 'PBMC Surabaya';
|
||||||
$payer_name = $results[0]['PAYERNAME'] == null ? '' : $results[0]['PAYERNAME'];
|
$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
|
$sql = "select
|
||||||
dc.CHAPID,
|
dc.CHAPID,
|
||||||
|
t.DEPTH as depth_test,
|
||||||
dc.FULLTEXT as chap_eng,
|
dc.FULLTEXT as chap_eng,
|
||||||
dc.FULLTEXT as chap_ind,
|
dc.FULLTEXT as chap_ind,
|
||||||
st.FULLTEXT as serum_type,
|
st.FULLTEXT as serum_type,
|
||||||
@ -41,7 +60,6 @@ class API_Results extends ResourceController {
|
|||||||
cdt.TEXT2 as test_ind,
|
cdt.TEXT2 as test_ind,
|
||||||
cdt.UNIT as UNITTEXT,
|
cdt.UNIT as UNITTEXT,
|
||||||
cdt.REFFTEXT,
|
cdt.REFFTEXT,
|
||||||
t.DEPTH as text_depth,
|
|
||||||
t.NOTPRINTABLE,
|
t.NOTPRINTABLE,
|
||||||
t.TESTORDER,
|
t.TESTORDER,
|
||||||
t.RESTYPE as code_type,
|
t.RESTYPE as code_type,
|
||||||
@ -59,36 +77,17 @@ class API_Results extends ResourceController {
|
|||||||
left join cmod.dbo.CM_DICT_TESTS cdt on dt.TESTCODE=cdt.TESTCODE
|
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
|
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'
|
where r.ACCESSNUMBER='$accessnumber'
|
||||||
ORDER BY t.TESTORDER";
|
ORDER BY dc.CHAPID, depth_test, t.TESTORDER";
|
||||||
$query = $db->query($sql);
|
$query = $db->query($sql);
|
||||||
$test_results = $query->getResultArray();
|
$test_results = $query->getResultArray();
|
||||||
|
// 5010200007
|
||||||
// $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
|
// Digunakan Untuk Hasil test
|
||||||
foreach ($test_results as $result) {
|
foreach ($test_results as $result) {
|
||||||
|
|
||||||
// var_dump($result);die();
|
if ($result['depth_test'] === 0) {
|
||||||
|
|
||||||
if ($result['text_depth'] == 0) {
|
|
||||||
// $uuid32 = $this->generateUUID32();
|
|
||||||
$uuid24 = $this->generateUUID24();
|
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
"test_ref_id"=> $uuid24,
|
"test_ref_id"=> " - TM ",
|
||||||
"service_id"=> "",
|
"service_id"=> "",
|
||||||
"service_name"=> $result['test_eng'],
|
"service_name"=> $result['test_eng'],
|
||||||
"test_medium"=> $result['serum_type'],
|
"test_medium"=> $result['serum_type'],
|
||||||
@ -96,14 +95,35 @@ class API_Results extends ResourceController {
|
|||||||
"chapter_type"=> $result['chap_eng'],
|
"chapter_type"=> $result['chap_eng'],
|
||||||
"test_summary"=> "",
|
"test_summary"=> "",
|
||||||
"status"=> "",
|
"status"=> "",
|
||||||
|
"subtest_results" => [],
|
||||||
];
|
];
|
||||||
|
|
||||||
array_push($response['data']['test_results'], $data);
|
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);
|
return $this->respond($response,200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user