From 8c0abaa3985ab04d21384c95b70e59c34a566051 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Wed, 6 May 2015 15:23:49 -0400 Subject: [PATCH] Resolves HospitalRun/frontend#48 --- app/patients/edit/controller.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/patients/edit/controller.js b/app/patients/edit/controller.js index 0745812e48..d956e6bdfd 100644 --- a/app/patients/edit/controller.js +++ b/app/patients/edit/controller.js @@ -405,10 +405,14 @@ export default AbstractEditController.extend(BloodTypes, GenderList, PouchAdapte }, newVisit: function() { - var newVisit = this.get('store').createRecord('visit', { - startDate: new Date(), - patient: this.get('model') - }); + var lastVisit = this.get('visits.lastObject'), + newVisit = this.get('store').createRecord('visit', { + startDate: new Date(), + patient: this.get('model') + }); + if (!Ember.isEmpty(lastVisit)) { + newVisit.setProperties(lastVisit.getProperties('primaryDiagnosis','primaryBillingDiagnosis')); + } this.transitionToRoute('visits.edit', newVisit); },