<OperationDefinition xmlns="http://hl7.org/fhir">
  <id value="SFM-sendMedication" />
  <text>
    <status value="generated" />
    <div xmlns="http://www.w3.org/1999/xhtml">Operation definition for SFM specific operation: $sendMedication</div>
  </text>
  <url value="http://nhn.no/sfm/fhir/OperationDefinition/SFM-sendMedication" />
  <version value="1.0" />
  <name value="sendMedication" />
  <title value="Operation for submitting and updating medical and prescription information for a patient" />
  <status value="active" />
  <kind value="operation" />
  <date value="2021-05-01" />
  <publisher value="Norsk Helsenett (SFM Project)" />
  <contact>
    <telecom>
      <system value="url" />
      <value value="http://nhn.no/fhir" />
    </telecom>
    <telecom>
      <system value="email" />
      <value value="SFM-Prosjekt@nhn.no" />
    </telecom>
  </contact>
  <description value="This operation provides submitting updated medication and prescription information to Reseptformidleren. Based on changes made in the medication/prescription for a patient SFM will submit PLL and prescription(s) and or recall neccessary prescriptions" />
  <code value="sendMedication" />
  <comment value="This operation is complex, and require that the Practitioner performing the operation presents a valid HelseID token with identity information, and that the authorisation is available in Helsepersonellregisteret" />
  <resource value="Patient" />
  <system value="false" />
  <type value="true" />
  <instance value="false" />
  <parameter>
    <name value="medication" />
    <use value="in" />
    <min value="1" />
    <max value="1" />
    <documentation value="Medication bundle document containing medicatiation and other prescription info. Patient must be present in the bundle, with sufficient info for messages to Reseptformidleren. See $getMedication" />
    <type value="Bundle" />
    <targetProfile value="http://ehelse.no/fhir/StructureDefinition/sfm-MedicationBundle" />
  </parameter>
  <parameter>
    <name value="prescriptionCount" />
    <use value="out" />
    <min value="1" />
    <max value="1" />
    <documentation value="the number of prescription signed and sent to Reseptformidleren" />
    <type value="integer" />
  </parameter>
  <parameter>
    <name value="recallCount" />
    <use value="out" />
    <min value="1" />
    <max value="1" />
    <documentation value="the number of withdrawals sent to Reseptformidleren" />
    <type value="integer" />
  </parameter>
  <parameter>
    <name value="PllResult" />
    <use value="out" />
    <min value="0" />
    <max value="1" />
    <documentation value="Result of PLL delivery to Reseptformidleren" />
    <part>
      <name value="PllmessageID" />
      <use value="out" />
      <min value="1" />
      <max value="1" />
      <documentation value="MessageID for M25.1 sent to Reseptformidleren" />
      <type value="string" />
    </part>
    <part>
      <name value="resultCode" />
      <use value="out" />
      <min value="1" />
      <max value="1" />
      <documentation value="Ok, or error code from Reseptformidleren or SFM" />
      <type value="Coding" />
      <binding>
        <strength value="required" />
        <valueSet value="http://ehelse.no/fhir/ValueSet/sfm-rfkj-lookupcodes" />
      </binding>
    </part>
  </parameter>
  <parameter>
    <name value="prescriptionOperationResult" />
    <use value="out" />
    <min value="0" />
    <max value="*" />
    <documentation value="Result of prescription delivery (M1) or prescription recall (M5) to Reseptformidleren" />
    <part>
      <name value="reseptID" />
      <use value="out" />
      <min value="1" />
      <max value="1" />
      <documentation value="ReseptID involved in the operation" />
      <type value="string" />
    </part>
    <part>
      <name value="refnum" />
      <use value="out" />
      <min value="0" />
      <max value="1" />
      <documentation value="Referansenumber assigned to prescription when relevant for M1" />
      <type value="string" />
    </part>
    <part>
      <name value="resultCode" />
      <use value="out" />
      <min value="1" />
      <max value="1" />
      <documentation value="Ok, or error code from Reseptformidleren or SFM" />
      <type value="Coding" />
      <binding>
        <strength value="required" />
        <valueSet value="http://ehelse.no/fhir/ValueSet/sfm-rfkj-lookupcodes" />
      </binding>
    </part>
  </parameter>
</OperationDefinition>