Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') or exit('No direct script access allowed');
- use GuzzleHttp\Client;
- class Vclaim_model extends CI_Model
- {
- private $_client;
- private $_header;
- private $_dataid = "";
- private $_secretKey = "";
- private $_url = "https://new-api.bpjs-kesehatan.go.id:8080/new-vclaim-rest/";
- public function __construct()
- {
- parent::__construct();
- $this->_client = new Client();
- date_default_timezone_set('UTC');
- $dataid = $this->_dataid;
- $secretKey = $this->_secretKey;
- $tStamp = strval(time() - strtotime('1970-01-01 00:00:00'));
- $signature = hash_hmac('sha256', $dataid . "&" . $tStamp, $secretKey, true);
- $encodedSignature = base64_encode($signature);
- //$urlencodedSignature = urlencode($encodedSignature);
- $this->_header = [
- 'x-cons-id' => $dataid,
- 'x-timestamp' => $tStamp,
- 'x-signature' => $encodedSignature,
- 'Content-Type' => 'application/x-www-form-urlencoded',
- 'Accept' => 'application/json',
- ];
- }
- public function detailKepesertaan($type, $noKartu)
- {
- if (!$type || !$noKartu) {
- return null;
- }
- if ($type == 1) {
- //KTP
- $method = 'Peserta/nik/' . $noKartu . '/tglSEP/' . date("Y-m-d") . '';
- } else {
- //NO kartu BPJS
- $method = 'Peserta/nokartu/' . $noKartu . '/tglSEP/' . date("Y-m-d") . '';
- }
- $response = $this->_client->request('GET', $method, [
- 'base_uri' => $this->_url,
- 'headers' => $this->_header,
- 'verify' => false,
- ]);
- $result = json_decode($response->getBody()->getContents(), true);
- return $result;
- }
- public function newSEP($data)
- {
- $method = 'SEP/1.1/insert';
- $response = $this->_client->request('POST', $method, [
- 'base_uri' => $this->_url,
- 'headers' => $this->_header,
- 'verify' => false,
- 'json' => $data,
- ]);
- $result = json_decode($response->getBody()->getContents(), true);
- return $result;
- }
- public function detailSEP($noSEP)
- {
- $method = 'SEP/' . $noSEP;
- $response = $this->_client->request('GET', $method, [
- 'base_uri' => $this->_url,
- 'headers' => $this->_header,
- 'verify' => false,
- ]);
- $result = json_decode($response->getBody()->getContents(), true);
- return $result;
- }
- public function cariRujukanByNorujukan($faskes, $norujukan)
- {
- if (!$faskes || !$norujukan) {
- return null;
- }
- if ($faskes == 1) {
- //KTP
- $method = 'Rujukan/' . $norujukan . '';
- } else {
- //NO kartu BPJS
- $method = 'Rujukan/RS/' . $norujukan . '';
- }
- $response = $this->_client->request('GET', $method, [
- 'base_uri' => $this->_url,
- 'headers' => $this->_header,
- 'verify' => false,
- ]);
- $result = json_decode($response->getBody()->getContents(), true);
- return $result;
- }
- public function listRujukanByNoka($faskes, $noka)
- {
- if (!$faskes || !$noka) {
- return null;
- }
- if ($faskes == 1) {
- //KTP
- $method = 'Rujukan/List/Peserta/' . $noka . '';
- } else {
- //NO kartu BPJS
- $method = 'Rujukan/RS/List/Peserta/' . $noka . '';
- }
- $response = $this->_client->request('GET', $method, [
- 'base_uri' => $this->_url,
- 'headers' => $this->_header,
- 'verify' => false,
- ]);
- $result = json_decode($response->getBody()->getContents(), true);
- return $result;
- }
- public function detailrujukanByNoKa($faskes, $noka)
- {
- if ($faskes == 1) {
- //KTP
- $method = 'Rujukan/Peserta/' . $noka . '';
- } else {
- //NO kartu BPJS
- $method = 'Rujukan/RS/Peserta/' . $noka . '';
- }
- $response = $this->_client->request('GET', $method, [
- 'base_uri' => $this->_url,
- 'headers' => $this->_header,
- 'verify' => false,
- ]);
- $result = json_decode($response->getBody()->getContents(), true);
- return $result;
- }
- public function historyPelayananPeserta($noKa, $tglMulai, $tglAkhir)
- {
- $method = 'monitoring/HistoriPelayanan/NoKartu/' . $noKa . '/tglAwal/' . $tglMulai . '/tglAkhir/' . $tglAkhir . '';
- $response = $this->_client->request('GET', $method, [
- 'base_uri' => $this->_url,
- 'headers' => $this->_header,
- 'verify' => false,
- ]);
- $result = json_decode($response->getBody()->getContents(), true);
- return $result;
- }
- public function searchDiagnosa($keyword)
- {
- $method = 'referensi/diagnosa/' . $keyword . '';
- $response = $this->_client->request('GET', $method, [
- 'base_uri' => $this->_url,
- 'headers' => $this->_header,
- 'verify' => false,
- ]);
- $result = json_decode($response->getBody()->getContents(), true);
- return $result;
- }
- public function searchPoli($keyword)
- {
- $method = 'referensi/poli/' . $keyword . '';
- $response = $this->_client->request('GET', $method, [
- 'base_uri' => $this->_url,
- 'headers' => $this->_header,
- 'verify' => false,
- ]);
- $result = json_decode($response->getBody()->getContents(), true);
- return $result;
- }
- public function searchDPJP($jenispelayanan = 1, $tanggal, $spesialisasi)
- {
- $method = 'referensi/dokter/pelayanan/' . $jenispelayanan . '/tglPelayanan/' . $tanggal . '/Spesialis/' . $spesialisasi . '';
- $response = $this->_client->request('GET', $method, [
- 'base_uri' => $this->_url,
- 'headers' => $this->_header,
- 'verify' => false,
- ]);
- $result = json_decode($response->getBody()->getContents(), true);
- return $result;
- }
- public function asalfaskesrujukan()
- {
- $faskes = [
- ["id" => "1", "faskes" => "Faskes Tingkat 1 (PCARE/PUSKESMAS/DR KELUARGA)"],
- ["id" => "2", "faskes" => "Faskes Tingkat 2 (RUMAH SAKIT)"]
- ];
- return $faskes;
- }
- public function statuskecelakaan()
- {
- // $statuskecelakaan = [
- // ["id" => "0", "status" => "Bukan Kecelakaan"],
- // ["id" => "1", "status" => "Kecelakaan Lalulintas dan bukan kecelakaan kerja"],
- // ["id" => "2", "status" => "Kecelakaan Lalulintas dan kecelakaan kerja"],
- // ["id" => "3", "status" => "Kecelakaan Kerja"]
- // ];
- $statuskecelakaan = [
- ["id" => "0", "status" => "Bukan Kecelakaan"]
- ];
- return $statuskecelakaan;
- }
- private function _listRujukanPcareByNoka($noka)
- {
- $method = 'Rujukan/List/Peserta/' . $noka . '';
- $response = $this->_client->request('GET', $method, [
- 'base_uri' => $this->_url,
- 'headers' => $this->_header,
- 'verify' => false,
- ]);
- $result = json_decode($response->getBody()->getContents(), true);
- return $result;
- }
- private function _listRujukanRSByNoka($noka)
- {
- $method = 'Rujukan/RS/List/Peserta/' . $noka . '';
- $response = $this->_client->request('GET', $method, [
- 'base_uri' => $this->_url,
- 'headers' => $this->_header,
- 'verify' => false,
- ]);
- $result = json_decode($response->getBody()->getContents(), true);
- return $result;
- }
- public function getAllRujukanBynoka($noka)
- {
- $pcare = $this->_listRujukanPcareByNoka($noka);
- $rs = $this->_listRujukanRSByNoka($noka);
- $peserta = $this->detailKepesertaan(2, $noka);
- $lastpcare = $this->detailrujukanByNoKa(1, $noka);
- $lastrs = $this->detailrujukanByNoKa(2, $noka);
- $list = [
- 'peserta' => $peserta,
- 'pcare' => $pcare,
- 'lastpcare' => $lastpcare,
- 'rs' => $rs,
- 'lastrs' => $lastrs
- ];
- return $list;
- }
- public function newPengajuanSEP($data)
- {
- $method = 'Sep/pengajuanSEP';
- $response = $this->_client->request('POST', $method, [
- 'base_uri' => $this->_url,
- 'headers' => $this->_header,
- 'verify' => false,
- 'json' => $data,
- ]);
- $result = json_decode($response->getBody()->getContents(), true);
- return $result;
- }
- public function approvalSEP($data)
- {
- $method = 'Sep/aprovalSEP';
- $response = $this->_client->request('POST', $method, [
- 'base_uri' => $this->_url,
- 'headers' => $this->_header,
- 'verify' => false,
- 'json' => $data,
- ]);
- $result = json_decode($response->getBody()->getContents(), true);
- return $result;
- }
- public function updateTanggalPulangSEP($data)
- {
- $method = 'Sep/updtglplg';
- $response = $this->_client->request('PUT', $method, [
- 'base_uri' => $this->_url,
- 'headers' => $this->_header,
- 'verify' => false,
- 'json' => $data,
- ]);
- $result = json_decode($response->getBody()->getContents(), true);
- return $result;
- }
- public function dataKunjunganPasienBPJS($tanggalSEP, $JnsPelayanan)
- {
- $method = 'Monitoring/Kunjungan/Tanggal/' . $tanggalSEP . '/JnsPelayanan/' . $JnsPelayanan . '';
- $response = $this->_client->request('GET', $method, [
- 'base_uri' => $this->_url,
- 'headers' => $this->_header,
- 'verify' => false
- ]);
- $result = json_decode($response->getBody()->getContents(), true);
- return $result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement