Page Status: updated 2022-10-31

Prescription - Fetch

Page index

Introduction

Sv. Hämta förskrivningar.

This page describes the process of fetching the resource MedicationRequest for a patient by a few examples.

Note that a MedicationRequest may have a data lock on some information (sv: spärrad information) for certain roles. Some information in the response is excluded in such cases. It is also possible, for a patient or practitioner, to lock a full MedicationRequest instance for certain roles, meaning that the instance is not available at all for the person requesting the resource.

A MedicationRequest can be fetched in different ways. See MedicationRequest query operations for information about all options.

In short, a query request is either a read, that is, a retrieval via the resource ID, or a search via a search condition. The result differs between a read and a search. A search results in a Bundle being returned containing all matching resources. If there are no hits, an empty Bundle is returned. A read results in the requested resource being returned or an error if no resource with the requested ID exists. If a system error occurs both searches and reads result in an error (i.e. an OperationOutcome).

Fetching a MedicationRequest is done by one of the following operations.

GET [base]/MedicationRequest/[id]
GET [base]/MedicationRequest?[search parameters]

A set of HTTP headers must be provided in order to fetch a prescription. See HTTP Header and Authorization for more information about the various headers used by the National Medication List.

See MedicationRequest for more information about the MedicationRequest resource.

Before a MedicationRequest can be retrieved amd presented to the user other information is needed from the National Medication List. For more information on different scenarios and what information is required for each scenario, see Handbok för vård- och apotekstjänster: Verksamhetsområden.

Examples

HTTP Headers

See HTTP Header and Authorization for generic information about all HTTP headers used by the National Medication List including information about authorization, purpose and access type. The authorization token is translated to an authority role. The authority role together with the purpose and type of access is used by the National Medication List to determine what actions a user may perform and what information the user may access.

Header Comment
authorization The users's security token
prefer Type of returned content
x-access The cause for the call
x-context-id An ID to group a sequence of requests
x-org-info Information about the users's organisation
x-patientref The logical ID of the patient
x-provenance A provenance resource with information about the user interacting with NLL
x-purpose The purpose of the call
x-request-id A random and unique ID
x-user-agent Information about the calling system

Example 1 - Fetch prescription for a patient with an identification number

This example shows how to fetch a prescription created by a healtcare provider (Create prescription as a healthcare provider) for a patient having a personal identification number (sv. personnummer). The request is made by a healthcare professional.

The request is made as a read by the logical id, GET [base]/MedicationRequest/1f4b3dc7-e0ca-4783-9ba2-8137c0a1967f.

HTTP headers

Header Value Comment
authorization {...,"FORSKRIVARKOD":"9000027","VARDGIVARE":"0123456789","YRKESKOD":["LK"],"loa":3} Selected information from the OAuth2-ticket in decoded form
prefer
x-access TILLFALLIGT_SAMTYCKE
x-org-info {"orgenhetsOrt":"Orgsala"} Decoded value
x-patientref 722c3e2f-52bb-458f-af46-aa22466f478c
x-provenance
x-purpose VARD
x-request-id fcc5ed38-43bf-4bbd-8fc5-ad403e0bb9aa
x-user-agent {"name":"Test system testaren","version":"0.01010101010.1 beta"} Decoded value

HTTP body: Fetch MedicationRequest as a healthcare provider

Example 2 - Fetch prescription created by a pharmacy

This example shows how to fetch a prescription created by a pharmacy (Create prescription as a pharmacy) for a patient having a personal identification number (sv. personnummer). The request is made by a healthcare professional.

The request is made as a read by the logical id, GET [base]/MedicationRequest/9c25b201-bbf7-406b-a791-37a20b241e3a.

HTTP headers

Header Value Comment
authorization {...,"FORSKRIVARKOD":"9000027","VARDGIVARE":"0123456789","YRKESKOD":["LK"],"loa":3} Selected information from the OAuth2-ticket in decoded form
prefer
x-access TILLFALLIGT_SAMTYCKE
x-org-info {"orgenhetsOrt":"Orgsala"} Decoded value
x-patientref 722c3e2f-52bb-458f-af46-aa22466f478c
x-provenance
x-purpose VARD
x-request-id 66696a28-f950-4243-a21c-0d1a4bf34922
x-user-agent {"name":"Test system testaren","version":"0.01010101010.1 beta"} Decoded value

