renalware-core 2.0.7 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35f1da96bf99bc1165eafb40df5d2061d5840831ef9d061373448bb6fc0d8dad
4
- data.tar.gz: cf73511f92c66f3a6192b26daefd7ed7a1bd69265edee4a283fa17d6e138e38b
3
+ metadata.gz: f41d5954f23c36c96a70b4144d1d87cf641d5b36710077b413a78be349a84535
4
+ data.tar.gz: b86bd1bc6dc7820348938df876fb4cd069fef8714d0cb5ad7fd702d8c7e0dd89
5
5
  SHA512:
6
- metadata.gz: 571bf241c4d5c4249267c2a948b46d3e1455f6bdd453891f13df6e66b45774eae011971a37a96280b6c0a5e1a60e8faeef22e9342ca0770ea99427ff116d626d
7
- data.tar.gz: f9700de2153b34d22684d45f79350bc4b996d5deb7b95faeb8d57adf0af85a24e6dd061cd423fd26f47aff4f6a2d13ba77351a6f89befc14e096fba68dd6a5d1
6
+ metadata.gz: e642930ef41116b225a8cbcb89af1638993141f498800f265aafff94cf9f68303ea9c9e1e46dad5e4d7dbe0a3b24c830360781b11a0b2cdaf1f3d638ef634180
7
+ data.tar.gz: 7178712e89d738149ee01e2b232befe8e7fef0d21a87eef5a3c5bdae85081562321cafa2039a814407943673788a687fc31caf6b771f1c36258bb50b30addf71
@@ -6,7 +6,8 @@ module Renalware
6
6
  def index
7
7
  render_index(query: query,
8
8
  page_title: t(".page_title"),
9
- view_proc: ->(patient) { patient_transplants_mdm_path(patient) })
9
+ view_proc: ->(patient) { patient_transplants_mdm_path(patient) },
10
+ patient_presenter_class: Transplants::MDMPatientPresenter)
10
11
  end
11
12
 
12
13
  private
@@ -9,7 +9,9 @@ module Renalware
9
9
  validates :patient_id, presence: true
10
10
  validates :started_on, presence: true
11
11
  validates :description, presence: true
12
- validates :consult_type, presence: true
12
+ # Currently #consult_type is a string and we are not sure what should be in there
13
+ # Migrated consults may not have a type so only enforce it creation of new ones.
14
+ validates :consult_type, presence: true, on: :create
13
15
  validates :other_site_or_ward, presence: {
14
16
  if: ->(consult){ consult.consult_site_id.blank? && consult.hospital_ward_id.blank? }
15
17
  }
@@ -45,9 +45,12 @@ module Renalware
45
45
  attribute :observations_after, Observations
46
46
 
47
47
  class Dialysis < Renalware::HD::SessionDocument::Dialysis
48
- # rubocop:disable Rails/Validation
49
- validates_presence_of attribute_set.map(&:name).reject{ |att| att == :machine_ktv }
50
- # rubocop:enable Rails/Validation
48
+ validates :arterial_pressure, presence: true
49
+ validates :venous_pressure, presence: true
50
+ validates :fluid_removed, presence: true
51
+ validates :blood_flow, presence: true
52
+ validates :flow_rate, presence: true
53
+ validates :litres_processed, presence: true
51
54
  end
52
55
  attribute :dialysis, Dialysis
53
56
 
@@ -32,6 +32,10 @@ module Renalware
32
32
  ""
33
33
  end
34
34
 
35
+ def to_s
36
+ [title, name].compact.join(" ")
37
+ end
38
+
35
39
  def skip_given_name_validation?
36
40
  true
37
41
  end
@@ -43,7 +47,11 @@ module Renalware
43
47
  end
44
48
 
45
49
  def salutation
46
- [title, name].join(" ")
50
+ [
51
+ Renalware.config.salutation_prefix,
52
+ title,
53
+ name
54
+ ].compact.join(" ")
47
55
  end
48
56
 
49
57
  class PrimaryCarePhysicianAddressAccessError < StandardError; end
@@ -55,6 +55,15 @@ module Renalware
55
55
  joins("RIGHT OUTER JOIN patient_worries ON patient_worries.patient_id = patients.id")
56
56
  end
57
57
  alias_method :on_worryboard, :patients_on_the_worry_board
58
+
59
+ def patients_with_a_transplant_operation_in_the_past_year
60
+ joins(<<-SQL)
61
+ LEFT JOIN transplant_recipient_operations
62
+ ON patients.id = transplant_recipient_operations.patient_id
63
+ SQL
64
+ .where("transplant_recipient_operations.performed_on >= ?", 1.year.ago)
65
+ end
66
+ alias_method :past_year, :patients_with_a_transplant_operation_in_the_past_year
58
67
  end
59
68
  end
60
69
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_dependency "renalware/transplants"
4
+
5
+ module Renalware
6
+ module Transplants
7
+ # Presenter formatting a single patient for use behind any MDM Patients listing.
8
+ class MDMPatientPresenter < Renalware::MDMPatientPresenter
9
+ def last_operation_on
10
+ Transplants::RecipientOperation
11
+ .for_patient(__getobj__)
12
+ .order(performed_on: :desc)
13
+ .limit(1)
14
+ .pluck(:performed_on)
15
+ .first
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,12 +1,22 @@
1
1
  # See HL7 spec http://pacs.hk/Doc/HL7/Hl7V231.pdf
