renalware-core 2.0.15 → 2.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/renalware/concerns/pdf_renderable.rb +2 -0
  3. data/app/controllers/renalware/hd/mdm_patients_controller.rb +8 -6
  4. data/app/controllers/renalware/hospitals/units_controller.rb +38 -26
  5. data/app/controllers/renalware/letters/letters_controller.rb +2 -1
  6. data/app/controllers/renalware/mdm_controller.rb +2 -0
  7. data/app/controllers/renalware/mdm_patients_controller.rb +2 -0
  8. data/app/controllers/renalware/messaging/internal/messages_controller.rb +0 -6
  9. data/app/controllers/renalware/pd/regimes_controller.rb +4 -2
  10. data/app/controllers/renalware/transplants/wait_lists_controller.rb +1 -1
  11. data/app/models/renalware/hd/modality_description.rb +27 -0
  12. data/app/models/renalware/hd/patient.rb +8 -1
  13. data/app/models/renalware/hd/sessions/auditable_session.rb +5 -2
  14. data/app/models/renalware/hd/sessions/auditable_session_collection.rb +1 -1
  15. data/app/models/renalware/letters/electronic_receipt.rb +10 -2
  16. data/app/models/renalware/letters/letter.rb +3 -0
  17. data/app/models/renalware/modalities/description.rb +6 -0
  18. data/app/models/renalware/renal/patient.rb +3 -0
  19. data/app/models/renalware/transplants/registrations/wait_list_query.rb +14 -4
  20. data/app/policies/renalware/letters/electronic_receipt_policy.rb +1 -1
  21. data/app/presenters/renalware/patients/banner_presenter.rb +15 -0
  22. data/app/presenters/renalware/transplants/wait_list_registration_presenter.rb +46 -2
  23. data/app/views/renalware/hd/protocols/show.pdf.slim +0 -1
  24. data/app/views/renalware/hospitals/units/_form.html.slim +2 -2
  25. data/app/views/renalware/hospitals/units/edit.html.slim +1 -1
  26. data/app/views/renalware/hospitals/units/index.html.slim +2 -2
  27. data/app/views/renalware/hospitals/units/new.html.slim +1 -1
  28. data/app/views/renalware/letters/electronic_receipts/_table.html.slim +5 -2
  29. data/app/views/renalware/letters/letters/_letter.html.slim +8 -3
  30. data/app/views/renalware/letters/letters/_table.html.slim +12 -6
  31. data/app/views/renalware/letters/letters/author.html.slim +1 -2
  32. data/app/views/renalware/mdm/_prescriptions.html.slim +22 -16
  33. data/app/views/renalware/mdm_patients/_patient.html.slim +2 -0
  34. data/app/views/renalware/mdm_patients/_table.html.slim +1 -0
  35. data/app/views/renalware/patients/_header.html.slim +2 -1
  36. data/app/views/renalware/patients/side_menu/_actions.html.slim +17 -15
  37. data/app/views/renalware/transplants/wait_lists/_registration.html.slim +17 -23
  38. data/app/views/renalware/transplants/wait_lists/show.html.slim +2 -5
  39. data/config/locales/renalware/mdm.yml +1 -0
  40. data/config/routes.rb +20 -14
  41. data/lib/renalware/version.rb +1 -1
  42. metadata +3 -3
  43. data/app/controllers/renalware/concerns/nested_actions_controller_methods.rb +0 -30
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69acb8bcbc66d26c57c3780bc3118754485ff7c396cf2b12250f66e700f3219c
4
- data.tar.gz: 7b6a83a7af2942a923f54726d0e7b6e763e23e981811bc8fae70ebbe65bcbb63
3
+ metadata.gz: 48ebb9515ae94eb8fe4576bb06a5b5caffab683620a3a86baad31e571aeacbd1
4
+ data.tar.gz: 1dea69e84c15ff4b351b3d541edaae89ef01a20d2a702802ddbc0a3c3f34445f
5
5
  SHA512:
6
- metadata.gz: 926445330b993a066666112259188829d7468c4ffe423340b6212dd541729e13fc0db5dd0364ac1bfa9dcdc316fb59703f407bb4bc08032cb2158d7e88b918c9
7
- data.tar.gz: 501e734c35671bc8343825fc4aed03233e95ba8109e921f1a39cef5872d3e74eabc601f7db51f88b907f4f7834dff3f5632e06aba97dde8c2ada466120577015
6
+ metadata.gz: 3f71f9360fbed7a17f3c34b4adcbc8a6dd717d734d45741b13d30737dedcb4cbe520200885d0c3c46eb8f55eb93e73004240571a2a434351c854ed1d59c8c545
7
+ data.tar.gz: b9d76f685b3208666c869c0688d4cff3e706d6ef279411f58ff8984cf6d0a8263f4efef7780aa3fd49ea228b2c020bf30b2318ff0b2030aff9a599e959ca771f
@@ -6,6 +6,8 @@ module Renalware
6
6
  extend ActiveSupport::Concern
7
7
 
8
8
  included do
9
+ protected
10
+
9
11
  def default_pdf_options
10
12
  {
11
13
  page_size: "A4",
@@ -3,12 +3,6 @@ require_dependency "renalware/hd"
3
3
  module Renalware
4
4
  module HD
5
5
  class MDMPatientsController < Renalware::MDMPatientsController
6
- def render_index(**args)
7
- presenter = build_presenter(params: params, **args)
8
- authorize presenter.patients
9
- render :index, locals: { presenter: presenter }
10
- end
11
-
12
6
  def index
13
7
  query = HD::MDMPatientsQuery.new(
14
8
  relation: HD::Patient.eager_load(hd_profile: [:hospital_unit]),
@@ -19,6 +13,14 @@ module Renalware
19
13
  view_proc: ->(patient) { patient_hd_mdm_path(patient) },
20
14
  patient_presenter_class: HD::PatientPresenter)
21
15
  end
16
+
17
+ private
18
+
19
+ def render_index(**args)
20
+ presenter = build_presenter(params: params, **args)
21
+ authorize presenter.patients
22
+ render :index, locals: { presenter: presenter }
23
+ end
22
24
  end
23
25
  end
24
26
  end
@@ -3,59 +3,71 @@ require_dependency "renalware/hospitals"
3
3
  module Renalware
4
4
  module Hospitals
5
5
  class UnitsController < BaseController
6
- before_action :load_hospital_unit, only: [:edit, :update]
7
-
8
6
  def new
9
- @hospital_unit = Unit.new
10
- authorize @hospital_unit
7
+ hospital_unit = Unit.new
8
+ authorize hospital_unit
9
+ render_new(hospital_unit)
11
10
  end
12
11
 
13
12
  def create
14
- @hospital_unit = Unit.new(hospital_unit_params)
15
- authorize @hospital_unit
13
+ hospital_unit = Unit.new(hospital_unit_params)
14
+ authorize hospital_unit
16
15
 
17
- if @hospital_unit.save
18
- redirect_to hospitals_units_path,
19
- notice: t(".success", model_name: "hospital unit")
16
+ if hospital_unit.save
17
+ redirect_to hospitals_units_path, notice: success_msg_for("hospital unit")
20
18
  else
21
- flash.now[:error] = t(".failed", model_name: "hospital unit")
22
- render :new
19
+ flash.now[:error] = failed_msg_for("hospital unit")
20
+ render_new(hospital_unit)
23
21
  end
24
22
  end
25
23
 
26
24
  def index
27
- @hospital_units = Unit.all
28
- authorize @hospital_units
25
+ hospital_units = Unit.all
26
+ authorize hospital_units
27
+ render locals: { hospital_units: hospital_units }
28
+ end
29
+
30
+ def edit
31
+ render_edit(find_and_authorize_hospital_unit)
29
32
  end
30
33
 
31
34
  def update
32
- if @hospital_unit.update(hospital_unit_params)
33
- redirect_to hospitals_units_path,
34
- notice: t(".success", model_name: "hospital unit")
35
+ hospital_unit = find_and_authorize_hospital_unit
36
+ if hospital_unit.update(hospital_unit_params)
37
+ redirect_to hospitals_units_path, notice: success_msg_for("hospital unit")
35
38
  else
36
- flash.now[:error] = t(".failed", model_name: "hospital unit")
37
- render :edit
39
+ flash.now[:error] = failed_msg_for("hospital unit")
40
+ render_edit(hospital_unit)
38
41
  end
39
42
  end
40
43
 
41
44
  def destroy
42
- authorize Unit.destroy(params[:id])
43
- redirect_to hospitals_units_path,
44
- notice: t(".success", model_name: "hospital unit")
45
+ hospital_unit = find_and_authorize_hospital_unit
46
+ hospital_unit.destroy!
47
+ redirect_to hospitals_units_path, notice: success_msg_for("hospital unit")
45
48
  end
46
49
 
47
50
  private
48
51
 
52
+ def render_new(hospital_unit)
53
+ render :new, locals: { hospital_unit: hospital_unit }
54
+ end
55
+
56
+ def render_edit(hospital_unit)
57
+ render :edit, locals: { hospital_unit: hospital_unit }
58
+ end
59
+
60
+ def find_and_authorize_hospital_unit
61
+ hospital_unit = Unit.find(params[:id])
62
+ authorize hospital_unit
63
+ hospital_unit
64
+ end
65
+
49
66
  def hospital_unit_params
50
67
  params.require(:hospitals_unit).permit(
51
68
  :name, :unit_code, :renal_registry_code, :unit_type, :hospital_centre_id, :is_hd_site
52
69
  )
53
70
  end
54
-
55
- def load_hospital_unit
56
- @hospital_unit = Unit.find(params[:id])
57
- authorize @hospital_unit
58
- end
59
71
  end
60
72
  end
61
73
  end
@@ -19,7 +19,8 @@ module Renalware
19
19
  authorize letters
20
20
  render locals: {
21
21
  author: author,
22
- letters: present_letters(letters)
22
+ letters: present_letters(letters),
23
+ columns: %i(patient)
23
24
  }
24
25
  end
25
26
 
@@ -2,6 +2,8 @@ require_dependency "renalware"
2
2
 
3
3
  module Renalware
4
4
  class MDMController < BaseController
5
+ protected
6
+
5
7
  def render_show(mdm_presenter:)
6
8
  render :show, locals: {
7
9
  mdm: mdm_presenter
@@ -9,6 +9,8 @@ module Renalware
9
9
  include PresenterHelper
10
10
  include Renalware::Concerns::Pageable
11
11
 
12
+ protected
13
+
12
14
  def render_index(**args)
13
15
  presenter = build_presenter(params: params, **args)
14
16
  authorize presenter.patients
@@ -7,12 +7,6 @@ module Renalware
7
7
  include Renalware::Concerns::Pageable
8
8
  include PresenterHelper
9
9
 
10
- def sent
11
- messages = author.messages.page(page).per(per_page)
12
- authorize messages
13
- render locals: { messages: present(messages, MessagePresenter) }
14
- end
15
-
16
10
  def new
17
11
  authorize Message, :new?
18
12
  form = MessageFormBuilder.new(patient: patient, params: params).call
@@ -3,8 +3,6 @@ require_dependency "renalware/hd/base_controller"
3
3
  module Renalware
4
4
  module PD
5
5
  class RegimesController < BaseController
6
- include Renalware::Concerns::NestedActionsControllerMethods
7
-
8
6
  before_action :load_patient
9
7
 
10
8
  def new
@@ -16,6 +14,7 @@ module Renalware
16
14
  }
17
15
  end
18
16
 
17
+ # rubocop:disable Metrics/AbcSize
19
18
  def create
20
19
  result = CreateRegime.new(patient: patient)
21
20
  .call(by: current_user, params: pd_regime_params)
@@ -30,6 +29,7 @@ module Renalware
30
29
  }
