templates/_vital_signs.c32.erb in health-data-standards-1.0.1 vs templates/_vital_signs.c32.erb in health-data-standards-2.0.0

- old
+ new

@@ -32,20 +32,21 @@ <text> <reference value="vitals-desc-<%= i %>"/> </text> <statusCode code="completed"/> <effectiveTime <%= value_or_null_flavor(entry.as_point_in_time) %>/> - <% if entry.value -%> - <% if is_num?(entry.value['scalar']) -%> - <value xsi:type="PQ" value="<%= entry.value["scalar"] %>" <% if entry.value["units"]-%>unit="<%= entry.value["units"] %>"<% end -%>/> - <% elsif is_bool?(entry.value['scalar'])%> - <value xsi:type="BL" value="<%= entry.value["scalar"] %>" /> - <% else -%> - <value xsi:type="ST" ><%= entry.value["scalar"] %></value> - <% end -%> - <% else -%> - <value xsi:type="PQ" nullFlavor="UNK"/> - <% end -%> + <% ev = entry.values.first + if ev.present? && ev.respond_to?(:scalar) -%> + <% if is_num?(ev.scalar) -%> + <value xsi:type="PQ" value="<%= ev.scalar %>" <% if ev.units -%>unit="<%= ev.units %>"<% end -%>/> + <% elsif is_bool?(ev.scalar)%> + <value xsi:type="BL" value="<%= ev.scalar %>" /> + <% else -%> + <value xsi:type="ST" ><%= ev.scalar %></value> + <% end -%> + <% else -%> + <value xsi:type="PQ" nullFlavor="UNK"/> + <% end -%> </observation> </component> <% end -%> </organizer> </entry> \ No newline at end of file