Journalanteckningar

API change history

Journalanteckningar för en patient.

Hämta journalanteckningar

Mer information om meddelandet finns här.

Samtliga journalanteckningar för aktuell patient. Urvalet kan filtreras med avseede på tidsperiod.

OAuth scopeför åtkomst : user/JournalNote-read

Try it

Request URL

Request parameters

(optional)
string

Från registrerad tidpunkt på formatet ''1970-01-01T01:00:00''

(optional)
string

Till registrerad tidpunkt på formatet ''1970-01-01T01:00:00''

Request headers

(optional)
string

Patientens personnummer.

string
Subscription key which provides access to this API. Found in your Profile.
string
OAuth 2.0 access token obtained from OAuth2 Authorization. Supported grant types: Authorization code, Client credentials.

Request body

Response 200

Begäran lyckades för inloggad patient

[
  {
    "XSDVersion": {
      "version": 0.21
    },
    "JournalNoteEHRExtract": [
      {
        "ehr_id": {
          "extension": "SE162321000024-Cambio_Common_U:EhrId:195503071887",
          "root": "1.2.752.129.2.1.2.1"
        },
        "HCMContact": {
          "HCMContacInternaltID": "59062",
          "target_id": {
            "extension": "SE162321000024-Cambio_Common_U:RcId:Contact:59062",
            "root": "1.2.752.129.2.1.2.1"
          },
          "HCMContactBegin": {
            "value": "20150210222543"
          },
          "HCMContactType": "Mottagningsbesök",
          "HCMContactStatus": "Ankommen",
          "ContactPerformingUnit": "1253"
        },
        "ehr_system": {
          "extension": "SE162321000024-Cambio_Common_U",
          "root": "1.2.752.129.2.1.2.1"
        },
        "Note": {
          "NoteId": {
            "extension": "SE162321000024-Cambio_Common_U:RcId:JournalNoteId:58723",
            "root": "Define"
          },
          "NoteTemplateName": "Daganteckning Läkare",
          "NoteActive": true,
          "NoteDateTime": {
            "value": "20150210222500"
          },
          "NoteTypeOfNote": "Daganteckning",
          "Records": {
            "Record": [
              {
                "Keyword": "BMI",
                "KeywordToolType": "Other",
                "Value": [
                  {
                    "JournalValueType": "Other"
                  }
                ],
                "OtherValue": {
                  "ArchetypeRecords": {
                    "ArchetypeRecord": [
                      {
                        "ArchetypeRecord": [
                          {
                            "ArchetypeRecord": [
                              {
                                "ArchetypeRecord": [
                                  {
                                    "DataType": "DVQUANTITY",
                                    "Magnitude": "77.0",
                                    "Unit": "kg",
                                    "Range": "0.0 - 1000.0",
                                    "Name": "Vikt"
                                  }
                                ],
                                "EventDateTime": {
                                  "startDateTime": {
                                    "value": "20150210222543"
                                  },
                                  "endDateTime": {
                                    "value": "20150210222543"
                                  }
                                },
                                "ArchetypeId": "openEHR-EHR-OBSERVATION.body_weight.v1",
                                "Name": "Kroppsvikt"
                              },
                              {
                                "ArchetypeRecord": [
                                  {
                                    "DataType": "DVQUANTITY",
                                    "Magnitude": "164.0",
                                    "Unit": "cm",
                                    "Range": "0.0 - 1000.0",
                                    "Name": "Längd"
                                  }
                                ],
                                "EventDateTime": {
                                  "startDateTime": {
                                    "value": "20150210222543"
                                  },
                                  "endDateTime": {
                                    "value": "20150210222543"
                                  }
                                },
                                "ArchetypeId": "openEHR-EHR-OBSERVATION.height.v1",
                                "Name": "Längd"
                              }
                            ],
                            "DataType": "DVQUANTITY",
                            "Magnitude": "28.63",
                            "Unit": "kg/m2",
                            "Range": "0.0 - 1000.0",
                            "Name": "BMI (Body Mass Index)"
                          }
                        ],
                        "EventDateTime": {
                          "startDateTime": {
                            "value": "20150210222543"
                          },
                          "endDateTime": {
                            "value": "20150210222543"
                          }
                        },
                        "ArchetypeId": "openEHR-EHR-OBSERVATION.body_mass_index.v1",
                        "Name": "BMI"
                      }
                    ]
                  }
                }
              }
            ]
          },
          "NoteVersionDateTime": {
            "value": "20150210222810"
          },
          "NoteSignDateTime": {
            "value": "20150210222811"
          }
        },
        "time_created": {
          "value": "20170123190425"
        },
        "Patient": {
          "PatientID": {
            "extension": "195503071887",
            "root": "1.2.752.129.2.1.3.1"
          },
          "PatientProtectedId": false,
          "PatientName": {
            "PatientFamilyName": "Lennartsson",
            "PatientMiddleName": "",
            "PatientGivenName": [
              {
                "qualifier": "CL",
                "value": "Lena"
              }
            ]
          },
          "PatientInternalID": "13"
        },
        "AccessZoneUnit": {
          "UnitID": {
            "extension": "SE162321000024-0016497",
            "root": "1.2.752.129.2.1.4.1"
          },
          "UnitLocalID": {
            "extension": "",
            "root": "LocalUnitOID"
          }
        },
        "CareProviders": {
          "CareProvider": [
            {
              "CareProviderUnit": {
                "UnitID": {
                  "extension": "Not implemented",
                  "root": "1.2.752.129.2.1.4.1"
                },
                "UnitLocalID": {
                  "extension": "Not implemented",
                  "root": "1.2.752.129.2.1.4.1"
                }
              },
              "CareProviderInternalID": "76411",
              "ProviderPosition": {
                "CareProviderPositionID": {
                  "extension": "Not implemented",
                  "root": "Define"
                },
                "CareProviderPositionName": "Consultant"
              },
              "CareProviderType": "Vårdgivare",
              "CareProviderID": {
                "extension": "",
                "root": "1.2.752.129.2.1.4.1"
              },
              "CareProviderName": "Jeanette Hjelte"
            },
            {
              "CareProviderUnit": {
                "UnitID": {
                  "extension": "Not implemented",
                  "root": "1.2.752.129.2.1.4.1"
                },
                "UnitLocalID": {
                  "extension": "Not implemented",
                  "root": "1.2.752.129.2.1.4.1"
                }
              },
              "CareProviderInternalID": "76411",
              "ProviderPosition": {
                "CareProviderPositionID": {
                  "extension": "Not implemented",
                  "root": "Define"
                },
                "CareProviderPositionName": "Consultant"
              },
              "CareProviderType": "Signering",
              "CareProviderID": {
                "extension": "",
                "root": "1.2.752.129.2.1.4.1"
              },
              "CareProviderName": "Jeanette Hjelte"
            }
          ]
        },
        "Units": {
          "Unit": [
            {
              "UnitID": {
                "extension": "SE162321000024-0001",
                "root": "1.2.752.129.2.1.4.1"
              },
              "UnitName": "County of Cambio*",
              "UnitLocalID": {
                "extension": "",
                "root": "LocalUnitOID"
              }
            },
            {
              "PhoneNumbers": {
                "Phone": [
                  {
                    "PhoneComment": "krävs för e-recept",
                    "PhoneType": "HSA_Tjänstetelefon",
                    "PhoneNumber": "013-200301"
                  },
                  {
                    "PhoneComment": "",
                    "PhoneType": "EReciever_CommonNumber",
                    "PhoneNumber": "3125412346"
                  }
                ]
              },
              "UnitAddresses": {
                "UnitAddress": [
                  {
                    "UnitAddressCountry": "Sverige",
                    "UnitAddressPostcode": "456 54",
                    "UnitAddressAddress": "",
                    "UnitAddressCity": "Söderköping",
                    "UnitAddressCounty": "",
                    "UnitAddressComment": "krävs för e-recept",
                    "UnitAddressType": "Postadress"
                  },
                  {
                    "UnitAddressCountry": "Sverige",
                    "UnitAddressPostcode": "999",
                    "UnitAddressAddress": "ortoped-address",
                    "UnitAddressCity": "Uppsala",
                    "UnitAddressCounty": "",
                    "UnitAddressComment": "",
                    "UnitAddressType": "Besöksadress"
                  }
                ]
              },
              "UnitID": {
                "extension": "SE162321000024-6911",
                "root": "1.2.752.129.2.1.4.1"
              },
              "UnitName": "Ortopedmottagningen",
              "EmailAddresses": {
                "Email": [
                  {
                    "EmailType": "",
                    "EmailAddress": "info@ortmott1.se"
                  }
                ]
              },
              "UnitSecrecyGroups": {
                "Group": [
                  "Ortopedkliniken"
                ]
              },
              "AccessZones": {
                "AccessZoneID": [
                  {
                    "extension": "SE162321000024-0016497",
                    "root": "1.2.752.129.2.1.4.1"
                  }
                ]
              },
              "HeadCareproviderUnitID": {
                "extension": "SE162321000024-0001",
                "root": "1.2.752.129.2.1.4.1"
              },
              "UnitLocalID": {
                "extension": "98765412",
                "root": "LocalUnitOID"
              }
            },
            {
              "PhoneNumbers": {
                "Phone": [
                  {
                    "PhoneComment": "",
                    "PhoneType": "Växel",
                    "PhoneNumber": "023-490000"
                  },
                  {
                    "PhoneComment": "",
                    "PhoneType": "EReciever_CommonNumber",
                    "PhoneNumber": "0123456789"
                  }
                ]
              },
              "UnitAddresses": {
                "UnitAddress": [
                  {
                    "UnitAddressCountry": "Sverige",
                    "UnitAddressPostcode": "7918234",
                    "UnitAddressAddress": "Ortopeden-Cambio lasarett",
                    "UnitAddressCity": "Falun",
                    "UnitAddressCounty": "",
                    "UnitAddressComment": "",
                    "UnitAddressType": "Besöksadress"
                  }
                ]
              },
              "UnitID": {
                "extension": "SE162321000024-0016497",
                "root": "1.2.752.129.2.1.4.1"
              },
              "UnitName": "Ortopeddivisionen",
              "UnitSecrecyGroups": {
                "Group": [
                  "Ortopedkliniken"
                ]
              },
              "AccessZones": {
                "AccessZoneID": [
                  {
                    "extension": "SE162321000024-0016497",
                    "root": "1.2.752.129.2.1.4.1"
                  }
                ]
              },
              "HeadCareproviderUnitID": {
                "extension": "SE162321000024-0001",
                "root": "1.2.752.129.2.1.4.1"
              },
              "UnitLocalID": {
                "extension": "",
                "root": "LocalUnitOID"
              }
            }
          ]
        },
        "CareUnit": {
          "UnitID": {
            "extension": "SE162321000024-6911",
            "root": "1.2.752.129.2.1.4.1"
          },
          "UnitLocalID": {
            "extension": "98765412",
            "root": "LocalUnitOID"
          }
        },
        "HeadCareproviderUnit": {
          "UnitID": {
            "extension": "SE162321000024-0001",
            "root": "1.2.752.129.2.1.4.1"
          },
          "UnitLocalID": {
            "extension": "",
            "root": "LocalUnitOID"
          }
        }
      }
    ]
  }
]