31
30
  end
32
31
  end
32
+ # rubocop:enable Metrics/AbcSize
33
33
 
34
34
  def edit
35
35
  render :edit, locals: {
@@ -38,6 +38,7 @@ module Renalware
38
38
  }
39
39
  end
40
40
 
41
+ # rubocop:disable Metrics/AbcSize
41
42
  def update
42
43
  result = ReviseRegime.new(pd_regime).call(by: current_user, params: pd_regime_params)
43
44
 
@@ -52,6 +53,7 @@ module Renalware
52
53
  }
53
54
  end
54
55
  end
56
+ # rubocop:enable Metrics/AbcSize
55
57
 
56
58
  def show
57
59
  render :show, locals: {
@@ -10,7 +10,7 @@ module Renalware
10
10
  authorize registrations
11
11
  render locals: {
12
12
  path_params: path_params,
13
- registrations: registrations,
13
+ registrations: CollectionPresenter.new(registrations, WaitListRegistrationPresenter),
14
14
  q: query.search
15
15
  }
16
16
  end
@@ -8,6 +8,33 @@ module Renalware
8
8
  def to_sym
9
9
  :hd
10
10
  end
11
+
12
+ def augmented_name_for(patient)
13
+ AugmentedModalityName.new(name, patient).to_s
14
+ end
15
+
16
+ # This class might be better as a presenter but leaving here for now.
17
+ # #to_s returns e.g. "HD (HOSPCODE)" if patient's HD profile indicates they dialyse at
18
+ # HOSPCODE, otherwise returns "HD".
19
+ class AugmentedModalityName
20
+ delegate :hd_profile, to: :patient, allow_nil: true
21
+ delegate :hospital_unit, to: :hd_profile, allow_nil: true
22
+ delegate :unit_code, to: :hospital_unit, allow_nil: true
23
+
24
+ def initialize(default_name, patient)
25
+ @patient = HD.cast_patient(patient)
26
+ @default_name = default_name
27
+ end
28
+
29
+ def to_s
30
+ return default_name if patient.blank? || unit_code.blank?
31
+ "#{default_name} (#{unit_code})"
32
+ end
33
+
34
+ private
35
+
36
+ attr_reader :patient, :default_name
37
+ end
11
38
  end
12
39
  end
13
40
  end
@@ -8,7 +8,14 @@ module Renalware
8
8
  has_one :hd_profile, class_name: "Profile"
9
9
  has_one :hd_preference_set, class_name: "PreferenceSet"
10
10
  has_many :hd_sessions, class_name: "Session"
11
- scope :with_profile, -> { includes(:hd_profile) }
11
+ scope :with_profile, lambda {
12
+ includes(hd_profile: :hospital_unit)
13
+ .joins(<<-SQL)
14
+ LEFT OUTER JOIN hd_profiles ON hd_profiles.patient_id = patients.id
15
+ LEFT OUTER JOIN hospital_units ON hd_profiles.hospital_unit_id = hospital_units.id
16
+ SQL
17
+ .where("hd_profiles.deactivated_at is NULL")
18
+ }
12
19
 
13
20
  def treated?
14
21
  modality_descriptions.exists?(type: "Renalware::HD::ModalityDescription")
@@ -61,8 +61,7 @@ module Renalware
61
61
  # This is fluid removed (ml) / HD time in hours eg 3.75 / dry weight (kg)
62
62
  # The result is in ml/hr/kg
63
63
  def ufr
64
- return nil unless measured_dry_weight > 0 && duration > 0
65
- return nil unless (fluid_removed = document.dialysis.fluid_removed) > 0
64
+ return nil unless measured_dry_weight > 0 && duration > 0 && fluid_removed > 0
66
65
 
67
66
  fluid_removed / duration_as_hours / measured_dry_weight
68
67
  end
@@ -80,6 +79,10 @@ module Renalware
80
79
  def duration_as_hours
81
80
  duration.to_f / 60.0
82
81
  end
82
+
83
+ def fluid_removed
84
+ document.dialysis.fluid_removed.to_f
85
+ end
83
86
  end
84
87
  end
85
88
  end
@@ -151,7 +151,7 @@ module Renalware
151
151
  end
152
152
 
153
153
  def total
154
- @total ||= values.inject(0){ |sum, value| sum + value }
154
+ @total ||= values.inject(0.0){ |sum, value| sum + value.to_f }
155
155
  end
156
156
 
157
157
  def mean
@@ -20,8 +20,16 @@ module Renalware
20
20
  .merge(Letter::Approved.all)
21
21
  .where(letter_letters: { author_id: user_id })
22
22
  }
