renalware-core 2.0.0.pre.beta12 → 2.0.0.pre.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/stylesheets/renalware/modules/_letters.scss +0 -1
  4. data/app/assets/stylesheets/renalware/modules/_pathology.scss +4 -0
  5. data/app/assets/stylesheets/renalware/partials/_beta_banner.scss +26 -0
  6. data/app/assets/stylesheets/renalware/partials/_errors.scss +4 -0
  7. data/app/controllers/renalware/admissions/consults_controller.rb +0 -7
  8. data/app/controllers/renalware/concerns/devise_controller_methods.rb +9 -9
  9. data/app/controllers/renalware/hd/mdm_controller.rb +2 -3
  10. data/app/controllers/renalware/hd/mdm_patients_controller.rb +7 -1
  11. data/app/controllers/renalware/letters/letters_controller.rb +1 -1
  12. data/app/controllers/renalware/letters/lists_controller.rb +13 -6
  13. data/app/controllers/renalware/mdm_controller.rb +1 -1
  14. data/app/controllers/renalware/mdm_patients_controller.rb +1 -1
  15. data/app/controllers/renalware/patients/bookmarks_controller.rb +1 -1
  16. data/app/controllers/renalware/patients/clinical_summaries_controller.rb +1 -1
  17. data/app/controllers/renalware/pd/mdm_controller.rb +2 -3
  18. data/app/controllers/renalware/pd/mdm_patients_controller.rb +2 -0
  19. data/app/controllers/renalware/renal/low_clearance/mdm_controller.rb +15 -0
  20. data/app/controllers/renalware/renal/low_clearance/mdm_patients_controller.rb +29 -0
  21. data/app/controllers/renalware/session_timeout_controller.rb +2 -0
  22. data/app/controllers/renalware/system/user_feedback_controller.rb +35 -0
  23. data/app/controllers/renalware/transplants/mdm_controller.rb +1 -3
  24. data/app/controllers/renalware/transplants/mdm_patients_controller.rb +2 -0
  25. data/app/helpers/renalware/application_helper.rb +1 -42
  26. data/app/helpers/renalware/clinic_helper.rb +3 -1
  27. data/app/helpers/renalware/infection_organisms_helper.rb +20 -0
  28. data/app/helpers/renalware/mdm_helper.rb +9 -7
  29. data/app/helpers/renalware/prescriptions_helper.rb +20 -0
  30. data/app/helpers/renalware/side_nav_helper.rb +0 -8
  31. data/app/jobs/application_job.rb +2 -0
  32. data/app/models/concerns/renalware/explicit_state_model.rb +2 -0
  33. data/app/models/concerns/renalware/patient_pathology_scopes.rb +39 -0
  34. data/app/models/concerns/renalware/personable.rb +3 -2
  35. data/app/models/renalware/clinics/appointment.rb +4 -4
  36. data/app/models/renalware/clinics/clinic_visit.rb +2 -2
  37. data/app/models/renalware/drugs/classification.rb +11 -0
  38. data/app/models/renalware/drugs/drug.rb +3 -3
  39. data/app/models/renalware/drugs/type.rb +2 -1
  40. data/app/models/renalware/hd/mdm_patients_query.rb +4 -9
  41. data/app/models/renalware/hd/session/closed.rb +10 -3
  42. data/app/models/renalware/hd/session.rb +2 -1
  43. data/app/models/renalware/hd/sessions/auditable_session_collection.rb +7 -7
  44. data/app/models/renalware/letters/archive.rb +1 -1
  45. data/app/models/renalware/letters/description.rb +1 -1
  46. data/app/models/renalware/letters/event/clinic_visit.rb +4 -0
  47. data/app/models/renalware/letters/letter_factory.rb +1 -0
  48. data/app/models/renalware/letters/part/allergies.rb +1 -1
  49. data/app/models/renalware/letters/part/prescriptions.rb +1 -1
  50. data/app/models/renalware/letters/part/problems.rb +1 -1
  51. data/app/models/renalware/letters/part/recent_pathology_results.rb +14 -12
  52. data/app/models/renalware/letters/part.rb +3 -2
  53. data/app/models/renalware/letters/recipient.rb +1 -1
  54. data/app/models/renalware/letters/signature.rb +3 -1
  55. data/app/models/renalware/pathology/current_observations_for_descriptions_query.rb +7 -4
  56. data/app/models/renalware/pathology/observations_for_descriptions_query.rb +1 -2
  57. data/app/models/renalware/patients/bookmark.rb +1 -1
  58. data/app/models/renalware/patients/patient_hospital_identifiers.rb +4 -4
  59. data/app/models/renalware/patients/practice.rb +3 -3
  60. data/app/models/renalware/patients/primary_care_physician.rb +2 -2
  61. data/app/models/renalware/renal/low_clearance/mdm_patients_query.rb +63 -0
  62. data/app/models/renalware/renal/low_clearance/modality_description.rb +13 -0
  63. data/app/models/renalware/renal/profile.rb +2 -0
  64. data/app/models/renalware/renal/registry/preflight_checks/deaths_query.rb +1 -1
  65. data/app/models/renalware/renal/version.rb +9 -0
  66. data/app/models/renalware/renal.rb +4 -0
  67. data/app/models/renalware/role.rb +4 -3
  68. data/app/models/renalware/roles_user.rb +6 -0
  69. data/app/models/renalware/system/user_feedback.rb +16 -0
  70. data/app/models/renalware/transplants/donor_modality_description.rb +3 -0
  71. data/app/models/renalware/transplants/recipient_modality_description.rb +3 -0
  72. data/app/models/renalware/user.rb +14 -9
  73. data/app/models/renalware.rb +2 -5
  74. data/app/policies/renalware/base_policy.rb +1 -1
  75. data/app/policies/renalware/system/user_feedback_policy.rb +8 -0
  76. data/app/presenters/renalware/hd/mdm_presenter.rb +2 -0
  77. data/app/presenters/renalware/hd/session_access_presenter.rb +1 -1
  78. data/app/presenters/renalware/hd/session_presenter.rb +4 -5
  79. data/app/presenters/renalware/hd/station_presenter.rb +1 -1
  80. data/app/presenters/renalware/letters/letter_presenter.rb +4 -2
  81. data/app/presenters/renalware/mdm_presenter.rb +3 -3
  82. data/app/presenters/renalware/pathology/observations_diff.rb +110 -0
  83. data/app/presenters/renalware/renal/clinical_summary_presenter.rb +32 -4
  84. data/app/presenters/renalware/renal/low_clearance/mdm_presenter.rb +14 -0
  85. data/app/views/renalware/accesses/assessments/show.html.slim +1 -1
  86. data/app/views/renalware/accesses/dashboards/show.html.slim +1 -1
  87. data/app/views/renalware/accesses/procedures/show.html.slim +1 -1
  88. data/app/views/renalware/accesses/profiles/_list.html.slim +1 -1
  89. data/app/views/renalware/accesses/profiles/show.html.slim +1 -1
  90. data/app/views/renalware/admissions/consults/_form.html.slim +12 -12
  91. data/app/views/renalware/admissions/requests/_create_request_link.html.slim +1 -1
  92. data/app/views/renalware/admissions/requests/_form.html.slim +1 -1
  93. data/app/views/renalware/clinical/allergies/_new.html.slim +3 -3
  94. data/app/views/renalware/clinical/allergy_statuses/_form.html.slim +3 -3
  95. data/app/views/renalware/clinical/dry_weights/{_row.html.slim → _dry_weight.html.slim} +0 -0
  96. data/app/views/renalware/clinical/dry_weights/_list.html.slim +1 -2
  97. data/app/views/renalware/clinical/dry_weights/index.html.slim +1 -2
  98. data/app/views/renalware/clinical/profiles/show.html.slim +1 -1
  99. data/app/views/renalware/events/types/index.html.slim +1 -1
  100. data/app/views/renalware/hd/diaries/show.pdf.slim +1 -0
  101. data/app/views/renalware/hd/diary_slots/_form.html.slim +10 -10
  102. data/app/views/renalware/hd/diary_slots/_tab.html.slim +4 -4
  103. data/app/views/renalware/hd/mdm/_sessions.html.slim +1 -1
  104. data/app/views/renalware/hd/mdm_patients/_table.html.slim +7 -8
  105. data/app/views/renalware/hd/ongoing_sessions/_table.html.slim +1 -2
  106. data/app/views/renalware/hd/sessions/_form.html.slim +2 -2
  107. data/app/views/renalware/hd/sessions/_list.html.slim +1 -1
  108. data/app/views/renalware/hd/sessions/_row.html.slim +1 -1
  109. data/app/views/renalware/hd/sessions/_session_nav.html.slim +1 -1
  110. data/app/views/renalware/hd/sessions/_table.html.slim +1 -1
  111. data/app/views/renalware/hd/sessions/closed/_row.html.slim +1 -1
  112. data/app/views/renalware/hd/sessions/open/_row.html.slim +1 -1
  113. data/app/views/renalware/hd/stations/edit.html.slim +1 -1
  114. data/app/views/renalware/hd/stations/index.html.slim +1 -1
  115. data/app/views/renalware/hd/stations/new.html.slim +1 -1
  116. data/app/views/renalware/layouts/_patient.html.slim +1 -1
  117. data/app/views/renalware/layouts/application.html.slim +3 -1
  118. data/app/views/renalware/letters/contacts/_new_person.html.slim +2 -2
  119. data/app/views/renalware/letters/contacts/_person_from_directory.html.slim +2 -2
  120. data/app/views/renalware/letters/formatted_letters/_letter.html.slim +3 -3
  121. data/app/views/renalware/letters/formatted_letters/show.html.slim +1 -1
  122. data/app/views/renalware/letters/formatted_letters/show.inlinepdf.slim +1 -1
  123. data/app/views/renalware/letters/formatted_letters/show.pdf.slim +1 -1
  124. data/app/views/renalware/letters/letters/_electronic_ccs.html.slim +1 -1
  125. data/app/views/renalware/letters/letters/_form.html.slim +5 -2
  126. data/app/views/renalware/letters/letters/_pathology.html.slim +26 -0
  127. data/app/views/renalware/letters/letters/_preview.html.slim +3 -3
  128. data/app/views/renalware/letters/letters/edit.html.slim +11 -12
  129. data/app/views/renalware/letters/letters/new.html.slim +1 -1
  130. data/app/views/renalware/letters/lists/_letter.html.slim +1 -2
  131. data/app/views/renalware/letters/lists/show.html.slim +13 -14
  132. data/app/views/renalware/letters/parts/_recent_pathology_results.html.slim +3 -8
  133. data/app/views/renalware/letters/shared/_electronic_cc_type_tabs.html.slim +3 -3
  134. data/app/views/renalware/mdm/_letters.html.slim +1 -1
  135. data/app/views/renalware/mdm/_measurements.html.slim +1 -1
  136. data/app/views/renalware/mdm_patients/_patient.html.slim +1 -1
  137. data/app/views/renalware/mdm_patients/_table.html.slim +11 -13
  138. data/app/views/renalware/messaging/internal/messages/_form.html.slim +7 -7
  139. data/app/views/renalware/messaging/internal/messages/_send_message_link.html.slim +1 -1
  140. data/app/views/renalware/messaging/internal/messages/_send_reply_link.html.slim +1 -1
  141. data/app/views/renalware/messaging/internal/receipts/_sent_receipt.html.slim +1 -1
  142. data/app/views/renalware/messaging/shared/_messages_type_tabs.html.slim +3 -3
  143. data/app/views/renalware/navigation/_branding.html.slim +1 -1
  144. data/app/views/renalware/navigation/_mdms.html.slim +1 -0
  145. data/app/views/renalware/pathology/observations/_diff.html.slim +22 -0
  146. data/app/views/renalware/patients/_layout.html.slim +1 -1
  147. data/app/views/renalware/patients/alerts/_create_alert_link.html.slim +1 -1
  148. data/app/views/renalware/patients/alerts/_form.html.slim +4 -4
  149. data/app/views/renalware/patients/alerts/_list.html.slim +1 -2
  150. data/app/views/renalware/patients/bookmarks/_delete.html.slim +1 -1
  151. data/app/views/renalware/patients/bookmarks/_new.html.slim +8 -8
  152. data/app/views/renalware/patients/clinical_summaries/_events.html.slim +6 -4
  153. data/app/views/renalware/patients/clinical_summaries/_letters.html.slim +6 -3
  154. data/app/views/renalware/patients/clinical_summaries/_prescriptions.html.slim +2 -2
  155. data/app/views/renalware/patients/clinical_summaries/_problems.html.slim +2 -2
  156. data/app/views/renalware/patients/clinical_summaries/show.html.slim +14 -4
  157. data/app/views/renalware/patients/patients/show.html.slim +1 -1
  158. data/app/views/renalware/patients/side_menu/_modalities.html.slim +2 -2
  159. data/app/views/renalware/patients/worries/_delete.html.slim +1 -1
  160. data/app/views/renalware/patients/worries/_new.html.slim +6 -6
  161. data/app/views/renalware/pd/dashboards/show.html.slim +1 -1
  162. data/app/views/renalware/pd/infection_organisms/_table.html.slim +3 -3
  163. data/app/views/renalware/pd/pet_adequacy_results/_form.html.slim +23 -23
  164. data/app/views/renalware/pd/regime_bags/_form.html.slim +5 -5
  165. data/app/views/renalware/pd/regime_bags/_regime_bag.html.slim +2 -2
  166. data/app/views/renalware/pd/regime_bags/_regime_bags.html.slim +1 -1
  167. data/app/views/renalware/pd/regimes/_current_regime.html.slim +1 -1
  168. data/app/views/renalware/problems/problems/index.html.slim +1 -1
  169. data/app/views/renalware/renal/low_clearance/mdm/_bottom.html.slim +3 -0
  170. data/app/views/renalware/renal/low_clearance/mdm/_low_clearance_profile.html.slim +4 -0
  171. data/app/views/renalware/renal/low_clearance/mdm/_top.html.slim +5 -0
  172. data/app/views/renalware/renal/low_clearance/mdm_patients/_filters.html.slim +9 -0
  173. data/app/views/renalware/renal/profiles/_mini.html.slim +1 -1
  174. data/app/views/renalware/reporting/audits/index.html.slim +1 -1
  175. data/app/views/renalware/research/study_participants/_form.html.slim +3 -3
  176. data/app/views/renalware/shared/_modal_close_link.html.slim +1 -1
  177. data/app/views/renalware/shared/documents/_blood_pressure_input.html.slim +1 -1
  178. data/app/views/renalware/snippets/snippets/_form.html.slim +4 -4
  179. data/app/views/renalware/snippets/snippets/_list.html.slim +3 -3
  180. data/app/views/renalware/snippets/snippets/_row.html.slim +2 -2
  181. data/app/views/renalware/snippets/snippets/_table.html.slim +7 -7
  182. data/app/views/renalware/snippets/snippets/edit.html.slim +1 -1
  183. data/app/views/renalware/snippets/snippets/new.html.slim +1 -1
  184. data/app/views/renalware/system/user_feedback/_banner.html.slim +9 -0
  185. data/app/views/renalware/system/user_feedback/new.html.slim +13 -0
  186. data/app/views/renalware/transplants/donor_dashboards/show.html.slim +2 -2
  187. data/app/views/renalware/transplants/recipient_dashboards/show.html.slim +2 -2
  188. data/config/initializers/inflections.rb +2 -0
  189. data/config/locales/custom.yml +7 -0
  190. data/config/locales/renalware/letters/letter.en.yml +2 -2
  191. data/config/locales/renalware/navigation/renal.en.yml +1 -0
  192. data/config/locales/renalware/renal/low_clearance.en.yml +15 -0
  193. data/config/permissions.yml +1 -0
  194. data/config/routes.rb +10 -0
  195. data/db/migrate/20171114120904_add_pathology_snapshot_to_letters.rb +5 -0
  196. data/db/migrate/20171123123712_add_id_to_roles_users.rb +5 -0
  197. data/db/migrate/20171123143534_add_pk_to_drug_types_drugs.rb +18 -0
  198. data/db/migrate/20171123154116_create_renal_versions.rb +14 -0
  199. data/db/migrate/20171128163543_add_more_missing_indexes.rb +16 -0
  200. data/db/migrate/20171206121652_add_loinc_code_to_observation_descriptions.rb +5 -0
  201. data/db/migrate/20171208211206_create_user_feedback.rb +10 -0
  202. data/db/migrate/20171211130716_remove_unused_patients_cols.rb +6 -0
  203. data/db/seeds/default/modalities/descriptions.rb +1 -0
  204. data/db/views/reporting_anaemia_audit_v01.sql +1 -1
  205. data/db/views/reporting_bone_audit_v01.sql +1 -1
  206. data/lib/renalware/configuration.rb +3 -0
  207. data/lib/renalware/version.rb +1 -1
  208. data/spec/factories/modalities/modality_descriptions.rb +3 -2
  209. data/spec/factories/renal/lcc_modality_description.rb +9 -0
  210. data/spec/factories/system/roles.rb +2 -2
  211. data/spec/factories/system/users.rb +3 -3
  212. data/spec/support/login_macros.rb +2 -2
  213. data/spec/support/roles_spec_helper.rb +1 -1
  214. metadata +35 -6
  215. data/app/models/renalware/patients/message_listener.rb +0 -31
  216. data/config/initializers/version.rb +0 -3
  217. data/spec/support/database_cleaner.rb +0 -16