2
- #
3
- xml = builder
4
2
 
5
- # Migrated OBRs have the prefix 'PCS-'. Some have been reported as duplicates by URDC.
6
- # I don't believe PCS-XXX is the actual placerid in the HL7 message as this is not stored in RW1
7
- # so we are safe here to suffix them with a random string to remove the possibility of duplication.
8
- placer_id = request.requestor_order_number
9
- placer_id += SecureRandom.hex(8) if placer_id.to_s.upcase.start_with?("PCS-")
3
+ # A Note about PlacerId
4
+ # ---------------------
5
+ # In UKRDC terms an OBR equates to their LabOrder. Each LabOrder must have a unique
6
+ # PlacerId. However an HL7 message (for example at KCH) can have multiple OBRs with the same
7
+ # placer id (aka requester order number) thus causing duplicate placer ids to appear in the XML.
8
+ # After email discussion with George and Nick at UKRDC it was decided that PlacerID could be
9
+ # any value as long as it is unique and is persisted in Renalware (in case an update needs to be
10
+ # sent, and the original LabOrder identified). To solve this we obfuscate the request.id (slightly)
11
+ # by converting to base 16 (hex) and then append it to the original requester order number.
12
+ # Its not good practice to expose a database id in this way though it is to an internal NHS consumer
13
+ # and the hex obfuscation helps slightly.
14
+ # A better approach might be to generate a GUID for each pathology_observation_request and pass
15
+ # this as the placer id. However that would introduce more moving parts (calling the SQL function
16
+ # to generate the uuid) and increases storage and XML file sizes.
17
+ placer_id = "#{request.requestor_order_number}-#{request.id.to_s(16)}".upcase
18
+
19
+ xml = builder
10
20
 
11
21
  xml.LabOrder do
12
22
  # xml.ReceivingLocation do
@@ -215,6 +215,7 @@ scss:
215
215
 