23
- scope :unread, -> { where(read_at: nil).joins(:letter).merge(Letter::Approved.all) }
24
- scope :read, -> { where.not(read_at: nil).joins(:letter).merge(Letter::Approved.all) }
23
+ scope :unread, lambda {
24
+ where(read_at: nil)
25
+ .joins(:letter)
26
+ .merge(Letter.approved_or_completed)
27
+ }
28
+ scope :read, lambda {
29
+ where.not(read_at: nil)
30
+ .joins(:letter)
31
+ .merge(Letter.approved_or_completed)
32
+ }
25
33
  scope :for_recipient, ->(user_id) { where(recipient_id: user_id) }
26
34
  scope :ordered, -> { order(created_at: :desc) }
27
35
 
@@ -63,6 +63,9 @@ module Renalware
63
63
  scope :with_patient, -> { includes(patient: :primary_care_physician) }
64
64
  scope :with_event, -> { includes(:event) }
65
65
  scope :with_cc_recipients, -> { includes(cc_recipients: { addressee: { person: :address } }) }
66
+ scope :approved_or_completed, lambda {
67
+ where(type: [state_class_name(:approved), state_class_name(:completed)])
68
+ }
66
69
 
67
70
  delegate :primary_care_physician, to: :patient
68
71
 
@@ -20,6 +20,12 @@ module Renalware
20
20
  def self.policy_class
21
21
  Modalities::DescriptionPolicy
22
22
  end
23
+
24
+ # Modalities::Description subclasses can override this to for instance add
25
+ # the patient's 'HD Site' add after 'HD'
26
+ def augmented_name_for(_patient)
27
+ name
28
+ end
23
29
  end
24
30
  end
25
31
  end
@@ -9,6 +9,9 @@ module Renalware
9
9
  scope :having_no_primary_renal_diagnosis, lambda {
10
10
  where(renal_profile: nil)
11
11
  }
12
+ scope :with_profile, lambda {
13
+ joins("LEFT OUTER JOIN renal_profiles ON renal_profiles.patient_id = patients.id")
14
+ }
12
15
  end
13
16
  end
14
17
  end
@@ -23,7 +23,11 @@ module Renalware
23
23
  query = query_for_filter(named_filter).merge(q)
24
24
  QueryableRegistration
25
25
  .includes(patient: [current_modality: :description])
26
+ .includes(current_status: :description)
27
+ .merge(HD::Patient.with_profile)
28
+ .merge(Renal::Patient.with_profile)
26
29
  .search(query).tap do |s|
30
+
27
31
  s.sorts = ["patient_family_name, patient_given_name"]
28
32
  end
29
33
  end
@@ -80,10 +84,6 @@ module Renalware
80
84
  .where.not(transplant_registration_status_descriptions: { code: codes })
81
85
  }
82
86
 
83
- ransacker :uk_transplant_centre_code do
84
- Arel.sql("transplant_registrations.document -> 'codes' ->> 'uk_transplant_centre_code'")
85
- end
86
-
87
87
  ransacker :crf_highest_value do
88
88
  Arel.sql("transplant_registrations.document -> 'crf' -> 'highest' ->> 'result'")
89
89
  end
@@ -92,6 +92,16 @@ module Renalware
92
92
  Arel.sql("transplant_registrations.document -> 'crf' -> 'latest' ->> 'result'")
93
93
  end
94
94
 