@@ -1,3 +1,5 @@
1
+ require_dependency "renalware"
2
+
1
3
  module Renalware
2
4
  module HD
3
5
  class MDMPresenter < Renalware::MDMPresenter
@@ -26,7 +26,7 @@ module Renalware
26
26
  attr_reader :session
27
27
 
28
28
  def info
29
- @info ||= session.try!(:document).try!(:info)
29
+ @info ||= session&.document&.info
30
30
  end
31
31
 
32
32
  def abbreviated_type
@@ -25,11 +25,6 @@ module Renalware
25
25
  :renal_registry_code,
26
26
  to: :hospital_unit,
27
27
  prefix: true, allow_nil: true
28
-
29
- def state
30
- self.class.to_s.demodulize.downcase
31
- end
32
-
33
28
  delegate :class, to: :__getobj__
34
29
 
35
30
  def initialize(session, view_context = nil)
@@ -38,6 +33,10 @@ module Renalware
38
33
  super(session)
39
34
  end
40
35
 
36
+ def state
37
+ self.class.to_s.demodulize.downcase
38
+ end
39
+
41
40
  def performed_on
42
41
  url = view_context.patient_hd_session_path(session.patient, session)
43
42
  text = ::I18n.l(super)
@@ -2,7 +2,7 @@ module Renalware
2
2
  module HD
