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

Commit

Permalink
Deprecation fixes for imaging.
Browse files Browse the repository at this point in the history
Fixes #186
  • Loading branch information
jkleinsc committed Oct 29, 2015
1 parent 99e0637 commit 5a60565
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 34 deletions.
5 changes: 2 additions & 3 deletions app/imaging/charge/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import ProcedureChargeController from 'hospitalrun/procedures/charge/controller'
import Ember from 'ember';

export default ProcedureChargeController.extend({
needs: ['imaging/edit'],
cancelAction: 'closeModal',
new#Item: false,
requestingController: Ember.computed.alias('controllers.imaging/edit'),
#List: Ember.computed.alias('controllers.imaging/edit.charges#List')
requestingController: Ember.inject.controllers('imaging/edit'),
#List: Ember.computed.alias('requestingController.charges#List')
});
2 changes: 0 additions & 2 deletions app/imaging/charge/template.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{{#modal-dialog
hideCancelButton=hideCancelButton
hideUpdateButton=hideUpdateButton
isUpdateDisabled=isUpdateDisabled
title=title
updateButtonAction=updateButtonAction
Expand Down
2 changes: 0 additions & 2 deletions app/imaging/delete/template.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{{#modal-dialog
hideCancelButton=hideCancelButton
hideUpdateButton=hideUpdateButton
isUpdateDisabled=isUpdateDisabled
title=title
updateButtonAction=updateButtonAction
Expand Down
42 changes: 22 additions & 20 deletions app/imaging/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import Ember from 'ember';
import PatientSubmodule from 'hospitalrun/mixins/patient-submodule';

export default AbstractEditController.extend(ChargeActions, PatientSubmodule, {
needs: ['imaging'],
imagingController: Ember.inject.controller('imaging'),

charge#Category: 'Imaging',
chargeRoute: 'imaging.charge',
selectedImagingType: null,
Expand All @@ -22,38 +23,39 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, {

actions: {
completeImaging: function() {
this.set('status', 'Completed');
this.get('model').validate().catch(Ember.K);
if (this.get('isValid')) {
this.set('imagingDate', new Date());
this.send('update');
}
this.set('model.status', 'Completed');
this.get('model').validate().then(function() {
if (this.get('model.isValid')) {
this.set('model.imagingDate', new Date());
this.send('update');
}
}.bind(this)).catch(Ember.K);
},

/**
* Save the imaging request(s), creating multiples when user selects multiple imaging tests.
*/
update: function() {
if (this.get('isNew')) {
if (this.get('model.isNew')) {
var newImaging = this.get('model'),
selectedImagingType = this.get('selectedImagingType');
if (Ember.isEmpty(this.get('status'))) {
this.set('status', 'Requested');
if (Ember.isEmpty(this.get('model.status'))) {
this.set('model.status', 'Requested');
}
this.set('requestedBy', newImaging.getUserName());
this.set('requestedDate', new Date());
this.set('model.requestedBy', newImaging.getUserName());
this.set('model.requestedDate', new Date());
if (Ember.isEmpty(selectedImagingType)) {
this.saveNew#(this.get('imagingTypeName'), 'Imaging', 'imagingType').then(function() {
this.saveNew#(this.get('model.imagingTypeName'), 'Imaging', 'model.imagingType').then(function() {
this.addChildToVisit(newImaging, 'imaging', 'Imaging').then(function() {
this.saveModel();
}.bind(this));
}.bind(this));
} else {
this.getSelected#('model.selectedImagingType').then(function(#Records) {
this.getSelected#('selectedImagingType').then(function(#Records) {
if (Ember.isArray(#Records)) {
this.createMultipleRequests(#Records, 'imagingType', 'imaging', 'Imaging');
} else {
this.set('imagingType', #Records);
this.set('model.imagingType', #Records);
this.addChildToVisit(newImaging, 'imaging', 'Imaging').then(function() {
this.saveModel();
}.bind(this));
Expand Down Expand Up @@ -81,16 +83,16 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, {

lookupListsToUpdate: [{
name: 'radiologistList',
property: 'radiologist',
property: 'model.radiologist',
id: 'radiologists'
}],

#TypeForObjectType: 'Imaging Procedure',
#Types: Ember.computed.alias('controllers.imaging.imaging#Types'),
#Types: Ember.computed.alias('imagingController.imaging#Types'),

#List: null, // This gets filled in by the route

radiologistList: Ember.computed.alias('controllers.imaging.radiologistList'),
radiologistList: Ember.computed.alias('imagingController.radiologistList'),

updateCapability: 'add_imaging',

Expand All @@ -99,7 +101,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, {
var afterDialogAction,
alertTitle,
alertMessage;
if (this.get('status') === 'Completed') {
if (this.get('model.status') === 'Completed') {
alertTitle = 'Imaging Request Completed';
alertMessage = 'The imaging request has been completed.';
} else {
Expand All @@ -110,7 +112,7 @@ export default AbstractEditController.extend(ChargeActions, PatientSubmodule, {
afterDialogAction = this.get('cancelAction');
}
this.saveVisitIfNeeded(alertTitle, alertMessage, afterDialogAction);
this.set('selectPatient', false);
this.set('model.selectPatient', false);
}

});
14 changes: 7 additions & 7 deletions app/imaging/edit/template.hbs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{{#edit-panel editPanelProps=editPanelProps}}
{{#em-form model=this submitButton=false }}
{{#if selectPatient}}
{{#em-form model=model submitButton=false }}
{{#if model.selectPatient}}
{{patient-typeahead property="patientTypeAhead" label="Patient" content=patientList selection=selectedPatient class="required patient-input"}}
{{else}}
{{patient-summary patient=patient returnTo='imaging.edit' returnToContext=id disablePatientLink=isNew }}
{{patient-summary patient=model.patient returnTo='imaging.edit' returnToContext=model.id disablePatientLink=model.isNew }}
{{/if}}
{{#if isNew}}
{{#if model.isNew}}
<div class="row">
{{em-select class="col-xs-3 required" label="Visit"
property="visit" content=patientVisitsForSelect
optionValuePath="selectObject" optionLabelPath="selectObject.visitDescription"
prompt="--Add New Visit--"
selected=visit
selected=model.visit
}}
</div>
{{checkbox-or-typeahead property="imagingTypeName"
Expand All @@ -28,11 +28,11 @@
<div class="row">
<div class="form-group col-xs-3">
<label>Visit</label>
<p class="form-control-static">{{visit.visitDate}}</p>
<p class="form-control-static">{{model.visit.visitDate}}</p>
</div>
<div class="form-group col-xs-9">
<label>Imaging Type</label>
<p class="form-control-static">{{imagingType.name}}</p>
<p class="form-control-static">{{model.imagingType.name}}</p>
</div>
</div>
{{/if}}
Expand Down

0 comments on commit 5a60565

Please # to comment.