Guide to Configuring Digital E-Prescriptions Integrated with SatuSehat in Your Clinic
N
Back to Blog

Guide to Configuring Digital E-Prescriptions Integrated with SatuSehat in Your Clinic

Tutorial
Nugroho Setiawan · Konsultan IT & Full Stack Developer 15 Jun 2026 14 min baca 3,123 kata 364 views
Implementing digital e-prescriptions in clinics is no longer optional, but a necessity for efficiency and compliance. This article guides you step by step through integrating an e-prescription system with the SatuSehat platform, improving service and data accuracy. Learn the concepts, technical impl

Digital transformation in the healthcare sector has become an inevitability, driving various healthcare facilities to adopt technology to improve efficiency and quality of service. One crucial area is medication prescribing management. Manual paper-based prescriptions are often a source of various problems, ranging from difficult-to-read doctor's handwriting (causing medication administration errors), inefficiency in medication preparation time, to the risk of losing prescriptions. Data from WHO shows that medication errors are one of the leading causes of preventable patient injury, with unclear prescriptions contributing a significant percentage. In Indonesia, regulations such as Minister of Health Regulation (PMK) Number 24 of 2022 on Medical Records have explicitly mandated healthcare facilities to implement Electronic Medical Records (EMR), including e-prescription modules. Compliance with this regulation is not only important to avoid sanctions, but also to build an integrated healthcare ecosystem through the SatuSehat platform. This article will guide you in depth on how to configure and integrate a digital e-prescription system in your clinic with the SatuSehat platform. We will discuss basic concepts, technical implementation details using the latest technology, runnable code examples, error handling, and best practices to ensure successful and sustainable e-prescription adoption.

Basic Concepts of Digital E-Prescription & SatuSehat Integration

Digital e-prescription is the process of prescribing medication electronically by doctors through a clinic management information system (Clinic MIS), replacing conventional paper-based prescriptions. The main benefits of e-prescription adoption are significant. First, it drastically reduces the potential for medication errors that often occur due to misinterpretation of handwriting or dosage errors. A study shows that e-prescribing systems can reduce medication errors by up to 80%. Second, it improves workflow efficiency in clinics and pharmacies, speeding up the process of preparing and dispensing medication to patients. Third, it ensures better accessibility of prescription data, allowing patient prescription history to be recorded neatly and easily accessed by authorized medical personnel. Fourth, and most importantly, is regulatory compliance. PMK 24/2022 Article 26 Paragraph 1 explicitly states that prescriptions must be made electronically. With e-prescription, your clinic not only meets operational standards but also legal standards.

The main components in a digital e-prescription system include: a prescribing module on the doctor's side integrated with the Clinic MIS, a pharmacy module for the dispensing or medication preparation process, and most importantly, a data integration module with the SatuSehat platform. SatuSehat, developed by the Indonesian Ministry of Health, serves as a national health data interoperability platform. Its goal is to create a single patient medical record integrated nationally, enabling secure and efficient data exchange between healthcare facilities.

The role of the Fast Healthcare Interoperability Resources (FHIR) Release 4 (R4) standard is central in SatuSehat integration. FHIR is a standard developed by HL7 International for electronic health data exchange. It defines 'resources' as the basic units of information that can be exchanged, such as 'Patient', 'Practitioner', 'Medication', and 'MedicationRequest'. In the context of e-prescription, the 'MedicationRequest' resource is the core of the prescription data to be sent to SatuSehat. The basic data flow is as follows: doctor creates an e-prescription in the Clinic MIS > Clinic MIS formats the prescription data into an FHIR MedicationRequest resource > Clinic MIS sends the resource to the SatuSehat API > pharmacy, whether inside or outside the clinic, can retrieve the prescription data from SatuSehat for the dispensing process. This creates a nationally digitized and integrated prescribing ecosystem.

Technical Implementation Details of E-Prescription Integration with SatuSehat

The initial step in implementing a digital e-prescription integrated with SatuSehat is infrastructure and account preparation. You must have an account on the SatuSehat developer portal, which will provide you with a Client ID and Client Secret. These credentials are essential for the authentication process to the SatuSehat API, both in the sandbox environment for development and the production environment. Make sure you have read and understood the latest SatuSehat FHIR profile documentation, as this profile is frequently updated and implementation details highly depend on the applicable profile version.