3
3
  class StationPresenter < SimpleDelegator
4
4
  def name
5
- super.blank? ? "Unnamed Station" : super
5
+ super.presence || "Unnamed Station"
6
6
  end
7
7
 
8
8
  def css
@@ -41,11 +41,13 @@ module Renalware
41
41
  end
42
42
 
43
43
  def parts
44
- letter_event.part_classes.values.map { |part_class| part_class.new(patient, letter_event) }
44
+ letter_event.part_classes.values.map do |part_class|
45
+ part_class.new(patient, self, letter_event)
46
+ end
45
47
  end
46
48
 
47
49
  def part_for(part_name)
48
- letter_event.part_classes[part_name].new(patient, letter_event)
50
+ letter_event.part_classes[part_name].new(patient, self, letter_event)
49
51
  end
50
52
 
51
53
  def to_html
@@ -21,9 +21,9 @@ module Renalware
21
21
  OpenStruct.new(table: pathology_table_view, rows: presenter.view_model)
22
22
  end
23
23
 
24
- def latest_pathology_for(code)
25
- code
26
- end
24
+ # def latest_pathology_for(code)
25
+ # code
26
+ # end
27
27
 
28
28
  def clinic_visits(limit: 6)
29
29
  @clinic_visits ||= Clinics::ClinicVisit.for_patient(patient)
