<%= medication.id%>
<%== code_display medication, "preferred_code_sets" => ["RxNorm", "CVX"] %>
<%= medication.free_text%>
<%== gc32_effective_time(medication)%>
<% if medication.administration_timing %>
<%== quantity_display medication.administration_timing["period"], :period %>
<% end %>
<% if medication.route %>
<%== code_display medication, "tag_name" => "route", "attribute" => "route", "preferred_code_sets" => ["NCI Thesaurus"] %>
<% end %>
<% if medication.site %>
<%== code_display medication, "tag_name" => "site", "attribute" => "site", "preferred_code_sets" => ["SNOMED-CT"] %>
<% end %>
<%== quantity_display medication.dose, :dose %>
<% if medication.dose_indicator %>
<%medication.dose_indicator%>
<% end %>
<% if medication.dose_restriction %>
<%= medication.dose_restriction["numerator"]%>
<%= medication.dose_restriction["denominator"]%>
<% end %>
<% if medication.product_form %>
<%== code_display medication, "tag_name" => "productForm", "attribute" => "product_form", "preferred_code_sets" => ["NCI Thesaurus"] %>
<% end %>
<% if medication.delivery_method %>
<%== code_display medication, "tag_name" => "deliveryMethod", "attribute" => "delivery_method", "preferred_code_sets" => medication.delivery_method.keys %>
<% end %>
<% if medication.type_of_medication%>
<%== code_display medication, "tag_name" => "type", "attribute" => "type_of_medication", "preferred_code_sets" => ["SNOMED-CT"] %>
<% end %>
<% if medication.status_of_medication%>
<%== code_display medication, "tag_name" => "statusOfMedication", "attribute" => "status_of_medication", "preferred_code_sets" => ["SNOMED-CT"] %>
<% end %>
<%if medication.indication%>
<%== code_display medication, "tag_name" => "indication", "attribute" => "indication", "preferred_code_sets" => ["SNOMED-CT"] %>
<% end %>
<% if medication.vehicle %>
<%== code_display medication, "tag_name" => "vehicle", "attribute" => "vehicle", "preferred_code_sets" => ["SNOMED-CT"] %>
<% end%>
<% if medication.dose_indicator %>
<%= medication.dose_indicator %>
<% end %>
<% if medication.patient_instructions %>
<%=medication.patient_instructions%>
<% end %>
<% if medication.fulfillment_instructions %>
<%=medication.fulfillment_instructions%>
<% end %>
<% medication.fulfillment_history.each do |fh| %>
fillStatus="<%=fh.fill_status%>" <% end %>
<% if fh.fill_number %> fillNumber="<%=fh.fill_number%>" <% end %>>
<%=fh.prescription_number%>
<%= Time.at(fh.dispense_date).utc%>
<%== quantity_display fh.quantity_dispensed, :quantityDispensed %>
<% end %>
<% medication.order_information.each do |oi| %>
<%= "orderNumber=\"#{oi.order_number}\"" %> <% end %> <% if oi.fills %> <%= "fills=\"#{oi.fills}\"" %> <% end %>>
<%== quantity_display oi.quantity_ordered, "quantityOrdered" %>
<%= Time.at(oi.order_date_time).utc%>
<%= Time.at(oi.order_expiration_date_time).utc%>
<% end %>