Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Adding the notes and patient history #392

Closed
wants to merge 64 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
257d796
Patient Note object.
tangollama Mar 15, 2016
2cb0949
add_note label
tangollama Mar 16, 2016
591f416
add and delete note permissions
tangollama Mar 16, 2016
2afedfb
Initial Patient History and Patient Notes
tangollama Mar 16, 2016
c12c954
Merge branch 'master' into notes-feature-try-again
tangollama Mar 16, 2016
5c962b8
bug is bad
tangollama Mar 16, 2016
b74f4d0
missing paren
tangollama Mar 16, 2016
db759f1
Cleanup from JSHint
tangollama Mar 16, 2016
ffb1744
fixing the show status for tabs in NEW
tangollama Mar 16, 2016
93065f2
Adding notes to visits now works.
tangollama Mar 16, 2016
48ba126
functional patient-notes
tangollama Mar 17, 2016
2c3cc9d
Merge branch 'master' into notes-feature-try-again
tangollama Mar 17, 2016
2463b7d
Merge remote-tracking branch 'origin/master' into notes-feature-try-a…
Mar 17, 2016
0b545df
corrections to labels and acceptance tests
tangollama Mar 17, 2016
e854f11
Merge branch 'master' into notes-feature-try-again
tangollama Mar 17, 2016
88e7a37
Adding the security checks into the controller for assistance with th…
tangollama Mar 17, 2016
d20b636
merge master and resolve conflicts
Mar 20, 2016
f17baa4
merging from master
tangollama Mar 21, 2016
6493461
Merge remote-tracking branch 'origin/notes-feature-try-again' into no…
tangollama Mar 21, 2016
28c8975
adding date of birth to the patient summary
tangollama Mar 21, 2016
b788cc2
date of birth change
tangollama Mar 21, 2016
1876608
tweak patient id styling
Mar 21, 2016
475aa60
fix for missing classname
Mar 21, 2016
c72326b
remove panel title per change in c5d597c
Mar 21, 2016
efb7624
initial spike for history content styling
Mar 21, 2016
02e03a0
improve input contrast
Mar 21, 2016
8066f5b
remove border from panel footer
Mar 21, 2016
4e71d8a
styling for patient history headings
Mar 22, 2016
a78480d
updating copy + removing labels.on
tangollama Mar 22, 2016
c7970ce
style note content
Mar 22, 2016
6bf877c
remove light weight for nav
Mar 22, 2016
e4b18bd
overwrite border style
Mar 22, 2016
2242da6
template adjustments in the history
tangollama Mar 23, 2016
9461679
more adjustments to the history
tangollama Mar 23, 2016
e5da865
Merge branch 'master' into notes-feature-try-again
tangollama Mar 23, 2016
8084f94
correction on translation bundle error.
tangollama Mar 23, 2016
d6373e8
building in patient notes migration to patient edit route
tangollama Mar 23, 2016
1535654
white space warnings
tangollama Mar 23, 2016
600f062
more formatting corrections
tangollama Mar 23, 2016
c75f2b7
reduce font weight on note copy
Mar 23, 2016
2b1394e
removing the lazy migration for patient-notes
tangollama Mar 24, 2016
0fde46a
KISS + listing errors
tangollama Mar 25, 2016
4dd87e6
formatting and whitespace errors
tangollama Mar 25, 2016
faf297a
updated test for updated interface
tangollama Mar 25, 2016
850954d
test cleanup
tangollama Mar 25, 2016
b310fe6
canAddNote assumes there's a visit to tie to.
tangollama Mar 25, 2016
14c305c
New html-line-break helper
tangollama Mar 25, 2016
5776715
add html-line-break
tangollama Mar 25, 2016
d02154d
checking for undefined
tangollama Mar 25, 2016
53f73ba
jslinting errors in travis build
tangollama Mar 25, 2016
187caac
updating content security policy
tangollama Mar 25, 2016
2665d99
mistakenly checked in our new relic config.
tangollama Mar 26, 2016
af24000
updated test for CRUD exercises
tangollama Mar 27, 2016
2b0ca5f
updated canAddNote logic
tangollama Mar 27, 2016
7ddc045
Injecting the translation service into models
tangollama Mar 28, 2016
5260f75
translations and type-ahead
tangollama Mar 28, 2016
71ed560
added actions
tangollama Mar 28, 2016
9eba214
add route-level action for delete
tangollama Mar 28, 2016
6f00027
baking translations into the model
tangollama Mar 28, 2016
a0e226f
Adding physicianList
tangollama Mar 28, 2016
9fef770
new asserts for CRUD
tangollama Mar 28, 2016
c1a16dd
updating test timing
tangollama Mar 28, 2016
44c8329
more adjustments for timing
tangollama Mar 28, 2016
c5e0706
Fixing formatting and display issues
tangollama Mar 29, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ nbproject/project.xml
*.sublime-workspace
server/config.js
.brackets.json
/app/nbproject/private/
/app/nbproject/private/
newrelic_agent.log