@@ -0,0 +1,110 @@
1
+ require "attr_extras"
2
+ require_dependency "renalware/pathology"
3
+
4
+ # Uses Rails 5 `render anywhere` feature.
5
+ module Renalware
6
+ module Pathology
7
+ class ObservationsDiff
8
+ def initialize(patient:, between_dates:, descriptions:)
9
+ @patient = patient
10
+ @descriptions = descriptions
11
+ @between_dates = Array(between_dates)
12
+ if between_dates.length != 2
13
+ raise ArgumentError, "between_dates argument must be an array of 2 dates"
14
+ end
15
+ end
16
+
17
+ def to_html
18
+ render
19
+ end
20
+
21
+ def to_h
22
+ @to_h ||= build_diff_hash
23
+ end
24
+
25
+ private
26
+
27
+ attr_reader :patient, :between_dates, :descriptions
28
+
29
+ def render
30
+ renderer.render(
31
+ partial: "renalware/pathology/observations/diff",
32
+ locals: {
33
+ patient: patient,
34
+ diffs: to_h
35
+ }
36
+ )
37
+ end
38
+
39
+ def renderer
40
+ ApplicationController.renderer
41
+ end
42
+
43
+ def observations1
44
+ @observations1 ||= begin
45
+ observations_in_daterange(Time.zone.at(1)..between_dates.first)
46
+ end
47
+ end
48
+
49
+ def observations2
50
+ @observations2 ||= begin
51
+ obs1_ids = observations1.map(&:id)
52
+ observations_in_daterange(between_dates.first..between_dates.last)
53
+ .reject{ |obs| obs1_ids.include?(obs.id) }
54
+ end
55
+ end
56
+
57
+ def observations_in_daterange(range)
58
+ Pathology::CurrentObservationsForDescriptionsQuery.new(
59
+ patient: patient,
60
+ descriptions: descriptions
61
+ ).call.where(observed_at: range).reject{ |obs| obs.id.nil? }.to_a
62
+ end
63
+
64
+ class ObsWithDiff
65
+ include Virtus.model
66
+ attribute :observed_at
67
+ attribute :result, Float
68
+ attribute :result_diff
69
+
70
+ def result_diff(more_recent)
71
+ more_recent && result && (result.to_f - more_recent.result&.to_f)
72
+ end
73
+ end
74
+
75
+ # Build
76
+ # [
77
+ # { "HGB" => [
78
+ # { observed_at:, value: },
79
+ # { observed_at:, value:, diff: }
80
+ # ]
81
+ # }
82
+ # ]
83
+ # Note this could be done with a SQL window function
84
+ # rubocop:disable Metrics/MethodLength
85
+ # rubocop:disable Metrics/AbcSize
86
+ def build_diff_hash
87
+ result = {}
88
+
89
+ observations1.each do |older_obs|
90
+ result[older_obs.description.code] = [
91
+ ObsWithDiff.new(older_obs.attributes.symbolize_keys),
92
+ nil
93
+ ]
94
+ end
95
+
96
+ observations2.each do |newer_obs|
97
+ arr = result[newer_obs.description.code] || Array(2)
98
+ older_obs = arr[0]
99
+ args = newer_obs.attributes.symbolize_keys
100
+ .merge(result_diff: older_obs&.result_diff(newer_obs))
101
+ arr[1] = ObsWithDiff.new(args)
102
+ end
103
+
104
+ result
105
+ end
106
+ # rubocop:enable Metrics/MethodLength Metrics/AbcSize
107
+ # rubocop:enable Metrics/AbcSize
108
+ end
109
+ end
110
+ end
@@ -27,17 +27,45 @@ module Renalware
27
27
  end
