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

Commit

Permalink
Lab model modification (#916)
Browse files Browse the repository at this point in the history
* Modified invoice model

* Modified lab model
  • Loading branch information
hsorellana authored and jkleinsc committed Jan 10, 2017
1 parent ceac8e7 commit 3aa7497
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions app/models/lab.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,34 @@ import AbstractModel from 'hospitalrun/models/abstract';
import CanEditRequested from 'hospitalrun/mixins/can-edit-requested';
import DateFormat from 'hospitalrun/mixins/date-format';
import DS from 'ember-data';
import Ember from 'ember';
import PatientValidation from 'hospitalrun/utils/patient-validation';
import ResultValidation from 'hospitalrun/mixins/result-validation';

const { computed, get } = Ember;

export default AbstractModel.extend(CanEditRequested, DateFormat, ResultValidation, {
charges: DS.hasMany('proc-charge', {
async: false
}),
// Attributes
labDate: DS.attr('date'),
labType: DS.belongsTo('pricing', {
async: false
}),
notes: DS.attr('string'),
patient: DS.belongsTo('patient', {
async: false
}),
requestedBy: DS.attr('string'),
requestedDate: DS.attr('date'),
result: DS.attr('string'),
status: DS.attr('string'),
visit: DS.belongsTo('visit', {
async: false
}),

labDateAsTime: function() {
return this.dateToTime(this.get('labDate'));
}.property('labDate'),
// Associations
charges: DS.hasMany('proc-charge', { async: false }),
labType: DS.belongsTo('pricing', { async: false }),
patient: DS.belongsTo('patient', { async: false }),
visit: DS.belongsTo('visit', { async: false }),

labDateAsTime: computed('labDate', function() {
return this.dateToTime(get(this, 'labDate'));
}),

requestedDateAsTime: function() {
return this.dateToTime(this.get('requestedDate'));
}.property('requestedDate'),
requestedDateAsTime: computed('requestedDate', function() {
return this.dateToTime(get(this, 'requestedDate'));
}),

validations: {
labTypeName: {
Expand Down

0 comments on commit 3aa7497

Please sign in to comment.