<?xml version="1.0" encoding="UTF-8"?>

<OperationDefinition xmlns="http://hl7.org/fhir">
  <id value="DocumentReference-docref"/>
  <text>
    <status value="generated"/>
    <div xmlns="http://www.w3.org/1999/xhtml">
      <p class="res-header-id">
        <b>Generated Narrative: OperationDefinition DocumentReference-docref</b>
      </p>
      <a name="DocumentReference-docref"> </a>
      <a name="hcDocumentReference-docref"> </a>
      <p>URL: [base]/DocumentReference/$docref</p>
      <h3>Parameters</h3>
      <table class="grid">
        <tr>
          <td>
            <b>Use</b>
          </td>
          <td>
            <b>Name</b>
          </td>
          <td>
            <b>Scope</b>
          </td>
          <td>
            <b>Cardinality</b>
          </td>
          <td>
            <b>Type</b>
          </td>
          <td>
            <b>Binding</b>
          </td>
          <td>
            <b>Documentation</b>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>patient</td>
          <td/>
          <td>1..1</td>
          <td>
            <a href="datatypes.html#id">id</a>
          </td>
          <td/>
          <td>
            <div>
              <p>The id of the patient resource located on the server on which this operation is executed.  If there is no match, an empty Bundle is returned</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>start</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#dateTime">dateTime</a>
          </td>
          <td/>
          <td>
            <div>
              <p>The date range relates to care dates, not record currency dates - e.g. all records relating to care provided in a certain date range. If no start date is provided, all documents prior to the end date are in scope.  If neither a start date nor an end date is provided, the most recent or current document is in scope.  The client 
                <strong>SHOULD</strong> provide values precise to the second + time offset.
              </p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>end</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#dateTime">dateTime</a>
          </td>
          <td/>
          <td>
            <div>
              <p>The date range relates to care dates, not record currency dates - e.g. all records relating to care provided in a certain date range. If no end date is provided, all documents subsequent to the start date are in scope. If neither a start date nor an end date is provided, the most recent or current document is in scope.  The client 
                <strong>SHOULD</strong> provide values precise to the second + time offset.
              </p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>type</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#CodeableConcept">CodeableConcept</a>
          </td>
          <td>
            <a href="valueset-doc-typecodes.html">FHIR Document Type Codes</a> (Required)
          </td>
          <td>
            <div>
              <p>The type relates to document type e.g. C-CDA Clinical Summary of Care (CCD) = LOINC 34133-9: Summary of episode note, and International Patient Summary (IPS) = LOINC 60591-5: Patient summary document.  If no type is provided, the summary document, if available, SHALL be in scope, and all other document types MAY be in scope. It is at the server's discretion how to respond if multiple types are provided. The server MAY return documents to any of the specified types. The server's CapabilityStatement should document its behavior and what types it supports</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>on-demand</td>
          <td/>
          <td>0..1</td>
          <td>
            <a href="datatypes.html#boolean">boolean</a>
          </td>
          <td/>
          <td>
            <div>
              <p>This on-demand parameter allows client to dictate whether they are requesting only 'on-demand' or both 'on-demand' and 'stable' documents (or delayed/deferred assembly) that meet the query parameters</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>IN</td>
          <td>profile</td>
          <td/>
          <td>0..*</td>
          <td>
            <a href="datatypes.html#canonical">canonical</a>
          </td>
          <td/>
          <td>
            <div>
              <p>This parameter allows the client to request documents according to a specific profile using the profile's canonical reference. It is at the server's discretion how to respond if multiple profiles are provided. The server MAY return documents to any of the specified profiles. The server's CapabilityStatement should document its behavior and what profiles it supports.</p>

            </div>
          </td>
        </tr>
        <tr>
          <td>OUT</td>
          <td>return</td>
          <td/>
          <td>1..1</td>
          <td>
            <a href="bundle.html">Bundle</a>
          </td>
          <td/>
          <td>
            <div>
              <p>The bundle type is &quot;searchset&quot;containing 
                <a href="documentreference.html">DocumentReference</a> resources.
              </p>

            </div>
          </td>
        </tr>
      </table>
      <div>
        <p>The server either returns a search result Bundle containing at least one DocumentReference,
