kemenkesri / satusehat-mediator-client-php
Library to acceleare SATUSEHAT implementation via Interoperability Mediator
Requires
- php: ^5.5 || ^7.0 || ^8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- dcarbone/php-fhir-generated: ^2.0 || ^3.0
- guzzlehttp/guzzle: ^6.5
- guzzlehttp/psr7: ^1.7 || ^2.0
- kamermans/guzzle-oauth2-subscriber: ^1.0 || ^1.1
Requires (Dev)
- brainmaestro/composer-git-hooks: ^2.8 || ^3.0
- friendsofphp/php-cs-fixer: ^2.19 || ^3.5
- laravel/tinker: ^1.0 || ^2.9
- phpunit/phpunit: ^5.7 || ^8.0 || ^9.0
- dev-main
- v1.0.2
- v1.0.1
- v1.0.0
- dev-feat/adjustment-mediator-form
- dev-feat/tb-fase234
- dev-main-5.6
- dev-feat/hardcoded-generate-token
- dev-feat/fhir-service-request
- dev-feat/fhir-resource-api
- dev-feat/create-permohonan
- dev-feat/mediator-form
- dev-release
- dev-fix/submit-response
- dev-initial-commit
- dev-feat/send-data-to-mediator
This package is auto-updated.
Last update: 2025-03-11 07:08:37 UTC
README
Spesifikasi API ini merupakan contoh untuk menggunakan Mediator Interoperabilitas SATUSEHAT yang secara khusus ditujukan untuk mempercepat dan memudahkan proses interoperabilitas data Rekam Medis Elektronik (RME) antara sistem informasi di Fasilitas Kesehatan (Rumah Sakit, Puskesmas, Klinik, Laboratorium, dll) dengan Platform SATUSEHAT. Mediator Interoperabilitas SATUSEHAT menyediakan format custom yang disederhanakan dari format HL7 FHIR sebagai perantara antara sistem RME dengan SATUSEHAT beserta sistem informasi kesehatan yang ada ditingkat nasional.
Package PHP ini digenerate secara otomatis menggunakan Swagger Codegen project:
Requirements
PHP 7.4 and later
Installation & Usage
Composer
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/kemenkesri/satusehat-mediator-client-php.git"
}
],
"require": {
"kemenkesri/satusehat-mediator-client-php": "*@dev"
}
}
Then run composer install
Manual Installation
Download the files and include autoload.php
:
require_once('/path/to/satusehat-mediator-client-php/vendor/autoload.php');
Tests
To run the unit tests:
composer install
./vendor/bin/phpunit
Getting Started
Please follow the installation procedure and then run the following:
Get Patient Info
<?php 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; require_once(__DIR__ . '/vendor/autoload.php'); $bearerToken = 'ABCD'; Configuration::setConfigurationConstant( 'development', [ 'authUrl' => 'https://api-satusehat-stg.dto.kemkes.go.id/oauth2/v1/accesstoken', 'tokenUrl' => '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; } ?>
Submit RME data
<?php 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; require_once(__DIR__ . '/vendor/autoload.php'); $bearerToken = 'ABCD'; Configuration::setConfigurationConstant( 'development', [ 'authUrl' => 'https://api-satusehat-stg.dto.kemkes.go.id/oauth2/v1/accesstoken', 'tokenUrl' => '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; } ?>
Documentation for API Endpoints
All URIs are relative to https://mediator-satusehat.kemkes.go.id/api-dev/satusehat/rme/v1.0
Class | Method | HTTP request | Description |
---|---|---|---|
PatientApi | patientPost | POST /patient | Mengambil informasi terkait pasien |
SubmitDataApi | syncPost | POST /sync | Kirim data RME ke Mediator dengan format Non-FHIR |
Documentation For Models
- ApiError
- CarePlan
- Composition
- Condition
- DiagnosticReport
- DocumentStatus
- Encounter
- EpisodeOfCare
- GetPatientRequest
- GetPatientResponse
- Immunization
- Location
- MediatorResourceBasic
- Medication
- MedicationIngredient
- MedicationStatement
- Observation
- ObservationComponent
- Patient
- PatientBasic
- Procedure
- QuestionnaireResponse
- SatuSehatResponse
- ServiceRequest
- Specimen
- SubmitRequest
- SubmitResponse
- TbConfirm
- TbSuspect
Documentation For Authorization
satusehat_auth
- Type: OAuth
- Flow: accessCode
- Authorization URL: https://api-satusehat-stg.dto.kemkes.go.id/oauth2/v1
- Scopes:
satusehat_bearer
- Type: HTTP bearer authentication