renalware-core 2.0.21 → 2.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/renalware/clinical/profiles_controller.rb +9 -3
- data/app/controllers/renalware/system/user_feedback_controller.rb +2 -3
- data/app/controllers/renalware/virology/base_controller.rb +17 -0
- data/app/controllers/renalware/virology/profiles_controller.rb +61 -0
- data/app/documents/renalware/dated_boolean_diagnosis.rb +16 -0
- data/app/documents/renalware/patient_document.rb +1 -8
- data/app/documents/renalware/virology/profile_document.rb +14 -0
- data/app/documents/renalware/year_dated_diagnosis.rb +8 -0
- data/app/jobs/renalware/hd/generate_monthly_statistics_for_patient_job.rb +3 -1
- data/app/jobs/renalware/hd/generate_monthly_statistics_job.rb +3 -1
- data/app/models/renalware/pathology/observation_requests_attributes_builder.rb +4 -1
- data/app/models/renalware/patient.rb +5 -0
- data/app/models/renalware/virology/patient.rb +11 -0
- data/app/models/renalware/virology/profile.rb +4 -0
- data/app/models/renalware/virology/version.rb +11 -0
- data/app/policies/renalware/virology/profile_policy.rb +10 -0
- data/app/presenters/renalware/clinical/profile_presenter.rb +6 -5
- data/app/views/renalware/clinical/profiles/edit.html.slim +2 -4
- data/app/views/renalware/clinical/profiles/show.html.slim +9 -4
- data/app/views/renalware/hd/current_profile/_summary.html.slim +1 -1
- data/app/views/renalware/hd/dashboards/show.html.slim +6 -1
- data/app/views/renalware/hd/mdm/_top.html.slim +4 -0
- data/app/views/renalware/hd/preference_sets/_summary.html.slim +1 -1
- data/app/views/renalware/hd/protocols/_virology.html.slim +7 -0
- data/app/views/renalware/hd/protocols/show.pdf.slim +8 -3
- data/app/views/renalware/letters/letters/_letter.html.slim +28 -28
- data/app/views/renalware/letters/letters/_table.html.slim +0 -1
- data/app/views/renalware/patients/patients/new.html.slim +15 -0
- data/app/views/renalware/shared/documents/_dated_boolean_diagnosis.html.slim +0 -0
- data/app/views/renalware/shared/documents/_dated_boolean_diagnosis_input.html.slim +9 -0
- data/app/views/renalware/shared/documents/_year_dated_diagnosis_input.html.slim +21 -0
- data/app/views/renalware/virology/dashboards/_actions.html.slim +1 -0
- data/app/views/renalware/virology/dashboards/show.html.slim +1 -1
- data/app/views/renalware/virology/profiles/_summary.html.slim +16 -0
- data/app/views/renalware/virology/profiles/edit.html.slim +18 -0
- data/config/initializers/inflections.rb +1 -0
- data/config/locales/renalware/patient.yml +3 -0
- data/config/locales/renalware/virology/virology.en.yml +6 -0
- data/config/routes.rb +1 -0
- data/db/migrate/20180502093256_add_document_to_virology_profiles.rb +29 -0
- data/db/migrate/20180502110638_create_virology_versions.rb +10 -0
- data/lib/renalware/version.rb +1 -1
- data/spec/factories/virology/patients.rb +5 -0
- metadata +29 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c9df5d0937aca9913d07516b1d59836215499b54f8160d4a9fa5d6d811a5eb8
|
4
|
+
data.tar.gz: 4afe4555a5821f3c8464d95137fe5a28b8341f1db3e996083216c73b4780f85a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8f02ea880a57bc537775cc5addd1bea2d6fcf5bf3beae5c647d2cb36a88c6dc0007bed2d76215651d24a29e9cc9e30550fd77785ff3e9bfafbcd8cfdd0d1800
|
7
|
+
data.tar.gz: 9d7ba211614d195aff1d88d4faf32a6a83669c130fae96ecbedc69d5ec1be197cbf24749a6b05e3a148534e83fd1694e96a10d7ba246eb6a51699aadf21f78bd
|
@@ -32,8 +32,12 @@ module Renalware
|
|
32
32
|
|
33
33
|
def update_patient
|
34
34
|
document = patient.document
|
35
|
-
|
36
|
-
|
35
|
+
%i(diabetes history).each do |document_attribute|
|
36
|
+
document.send(
|
37
|
+
:"#{document_attribute}=",
|
38
|
+
profile_params[document_attribute].symbolize_keys
|
39
|
+
)
|
40
|
+
end
|
37
41
|
patient.by = current_user
|
38
42
|
patient.save!
|
39
43
|
end
|
@@ -41,7 +45,9 @@ module Renalware
|
|
41
45
|
def profile_params
|
42
46
|
params
|
43
47
|
.require(:clinical_profile)
|
44
|
-
.permit(
|
48
|
+
.permit(
|
49
|
+
diabetes: %i(diagnosis diagnosed_on),
|
50
|
+
history: %i(alcohol smoking))
|
45
51
|
.to_h
|
46
52
|
end
|
47
53
|
end
|
@@ -27,10 +27,9 @@ module Renalware
|
|
27
27
|
search = UserFeedback
|
28
28
|
.includes(:author)
|
29
29
|
.order(created_at: :desc)
|
30
|
-
.page(page)
|
31
|
-
.per(per_page)
|
32
30
|
.search(search_params)
|
33
|
-
|
31
|
+
|
32
|
+
feedback_msgs = search.result.page(page).per(per_page)
|
34
33
|
authorize feedback_msgs
|
35
34
|
render locals: { feedback_msgs: feedback_msgs, search: search }
|
36
35
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_dependency "renalware/renal"
|
4
|
+
|
5
|
+
module Renalware
|
6
|
+
module Virology
|
7
|
+
class BaseController < Renalware::BaseController
|
8
|
+
protected
|
9
|
+
|
10
|
+
# rubocop:disable Naming/MemoizedInstanceVariableName
|
11
|
+
def patient
|
12
|
+
@virology_patient ||= Renalware::Virology.cast_patient(super)
|
13
|
+
end
|
14
|
+
# rubocop:enable Naming/MemoizedInstanceVariableName
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_dependency "renalware/virology"
|
4
|
+
|
5
|
+
module Renalware
|
6
|
+
module Virology
|
7
|
+
class ProfilesController < Virology::BaseController
|
8
|
+
def edit
|
9
|
+
profile = find_profile
|
10
|
+
authorize profile
|
11
|
+
render_edit(profile: profile)
|
12
|
+
end
|
13
|
+
|
14
|
+
def update
|
15
|
+
profile = find_profile
|
16
|
+
authorize profile
|
17
|
+
if update_profile(profile)
|
18
|
+
redirect_to patient_virology_dashboard_path(patient)
|
19
|
+
else
|
20
|
+
render_edit(profile: profile)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def find_profile
|
27
|
+
patient.profile || patient.build_profile
|
28
|
+
end
|
29
|
+
|
30
|
+
def render_edit(profile:)
|
31
|
+
render :edit, locals: { patient: patient, profile: profile }
|
32
|
+
end
|
33
|
+
|
34
|
+
def update_profile(profile)
|
35
|
+
document_params = profile_params[:document]
|
36
|
+
document = profile.document
|
37
|
+
document.hiv = YearDatedDiagnosis.new(document_params[:hiv])
|
38
|
+
document.hepatitis_b = YearDatedDiagnosis.new(document_params[:hepatitis_b])
|
39
|
+
document.hepatitis_c = YearDatedDiagnosis.new(document_params[:hepatitis_c])
|
40
|
+
profile.save_by(current_user)
|
41
|
+
end
|
42
|
+
|
43
|
+
def profile_params
|
44
|
+
params
|
45
|
+
.require(:virology_profile)
|
46
|
+
.permit(attributes)
|
47
|
+
.merge(document: document_attributes)
|
48
|
+
end
|
49
|
+
|
50
|
+
def attributes
|
51
|
+
[
|
52
|
+
document: []
|
53
|
+
]
|
54
|
+
end
|
55
|
+
|
56
|
+
def document_attributes
|
57
|
+
params.require(:virology_profile).fetch(:document, nil).try(:permit!)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Renalware
|
4
|
+
class DatedBooleanDiagnosis < NestedAttribute
|
5
|
+
attribute :diagnosis, Boolean
|
6
|
+
attribute :diagnosed_on, Date
|
7
|
+
|
8
|
+
validates :diagnosed_on, timeliness: { type: :date, allow_blank: true }
|
9
|
+
|
10
|
+
def to_s
|
11
|
+
return "" if diagnosis.to_s.blank?
|
12
|
+
datestamp = diagnosed_on.present? ? "(#{I18n.l(diagnosed_on)})" : nil
|
13
|
+
[(diagnosis ? "Yes" : "No"), datestamp].compact.join(" ")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -8,14 +8,7 @@ module Renalware
|
|
8
8
|
attribute :interpreter_notes, String
|
9
9
|
attribute :admin_notes, String
|
10
10
|
attribute :special_needs_notes, String
|
11
|
-
|
12
|
-
class Diabetes < NestedAttribute
|
13
|
-
attribute :diagnosis, Boolean
|
14
|
-
attribute :diagnosed_on, Date
|
15
|
-
|
16
|
-
validates :diagnosed_on, timeliness: { type: :date, allow_blank: true }
|
17
|
-
end
|
18
|
-
attribute :diabetes, Diabetes
|
11
|
+
attribute :diabetes, DatedBooleanDiagnosis
|
19
12
|
|
20
13
|
class Referral < Document::Embedded
|
21
14
|
attribute :referring_physician_name, String
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "document/embedded"
|
4
|
+
require "document/enum"
|
5
|
+
|
6
|
+
module Renalware
|
7
|
+
module Virology
|
8
|
+
class ProfileDocument < Document::Embedded
|
9
|
+
attribute :hiv, YearDatedDiagnosis
|
10
|
+
attribute :hepatitis_b, YearDatedDiagnosis
|
11
|
+
attribute :hepatitis_c, YearDatedDiagnosis
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "month_period"
|
4
|
+
|
3
5
|
module Renalware
|
4
6
|
module HD
|
5
7
|
class GenerateMonthlyStatisticsForPatientJob < ApplicationJob
|
@@ -7,7 +9,7 @@ module Renalware
|
|
7
9
|
|
8
10
|
# :reek:UtilityFunction
|
9
11
|
def perform(patient:, month:, year:)
|
10
|
-
period = MonthPeriod.new(month: month, year: year)
|
12
|
+
period = Renalware::MonthPeriod.new(month: month, year: year)
|
11
13
|
GenerateMonthlyStatisticsForPatient.new(patient: patient, period: period).call
|
12
14
|
end
|
13
15
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "month_period"
|
4
|
+
|
3
5
|
# This job when executed will store a snapshot of last month's HD session statistics
|
4
6
|
# for each HD patient.
|
5
7
|
module Renalware
|
@@ -25,7 +27,7 @@ module Renalware
|
|
25
27
|
end
|
26
28
|
|
27
29
|
def period
|
28
|
-
@period ||= MonthPeriod.new(month: month, year: year)
|
30
|
+
@period ||= Renalware::MonthPeriod.new(month: month, year: year)
|
29
31
|
end
|
30
32
|
|
31
33
|
def month
|
@@ -11,6 +11,7 @@ module Renalware
|
|
11
11
|
# - This class could be removed and a Builder class used to create the database models
|
12
12
|
# directly - this would remove the extra level of indirection that this class introduces.
|
13
13
|
class ObservationRequestsAttributesBuilder
|
14
|
+
DEFAULT_REQUESTOR_NAME = "UNKNOWN"
|
14
15
|
delegate :patient_identification, :observation_requests, to: :message_payload
|
15
16
|
delegate :internal_id, to: :patient_identification
|
16
17
|
alias_attribute :requests, :observation_requests
|
@@ -59,7 +60,7 @@ module Renalware
|
|
59
60
|
hash = {
|
60
61
|
observation_request: {
|
61
62
|
description_id: request_description.id,
|
62
|
-
requestor_name: request.ordering_provider_name,
|
63
|
+
requestor_name: request.ordering_provider_name || DEFAULT_REQUESTOR_NAME,
|
63
64
|
requestor_order_number: request.placer_order_number,
|
64
65
|
requested_at: parse_time(request.date_time),
|
65
66
|
observations_attributes: build_observations_params(request)
|
@@ -109,7 +110,9 @@ module Renalware
|
|
109
110
|
Patient.find_by!(local_patient_id: local_patient_id)
|
110
111
|
end
|
111
112
|
|
113
|
+
# Default to using today's date and time if no date_time passed in the message
|
112
114
|
def parse_time(string)
|
115
|
+
return Time.zone.now.to_s if string.blank?
|
113
116
|
Time.zone.parse(string).to_s
|
114
117
|
end
|
115
118
|
end
|
@@ -85,6 +85,11 @@ module Renalware
|
|
85
85
|
length: { minimum: 10, maximum: 10 },
|
86
86
|
uniqueness: { case_sensitive: false },
|
87
87
|
allow_blank: true
|
88
|
+
validates :local_patient_id, uniqueness: { case_sensitive: false }, allow_blank: true
|
89
|
+
validates :local_patient_id_2, uniqueness: { case_sensitive: false }, allow_blank: true
|
90
|
+
validates :local_patient_id_3, uniqueness: { case_sensitive: false }, allow_blank: true
|
91
|
+
validates :local_patient_id_4, uniqueness: { case_sensitive: false }, allow_blank: true
|
92
|
+
validates :local_patient_id_5, uniqueness: { case_sensitive: false }, allow_blank: true
|
88
93
|
validates :family_name, presence: true
|
89
94
|
validates :given_name, presence: true
|
90
95
|
validates :born_on, presence: true
|
@@ -1,11 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_dependency "renalware/virology"
|
4
|
+
require "document/base"
|
4
5
|
|
5
6
|
module Renalware
|
6
7
|
module Virology
|
7
8
|
class Profile < ApplicationRecord
|
9
|
+
include Accountable
|
10
|
+
include Document::Base
|
8
11
|
belongs_to :patient, touch: true
|
12
|
+
has_document class_name: "Renalware::Virology::ProfileDocument"
|
9
13
|
end
|
10
14
|
end
|
11
15
|
end
|
@@ -6,8 +6,7 @@ module Renalware
|
|
6
6
|
module Clinical
|
7
7
|
class ProfilePresenter
|
8
8
|
attr_reader :patient, :params
|
9
|
-
delegate :allergies, to: :patient
|
10
|
-
delegate :diagnosis, :diagnosed_on, to: :diabetes, prefix: true
|
9
|
+
delegate :allergies, :document, to: :patient
|
11
10
|
|
12
11
|
def initialize(patient:, params:)
|
13
12
|
@params = params
|
@@ -30,11 +29,13 @@ module Renalware
|
|
30
29
|
end
|
31
30
|
|
32
31
|
def history
|
33
|
-
|
32
|
+
document.history || NullObject.instance
|
34
33
|
end
|
35
34
|
|
36
|
-
|
37
|
-
|
35
|
+
%i(diabetes).each do |document_attribute|
|
36
|
+
define_method(document_attribute) do
|
37
|
+
document.send(document_attribute) || NullObject.instance
|
38
|
+
end
|
38
39
|
end
|
39
40
|
|
40
41
|
def dry_weights
|
@@ -13,10 +13,8 @@
|
|
13
13
|
article
|
14
14
|
header
|
15
15
|
h2 Diabetes
|
16
|
-
|
17
|
-
= f
|
18
|
-
= fd.input :diagnosis, as: :inline_radio_buttons
|
19
|
-
= fd.input :diagnosed_on, as: :date_picker
|
16
|
+
.hint If YES, enter year of diagnosis
|
17
|
+
= render_input f, :diabetes
|
20
18
|
|
21
19
|
article
|
22
20
|
header
|
@@ -5,15 +5,20 @@
|
|
5
5
|
.grid
|
6
6
|
.row
|
7
7
|
.columns.medium-6
|
8
|
+
|
8
9
|
article
|
9
10
|
header
|
10
11
|
h2 Diabetes
|
11
12
|
|
12
13
|
dl.dl-horizontal
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
- %i(diabetes).each do |document_attribute|
|
15
|
+
dt= profile.document.class.human_attribute_name(document_attribute)
|
16
|
+
dd= profile.send(document_attribute).to_s
|
17
|
+
|
18
|
+
.columns.medium-6
|
19
|
+
= render "renalware/virology/profiles/summary",
|
20
|
+
patient: patient,
|
21
|
+
positive_results_only: true
|
17
22
|
|
18
23
|
.columns.medium-6
|
19
24
|
article
|
@@ -21,8 +21,13 @@
|
|
21
21
|
patient: dashboard.patient,
|
22
22
|
access: dashboard.access
|
23
23
|
|
24
|
+
.medium-6.large-4.xlarge-3.columns
|
25
|
+
= render "renalware/virology/profiles/summary",
|
26
|
+
patient: dashboard.patient,
|
27
|
+
positive_results_only: true
|
28
|
+
|
24
29
|
- unless dashboard.preference_set.new_record?
|
25
|
-
.medium-6.large-4.xlarge-
|
30
|
+
.medium-6.large-4.xlarge-3.columns
|
26
31
|
= render "renalware/hd/preference_sets/summary",
|
27
32
|
patient: dashboard.patient,
|
28
33
|
preference_set: dashboard.preference_set
|
@@ -3,5 +3,9 @@
|
|
3
3
|
.columns.small-12.medium-6.large-3
|
4
4
|
- if mdm.access.present?
|
5
5
|
= render "renalware/hd/accesses/summary", access: mdm.access, patient: mdm.patient
|
6
|
+
.columns.medium-12.large-6
|
7
|
+
= render "renalware/virology/profiles/summary",
|
8
|
+
patient: mdm.patient,
|
9
|
+
positive_results_only: true
|
6
10
|
.columns.medium-12.large-6
|
7
11
|
= render "prescriptions", mdm: mdm, with_esa: true
|
@@ -0,0 +1,7 @@
|
|
1
|
+
- document = Renalware::Virology.cast_patient(protocol.patient).profile&.document || Renalware::NullObject.instance
|
2
|
+
table(style="text-align: left;")
|
3
|
+
- %i(hiv hepatitis_b hepatitis_c).each do |attr|
|
4
|
+
- if document.public_send(attr).status&.yes?
|
5
|
+
tr
|
6
|
+
th= attr_name(document, attr)
|
7
|
+
td= document.public_send(attr).to_s
|
@@ -15,13 +15,18 @@
|
|
15
15
|
- if clinical_patient.allergy_status_updated_at
|
16
16
|
span.allergy_status_updated_at
|
17
17
|
= "#{l(clinical_patient.allergy_status_updated_at&.to_date)}"
|
18
|
+
|
18
19
|
th.protocol-prescriptions Prescriptions on HD
|
19
20
|
th.protocol-recent-pathology Recent Pathology
|
20
21
|
tbody
|
21
22
|
tr
|
22
|
-
td
|
23
|
-
|
24
|
-
td
|
23
|
+
td
|
24
|
+
= render "profile", profile: protocol.profile
|
25
|
+
td
|
26
|
+
= render "allergies", patient: protocol.patient
|
27
|
+
= render "virology", protocol: protocol
|
28
|
+
td
|
29
|
+
= render "prescriptions", prescriptions: protocol.prescriptions
|
25
30
|
td
|
26
31
|
= render "recent_pathology", recent_pathology: protocol.recent_pathology
|
27
32
|
= render "latest_dry_weight", latest_dry_weight: protocol.latest_dry_weight
|
@@ -1,32 +1,32 @@
|
|
1
1
|
- columns = local_assigns[:columns] || []
|
2
|
-
|
3
|
-
tr(class=letter.state.dasherize)
|
4
|
-
|
5
|
-
|
6
|
-
= pipe_separator
|
7
|
-
= link_to letter.view_label, patient_letters_letter_path(letter.patient, letter)
|
8
|
-
- if policy(letter).update?
|
9
|
-
= pipe_separator
|
10
|
-
= link_to "Edit", edit_patient_letters_letter_path(letter.patient, letter)
|
11
|
-
- if policy(letter).destroy?
|
2
|
+
- cache([letter, columns.join("-")]) do
|
3
|
+
tr(class=letter.state.dasherize)
|
4
|
+
td
|
5
|
+
= link_to "Toggle", "#quick-preview-#{letter.id}", data: { behaviour: "toggler" }
|
12
6
|
= pipe_separator
|
13
|
-
= link_to
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
= link_to letter.view_label, patient_letters_letter_path(letter.patient, letter)
|
8
|
+
- if policy(letter).update?
|
9
|
+
= pipe_separator
|
10
|
+
= link_to "Edit", edit_patient_letters_letter_path(letter.patient, letter)
|
11
|
+
- if policy(letter).destroy?
|
12
|
+
= pipe_separator
|
13
|
+
= link_to "Delete",
|
14
|
+
patient_letters_letter_path(letter.patient, letter),
|
15
|
+
method: :delete,
|
16
|
+
data: { confirm: I18n.t("prompts.confirm_delete") }
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
18
|
+
td.state
|
19
|
+
span= letter.state_description
|
20
|
+
td= l(letter.issued_on)
|
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)
|
25
|
+
td.recipient= letter.main_recipient.address
|
26
|
+
td.col-width-medium-with-ellipsis= letter.description
|
27
27
|
|
28
|
-
= content_tag(:tr, id: "quick-preview-#{letter.id}", style: "display: none")
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
= content_tag(:tr, id: "quick-preview-#{letter.id}", style: "display: none")
|
29
|
+
td
|
30
|
+
td(colspan=8)
|
31
|
+
.quick-preview
|
32
|
+
= simple_format letter.body
|
@@ -1,5 +1,20 @@
|
|
1
1
|
= within_admin_layout(title: "New", breadcrumbs: breadcrumb_for("Patients", patients_path)) do
|
2
|
+
|
3
|
+
.panel.warn
|
4
|
+
h2 Before adding a patient, please check they are not already in Renalware
|
5
|
+
span
|
6
|
+
| Use the search at the top left of this page to identify a patient
|
7
|
+
| using their name or hospital/NHS number.
|
8
|
+
br
|
9
|
+
| If you find a match remember to check
|
10
|
+
| their name, date of birth and hospital numbers from the different hospitals.
|
11
|
+
br
|
12
|
+
| Please
|
13
|
+
b DO NOT ADD A PATIENT
|
14
|
+
| if you think they already exist on the database - check first and add them later if necessary
|
15
|
+
|
2
16
|
.row
|
17
|
+
|
3
18
|
= render "renalware/shared/errors", model: patient
|
4
19
|
|
5
20
|
= simple_form_for patient,
|
File without changes
|
@@ -0,0 +1,9 @@
|
|
1
|
+
- renderable = f.object.public_send(attribute)
|
2
|
+
= f.simple_fields_for attribute, renderable do |fd|
|
3
|
+
.row(class=attribute)
|
4
|
+
.columns.small-12.medium-3.large-3
|
5
|
+
= fd.label attribute, f.object.class.human_attribute_name(attribute)
|
6
|
+
.columns.small-4.medium-4.large-3
|
7
|
+
= fd.input :diagnosis, as: :inline_radio_buttons, wrapper: :bare
|
8
|
+
.columns.small-7.medium-5.large-4.end
|
9
|
+
= fd.input :diagnosed_on, as: :date_picker, label: "Diagnosed", input_html: { class: "tiny-input" }
|
@@ -0,0 +1,21 @@
|
|
1
|
+
- renderable = f.object.public_send(attribute)
|
2
|
+
|
3
|
+
td= fd.label :status, f.object.class.human_attribute_name(attribute)
|
4
|
+
td= fd.input :status, as: :inline_radio_buttons,
|
5
|
+
label: false, wrapper: "vertical_form"
|
6
|
+
td= fd.input :confirmed_on_year, label: false, wrapper: "vertical_form",
|
7
|
+
collection: Renalware::YearDatedConfirmation.valid_years.reverse,
|
8
|
+
input_html: { class: "tiny-input" }
|
9
|
+
|
10
|
+
|
11
|
+
= f.simple_fields_for attribute, renderable do |fd|
|
12
|
+
.row(class=attribute)
|
13
|
+
.columns.small-12.medium-3.large-3
|
14
|
+
= fd.label attribute, f.object.class.human_attribute_name(attribute)
|
15
|
+
.columns.small-4.medium-4.large-3
|
16
|
+
= fd.input :status, as: :inline_radio_buttons, wrapper: :bare
|
17
|
+
.columns.small-6.medium-5.large-4.end
|
18
|
+
= fd.input :confirmed_on_year,
|
19
|
+
label: "Diagnosed",
|
20
|
+
collection: Renalware::YearDatedConfirmation.valid_years.reverse,
|
21
|
+
input_html: { class: "tiny-input" }
|
@@ -0,0 +1,16 @@
|
|
1
|
+
- profile = Renalware::Virology.cast_patient(patient).profile
|
2
|
+
- document = profile&.document || Renalware::NullObject.instance
|
3
|
+
- positive_results_only = local_assigns.fetch(:positive_results_only, false)
|
4
|
+
|
5
|
+
article
|
6
|
+
header
|
7
|
+
h2 Virology
|
8
|
+
ul
|
9
|
+
li= link_to "Edit", edit_patient_virology_profile_path(patient), class: "button"
|
10
|
+
|
11
|
+
dl.dl-horizontal.medium
|
12
|
+
- %i(hiv hepatitis_b hepatitis_c).each do |attr_name|
|
13
|
+
- status = document.public_send(attr_name).status
|
14
|
+
- next if positive_results_only && !status&.yes?
|
15
|
+
dt= attr_name(document, attr_name)
|
16
|
+
dd= document.public_send(attr_name).to_s
|
@@ -0,0 +1,18 @@
|
|
1
|
+
= within_patient_layout(title: "Edit Profile",
|
2
|
+
breadcrumbs: breadcrumb_for("Virology", patient_virology_dashboard_path(patient))) do
|
3
|
+
|
4
|
+
= simple_form_for(profile,
|
5
|
+
url: patient_virology_profile_path(patient, profile),
|
6
|
+
method: :patch,
|
7
|
+
html: { autocomplete: "off" },
|
8
|
+
wrapper: :horizontal_form) do |f|
|
9
|
+
|
10
|
+
= f.simple_fields_for :document, profile.document do |fd|
|
11
|
+
.hint If YES, enter year of diagnosis
|
12
|
+
= render_input fd, :hiv
|
13
|
+
= render_input fd, :hepatitis_b
|
14
|
+
= render_input fd, :hepatitis_c
|
15
|
+
|
16
|
+
= f.submit "Save", class: "button"
|
17
|
+
span= " or "
|
18
|
+
= link_to "cancel", patient_virology_dashboard_path(patient)
|
@@ -16,7 +16,10 @@ en:
|
|
16
16
|
renalreg_recorded_by: Renal Reg decision recorded by
|
17
17
|
rpv_recorded_by: RPV decision recorded by
|
18
18
|
language: Main Language
|
19
|
+
activemodel:
|
19
20
|
attributes:
|
21
|
+
renalware/patient_document:
|
22
|
+
diabetes: Diabetes
|
20
23
|
renalware/patient_document/history:
|
21
24
|
alcohol:
|
22
25
|
smoking:
|
@@ -8,6 +8,12 @@ en:
|
|
8
8
|
dashboards:
|
9
9
|
actions:
|
10
10
|
add_vaccination: Vaccination
|
11
|
+
activemodel:
|
12
|
+
attributes:
|
13
|
+
renalware/virology/profile_document:
|
14
|
+
hiv: HIV
|
15
|
+
hepatitis_b: Hepatitis B
|
16
|
+
hepatitis_c: Hepatitis C
|
11
17
|
enumerize:
|
12
18
|
renalware/virology/vaccination/document:
|
13
19
|
type:
|
data/config/routes.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
# rubocop:disable Metrics/MethodLength
|
2
|
+
class AddDocumentToVirologyProfiles < ActiveRecord::Migration[5.1]
|
3
|
+
def change
|
4
|
+
add_column :virology_profiles,
|
5
|
+
:document,
|
6
|
+
:jsonb,
|
7
|
+
default: {},
|
8
|
+
null: false
|
9
|
+
|
10
|
+
add_reference :virology_profiles,
|
11
|
+
:updated_by,
|
12
|
+
foreign_key:
|
13
|
+
{ to_table: :users },
|
14
|
+
index: true,
|
15
|
+
null: true
|
16
|
+
|
17
|
+
add_reference :virology_profiles,
|
18
|
+
:created_by,
|
19
|
+
foreign_key:
|
20
|
+
{ to_table: :users },
|
21
|
+
index: true,
|
22
|
+
null: true
|
23
|
+
|
24
|
+
add_column :virology_profiles, :updated_at, :datetime
|
25
|
+
add_column :virology_profiles, :created_at, :datetime
|
26
|
+
|
27
|
+
add_index :virology_profiles, :document, using: :gin
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class CreateVirologyVersions < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :virology_versions do |t|
|
4
|
+
t.string :item_type, null: false
|
5
|
+
t.integer :item_id, null: false
|
6
|
+
t.datetime :created_at
|
7
|
+
end
|
8
|
+
add_index :virology_versions, [:item_type, :item_id]
|
9
|
+
end
|
10
|
+
end
|
data/lib/renalware/version.rb
CHANGED
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.
|
4
|
+
version: 2.0.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airslie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_type
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 8.4.1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 8.4.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: chosen-rails
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -226,14 +226,14 @@ dependencies:
|
|
226
226
|
requirements:
|
227
227
|
- - "~>"
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version: 2.
|
229
|
+
version: 2.4.0
|
230
230
|
type: :runtime
|
231
231
|
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
234
|
- - "~>"
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version: 2.
|
236
|
+
version: 2.4.0
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
238
|
name: dumb_delegator
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|
@@ -352,14 +352,14 @@ dependencies:
|
|
352
352
|
requirements:
|
353
353
|
- - "~>"
|
354
354
|
- !ruby/object:Gem::Version
|
355
|
-
version: 0.
|
355
|
+
version: 0.16.2
|
356
356
|
type: :runtime
|
357
357
|
prerelease: false
|
358
358
|
version_requirements: !ruby/object:Gem::Requirement
|
359
359
|
requirements:
|
360
360
|
- - "~>"
|
361
361
|
- !ruby/object:Gem::Version
|
362
|
-
version: 0.
|
362
|
+
version: 0.16.2
|
363
363
|
- !ruby/object:Gem::Dependency
|
364
364
|
name: jbuilder
|
365
365
|
requirement: !ruby/object:Gem::Requirement
|
@@ -548,14 +548,14 @@ dependencies:
|
|
548
548
|
requirements:
|
549
549
|
- - "~>"
|
550
550
|
- !ruby/object:Gem::Version
|
551
|
-
version: 0.
|
551
|
+
version: 1.0.0
|
552
552
|
type: :runtime
|
553
553
|
prerelease: false
|
554
554
|
version_requirements: !ruby/object:Gem::Requirement
|
555
555
|
requirements:
|
556
556
|
- - "~>"
|
557
557
|
- !ruby/object:Gem::Version
|
558
|
-
version: 0.
|
558
|
+
version: 1.0.0
|
559
559
|
- !ruby/object:Gem::Dependency
|
560
560
|
name: puma
|
561
561
|
requirement: !ruby/object:Gem::Requirement
|
@@ -590,14 +590,14 @@ dependencies:
|
|
590
590
|
requirements:
|
591
591
|
- - "~>"
|
592
592
|
- !ruby/object:Gem::Version
|
593
|
-
version: 5.0
|
593
|
+
version: 5.2.0
|
594
594
|
type: :runtime
|
595
595
|
prerelease: false
|
596
596
|
version_requirements: !ruby/object:Gem::Requirement
|
597
597
|
requirements:
|
598
598
|
- - "~>"
|
599
599
|
- !ruby/object:Gem::Version
|
600
|
-
version: 5.0
|
600
|
+
version: 5.2.0
|
601
601
|
- !ruby/object:Gem::Dependency
|
602
602
|
name: rails
|
603
603
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1186,13 +1186,16 @@ files:
|
|
1186
1186
|
- app/controllers/renalware/transplants/registration_statuses_controller.rb
|
1187
1187
|
- app/controllers/renalware/transplants/registrations_controller.rb
|
1188
1188
|
- app/controllers/renalware/transplants/wait_lists_controller.rb
|
1189
|
+
- app/controllers/renalware/virology/base_controller.rb
|
1189
1190
|
- app/controllers/renalware/virology/dashboards_controller.rb
|
1191
|
+
- app/controllers/renalware/virology/profiles_controller.rb
|
1190
1192
|
- app/controllers/renalware/virology/vaccinations_controller.rb
|
1191
1193
|
- app/documents/renalware/accesses/assessment_document.rb
|
1192
1194
|
- app/documents/renalware/age.rb
|
1193
1195
|
- app/documents/renalware/binary_marker.rb
|
1194
1196
|
- app/documents/renalware/blood_group.rb
|
1195
1197
|
- app/documents/renalware/blood_pressure.rb
|
1198
|
+
- app/documents/renalware/dated_boolean_diagnosis.rb
|
1196
1199
|
- app/documents/renalware/dated_confirmation.rb
|
1197
1200
|
- app/documents/renalware/dated_integer.rb
|
1198
1201
|
- app/documents/renalware/dated_result.rb
|
@@ -1213,7 +1216,9 @@ files:
|
|
1213
1216
|
- app/documents/renalware/transplants/recipient_operation_document.rb
|
1214
1217
|
- app/documents/renalware/transplants/recipient_workup_document.rb
|
1215
1218
|
- app/documents/renalware/transplants/registration_document.rb
|
1219
|
+
- app/documents/renalware/virology/profile_document.rb
|
1216
1220
|
- app/documents/renalware/year_dated_confirmation.rb
|
1221
|
+
- app/documents/renalware/year_dated_diagnosis.rb
|
1217
1222
|
- app/drops/renalware/patients/patient_drop.rb
|
1218
1223
|
- app/drops/renalware/pd/exit_site_infection_drop.rb
|
1219
1224
|
- app/drops/renalware/pd/patient_drop.rb
|
@@ -1732,8 +1737,10 @@ files:
|
|
1732
1737
|
- app/models/renalware/user.rb
|
1733
1738
|
- app/models/renalware/version.rb
|
1734
1739
|
- app/models/renalware/virology.rb
|
1740
|
+
- app/models/renalware/virology/patient.rb
|
1735
1741
|
- app/models/renalware/virology/profile.rb
|
1736
1742
|
- app/models/renalware/virology/vaccination.rb
|
1743
|
+
- app/models/renalware/virology/version.rb
|
1737
1744
|
- app/models/renalware/zip_archive.rb
|
1738
1745
|
- app/policies/application_policy.rb
|
1739
1746
|
- app/policies/renalware/admin/cache_policy.rb
|
@@ -1794,6 +1801,7 @@ files:
|
|
1794
1801
|
- app/policies/renalware/transplants/registration_policy.rb
|
1795
1802
|
- app/policies/renalware/user_policy.rb
|
1796
1803
|
- app/policies/renalware/virology/dasboard_policy.rb
|
1804
|
+
- app/policies/renalware/virology/profile_policy.rb
|
1797
1805
|
- app/policies/renalware/virology/vaccination_policy.rb
|
1798
1806
|
- app/policies/renalware/yaml_permission_configuration.rb
|
1799
1807
|
- app/presenters/date_presenter.rb
|
@@ -2167,6 +2175,7 @@ files:
|
|
2167
2175
|
- app/views/renalware/hd/protocols/_prescriptions.html.slim
|
2168
2176
|
- app/views/renalware/hd/protocols/_profile.html.slim
|
2169
2177
|
- app/views/renalware/hd/protocols/_recent_pathology.html.slim
|
2178
|
+
- app/views/renalware/hd/protocols/_virology.html.slim
|
2170
2179
|
- app/views/renalware/hd/protocols/show.pdf.slim
|
2171
2180
|
- app/views/renalware/hd/sessions/_empty_row.html.slim
|
2172
2181
|
- app/views/renalware/hd/sessions/_form.html.slim
|
@@ -2587,6 +2596,8 @@ files:
|
|
2587
2596
|
- app/views/renalware/shared/documents/_blood_group_input.html.slim
|
2588
2597
|
- app/views/renalware/shared/documents/_blood_pressure.html.slim
|
2589
2598
|
- app/views/renalware/shared/documents/_blood_pressure_input.html.slim
|
2599
|
+
- app/views/renalware/shared/documents/_dated_boolean_diagnosis.html.slim
|
2600
|
+
- app/views/renalware/shared/documents/_dated_boolean_diagnosis_input.html.slim
|
2590
2601
|
- app/views/renalware/shared/documents/_dated_confirmation.html.slim
|
2591
2602
|
- app/views/renalware/shared/documents/_dated_confirmation_input.html.slim
|
2592
2603
|
- app/views/renalware/shared/documents/_dated_integer.html.slim
|
@@ -2605,6 +2616,7 @@ files:
|
|
2605
2616
|
- app/views/renalware/shared/documents/_smoking_status_input.html.slim
|
2606
2617
|
- app/views/renalware/shared/documents/_year_dated_confirmation.html.slim
|
2607
2618
|
- app/views/renalware/shared/documents/_year_dated_confirmation_input.html.slim
|
2619
|
+
- app/views/renalware/shared/documents/_year_dated_diagnosis_input.html.slim
|
2608
2620
|
- app/views/renalware/snippets/snippet_invocations/create.js.erb
|
2609
2621
|
- app/views/renalware/snippets/snippets/_form.html.slim
|
2610
2622
|
- app/views/renalware/snippets/snippets/_list.html.slim
|
@@ -2694,6 +2706,8 @@ files:
|
|
2694
2706
|
- app/views/renalware/transplants/wait_lists/show.html.slim
|
2695
2707
|
- app/views/renalware/virology/dashboards/_actions.html.slim
|
2696
2708
|
- app/views/renalware/virology/dashboards/show.html.slim
|
2709
|
+
- app/views/renalware/virology/profiles/_summary.html.slim
|
2710
|
+
- app/views/renalware/virology/profiles/edit.html.slim
|
2697
2711
|
- app/views/renalware/virology/vaccinations/_cell.html.slim
|
2698
2712
|
- app/views/renalware/virology/vaccinations/_inputs.html.slim
|
2699
2713
|
- app/views/renalware/virology/vaccinations/_list.html.slim
|
@@ -3216,6 +3230,8 @@ files:
|
|
3216
3230
|
- db/migrate/20180419141524_add_cols_to_hd_patient_statistics.rb
|
3217
3231
|
- db/migrate/20180422090043_update_hd_overall_audit_to_version_6.rb
|
3218
3232
|
- db/migrate/20180427133558_add_code_to_hospitals_wards.rb
|
3233
|
+
- db/migrate/20180502093256_add_document_to_virology_profiles.rb
|
3234
|
+
- db/migrate/20180502110638_create_virology_versions.rb
|
3219
3235
|
- db/seeds.rb
|
3220
3236
|
- db/seeds/default/accesses/access_pd_catheter_insertion_techniques.csv
|
3221
3237
|
- db/seeds/default/accesses/access_pd_catheter_insertion_techniques.rb
|
@@ -3518,6 +3534,7 @@ files:
|
|
3518
3534
|
- spec/factories/transplants/registration_status_descriptions.rb
|
3519
3535
|
- spec/factories/transplants/registration_statuses.rb
|
3520
3536
|
- spec/factories/transplants/registrations.rb
|
3537
|
+
- spec/factories/virology/patients.rb
|
3521
3538
|
- spec/factories/virology/vaccinations.rb
|
3522
3539
|
- spec/support/capybara.rb
|
3523
3540
|
- spec/support/capybara_helper.rb
|