Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove patientId field, fixed next appointment bug, removed unus… #5

Merged
merged 5 commits into from
Feb 21, 2017
Merged
Show file tree
Hide file tree
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
51 changes: 28 additions & 23 deletions app/admin/lookup/controller.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import Ember from 'ember';
import BillingCategories from 'hospitalrun/mixins/billing-categories';
import csvParse from 'npm:csv-parse';
import ModalHelper from 'hospitalrun/mixins/modal-helper';
import InventoryTypeList from 'hospitalrun/mixins/inventory-type-list';
import UnitTypes from 'hospitalrun/mixins/unit-types';
import VisitTypes from 'hospitalrun/mixins/visit-types';
import { EKMixin, keyDown } from 'ember-keyboard';

const {
computed
computed, get
} = Ember;

export default Ember.Controller.extend(BillingCategories, EKMixin,
Expand Down Expand Up @@ -291,6 +292,31 @@ export default Ember.Controller.extend(BillingCategories, EKMixin,
return true;
},

_importLookupList(file) {
let fileSystem = get(this, 'fileSystem');
let lookupTypeList = get(this, 'lookupTypeList');
let lookupValues = get(lookupTypeList, 'value');
fileSystem.fileToString(file).then((values) => {
csvParse(values, { trim: true }, (err, data) =>{
data.forEach((row) => {
let [newValue] = row;
if (!lookupValues.includes(newValue)) {
lookupValues.addObject(newValue);
}
});
lookupValues.sort();
let i18n = get(this, 'i18n');
let message = i18n.t('admin.lookup.alertImportListSaveMessage');
let title = i18n.t('admin.lookup.alertImportListSaveTitle');
lookupTypeList.save().then(() => {
this.displayAlert(title, message);
this.set('importFile');
this.set('model.importFileName');
});
});
});
},

_sortValues(a, b) {
return Ember.compare(a.toLowerCase(), b.toLowerCase());
},
Expand Down Expand Up @@ -335,35 +361,14 @@ export default Ember.Controller.extend(BillingCategories, EKMixin,
}
},
importList() {
let fileSystem = this.get('fileSystem');
let fileToImport = this.get('importFile');
let lookupTypeList = this.get('lookupTypeList');
if (!fileToImport || !fileToImport.type) {
this.displayAlert(
this.get('i18n').t('admin.lookup.alertImportListTitle'),
this.get('i18n').t('admin.lookup.alertImportListMessage')
);
} else {
fileSystem.fileToDataURL(fileToImport).then(function(fileDataUrl) {
let dataUrlParts = fileDataUrl.split(',');
lookupTypeList.setProperties({
_attachments: {
file: {
content_type: fileToImport.type,
data: dataUrlParts[1]
}
},
importFile: true
});
lookupTypeList.save().then(function() {
this.displayAlert(
this.get('i18n').t('admin.lookup.alertImportListSaveTitle'),
this.get('i18n').t('admin.lookup.alertImportListSaveMessage'),
'refreshLookupLists');
this.set('importFile');
this.set('model.importFileName');
}.bind(this));
}.bind(this));
this._importLookupList(fileToImport);
}
},
updateList() {
Expand Down
3 changes: 0 additions & 3 deletions app/admin/lookup/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ export default AbstractIndexRoute.extend({
actions: {
deleteValue(value) {
this.controller.send('deleteValue', value);
},
refreshLookupLists() {
this.refresh();
}
}
});
3 changes: 1 addition & 2 deletions app/locales/en/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -1108,15 +1108,14 @@ export default {
saved: 'The report has been saved'
},
form: {
patientId: 'Patient Id',
visitDate: 'Date of Visit',
primaryDiagnosis: 'Primary Diagnosis',
secondaryDiagnosis: 'Secondary Diagnosis',
procedures: 'Procedures',
labs: 'Labs',
images: 'Images',
nextAppointmentDate: 'Date Of Next Appointment',
operativePlan: 'Operative Plans'
operativePlan: 'Planned Procedures'
},
opd: {
titles: {
Expand Down
11 changes: 6 additions & 5 deletions app/models/lookup.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Model } from 'ember-pouch';
import DS from 'ember-data';

const { attr } = DS;

export default Model.extend({
_attachments: DS.attr(), // Temporarily store file as attachment until it gets uploaded to the server
importFile: DS.attr('boolean', { defaultValue: false }),
value: DS.attr(''),
organizeByType: DS.attr('boolean'),
userCanAdd: DS.attr('boolean')
organizeByType: attr('boolean'),
userCanAdd: attr('boolean'),
value: attr('')
});
6 changes: 3 additions & 3 deletions app/reports/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export default AbstractEditController.extend(PatientSubmodule, PatientDiagnosis,
return result;
}),

nextAppointment: Ember.computed('model.patient.id', 'model.visit.startDate', function() {
let patientId = this.get('model.patient.id');
nextAppointment: Ember.computed('model', function() {
let patientId = this.get('model.visit.patient.id');
let visitDate = this.get('model.visit.startDate');
let maxValue = this.get('maxValue');
let promise = this.store.query('appointment', {
Expand All @@ -38,7 +38,7 @@ export default AbstractEditController.extend(PatientSubmodule, PatientDiagnosis,
if (!futureAppointments.length) {
return '';
}
let [appointment] = [futureAppointments];
let [appointment] = futureAppointments;
let res = appointment.get('startDate');
return res;
});
Expand Down
15 changes: 5 additions & 10 deletions app/reports/edit/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,11 @@
disablePatientLink=model.isNew
}}
{{/if}}
{{#if model.visit.patient.displayPatientId}}
<div class="ps-info-group patient-name print-hide">
<label class="ps-info-label">{{t 'reports.form.patientId' }}</label>
<input class="form-control" value={{model.visit.patient.displayPatientId}}>
</div>
{{/if}}

{{#if model.visit.startDate}}
<div class="ps-info-group">
<label class="ps-info-label">{{t 'reports.form.visitDate' }}</label>
<input class="form-control" value={{date-format model.visit.startDate format="DD/MM/YYYY hh:mm a"}}>
<p class="ps-info-label">{{t 'reports.form.visitDate' }}</p>
{{date-format model.visit.startDate format="DD/MM/YYYY hh:mm a"}}
</div>
{{/if}}

Expand Down Expand Up @@ -82,8 +77,8 @@

{{#if nextAppointment}}
<div class="ps-info-group">
<label class="ps-info-label">{{t 'reports.form.nextAppointmentDate' }}</label>
<input class="form-control" value={{date-format nextAppointment format="DD/MM/YYYY hh:mm a"}}>
<p class="ps-info-label">{{t 'reports.form.nextAppointmentDate' }}</p>
{{date-format nextAppointment format="DD/MM/YYYY hh:mm a"}}
</div>
{{/if}}

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"broccoli-manifest": "0.0.7",
"broccoli-merge-trees": "^1.1.1",
"broccoli-serviceworker": "0.1.4",
"csv-parse": "^1.2.0",
"ember-ajax": "2.5.4",
"ember-browserify": "^1.1.12",
"ember-cli": "2.10.0",
Expand Down