28
28
 
29
29
  def current_events
30
- @current_events ||= Events::Event.includes([:created_by, :event_type])
31
- .for_patient(@patient)
32
- .ordered
30
+ @current_events ||= begin
31
+ Events::Event.includes([:created_by, :event_type])
32
+ .for_patient(@patient)
33
+ .limit(Renalware.config.clinical_summary_max_events_to_display)
34
+ .ordered
35
+ end
36
+ end
37
+
38
+ def current_events_count
39
+ title_friendly_collection_count(
40
+ actual: current_events.size,
41
+ total: patient.summary.events_count
42
+ )
33
43
  end
34
44
 
35
45
  def letters
36
46
  present_letters(find_letters)
37
47
  end
38
48
 
49
+ def letters_count
50
+ title_friendly_collection_count(
51
+ actual: letters.size,
52
+ total: patient.summary.letters_count
53
+ )
54
+ end
55
+
39
56
  private
40
57
 
58
+ attr_reader :patient
59
+
60
+ # Retuns e.g. "9" or "10 of 11"
61
+ def title_friendly_collection_count(actual:, total:)
62
+ if total > actual
63
+ "#{actual} of #{total}"
64
+ else
65
+ actual
66
+ end
67
+ end
68
+
41
69
  def find_letters
42
70
  patient = Renalware::Letters.cast_patient(@patient)
43
71
  patient.letters
@@ -45,7 +73,7 @@ module Renalware
45
73
  .with_letterhead
46
74
  .with_author
47
75
  .with_patient
48
- .limit(10)
76
+ .limit(Renalware.config.clinical_summary_max_letters_to_display)
49
77
  .order(issued_on: :desc)
50
78
  end
51
79
 
@@ -0,0 +1,14 @@
1
+ module Renalware
2
+ module Renal
3
+ module LowClearance
4
+ class MDMPresenter < Renalware::MDMPresenter
5
+ def low_clearance
6
+ @low_clearance ||= begin
7
+ Renal.cast_patient(patient).profile&.document&.low_clearance ||
8
+ Renalware::Renal::ProfileDocument::LowClearance.new
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,5 +1,5 @@
1
1
  = content_for(:actions) do
2
- =link_to "Edit",
2
+ = link_to "Edit",
3
3
  edit_patient_accesses_assessment_path(patient, assessment),
4
4
  class: "button"
5
5
 
@@ -11,7 +11,7 @@
11
11
  patient: @patient,
12
12
  plans: @plans,
13
13
  current_plan: @current_plan
14
- -if @procedures.any?
14
+ - if @procedures.any?
15
15
  = render "renalware/accesses/procedures/list"
16
16
  - if @assessments.any?
17
17
  = render "renalware/accesses/assessments/list",
@@ -1,5 +1,5 @@
1
1
  = content_for(:actions) do
2
- =link_to "Edit",
2
+ = link_to "Edit",
3
3
  edit_patient_accesses_procedure_path(patient, procedure),
4
4
  class: "button"
5
5
 
@@ -1,7 +1,7 @@
1
1
  article.access-profiles