216
216
  .message {
217
217
  margin-top: 30px;
218
+ margin-bottom: 20px;
218
219
 
219
220
  p {
220
221
  margin-bottom: 15px;
@@ -308,6 +309,8 @@ scss:
308
309
  .message
309
310
  = letter.body&.html_safe
310
311
 
312
+ p Yours sincerely
313
+
311
314
  .signature.nobreak
312
315
  .electronic-signature
313
316
  p= letter.signature
@@ -106,9 +106,9 @@ heading
106
106
  .our-ref= "RW ref: #{patient.hospital_identifier}"
107
107
 
108
108
  span.logo= wicked_pdf_image_tag "renalware/NHS-Black.jpg", width: 50
109
- .trust
110
- .title Barts and the London
111
- span NHS Trust
109
+ / .trust
110
+ / .title Barts and the London
111
+ / span NHS Trust
112
112
 
113
113
  main
114
114
 
@@ -7,17 +7,23 @@ article
7
7
  data: { "reveal-id" => "change-gp-modal", "reveal-ajax" => "true" }
8
8
 
9
9
  dl.dl-horizontal
10
- dt GP:
10
+ dt(title=patient.primary_care_physician&.code) GP:
11
11
  - if patient.primary_care_physician.present?
12
12
  dd= patient.primary_care_physician
13
13
  - else
14
14
  dd None
15
+
16
+ dt(title=patient.practice&.code) Practice:
15
17
  - if patient.practice
16
- dt Practice
17
- dd
18
- = patient.practice.name
19
- br
20
- = Renalware::AddressPresenter::Block.new(patient.practice.address).to_html
18
+ dd= patient.practice.name
19
+ dt Address:
20
+ dd= Renalware::AddressPresenter::Block.new(patient.practice.address).to_html
21
+ dt Tel:
22
+ dd= patient.practice.telephone
23
+ dt Email:
24
+ dd= patient.practice.email
25
+ - else
26
+ dd None
21
27
 
22
28
  / This is where the Find GP modal will be inserted in an Ajax call
23
29
  #change-gp-modal.reveal-modal.medium(data-reveal)
@@ -3,6 +3,6 @@
3
3
  dl.sub-nav
4
4
  dd(class=("active" unless named_filter_param.present?))
5
5
  = link_to t(".filter.all"), transplants_mdm_patients_path
6
- - %i(recent on_worryboard).each do |filter|
6
+ - %i(on_worryboard recent past_year).each do |filter|
7
7
  dd(class=("active" if named_filter_param == filter.to_s))
8
8
  = link_to t(".filter.#{filter}"), transplants_filtered_mdm_patients_path(named_filter: filter)
@@ -0,0 +1,18 @@
1
+ - observation_set = patient.current_observation_set
2
+ tr
3
+ td.full-name= link_to patient.to_s(:default), view_proc.call(patient)
4
+ td.nowrap= patient.nhs_number
5
+ td.nowrap= patient.hospital_identifier
6
+ td= patient.sex.code
7
+ td= patient.age
8
+ td= patient.modality_description&.name
9
+ td= l(patient.last_operation_on)
10
+ td= observation_set.hgb_result
11
+ td= l(observation_set.hgb_observed_at)
12
+ td= observation_set.ure_result
13
+ td= l(observation_set.ure_observed_at)
14
+ td= observation_set.cre_result
15
+ td= l(observation_set.cre_observed_at)
16
+ td= observation_set.egfr_result
17
+ td= l(patient.esrf_date)
18
+ td.actions= link_to t(".view"), view_proc.call(patient)
@@ -0,0 +1,22 @@
1
+ - path = [:renalware, presenter.q]
2
+ table#patients.mdm-patients.columns
3
+ thead
4
+ tr
5
+ th.col-width-large= sort_link(path, :family_name, t(".name"))
6
+ th.col-width-nhs-no= sort_link(path, :nhs_number, t(".nhs_no"))
7
+ th.col-width-reference-no= t(".hosp_no")
8
+ th.col-width-tiny= t(".sex")
9
+ th.col-width-tiny= t(".age")
10
+ th.col-width-medium= t(".modality")
11
+ th.col-width-date= t(".last_operation_on")
12
+ - %i(hgb ure cre).each do |code|
13
+ th.col-width-tiny= sort_link(path, code, t(".#{code}"))
14
+ th.col-width-date= sort_link(path, :"#{code}_date", t(".#{code}_date"))
15
+ th.col-width-tiny= sort_link(path, :egfr, t(".egfr"))
16
+ th.col-width-date= t(".esrf")
17
+ th.col-width-small
18
+
19
+ tbody
20
+ = render partial: "patient",
21
+ collection: presenter.patients,
22
+ locals: { view_proc: presenter.view_proc, q: presenter.q }
@@ -2,10 +2,30 @@ en:
2
2
  renalware:
3
3
  transplants:
4
4
  mdm_patients:
5
+ patient:
6
+ view: "MDM"
7
+ table:
8
+ name: Name
9
+ nhs_no: NHS No.
10
+ hosp_no: Hosp No.
11
+ sex: Sex
12
+ age: Age
13
+ dob: Date of Birth
14
+ modality: Modality
15
+ esrf: ESRF
16
+ hgb: HGB
17
+ hgb_date: HGB Date
18
+ ure: URE
19
+ ure_date: URE Date
20
+ cre: CRE
21
+ cre_date: CRE Date
22
+ egfr: EGFR
23
+ last_operation_on: Last Op Date
5
24
  index:
6
25
  page_title: Transplant MDM Patients
7
26
  filters:
8
27
  filter:
9
28
  all: All
10
- recent: Recent
29
+ recent: Tx in Past 3/12
11
30
  on_worryboard: On Worryboard
31
+ past_year: Tx in Past Year
data/config/routes.rb CHANGED
@@ -271,7 +271,7 @@ Renalware::Engine.routes.draw do
271
271
  end
272
272
  resources :live_donors, only: :index
273
273
  resources :mdm_patients, only: :index
274
- constraints(named_filter: /(recent|on_worryboard)/) do
274
+ constraints(named_filter: /(recent|on_worryboard|past_year)/) do
275
275
  get "mdm_patients/:named_filter", to: "mdm_patients#index", as: :filtered_mdm_patients
276
276
  end
277
277
  end
@@ -1,3 +1,3 @@
1
1
  module Renalware
2
- VERSION = "2.0.7".freeze
2
+ VERSION = "2.0.8".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.7
4
+ version: 2.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airslie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-16 00:00:00.000000000 Z
11
+ date: 2018-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -1886,6 +1886,7 @@ files:
1886
1886
  - app/presenters/renalware/time_of_day_presenter.rb
1887
1887
  - app/presenters/renalware/transplants/consent_presenter.rb
1888
1888
  - app/presenters/renalware/transplants/donor_dashboard_presenter.rb
1889
+ - app/presenters/renalware/transplants/mdm_patient_presenter.rb
1889
1890
  - app/presenters/renalware/transplants/mdm_presenter.rb
1890
1891
  - app/presenters/renalware/transplants/patient_presenter.rb
1891
1892
  - app/presenters/renalware/transplants/recipient_dashboard_presenter.rb
@@ -2648,6 +2649,8 @@ files:
2648
2649
  - app/views/renalware/transplants/mdm/_prescriptions.html.slim
2649
2650
  - app/views/renalware/transplants/mdm/_top.html.slim
2650
2651
  - app/views/renalware/transplants/mdm_patients/_filters.html.slim
2652
+ - app/views/renalware/transplants/mdm_patients/_patient.html.slim
2653
+ - app/views/renalware/transplants/mdm_patients/_table.html.slim
2651
2654
  - app/views/renalware/transplants/recipient_dashboards/_modality_missing_warning.html.slim
2652
2655
  - app/views/renalware/transplants/recipient_dashboards/_page_actions.html.slim
2653
2656
  - app/views/renalware/transplants/recipient_dashboards/show.html.slim