app/views/pdfs/appoinments.pdf.erb
<% if @patient.clinic_history? %>
<table class="table nobreak">
<thead>
<% if @patient.allergies.present? %>
<tr><th><%= t("activerecord.attributes.patient.allergies") %></th></tr>
<tr><td><%= @patient.allergies %></td></tr>
<% end %>
<% if @patient.pathological_background.present? %>
<tr><th><%= t("activerecord.attributes.patient.pathological_background") %></th></tr>
<tr><td><%= @patient.pathological_background %></td></tr>
<% end %>
<% if @patient.non_pathological_background.present? %>
<tr><th><%= t("activerecord.attributes.patient.non_pathological_background") %></th></tr>
<tr><td><%= @patient.non_pathological_background %></td></tr>
<% end %>
<% if @patient.gyneco_obstetric_background.present? %>
<tr><th><%= t("activerecord.attributes.patient.gyneco_obstetric_background") %></th></tr>
<tr><td><%= @patient.gyneco_obstetric_background %></td></tr>
<% end %>
<% if @patient.system_background.present? %>
<tr><th><%= t("activerecord.attributes.patient.system_background") %></th></tr>
<tr><td><%= @patient.system_background %></td></tr>
<% end %>
<% if @patient.family_inheritance_background.present? %>
<tr><th><%= t("activerecord.attributes.patient.family_inheritance_background") %></th></tr>
<tr><td><%= @patient.family_inheritance_background %></td></tr>
<% end %>
<% if @patient.physic_exploration.present? %>
<tr><th><%= t("activerecord.attributes.patient.physic_exploration") %></th></tr>
<tr><td><%= @patient.physic_exploration %></td></tr>
<% end %>
<% if @patient.other_background.present? %>
<tr><th><%= t("activerecord.attributes.patient.other_background") %></th></tr>
<tr><td><%= @patient.other_background %></td></tr>
<% end %>
</thead>
</table>
<div class="alwaysbreak"></div>
<% end %>
<% @appointments.each do |appointment| %>
<table class="table nobreak">
<thead>
<tr><th><%= t("activerecord.attributes.appointment.created_at") %></th></tr>
<tr><td><%= l appointment.created_at, format: :long %></td></tr>
<tr><th><%= t("activerecord.attributes.appointment.patient") %></th></tr>
<tr><td><%= @patient %> - <%= age_months(@patient) %></td></tr>
<tr><th><%= t("activerecord.attributes.appointment.reason") %></th></tr>
<tr><td><%= appointment.reason %></td></tr>
<tr><th><%= t("activerecord.attributes.appointment.note") %></th></tr>
<tr><td><%= raw sanitize appointment.note %></td></tr>
<tr><th><%= t("activerecord.attributes.appointment.prescription") %></th></tr>
<tr><td><%= raw sanitize appointment.prescription %></td></tr>
<tr><th><%= t("activerecord.attributes.appointment.recommendations") %></th></tr>
<tr><td><%= raw appointment.recommendations %></td></tr>
<% if appointment.cabinet_results.present? %>
<tr><th><%= t("activerecord.attributes.appointment.cabinet_results") %></th></tr>
<tr><td><%= appointment.cabinet_results %></td></tr>
<% end %>
<% if appointment.histopathology.present? %>
<tr><th><%= t("activerecord.attributes.appointment.histopathology") %></th></tr>
<tr><td><%= appointment.histopathology %></td></tr>
<% end %>
<tr>
<th>
<table class="table">
<thead>
<tr>
<% if appointment.height.present? && !appointment.height.zero? %>
<th><%= t("activerecord.attributes.appointment.height") %></th>
<% end %>
<% if appointment.weight.present? && !appointment.weight.zero? %>
<th><%= t("activerecord.attributes.appointment.weight") %></th>
<% end %>
<% if appointment.imc.present? %>
<th><%= t("activerecord.attributes.appointment.imc") %></th>
<% end %>
<% if appointment.blood_pressure.present? %>
<th><%= t("activerecord.attributes.appointment.blood_pressure") %></th>
<% end %>
<% unless appointment.heart_rate.zero? %>
<th><%= t("activerecord.attributes.appointment.heart_rate") %></th>
<% end %>
<% unless appointment.breathing_rate.zero? %>
<th><%= t("activerecord.attributes.appointment.breathing_rate") %></th>
<% end %>
<% unless appointment.temperature.zero? %>
<th><%= t("activerecord.attributes.appointment.temperature") %></th>
<% end %>
<% unless appointment.glycaemia.zero? %>
<th><%= t("activerecord.attributes.appointment.glycaemia") %></th>
<% end %>
<% unless appointment.sat_02.zero? %>
<th><%= t("activerecord.attributes.appointment.sat_02") %></th>
<% end %>
</tr>
<tr>
<% if appointment.height.present? && !appointment.height.zero? %>
<td><%= appointment.height %> cm.</td>
<% end %>
<% if appointment.weight.present? && !appointment.weight.zero? %>
<td><%= appointment.weight %> kg.</td>
<% end %>
<% if appointment.imc.present? %>
<td><%= number_with_precision(appointment.imc, precision: 2) %></td>
<% end %>
<% if appointment.blood_pressure.present? %>
<td><%= appointment.blood_pressure %></td>
<% end %>
<% unless appointment.heart_rate.zero? %>
<td><%= number_with_precision(appointment.heart_rate, precision: 2) %></td>
<% end %>
<% unless appointment.breathing_rate.zero? %>
<td><%= number_with_precision(appointment.breathing_rate, precision: 2) %></td>
<% end %>
<% unless appointment.temperature.zero? %>
<td><%= temperature appointment %></td>
<% end %>
<% unless appointment.glycaemia.zero? %>
<td><%= appointment.glycaemia %></td>
<% end %>
<% unless appointment.sat_02.zero? %>
<td><%= appointment.sat_02 %></td>
<% end %>
</tr>
</thead>
</table>
</th>
</tr>
</thead>
</table>
<div class="alwaysbreak"></div>
<% end %>