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

Visit Reports #991

Merged
merged 121 commits into from
Mar 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
ce9b90d
added basic translations for report
Chima1707 Jan 26, 2017
3dd4032
feat: added report model
Chima1707 Jan 26, 2017
e883089
feat: added report tabs to visit page
Chima1707 Jan 26, 2017
0774d1c
feat: added report route to router
Chima1707 Jan 26, 2017
7d4d07a
feat: added report page
Chima1707 Jan 26, 2017
80de01f
feat: reports to visits children
Chima1707 Jan 26, 2017
1495e89
feat: added add/delete report capabilities
Chima1707 Jan 26, 2017
7c46622
fix: fixed diagnosisContainer issue on browser back history button
Chima1707 Jan 26, 2017
f24c59e
fix: display different report title based on type of visit
Chima1707 Jan 30, 2017
d16bc06
Merge remote-tracking branch 'origin/master' into feat/opd-report
Chima1707 Jan 30, 2017
1107c53
Modified Package.json for new NPM Deployment
mofesola Feb 3, 2017
bf614b5
fix: added next appointment and operative plans to opd form
Chima1707 Feb 6, 2017
63f5571
Merge remote-tracking branch 'origin/dev' into feat/opd-report
Chima1707 Feb 6, 2017
d9268c2
Restore package.json to working state
adeolabadmus Feb 8, 2017
4ab6026
Implement custom forms for OPD Report
adeolabadmus Feb 8, 2017
32bf618
Add custom forms attribute to report model
adeolabadmus Feb 9, 2017
3be61a1
Merge pull request #1 from eHealthAfrica/opd-custom-form
Feb 9, 2017
4e94eae
fix: saved report object
Chima1707 Feb 13, 2017
6da7b88
fix: added preview report feat
Chima1707 Feb 13, 2017
32f96a2
fix: added report by visit view
Chima1707 Feb 15, 2017
dd25475
fix: added logic to show different report sections
Chima1707 Feb 15, 2017
07b23c9
fix: added some report translations
Chima1707 Feb 15, 2017
8ac82d8
fix: edited report model
Chima1707 Feb 15, 2017
f6f2dac
fix: implemented logic to toggle between show report and new report
Chima1707 Feb 15, 2017
1a6c955
Merge outpatient fix from upstream repo
adeolabadmus Feb 16, 2017
ccb0b05
Remove preview functionality from OPD Reports
adeolabadmus Feb 16, 2017
0e49768
Implement print button
adeolabadmus Feb 16, 2017
bac66a6
Remove print section header
adeolabadmus Feb 16, 2017
5b2efbb
Write styles and markup for print page
adeolabadmus Feb 16, 2017
6d6e851
Refactor report header into partial
adeolabadmus Feb 16, 2017
1f85452
Rename report types
adeolabadmus Feb 16, 2017
a9a3159
fix style lint errors
adeolabadmus Feb 17, 2017
c4f497c
Merge pull request #2 from eHealthAfrica/print
Feb 17, 2017
64583f2
fix: completed internationalization and lint fix
Chima1707 Feb 17, 2017
a7ad7f4
0.9.18
mofesola Feb 17, 2017
177f5b4
Incremented version number, added scope
mofesola Feb 17, 2017
b6b70f1
fix: remove patientId field, fixed next appointment bug, removed unus…
Chima1707 Feb 17, 2017
2d8c5c9
fix: change date fields to simple text
Chima1707 Feb 21, 2017
f2be926
Merge remote-tracking branch 'origin/dev' into feat/opd-report
Chima1707 Feb 21, 2017
a8341e4
Merge remote-tracking branch 'hospital-run/master' into feat/opd-report
Chima1707 Feb 21, 2017
f8859de
Merge pull request #5 from eHealthAfrica/feat/opd-report
adeolabadmus Feb 21, 2017
bf79a5c
fix: fixed bug that has to do with page header title
Chima1707 Feb 21, 2017
9334afb
Added .travis.yml file for building and deploying to npm
mofesola Feb 21, 2017
41f9ef6
Merge pull request #14 from eHealthAfrica/conf/deploy
mofesola Feb 21, 2017
da5668f
Removed ember test. Pretty much does the same as npm test
mofesola Feb 21, 2017
7106cfa
Merge pull request #15 from eHealthAfrica/conf/deploy
mofesola Feb 21, 2017
fdfa21e
Allowing all branches to be tested and built
mofesola Feb 21, 2017
be9b666
Merge pull request #16 from eHealthAfrica/conf/deploy
mofesola Feb 21, 2017
0b0b761
fix: added translations for discharge report
Chima1707 Feb 22, 2017
6a2e480
fix: modified report model to accommodate discharge report
Chima1707 Feb 22, 2017
3c6cb9e
fix: added discharge report
Chima1707 Feb 22, 2017
a0c3ddf
fix: added next appointment date to discharge report on save
Chima1707 Feb 22, 2017
bd2b0d4
fix: implemented next appointment as a mixin
Chima1707 Feb 22, 2017
1cf8534
fix: added translations for followup appointment message
Chima1707 Feb 22, 2017
d0140b3
fix: made sure a followup appointment exists before you generate disc…
Chima1707 Feb 22, 2017
169b268
Merge remote-tracking branch 'origin/dev' into feat/discharge-report
Chima1707 Feb 22, 2017
29795ac
Add Hospital Info report header as option config
adeolabadmus Feb 22, 2017
16ba110
Merge pull request #17 from eHealthAfrica/hospital-config
adeolabadmus Feb 23, 2017
2077532
Add report model to patient-diagnosis and visit unit tests
adeolabadmus Feb 23, 2017
238d590
Merge pull request #18 from eHealthAfrica/fix-test
adeolabadmus Feb 23, 2017
1a0fcf1
Merge remote-tracking branch 'origin/dev' into feat/discharge-report
Chima1707 Feb 23, 2017
d35a8a9
fix: fixed report header conflict
Chima1707 Feb 23, 2017
edb0ef3
Refactor report template
adeolabadmus Feb 23, 2017
2db7c32
Add custom forms to discharge report
adeolabadmus Feb 23, 2017
f1cd0e4
Merge pull request #13 from eHealthAfrica/feat/discharge-report
Feb 23, 2017
4662424
fix: added hospital info doc to environment
Chima1707 Feb 23, 2017
d98df0d
fix: create sample docs on couchdb
Chima1707 Feb 23, 2017
32d0deb
Merge remote-tracking branch 'origin/dev' into feat/discharge-report
Chima1707 Feb 23, 2017
ed34c53
Change how "new" routes work
jkleinsc Feb 22, 2017
4a20709
fix: made sure sample docs are created when deleted
Chima1707 Feb 23, 2017
59b3b30
Add query parameters to improve app navigation experience
adeolabadmus Feb 24, 2017
dd9ce6b
set patient on visit models
adeolabadmus Feb 24, 2017
7d439f0
Redirect reports/new to patients when no visit model
adeolabadmus Feb 24, 2017
dd89556
Clean up visit controller
adeolabadmus Feb 24, 2017
012f7d5
Set visit on models
adeolabadmus Feb 24, 2017
4834a44
Update visit acceptance tests
adeolabadmus Feb 24, 2017
67670f6
Fix appointments new surgery test error
adeolabadmus Feb 24, 2017
8c0387a
Remove double reference to visits controller
adeolabadmus Feb 26, 2017
a38f060
Display visit diagnosis appropriately
adeolabadmus Feb 26, 2017
62c4dce
Fix Operative Plans display
adeolabadmus Feb 26, 2017
a015ed2
Merge pull request #22 from eHealthAfrica/fix-report-diagnosis
Feb 27, 2017
74f1819
Merge pull request #23 from eHealthAfrica/fix-operative-plan
Feb 27, 2017
4de70c2
Merge pull request #20 from eHealthAfrica/fix-new-route
Feb 27, 2017
3314ee2
Merge pull request #19 from eHealthAfrica/feat/discharge-report
adeolabadmus Feb 27, 2017
df81a13
fix: fixed translation lables for next appointments
Chima1707 Mar 2, 2017
de35e44
fix: modified get futureAppointment to work for list of appointments
Chima1707 Mar 2, 2017
bbdbd65
fix: implemented next appointments on both template and controller
Chima1707 Mar 2, 2017
f91decc
fix: fix lint
Chima1707 Mar 2, 2017
9765327
FIx next appointments display
adeolabadmus Mar 2, 2017
6ce8d23
Merge pull request #25 from eHealthAfrica/feat/nextAppointment
adeolabadmus Mar 2, 2017
cc260dd
Added auto trigger hospitalrun-server refresh script on successful build
mofesola Mar 2, 2017
191aef1
Merge pull request #26 from eHealthAfrica/conf/deploy
mofesola Mar 2, 2017
cda4799
Fix reports controller bug
adeolabadmus Mar 2, 2017
397fb9a
Add diagnosis container
adeolabadmus Mar 2, 2017
897e380
Set patient on model if model is not new
adeolabadmus Mar 2, 2017
1d3302a
Set visit on controller and add display current operative plan
adeolabadmus Mar 2, 2017
fbfa8b7
Add `Completed By` field to report
adeolabadmus Mar 2, 2017
c276e9c
Refactor reports template
adeolabadmus Mar 2, 2017
31d8c33
Ensure reports.edit returns to visits.edit
adeolabadmus Mar 2, 2017
ac20a24
Display patient procedures on report
adeolabadmus Mar 3, 2017
22e4f62
Merge pull request #28 from eHealthAfrica/patient-procedures
Mar 3, 2017
d4bbd83
Remove discharge report compulsory next appointment modal
adeolabadmus Mar 7, 2017
f0ee0b3
Fix `completed by` on report page
adeolabadmus Mar 7, 2017
c1f82b0
Style select element properly; Add titles to report
adeolabadmus Mar 7, 2017
ac35a25
fix: fix new user title bug after a new user has been added
Chima1707 Mar 7, 2017
2d78c4a
Merge pull request #29 from eHealthAfrica/retro-fix
adeolabadmus Mar 7, 2017
a85da20
Merge pull request #30 from eHealthAfrica/fix/user
adeolabadmus Mar 7, 2017
3241938
Added deploy branches to .travis.yml
mofesola Mar 8, 2017
7575a2b
Merge pull request #32 from eHealthAfrica/conf/deploy
mofesola Mar 8, 2017
b7bbbc7
fix: fix test for new user title bug
Chima1707 Mar 9, 2017
b751d50
Merge pull request #36 from eHealthAfrica/fix/user-edit-title-test
adeolabadmus Mar 9, 2017
3d12782
fix: updated report template with testing attributes on fields
Chima1707 Mar 10, 2017
299aa25
fix: update visit template with testing attributes on fields
Chima1707 Mar 10, 2017
e94be73
fix: implemented acceptance tests for opd and discharge reports
Chima1707 Mar 10, 2017
2163458
Merge remote-tracking branch 'origin/dev' into fix/report-acceptance-…
Chima1707 Mar 10, 2017
79d52a4
Implement acceptance tests for OPD Report
adeolabadmus Mar 14, 2017
e2d8131
Merge pull request #37 from eHealthAfrica/fix/report-acceptance-tests
adeolabadmus Mar 14, 2017
ad1d00e
Merge remote-tracking branch 'upstream/master' into refactor-code
adeolabadmus Mar 14, 2017
7895b24
Refactor code to conform with style guide
adeolabadmus Mar 14, 2017
6463268
Fix nextAppointment bug
adeolabadmus Mar 15, 2017
d9e1baf
Merge pull request #38 from eHealthAfrica/refactor-code
Mar 15, 2017
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
4 changes: 3 additions & 1 deletion app/admin/custom-forms/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ export default AbstractEditController.extend({
'operativePlan',
'patient',
'socialwork',
'visit'
'visit',
'opdReport',
'dischargeReport'
],

formTypes: computed(function() {
Expand Down
4 changes: 4 additions & 0 deletions app/appointments/edit/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const {
} = Ember;

export default AbstractEditRoute.extend(AddToPatientRoute, PatientListRoute, {

editTitle: t('appointments.editTitle'),
modelName: 'appointment',
newButtonText: t('appointments.buttons.newButton'),
Expand Down Expand Up @@ -59,6 +60,9 @@ export default AbstractEditRoute.extend(AddToPatientRoute, PatientListRoute, {
if (!isEmpty(params.forPatientId)) {
let modelPromise = this._super(params);
return this._setPatientOnModel(modelPromise, params.forPatientId);
} else if (!isEmpty(params.forVisitId)) {
let modelPromise = this._super(params);
return this._setVisitOnModel(modelPromise, params.forVisitId);
} else {
return this._createNewRecord(params);
}
Expand Down
3 changes: 3 additions & 0 deletions app/helpers/date-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export default Ember.Helper.helper(function(params, hash) {
if (hash && hash.format) {
dateFormat = hash.format;
}
if (date && typeof date.get == 'function') {
date = date.get('content');
}
return moment(date).format(dateFormat);
}
});
61 changes: 58 additions & 3 deletions app/locales/en/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ export default {
socialworkFormType: 'Social Work',
text: 'Text',
textarea: 'Large Text',
visitFormType: 'Visit'
visitFormType: 'Visit',
opdReportFormType: 'Outpatient Report',
dischargeReportFormType: 'Discharge Report'
},
messages: {
deleteForm: 'Are you sure you want to delete this custom form?',
Expand Down Expand Up @@ -994,14 +996,16 @@ export default {
statusDischarged: 'Discharged',
statusCheckedIn: 'Checked In',
statusCheckedOut: 'Checked Out',
createNewPatient: 'Create New Patient'
createNewPatient: 'Create New Patient',
reportType: 'Report type'
},
navigation: {
charges: 'Charges',
notes: 'Notes',
orders: 'Orders',
procedures: 'Procedures',
vitals: 'Vitals'
vitals: 'Vitals',
reports: 'Reports'
}
},
labs: {
Expand Down Expand Up @@ -1105,6 +1109,8 @@ export default {
backToPatients: 'Back to Patient List',
newPatient: '+ new patient',
patientCheckIn: 'Patient Check In',
newOPDReport: 'New OPD Report',
newDischargeReport: 'New Discharge Report',
scheduleSurgery: 'Schedule Surgery'
},
labels: {
Expand Down Expand Up @@ -1234,6 +1240,55 @@ export default {
addMedication: 'Add Medication'
}
},
reports: {
titles: {
saved: 'Report saved',
opdTitle: 'OPD Report',
dischargeReport: 'Discharge Report'
},
form: {
visitDate: 'Date of Visit',
admissionDate: 'Admission Date',
dischargeDate: 'Discharge Date',
notes: {
title: 'Notes',
date: 'Date',
author: 'Author'
},
primaryDiagnosis: 'Primary Diagnosis',
secondaryDiagnosis: 'Secondary Diagnosis',
procedures: 'Procedures',
allProcedures: 'All Procedures Performed',
labs: 'Labs',
images: 'Images',
medications: 'Medications',
nextAppointment: 'Next Appointment',
nextAppointments: 'Next Appointments',
operativePlan: {
title: 'Operative Plan',
description: 'Operation Description',
procedures: 'Planned Procedures',
instructions: 'Instructions upon Admission'
},
completedBy: 'Completed By'
},
opd: {
titles: {
new: 'New OPD Report',
edit: 'Edit OPD Report'
}
},
discharge: {
titles: {
new: 'New Discharge Report',
edit: 'Edit Discharge Report'
}
},
messages: {
delete: 'Are you sure you wish to delete this report?',
saved: 'The report has been saved.'
}
},
components: {
chargesByTypeTab: {
charges: 'charges'
Expand Down
2 changes: 1 addition & 1 deletion app/medication/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default AbstractEditController.extend(AddNewPatient, FulfillRequest, Inve
prescriptionClass: function() {
let quantity = this.get('model.quantity');
if (Ember.isEmpty(quantity)) {
return 'required';
return 'required test-medication-prescription';
}
}.property('model.quantity'),

Expand Down
2 changes: 2 additions & 0 deletions app/medication/edit/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export default AbstractEditRoute.extend(AddToPatientRoute, FulfillRequest, Inven
if (!Ember.isEmpty(idParam) && params[idParam] === 'new' || params[idParam] === 'dispense') {
if (!isEmpty(params.forPatientId)) {
return this._setPatientOnModel(modelPromise, params.forPatientId);
} else if (!isEmpty(params.forVisitId)) {
return this._setVisitOnModel(modelPromise, params.forVisitId);
} else {
return this._createNewRecord(params);
}
Expand Down
29 changes: 27 additions & 2 deletions app/mixins/add-to-patient-route.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,23 @@ export default Mixin.create({
queryParams: {
forPatientId: {
refreshModel: false
},
forVisitId: {
refreshModel: false
}
},

model(params) {
let idParam = get(this, 'idParam');
let modelPromise = this._super(params);
if (!isEmpty(params.forPatientId) && params[idParam] === 'new') {
return this._setPatientOnModel(modelPromise, params.forPatientId);
if (params[idParam] === 'new') {
if (!isEmpty(params.forPatientId)) {
return this._setPatientOnModel(modelPromise, params.forPatientId);
} else if (!isEmpty(params.forVisitId)) {
return this._setVisitOnModel(modelPromise, params.forVisitId);
} else {
return this._createNewRecord(params);
}
} else {
return modelPromise;
}
Expand All @@ -32,5 +41,21 @@ export default Mixin.create({
return model;
});
});
},

/**
* Resolves the model promise and then sets the visit information on the model.
*/
_setVisitOnModel(modelPromise, visitId) {
let store = get(this, 'store');
return modelPromise.then((model) => {
return store.find('visit', visitId).then((visit) => {
model.set('visit', visit);
model.set('returnToVisit', visitId);
model.set('selectPatient', false);
model.set('patient', visit.get('patient'));
return model;
});
});
}
});
12 changes: 12 additions & 0 deletions app/mixins/patient-submodule.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,17 @@ export default Ember.Mixin.create(PatientVisits, {
});
}.property('model.patient.id', 'newVisitAdded'),

patientProcedures: Ember.computed('patientVisits.[]', function() {
let patient = get(this, 'model.patient');
return DS.PromiseArray.create({
promise: get(this, 'patientVisits').then((patientVisits) => {
return get(patient, 'operationReports').then((operationReports) => {
return this._getPatientProcedures(operationReports, patientVisits);
});
})
});
}),

patientVisitsForSelect: function() {
return DS.PromiseArray.create({
promise: this.get('patientVisits').then(function(patientVisits) {
Expand Down Expand Up @@ -227,6 +238,7 @@ export default Ember.Mixin.create(PatientVisits, {
promises.push(visit.get('medication'));
promises.push(visit.get('procedures'));
promises.push(visit.get('vitals'));
promises.push(visit.get('reports'));
}
return promises;
},
Expand Down
63 changes: 61 additions & 2 deletions app/mixins/patient-visits.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import Ember from 'ember';
import PouchDbMixin from 'hospitalrun/mixins/pouchdb';
import VisitStatus from 'hospitalrun/utils/visit-statuses';

import DS from 'ember-data';
import moment from 'moment';
const {
isEmpty
isEmpty,
get
} = Ember;

export default Ember.Mixin.create(PouchDbMixin, {
Expand All @@ -20,6 +22,63 @@ export default Ember.Mixin.create(PouchDbMixin, {
});
},

getPatientFutureAppointment(visit, outPatient) {
let patientId = get(visit, 'patient.id');
let visitDate = get(visit, 'startDate');
let maxValue = get(this, 'maxValue');
let promise = this.store.query('appointment', {
options: {
startkey: [patientId, null, null, 'appointment_'],
endkey: [patientId, maxValue, maxValue, maxValue]
},
mapReduce: 'appointments_by_patient'
}).then(function(result) {
let futureAppointments = result.filter(function(data) {
let startDate = get(data, 'startDate');
return startDate && moment(startDate).isAfter(moment(visitDate), 'day');
}).sortBy('startDate');
if (!futureAppointments.length) {
return null;
}
if (!outPatient) {
let [appointment] = futureAppointments;
return appointment;
} else {
return futureAppointments.slice(0, 3);
}

});
return (outPatient) ? DS.PromiseArray.create({ promise }) : DS.PromiseObject.create({ promise });
},

_getVisitCollection(visits, name) {
let returnList = [];
if (!Ember.isEmpty(visits)) {
visits.forEach(function(visit) {
get(visit, name).then(function(items) {
returnList.addObjects(items);
});
});
}
return returnList;
},

_getPatientProcedures(operationReports, visits) {
let patientProcedures = this._getVisitCollection(visits, 'procedures');
operationReports.forEach((report) => {
let reportedProcedures = get(report, 'procedures');
let surgeryDate = get(report, 'surgeryDate');
reportedProcedures.forEach((procedure) => {
patientProcedures.addObject({
description: get(procedure, 'description'),
procedureDate: surgeryDate,
report
});
});
});
return patientProcedures;
},

checkoutVisit(visit, status) {
visit.set('status', status);
visit.set('endDate', new Date());
Expand Down
17 changes: 17 additions & 0 deletions app/mixins/user-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@ export default Ember.Mixin.create({
'Nurse Manager',
'System Administrator'
],
add_report: [
'Data Entry',
'Doctor',
'Hospital Administrator',
'Medical Records Officer',
'Nurse',
'Nurse Manager',
'System Administrator'
],
admit_patient: [
'Data Entry',
'Doctor',
Expand Down Expand Up @@ -324,6 +333,14 @@ export default Ember.Mixin.create({
'Nurse Manager',
'System Administrator'
],
delete_report: [
'Doctor',
'Hospital Administrator',
'Medical Records Officer',
'Nurse',
'Nurse Manager',
'System Administrator'
],
delete_visit: [
'Doctor',
'Hospital Administrator',
Expand Down
32 changes: 32 additions & 0 deletions app/models/report.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import AbstractModel from 'hospitalrun/models/abstract';
import DS from 'ember-data';

export default AbstractModel.extend({
// Attributes
reportDate: DS.attr('date'),
customForms: DS.attr('custom-forms'),
reportType: DS.attr('string'),
surgeon: DS.attr('string'),

// Associations
visit: DS.belongsTo('visit', { async: false }),

validations: {
visit: {
presence: true
},

reportDate: {
presence: true
},

surgeon: {
presence: {
'if'(object) {
return !object.get('visit.outPatient');
},
message: 'Please select a surgeon'
}
}
}
});
1 change: 1 addition & 0 deletions app/models/visit.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export default AbstractModel.extend({
status: DS.attr('string'),
visitType: DS.attr(),
vitals: DS.hasMany('vital', { async: true }),
reports: DS.hasMany('report', { async: true }),

diagnosisList: computed('diagnoses.[]', function() {
let diagnoses = this.get('diagnoses');
Expand Down
Loading