<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kemenkesri / satusehat-mediator-client-php example snippets
use Mediator\SatuSehat\Lib\Client\Api\PatientApi;
use Mediator\SatuSehat\Lib\Client\Configuration;
use Mediator\SatuSehat\Lib\Client\Model\GetPatientRequest;
use Mediator\SatuSehat\Lib\Client\OAuthClient;
'https://api-satusehat-stg.dto.kemkes.go.id/oauth2/v1/refreshtoken',
'baseUrl' => 'https://mediator-satusehat.kemkes.go.id/api-dev/satusehat/rme/v1.0',
// 'clientId' => $clientId,
// 'clientSecret' => $clientSecret,
'bearerToken' => $bearerToken,
]
);
$apiInstance = new PatientApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new OAuthClient(Configuration::getDefaultConfiguration('development'))
);
$body = new GetPatientRequest();
try {
$result = $apiInstance->patientPost($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PatientApi->patientPost: ', $e->getMessage(), PHP_EOL;
}
use Mediator\SatuSehat\Lib\Client\Api\SubmitDataApi;
use Mediator\SatuSehat\Lib\Client\Configuration;
use Mediator\SatuSehat\Lib\Client\Model\SubmitRequest;
use Mediator\SatuSehat\Lib\Client\OAuthClient;
=> 'https://api-satusehat-stg.dto.kemkes.go.id/oauth2/v1/refreshtoken',
'baseUrl' => 'https://mediator-satusehat.kemkes.go.id/api-dev/satusehat/rme/v1.0',
// 'clientId' => $clientId,
// 'clientSecret' => $clientSecret,
'bearerToken' => $bearerToken,
]
);
$apiInstance = new Mediator\SatuSehat\Lib\Client\Api\SubmitDataApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new OAuthClient(Configuration::getDefaultConfiguration('development'))
);
$body = new SubmitRequest(
"profile" => [ "TB" ],
"organization_id" => "100011961",
"location_id" => "ef011065-38c9-46f8-9c35-d1fe68966a3e",
"practitioner_nik" => "N10000001",
"patient" => [
"nik" => "3515120000000000",
"name" => "ABCD",
"birthDate" => "2019-10-25",
"address" => [
[
"use" => "temp", // temp = alamat domisili, home = alamat ktp
"country" => "id",
"province" => "35", // kode depdagri 2 digit untuk provinsi
"city" => "3578", // kode depdagri 4 digit untuk kab/kota
"district" => "357801", // kode depdagri 6 digit untuk kecamatan
"village" => "3578011002", // kode depdagri 10 digit untuk kelurahan/desa
"rt" => "",
"rw" => "",
"postal_code" => "-",
"line" => ["alamat jalan dan informasi lainnya"]
]
],
],
"tb_suspect" => [
"tgl_daftar" => "2024-05-24",
"asal_rujukan_id" => "3",
"fasyankes_id" => "1000119617",
"jenis_fasyankes_id" => "1",
"terduga_tb_id" => "1",
"terduga_ro_id" => null,
"tipe_pasien_id" => "1",
"status_dm_id" => "1",
"status_hiv_id" => "3"
],
"encounter" => [
"encounter_id" => "83ef7e32-64f3-40a7-87c4-3cc59d44b4c6",
"local_id" => "2024-05-24 09:27:26.405593+07",
"classification" => "AMB",
"period_start" => "2024-05-24T09:28:01+07:00",
"period_in_progress" => "2024-05-24T09:58:01+07:00",
"period_end" => "2024-05-24T10:58:01+07:00"
],
"condition" => [
[
"id" => "2a073abe-1b17-441d-885c-206e8b966f5c",
"code_condition" => "Z10"
]
]
);
try {
$result = $apiInstance->syncPost($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling SubmitDataApi->syncPost: ', $e->getMessage(), PHP_EOL;
}