<?xml version='1.0' encoding='UTF-8'?>
<!--
    20090420: Bent Bisballe Nyeng
    Tilføjede '-' til cpr nummeret.
  -->
<macro name="B.0" version="1.0">
  <resume store_in_journal="false"/>
  <queries>
    <query service="pentominos" class="cpr" ttl="1000000"/>
    <query service="pentominos" class="referral" ttl="1000000"/>
  </queries>
  <maps>
    <map name="cpr_bindestreg">
      value = 0
      timestamp = 0
      source = 'pentominos'

      if(cpr and cpr.cpr and cpr.cpr.value and cpr.cpr.timestamp and cpr.cpr.source)
      then
        value = string.sub(cpr.cpr.value,1,6) .. '-' .. string.sub(cpr.cpr.value,7,11)
        timestamp = cpr.cpr.timestamp
        source = cpr.cpr.source
      end

      return value, timestamp, source
    </map>
  </maps>
  <scripts>
  </scripts>
  <window caption="Patient informationer (B.0)"
          layout="hbox">

    <!-- Patient info -->
    <frame layout="vbox">
      <frame layout="hbox">
        <label caption="Navn:" width="50"/>
        <lineedit name="name" map="cpr.name" value="Patienten kunne ikke findes" readonly="true"/>
      </frame>
      <frame layout="hbox">
        <label caption="Cpr-nr:" width="50"/>
        <lineedit name="cpr" map="cpr_bindestreg" value="-" readonly="true"/>
      </frame>
    </frame>

    <!-- Henvisnings info -->
    <frame layout="vbox">
      <frame layout="hbox">
        <label width="100" caption="Henvisende læge:"/>
        <lineedit name="referral.doctor" map="henvisning.doctor" value="Henvisnings informationer kunne ikke findes" readonly="true"/>
      </frame>
      <frame layout="hbox">
        <label width="100" caption="Henvisningskode:"/>
        <lineedit name="referral.diagnosecode" map="henvisning.code" value="-" readonly="true"/>
        <label width="60" caption="Diagnose:"/>
        <lineedit width="200" name="referral.diagnose" map="henvisning.diagnose" value="-" readonly="true"/>
      </frame>
    </frame>

  </window>
</macro>