or it returns an error.</p>

      </div>
    </div>
  </text>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm">
    <valueInteger value="3"/>
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
    <valueCode value="normative"/>
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-wg">
    <valueCode value="oo"/>
  </extension>
  <url value="http://hl7.org/fhir/OperationDefinition/DocumentReference-docref"/>
  <version value="6.0.0-ballot4"/>
  <name value="Docref"/>
  <title value="Fetch DocumentReference"/>
  <status value="active"/>
  <kind value="operation"/>
  <experimental value="false"/>
  <date value="2026-05-20T06:46:23+00:00"/>
  <publisher value="HL7 International / Orders and Observations"/>
  <contact>
    <telecom>
      <system value="url"/>
      <value value="http://hl7.org/fhir"/>
    </telecom>
    <telecom>
      <system value="email"/>
      <value value="fhir@lists.hl7.org"/>
    </telecom>
  </contact>
  <contact>
    <telecom>
      <system value="url"/>
      <value value="http://www.hl7.org/Special/committees/orders"/>
    </telecom>
  </contact>
  <description value="This operation is used to return all the references to documents related to a patient. &#xA;&#xA; The operation requires a patient id and takes the optional input parameters: &#xA;  - start date&#xA;  - end date&#xA;  - document type &#xA;&#xA;  - on demand &#xA;&#xA;  - profile &#xA;&#xA; and returns a [Bundle](bundle.html) of type &quot;searchset&quot; containing [DocumentReference](documentreference.html) resources for the patient. If the server has or can create documents that are related to the patient, and that are available for the given user, the server returns the DocumentReference resources needed to support the records.  The principle intended use for this operation is to provide a provider or patient with access to their available document information. &#xA;&#xA; This operation is *different* from a search by patient and type and date range because: &#xA;&#xA; 1. It is used to request a server to *generate* a document based on the specified parameters. &#xA;&#xA; 1. If no parameters are specified, the server SHALL return a DocumentReference to the patient's most current summary &#xA;&#xA; 1. If the server cannot *generate* a document based on the specified parameters, the operation will return an empty search bundle. &#xA;&#xA; Unless the client indicates they are only interested in 'on-demand' documents using the on-demand parameter, the server SHOULD return DocumentReference instances for existing documents that meet the request parameters. In this regard, this operation is similar to a FHIR RESTful query."/>
  <jurisdiction>
    <coding>
      <system value="http://unstats.un.org/unsd/methods/m49/m49.htm"/>
      <code value="001"/>
      <display value="World"/>
    </coding>
  </jurisdiction>
  <affectsState value="true"/>
  <code value="docref"/>
  <comment value="The server either returns a search result Bundle containing at least one DocumentReference, &#xA;or it returns an error."/>
  <resource value="DocumentReference"/>
  <system value="false"/>
  <type value="true"/>
  <instance value="false"/>
  <parameter>
    <name value="patient"/>
    <use value="in"/>
    <min value="1"/>
    <max value="1"/>
    <documentation value="The id of the patient resource located on the server on which this operation is executed.  If there is no match, an empty Bundle is returned"/>
    <type value="id"/>
  </parameter>
  <parameter>
    <name value="start"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="The date range relates to care dates, not record currency dates - e.g. all records relating to care provided in a certain date range. If no start date is provided, all documents prior to the end date are in scope.  If neither a start date nor an end date is provided, the most recent or current document is in scope.  The client **SHOULD** provide values precise to the second + time offset."/>
    <type value="dateTime"/>
  </parameter>
  <parameter>
    <name value="end"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="The date range relates to care dates, not record currency dates - e.g. all records relating to care provided in a certain date range. If no end date is provided, all documents subsequent to the start date are in scope. If neither a start date nor an end date is provided, the most recent or current document is in scope.  The client **SHOULD** provide values precise to the second + time offset."/>
    <type value="dateTime"/>
  </parameter>
  <parameter>
    <name value="type"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value=" The type relates to document type e.g. C-CDA Clinical Summary of Care (CCD) = LOINC 34133-9: Summary of episode note, and International Patient Summary (IPS) = LOINC 60591-5: Patient summary document.  If no type is provided, the summary document, if available, SHALL be in scope, and all other document types MAY be in scope. It is at the server's discretion how to respond if multiple types are provided. The server MAY return documents to any of the specified types. The server's CapabilityStatement should document its behavior and what types it supports"/>
    <type value="CodeableConcept"/>
    <binding>
      <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
        <valueString value="??"/>
      </extension>
      <strength value="required"/>
      <valueSet value="http://hl7.org/fhir/ValueSet/doc-typecodes|6.0.0-ballot4"/>
    </binding>
  </parameter>
  <parameter>
    <name value="on-demand"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="This on-demand parameter allows client to dictate whether they are requesting only 'on-demand' or both 'on-demand' and 'stable' documents (or delayed/deferred assembly) that meet the query parameters"/>
    <type value="boolean"/>
  </parameter>
  <parameter>
    <name value="profile"/>
    <use value="in"/>
    <min value="0"/>
    <max value="*"/>
    <documentation value="This parameter allows the client to request documents according to a specific profile using the profile's canonical reference. It is at the server's discretion how to respond if multiple profiles are provided. The server MAY return documents to any of the specified profiles. The server's CapabilityStatement should document its behavior and what profiles it supports."/>
    <type value="canonical"/>
  </parameter>
  <parameter>
    <name value="return"/>
    <use value="out"/>
    <min value="1"/>
    <max value="1"/>
    <documentation value="The bundle type is &quot;searchset&quot;containing [DocumentReference](documentreference.html) resources."/>
    <type value="Bundle"/>
  </parameter>
</OperationDefinition>