Response 401

Ogitligt token för åtkomst. Klienten måste begära ett nytt token från auktorisationsservern.

{
  "statusCode": 401,
  "message": "Invalid access token."
}
{
  "description": "Generiskt  felmeddelande för samtliga system och applikationsfel.",
  "properties": {
    "error": {
      "description": "Felorsaken i text.",
      "type": "string"
    },
    "path": {
      "description": "Sökväg till efterfrågad resurs.",
      "type": "string"
    },
    "status": {
      "description": "HTTP status.",
      "type": "integer"
    },
    "timestamp": {
      "description": "Tidstämpel (millisekunder sedan epoch).",
      "type": "integer"
    }
  },
  "type": "object"
}

Response 403

Otillräckligt OAuth2 scope för åtkomst.

{
  "statusCode": 403,
  "message": "Insufficient scope."
}
{
  "description": "Generiskt  felmeddelande för samtliga system och applikationsfel.",
  "properties": {
    "error": {
      "description": "Felorsaken i text.",
      "type": "string"
    },
    "path": {
      "description": "Sökväg till efterfrågad resurs.",
      "type": "string"
    },
    "status": {
      "description": "HTTP status.",
      "type": "integer"
    },
    "timestamp": {
      "description": "Tidstämpel (millisekunder sedan epoch).",
      "type": "integer"
    }
  },
  "type": "object"
}

