gematik / ref-eRp-FD-Server

ARCHIVED - This project acts as reference implementation of main aspects of an e-prescription server designed by gematik.
Other
44 stars 3 forks source link

patient will allocate eprescription to pharmacy #22

Closed nauni77 closed 3 years ago

nauni77 commented 3 years ago

documentation reference: https://github.com/gematik/api-erp/blob/master/docs/erp_communication.adoc#anwendungsfall-ein-e-rezept-verbindlich-einer-apotheke-zuweisen

create and activate eprescription At first step I create and activate an eprescription. Receive the following values:

  techId : "a193c6d1-1dd2-11b2-8036-fa2423bc3178"
  epresIds : "160.000.558.778.000.75"
  xaccessCodes : "d711ab635321c317959e590f9c630dd152b666c7550414c5c1eaff6567cdc56a" ]

create patient token for header

cargo run -p tool -- \
    create-access-token \
        --key ./certs/idp_id \
        --claims ./server/examples/claims_patient.json

assign the eprescription ot pharmacy URL: POST: http://localhost:3000/Communication HEADER: Authorization: Bearer eyJhbGciOiJCUDI1NlIxIn0.ey.... Content-Type: application/fhir+json; charset=UTF-8 BODY:

{
  "resourceType": "Communication",
  "meta": {
    "profile": [
      "https://gematik.de/fhir/StructureDefinition/ErxCommunicationDispReq"
    ]
  },
  "status": "unknown",
  "basedOn": [
    {
      "reference": "Task/4711/$accept?ac=d711ab635321c317959e590f9c630dd152b666c7550414c5c1eaff6567cdc56a"
    }
  ],
  "recipient": [
    {
      "identifier": {
        "system": "https://gematik.de/fhir/Namingsystem/TelematikID",
        "value": "606358757"
      }
    }
  ],
  "payload": [
    {
      "contentString": "Bitte schicken Sie einen Boten. N"
    }
  ]
}

response: But this returns an error - even if the body contains the content described at documentation. Error message:

HTTP/1.1 400 Bad Request
content-length: 330
connection: close
content-type: application/fhir+xml
date: Sat, 06 Mar 2021 16:11:07 GMT

<OperationOutcome xmlns="http://hl7.org/fhir"><meta><profile value="http://hl7.org/fhir/StructureDefinition/OperationOutcome"/></meta><issue><severity value="error"/><code value="invalid"/><details><text value="Error while decoding JSON: Element Out Of Order (id=about, path/Communication)!"/></details></issue></OperationOutcome>

Is the documentation wrong? Or did I something wrong?

Best regards, Oli

Gematik-Entwicklung commented 3 years ago

Hi Oli,

sorry for the late response. The order of all properties of a resource is important. Please refere to the profile of ErxCommunicationDispReq. In your special case, "basedOn" must be before "status".

Best regards, gematik Dev-Team.

nauni77 commented 3 years ago

Hello,

in that case your documentation is wrong. This order is described at: https://github.com/gematik/api-erp/blob/master/docs/erp_communication.adoc#anwendungsfall-ein-e-rezept-verbindlich-einer-apotheke-zuweisen

Maybe you will check and correct that.

Thanks for your response. I will try and give feedback.

Regards, Oli

nauni77 commented 3 years ago

Hello, if I change the order I receive a 201 and it looks good. Thanks!

But we have the Problem, that we want to simulate more then one pharmacy. At the POST-Body I define "606358757" as recipient. How can I add more pharmacies. Please explain how to define other additional pharmacies (incl. the ID, getting a AccessToken, a.s.o.).

Background: We have several persons at QS and traditional everybody owns his/ her own pharmacy for testing.

Thanks in advance, Oli

nauni77 commented 3 years ago

