From 4db8c1305c33d47dc43778ee14c0aadbe8df43f1 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 27 Dec 2016 12:49:01 -0500 Subject: [PATCH] Cleaned up patient history Resolves #889 --- app/models/visit.js | 19 ++++++++++++- app/patients/edit/template.hbs | 49 ++++++++++------------------------ 2 files changed, 32 insertions(+), 36 deletions(-) diff --git a/app/models/visit.js b/app/models/visit.js index b03b0d77e2..4fc207c9dd 100644 --- a/app/models/visit.js +++ b/app/models/visit.js @@ -25,6 +25,8 @@ const PAYMENT_STATES = { CLEAR: 'clear', PENDING: 'pending' }; +const COMPLETED_STATUS = 'Completed'; +const FULFILLED_STATUS = 'Fulfilled'; const REQUESTED_STATUS = 'Requested'; const STATUS_FIELD = 'status'; @@ -86,7 +88,22 @@ export default AbstractModel.extend({ } }), - hasDoneOrders: computed('labs', 'imaging', function() { + hasCompletedImaging: computed('imaging.@each.status', function() { + let imaging = this.get('imaging'); + return imaging.isAny(STATUS_FIELD, COMPLETED_STATUS); + }), + + hasCompletedLabs: computed('labs.@each.status', function() { + let labs = this.get('labs'); + return labs.isAny(STATUS_FIELD, COMPLETED_STATUS); + }), + + hasCompletedMedication: computed('medication.@each.status', function() { + let medication = this.get('medication'); + return medication.isAny(STATUS_FIELD, FULFILLED_STATUS); + }), + + hasDoneOrders: computed('imaging.@each.status', 'labs.@each.status', function() { let i18n = this.get('i18n'); let imaging = this.get('imaging'); let labs = this.get('labs'); diff --git a/app/patients/edit/template.hbs b/app/patients/edit/template.hbs index d470617c17..ea99abd454 100644 --- a/app/patients/edit/template.hbs +++ b/app/patients/edit/template.hbs @@ -46,67 +46,46 @@
{{t 'labels.procedures' }}
{{#each visit.procedures as |procedure|}} -
+
{{date-format procedure.procedureDate}}: - {{#if procedure.cptCode}} - [{{t 'labels.cptcode' }} - {{procedure.cptCode}}] - {{/if}} {{procedure.description}}
-
- {{t 'labels.physician'}}: {{procedure.physician}} - {{#if procedure.assistant}} - , {{t 'labels.assisting'}}: {{procedure.assistant}} - {{/if}} - {{#if procedure.anesthesiologist}} - , {{t 'labels.anesthesia'}}: {{procedure.anesthesiologist}} - {{/if}} -
- {{html-line-break procedure.notes}}
{{/each}}
{{/if}} - {{#if visit.imaging}} + {{#if visit.hasCompletedImaging}}
{{t 'labels.imageOrders' }}
{{#each visit.imaging as |imaging|}} -
+ {{#if (eq imaging.status 'Completed')}}
{{date-format imaging.imagingDate}}: {{imaging.imagingType.name}}
-
{{imaging.result}}
-
{{html-line-break imaging.notes}}
-
+ {{/if}} {{/each}}
{{/if}} - {{#if visit.labs}} + {{#if visit.hasCompletedLabs}}
{{t 'labels.labOrders' }}
{{#each visit.labs as |lab|}} -
+ {{#if (eq lab.status 'Completed')}}
{{date-format lab.labDate}}: {{lab.labType.name}}
-
{{lab.result}}
-
{{html-line-break lab.notes}}
-
+ {{/if}} {{/each}}
{{/if}} - {{#if visit.patientNotes}} + {{#if visit.hasCompletedMedication}}
-
{{t 'labels.notes'}}
- {{#each visit.patientNotes as |note|}} -
-
{{note.authoredBy}}
- {{date-format note.date}}[{{note.noteType}}]: {{html-line-break note.content}} -
+
{{t 'labels.medication' }}
+ {{#each visit.medication as |medication|}} + {{#if (eq medication.status 'Fulfilled')}} +
{{date-format medication.prescriptionDate}}: {{medication.medicationName}}
+ {{/if}} {{/each}}
- {{else}} -
- {{t 'messages.noNotesAvailable'}} -
{{/if}} +
{{/each}} {{else}}