简体   繁体   中英

HL7-Fhir : when posting a resource, is it allowed to reference to another resources by search criteria?

Creating a new resource (patient) can be done by a POST to the server.

Example 1]
Create a new Patient 'a' which is linked to Organization with id = 1 ) :

{
  "resourceType": "Patient",
  "name": "a",
  "birthDate": "1974-12-25",
  "organization": {
    "reference": "Organization/1"
  }
}

However, I was wondering if it's also allowed to create a new Patient with a link to an Organization based on a search field?

Example 2]
Create a new Patient 'b' which is linked to an Organization with name = orgname .

{
  "resourceType": "Patient",
  "name": "b",
  "birthDate": "1974-12-25",
  "organization": {
    "reference": "Organization?name=orgname"
  }
}

A reference must point to a specific resource. So what you've shown isn't allowed. However, if you were to post a bundle, your Patient resource could point to an Organization resource within the Bundle and the Bundle could have a conditional create (using If-None-Exist) based on the absence of any resource that has a specified name. But we haven't actually defined what happens to references in this circumstance. (If you wouldn't mind, it'd be good to submit a change request on this.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM