<OperationDefinition xmlns="http://hl7.org/fhir">
<id value="-s-create-episode-of-care"/>
<text>
<status value="extensions"/>
<div xmlns="http://www.w3.org/1999/xhtml"><h2>create-episode-of-care</h2><p>OPERATION: create-episode-of-care</p><p>The official URL for this operation definition is: </p><pre>http://ehealth.sundhed.dk/fhir/OperationDefinition/-s-create-episode-of-care</pre><div><p>This operation persists an EpisodeOfCare based on the transient value of an EpisodeOfCare provided in the input.</p>
<h2>Input</h2>
<p>The input is a Bundle which must contain exactly one EpisodeOfCare, conditions referenced in diagnosis list and at least one Provenance resource. All Provenances in the input must have the EpisodeOfCare as target. At least one Provenance must be interpreted into a 'Privacy-provenance' (see below).</p>
<h3>The EpisodeOfCare resource</h3>
<p>The EpisodeOfCare has to have <code>PLANNED</code> status
The 'id' property of the EpisodeOfCare will be reassigned by the server, but can be referenced by other resources in the same bundle.
The 'managingOrganization' property of the EpisodeOfCare references the GDPR Data Controller (Danish: 'Dataansvarlig').</p>
<h3>The privacy-Provenance resource</h3>
<p>A privacy-Provenance is a Provenance resource characterized by having at least one entry in Provenance.policy which data are transported, stored, or processed in the system. Possible values are:
- 'http://ehealth.sundhed.dk/policy/dk/sundhedsloven'
- 'http://ehealth.sundhed.dk/policy/dk/serviceloven'</p>
<h3>Diagnosis referenced Condition resource</h3>
<p>For any diagnosis listed, the referenced Condition must be concerning the same Patient as the EpisodeOfCare.</p>
<h2>Output</h2>
<p>For valid inputs, the server will create, persist and return a new EpisodeOfCare, client-supplied provenances, conditions and origin-provenance carrying a server-assigned ids.
To get resources bodies in the output the request header has to contain parameter <code>`Prefer: return=representation</code>`.</p>
<h3>The origin-Provenance resource</h3>
<p>Whenever an EpisodeOfCare is created, the server automatically creates an 'origin' Provenance resource point to it (in addition to the client-supplied Privacy-Provenance). This Origin-Provenance resource is filled with data from the JWT access token in order to record the origin of the EpisodeOfCare resource. For instance agent.whoReference points to a resource which is created as a shadow identity from the JWT token.</p>
</div><p>URL: [base]/$create-episode-of-care</p><p>Parameters</p><table class="grid"><tr><td><b>Use</b></td><td><b>Name</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>episodeOfCareAndProvenances</td><td>1..1</td><td><a href="http://hl7.org/fhir/STU3/bundle.html">Bundle</a></td><td/><td/></tr><tr><td>OUT</td><td>return</td><td>0..1</td><td><a href="http://hl7.org/fhir/STU3/bundle.html">Bundle</a></td><td/><td/></tr></table></div>
</text>
<url
value="http://ehealth.sundhed.dk/fhir/OperationDefinition/-s-create-episode-of-care"/>
<name value="create-episode-of-care"/>
<status value="active"/>
<kind value="operation"/>
<date value="2021-01-07T13:26:31+00:00"/>
<description
value="This operation persists an EpisodeOfCare based on the transient value of an EpisodeOfCare provided in the input.
## Input
The input is a Bundle which must contain exactly one EpisodeOfCare, conditions referenced in diagnosis list and at least one Provenance resource. All Provenances in the input must have the EpisodeOfCare as target. At least one Provenance must be interpreted into a 'Privacy-provenance' (see below).
### The EpisodeOfCare resource
The EpisodeOfCare has to have `PLANNED` status
The 'id' property of the EpisodeOfCare will be reassigned by the server, but can be referenced by other resources in the same bundle.
The 'managingOrganization' property of the EpisodeOfCare references the GDPR Data Controller (Danish: 'Dataansvarlig').
### The privacy-Provenance resource
A privacy-Provenance is a Provenance resource characterized by having at least one entry in Provenance.policy which data are transported, stored, or processed in the system. Possible values are:
- 'http://ehealth.sundhed.dk/policy/dk/sundhedsloven'
- 'http://ehealth.sundhed.dk/policy/dk/serviceloven'
### Diagnosis referenced Condition resource
For any diagnosis listed, the referenced Condition must be concerning the same Patient as the EpisodeOfCare.
## Output
For valid inputs, the server will create, persist and return a new EpisodeOfCare, client-supplied provenances, conditions and origin-provenance carrying a server-assigned ids.
To get resources bodies in the output the request header has to contain parameter ```Prefer: return=representation```.
### The origin-Provenance resource
Whenever an EpisodeOfCare is created, the server automatically creates an 'origin' Provenance resource point to it (in addition to the client-supplied Privacy-Provenance). This Origin-Provenance resource is filled with data from the JWT access token in order to record the origin of the EpisodeOfCare resource. For instance agent.whoReference points to a resource which is created as a shadow identity from the JWT token.
"/>
<idempotent value="false"/>
<code value="create-episode-of-care"/>
<system value="true"/>
<type value="false"/>
<instance value="false"/>
<parameter>
<name value="episodeOfCareAndProvenances"/>
<use value="in"/>
<min value="1"/>
<max value="1"/>
<type value="Bundle"/>
</parameter>
<parameter>
<name value="return"/>
<use value="out"/>
<min value="0"/>
<max value="1"/>
<type value="Bundle"/>
</parameter>
</OperationDefinition>