templates/html/_entry.html.erb in health-data-standards-2.1.4 vs templates/html/_entry.html.erb in health-data-standards-2.2.0
- old
+ new
@@ -13,11 +13,11 @@
<br/>
<% if concept_map %>
<%
matches = []
codes.each do |code|
- matches.concat(concept_map[set][code].values)
+ matches.concat(concept_map[set][code].values) if concept_map[set][code]
end
%>
<ul id="<%=entry.id%>_<%=set%>" style="display: none; position: absolute; background: #EEE; padding: 10px; padding-left: 30px; width: 600px; z-index: 3000;">
<% matches.each do |concept_match| %>
<li><%= concept_match[:concept].titleize %> (<%= concept_match[:oid]%>)</li>
@@ -35,31 +35,34 @@
<%= value.try(:scalar) %> <%= units %><br/>
<% elsif value.respond_to? :codes %>
<% value.codes.each do |system, vals| %>
<%= system %>: <%= vals.join(',') %>
<% end %>
- <%= (value.description ? "(#{value.description})" : "(UNKNOWN CODED VALUE)")%>
+ <%= (value.description ? "(#{value.description})" : '')%>
<br/>
<% else %>
UNKNOWN VALUE
<% end %>
<% end %>
</td>
<td>
<%
- (entry.attributes.keys.reject {|key| ['codes', 'time', 'description', 'mood_code', 'values', '_id', '_type', 'start_time', 'end_time', 'status_code', 'negationInd', 'negationReason', 'oid'].include? key}).each do |field|
- field_value = ThingWithCodes.convert_codes_to_s(entry.attributes[field]) rescue entry.attributes[field].to_s
+ (entry.attributes.keys.reject {|key| ['codes', 'time', 'description', 'mood_code', 'values', '_id', '_type', 'start_time', 'end_time', 'status_code', 'negationInd', 'oid'].include? key}).each do |field|
+ field_value = convert_field_to_hash(field, entry.attributes[field])
+
%>
- <%= field %>: (<b><%= field_value %></b>)
- <%
- end
- if entry.negationInd
- negation_reason = ''
- if entry.negationReason
- negation_reason = ThingWithCodes.convert_codes_to_s(entry.negationReason) rescue entry.negationReason.to_s
- end
- %>
- negation: <%= negation_reason %>
+ <% if field_value && !field_value.empty? %>
+ <dl>
+ <% if field_value.is_a? Hash %>
+ <dt><b><%= field.titleize %>:</b></dt>
+ <% field_value.keys.each do |fieldkey| %>
+ <dd><%= fieldkey %>: <i><%= field_value[fieldkey] %></i></dd>
+ <% end %>
+ <% else %>
+ <dt><b><%= field.titleize %></b>: <%= field_value%></dt>
+ <% end %>
+ <dl>
+ <% end %>
<%
end
%>
</td>