For backend technology, we recommend using Laravel version 11.x with PHP version 8.2 or newer, combined with PostgreSQL version 16.x database. Laravel offers a robust ecosystem for API development and data management, while PostgreSQL is known for its reliability and scalability. To interact with the SatuSehat FHIR API, you can use an HTTP client such as Guzzle for PHP. If you use Java, HAPI FHIR Client is an excellent choice. The SatuSehat API endpoint you will use to send and receive FHIR data is https://api-satusehat.kemkes.go.id/fhir-r4.

Authenticate to SatuSehat using the OAuth 2.0 standard with the client_credentials grant type. This means you will use the Client ID and Client Secret to obtain an access_token from the SatuSehat authentication endpoint. This access_token must then be included in every request to the SatuSehat FHIR API as the header Authorization: Bearer [access_token]. This token usually has a short validity period (for example 1 hour), so you need to implement a mechanism to refresh the token automatically before it expires.

Data structure is a crucial aspect. You need to map the prescription data in your Clinic SIM into the FHIR MedicationRequest resource structure according to the SatuSehat profile. The data that must be prepared at a minimum includes: Patient ID (NIK registered with Dukcapil), Practitioner ID (doctor's NIP or STR), Drug Code (using BPOM or SNOMED CT standards if available), Dose, Quantity, Route of administration, and Duration of use. It is important to ensure that all this data is valid and complies with the format required by SatuSehat. For example, the patient's NIK must be 16 digits and valid. The use of FHIR R4 is mandatory for SatuSehat. Perform strict data validation on your application side before sending it to SatuSehat to avoid error responses and ensure data integrity.

Implementation Code Example

This section will present a concrete code example using PHP (Laravel) and the Guzzle HTTP client to interact with the SatuSehat API. You can adapt this code for your clinic system.

1. Getting an Access Token from SatuSehat

The first step is to obtain the access token required for every request to the FHIR API. This token is obtained by sending your Client ID and Client Secret to the SatuSehat authentication endpoint.

<?phpnamespace App\'Services;use GuzzleHttp\Client;use GuzzleHttp\Exception\GuzzleException;class SatuSehatAuthService{    protected $client;    protected $baseUrl;    protected $clientId;    protected $clientSecret;    public function __construct()    {        $this->client = new Client();        $this->baseUrl = env('SATUSEHAT_AUTH_BASE_URL', 'https://api-satusehat.kemkes.go.id/oauth2/v1');        $this->clientId = env('SATUSEHAT_CLIENT_ID');        $this->clientSecret = env('SATUSEHAT_CLIENT_SECRET');    }    public function getAccessToken(): ?string    {        try {            $response = $this->client->post($this->baseUrl . '/accesstoken?grant_type=client_credentials', [                'headers' => [                    'Content-Type' => 'application/x-www-form-urlencoded'                ],                'form_params' => [                    'client_id' => $this->clientId,                    'client_secret' => $this->clientSecret                ]            ]);            $data = json_decode($response->getBody()->getContents(), true);            return $data['access_token'] ?? null;        } catch (GuzzleException $e) {            // Log error atau throw exception            \Log::error('Failed to get SatuSehat access token: ' . $e->getMessage());            return null;        }    }}

The code above defines a service to manage authentication to SatuSehat. The getAccessToken() function will send a POST request to the /accesstoken endpoint with your Client ID and Client Secret. Make sure you have configured the environment variables SATUSEHAT_AUTH_BASE_URL, SATUSEHAT_CLIENT_ID, and SATUSEHAT_CLIENT_SECRET in your Laravel application's .env file. The access token successfully obtained will be returned as a string. If a failure occurs, the error message will be logged and the function will return null.

2. Sending the MedicationRequest Resource to SatuSehat

After obtaining the access token, you can send the MedicationRequest resource that has been formatted according to the FHIR R4 standard and the SatuSehat profile. This example assumes you have prescription data already prepared in a PHP array format.

<?phpnamespace App\Services;use GuzzleHttp\Client;use GuzzleHttp\Exception\GuzzleException;use App\Services\SatuSehatAuthService;class SatuSehatFhirService{    protected $client;    protected $fhirBaseUrl;    protected $authService;    public function __construct(SatuSehatAuthService $authService)    {        $this->client = new Client();        $this->fhirBaseUrl = env('SATUSEHAT_FHIR_BASE_URL', 'https://api-satusehat.kemkes.go.id/fhir-r4');        $this->authService = $authService;    }    public function sendMedicationRequest(array $medicationRequestData): ?array    {        $accessToken = $this->authService->getAccessToken();        if (!$accessToken) {            return ['error' => 'Failed to get access token'];        }        try {            $response = $this->client->post($this->fhirBaseUrl . '/MedicationRequest', [                'headers' => [                    'Authorization' => 'Bearer ' . $accessToken,                    'Content-Type' => 'application/json'                ],                'json' => $medicationRequestData            ]);            return json_decode($response->getBody()->getContents(), true);        } catch (GuzzleException $e) {            // Log error atau throw exception            \]Log::error('Failed to send MedicationRequest to SatuSehat: ' . $e->getMessage());            return ['error' => $e->getMessage()];        }    }}

The SatuSehatFhirService class is responsible for sending MedicationRequest data. The sendMedicationRequest method first calls SatuSehatAuthService to obtain an access token. If the token is successfully obtained, it then makes a POST request to the /MedicationRequest endpoint in the SatuSehat FHIR API. The Authorization header is included with the access token, and the request body contains the prescription data in JSON format. The response from SatuSehat (usually the saved MedicationRequest resource) will be returned. Ensure that $medicationRequestData has been formatted correctly according to the SatuSehat FHIR profile.

Example FHIR Payload & Error Handling

Understanding the correct FHIR payload structure is key to successful integration. Here is an example JSON payload for a realistic MedicationRequest resource, according to the SatuSehat profile. This payload includes references to the patient, practitioner (doctor), medication, and dosage instructions.

{  "resourceType": "MedicationRequest",  "id": "{{medication_request_uuid}}",  "identifier": [    {      "use": "official",      "system": "http://sys-klinik.id/medication-request",      "value": "MR-20240101-001"    }  ],  "status": "active",  "intent": "order",  "medicationReference": {    "reference": "Medication/{{medication_uuid}}",    "display": "Paracetamol 500 mg"  },  "subject": {    "reference": "Patient/{{patient_uuid}}",    "display": "Budi Santoso"  },  "encounter": {    "reference": "Encounter/{{encounter_uuid}}"  },  "authoredOn": "2024-01-01T10:00:00+07:00",  "requester": {    "reference": "Practitioner/{{practitioner_uuid}}",    "display": "dr. Nugroho Setiawan, Sp.PD"  },  "dosageInstruction": [    {      "sequence": 1,      "text": "1 tablet 3 times a day after meals",      "timing": {        "repeat": {          "frequency": 3,          "period": 1,          "periodUnit": "d"        }      },      "route": {        "coding": [          {            "system": "http://terminology.hl7.org/CodeSystem/v3-RouteOfAdministration",            "code": "PO",            "display": "Peroral"          }        ]      },      "doseAndRate": [        {          "type": {            "coding": [              {                "system": "http://terminology.hl7.org/CodeSystem/dose-rate-type",                "code": "ordered",                "display": "Ordered"              }            ]          },          "doseQuantity": {            "value": 1,            "unit": "tablet",            "system": "http://unitsofmeasure.org",            "code": "tab"          }        }      ]    }  ],  "dispenseRequest": {    "numberOfRepeatsAllowed": 0,    "quantity": {      "value": 30,      "unit": "tablet",      "system": "http://unitsofmeasure.org",      "code": "tab"    },    "expectedSupplyDuration": {      "value": 10,      "unit": "days",      "system": "http://unitsofmeasure.org",      "code": "d"    }  }}

Note the placeholders such as {{medication_request_uuid}}, {{medication_uuid}}, {{patient_uuid}}, {{encounter_uuid}}, and {{practitioner_uuid}}. These must be replaced with valid unique IDs according to the resources you have registered in SatuSehat. For example, medication_uuid is the ID of the Medication resource representing Paracetamol 500 mg that you previously created and sent to SatuSehat. This ID is the unique ID given by SatuSehat after the resource is created.

Example Error Messages and Handling:

When interacting with external APIs like SatuSehat, error handling is a crucial aspect. You may encounter various types of errors. One common example is failed data validation:

{  "resourceType": "OperationOutcome",  "issue": [    {      "severity": "error",      "code": "invalid",      "details": {        "text": "The NIK '123456789012345' provided for Patient reference 'Patient/{{patient_uuid}}' is not valid. NIK must be 16 digits."      },      "expression": [        "MedicationRequest.subject.reference"      ]    }  ]}

The error message above indicates that the patient's NIK you provided is invalid because it is less than 16 digits. Effective error handling strategies include:

  1. Log Error Details: Whenever an API failure occurs, log in detail the request sent, the response received (including HTTP status code and error body), and the timestamp. This is very helpful in the debugging process.
  2. Automatic Notifications: Configure the system to send automatic notifications (e.g., via email or Slack) to the IT team or developers when critical or recurring errors occur.
  3. Retry Mechanism: For transient errors (e.g., temporary network connection issues or SatuSehat server being busy), implement a retry mechanism with an exponential backoff strategy. This means retrying the request after increasingly longer intervals (e.g., 1 second, 2 seconds, 4 seconds, etc.) up to a certain attempt limit.
  4. Client-Side Input Validation: Perform strict data validation on your application side before sending to SatuSehat. This can prevent most data validation errors on the SatuSehat server side, such as invalid NIK or empty required fields.
  5. Fallback Plan: Consider the worst-case scenario. If SatuSehat is inaccessible for a long time, is there a mechanism for secure local storage of prescriptions that can be re-synced after the connection is restored?

Best Practices

  1. Understand the SatuSehat Profile in Depth: Always refer to and understand the official SatuSehat FHIR profile documentation published by the Ministry of Health. This profile specifically defines which FHIR resources must be used, which fields are mandatory, the data format, and the permitted terminology. Changes to the profile may occur, so it is important to always follow the latest version.
  2. Implement Strict Data Validation: Ensure your system performs data validation on both the server and client side for every piece of data to be sent to SatuSehat. This validation must cover the format of NIK, STR, drug codes (BPOM/SNOMED CT), dates, and all mandatory fields according to the FHIR R4 standard and the SatuSehat profile. This will reduce the likelihood of errors from the SatuSehat API.
  3. Adopt a Comprehensive Logging and Monitoring System: Implement a logging system that records all API transactions, including requests and responses to SatuSehat, HTTP status, and error details. Use monitoring tools such as Sentry, Prometheus, or the ELK Stack to monitor API performance and proactively detect anomalies, ensuring the team can respond to issues quickly.
  4. Prioritize Patient Data Security: Ensure all data transmissions to and from SatuSehat use encrypted connections (HTTPS/TLS 1.2+). Store API credentials (Client ID, Client Secret) very securely, for example using environment variables or an encrypted vault, and avoid hardcoding them in the source code. Comply with health data security standards such as HIPAA or the PMK 24/2022 regulation.
  5. Build a Robust Error Handling Mechanism: Design your system to handle API failures gracefully. This includes implementing retry logic with exponential backoff for transient errors, automatic notifications to administrators when persistent errors occur, and a fallback mechanism to store data locally if the SatuSehat API cannot be reached.
  6. Perform Thorough Testing in the Sandbox Environment: Before go-live, perform a series of extensive tests in the SatuSehat sandbox environment. This includes unit, integration, and end-to-end testing for various prescribing scenarios, including positive and negative cases. Ensure all workflows function as expected and that the data sent and received is consistent.
  7. Plan for Scalability and Performance: Design the architecture of your e-prescription system so that it can handle increasing data volumes as the clinic grows. Consider using a message queue such as RabbitMQ or Kafka to process data delivery to SatuSehat asynchronously, reducing the load on the main system and improving application responsiveness.
  8. Access Token Lifecycle Management: Ensure your system has an efficient mechanism to obtain, store, and automatically refresh the SatuSehat access token before it expires. Do not hardcode tokens and avoid storing tokens in insecure locations.

FAQ

Q1: What is the main difference between a digital prescription and a regular (paper) prescription?
A1: A digital prescription is created and stored electronically in the clinic's information system, while a regular prescription is handwritten on paper. The main differences lie in efficiency, accuracy, and integration capability. Digital prescriptions reduce the risk of misreading a doctor's handwriting, enable automatic validation, speed up pharmacy workflows, and can be directly integrated with platforms such as SatuSehat for unified medical records. This also ensures compliance with the PMK 24/2022 regulation.

Q2: Are all clinics required to implement e-prescriptions?
A2: Based on PMK 24 of 2022 concerning Medical Records, all healthcare facilities in Indonesia, including clinics, are required to implement Electronic Medical Records (EMR). E-prescriptions are an integral part of EMR. The full compliance deadline set is the end of 2024. Therefore, the adoption of e-prescriptions is no longer an option, but a regulatory necessity that every clinic must fulfill.

Q3: What if there is a connection problem to SatuSehat when a doctor wants to create an e-prescription?
A3: A good e-prescription system must have an offline or disconnected-connection handling mechanism. This can include storing prescriptions locally in the clinic system and then queuing them to be sent to SatuSehat once the connection is restored (retry mechanism). Doctors and pharmacy staff can still continue the prescribing and dispensing process internally, with clear notification that the data has not yet been sent to SatuSehat. It is important to implement logging and automatic notifications so that the IT team can immediately address connectivity issues.

Q4: What data must be present in an e-prescription for it to be accepted by SatuSehat?
A4: For an e-prescription sent to SatuSehat, the minimum data that must be present and must conform to the SatuSehat FHIR profile includes patient information (a valid NIK), practitioner/doctor information (STR or NIP), drug details (BPOM or SNOMED CT drug code), dosage instructions (frequency, route, quantity), and service context (encounter). Each of these fields has a specific format and standard that must be met so that the data can be processed correctly by SatuSehat.

Q5: How long does it usually take to implement digital e-prescriptions in a clinic?
A5: The implementation time for digital e-prescriptions varies greatly, depending on the complexity of the clinic's existing system, data availability, and IT team resources. For basic integration with SatuSehat, the process can take at least 2 to 4 months, covering the requirements analysis, development, sandbox testing, and go-live preparation stages. If your clinic needs to develop a Clinic SIM from scratch, the time required will certainly be longer, perhaps 6 months to 1 year.

Q6: Is there a cost to use the SatuSehat platform?
A6: Access to the SatuSehat API provided by the Ministry of Health of the Republic of Indonesia is currently free of charge. However, costs may arise from the development and modification of your clinic's internal information system to integrate with SatuSehat. This includes costs for developer resources, server infrastructure, software licenses if any, as well as ongoing maintenance and support costs. This investment should be seen as a long-term investment for efficiency and regulatory compliance.

Implementing digital e-prescriptions integrated with SatuSehat is a strategic step that not only improves operational efficiency and service accuracy at your clinic but also ensures compliance with government regulations. By understanding the basic concepts, carefully implementing technical details, and following best practices, you can realize a modern and integrated prescribing system. This transformation will bring your clinic into an era of better healthcare, where patient data is integrated and medical processes run smoothly. If your clinic or hospital needs expert assistance in designing, developing, or integrating a digital e-prescription system with SatuSehat, our team at Nugroho Setiawan is ready to help. With deep experience in SIMRS, Clinic SIM, and BPJS/SatuSehat integration, we offer end-to-end solutions tailored to your needs. Contact us for a free consultation and realize your digital clinic, ensuring you not only meet regulations but also become a pioneer in healthcare innovation.

This article is part of the knowledge base of Nugroho Setiawan, an IT consultant in Jogja (Yogyakarta). Related solutions: SIMRS (Hospital Information System) Clinic Management System SatuSehat Integration. Need a free consultation?

Terakhir diperbarui 18 Oct 2026

Komentar

Komentar ditinjau sebelum tampil.

Belum ada komentar. Jadilah yang pertama!

Butuh bantuan implementasi?

Saya membantu konsultasi IT & pengembangan aplikasi untuk rumah sakit, klinik, dan bisnis di Yogyakarta (DIY), Magelang, dan sekitarnya.

Produk & Solusi SIMRS ERP Portfolio Konsultasi Gratis