95
+ # TODO: move ransacker to HD namespace
96
+ ransacker :hd_site do
97
+ Arel.sql("hospital_units.unit_code")
98
+ end
99
+
100
+ # TODO: move ransacker to Renal namespace
101
+ ransacker :esrf_on do
102
+ Arel.sql("renal_profiles.esrf_on")
103
+ end
104
+
95
105
  scope :ukt_status_is, lambda { |status|
96
106
  where(
97
107
  "transplant_registrations.document -> 'uk_transplant_centre' ->> 'status' ilike ?",
@@ -6,7 +6,7 @@ module Renalware
6
6
  module Letters
7
7
  class ElectronicReceiptPolicy < BasePolicy
8
8
  def mark_as_read?
9
- !record.read? && record.letter.approved?
9
+ !record.read? && (record.letter.approved? || record.letter.completed?)
10
10
  end
11
11
 
12
12
  def unread?
@@ -0,0 +1,15 @@
1
+ require_dependency "renalware/patients"
2
+
3
+ module Renalware
4
+ module Patients
5
+ class BannerPresenter < SimpleDelegator
6
+ def current_modality_description
7
+ if current_modality.blank? || current_modality.new_record?
8
+ I18n.t("renalware.modalities.none")
9
+ else
10
+ current_modality.description.augmented_name_for(__getobj__)
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -5,13 +5,57 @@ require_dependency "renalware/transplants"
5
5
  module Renalware
6
6
  module Transplants
7
7
  class WaitListRegistrationPresenter < SimpleDelegator
8
- delegate :uk_transplant_centre, to: :document
9
- delegate :status, :status_updated_on, to: :uk_transplant_centre, prefix: true, allow_nil: true
8
+ delegate :uk_transplant_centre,
9
+ :transplant,
10
+ :organs,
11
+ :crf,
12
+ to: :document
13
+ delegate :status,
14
+ :status_updated_on,
15
+ to: :uk_transplant_centre, prefix: true, allow_nil: true
16
+ delegate :highest,
17
+ :latest,
18
+ to: :crf, prefix: true, allow_nil: true
19
+ delegate :recorded_on,
20
+ :result,
21
+ to: :crf_highest, prefix: true, allow_nil: true
22
+ delegate :recorded_on,
23
+ :result,
24
+ to: :crf_latest, prefix: true, allow_nil: true
25
+ delegate :blood_group,
26
+ :nb_of_previous_grafts,
27
+ to: :transplant, prefix: true, allow_nil: true
28
+ delegate :transplant_type,
29
+ to: :organs,
30
+ prefix: true, allow_nil: true
31
+ delegate :hospital_identifier,
32
+ :age,
33
+ :sex,
34
+ :current_modality,
35
+ to: :patient,
36
+ prefix: true, allow_nil: true
10
37
 
11
38
  def uk_transplant_centre_summary
12
39
  return if uk_transplant_centre_status.blank?
13
40
  "#{uk_transplant_centre_status} (#{I18n.l(uk_transplant_centre_status_updated_on)})"
14
41
  end
42
+
43
+ def hd_hospital_unit_code
44
+ Renalware::HD.cast_patient(patient).hd_profile&.hospital_unit&.unit_code
45
+ end
46
+
47
+ def esrf_date
48
+ Renalware::Renal.cast_patient(patient).profile&.esrf_on
49
+ end
50
+
51
+ def dol
52
+ entered_on && (Time.zone.today - entered_on).to_i
53
+ end
54
+
55
+ def sens
56
+ return if crf_latest_result.blank?
57
+ crf_latest_result.to_i > 60 ? "Sens" : "Unsens"
58
+ end
15
59
  end
16
60
  end
17
61
  end
@@ -5,7 +5,6 @@
5
5
 
6
6
  - protocol.with_format("html") do
7
7
  .protocol
8
-
9
8
  = render "renalware/patients/header", patient: protocol.patient
10
9
  table.protocol-patient-summary
11
10
  thead
@@ -1,6 +1,6 @@
1
- = render "renalware/shared/errors", model: @hospital_unit
1
+ = render "renalware/shared/errors", model: hospital_unit
2
2
 
3
- = simple_form_for @hospital_unit,
3
+ = simple_form_for hospital_unit,
4
4
  wrapper: :horizontal_form,
5
5
  html: { autocomplete: "off" } do |f|
6
6
  = f.association :hospital_centre,
@@ -1,3 +1,3 @@
1
1
  = within_admin_layout(title: "Edit",
2
2
  breadcrumbs: breadcrumb_for("Hospital Units", hospitals_units_path)) do
3
- = render "form"
3
+ = render "form", hospital_unit: hospital_unit
@@ -16,14 +16,14 @@
16
16
  th.col-width-tiny Stations
17
17
  th.col-width-medium
18
18
  tbody
19
- - @hospital_units.each do |unit|
19
+ - hospital_units.each do |unit|
20
20
  tr
21
21
  td
22
22
  = link_to "Edit", edit_hospitals_unit_path(unit.id)
23
23
  = pipe_separator
24
24
  = link_to "Delete",
25
25
  hospitals_unit_path(unit.id),
26
- RecipientFollowupmethod: :delete,
26
+ method: :delete,
27
27
  data: { confirm: I18n.t("prompts.confirm_delete") }
28
28
  td= unit.unit_code
29
29
  td= unit.name
@@ -1,3 +1,3 @@
1
1
  = within_admin_layout(title: "Add",
2
2
  breadcrumbs: breadcrumb_for("Hospital Units", hospitals_units_path)) do
3
- = render "form"
3
+ = render "form", hospital_unit: hospital_unit
@@ -1,6 +1,7 @@
1
1
  table.letters.electronic-ccs.has-togglable-rows
2
2
  thead
3
3
  tr
4
+ th.col-width-tiny State
4
5
  th.col-width-date Date
5
6
  th.col-width-date-time Read at
6
7
  th.col-width-medium Author
@@ -15,7 +16,9 @@ table.letters.electronic-ccs.has-togglable-rows
15
16
  - letter = Renalware::Letters::LetterPresenter.new(receipt.letter)
16
17
  - patient = letter.patient
17
18
 
18
- tr(id=receipt.html_identifier)
19
+ tr(id=receipt.html_identifier class=letter.state.dasherize)
20
+ td.state
21
+ span= letter.state_description
19
22
  td= l(letter.issued_on)
20
23
  td= l(receipt.read_at)
21
24
  td= letter.author
@@ -31,7 +34,7 @@ table.letters.electronic-ccs.has-togglable-rows
31
34
 
32
35
  = content_tag(:tr, id: receipt.html_preview_identifier, style: "display: none")
33
36
  td
34
- td(colspan=6)
37
+ td(colspan=7)
35
38
  .quick-preview
36
39
  = simple_format letter.body
37
40
 
@@ -1,3 +1,5 @@
1
+ - columns = local_assigns[:columns] || []
2
+
1
3
  tr(class=letter.state.dasherize)
2
4
  td
3
5
  = link_to "Toggle", "#quick-preview-#{letter.id}", data: { behaviour: "toggler" }
@@ -16,12 +18,15 @@ tr(class=letter.state.dasherize)
16
18
  td.state
17
19
  span= letter.state_description
18
20
  td= l(letter.issued_on)
19
- td= letter.author
21
+ - if columns.include?(:author)
22
+ td.col-width-medium-with-ellipsis= letter.author
23
+ - if columns.include?(:patient)
24
+ td.col-width-medium-with-ellipsis= default_patient_link(letter.patient)
20
25
  td.recipient= letter.main_recipient.address
21
- td= letter.description
26
+ td.col-width-medium-with-ellipsis= letter.description
22
27
 
23
28
  = content_tag(:tr, id: "quick-preview-#{letter.id}", style: "display: none")
24
29
  td
25
- td(colspan=7)
30
+ td(colspan=8)
26
31
  .quick-preview
27
32
  = simple_format letter.body
@@ -1,14 +1,20 @@
1
+ - columns = local_assigns[:columns] || [:author]
2
+
1
3
  table.auto-layout.letters.has-togglable-rows
2
4
  thead
3
5
  tr
4
- th.col-width-medium
5
- th State
6
+ th.col-width-small
7
+ th.col-width-tiny State
6
8
  th.col-width-date Date
7
- th Author
8
- th Recipient
9
- th Description
9
+ - if columns.include?(:author)
10
+ th.col-width-medium Author
11
+ - if columns.include?(:patient)
12
+ th.col-width-medium Patient
13
+ th.col-width-medium Recipient
14
+ th.col-width-medium Description
10
15
 
11
16
  tbody
12
17
  = render partial: "renalware/letters/letters/letter",
13
18
  collection: letters,
14
- cached: true
19
+ cached: true,
20
+ locals: { columns: columns }
@@ -1,4 +1,3 @@
1
1
  = within_admin_layout(title: "#{author.full_name}'s letters") do
2
-
3
- = render "table", letters: letters
2
+ = render "table", letters: letters, columns: columns
4
3
  = paginate letters
@@ -7,21 +7,27 @@ article
7
7
  patient_prescriptions_path(mdm.patient),
8
8
  class: "button secondary"
9
9
 
10
- - if local_assigns[:with_esa] == true
10
+ = link_to "Toggle",
11
+ "#prescriptions",
12
+ class: "button secondary",
13
+ data: { behaviour: "css-toggler" }
11
14
 
12
- ul.tab-strip(data-tab)
13
- li.tab-title.active= link_to "Current", "#current"
14
- li.tab-title= link_to "EPO History", "#epo-history"
15
+ #prescriptions.expandable
16
+ - if local_assigns[:with_esa] == true
15
17
 
16
- .tabs-content
17
- #current.content.active
18
- = render "renalware/mdm/prescriptions/table",
19
- prescriptions: mdm.current_prescriptions,
20
- show_administer_on_hd: true
21
- #epo-history.content
22
- = render "renalware/mdm/prescriptions/table",
23
- prescriptions: mdm.esa_prescriptions,
24
- show_terminated_on: true,
25
- show_administer_on_hd: true
26
- - else
27
- = render "current_prescriptions", mdm: mdm
18
+ ul.tab-strip(data-tab)
19
+ li.tab-title.active= link_to "Current", "#current"
20
+ li.tab-title= link_to "EPO History", "#epo-history"
21
+
22
+ .tabs-content
23
+ #current.content.active
24
+ = render "renalware/mdm/prescriptions/table",
25
+ prescriptions: mdm.current_prescriptions,
26
+ show_administer_on_hd: true
27
+ #epo-history.content
28
+ = render "renalware/mdm/prescriptions/table",
29
+ prescriptions: mdm.esa_prescriptions,
30
+ show_terminated_on: true,
31
+ show_administer_on_hd: true
32
+ - else
33
+ = render "current_prescriptions", mdm: mdm
@@ -1,4 +1,5 @@
1
1
  - observation_set = patient.current_observation_set
2
+ - transplant_patient = Renalware::Transplants::PatientPresenter.new(patient)
2
3
  tr
3
4
  td.full-name= link_to patient.to_s(:default), view_proc.call(patient)
4
5
  td.nowrap= patient.nhs_number
@@ -6,6 +7,7 @@ tr
6
7
  td= patient.sex.code
7
8
  td= patient.age
8
9
  td= patient.modality_description&.name
10
+ td= transplant_patient.current_registration_status
9
11
  td= observation_set.hgb_result
10
12
  td= l(observation_set.hgb_observed_at)
11
13
  td= observation_set.ure_result
@@ -8,6 +8,7 @@ table#patients.mdm-patients.columns
8
8
  th.col-width-tiny= t(".sex")
9
9
  th.col-width-tiny= t(".age")
10
10
  th.col-width-medium= t(".modality")
11
+ th.col-width-date= t(".registration_status")
11
12
  - %i(hgb ure cre).each do |code|
12
13
  th.col-width-tiny= sort_link(path, code, t(".#{code}"))
13
14
  th.col-width-date= sort_link(path, :"#{code}_date", t(".#{code}_date"))
@@ -1,4 +1,5 @@
1
1
  - back_path ||= nil
2
+ - patient = Renalware::Patients::BannerPresenter.new(patient)
2
3
 
3
4
  .header.patient-header
4
5
  / If screen-is-mobile-size is visible then we collapse the patient LH nav
@@ -31,4 +32,4 @@
31
32
  dt= t(".born_on")
32
33
  dd= "#{l(patient.born_on)} (#{patient.age}y)"
33
34
  dt= t(".modality")
34
- dd= modality_description_for(patient.current_modality)
35
+ dd= patient.current_modality_description
@@ -1,20 +1,22 @@
1
1
  - bookmark = find_user_bookmark_for_patient(patient)
2
2
 
3
- - cache([patient, current_user, bookmark || "bookmarks/"]) do
4
- - if bookmark.present?
5
- li.link.action= render partial: "renalware/patients/bookmarks/delete",
6
- locals: { bookmark: bookmark, link_text: t(".delete_bookmark") }
7
- - else
8
- li.link.action= render partial: "renalware/patients/bookmarks/new",
9
- locals: { patient: patient, link_text: t(".create_bookmark") }
10
-
11
- - cache([patient, patient.worry || "worries/"]) do
12
- - if patient.worry.present?
13
- li.link.action= render partial: "renalware/patients/worries/delete",
14
- locals: { patient: patient }
15
- - else
16
- li.link.action= render partial: "renalware/patients/worries/new",
17
- locals: { patient: patient }
3
+ / Don't cache fragments that contain a form
4
+ /- cache([patient, current_user, bookmark || "bookmarks/"]) do
5
+ - if bookmark.present?
6
+ li.link.action= render partial: "renalware/patients/bookmarks/delete",
7
+ locals: { bookmark: bookmark, link_text: t(".delete_bookmark") }
8
+ - else
9
+ li.link.action= render partial: "renalware/patients/bookmarks/new",
10
+ locals: { patient: patient, link_text: t(".create_bookmark") }
11
+
12
+ / Don't cache fragments that contain a form
13
+ /- cache([patient, patient.worry || "worries/"]) do
14
+ - if patient.worry.present?
15
+ li.link.action= render partial: "renalware/patients/worries/delete",
16
+ locals: { patient: patient }
17
+ - else
18
+ li.link.action= render partial: "renalware/patients/worries/new",
19
+ locals: { patient: patient }
18
20
 
19
21
  - cache([patient, "send_message_link"]) do
20
22
  li.link.action= render partial: "renalware/messaging/internal/messages/send_message_link",
@@ -5,27 +5,21 @@ tr
5
5
  td.full-name
6
6
  = link_to registration.patient.to_s,
7
7
  patient_clinical_summary_path(registration.patient)
8
- td= registration.patient.hospital_identifier
9
- td= registration.patient.age
10
- td= registration.patient.sex.code
11
- td= registration.patient.current_modality
12
- td= registration.document.codes.uk_transplant_centre_code
8
+ td= registration.patient_hospital_identifier
9
+ td= registration.patient_age
10
+ td= registration.patient_sex.code
11
+ td= registration.patient_current_modality
12
+ td= registration.hd_hospital_unit_code
13
13
  td= registration.current_status
14
- td= registration.document.uk_transplant_centre&.status
15
- td
16
- - Renalware::Renal.cast_patient(registration.patient).tap do |patient|
17
- = I18n.l(patient.profile&.esrf_on)
18
- td= I18n.l registration.entered_on
19
- td
20
- - if registration.entered_on
21
- = (Time.zone.today - registration.entered_on).to_i
22
- td= registration.document.transplant.blood_group.to_s
23
- td= registration.document.crf.highest.result
24
- td= I18n.l registration.document.crf.highest.recorded_on
25
- td= registration.document.crf.latest.result
26
- td= I18n.l registration.document.crf.latest.recorded_on
27
- td
28
- - if registration.document.crf.latest.result.present?
29
- = (registration.document.crf.latest.result.to_i > 60 ? "Sens" : "Unsens")
30
- td= registration.document.transplant.nb_of_previous_grafts
31
- td= registration.document.organs.transplant_type.try(:text)
14
+ td= registration.uk_transplant_centre_status
15
+ td= l(registration.esrf_date)
16
+ td= l(registration.entered_on)
17
+ td= registration.dol
18
+ td= registration.transplant_blood_group.to_s
19
+ td= registration.crf_highest_result
20
+ td= l(registration.crf_highest_recorded_on)
21
+ td= registration.crf_latest_result
22
+ td= l(registration.crf_latest_recorded_on)
23
+ td= registration.sens
24
+ td= registration.transplant_nb_of_previous_grafts
25
+ td= registration.organs_transplant_type&.text
@@ -25,13 +25,10 @@
25
25
  th= sort_link([:renalware, q], :patient_born_on, "Age")
26
26
  th= sort_link([:renalware, q], :patient_sex, "Sex")
27
27
  th Modal
28
- th= sort_link([:renalware, q], :uk_transplant_centre_code, "Site")
28
+ th= sort_link([:renalware, q], :hd_site, "HD Site")
29
29
  th Status
30
30
  th UKT Status
31
- / Note patient_profile_esrf_on sorting not yet working because patient is not a
32
- / Renal::Patient so patient#profile does not exist. We may need to add a ransacker
33
- / in WaitListQuery
34
- th.col-width-date= sort_link([:renalware, q], :patient_profile_esrf_on, "ESRF Date")
31
+ th.col-width-date= sort_link([:renalware, q], :esrf_on, "ESRF Date")
35
32
  th.col-width-date= sort_link([:renalware, q], :entered_on, "Entry Date")
36
33
  th DOL
37
34
  th Bld Grp
@@ -19,6 +19,7 @@ en:
19
19
  cre: CRE
20
20
  cre_date: CRE Date
21
21
  egfr: EGFR
22
+ registration_status: Tx Status
22
23
  mdm:
23
24
  problems:
24
25
  view_all: View All
data/config/routes.rb CHANGED
@@ -36,16 +36,16 @@ Renalware::Engine.routes.draw do
36
36
  resources :mock_errors, only: [:index], controller: "system/mock_errors"
37
37
 
38
38
  namespace :reporting do
39
- resources :audits, except: [:destroy]
39
+ resources :audits, except: [:destroy, :create, :new]
40
40
  resources :audit_refreshments, only: [:create]
41
41
  end
42
42
 
43
43
  namespace :admissions do
44
- resources :requests do
44
+ resources :requests, except: :show do
45
45
  post :sort, on: :collection
46
46
  end
47
- resources :consults
48
- resources :admissions
47
+ resources :consults, except: :show
48
+ resources :admissions, except: :show
49
49
  end
50
50
 
51
51
  namespace :messaging do
@@ -110,11 +110,11 @@ Renalware::Engine.routes.draw do
110
110
 
111
111
  resources :bookmarks, controller: "patients/bookmarks", only: :destroy
112
112
  resource :dashboard, only: :show, controller: "dashboard/dashboards"
113
- resource :worryboard, :show, controller: "patients/worryboard"
113
+ resource :worryboard, only: :show, controller: "patients/worryboard"
114
114
 
115
115
  # Clinics
116
116
  resources :appointments, controller: "clinics/appointments", only: [:index]
117
- resources :clinic_visits, controller: "clinics/visits"
117
+ resources :clinic_visits, only: :index, controller: "clinics/visits"
118
118
 
119
119
  resources :deaths, only: :index, as: :patient_deaths
120
120
 
@@ -453,21 +453,27 @@ Renalware::Engine.routes.draw do
453
453
  scope "/donor" do
454
454
  resource :donor_dashboard, only: :show, path: "/dashboard"
455
455
  resource :donor_workup, only: [:show, :edit, :update], path: "/workup"
456
- resources :donor_operations, expect: [:index, :destroy], path: "/operations" do
457
- resource :followup, controller: "donor_followups", path: "/follow_up"
456
+ resources :donor_operations, except: [:index, :destroy], path: "/operations" do
457
+ resource :followup,
458
+ except: :destroy,
459
+ controller: "donor_followups",
460
+ path: "/follow_up"
458
461
  end
459
- resources :donations, expect: [:index, :destroy]
460
- resource :donor_stage, expect: [:index, :destroy], path: "/stage"
462
+ resources :donations, except: [:index, :destroy]
463
+ resource :donor_stage, only: [:new, :create], path: "/stage"
461
464
  end
462
465
 
463
466
  scope "/recipient" do
464
467
  resource :recipient_dashboard, only: :show, path: "/dashboard"
465
468
  resource :recipient_workup, only: [:show, :edit, :update], path: "/workup"
466
- resources :recipient_operations, expect: [:index, :destroy], path: "/operations" do
467
- resource :followup, controller: "recipient_followups", path: "/follow_up"
469
+ resources :recipient_operations, except: [:index, :destroy], path: "/operations" do
470
+ resource :followup,
471
+ except: :destroy,
472
+ controller: "recipient_followups",
473
+ path: "/follow_up"
468
474
  end
469
- resource :registration, expect: [:index, :destroy] do
470
- resources :statuses, controller: "registration_statuses"
475
+ resource :registration, only: [:show, :edit, :update] do
476
+ resources :statuses, except: [:index, :show], controller: "registration_statuses"
471
477
  end
472
478
  end
473
479
  end
@@ -1,3 +1,3 @@
1
1
  module Renalware
2
- VERSION = "2.0.15".freeze
2
+ VERSION = "2.0.16".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renalware-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.15
4
+ version: 2.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airslie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-06 00:00:00.000000000 Z
11
+ date: 2018-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -1059,7 +1059,6 @@ files:
1059
1059
  - app/controllers/renalware/clinics/visits_controller.rb
1060
1060
  - app/controllers/renalware/concerns/cache_busting.rb
1061
1061
  - app/controllers/renalware/concerns/devise_controller_methods.rb
1062
- - app/controllers/renalware/concerns/nested_actions_controller_methods.rb
1063
1062
  - app/controllers/renalware/concerns/pageable.rb
1064
1063
  - app/controllers/renalware/concerns/pdf_renderable.rb
1065
1064
  - app/controllers/renalware/dashboard.rb
@@ -1875,6 +1874,7 @@ files:
1875
1874
  - app/presenters/renalware/pathology/requests/sample_description.rb
1876
1875
  - app/presenters/renalware/pathology/results_presenter.rb
1877
1876
  - app/presenters/renalware/patient_presenter.rb
1877
+ - app/presenters/renalware/patients/banner_presenter.rb
1878
1878
  - app/presenters/renalware/pd/dashboard_presenter.rb
1879
1879
  - app/presenters/renalware/pd/delivery_interval_presenter.rb
1880
1880
  - app/presenters/renalware/pd/mdm_presenter.rb
@@ -1,30 +0,0 @@
1
- require "active_support/concern"
2
-
3
- module Renalware
4
- module Concerns::NestedActionsControllerMethods
5
- extend ActiveSupport::Concern
6
-
7
- included do
8
- # Allows add and remove form submissions for a nested collection
9
- #
10
- # @params
11
- # nested - the nested collection where items are added or removed
12
- # default_action - the update or save action wrapped in a proc
13
- # build_attrs - attributes to pass to collection#build when adding to the collection
14
- #
15
- def perform_action(nested, default_action, build_attrs = {})
16
- if (actions = params[:actions]).present?
17
- if actions.key?(:remove)
18
- index = actions[:remove].keys.first.to_i
19
- nested.destroy(nested[index])
20
- else
21
- nested.build(build_attrs)
22
- end
23
- false
24
- else
25
- default_action.call
26
- end
27
- end
28
- end
29
- end
30
- end