Response 429

För många anrop per tidsenhet.

{
  "statusCode": 429,
  "message": "Rate limit is exceeded. Try again in 5 seconds."
}
{
  "description": "Generiskt  felmeddelande för samtliga system och applikationsfel.",
  "properties": {
    "error": {
      "description": "Felorsaken i text.",
      "type": "string"
    },
    "path": {
      "description": "Sökväg till efterfrågad resurs.",
      "type": "string"
    },
    "status": {
      "description": "HTTP status.",
      "type": "integer"
    },
    "timestamp": {
      "description": "Tidstämpel (millisekunder sedan epoch).",
      "type": "integer"
    }
  },
  "type": "object"
}

Code samples

@ECHO OFF

curl -v -X GET "https://api.openservices.cambio.se/patients/journalnotes/?fromDateTime={string}&toDateTime={string}"
-H "patient: "
-H "Ocp-Apim-Subscription-Key: {subscription key}"
-H "Authorization: {access token}"

--data-ascii "{body}" 
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;

namespace CSHttpClientSample
{
    static class Program
    {
        static void Main()
        {
            MakeRequest();
            Console.WriteLine("Hit ENTER to exit...");
            Console.ReadLine();
        }
        
        static async void MakeRequest()
        {
            var client = new HttpClient();
            var queryString = HttpUtility.ParseQueryString(string.Empty);

            // Request headers
            client.DefaultRequestHeaders.Add("patient", "");
            client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "{subscription key}");
            client.DefaultRequestHeaders.Add("Authorization", "{access token}");

