Sha256: 7ee9bb078022d982df935821a17e793f91866ad30d9c15e23fe3780cb26c7f35

Contents?: true

Size: 1.44 KB

Versions: 30

Compression:

Stored size: 1.44 KB

Contents

# frozen_string_literal: true

xml = builder

xml.Medications do
  patient.prescriptions_with_numeric_dose_amount.each do |prescription|
    xml.Medication do
      xml.FromTime prescription.prescribed_on.to_datetime
      if prescription.terminated_or_marked_for_termination?
        xml.ToTime prescription.terminated_on&.to_datetime
      end
      xml.EnteringOrganization do
        xml.CodingStandard "ODS"
        xml.Code Renalware.config.ukrdc_site_code
      end
      xml.Route do
        xml.CodingStandard "RR22"
        xml.Code prescription.medication_route&.rr_code
        # xml.Description prescription.medication_route&.name
      end
      xml.DrugProduct do
        xml.Generic prescription.drug
        # xml.Id do
        #   xml.CodingStandard "DM+D"
        #   xml.Code "dm + d code for the drug - coming soon"
        #   xml.Description prescription.drug
        # end
      end
      xml.Frequency prescription.frequency
      xml.Comments [prescription.dose_amount,
                    prescription.dose_unit&.text,
                    prescription.frequency].compact.join(" ")
      xml.DoseQuantity prescription.dose_amount&.strip

      if prescription.dose_unit.present?
        xml.DoseUoM do
          prescription.dose_unit
          xml.CodingStandard "LOCAL"
          xml.Code prescription.dose_unit&.text
          xml.Description prescription.dose_unit
        end
      end

      xml.ExternalId prescription.id
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
renalware-core-2.0.136 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.135 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.134 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.133 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.132 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.131 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.130 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.129 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.128 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.127 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.126 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.125 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.124 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.123 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.121 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.120 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.119 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.118 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.117 app/views/renalware/api/ukrdc/patients/_medications.xml.builder
renalware-core-2.0.116 app/views/renalware/api/ukrdc/patients/_medications.xml.builder