This repository has been archived by the owner on Jan 9, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding the notes and patient history
- Loading branch information
Showing
29 changed files
with
745 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'))); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.