            // Request parameters
            queryString["fromDateTime"] = "{string}";
            queryString["toDateTime"] = "{string}";
            var uri = "https://api.openservices.cambio.se/patients/journalnotes/?" + queryString;

            var response = await client.GetAsync(uri);
        }
    }
}	
// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class JavaSample 
{
    public static void main(String[] args) 
    {
        HttpClient httpclient = HttpClients.createDefault();

        try
        {
            URIBuilder builder = new URIBuilder("https://api.openservices.cambio.se/patients/journalnotes/");

            builder.setParameter("fromDateTime", "{string}");
            builder.setParameter("toDateTime", "{string}");

            URI uri = builder.build();
            HttpGet request = new HttpGet(uri);
            request.setHeader("patient", "");
            request.setHeader("Ocp-Apim-Subscription-Key", "{subscription key}");
            request.setHeader("Authorization", "{access token}");


            // Request body
            StringEntity reqEntity = new StringEntity("{body}");
            request.setEntity(reqEntity);

            HttpResponse response = httpclient.execute(request);
            HttpEntity entity = response.getEntity();

            if (entity != null) 
            {
                System.out.println(EntityUtils.toString(entity));
            }
        }
        catch (Exception e)
        {
            System.out.println(e.getMessage());
        }
    }
}

<!DOCTYPE html>
<html>
<head>
    <title>JSSample</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>

<script type="text/javascript">
    $(function() {
        var params = {
            // Request parameters
            "fromDateTime": "{string}",
            "toDateTime": "{string}",
        };
      
        $.ajax({
            url: "https://api.openservices.cambio.se/patients/journalnotes/?" + $.param(params),
            beforeSend: function(xhrObj){
                // Request headers
                xhrObj.setRequestHeader("patient","");
                xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","{subscription key}");
                xhrObj.setRequestHeader("Authorization","{access token}");
            },
            type: "GET",
            // Request body
            data: "{body}",
        })
        .done(function(data) {
            alert("success");
        })
        .fail(function() {
            alert("error");
        });
    });