2
2
  header
3
3
  h2 Access Profile History
4
- =link_to "Add Profile",
4
+ = link_to "Add Profile",
5
5
  new_patient_accesses_profile_path(@patient),
6
6
  class: "button"
7
7
 
@@ -1,5 +1,5 @@
1
1
  = content_for(:actions) do
2
- =link_to "Edit",
2
+ = link_to "Edit",
3
3
  edit_patient_accesses_profile_path(patient, profile),
4
4
  class: "button"
5
5
 
@@ -70,24 +70,24 @@
70
70
  include_blank: true,
71
71
  wrapper: :horizontal_medium
72
72
 
73
- =f.association :hospital_ward,
73
+ = f.association :hospital_ward,
74
74
  collection: Renalware::Hospitals::Ward.where(hospital_unit_id: consult.hospital_unit_id),
75
75
  wrapper: :horizontal_medium
76
- =f.input :started_on, as: :date_picker, wrapper: :horizontal_datepicker
77
- =f.input :consult_type, wrapper: :horizontal_medium
78
- =f.input :decided_on, as: :date_picker, wrapper: :horizontal_datepicker
79
- =f.input :transfer_priority, include_blank: false, wrapper: :horizontal_small
80
- =f.input :transferred_on, as: :date_picker, wrapper: :horizontal_datepicker
81
- =f.association :seen_by,
76
+ = f.input :started_on, as: :date_picker, wrapper: :horizontal_datepicker
77
+ = f.input :consult_type, wrapper: :horizontal_medium
78
+ = f.input :decided_on, as: :date_picker, wrapper: :horizontal_datepicker
79
+ = f.input :transfer_priority, include_blank: false, wrapper: :horizontal_small
80
+ = f.input :transferred_on, as: :date_picker, wrapper: :horizontal_datepicker
81
+ = f.association :seen_by,
82
82
  as: :user_picker,
83
83
  collection: Renalware::User.ordered,
84
84
  wrapper: :horizontal_medium
85
- =f.input :contact_number, wrapper: :horizontal_medium
85
+ = f.input :contact_number, wrapper: :horizontal_medium
86
86
 
87
- =f.input :aki_risk, include_blank: "Please select", wrapper: :horizontal_small
88
- =f.input :requires_aki_nurse, as: :inline_radio_buttons, wrapper: :horizontal_small
89
- =f.input :description, wrapper: :horizontal_large, input_html: { rows: 5 }
87
+ = f.input :aki_risk, include_blank: "Please select", wrapper: :horizontal_small
88
+ = f.input :requires_aki_nurse, as: :inline_radio_buttons, wrapper: :horizontal_small
89
+ = f.input :description, wrapper: :horizontal_large, input_html: { rows: 5 }
90
90
 
91
91
  = f.submit class: :button
92
92
  span= " or "
93
- =link_to "Cancel", admissions_consults_path
93
+ = link_to "Cancel", admissions_consults_path
@@ -3,7 +3,7 @@
3
3
  - url = new_admissions_request_path(patient_id: patient, format: :html)
4
4
 
5
5
  / Link to launch the modal dialog
6
- =link_to(url,
6
+ = link_to(url,
7
7
  id: "create-admissions-request",
8
8
  data: { "reveal-id" => "admissions-request-modal", "reveal-ajax" => "true" }) do
9
9
  - if local_assigns.fetch(:use_icon, true)
@@ -23,7 +23,7 @@
23
23
  = f.input :notes, as: :text, wrapper: :horizontal_large, input_html: { rows: 5 }
24
24
  = f.submit class: :button
25
25
  span= " or "
26
- =link_to "Cancel",
26
+ = link_to "Cancel",
27
27
  "#",
28
28
  "aria-label" => "Close",
29
29
  class: "reveal-modal-close"
@@ -5,10 +5,10 @@
5
5
  html: { autocomplete: "off" },
6
6
  validate: true do |f|
7
7
  h2= t(".title")
8
- =f.input :description, as: :text, autofocus: true
9
- =f.submit t(".save"), class: :button, data: { disable_with: t(".save_disable_with") }
8
+ = f.input :description, as: :text, autofocus: true
9
+ = f.submit t(".save"), class: :button, data: { disable_with: t(".save_disable_with") }
10
10
  span= " or "
11
- =link_to t(".cancel"),
11
+ = link_to t(".cancel"),
12
12
  "#",
13
13
  "aria-label" => "Close",
14
14
  class: "reveal-modal-close"
@@ -8,6 +8,6 @@
8
8
  method: :put do |f|
9
9
  .flex-container(class="#{ "disabled" if patient.allergies.count > 0}")
10
10
 
11
- =f.check_box :no_known_allergies
12
- =f.label :no_known_allergies, t(".no_known_allergies")
13
- =f.submit t(".save"), class: "button", data: { disable_with: t(".save_disable_with") }
11
+ = f.check_box :no_known_allergies
12
+ = f.label :no_known_allergies, t(".no_known_allergies")
13
+ = f.submit t(".save"), class: "button", data: { disable_with: t(".save_disable_with") }
@@ -19,5 +19,4 @@ article.dry-weights.simple.simple-table
19
19
  th.col-width-small= t(".weight")
20
20
  th= t(".assessor")
21
21
  tbody
22
- - presenter.dry_weights.each do |dry_weight|
23
- = render "renalware/clinical/dry_weights/row", dry_weight: dry_weight
22
+ = render presenter.dry_weights
@@ -7,7 +7,6 @@
7
7
  th Assessor
8
8
 
9
9
  tbody
10
- - dry_weights.each do |dry_weight|
11
- = render "row", dry_weight: dry_weight
10
+ = render dry_weights
12
11
 
13
12
  = paginate dry_weights
@@ -1,5 +1,5 @@
1
1
  = content_for(:actions) do
2
- =link_to "Edit", edit_patient_clinical_profile_path(patient), class: "button"
2
+ = link_to "Edit", edit_patient_clinical_profile_path(patient), class: "button"
3
3
 
4
4
  = within_patient_layout(title: "Clinical Profile") do
5
5
  .grid
@@ -4,4 +4,4 @@
4
4
  class: "button"
5
5
 
6
6
  = within_admin_layout(title: "Patient Event Types") do
7
- =render "table", event_types: event_types
7
+ = render "table", event_types: event_types
@@ -30,3 +30,4 @@
30
30
  = slot.patient.family_name
31
31
  br
32
32
  = slot.patient.given_name
33
+ .page-break
@@ -7,9 +7,9 @@
7
7
  method: :post,
8
8
  wrapper: :horizontal_form) do |f|