HTTP body: Fetch MedicationRequest created by a pharmacy

Example 3 - Fetch prescription for a patient without identification number

This example shows how to fetch a prescription for a patient lacking identification number (sv. personnummer) (Create prescription for a patient on birthdate). The request is made by a pharmacy staff.

The request is made as a read by the logical id, GET [base]/MedicationRequest/85ddc225-3d1d-4c03-9b7b-886e77f8b74b.

HTTP headers

Header Value Comment
authorization {...,"APOTEKSID":"7350046611966","LEGITIMATIONSKOD":"920007","YRKESKOD":["AP"],"loa":3} Selected information from the OAuth2-ticket in decoded form
prefer
x-access TILLFALLIGT_SAMTYCKE_BEHANDLINGSORSAK
x-org-info {"orgenhetsOrt":"Orgsala"} Decoded value
x-patientref
x-provenance
x-purpose EXPEDIERING
x-request-id 87a60b43-fb52-41b4-b793-66cdad878188
x-user-agent {"name":"Test system testaren","version":"0.01010101010.1 beta"} Decoded value

HTTP body: Fetch MedicationRequest without a national identity number

Example 4 - Fetch prescription of medical consumables

This example shows how to fetch a prescription of a medical consumable (Create prescription of medical consumables). The request is made by a healthcare professional.

The request is made as a read by the logical id, GET [base]/MedicationRequest/3a4fcef3-57b9-476a-a419-b96ed790e3f7.

HTTP headers

Header Value Comment
authorization {...,"FORSKRIVARKOD":"9000027","VARDGIVARE":"0123456789","YRKESKOD":["LK"],"loa":3} Selected information from the OAuth2-ticket in decoded form
prefer
x-access UTAN_KRAV_SAMTYCKE_BARN
x-org-info {"orgenhetsOrt":"Orgsala"} Decoded value
x-patientref cefe1521-d4dc-48bc-be51-52a12b9697ef
x-provenance
x-purpose VARD
x-request-id f26e514a-f550-4f1c-a1d0-f660ace5e13c
x-user-agent {"name":"Test system testaren","version":"0.01010101010.1 beta"} Decoded value

HTTP body: Fetch MedicationRequest for medical consumables

Example 5 - Fetch prescription for a patient having a multi-dose dispensing consent

This example shows how to fetch a prescription of multi-dose dispensing for a patient who has a multi-dose dispensing consent (Create prescription for a patient having a multi-dose dispensing consent). The request is made by a healthcare professional.

The request is made as a read by the logical id, GET [base]/MedicationRequest/eaea2586-e672-4d14-9a72-99ae05fb6df0.

HTTP headers

Header Value Comment
authorization {...,"FORSKRIVARKOD":"9000027","VARDGIVARE":"0123456789","YRKESKOD":["LK"],"loa":3} Selected information from the OAuth2-ticket in decoded form
prefer
x-access DOSPATIENTS_UPPGIFTER
x-org-info {"orgenhetsOrt":"Orgsala"} Decoded value
x-patientref 722c3e2f-52bb-458f-af46-aa22466f478c
x-provenance
x-purpose VARD
x-request-id 9cc4f881-4e06-4999-a299-4da93e9126f1
x-user-agent {"name":"Test system testaren","version":"0.01010101010.1 beta"} Decoded value

HTTP body: Fetch MedicationRequest for multi dose dispensing

Example 6 - Fetch prescriptions by a search

This example shows how to fetch all prescriptions related to a patient. The request is made by a healthcare professional.

The request is made as a search by the logical id of the patient, GET [base]/MedicationRequest?patient._id=722c3e2f-52bb-458f-af46-aa22466f478c.

HTTP headers

Header Value Comment
authorization {...,"FORSKRIVARKOD":"9000027","VARDGIVARE":"0123456789","YRKESKOD":["LK"],"loa":3} Selected information from the OAuth2-ticket in decoded form
prefer
x-access TILLFALLIGT_SAMTYCKE
x-org-info {"orgenhetsOrt":"Orgsala"} Decoded value
x-patientref 722c3e2f-52bb-458f-af46-aa22466f478c
x-provenance
x-purpose VARD
x-request-id bb82ee7e-c90b-42c4-b58c-d4f3f0e17814
x-user-agent {"name":"Test system testaren","version":"0.01010101010.1 beta"} Decoded value

HTTP body: Fetch MedicationRequest by a search