add glukosa
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
@host = devcpone.aplikasi.web.id
|
||||
@labNumber = R2606110001
|
||||
@labNumber = R2605050001
|
||||
@accessToken = fc9e04e30ca9f46be9cb68687554c701c984696aedbd3b0ef5680552e01c427a
|
||||
|
||||
### Wynacom - generate token exp 3 hari
|
||||
@@ -38,3 +38,11 @@ Authorization: Bearer {{accessToken}}
|
||||
"T_OrderHeaderLabNumber": "{{labNumber}}"
|
||||
}
|
||||
|
||||
### Wynacom - cek data glucose
|
||||
POST https://{{host}}/one-api/tools/wynacom/glucose
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{accessToken}}
|
||||
|
||||
{
|
||||
"T_OrderHeaderLabNumber": "{{labNumber}}"
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ class Wynacom extends MY_Controller
|
||||
"message" => "Wynacom tools API",
|
||||
"endpoints" => array(
|
||||
"POST /tools/wynacom/sampling_timestamp",
|
||||
"POST /tools/wynacom/glucose",
|
||||
"POST /tools/wynacom/generate_token",
|
||||
"POST /tools/wynacom/check_token",
|
||||
"POST /tools/wynacom/token_setting",
|
||||
@@ -170,6 +171,22 @@ class Wynacom extends MY_Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function glucose()
|
||||
{
|
||||
try {
|
||||
$this->validate_wynacom_token($this->get_access_token_param());
|
||||
|
||||
$order = $this->require_order_header();
|
||||
$lab_number = $order["T_OrderHeaderLabNumber"];
|
||||
|
||||
$this->sys_ok($this->get_glucose_result($lab_number));
|
||||
exit;
|
||||
} catch (Exception $exc) {
|
||||
$this->sys_error($exc->getMessage());
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
private function require_order_header()
|
||||
{
|
||||
$lab_number = $this->get_lab_number_param();
|
||||
@@ -467,6 +484,39 @@ class Wynacom extends MY_Controller
|
||||
return $qry->result_array();
|
||||
}
|
||||
|
||||
private function get_glucose_result($lab_number)
|
||||
{
|
||||
$sql = "SELECT
|
||||
LEFT(COALESCE(NULLIF(tt.T_TestSasCode, ''), nt.Nat_TestCode), 8) AS cpone_test_code,
|
||||
COALESCE(tt.T_TestName, nt.Nat_TestName) AS cpone_test_name,
|
||||
IFNULL(ntm.Nat_TestMapCode, 'Un-Map') AS lis_test_code,
|
||||
og.OrderGlucoseResult AS result_glucosa
|
||||
FROM t_orderheader oh
|
||||
JOIN order_glucose og ON og.OrderGlucoseT_OrderHeaderID = oh.T_OrderHeaderID
|
||||
AND og.OrderGlucoseIsActive = 'Y'
|
||||
JOIN nat_test nt ON nt.Nat_TestID = og.OrderGlucoseNat_TestID
|
||||
AND nt.Nat_TestIsActive = 'Y'
|
||||
LEFT JOIN t_orderdetail od ON od.T_OrderDetailT_OrderHeaderID = oh.T_OrderHeaderID
|
||||
AND od.T_OrderDetailIsActive = 'Y'
|
||||
LEFT JOIN t_test tt ON tt.T_TestID = od.T_OrderDetailT_TestID
|
||||
AND tt.T_TestNat_TestID = og.OrderGlucoseNat_TestID
|
||||
AND tt.T_TestIsActive = 'Y'
|
||||
LEFT JOIN nat_testmap ntm ON ntm.Nat_TestMapNat_TestID = og.OrderGlucoseNat_TestID
|
||||
AND ntm.Nat_TestMapIsActive = 'Y'
|
||||
WHERE oh.T_OrderHeaderLabNumber = ?
|
||||
AND oh.T_OrderHeaderIsActive = 'Y'
|
||||
GROUP BY og.OrderGlucoseID
|
||||
ORDER BY cpone_test_code, cpone_test_name";
|
||||
$qry = $this->db->query($sql, array($lab_number));
|
||||
|
||||
if (!$qry) {
|
||||
$this->sys_error_db("Gagal mengambil data glucose", $this->db);
|
||||
exit;
|
||||
}
|
||||
|
||||
return $qry->result_array();
|
||||
}
|
||||
|
||||
private function union_sampling_timestamp($lab_number)
|
||||
{
|
||||
$sql = "SELECT *
|
||||
|
||||
@@ -366,6 +366,91 @@ child_test.T_TestParentT_TestID != 0 -> pakai parent test
|
||||
|
||||
Contoh: anak Hematologi Lengkap akan digabung sebagai parent Hematologi Lengkap.
|
||||
|
||||
## Glucose Result
|
||||
|
||||
Endpoint:
|
||||
|
||||
```http
|
||||
POST /glucose
|
||||
```
|
||||
|
||||
Header:
|
||||
|
||||
```http
|
||||
Authorization: Bearer {access_token}
|
||||
```
|
||||
|
||||
Request body:
|
||||
|
||||
```json
|
||||
{
|
||||
"T_OrderHeaderLabNumber": "R2606110001"
|
||||
}
|
||||
```
|
||||
|
||||
Contoh curl:
|
||||
|
||||
```bash
|
||||
curl -X POST "https://devcpone.aplikasi.web.id/one-api/tools/wynacom/glucose" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer TOKEN_VALUE" \
|
||||
-d '{"T_OrderHeaderLabNumber":"R2606110001"}'
|
||||
```
|
||||
|
||||
Contoh PHP `curl_init()`:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$baseUrl = 'https://devcpone.aplikasi.web.id/one-api/tools/wynacom';
|
||||
$accessToken = 'TOKEN_VALUE';
|
||||
|
||||
$ch = curl_init($baseUrl . '/glucose');
|
||||
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||
'Content-Type: application/json',
|
||||
'Authorization: Bearer ' . $accessToken
|
||||
));
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array(
|
||||
'T_OrderHeaderLabNumber' => 'R2606110001'
|
||||
)));
|
||||
|
||||
$response = curl_exec($ch);
|
||||
|
||||
if (curl_errno($ch)) {
|
||||
die('Curl error: ' . curl_error($ch));
|
||||
}
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
$glucoseResponse = json_decode($response, true);
|
||||
print_r($glucoseResponse);
|
||||
```
|
||||
|
||||
Contoh response:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "OK",
|
||||
"data": [
|
||||
{
|
||||
"cpone_test_code": "10530200",
|
||||
"cpone_test_name": "Glukosa Darah 2 Jam PP",
|
||||
"lis_test_code": "00000251",
|
||||
"result_glucosa": "120"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Sumber data:
|
||||
- `order_glucose.OrderGlucoseResult` sebagai `result_glucosa`
|
||||
- `t_test.T_TestSasCode` sebagai `cpone_test_code`, dipotong 8 digit dari depan
|
||||
- `t_test.T_TestName` sebagai `cpone_test_name`
|
||||
- `nat_testmap.Nat_TestMapCode` sebagai `lis_test_code`
|
||||
|
||||
## Error Umum
|
||||
|
||||
Token tidak dikirim:
|
||||
|
||||
Reference in New Issue
Block a user