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

Lab model modification #916

Merged
merged 3 commits into from
Jan 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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