9
9
 
10
- =f.input :station_id, as: :hidden
11
- =f.input :diurnal_period_code_id, as: :hidden
12
- =f.input :day_of_week, as: :hidden
10
+ = f.input :station_id, as: :hidden
11
+ = f.input :diurnal_period_code_id, as: :hidden
12
+ = f.input :day_of_week, as: :hidden
13
13
 
14
14
  .row
15
15
  .col-small-4
@@ -24,7 +24,7 @@
24
24
  / The value selected in in change_type above will determine which one to choose.
25
25
  #patient_select2s
26
26
  #dialysing_on_day_and_period
27
- =f.input :patient_id,
27
+ = f.input :patient_id,
28
28
  collection: slot.patients_preferring_to_dialyse_today_in_this_period,
29
29
  label_method: :text,
30
30
  value_method: :id,
@@ -33,7 +33,7 @@
33
33
  name: "hd_diary_slot[patient_id][]" }
34
34
 
35
35
  #dialysing_on_day(style="display:none")
36
- =f.input :patient_id,
36
+ = f.input :patient_id,
37
37
  collection: slot.patients_preferring_to_dialyse_today,
38
38
  label_method: :text,
39
39
  value_method: :id,
@@ -47,7 +47,7 @@
47
47
  class: "patient-id-select2 patient-ajax-search",
48
48
  name: "hd_diary_slot[patient_id][]",
49
49
  data: { "ajax--url" => hd_patients_dialysing_at_unit_path(unit_id: slot.diary.hospital_unit_id, format: :json),
50
- placeholder: "Type 3 or more characters" }\
50
+ placeholder: "Search by patient name or NHS/hosp no." }\
51
51
  }
52
52
 
53
53
  #dialysing_at_hospital(style="display:none")
@@ -57,14 +57,14 @@
57
57
  class: "patient-id-select2 patient-ajax-search",
58
58
  name: "hd_diary_slot[patient_id][]",
59
59
  data: { "ajax--url" => hd_patients_dialysing_at_hospital_path(format: :json),
60
- placeholder: "Type 3 or more characters" }\
60
+ placeholder: "Search by patient name or NHS/hosp no." }\
61
61
  }
62
- =f.submit "Add for this week only", class: "button save weekly"
62
+ = f.submit "Add for this week only", class: "button save weekly"
63
63
  | &nbsp;
64
- =f.submit "Add to this and all future weeks", class: "button secondary master", name: "master"
64
+ = f.submit "Add to this and all future weeks", class: "button secondary master", name: "master"
65
65
 
66
66
  = blank_separator
67
- =link_to "Cancel",
67
+ = link_to "Cancel",
68
68
  "#",
69
69
  "aria-label" => "Close",
70
70
  class: "reveal-modal-close"
@@ -5,8 +5,8 @@
5
5
  remote: true,
6
6
  wrapper: :horizontal_form) do |f|
7
7
 
8
- -if scheduled_only
9
- =f.input :patient_id,
8
+ - if scheduled_only
9
+ = f.input :patient_id,
10
10
  collection: patients,
11
11
  label_method: ->(item){ item.to_s(:long) },
12
12
  value_method: :id,
@@ -19,9 +19,9 @@
19
19
  data: { "ajax--url" => search_patients_path(format: :json) }\
20
20
  }
21
21
 
22
- =f.submit "Select", class: :button
22
+ = f.submit "Select", class: :button
23
23
  = blank_separator
24
- =link_to "Cancel",
24
+ = link_to "Cancel",
25
25
  "#",
26
26
  "aria-label" => "Close",
27
27
  class: "reveal-modal-close"
@@ -3,4 +3,4 @@ fieldset.simple
3
3
  span.title= t(".title")
4
4
  span.actions.action-links
5
5
  = link_to t(".view_all"), patient_hd_sessions_path(mdm.patient)
6
- =render "renalware/hd/sessions/table", sessions: mdm.sessions
6
+ = render "renalware/hd/sessions/table", sessions: mdm.sessions
@@ -1,7 +1,8 @@
1
+ - path = [:renalware, presenter.q]
1
2
  table#patients.mdm-patients.columns
2
3
  thead
3
4
  tr