Hello, maybe I don't understand something correct. Please correct me it this is true.

  1. create and activate an eprescription
  2. patient send this epres to pharmacy Body from this POST request:
    {
    "resourceType": "Communication",
    "meta": {
    "profile": [
      "https://gematik.de/fhir/StructureDefinition/ErxCommunicationDispReq"
    ]
    },
    "basedOn": [
    {
      "reference": "Task/10fb3519-1f16-11b2-80b1-c040ff194a81/$accept?ac=f7f9ede442c1b82cfb1ba9703df27d9ee00256d695c6d2431b5de31fe9794b38"
    }
    ],
    "status": "unknown",
    "recipient": [
    {
      "identifier": {
        "system": "https://gematik.de/fhir/Namingsystem/TelematikID",
        "value": "606358757"
      }
    }
    ],
    "payload": [
    {
      "contentString": "Bitte schicken Sie einen Boten. N"
    }
    ]
    }

    Answer:

    
    HTTP/1.1 201 Created
    content-length: 784
    connection: close
    content-type: application/fhir+xml
    date: Wed, 24 Mar 2021 13:14:02 GMT
=> seems to work.
3. now I look as pharmacy for this eprescription

Query with pharmacy token:

GET http://gematik-testclient.intra.vsa.de:3000/Communication?sent=2011-12-03T10:00:00

Answer is empty!?!???

HTTP/1.1 200 OK content-length: 70 connection: close content-type: application/fhir+xml date: Wed, 24 Mar 2021 13:16:58 GMT


My questions:
* this result should contain the notification of a new eprescription with the download link. Correct?
* if this is correct, what I'm doing wrong?
* where at test system I configure the "TelematikID" of the pharmacy? How can I create more than one pharmacy at test system - for testing purposes. At the moment I use the files

ls -lh claims_*

-rw-r--r-- 1 gematik gematik 529 Mar 24 13:50 claims_apotheke.json -rw-r--r-- 1 gematik gematik 529 Mar 24 13:50 claims_arzt.json -rw-r--r-- 1 gematik gematik 529 Mar 24 13:50 claims_patient.json


to create the tokens to access the test instance. But at `claims_apotheke.json` there is no element `TelematikID`. Please have a look at:

$ cat claims_apotheke.json { "acr": "eidas-loa-high", "aud": "https://erp.telematik.de/login", "exp": 2524608000, "family_name": "der Nachname", "given_name": "der Vorname", "iat": 1585336956, "idNummer": "X234567890", "iss": "https://idp1.telematik.de/jwt", "jti": "_01234567890123456789", "nbf": 1585336956, "nonce": "fuu bar baz", "organizationName": "Institutions- oder Organisations-Bezeichnung", "professionOID": "1.2.276.0.76.4.54", "sub": "RabcUSuuWKKZEEHmrcNm_kUDOW13uaGU5Zk8OoBwiNk" }



Or do TelematikID correspond to some of these IDs?

Thanks in advance and best regards, Oli
Gematik-Entwicklung commented 3 years ago

Hi Oli,

the ID stored in "Communication.recipient" corresponds to the "idNumber" of the ACCESS_TOKEN. In case of the patient ACCESS_TOKEN, the "idNumber" is the KVNR of the patient, but if the ACCESS_TOKEN is for parmacy, the "idNumber" contains the TelemetikID of the pharmacy. If you want to simulate more than one pharmacy, you have to create an ACCESS_TOKEN for each pharmacy with a suitable "idNumber".

Futhermore your request will only return Communication resources, that have the exact sent date of "2011-12-03T10:00:00" but as you can see in the response of the POST request, the communication was created/sent at "2021-03-24T13:14:02.672927202+00:00".

You can fetch all unread communications for a participant, by passing "received=null" as query parameter.

Best regards, gematik Dev-Team.

nauni77 commented 3 years ago

Hello, thanks very much for your fast comments. Very useful! I will check this and report my result!

Best regards, Oli

nauni77 commented 3 years ago

Hello, thanks for your Information.

I only changed the "idNumber", "family_name", "given_name" and "organziationName". It seems to work as expected.

Best regards, Oli