newrelic.js
8 changes: 8 additions & 0 deletions app/helpers/html-line-break.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Ember from 'ember';
export default Ember.Helper.helper(function([text]) {
if (text !== null && typeof text !== 'undefined') {
return new Ember.Handlebars.SafeString(text.replace(/\n/g, '<br>'));
} else {
return null;
}
});
1 change: 1 addition & 0 deletions app/initializers/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export default {
app.inject('route', 'i18n', 'service:i18n');
app.inject('controller', 'i18n', 'service:i18n');
app.inject('mixin', 'i18n', 'service:i18n');
app.inject('model', 'i18n', 'service:i18n');
}
};
57 changes: 55 additions & 2 deletions app/locales/en/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,15 @@ export default {
}
},
labels: {
cptcode: 'CPT Code',
loading: 'Loading',
name: 'Name',
patient: 'Patient',
quantity: 'Quantity',
requested_on: 'Requested On',
date: 'Date',
date_of_birth: 'Date of Birth',
date_of_birth_short: 'DoB',
date_requested: 'Date Requested',
date_completed: 'Date Completed',
description: 'Description',
Expand All @@ -155,12 +158,18 @@ export default {
action: 'Action',
notes: 'Notes',
edit: 'Edit',
image_orders: 'Image Orders',
lab_orders: 'Lab Orders',
patient_history: 'Patient History',
imaging_type: 'Imaging Type',
result: 'Result',
results: 'Results',
visit: 'Visit',
requests: 'Requests',
completed: 'Completed',
id: 'Id',
on: 'on',
type: 'Type',
id: 'ID',
sex: 'Sex',
age: 'Age',
username: 'Username',
Expand Down Expand Up @@ -196,17 +205,24 @@ export default {
location: 'Location',
provider: 'Provider',
with: 'With',
all_day: 'All Day'
all_day: 'All Day',
physician: 'Physician',
assisting: 'Assisting',
anesthesia: 'Anesthesia',
procedures: 'Procedures'
},
messages: {
no_items_found: 'No items found.',
no_history_available: 'No history available.',
create_new_record: 'Create a new record?',
create_new_user: 'Create a new user?',
no_users_found: 'No users found.',
are_you_sure_delete: 'Are you sure you wish to delete the user {{user}}?',
user_has_been_saved: 'The user has been saved.',
user_saved: 'User Saved',
on_behalf_of: 'on behalf of',
new_patient_has_to_be_created: 'A new patient needs to be created...Please wait..',
no_notes_available: 'No additional clinical notes are available for this visit.',
sorry: 'Sorry, something went wrong...'
},
alerts: {
Expand All @@ -226,6 +242,7 @@ export default {
delete: 'Delete',
new_user: 'New User',
add_value: 'Add Value',
new_note: 'New Note',
import: 'Import',
load_file: 'Load File',
new_request: 'New Request',
Expand Down Expand Up @@ -504,6 +521,31 @@ export default {
new_button: '+ new appointment'
}
},
visits: {
edit: {
actions: 'Actions',
edit: 'Edit',
date: 'Date',
authored_by: 'Authored By',
note: 'Note',
notes: 'Notes',
new_note: 'New Note',
visit_information: 'Visit Information',
new_appointment: 'New Appointment',
add_diagnosis: 'Add Diagnosis',
diagnosis: 'Diagnosis',
delete: 'Delete',
procedure: 'Procedure',
procedures: 'Procedures',
new_procedure: 'New Procedure',
labs: 'Labs',
new_lab: 'New Lab',
imaging: 'Imaging',
new_imaging: 'New Imaging',
medication: 'Medication',
new_medication: 'New Medication'
}
},
labs: {
section_title: 'Labs',
requests_title: 'Lab Requests',
Expand All @@ -530,5 +572,16 @@ export default {
request_saved_title: 'Lab Request Saved',
request_saved_message: 'The lab request has been saved.'
}
},
common: {
actions: 'Actions'
},
patients: {
notes: {
on_behalf_of_label: 'On Behalf Of',
on_behalf_of_copy: 'on behalf of',
please_select_a_visit: 'Please select a visit',
note_label: 'Note'
}
}
};
35 changes: 35 additions & 0 deletions app/mixins/patient-notes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import Ember from 'ember';
export default Ember.Mixin.create({

canAddNote: function() {
return this.currentUserCan('add_note') && (!Ember.isEmpty(this.get('visits')) || !Ember.isEmpty(this.get('model.visits')));
},

canDeleteNote: function() {
return this.currentUserCan('delete_note');
},

_computeNoteType: function(visit) {
switch (visit.get('visitType')) {
case 'Admission':
if (Ember.isEmpty(visit.get('procedures'))) {
return 'Pre-op';
} else {
return 'Post-op';
}
break;
case 'Clinic':
case 'Followup':
return 'General';
default:
return visit.get('visitType');
}
},

_setNoteType: function() {
var model = this.get('model');
if (model.get('noteType') == null) {
model.set('noteType', this._computeNoteType(model.get('visit')));
}
}
});
14 changes: 14 additions & 0 deletions app/mixins/user-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,20 @@ export default Ember.Mixin.create({
users: [
'User Administrator',
'System Administrator'
],
add_note: [
'Doctor',
'Medical Records Officer',
'Nurse',
'Nurse Manager',
'Patient Administration',
'System Administrator'
],
delete_note: [
'Medical Records Officer',
'Nurse Manager',
'Patient Administration',
'System Administrator'
]

},
Expand Down
42 changes: 42 additions & 0 deletions app/models/patient-note.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import AbstractModel from 'hospitalrun/models/abstract';
import Ember from 'ember';
import DS from 'ember-data';
export default AbstractModel.extend({
authoredBy: function() {
if (!Ember.isEmpty(this.get('attribution'))) {
let i18n = this.get('i18n');
return this.get('createdBy') + ' ' + i18n.t('patients.notes.on_behalf_of_copy') + ' ' + this.get('attribution');
} else {
return this.get('createdBy');
}
}.property('attribution', 'createdBy'),
// if the note was written by one person but dictated / given on behalf of another, otherwise, this and createdBy are the same
attribution: DS.attr('string'),
content: DS.attr('string'),
createdBy: DS.attr('string'),
date: DS.attr('date'),
// custom list of noteTypes of mixins/patient-note-types
noteType: DS.attr(),
// who is this note about?
patient: DS.belongsTo('patient', {
async: false
}),
// if this note is related to a visit, make sure it's noted.
visit: DS.belongsTo('visit', {
async: false
}),
validations: {
patient: {
presence: true
},
visit: {
presence: true
},
noteType: {
presence: true
},
content: {
presence: true
}
}
});
2 changes: 2 additions & 0 deletions app/models/visit.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export default AbstractModel.extend({
labs: DS.hasMany('lab', { async: true }),
location: DS.attr('string'),
medication: DS.hasMany('medication', { async: true }),
// this field is being deprecated in favor of patient-note
notes: DS.attr('string'),
patientNotes: DS.hasMany('patient-note', { async: true }),
outPatient: DS.attr('boolean'),
patient: DS.belongsTo('patient', {
async: false
Expand Down
63 changes: 44 additions & 19 deletions app/patients/edit/controller.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import AbstractEditController from 'hospitalrun/controllers/abstract-edit-controller';
import BloodTypes from 'hospitalrun/mixins/blood-types';
import Ember from 'ember';
import PatientNotes from 'hospitalrun/mixins/patient-notes';
import ReturnTo from 'hospitalrun/mixins/return-to';
import SelectValues from 'hospitalrun/utils/select-values';
import UserSession from 'hospitalrun/mixins/user-session';
export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, {
export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession, PatientNotes, {
canAddAppointment: function() {
return this.currentUserCan('add_appointment');
}.property(),
Expand Down Expand Up @@ -284,33 +285,41 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession,
},

editAppointment: function(appointment) {
appointment.set('returnToPatient', true);
appointment.set('returnTo', null);
this.transitionToRoute('appointments.edit', appointment);
if (this.get('canAddAppointment')) {
appointment.set('returnToPatient', true);
appointment.set('returnTo', null);
this.transitionToRoute('appointments.edit', appointment);
}
},

editImaging: function(imaging) {
if (imaging.get('canEdit')) {
imaging.setProperties({
'returnToPatient': true
});
this.transitionToRoute('imaging.edit', imaging);
if (this.get('canAddImaging')) {
if (imaging.get('canEdit')) {
imaging.setProperties({
'returnToPatient': true
});
this.transitionToRoute('imaging.edit', imaging);
}
}
},

editLab: function(lab) {
if (lab.get('canEdit')) {
lab.setProperties({
'returnToPatient': true
});
this.transitionToRoute('labs.edit', lab);
if (this.get('canAddLab')) {
if (lab.get('canEdit')) {
lab.setProperties({
'returnToPatient': true
});
this.transitionToRoute('labs.edit', lab);
}
}
},

editMedication: function(medication) {
if (medication.get('canEdit')) {
medication.set('returnToPatient', true);
this.transitionToRoute('medication.edit', medication);
if (this.get('canAddMedication')) {
if (medication.get('canEdit')) {
medication.set('returnToPatient', true);
this.transitionToRoute('medication.edit', medication);
}
}
},

Expand All @@ -319,11 +328,15 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession,
},

editProcedure: function(procedure) {
this.transitionToRoute('procedures.edit', procedure);
if (this.get('canAddVisit')) {
this.transitionToRoute('procedures.edit', procedure);
}
},

editVisit: function(visit) {
this.transitionToRoute('visits.edit', visit);
if (this.get('canAddVisit')) {
this.transitionToRoute('visits.edit', visit);
}
},

newAppointment: function() {
Expand Down Expand Up @@ -358,6 +371,18 @@ export default AbstractEditController.extend(BloodTypes, ReturnTo, UserSession,
});
},

showAddPatientNote: function(model) {
if (this.get('canAddNote')) {
if (Ember.isEmpty(model)) {
model = this.get('store').createRecord('patient-note', {
patient: this.get('model'),
createdBy: this.getUserName()
});
}
this.send('openModal', 'patients.notes', model);
}
},

showDeleteAppointment: function(appointment) {
appointment.set('deleteFromPatient', true);
this.send('openModal', 'appointments.delete', appointment);
Expand Down
8 changes: 7 additions & 1 deletion app/patients/edit/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ import AbstractEditRoute from 'hospitalrun/routes/abstract-edit-route';
import Ember from 'ember';
import PatientId from 'hospitalrun/mixins/patient-id';
import PatientVisits from 'hospitalrun/mixins/patient-visits';
import PatientNotes from 'hospitalrun/mixins/patient-notes';
import PouchDbMixin from 'hospitalrun/mixins/pouchdb';
export default AbstractEditRoute.extend(PatientId, PatientVisits, PouchDbMixin, {
export default AbstractEditRoute.extend(PatientId, PatientVisits, PouchDbMixin, PatientNotes, {
editTitle: 'Edit Patient',
modelName: 'patient',
newTitle: 'New Patient',
photos: null,

actions: {
updateNote: function(note) {
note.get('visit').save().then(function() {
// noop
});
},
appointmentDeleted: function(model) {
this.controller.send('appointmentDeleted', model);
},
Expand Down
Loading