</script>
</body>
</html>
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
    NSString* path = @"https://api.openservices.cambio.se/patients/journalnotes/";
    NSArray* array = @[
                         // Request parameters
                         @"entities=true",
                         @"fromDateTime={string}",
                         @"toDateTime={string}",
                      ];
    
    NSString* string = [array componentsJoinedByString:@"&"];
    path = [path stringByAppendingFormat:@"?%@", string];

    NSLog(@"%@", path);

    NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
    [_request setHTTPMethod:@"GET"];
    // Request headers
    [_request setValue:@"" forHTTPHeaderField:@"patient"];
    [_request setValue:@"{subscription key}" forHTTPHeaderField:@"Ocp-Apim-Subscription-Key"];
    [_request setValue:@"{access token}" forHTTPHeaderField:@"Authorization"];
    // Request body
    [_request setHTTPBody:[@"{body}" dataUsingEncoding:NSUTF8StringEncoding]];
    
    NSURLResponse *response = nil;
    NSError *error = nil;
    NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];

    if (nil != error)
    {
        NSLog(@"Error: %@", error);
    }
    else
    {
        NSError* error = nil;
        NSMutableDictionary* json = nil;
        NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
        NSLog(@"%@", dataString);
        
        if (nil != _connectionData)
        {
            json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
        }
        
        if (error || !json)
        {
            NSLog(@"Could not parse loaded json with error:%@", error);
        }
        
        NSLog(@"%@", json);
        _connectionData = nil;
    }
    
    [pool drain];

    return 0;
}
<?php
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';

$request = new Http_Request2('https://api.openservices.cambio.se/patients/journalnotes/');
$url = $request->getUrl();

$headers = array(
    // Request headers
    'patient' => '',
    'Ocp-Apim-Subscription-Key' => '{subscription key}',
    'Authorization' => '{access token}',
);

$request->setHeader($headers);

$parameters = array(
    // Request parameters
    'fromDateTime' => '{string}',
    'toDateTime' => '{string}',
);

$url->setQueryVariables($parameters);

$request->setMethod(HTTP_Request2::METHOD_GET);

// Request body
$request->setBody("{body}");

try
{
    $response = $request->send();
    echo $response->getBody();
}
catch (HttpException $ex)
{
    echo $ex;
}

?>
########### Python 2.7 #############
import httplib, urllib, base64

headers = {
    # Request headers
    'patient': '',
    'Ocp-Apim-Subscription-Key': '{subscription key}',
    'Authorization': '{access token}',
}

params = urllib.urlencode({
    # Request parameters
    'fromDateTime': '{string}',
    'toDateTime': '{string}',
})

try:
    conn = httplib.HTTPSConnection('api.openservices.cambio.se')
    conn.request("GET", "/patients/journalnotes/?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64

headers = {
    # Request headers
    'patient': '',
    'Ocp-Apim-Subscription-Key': '{subscription key}',
    'Authorization': '{access token}',
}

params = urllib.parse.urlencode({
    # Request parameters
    'fromDateTime': '{string}',
    'toDateTime': '{string}',
})

try:
    conn = http.client.HTTPSConnection('api.openservices.cambio.se')
    conn.request("GET", "/patients/journalnotes/?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################
require 'net/http'

uri = URI('https://api.openservices.cambio.se/patients/journalnotes/')

query = URI.encode_www_form({
    # Request parameters
    'fromDateTime' => '{string}',
    'toDateTime' => '{string}'
})
if query.length > 0
  if uri.query && uri.query.length > 0
    uri.query += '&' + query
  else
    uri.query = query
  end
end

request = Net::HTTP::Get.new(uri.request_uri)
# Request headers
request['patient'] = ''
# Request headers
request['Ocp-Apim-Subscription-Key'] = '{subscription key}'
# Request headers
request['Authorization'] = '{access token}'
# Request body
request.body = "{body}"

response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
    http.request(request)
end

puts response.body