renalware-core 2.0.64 → 2.0.67
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/renalware/application.js.erb +2 -2
- data/app/controllers/renalware/admin/users_controller.rb +1 -1
- data/app/controllers/renalware/api/ukrdc/patients_controller.rb +14 -67
- data/app/controllers/renalware/drugs/drugs_controller.rb +1 -1
- data/app/controllers/renalware/hd/protocols_controller.rb +1 -1
- data/app/controllers/renalware/patients/bookmarks_controller.rb +16 -5
- data/app/controllers/renalware/snippets/snippets_controller.rb +1 -1
- data/app/controllers/renalware/system/user_feedback_controller.rb +1 -1
- data/app/documents/renalware/hd/session_document.rb +1 -0
- data/app/models/renalware/admissions/consult_query.rb +1 -1
- data/app/models/renalware/clinical/dry_weight.rb +4 -0
- data/app/models/renalware/clinical/patient.rb +5 -0
- data/app/models/renalware/clinical/patient_dry_weights_query.rb +1 -1
- data/app/models/renalware/directory/person_query.rb +1 -1
- data/app/models/renalware/hd/mdm_patients_query.rb +1 -1
- data/app/models/renalware/hd/patient.rb +6 -0
- data/app/models/renalware/hd/patient_listener.rb +8 -0
- data/app/models/renalware/hd/sessions/ongoing_query.rb +1 -1
- data/app/models/renalware/hd/sessions/patient_query.rb +1 -1
- data/app/models/renalware/letters/descriptions/search_query.rb +1 -1
- data/app/models/renalware/letters/letter_factory.rb +55 -2
- data/app/models/renalware/letters/letter_query.rb +1 -1
- data/app/models/renalware/letters/recipient.rb +11 -0
- data/app/models/renalware/letters/resolve_default_electronic_ccs.rb +47 -0
- data/app/models/renalware/low_clearance/mdm_patients_query.rb +1 -1
- data/app/models/renalware/medications/prescriptions_by_drug_type_query.rb +1 -1
- data/app/models/renalware/medications/prescriptions_query.rb +1 -1
- data/app/models/renalware/patients/bookmarks_query.rb +49 -0
- data/app/models/renalware/patients/patient_search.rb +1 -1
- data/app/models/renalware/pd/mdm_patients_query.rb +1 -1
- data/app/models/renalware/renal/prd_descriptions/search_query.rb +1 -1
- data/app/models/renalware/transplants/live_donors_query.rb +1 -1
- data/app/models/renalware/transplants/mdm_patients_query.rb +1 -1
- data/app/models/renalware/transplants/registrations/wait_list_query.rb +1 -1
- data/app/models/renalware/ukrdc/create_encrypted_patient_xml_files.rb +13 -11
- data/app/models/renalware/ukrdc/create_patient_xml_file.rb +33 -21
- data/app/models/renalware/ukrdc/transmission_log.rb +1 -1
- data/app/models/renalware/ukrdc/xml_renderer.rb +126 -0
- data/app/presenters/renalware/clinical/dry_weight_presenter.rb +4 -0
- data/app/presenters/renalware/clinical/dry_weights_presenter.rb +15 -9
- data/app/presenters/renalware/ukrdc/modality_presenter.rb +8 -0
- data/app/presenters/renalware/ukrdc/patient_presenter.rb +9 -6
- data/app/views/renalware/api/ukrdc/patients/_clinical_relationships.xml.builder +4 -4
- data/app/views/renalware/api/ukrdc/patients/_encounters.xml.builder +9 -9
- data/app/views/renalware/api/ukrdc/patients/_family_histories.xml.builder +4 -4
- data/app/views/renalware/api/ukrdc/patients/_patient.xml.builder +1 -20
- data/app/views/renalware/api/ukrdc/patients/_program_memberships.xml.builder +4 -4
- data/app/views/renalware/api/ukrdc/patients/_surveys.xml.builder +4 -4
- data/app/views/renalware/api/ukrdc/patients/encounters/_hd_session.xml.builder +31 -31
- data/app/views/renalware/api/ukrdc/patients/encounters/_treatment.xml.builder +34 -0
- data/app/views/renalware/api/ukrdc/patients/lab_orders/_lab_order.xml.builder +1 -1
- data/app/views/renalware/api/ukrdc/patients/show.xml.builder +1 -1
- data/app/views/renalware/hd/mdm/_summary.html.slim +12 -4
- data/app/views/renalware/hd/protocols/_recent_pathology.html.slim +4 -0
- data/app/views/renalware/hd/sessions/_form.html.slim +1 -0
- data/app/views/renalware/mdm/_prescription_buttons.html.slim +15 -0
- data/app/views/renalware/mdm/_prescriptions.html.slim +1 -8
- data/app/views/renalware/patients/bookmarks/_bookmark.html.slim +16 -0
- data/app/views/renalware/patients/bookmarks/_table.html.slim +20 -0
- data/app/views/renalware/patients/bookmarks/index.html.slim +3 -1
- data/app/views/renalware/transplants/mdm/_prescriptions.html.slim +1 -8
- data/config/initializers/core_extensions.rb +1 -1
- data/config/initializers/renalware.rb +3 -0
- data/config/locales/renalware/hd/session.en.yml +7 -0
- data/config/locales/renalware/patients/bookmarks.en.yml +12 -0
- data/config/locales/renalware/patients/side_menu.en.yml +1 -1
- data/db/migrate/20150119160039_create_versions.rb +3 -3
- data/db/migrate/20150120155952_create_problem_versions.rb +3 -3
- data/db/migrate/20150203161438_create_medication_prescription_versions.rb +3 -3
- data/db/migrate/20150515155052_users_have_and_belong_to_many_roles.rb +3 -1
- data/db/migrate/20160120203747_create_access_versions.rb +3 -3
- data/db/migrate/20160121175711_create_hd_versions.rb +3 -3
- data/db/migrate/20170217141529_create_clinic_versions.rb +3 -3
- data/db/migrate/20170217161409_create_patient_versions.rb +3 -3
- data/db/migrate/20170605102519_create_clinical_versions.rb +3 -3
- data/db/migrate/20171002175804_add_rr_columns_to_transplant_registration_status_descriptions.rb +9 -7
- data/db/migrate/20171003093347_create_hospital_wards.rb +14 -12
- data/db/migrate/20171003111228_create_aki_alert_actions.rb +6 -4
- data/db/migrate/20171003122425_create_renal_aki_alerts.rb +18 -16
- data/db/migrate/20171004092235_create_hd_dialysates.rb +9 -7
- data/db/migrate/20171004110909_add_dialysate_id_to_profile_and_session.rb +6 -4
- data/db/migrate/20171005081224_create_reporting_bone_audit.rb +3 -1
- data/db/migrate/20171005091202_reporting_audit_changes.rb +5 -3
- data/db/migrate/20171005130109_create_medication_current_prescriptions.rb +3 -1
- data/db/migrate/20171005144505_create_reporting_anaemia_audit.rb +3 -1
- data/db/migrate/20171009104106_add_legacy_patient_id_to_patients.rb +4 -2
- data/db/migrate/20171009181615_add_columns_to_drug_drugs.rb +6 -4
- data/db/migrate/20171012110133_create_research_studies.rb +19 -17
- data/db/migrate/20171012143050_create_research_study_participants.rb +27 -25
- data/db/migrate/20171013145849_set_patients_secure_id.rb +12 -10
- data/db/migrate/20171016152223_add_index_to_diary_slots.rb +14 -12
- data/db/migrate/20171017132738_add_unique_indexes_to_local_patient_ids.rb +11 -9
- data/db/migrate/20171017171625_update_hd_overall_audit_view.rb +7 -5
- data/db/migrate/20171101121130_create_function_to_render_audit_view_as_json.rb +6 -4
- data/db/migrate/20171101162244_create_consults.rb +21 -19
- data/db/migrate/20171106100216_create_pd_audit_view.rb +3 -1
- data/db/migrate/20171109084751_remove_local_patient_id_unique_idx.rb +11 -9
- data/db/migrate/20171113120217_add_uuid_to_hd_sessions.rb +4 -2
- data/db/migrate/20171114120904_add_pathology_snapshot_to_letters.rb +3 -1
- data/db/migrate/20171118160030_add_tags_to_patient_bookmarks.rb +3 -1
- data/db/migrate/20171123123712_add_id_to_roles_users.rb +3 -1
- data/db/migrate/20171123143534_add_pk_to_drug_types_drugs.rb +13 -12
- data/db/migrate/20171123154116_create_renal_versions.rb +11 -9
- data/db/migrate/20171127082158_add_region_to_addresses.rb +3 -1
- data/db/migrate/20171127092158_create_function_to_import_practices.rb +6 -2
- data/db/migrate/20171127092359_create_fn_to_insert_gps.rb +6 -2
- data/db/migrate/20171128163543_add_more_missing_indexes.rb +14 -12
- data/db/migrate/20171204112150_create_consult_sites.rb +13 -9
- data/db/migrate/20171206121652_add_loinc_code_to_observation_descriptions.rb +3 -1
- data/db/migrate/20171206140738_create_fn_to_load_practice_memberships_csv.rb +9 -5
- data/db/migrate/20171208211206_create_user_feedback.rb +7 -5
- data/db/migrate/20171211130716_remove_unused_patients_cols.rb +4 -2
- data/db/migrate/20171211131918_remove_email_from_primary_care_physicians.rb +5 -3
- data/db/migrate/20171211161400_create_pathology_current_table.rb +9 -7
- data/db/migrate/20171213111513_create_fn_to_refresh_current_obs.rb +6 -2
- data/db/migrate/20171214141335_create_trigger_to_update_current_observation_sets.rb +10 -6
- data/db/migrate/20171214190849_enforce_request_id_on_observations.rb +3 -1
- data/db/migrate/20171215122454_add_pathology_observation_set_to_letters.rb +8 -6
- data/db/migrate/20171219154529_create_admission_admissions.rb +25 -23
- data/db/migrate/20180102155055_update_patient_summaries_to_version_5.rb +3 -1
- data/db/migrate/20180105132358_add_emailed_at_to_letter_recipients.rb +4 -2
- data/db/migrate/20180108185400_remove_null_constraint_from_letters_pathology_snapshot.rb +3 -1
- data/db/migrate/20180112151706_create_low_clearance_profiles.rb +43 -41
- data/db/migrate/20180112151813_create_low_clearance_versions.rb +11 -9
- data/db/migrate/20180119121243_create_trigger_to_preprocess_hl7_msg.rb +10 -6
- data/db/migrate/20180121115246_add_include_pathology_in_letter_to_letters_letterheads.rb +3 -1
- data/db/migrate/20180122173922_create_virology_profiles.rb +5 -1
- data/db/migrate/20180125201356_make_obs_set_trigger_change_updated_at.rb +6 -2
- data/db/migrate/20180126142314_add_uuid_to_letters.rb +4 -2
- data/db/migrate/20180130165803_add_deleted_at_indexes.rb +14 -12
- data/db/migrate/20180201090444_add_created_at_to_delayed_jobs_in_hl7_trig_fn.rb +6 -2
- data/db/migrate/20180202184954_create_view_pathology_observation_digests.rb +3 -1
- data/db/migrate/20180206225525_update_fn_update_current_observation_set_from_trigger.rb +6 -2
- data/db/migrate/20180207082540_create_count_estimate_function.rb +6 -2
- data/db/migrate/20180208150629_add_authentication_token_to_users.rb +3 -1
- data/db/migrate/20180213124203_add_cancelled_to_pathology_observations.rb +7 -5
- data/db/migrate/20180213125734_update_fn_update_current_obs_set_trgger.rb +6 -2
- data/db/migrate/20180213171805_add_display_order_cols_to_observation_descriptions.rb +10 -8
- data/db/migrate/20180214124317_add_cols_to_aki_alerts.rb +7 -5
- data/db/migrate/20180216132741_disable_some_audits.rb +6 -4
- data/db/migrate/20180221210458_add_state_index_on_modalities.rb +3 -1
- data/db/migrate/20180222090501_add_partial_index_to_bookmarks.rb +4 -2
- data/db/migrate/20180223100420_add_sent_to_ukrdc_at_to_patients.rb +3 -1
- data/db/migrate/20180226124724_add_patient_id_to_virology_profile.rb +9 -5
- data/db/migrate/20180226132410_create_ukrdc_transmission_logs.rb +12 -10
- data/db/migrate/20180301095040_update_fn_to_upsert_gp_practive_memberships.rb +7 -3
- data/db/migrate/20180305134959_add_display_group_to_observation_desriptions.rb +23 -22
- data/db/migrate/20180306071308_remove_rogue_aki_alerts_column.rb +3 -1
- data/db/migrate/20180306080518_add_state_tracking_cols_to_letters.rb +17 -15
- data/db/migrate/20180307191650_add_dwell_time_to_pd_regime.rb +3 -1
- data/db/migrate/20180307223111_create_system_visits_and_events.rb +42 -39
- data/db/migrate/20180309140316_add_unique_constraint_to_obr_requestor.rb +3 -1
- data/db/migrate/20180311104609_remove_unique_obr_requestor_order_number_index.rb +4 -2
- data/db/migrate/20180313114927_remove_deleted_at_from_admission_consults.rb +3 -1
- data/db/migrate/20180313124819_remove_tx_operation_constraints.rb +7 -5
- data/db/migrate/20180319191942_create_function_to_sort_without_failing_on_nonnumerics.rb +6 -2
- data/db/migrate/20180323150241_update_path_obs_descs_for_letter_groupings.rb +25 -23
- data/db/migrate/20180326155400_add_admin_notes_to_system_user_feedback.rb +4 -2
- data/db/migrate/20180327100423_add_constraints_to_recipient_operations.rb +3 -1
- data/db/migrate/20180328210434_add_rrt_to_admission_consults.rb +3 -1
- data/db/migrate/20180419141524_add_cols_to_hd_patient_statistics.rb +8 -6
- data/db/migrate/20180422090043_update_hd_overall_audit_to_version_6.rb +85 -84
- data/db/migrate/20180427133558_add_code_to_hospitals_wards.rb +3 -1
- data/db/migrate/20180502093256_add_document_to_virology_profiles.rb +22 -21
- data/db/migrate/20180502110638_create_virology_versions.rb +7 -5
- data/db/migrate/20180510151959_update_hd_overall_audit_to_version_7.rb +8 -4
- data/db/migrate/20180511100345_add_notes_to_transplant_registration_statuses.rb +3 -1
- data/db/migrate/20180511140415_add_message_hash_messaging_messages.rb +4 -2
- data/db/migrate/20180511171835_create_unique_indexes_on_obr_obr_codes.rb +5 -3
- data/db/migrate/20180514151627_create_system_messages.rb +10 -8
- data/db/migrate/20180516111411_create_view_patient_current_modalities.rb +3 -1
- data/db/migrate/20180524072633_add_columns_to_dialysates.rb +10 -8
- data/db/migrate/20180524074320_add_columns_to_hd_dialysers.rb +8 -6
- data/db/migrate/20180605114332_create_pseudo_encrypt_function.rb +6 -2
- data/db/migrate/20180605141806_add_external_id_to_research_study_participants.rb +33 -31
- data/db/migrate/20180605175211_add_application_url_to_research_studies.rb +3 -1
- data/db/migrate/20180622130552_add_external_id_to_hd_sessions.rb +4 -2
- data/db/migrate/20180625124431_add_patient_identifier_to_feed_messages.rb +3 -1
- data/db/migrate/20180628132323_add_letter_date_indexes.rb +9 -7
- data/db/migrate/20180702091222_create_hd_providers.rb +5 -3
- data/db/migrate/20180702091237_create_hd_provider_units.rb +8 -6
- data/db/migrate/20180702091352_create_hd_transmission_log.rb +15 -13
- data/db/migrate/20180712143314_add_hidden_to_modality_descriptions.rb +3 -1
- data/db/migrate/20180718172750_update_audit_letters_authors_to_version_3.rb +13 -11
- data/db/migrate/20180725132557_add_days_text_to_hd_schedule_definitions.rb +21 -19
- data/db/migrate/20180725132808_create_hd_schedule_definition_filters_view.rb +3 -1
- data/db/migrate/20180730154454_add_external_session_id_to_hd_transmission_logs.rb +7 -5
- data/db/migrate/20180802103013_add_hd_mdm_missing_indexes.rb +6 -4
- data/db/migrate/20180802132417_add_missing_indexes_2.rb +16 -14
- data/db/migrate/20180802144507_add_missing_foreign_key_indexes.rb +14 -12
- data/db/migrate/20180803131157_add_uuid_to_hd_transmission_logs.rb +7 -1
- data/db/migrate/20180814103916_create_index_on_lower_patient_family_name.rb +5 -3
- data/db/migrate/20180815144429_update_hd_overall_audit_to_version_8.rb +8 -4
- data/db/migrate/20180831134926_create_daily_reports.rb +3 -6
- data/db/migrate/20180907100545_add_page_count_to_letters.rb +3 -1
- data/db/migrate/20181001162513_add_active_to_hospital_wards.rb +3 -1
- data/db/migrate/20181008144324_update_daily_letters_report_view_to_version_2.rb +0 -2
- data/db/migrate/20181008145159_create_reporting_daily_ukrdc_view.rb +0 -4
- data/db/migrate/20181013115138_update_reporting_daily_pathology_view_to_v2.rb +0 -2
- data/db/migrate/20181025170410_add_ukrdc_helper_column_to_patients.rb +0 -2
- data/db/migrate/20181026145459_create_ukrdc_batch_numbers.rb +5 -3
- data/db/migrate/20181106133500_update_hd_overall_audit_to_version_9.rb +0 -2
- data/db/migrate/20181109110616_create_hd_grouped_transmission_logs_view.rb +0 -2
- data/db/migrate/20181126090401_add_warnings_to_hd_transmission_logs.rb +7 -0
- data/db/migrate/20181126123745_refresh_hd_grouped_transmission_logs_view.rb +8 -0
- data/db/migrate/20181217124025_change_ukrdc_transmission_log_error_type.rb +15 -0
- data/db/seeds/default/practices/nhs_practices_sample.csv +2 -2
- data/db/seeds/default/practices/primary_care_physicians_sample.csv +2 -2
- data/lib/core_extensions/active_record/migration_helpers.rb +43 -1
- data/lib/renalware/engine.rb +2 -0
- data/lib/renalware/version.rb +1 -1
- metadata +55 -19
- data/lib/migration_helper.rb +0 -11
- data/vendor/assets/javascripts/renalware/moment.min.js +0 -1
- data/vendor/assets/javascripts/renalware/mousetrap.js +0 -1044
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf634cea697775671cc9b95511d93c3927bfaef385d14257daffa16ca86086bb
|
4
|
+
data.tar.gz: da6403cbe24ea79e5690cb0e767bf83fd3931495950ad2135ffc9b08cad32ce6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2d4668c9ce60c07e2d66bd2676270342c087292d32737a03a4a5db0f953b6f3339573f1815ba4e0efc939979c67b2de3e5f0192f5d3a4fd7250b9de10b95580
|
7
|
+
data.tar.gz: 51c70c6a5b0d163669a13f5c3674afabb6dbdfd22093951521210b80d42d860c248a438c13c994b1f4a4cb103ea3969e1d856fd79c5631fb6f73557bb763b160
|
@@ -37,7 +37,7 @@
|
|
37
37
|
//= require foundation-datepicker
|
38
38
|
//= require renalware/clockpicker
|
39
39
|
//= require cocoon
|
40
|
-
//= require
|
40
|
+
//= require mousetrap
|
41
41
|
//= require renalware/iframeResizer
|
42
42
|
//= require chosen-jquery
|
43
43
|
//= require clipboard
|
@@ -45,7 +45,7 @@
|
|
45
45
|
//= require rails.validations
|
46
46
|
//= require rails.validations.simple_form
|
47
47
|
//= require renalware/print.min
|
48
|
-
//= require
|
48
|
+
//= require moment
|
49
49
|
//= require_tree .
|
50
50
|
//
|
51
51
|
|
@@ -10,7 +10,7 @@ module Renalware
|
|
10
10
|
search = User
|
11
11
|
.includes(:roles)
|
12
12
|
.where.not(username: :systemuser)
|
13
|
-
.
|
13
|
+
.ransack(query)
|
14
14
|
users = search.result(distinct: true).page(page).per(per_page)
|
15
15
|
authorize users
|
16
16
|
render locals: { users: users, user_search: search }
|
@@ -10,16 +10,25 @@ module Renalware
|
|
10
10
|
|
11
11
|
def show
|
12
12
|
respond_to do |format|
|
13
|
-
format.xml
|
14
|
-
render locals: {
|
15
|
-
patient: patient_presenter
|
16
|
-
}
|
17
|
-
end
|
13
|
+
format.xml { render xml: patient_ukrdc_xml }
|
18
14
|
end
|
19
15
|
end
|
20
16
|
|
21
17
|
private
|
22
18
|
|
19
|
+
def patient_ukrdc_xml
|
20
|
+
result = attempt_to_generate_patient_ukrdc_xml
|
21
|
+
if result.failure?
|
22
|
+
result.validation_errors.to_xml
|
23
|
+
else
|
24
|
+
result.xml
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def attempt_to_generate_patient_ukrdc_xml
|
29
|
+
Renalware::UKRDC::XmlRenderer.new(locals: { patient: patient_presenter }).call
|
30
|
+
end
|
31
|
+
|
23
32
|
def patient_presenter
|
24
33
|
patient = Renalware::Patient.find_by!(secure_id: params[:id])
|
25
34
|
authorize patient
|
@@ -30,65 +39,3 @@ module Renalware
|
|
30
39
|
end
|
31
40
|
end
|
32
41
|
end
|
33
|
-
|
34
|
-
# An alternative xml rendering implementation - moved to a template based approach
|
35
|
-
# for now as its provides clarity
|
36
|
-
#
|
37
|
-
|
38
|
-
# class Base
|
39
|
-
# include ActiveModel::Serializers::Xml
|
40
|
-
# include Virtus::Model
|
41
|
-
# end
|
42
|
-
|
43
|
-
# class PatientNumber < Base
|
44
|
-
# attribute :number, String
|
45
|
-
# attribute :organisation, String
|
46
|
-
|
47
|
-
# def self.build_nhs_number(number)
|
48
|
-
# new(number: number, organisation: "NHS")
|
49
|
-
# end
|
50
|
-
# end
|
51
|
-
|
52
|
-
# class Name < Base
|
53
|
-
# attribute :prefix, String
|
54
|
-
# attribute :family, String
|
55
|
-
# attribute :given, String
|
56
|
-
# attribute :suffix, String
|
57
|
-
# attribute :use, String
|
58
|
-
# end
|
59
|
-
|
60
|
-
# class Patient < Base
|
61
|
-
# attribute :gender, String # 0=Not Known 1=Male 2=Female 9=Not Specified.
|
62
|
-
# attribute :birth_time, DateTime
|
63
|
-
# attribute :death_time, DateTime
|
64
|
-
# attribute :patient_numbers, Array(PatientNumber)
|
65
|
-
# attribute :name, Name
|
66
|
-
# attribute :country_of_birth, String # ISO 3166-1 3-char alphabetic code
|
67
|
-
# end
|
68
|
-
|
69
|
-
# rdc_patient = UKRDC::Patient.new(
|
70
|
-
# gender: patient.sex&.code,
|
71
|
-
# birth_time: patient.born_on,
|
72
|
-
# death_time: patient.died_on,
|
73
|
-
# country_of_birth: "???"
|
74
|
-
# )
|
75
|
-
|
76
|
-
# rdc_patient.name = Name.new(
|
77
|
-
# prefix: patient.title,
|
78
|
-
# family: patient.family_name,
|
79
|
-
# given: patient.given_name,
|
80
|
-
# suffix: patient.suffix
|
81
|
-
# )
|
82
|
-
|
83
|
-
# rdc_patient.patient_numbers << UKRDC::PatientNumber.build_nhs_number(patient.nhs_number)
|
84
|
-
# Renalware.config.patient_hospital_identifiers.each do |_key, field|
|
85
|
-
# number = patient.public_send(field)
|
86
|
-
# unless number.blank?
|
87
|
-
# patient_number = UKRDC::PatientNumber.new(number: number, organisation: "LOCALHOSP")
|
88
|
-
# rdc_patient.patient_numbers << patient_number
|
89
|
-
# end
|
90
|
-
# end
|
91
|
-
|
92
|
-
# # Render XML
|
93
|
-
# respond_with rdc_patient, camelize: true
|
94
|
-
#
|
@@ -3,16 +3,19 @@
|
|
3
3
|
module Renalware
|
4
4
|
module Patients
|
5
5
|
class BookmarksController < BaseController
|
6
|
+
include Concerns::Pageable
|
6
7
|
before_action :load_patient, only: :create
|
7
8
|
|
8
9
|
# Display the user's bookmarks
|
9
10
|
def index
|
10
|
-
|
11
|
-
.bookmarks
|
12
|
-
|
13
|
-
|
11
|
+
search = BookmarksQuery.new(
|
12
|
+
default_relation: Patients.cast_user(current_user).bookmarks,
|
13
|
+
params: params[:q]
|
14
|
+
).search
|
15
|
+
|
16
|
+
bookmarks = search.result.page(page).per(per_page)
|
14
17
|
authorize bookmarks
|
15
|
-
render locals: { bookmarks: bookmarks }
|
18
|
+
render locals: { bookmarks: bookmarks, search: search }
|
16
19
|
end
|
17
20
|
|
18
21
|
# idempotent
|
@@ -25,6 +28,7 @@ module Renalware
|
|
25
28
|
end
|
26
29
|
|
27
30
|
# idempotent
|
31
|
+
# rubocop:disable Metrics/AbcSize
|
28
32
|
def destroy
|
29
33
|
bookmark = user.bookmarks.find_by(id: params[:id])
|
30
34
|
patient = bookmark&.patient
|
@@ -38,6 +42,7 @@ module Renalware
|
|
38
42
|
redirect_back(fallback_location: patient_path(fallback_location),
|
39
43
|
notice: success_msg_for("bookmark"))
|
40
44
|
end
|
45
|
+
# rubocop:enable Metrics/AbcSize
|
41
46
|
|
42
47
|
private
|
43
48
|
|
@@ -48,6 +53,12 @@ module Renalware
|
|
48
53
|
def bookmark_params
|
49
54
|
params.require(:patients_bookmark).permit(:notes, :urgent, :tags)
|
50
55
|
end
|
56
|
+
|
57
|
+
def search_params
|
58
|
+
hash = params[:q] || {}
|
59
|
+
hash[:s] ||= "created_at desc"
|
60
|
+
hash
|
61
|
+
end
|
51
62
|
end
|
52
63
|
end
|
53
64
|
end
|
@@ -8,7 +8,7 @@ module Renalware
|
|
8
8
|
def index
|
9
9
|
authorize Snippet, :index?
|
10
10
|
snippets = snippets_for_author(author)
|
11
|
-
search = snippets.
|
11
|
+
search = snippets.ransack(params[:q])
|
12
12
|
search.sorts = ["times_used desc", "last_used_on desc"] if search.sorts.empty?
|
13
13
|
snippets = paginate(search.result, default_per_page: 10)
|
14
14
|
render locals: { snippets: snippets, search: search, author: author }
|
@@ -101,6 +101,7 @@ module Renalware
|
|
101
101
|
|
102
102
|
class Complications < Document::Embedded
|
103
103
|
attribute :access_site_status, Document::Enum
|
104
|
+
attribute :line_exit_site_status, Document::Enum
|
104
105
|
attribute :was_dressing_changed, Document::Enum, enums: %i(yes no), default: :no
|
105
106
|
attribute :had_mrsa_swab, Document::Enum, enums: %i(yes no), default: :no
|
106
107
|
attribute :had_mssa_swab, Document::Enum, enums: %i(yes no), default: :no
|
@@ -21,7 +21,7 @@ module Renalware
|
|
21
21
|
# It might be better to refactor PatientsRansackHelper so we can include where required
|
22
22
|
# eg below using .extending(PatientsRansackHelper) rather than relying on it being in
|
23
23
|
# included in the model file.
|
24
|
-
# note that adding .includes(:created_by)
|
24
|
+
# note that adding .includes(:created_by) here creates an ambigous column
|
25
25
|
# 'family_name' error
|
26
26
|
# rubocop:disable Metrics/MethodLength
|
27
27
|
def search
|
@@ -6,6 +6,7 @@ module Renalware
|
|
6
6
|
module Clinical
|
7
7
|
class Patient < ActiveType::Record[Renalware::Patient]
|
8
8
|
has_many :allergies, dependent: :restrict_with_exception
|
9
|
+
has_many :dry_weights, dependent: :restrict_with_exception
|
9
10
|
|
10
11
|
# These statuses match NHS standards for the display of recorded allergy status.
|
11
12
|
# Note that
|
@@ -18,6 +19,10 @@ module Renalware
|
|
18
19
|
no_known_allergies
|
19
20
|
unavailable),
|
20
21
|
default: "unrecorded"
|
22
|
+
|
23
|
+
def latest_dry_weight
|
24
|
+
@latest_dry_weight ||= dry_weights.latest
|
25
|
+
end
|
21
26
|
end
|
22
27
|
end
|
23
28
|
end
|
@@ -26,6 +26,12 @@ module Renalware
|
|
26
26
|
modality_descriptions.exists?(type: "Renalware::HD::ModalityDescription")
|
27
27
|
end
|
28
28
|
|
29
|
+
def current_modality_hd?
|
30
|
+
return false if current_modality.blank?
|
31
|
+
|
32
|
+
current_modality.description.is_a?(HD::ModalityDescription)
|
33
|
+
end
|
34
|
+
|
29
35
|
def __getobj__
|
30
36
|
self
|
31
37
|
end
|
@@ -7,6 +7,14 @@ module Renalware
|
|
7
7
|
nullify_significant_hd_profile_attributes(patient, by: actor)
|
8
8
|
end
|
9
9
|
|
10
|
+
def request_default_electronic_cc_recipients_for_use_in_letters(patient:, array_of_user_ids:)
|
11
|
+
patient = HD.cast_patient(patient)
|
12
|
+
if patient.current_modality_hd?
|
13
|
+
named_nurse_id = patient.hd_profile&.named_nurse&.id
|
14
|
+
array_of_user_ids.push(named_nurse_id) if named_nurse_id.present?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
10
18
|
private
|
11
19
|
|
12
20
|
def nullify_significant_hd_profile_attributes(patient, by:)
|
@@ -5,11 +5,13 @@ require_dependency "renalware/letters"
|
|
5
5
|
module Renalware
|
6
6
|
module Letters
|
7
7
|
# Build a new draft letter.
|
8
|
-
# Used e.g from
|
8
|
+
# Used e.g from:
|
9
9
|
# - LettersController#new - when building the initial letter form
|
10
10
|
# (in which case params are those suppplied in #new)
|
11
11
|
# - LettersController#create via DraftLetter.build - before saving the letter, in which case
|
12
12
|
# params is the posted hash of letter attributes from the html form.
|
13
|
+
# TODO: think about spitting this into 2 classes, one for build (new/get) and one for creating
|
14
|
+
# (create/post)?
|
13
15
|
class LetterFactory
|
14
16
|
def initialize(patient, params = {})
|
15
17
|
@params = LetterParamsProcessor.new(patient).call(params)
|
@@ -18,13 +20,19 @@ module Renalware
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def build
|
21
|
-
|
23
|
+
# *Important this line is here and not in initialize. If moved to initialize we will get
|
24
|
+
# two copies of eCCs because of the way .with_contacts_as_default_ccs can be called
|
25
|
+
# before .build
|
26
|
+
@electronic_cc_recipient_ids = params.delete(:electronic_cc_recipient_ids) # see *
|
27
|
+
|
22
28
|
@letter = build_letter
|
23
29
|
build_electronic_ccs
|
24
30
|
include_primary_care_physician_as_default_main_recipient
|
25
31
|
assign_default_ccs
|
26
32
|
build_salutation
|
27
33
|
letter.pathology_timestamp = Time.zone.now
|
34
|
+
stub_letter_electronic_cc_recipient_ids_using_patients_default_eccs
|
35
|
+
|
28
36
|
letter
|
29
37
|
end
|
30
38
|
|
@@ -81,6 +89,51 @@ module Renalware
|
|
81
89
|
end
|
82
90
|
end
|
83
91
|
|
92
|
+
# Here we are doing thwo things:
|
93
|
+
#
|
94
|
+
# 1 We overwrite the ActiveRecord-generated 'electronic_cc_recipient_ids' property that would,
|
95
|
+
# if any electronic_cc_recipients where saved against the letter, return the ids of those
|
96
|
+
# recipients. This property is used in the letter form when displaying the selected eCC
|
97
|
+
# users in a multi-select list. It works as expected when editing
|
98
|
+
# letters that have a saved set of eCC recipients. But for the case when we are creating a
|
99
|
+
# new letter, where there are no saved eCC recipients BUT we want to *pre-select* zero or
|
100
|
+
# more default eCCs, ovewriting this property lets us spoof what AR would have done but
|
101
|
+
# instead of returning user ids resolved through the AR relationship (which would require
|
102
|
+
# those records to be saved) we return our own array. More on this next...
|
103
|
+
#
|
104
|
+
# 2 Inside our replacement #electronic_cc_recipient_ids property we resolve (collate, gather)
|
105
|
+
# the complete set of default eCC users (as an array of user ids) and return them.
|
106
|
+
# This lets us pre-select the default eCCs in the eCC multi-select
|
107
|
+
# UI component in the new letter form. The array of user ids is resolved by raising an
|
108
|
+
# event and asking any listeners to addd in their eCC suggestions.
|
109
|
+
# See ResolveDefaultElectronicCCs for details.
|
110
|
+
def stub_letter_electronic_cc_recipient_ids_using_patients_default_eccs
|
111
|
+
return unless building_new_letter?
|
112
|
+
|
113
|
+
letter.define_singleton_method(:electronic_cc_recipient_ids) do
|
114
|
+
ResolveDefaultElectronicCCs
|
115
|
+
.for(patient)
|
116
|
+
.broadcasting_to_configured_subscribers
|
117
|
+
.call
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
# We operate in two modes:
|
122
|
+
# 1. building a skeleton letter (with defaults) to display in new letter form
|
123
|
+
# 2. building the letter after an http post (ie in the controller create action in which case
|
124
|
+
# params will be fully populated.
|
125
|
+
# This helper method resolves which mode we are in.
|
126
|
+
# As letterhead_id is never passed when building a letter ready for display in the new form,
|
127
|
+
# we assume that if it is present it is because it is in the posted html form params ie
|
128
|
+
# we are going to go on and save the letter once built.
|
129
|
+
def building_letter_ready_to_save?
|
130
|
+
params.key?(:letterhead_id)
|
131
|
+
end
|
132
|
+
|
133
|
+
def building_new_letter?
|
134
|
+
!building_letter_ready_to_save?
|
135
|
+
end
|
136
|
+
|
84
137
|
def build_salutation
|
85
138
|
letter.salutation ||= begin
|
86
139
|
main_recipient = letter.main_recipient
|