{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://hl7.org/fhir/json-schema/ReferralRequest",
  "$ref": "#/definitions/ReferralRequest",
  "description": "see http://hl7.org/fhir/json.html#schema for information about the FHIR Json Schemas",
  "definitions": {
    "ReferralRequest": {
      "allOf": [
        {
          "$ref": "DomainResource#/definitions/DomainResource"
        },
        {
          "description": "Used to record and send details about a request for referral service or transfer of a patient to the care of another provider or provider organization.",
          "properties": {
            "resourceType": {
              "description": "This is a ReferralRequest resource",
              "type": "string",
              "enum": [
                "ReferralRequest"
              ]
            },
            "identifier": {
              "description": "Business identifier that uniquely identifies the referral/care transfer request instance.",
              "type": "array",
              "items": {
                "$ref": "Identifier.schema.json#/definitions/Identifier"
              }
            },
            "definition": {
              "description": "A protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json#/definitions/Reference"
              }
            },
            "basedOn": {
              "description": "Indicates any plans, proposals or orders that this request is intended to satisfy - in whole or in part.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json#/definitions/Reference"
              }
            },
            "replaces": {
              "description": "Completed or terminated request(s) whose function is taken by this new request.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json#/definitions/Reference"
              }
            },
            "groupIdentifier": {
              "description": "The business identifier of the logical \"grouping\" request/order that this referral is a part of.",
              "$ref": "Identifier.schema.json#/definitions/Identifier"
            },
            "status": {
              "description": "The status of the authorization/intention reflected by the referral request record.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "_status": {
              "description": "Extensions for status",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "intent": {
              "description": "Distinguishes the \"level\" of authorization/demand implicit in this request.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "_intent": {
              "description": "Extensions for intent",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "type": {
              "description": "An indication of the type of referral (or where applicable the type of transfer of care) request.",
              "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept"
            },
            "priority": {
              "description": "An indication of the urgency of referral (or where applicable the type of transfer of care) request.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "_priority": {
              "description": "Extensions for priority",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "serviceRequested": {
              "description": "The service(s) that is/are requested to be provided to the patient.  For example: cardiac pacemaker insertion.",
              "type": "array",
              "items": {
                "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept"
              }
            },
            "subject": {
              "description": "The patient who is the subject of a referral or transfer of care request.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            },
            "context": {
              "description": "The encounter at which the request for referral or transfer of care is initiated.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            },
            "occurrenceDateTime": {
              "description": "The period of time within which the services identified in the referral/transfer of care is specified or required to occur.",
              "pattern": "-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?",
              "type": "string"
            },
            "_occurrenceDateTime": {
              "description": "Extensions for occurrenceDateTime",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "occurrencePeriod": {
              "description": "The period of time within which the services identified in the referral/transfer of care is specified or required to occur.",
              "$ref": "Period.schema.json#/definitions/Period"
            },
            "authoredOn": {
              "description": "Date/DateTime of creation for draft requests and date of activation for active requests.",
              "type": "string",
              "pattern": "-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?"
            },
            "_authoredOn": {
              "description": "Extensions for authoredOn",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "requester": {
              "description": "The individual who initiated the request and has responsibility for its activation.",
              "$ref": "#/definitions/ReferralRequest_Requester"
            },
            "specialty": {
              "description": "Indication of the clinical domain or discipline to which the referral or transfer of care request is sent.  For example: Cardiology Gastroenterology Diabetology.",
              "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept"
            },
            "recipient": {
              "description": "The healthcare provider(s) or provider organization(s) who/which is to receive the referral/transfer of care request.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json#/definitions/Reference"
              }
            },
            "reasonCode": {
              "description": "Description of clinical condition indicating why referral/transfer of care is requested.  For example:  Pathological Anomalies, Disabled (physical or mental),  Behavioral Management.",
              "type": "array",
              "items": {
                "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept"
              }
            },
            "reasonReference": {
              "description": "Indicates another resource whose existence justifies this request.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json#/definitions/Reference"
              }
            },
            "description": {
              "description": "The reason element gives a short description of why the referral is being made, the description expands on this to support a more complete clinical summary.",
              "type": "string"
            },
            "_description": {
              "description": "Extensions for description",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "supportingInfo": {
              "description": "Any additional (administrative, financial or clinical) information required to support request for referral or transfer of care.  For example: Presenting problems/chief complaints Medical History Family History Alerts Allergy/Intolerance and Adverse Reactions Medications Observations/Assessments (may include cognitive and fundtional assessments) Diagnostic Reports Care Plan.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json#/definitions/Reference"
              }
            },
            "note": {
              "description": "Comments made about the referral request by any of the participants.",
              "type": "array",
              "items": {
                "$ref": "Annotation.schema.json#/definitions/Annotation"
              }
            },
            "relevantHistory": {
              "description": "Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json#/definitions/Reference"
              }
            }
          },
          "required": [
            "subject",
            "resourceType"
          ]
        }
      ]
    },
    "ReferralRequest_Requester": {
      "allOf": [
        {
          "$ref": "BackboneElement#/definitions/BackboneElement"
        },
        {
          "description": "Used to record and send details about a request for referral service or transfer of a patient to the care of another provider or provider organization.",
          "properties": {
            "agent": {
              "description": "The device, practitioner, etc. who initiated the request.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            },
            "onBehalfOf": {
              "description": "The organization the device or practitioner was acting on behalf of.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            }
          },
          "required": [
            "agent"
          ]
        }
      ]
    }
  }
}