4
- th.col-width-large= sort_link([:renalware, presenter.q], :family_name, t(".name"))
5
+ th.col-width-large= sort_link(path, :family_name, t(".name"))
5
6
  th.col-width-nhs-no= t(".nhs_no")
6
7
  th.col-width-reference-no= t(".hosp_no")
7
8
  th.col-width-tiny= t(".sex")
@@ -13,12 +14,10 @@ table#patients.mdm-patients.columns
13
14
  th.col-width-date= t(".dialysing_at")
14
15
  th.col-width-date= t(".registration_status")
15
16
  th.at-least.col-width-small= t(".transport_type")
16
- th.col-width-tiny= t(".hgb")
17
- th.col-width-date= t(".hgb_date")
17
+ th.col-width-tiny= sort_link(path, :hgb, t(".hgb"))
18
+ th.col-width-date= sort_link(path, :hgb_date, t(".hgb_date"))
18
19
  th.col-width-tiny
19
20
  tbody
20
- - presenter.patients.each do |patient|
21
- = render "patient",
22
- patient: patient,
23
- view_proc: presenter.view_proc,
24
- q: presenter.q
21
+ = render partial: "patient",
22
+ collection: presenter.patients,
23
+ locals: { view_proc: presenter.view_proc, q: presenter.q }
@@ -15,7 +15,6 @@ table.report
15
15
  td= sort_link([:renalware, query], :signed_off_by_family_name, "Signed Off By")
16
16
 
17
17
  tbody
18
- - sessions.each do |session|
19
- = render "session", session: session
18
+ = render partial: "session", collection: sessions
20
19
 
21
20
  = paginate sessions
@@ -4,7 +4,7 @@ ruby:
4
4
  = f.input :type, as: :hidden
5
5
  .row.top
6
6
  .large-12.columns
7
- =render "form_actions", f: f, back_path: back_path, session: session, patient: @patient
7
+ = render "form_actions", f: f, back_path: back_path, session: session, patient: @patient
8
8
 
9
9
  .form-content
10
10
  = f.simple_fields_for :document, f.object.document do |fd|
@@ -128,4 +128,4 @@ ruby:
128
128
 
129
129
  .row
130
130
  .large-12.columns
131
- =render "form_actions", f: f, back_path: back_path, session: session, patient: @patient
131
+ = render "form_actions", f: f, back_path: back_path, session: session, patient: @patient
@@ -14,4 +14,4 @@ article.hd-sessions
14
14
  new_patient_hd_session_path(@patient),
15
15
  class: "button"
16
16
 
17
- =render "renalware/hd/sessions/table", sessions: sessions
17
+ = render "renalware/hd/sessions/table", sessions: sessions
@@ -21,7 +21,7 @@ tr.hd-session-row(class=[session.state, stripe_class])
21
21
  td.print-only(rowspan=2)= session.notes
22
22
 
23
23
  tr(class=[session.state, stripe_class])
24
- td=tooltip(label: session.summarised_access_used, content: session.access_used)
24
+ td= tooltip(label: session.summarised_access_used, content: session.access_used)
25
25
  td= session.end_time
26
26
  td
27
27
  = session.after_measurement_for(:weight)
@@ -2,5 +2,5 @@
2
2
  dl.sub-nav
3
3
  dd= link_to "HD Summary", patient_hd_dashboard_path(@patient)
4
4
  dd= link_to "View", patient_hd_session_path(@patient, session)
5
- -if policy(session).edit?
5
+ - if policy(session).edit?
6
6
  dd= link_to "Edit", edit_patient_hd_session_path(@patient, session)
@@ -4,6 +4,6 @@ table.auto-layout.hd-sessions
4
4
  tbody
5
5
  - sessions.each_with_index do |session, index|
6
6
  - stripe_class = index % 2 == 0 ? "even" : "odd"
7
- =render "renalware/hd/sessions/#{session.state}/row",
7
+ = render "renalware/hd/sessions/#{session.state}/row",
8
8
  session: session,
9
9
  stripe_class: stripe_class
@@ -1,3 +1,3 @@
1
- =render "renalware/hd/sessions/row",
1
+ = render "renalware/hd/sessions/row",
2
2
  session: session,
3
3
  stripe_class: stripe_class
@@ -1,3 +1,3 @@
1
- =render "renalware/hd/sessions/row",
1
+ = render "renalware/hd/sessions/row",
2
2
  session: session,
3
3
  stripe_class: stripe_class
@@ -1,6 +1,6 @@
1
1
  / We allow cross-module references in the UI but not in the controller hence:
2
2
  - unit = Renalware::Hospitals::Unit.find(unit_id)
3
- - breadcrumbs = [breadcrumb_for("Hospital Units", hospitals_units_path),
3
+ - breadcrumbs = [breadcrumb_for("HD Units", hospitals_units_path),
4
4
  breadcrumb_for(unit.unit_code, edit_hospitals_unit_path(unit)),
5
5
  breadcrumb_for("Stations", hd_unit_stations_path(unit))]
6
6
 
@@ -1,6 +1,6 @@
1
1
  / We allow cross-module references in the UI but not in the controller hence:
2
2
  - unit = Renalware::Hospitals::Unit.find(unit_id)
3
- - breadcrumbs = [breadcrumb_for("Hospital Units", hospitals_units_path),
3
+ - breadcrumbs = [breadcrumb_for("HD Units", hospitals_units_path),
4
4
  breadcrumb_for(unit.unit_code, edit_hospitals_unit_path(unit))]
5
5
 
6
6
  = content_for(:actions) do