renalware-core 2.0.113 → 2.0.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +0 -2
- data/app/assets/javascripts/renalware/application.js.erb +0 -1
- data/app/assets/javascripts/renalware/feed_only_inputs.js.erb +26 -0
- data/app/assets/javascripts/renalware/feeds.js +50 -0
- data/app/assets/javascripts/renalware/person_ajax_search.js +43 -0
- data/app/assets/stylesheets/renalware/application.scss +0 -1
- data/app/assets/stylesheets/renalware/modules/_admin.scss +7 -0
- data/app/assets/stylesheets/renalware/modules/_pathology.scss +1 -1
- data/app/assets/stylesheets/renalware/modules/_patients.scss +6 -0
- data/app/assets/stylesheets/renalware/modules/_snippets.scss +2 -2
- data/app/assets/stylesheets/renalware/partials/_forms.scss +5 -1
- data/app/assets/stylesheets/renalware/partials/_layout.scss +4 -0
- data/app/{views/renalware/patients/_side_menu.html.slim → components/renalware/patients/side_menu_component.html.slim} +0 -0
- data/app/components/renalware/patients/side_menu_component.rb +18 -0
- data/app/controllers/renalware/clinical/body_compositions_controller.rb +6 -0
- data/app/controllers/renalware/feeds/hl7_test_messages_controller.rb +60 -0
- data/app/controllers/renalware/hd/mdm_patients_controller.rb +16 -6
- data/app/controllers/renalware/hd/scheduling/diaries_controller.rb +91 -0
- data/app/controllers/renalware/hd/scheduling/diary_slots_controller.rb +169 -0
- data/app/controllers/renalware/hd/session_forms/batches_controller.rb +1 -1
- data/app/controllers/renalware/pathology/observation_requests_controller.rb +23 -4
- data/app/controllers/renalware/pathology/requests/requests_controller.rb +0 -4
- data/app/controllers/renalware/patients/abridgements_controller.rb +39 -0
- data/app/controllers/renalware/pd/regimes_controller.rb +26 -0
- data/app/controllers/renalware/problems/problems_controller.rb +2 -2
- data/app/helpers/renalware/application_helper.rb +9 -0
- data/app/helpers/renalware/article_helper.rb +18 -0
- data/app/helpers/renalware/form_helper.rb +3 -2
- data/app/helpers/renalware/users_helper.rb +5 -1
- data/app/javascript/controllers/clipboard_controller.js +16 -0
- data/app/javascript/packs/renalware_core.js +20 -0
- data/app/jobs/feed_job.rb +1 -3
- data/app/jobs/hl7_message_example.yml +2 -2
- data/app/models/renalware/feeds/files/practice_memberships/import_job.rb +3 -0
- data/app/models/renalware/feeds/files/primary_care_physicians/import_job.rb +2 -0
- data/app/models/renalware/feeds/hl7_message.rb +57 -6
- data/app/models/renalware/feeds/hl7_test_form.rb +10 -0
- data/app/models/renalware/feeds/hl7_test_message.rb +11 -0
- data/app/models/renalware/feeds/message_parser.rb +6 -2
- data/app/models/renalware/feeds/message_processor.rb +44 -32
- data/app/models/renalware/feeds/persist_message.rb +9 -3
- data/app/models/renalware/feeds.rb +2 -0
- data/app/models/renalware/hd/scheduling/archive_arguments.rb +19 -0
- data/app/models/renalware/hd/scheduling/diary.rb +54 -0
- data/app/models/renalware/hd/scheduling/diary_housekeeping_job.rb +84 -0
- data/app/models/renalware/hd/scheduling/diary_range.rb +69 -0
- data/app/models/renalware/hd/scheduling/diary_slot.rb +88 -0
- data/app/models/renalware/hd/scheduling/find_or_create_diary_by_week_query.rb +52 -0
- data/app/models/renalware/hd/scheduling/find_or_create_master_diary.rb +27 -0
- data/app/models/renalware/hd/scheduling/master_diary.rb +35 -0
- data/app/models/renalware/hd/scheduling/weekly_diary.rb +47 -0
- data/app/models/renalware/pathology/message_listener.rb +2 -2
- data/app/models/renalware/pathology/requests/global_rule/latest_crf_older_than_weeks.rb +38 -0
- data/app/models/renalware/pathology/requests/global_rule/patient_is_diabetic.rb +1 -1
- data/app/models/renalware/patient.rb +1 -1
- data/app/models/renalware/patients/abridgement.rb +18 -0
- data/app/models/renalware/patients/abridgement_search_form.rb +12 -0
- data/app/models/renalware/patients/ingestion/command.rb +25 -0
- data/app/models/renalware/patients/ingestion/command_factory.rb +135 -0
- data/app/models/renalware/patients/ingestion/commands/add_or_update_patient.rb +65 -0
- data/app/models/renalware/patients/ingestion/message_listener.rb +21 -0
- data/app/models/renalware/patients/ingestion/message_mapper.rb +26 -0
- data/app/models/renalware/patients/ingestion/message_mappers/patient.rb +73 -0
- data/app/models/renalware/patients/ingestion/update_master_patient_index.rb +60 -0
- data/app/models/renalware/patients/ingestion/update_master_patient_index_job.rb.dead +20 -0
- data/app/models/renalware/patients.rb +4 -3
- data/app/models/renalware/problems/problem.rb +6 -2
- data/app/models/renalware/ukrdc/incoming/paths.rb +6 -7
- data/app/policies/renalware/admin/devops_policy.rb +18 -0
- data/app/policies/renalware/hd/{diary_policy.rb → scheduling/diary_policy.rb} +3 -1
- data/app/presenters/renalware/clinical/profile_presenter.rb +2 -1
- data/app/presenters/renalware/directory/person_auto_complete_presenter.rb +1 -1
- data/app/presenters/renalware/hd/scheduling/diary_presenter.rb +84 -0
- data/app/presenters/renalware/hd/scheduling/diary_slot_presenter.rb +74 -0
- data/app/presenters/renalware/hd/scheduling/null_slot.rb +42 -0
- data/app/presenters/renalware/pd/dashboard_presenter.rb +3 -2
- data/app/views/renalware/accesses/procedures/_form.html.slim +5 -1
- data/app/views/renalware/accesses/procedures/_list.html.slim +11 -4
- data/app/views/renalware/accesses/procedures/show.html.slim +17 -19
- data/app/views/renalware/addresses/_form.html.slim +17 -12
- data/app/views/renalware/admin/cache/show.html.slim +24 -0
- data/app/views/renalware/clinical/body_compositions/_list.html.slim +7 -43
- data/app/views/renalware/clinical/body_compositions/_table.html.slim +42 -0
- data/app/views/renalware/clinical/body_compositions/index.html.slim +9 -0
- data/app/views/renalware/clinical/dry_weights/_list.html.slim +2 -8
- data/app/views/renalware/clinical/dry_weights/_table.html.slim +7 -0
- data/app/views/renalware/clinical/profiles/show.html.slim +4 -2
- data/app/views/renalware/feeds/hl7_test_messages/create.js.erb +10 -0
- data/app/views/renalware/feeds/hl7_test_messages/new.slim +18 -0
- data/app/views/renalware/hd/mdm_patients/_filters.html.slim +0 -11
- data/app/views/renalware/hd/mdm_patients/_page_actions.html.slim +29 -0
- data/app/views/renalware/hd/mdm_patients/index.html.slim +7 -4
- data/app/views/renalware/hd/{diaries → scheduling/diaries}/_page_actions.html.slim +4 -4
- data/app/views/renalware/hd/{diaries → scheduling/diaries}/_table.html.slim +0 -0
- data/app/views/renalware/hd/{diaries → scheduling/diaries}/_weekly_diary.html.slim +1 -1
- data/app/views/renalware/hd/{diaries → scheduling/diaries}/edit.html.slim +6 -6
- data/app/views/renalware/hd/{diaries → scheduling/diaries}/index.html.slim +0 -0
- data/app/views/renalware/hd/{diaries → scheduling/diaries}/show.pdf.slim +0 -0
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/_form.html.slim +15 -6
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/_slot.html.slim +2 -2
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/_tab.html.slim +1 -1
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/create.js.erb +1 -1
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/destroy.js.erb +1 -1
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/edit.html.slim +2 -2
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/new.html.slim +0 -0
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/new.js.erb +0 -0
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/show.js.erb +0 -0
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/update.js.erb +1 -1
- data/app/views/renalware/hospitals/units/index.html.slim +2 -2
- data/app/views/renalware/layouts/_patient.html.slim +2 -1
- data/app/views/renalware/letters/contacts/_form.html.slim +10 -13
- data/app/views/renalware/letters/letters/_form.html.slim +2 -9
- data/app/views/renalware/navigation/_developer.html.slim +4 -0
- data/app/views/renalware/navigation/_menu.html.slim +2 -0
- data/app/views/renalware/pathology/observation_requests/_filters.html.slim +17 -0
- data/app/views/renalware/pathology/observation_requests/index.html.slim +2 -1
- data/app/views/renalware/patients/_layout.html.slim +1 -1
- data/app/views/renalware/patients/_side_menu.html.slim.dead +7 -0
- data/app/views/renalware/patients/abridgements/_abridgement.html.slim +8 -0
- data/app/views/renalware/patients/abridgements/_table.html.slim +12 -0
- data/app/views/renalware/patients/abridgements/index.html.slim +22 -0
- data/app/views/renalware/patients/alerts/create.json +3 -0
- data/app/views/renalware/patients/patients/_form.html.slim +36 -17
- data/app/views/renalware/patients/patients/edit.html.slim +1 -1
- data/app/views/renalware/patients/patients/new.html.slim +1 -1
- data/app/views/renalware/patients/side_menu/_actions.html.slim +2 -0
- data/app/views/renalware/pd/_apd_regimes.html.slim +1 -1
- data/app/views/renalware/pd/_capd_regimes.html.slim +1 -1
- data/app/views/renalware/pd/dashboards/show/_apd_regimes.html.slim +11 -2
- data/app/views/renalware/pd/dashboards/show/_capd_regimes.html.slim +11 -2
- data/app/views/renalware/pd/regimes/index.html.slim +7 -0
- data/app/views/renalware/renal/profiles/_form.html.slim +7 -24
- data/app/views/renalware/shared/documents/_binary_marker_input.html.slim +2 -2
- data/app/views/renalware/shared/documents/_blood_group_input.html.slim +4 -2
- data/app/views/renalware/transplants/registrations/_form.html.slim +22 -17
- data/config/locales/renalware/clinical/body_composition.yml +6 -3
- data/config/locales/renalware/clinical/dry_weight.en.yml +4 -3
- data/config/locales/renalware/hd/diary_slots.en.yml +3 -2
- data/config/locales/renalware/letters/contact.en.yml +0 -2
- data/config/routes/feeds.rb +5 -0
- data/config/routes/hd.rb +11 -7
- data/config/routes/letters.rb +0 -5
- data/config/routes/patients.rb +1 -0
- data/config/routes/pd.rb +2 -2
- data/config/routes/renal.rb +0 -5
- data/config/routes.rb +1 -0
- data/config/webpack/development.js +5 -0
- data/config/webpack/environment.js +3 -0
- data/config/webpack/production.js +5 -0
- data/config/webpack/test.js +5 -0
- data/config/webpacker.yml +103 -0
- data/db/functions/hd_diary_archive_elapsed_master_slots_v01.sql +40 -0
- data/db/migrate/20190322120025_create_feed_hl7_test_messages.rb +12 -0
- data/db/migrate/20190325134823_create_patients_master_index.rb +24 -0
- data/db/migrate/20190327100851_add_handled_to_feed_messages.rb +5 -0
- data/db/migrate/20191012121433_add_consultant_to_users.rb +7 -0
- data/db/migrate/20191018143635_create_hd_diary_matrix_view.rb +7 -0
- data/db/migrate/20191018144917_create_fn_to_archive_master_slots.rb +9 -0
- data/db/views/hd_diary_matrix_v01.sql +38 -0
- data/lib/core_extensions/active_record/sort.rb +27 -9
- data/lib/renalware/configuration.rb +3 -0
- data/lib/renalware/engine.rb +31 -0
- data/lib/renalware/version.rb +1 -1
- data/lib/renalware/week_period.rb +8 -7
- data/lib/renalware.rb +13 -1
- data/lib/tasks/hd.rake +7 -0
- data/lib/tasks/pathology.rake +1 -1
- data/lib/tasks/renalware.rake +89 -4
- data/spec/factories/hd/scheduling/diaries.rb +18 -0
- data/spec/factories/hd/{slots.rb → scheduling/slots.rb} +1 -1
- data/spec/factories/patients/abridgements.rb +9 -0
- data/spec/support/hl7_helpers.rb +13 -0
- data/spec/support/pages/letters/form.rb +4 -1
- metadata +126 -50
- data/app/assets/javascripts/renalware/auto_complete.js +0 -63
- data/app/controllers/renalware/hd/diaries_controller.rb +0 -89
- data/app/controllers/renalware/hd/diary_slots_controller.rb +0 -175
- data/app/controllers/renalware/letters/descriptions_controller.rb +0 -22
- data/app/controllers/renalware/renal/prd_descriptions_controller.rb +0 -15
- data/app/models/renalware/hd/archive_yesterdays_slots_job.rb +0 -69
- data/app/models/renalware/hd/diary.rb +0 -41
- data/app/models/renalware/hd/diary_slot.rb +0 -83
- data/app/models/renalware/hd/find_or_create_diary_by_week_query.rb +0 -50
- data/app/models/renalware/hd/find_or_create_master_diary.rb +0 -26
- data/app/models/renalware/hd/master_diary.rb +0 -32
- data/app/models/renalware/hd/weekly_diary.rb +0 -45
- data/app/models/renalware/renal/prd_descriptions/search_query.rb +0 -35
- data/app/presenters/renalware/hd/diary_presenter.rb +0 -79
- data/app/presenters/renalware/hd/diary_slot_presenter.rb +0 -72
- data/app/presenters/renalware/hd/null_slot.rb +0 -40
- data/app/views/renalware/renal/prd_descriptions/search.json.jbuilder +0 -6
- data/lib/test_support/autocomplete_helpers.rb +0 -14
- data/spec/factories/hd/diaries.rb +0 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d4138b40704044a6a0006492eba54b24dc92c31012e2da599b346a720c00ee9b
|
|
4
|
+
data.tar.gz: edfd0a9655c555f6bb23c1011a8f15e7581fb24026d06df04a01489b37c22e5d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 95d680af0d7c7d983e7ca5f0c41ec7f212de25fe20444ffd38fcfabecce2fbc2388f0eaa7062c7783df2eafb707dbab9865b394197fc24f0fd0e5d19d11a20a7
|
|
7
|
+
data.tar.gz: 300b19a9ba904f2530a67c2c77de95fc887345e43101b6fa4ea1f84ac80c18cf0eff12229ced1a69fe5afe3ddb2fe1be520459f806472a7af20e3916657c0b22
|
data/Rakefile
CHANGED
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
//= require jquery-readyselector
|
|
16
16
|
//= require jquery_ujs
|
|
17
17
|
//= require jquery-ui/core
|
|
18
|
-
//= require jquery-ui/widgets/autocomplete
|
|
19
18
|
//= require jquery-ui/widgets/sortable
|
|
20
19
|
//= require jquery-ui/effects/effect-highlight
|
|
21
20
|
//= require dataTables/jquery.dataTables
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var Renalware = typeof Renalware === 'undefined' ? {} : Renalware;
|
|
2
|
+
|
|
3
|
+
Renalware.FeedOnlyInputs = (function() {
|
|
4
|
+
// Disable any input/textarea/selects having a data attribute suggesting it is controlled by an
|
|
5
|
+
// external feed. The data in these inouts can be overwritten by the feed at any time so it
|
|
6
|
+
// makes sense not to allow user input.
|
|
7
|
+
// Note that this js file is only re-parsed when it changes, so if you change the value of
|
|
8
|
+
// e.g. disable_inputs_controlled_by_tissue_typing_feed in an initializer, it will not
|
|
9
|
+
// take affect until you clear the assets, or make a change to this file etc.
|
|
10
|
+
var disableFeedOnlyInputs = function() {
|
|
11
|
+
<% if Renalware.config.disable_inputs_controlled_by_tissue_typing_feed %>
|
|
12
|
+
$("input,textarea,select").filter("[data-controlled-by-tissue-typing-feed]").prop("disabled", true);
|
|
13
|
+
<% end %>
|
|
14
|
+
<% if Renalware.config.disable_inputs_controlled_by_demographics_feed %>
|
|
15
|
+
$("input,textarea,select").filter("[data-controlled-by-demographics-feed]").prop("disabled", true);
|
|
16
|
+
<% end %>
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
init: function () {
|
|
21
|
+
disableFeedOnlyInputs();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}());
|
|
25
|
+
|
|
26
|
+
$(document).ready(Renalware.FeedOnlyInputs.init);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
$(document).ready(function(){
|
|
2
|
+
$(".hl7-file-browser a").on("click", function(e) {
|
|
3
|
+
console.log($(this).data("body"));
|
|
4
|
+
$("#feeds_hl7_test_form_body").val($(this).data("body"))
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
// $(".file-viewer form").on("submit", function(event) {
|
|
8
|
+
// console.log("asassas");
|
|
9
|
+
// event.preventDefault();
|
|
10
|
+
// console.log(this)
|
|
11
|
+
|
|
12
|
+
// var valuesToSubmit = this.el.serialize();
|
|
13
|
+
// var self = this;
|
|
14
|
+
// //#url: self.el.attr("action"), //submits it to the given url of the form
|
|
15
|
+
|
|
16
|
+
// $.ajax({
|
|
17
|
+
// type: "POST",
|
|
18
|
+
// data: valuesToSubmit,
|
|
19
|
+
// dataType: "JSON",
|
|
20
|
+
// statusCode: {
|
|
21
|
+
// 201: function(contact) {
|
|
22
|
+
// // self._onSuccess(contact);
|
|
23
|
+
// console.log("asass")
|
|
24
|
+
// },
|
|
25
|
+
// 400: function(jqXHR) {
|
|
26
|
+
// var errors = jqXHR.responseJSON;
|
|
27
|
+
// // self._onErrors(errors);
|
|
28
|
+
// console.log("error")
|
|
29
|
+
// }
|
|
30
|
+
// }
|
|
31
|
+
// });
|
|
32
|
+
// });
|
|
33
|
+
|
|
34
|
+
// this.el.on("submit", function(event) { self._onSubmit(event) });
|
|
35
|
+
// $.ajax({
|
|
36
|
+
// type: "POST",
|
|
37
|
+
// url: self.el.attr("action"), //submits it to the given url of the form
|
|
38
|
+
// data: valuesToSubmit,
|
|
39
|
+
// dataType: "JSON",
|
|
40
|
+
// statusCode: {
|
|
41
|
+
// 201: function(contact) {
|
|
42
|
+
// self._onSuccess(contact);
|
|
43
|
+
// },
|
|
44
|
+
// 400: function(jqXHR) {
|
|
45
|
+
// var errors = jqXHR.responseJSON;
|
|
46
|
+
// self._onErrors(errors);
|
|
47
|
+
// }
|
|
48
|
+
// }
|
|
49
|
+
// });
|
|
50
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var Renalware = typeof Renalware === 'undefined' ? {} : Renalware;
|
|
2
|
+
|
|
3
|
+
Renalware.PersonSearch = (function() {
|
|
4
|
+
|
|
5
|
+
var initPersonSearch = function(){
|
|
6
|
+
var dropDown = $(".person-ajax-search");
|
|
7
|
+
|
|
8
|
+
$(dropDown).select2({
|
|
9
|
+
language: {
|
|
10
|
+
inputTooShort: function(args) {
|
|
11
|
+
return $(dropDown).data("hint");
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
ajax: {
|
|
15
|
+
dataType: 'json',
|
|
16
|
+
delay: 250,
|
|
17
|
+
data: function (params) {
|
|
18
|
+
return {
|
|
19
|
+
term: params.term
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
processResults: function (data, params) {
|
|
23
|
+
return {
|
|
24
|
+
results: data
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
cache: true
|
|
28
|
+
},
|
|
29
|
+
minimumInputLength: 2
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
init: function () {
|
|
35
|
+
initPersonSearch()
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}());
|
|
39
|
+
|
|
40
|
+
$(document).ready(Renalware.PersonSearch.init);
|
|
41
|
+
$(document).on('opened.fndtn.reveal', '[data-reveal]', function() {
|
|
42
|
+
Renalware.PersonSearch.init();
|
|
43
|
+
});
|
|
@@ -174,7 +174,7 @@ article {
|
|
|
174
174
|
span {
|
|
175
175
|
color: $mid-grey;
|
|
176
176
|
font-size: 1.1rem;
|
|
177
|
-
line-height: 1.78rem;
|
|
177
|
+
// line-height: 1.78rem;
|
|
178
178
|
margin: 0 .5rem 0 0;
|
|
179
179
|
}
|
|
180
180
|
|
|
@@ -475,3 +475,7 @@ legend .legend-note {
|
|
|
475
475
|
font-size: .9rem;
|
|
476
476
|
color: $steel;
|
|
477
477
|
}
|
|
478
|
+
|
|
479
|
+
.page-action-inline-form form {
|
|
480
|
+
display: inline-block;
|
|
481
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Renalware
|
|
4
|
+
module Patients
|
|
5
|
+
# Experimental ActionView component
|
|
6
|
+
class SideMenuComponent < ActionView::Component::Base
|
|
7
|
+
validates :patient, presence: true
|
|
8
|
+
|
|
9
|
+
def initialize(patient:)
|
|
10
|
+
@patient = patient
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
attr_reader :patient
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -6,8 +6,14 @@ require_dependency "renalware/clinical"
|
|
|
6
6
|
module Renalware
|
|
7
7
|
module Clinical
|
|
8
8
|
class BodyCompositionsController < Clinical::BaseController
|
|
9
|
+
include Renalware::Concerns::Pageable
|
|
9
10
|
before_action :load_patient
|
|
10
11
|
|
|
12
|
+
def index
|
|
13
|
+
body_compositions = BodyComposition.for_patient(patient).ordered.page(page).per(per_page)
|
|
14
|
+
render locals: { patient: patient, body_compositions: body_compositions }
|
|
15
|
+
end
|
|
16
|
+
|
|
11
17
|
def show
|
|
12
18
|
body_composition = find_body_composition
|
|
13
19
|
render locals: { patient: patient, body_composition: body_composition }
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_dependency "renalware/admin"
|
|
4
|
+
require "ap"
|
|
5
|
+
|
|
6
|
+
module Renalware
|
|
7
|
+
module Feeds
|
|
8
|
+
class HL7TestMessagesController < BaseController
|
|
9
|
+
def new
|
|
10
|
+
authorize [:renalware, :admin, :devops], :show?
|
|
11
|
+
test_messages = HL7TestMessage.all
|
|
12
|
+
render locals: { form: HL7TestForm.new, test_messages: test_messages }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
16
|
+
def create
|
|
17
|
+
authorize [:renalware, :admin, :devops], :create?
|
|
18
|
+
body = replace_placeholders_in_hl7_message(form_params[:body])
|
|
19
|
+
job = FeedJob.new(body)
|
|
20
|
+
job.perform
|
|
21
|
+
test_patient
|
|
22
|
+
version = test_patient.reload.versions.order(created_at: :desc).last&.object_changes
|
|
23
|
+
json_version = version && JSON.pretty_generate(version)
|
|
24
|
+
respond_to do |format|
|
|
25
|
+
format.js do
|
|
26
|
+
render locals: {
|
|
27
|
+
a: "asas",
|
|
28
|
+
test_patient: test_patient,
|
|
29
|
+
version: json_version
|
|
30
|
+
}
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
|
34
|
+
|
|
35
|
+
# # Delayed::Job.enqueue job
|
|
36
|
+
# redirect_to(
|
|
37
|
+
# renalware.new_feeds_hl7_test_message_path,
|
|
38
|
+
# notice: "Hl7 message queued"
|
|
39
|
+
# )
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
|
|
44
|
+
def form_params
|
|
45
|
+
params.require(:feeds_hl7_test_form).permit(:body)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def test_patient
|
|
49
|
+
@test_patient ||= Patient.find_by!(local_patient_id: "Z100001")
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def replace_placeholders_in_hl7_message(message)
|
|
53
|
+
message
|
|
54
|
+
.gsub("{{message_id}}", SecureRandom.hex(12))
|
|
55
|
+
.gsub("{{local_patient_id}}", test_patient.local_patient_id)
|
|
56
|
+
.gsub("\r\n", "\r")
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -50,11 +50,6 @@ module Renalware
|
|
|
50
50
|
params[:named_filter]
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
def batch_print_form
|
|
54
|
-
patient_ids = query.call.pluck("patients.id").join(",")
|
|
55
|
-
SessionForms::Form.new(patient_ids: patient_ids)
|
|
56
|
-
end
|
|
57
|
-
|
|
58
53
|
def render_index(filter_form:, **args)
|
|
59
54
|
presenter = build_presenter(params: params, **args)
|
|
60
55
|
authorize presenter.patients
|
|
@@ -63,10 +58,25 @@ module Renalware
|
|
|
63
58
|
locals: {
|
|
64
59
|
presenter: presenter,
|
|
65
60
|
filter_form: filter_form,
|
|
66
|
-
batch_print_form: batch_print_form
|
|
61
|
+
batch_print_form: batch_print_form,
|
|
62
|
+
pathology_requests_form: pathology_requests_form
|
|
67
63
|
}
|
|
68
64
|
)
|
|
69
65
|
end
|
|
66
|
+
|
|
67
|
+
# Form object behind the batch print session forms button
|
|
68
|
+
def batch_print_form
|
|
69
|
+
SessionForms::Form.new(patient_ids: patient_ids)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Form object behind the 'generate request forms' button
|
|
73
|
+
def pathology_requests_form
|
|
74
|
+
OpenStruct.new(patient_ids: patient_ids)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def patient_ids
|
|
78
|
+
@patient_ids ||= query.call.pluck("patients.id")
|
|
79
|
+
end
|
|
70
80
|
end
|
|
71
81
|
end
|
|
72
82
|
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_dependency "renalware/hd/base_controller"
|
|
4
|
+
|
|
5
|
+
# The route to the edit route for this controller takes /:year/:week_number segments
|
|
6
|
+
# rather than an id. THat is because when we load the diary, and when we navigate back and forth
|
|
7
|
+
# through diaries, we are concerned with the week more then an id. Its easier to navigate to the
|
|
8
|
+
# next week with /2017/52 than by looking up the id of the next diary ahead of time.
|
|
9
|
+
module Renalware
|
|
10
|
+
module HD
|
|
11
|
+
module Scheduling
|
|
12
|
+
class DiariesController < BaseController
|
|
13
|
+
include Renalware::Concerns::PdfRenderable
|
|
14
|
+
include Renalware::Concerns::Pageable
|
|
15
|
+
|
|
16
|
+
def edit
|
|
17
|
+
authorize weekly_diary, :show?
|
|
18
|
+
render locals: {
|
|
19
|
+
unit: unit,
|
|
20
|
+
diary: DiaryPresenter.new(current_user, weekly_diary)
|
|
21
|
+
}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Renders a list of diaries for a hospital unit
|
|
25
|
+
def index
|
|
26
|
+
authorize WeeklyDiary, :index?
|
|
27
|
+
render locals: { unit: unit, diaries: weekly_diaries }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def show
|
|
31
|
+
diary = WeeklyDiary.find(params[:id])
|
|
32
|
+
respond_to do |format|
|
|
33
|
+
format.pdf do
|
|
34
|
+
authorize diary
|
|
35
|
+
options = default_pdf_options.merge!(
|
|
36
|
+
pdf: pdf_filename,
|
|
37
|
+
locals: { unit: unit, diary: DiaryPresenter.new(current_user, diary) }
|
|
38
|
+
)
|
|
39
|
+
render options
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
# TODO: give a sensible name
|
|
47
|
+
def pdf_filename
|
|
48
|
+
"hd_unit_diary"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def weekly_diary
|
|
52
|
+
@weekly_diary ||= begin
|
|
53
|
+
FindOrCreateDiaryByWeekQuery.new(
|
|
54
|
+
relation: WeeklyDiary.eager_load(
|
|
55
|
+
slots: [:patient, :station, :diurnal_period_code],
|
|
56
|
+
master_diary: { slots: [:patient, :station, :diurnal_period_code] }
|
|
57
|
+
),
|
|
58
|
+
unit_id: unit_id,
|
|
59
|
+
week_period: week_period,
|
|
60
|
+
by: current_user
|
|
61
|
+
).call
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# The route segments are /:year/:week_number
|
|
66
|
+
# We use a WeekPeriod value object to wrap those two things.
|
|
67
|
+
def week_period
|
|
68
|
+
WeekPeriod.new(
|
|
69
|
+
week_number: params[:week_number],
|
|
70
|
+
year: params[:year]
|
|
71
|
+
)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def unit_id
|
|
75
|
+
params[:unit_id]
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def unit
|
|
79
|
+
Hospitals::Unit.find(unit_id)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def weekly_diaries
|
|
83
|
+
WeeklyDiary
|
|
84
|
+
.where(hospital_unit_id: unit_id)
|
|
85
|
+
.ordered
|
|
86
|
+
.page(page).per(per_page)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# rubocop:disable Metrics/ClassLength
|
|
4
|
+
require_dependency "renalware/hd/base_controller"
|
|
5
|
+
|
|
6
|
+
module Renalware
|
|
7
|
+
module HD
|
|
8
|
+
module Scheduling
|
|
9
|
+
class DiarySlotsController < BaseController
|
|
10
|
+
# GET html - renders a form
|
|
11
|
+
# Here we will have been passed in the query string:
|
|
12
|
+
# - the unit id
|
|
13
|
+
# - the dirunal_period_code id
|
|
14
|
+
# - the week and year (and thus the diary)
|
|
15
|
+
# and from that lot we could look up the master and weekly diaries
|
|
16
|
+
def new
|
|
17
|
+
# Be default this assume we are going to add a slot to the weekly diary
|
|
18
|
+
# but in which button is clicked in the modal dialog determines which diary
|
|
19
|
+
# (master or weekly) the slot will be added to.
|
|
20
|
+
slot = DiarySlot.new(
|
|
21
|
+
diary: weekly_diary,
|
|
22
|
+
station_id: params[:station_id],
|
|
23
|
+
day_of_week: params[:day_of_week],
|
|
24
|
+
diurnal_period_code_id: params[:diurnal_period_code_id]
|
|
25
|
+
)
|
|
26
|
+
authorize slot
|
|
27
|
+
render locals: locals_for(slot), layout: false
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# POST create js
|
|
31
|
+
# Here we may be adding a slot to the weekly or master diary.
|
|
32
|
+
# That should be transparent to us - we make the change and render
|
|
33
|
+
# create.js.erb which, on the client, will cause an ajax js call to #show.
|
|
34
|
+
# That secondary call is the one that refreshes the slot in the table with its latest state.
|
|
35
|
+
# We do this to avoid having to to a check (in each action in this controller) to see if we
|
|
36
|
+
# are on the master or weekly diary; if we always refresh the diary slot in the ui after any
|
|
37
|
+
# action, then it will always update correctly.
|
|
38
|
+
def create
|
|
39
|
+
diary = Diary.find(params[:diary_id])
|
|
40
|
+
slot = diary.slots.new(slot_params)
|
|
41
|
+
slot.patient_id = posted_patient_id
|
|
42
|
+
authorize slot
|
|
43
|
+
if slot.save_by(current_user)
|
|
44
|
+
render locals: { diary: diary, slot: diary.decorate_slot(slot) }
|
|
45
|
+
else
|
|
46
|
+
render :new, locals: { slot: DiarySlotPresenter.new(slot) }, layout: false
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# GET .js refresh a slot in a *weekly* diary
|
|
51
|
+
# See comment on #create.
|
|
52
|
+
# See show.js.erb where we refresh the slot in the diary
|
|
53
|
+
# To get here we will have manufactured a url like this
|
|
54
|
+
# hd/diaries/2/slots/day/1/period/1/station/1
|
|
55
|
+
# as those bit are will we know.
|
|
56
|
+
# Basically we are saying find for this weekly diary, find the matching
|
|
57
|
+
# slot for the station/day/period combo and render the weekly slot if there is
|
|
58
|
+
# one, or the master behind it if there is one of those, otherwise render an Add button.
|
|
59
|
+
def show
|
|
60
|
+
authorize DiarySlot, :show?
|
|
61
|
+
slot = weekly_then_master_then_empty_slot
|
|
62
|
+
render layout: false, locals: { slot: DiarySlotPresenter.new(slot) }
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def edit
|
|
66
|
+
authorize slot
|
|
67
|
+
render layout: false, locals: { slot: DiarySlotPresenter.new(slot) }
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# DELETE js
|
|
71
|
+
# Delete the slot (we don't know if its on the master or weekly diary).
|
|
72
|
+
# NB as per #create and #update, the rendered js file (destroy.js.erb) will make a secondary
|
|
73
|
+
# call back into #show to refresh the UI (i.e. we don't attempt to update the UI in
|
|
74
|
+
# destroy.js.erb)
|
|
75
|
+
def destroy
|
|
76
|
+
authorize slot
|
|
77
|
+
slot.destroy!
|
|
78
|
+
render locals: { slot: DiarySlotPresenter.new(slot) }
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# PATCH js
|
|
82
|
+
# See also comments in #create and #destroy.
|
|
83
|
+
def update
|
|
84
|
+
authorize slot
|
|
85
|
+
slot.patient_id = slot_params[:patient_id]
|
|
86
|
+
slot.save_by!(current_user)
|
|
87
|
+
diary = slot.diary
|
|
88
|
+
render locals: { diary: diary, slot: diary.decorate_slot(slot) }
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
private
|
|
92
|
+
|
|
93
|
+
# Find the corresponding slot in the master if there is one, otherwise an empty slot
|
|
94
|
+
# with an 'Add' button ready to set up a new patient
|
|
95
|
+
def weekly_then_master_then_empty_slot
|
|
96
|
+
empty_slot = build_empty_weekly_slot
|
|
97
|
+
find_weekly_slot(empty_slot) || find_master_slot(empty_slot) || empty_slot
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def find_master_slot(args)
|
|
101
|
+
slot = master_diary.slots.find_by(
|
|
102
|
+
diurnal_period_code_id: args.diurnal_period_code_id,
|
|
103
|
+
station_id: args.station_id,
|
|
104
|
+
day_of_week: args.day_of_week
|
|
105
|
+
)
|
|
106
|
+
slot && master_diary.decorate_slot(slot)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def find_weekly_slot(args)
|
|
110
|
+
slot = weekly_diary.slots.find_by(
|
|
111
|
+
diurnal_period_code_id: args.diurnal_period_code_id,
|
|
112
|
+
station_id: args.station_id,
|
|
113
|
+
day_of_week: args.day_of_week
|
|
114
|
+
)
|
|
115
|
+
slot && weekly_diary.decorate_slot(slot)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Used for searching etc
|
|
119
|
+
def build_empty_weekly_slot
|
|
120
|
+
weekly_diary.slots.new(
|
|
121
|
+
day_of_week: params[:day_of_week],
|
|
122
|
+
station_id: params[:station_id],
|
|
123
|
+
diurnal_period_code_id: params[:diurnal_period_code_id]
|
|
124
|
+
)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def slot
|
|
128
|
+
@slot ||= DiarySlot.find(params[:id])
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# In the url the :diary_id param is always the weekly diary id!
|
|
132
|
+
def weekly_diary
|
|
133
|
+
@weekly_diary ||= WeeklyDiary.find(params[:diary_id])
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def master_diary
|
|
137
|
+
weekly_diary.master_diary
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def locals_for(slot)
|
|
141
|
+
{
|
|
142
|
+
slot: DiarySlotPresenter.new(slot),
|
|
143
|
+
weekly_diary: weekly_diary
|
|
144
|
+
}
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def posted_patient_id
|
|
148
|
+
slot_params[:patient_id]
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def slot_params
|
|
152
|
+
params
|
|
153
|
+
.require(:slot)
|
|
154
|
+
.permit(
|
|
155
|
+
:master_slot,
|
|
156
|
+
:day_of_week,
|
|
157
|
+
:diurnal_period_code_id,
|
|
158
|
+
:station_id,
|
|
159
|
+
:target_diary_id,
|
|
160
|
+
:change_type,
|
|
161
|
+
:patient_id,
|
|
162
|
+
patient_ids: []
|
|
163
|
+
)
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
# rubocop:enable Metrics/ClassLength
|
|
169
|
+
end
|