<OperationDefinition xmlns="http://hl7.org/fhir">
  <id value="SFM-getMedication" />
  <text>
    <status value="generated" />
    <div xmlns="http://www.w3.org/1999/xhtml">Operation definition for SFM specific operation: $getMedication</div>
  </text>
  <url value="http://nhn.no/sfm/fhir/OperationDefinition/SFM-getMedication" />
  <version value="1.0" />
  <name value="getMedication" />
  <title value="Operation for lookup 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 lookup in Kjernejournal and/or Reseptformidleren to collect and aggregate information on prescriptions, medication treatement, PLL (Pasientens LegemiddeListe), dispense information and Critical information" />
  <code value="getMedication" />
  <comment value="This operation is complex, and requier 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="patient" />
    <use value="in" />
    <min value="1" />
    <max value="1" />
    <documentation value="Must be present and contain Name, Address and (identifier OR (birthDate + gender))" />
    <type value="Patient" />
    <targetProfile value="http://ehelse.no/fhir/StructureDefinition/sfm-Patient" />
  </parameter>
  <parameter>
    <name value="Referansenummer" />
    <use value="in" />
    <min value="0" />
    <max value="*" />
    <documentation value="Refereansenummer shall always be present for patient without national ID. Referansenummer may be present for retreival of låst resept, doctors-name prescriptions or other" />
    <type value="string" />
  </parameter>
  <parameter>
    <name value="historyTimestamp" />
    <use value="in" />
    <min value="0" />
    <max value="1" />
    <documentation value="For lookup in Kjernejournal: Indicates timestamp from witch changes shall be returned" />
    <type value="dateTime" />
  </parameter>
  <parameter>
    <name value="SamtykkeKjernejournal" />
    <use value="in" />
    <min value="0" />
    <max value="1" />
    <documentation value="Patient consent type for access to Medication data (HPAKUTT, HPMOTTATTSAMTYKKE, HPUNNTAK)" />
    <type value="code" />
    <binding>
      <strength value="required" />
      <valueSet value="http://ehelse.no/fhir/ValueSet/sfm-kj-consentcodes" />
    </binding>
  </parameter>
  <parameter>
    <name value="SamtykkeSperretLegemidler" />
    <use value="in" />
    <min value="0" />
    <max value="1" />
    <documentation value="Patient consent type for access to disclosed Medication data (HPAKUTT, HPMOTTATTSAMTYKKE)" />
    <type value="code" />
    <binding>
      <strength value="required" />
      <valueSet value="http://ehelse.no/fhir/ValueSet/sfm-kj-consentcodes" />
    </binding>
  </parameter>
  <parameter>
    <name value="SamtykkeLasteResepter" />
    <use value="in" />
    <min value="0" />
    <max value="1" />
    <documentation value="Patient consent type for access to LÅST RESEPT / locked prescriptions (HPAKUTT, HPMOTTATTSAMTYKKE)" />
    <type value="code" />
    <binding>
      <strength value="required" />
      <valueSet value="http://ehelse.no/fhir/ValueSet/sfm-kj-consentcodes" />
    </binding>
  </parameter>
  <parameter>
    <name value="IncludeOriginal" />
    <use value="in" />
    <min value="0" />
    <max value="*" />
    <documentation value="Flag for inclusion of (elements from) original e-resep messages" />
    <type value="code" />
    <binding>
      <strength value="required" />
      <valueSet value="http://ehelse.no/fhir/ValueSet/sfm-include-binary" />
    </binding>
  </parameter>
  <parameter>
    <name value="medication" />
    <use value="out" />
    <min value="1" />
    <max value="1" />
    <documentation value="Main result. Medication bundle document" />
    <type value="Bundle" />
  </parameter>
  <parameter>
    <name value="KJHentetTidspunkt" />
    <use value="out" />
    <min value="0" />
    <max value="1" />
    <documentation value="Time for result from KJ. Absensce shall be interpreted as no lookup performed" />
    <type value="dateTime" />
  </parameter>
  <parameter>
    <name value="RFHentetTidspunkt" />
    <use value="out" />
    <min value="0" />
    <max value="1" />
    <documentation value="Time for result from RF. Absensce shall be interpreted as no lookup performed" />
    <type value="dateTime" />
  </parameter>
  <parameter>
    <name value="KJFeilkode" />
    <use value="out" />
    <min value="0" />
    <max value="1" />
    <documentation value="Error response from KJ" />
    <type value="Coding" />
    <binding>
      <strength value="required" />
      <valueSet value="http://ehelse.no/fhir/ValueSet/sfm-rfkj-lookupcodes" />
    </binding>
  </parameter>
  <parameter>
    <name value="RFM96Feilkode" />
    <use value="out" />
    <min value="0" />
    <max value="1" />
    <documentation value="Error response from RF on M9.6 lookup" />
    <type value="Coding" />
    <binding>
      <strength value="required" />
      <valueSet value="http://ehelse.no/fhir/ValueSet/sfm-rfkj-lookupcodes" />
    </binding>
  </parameter>
  <parameter>
    <name value="RFM912Feilkode" />
    <use value="out" />
    <min value="0" />
    <max value="1" />
    <documentation value="Error response from RF on M9.12 lookup" />
    <type value="Coding" />
    <binding>
      <strength value="required" />
      <valueSet value="http://ehelse.no/fhir/ValueSet/sfm-rfkj-lookupcodes" />
    </binding>
  </parameter>
  <parameter>
    <name value="KJHarLegemidler" />
    <use value="out" />
    <min value="0" />
    <max value="1" />
    <documentation value="According to response from KJ" />
    <type value="boolean" />
  </parameter>
  <parameter>
    <name value="KJHarLaste" />
    <use value="out" />
    <min value="0" />
    <max value="1" />
    <documentation value="According to response from KJ" />
    <type value="boolean" />
  </parameter>
  <parameter>
    <name value="RFHarLaste" />
    <use value="out" />
    <min value="0" />
    <max value="1" />
    <documentation value="According to response from RF" />
    <type value="boolean" />
  </parameter>
  <parameter>
    <name value="RFPasientreservasjon" />
    <use value="out" />
    <min value="0" />
    <max value="1" />
    <documentation value="According to response from RF" />
    <type value="boolean" />
  </parameter>
</OperationDefinition>