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

Outpatient (OPD) Module #904

Merged
merged 126 commits into from
Dec 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
e72daee
Initial functionality to display visits and checkin patients.
jkleinsc Aug 19, 2016
49dd406
Merge branch 'master' into outpatient
jkleinsc Sep 12, 2016
33d068d
Merge branch 'master' into outpatient
jkleinsc Sep 12, 2016
ca87183
Don't show age if it isn't set
jkleinsc Sep 12, 2016
0e63237
Only show today's outpatients.
jkleinsc Sep 12, 2016
eccc59a
Added visit reason
jkleinsc Sep 12, 2016
690fc4d
Fixed visit edit and changed age display
jkleinsc Sep 12, 2016
e82e8fa
Fixed return to outpatient
jkleinsc Sep 12, 2016
fe8249f
Set end date on outpatient check in.
jkleinsc Sep 12, 2016
b1eec9b
Added tabbed navigation to visits.
jkleinsc Sep 12, 2016
3f59a6c
Fix adding imaging and lab requests from visit.
jkleinsc Sep 13, 2016
3eabf13
New component to show patient orders
jkleinsc Sep 13, 2016
92faaf4
Merge branch 'master' into outpatient
jkleinsc Sep 14, 2016
09abfec
Added filtering to sortable columns
jkleinsc Sep 14, 2016
08a392d
Fixed missing translations
jkleinsc Sep 14, 2016
f90c056
Added sorting and started filtering.
jkleinsc Sep 14, 2016
f94c182
Fixed filter display
jkleinsc Sep 15, 2016
e83224d
Created typeahead filter.
jkleinsc Sep 16, 2016
decab39
Fix issue with idb.filesystem
jkleinsc Sep 19, 2016
ffc5d59
Merge branch 'master' into outpatient
jkleinsc Oct 5, 2016
ff18fff
Added clear for typeahead filter
jkleinsc Oct 5, 2016
603b60c
Fixed menu translation
jkleinsc Oct 5, 2016
9c6df11
Moved filterList to mixin
jkleinsc Oct 5, 2016
10a1f12
Added filtering to outpatient list.
jkleinsc Oct 5, 2016
66229bd
Put back history fields
jkleinsc Oct 5, 2016
2174c99
Don't show charges header on visit
jkleinsc Oct 5, 2016
c1a6774
Fix failing tests.
jkleinsc Oct 5, 2016
2b91d4d
Merge branch 'master' into outpatient
jkleinsc Oct 6, 2016
34ea1b1
Starting changes to show different fields per visit type.
jkleinsc Oct 10, 2016
3125050
Merge branch 'master' into outpatient
jkleinsc Oct 12, 2016
5a5ff17
Merge branch 'master' into outpatient
jkleinsc Oct 12, 2016
33f8da2
Merge branch 'master' into outpatient
jkleinsc Oct 13, 2016
3922e98
Starting work on customizing forms per visit type.
jkleinsc Oct 14, 2016
ef24d80
Added time to lab, imaging, and medication requests.
jkleinsc Oct 18, 2016
d3a11db
Fixed sorting on outpatient list.
jkleinsc Oct 18, 2016
3f6ee23
Added short display name
jkleinsc Oct 21, 2016
2e467ec
Added hasAppointment and hasDoneOrders
jkleinsc Oct 21, 2016
9ec3609
Change to record check in time
jkleinsc Oct 21, 2016
13d048d
Added check in time, has appointment, done orders
jkleinsc Oct 21, 2016
d0ff0c0
Fixed deprecation warning.
jkleinsc Oct 24, 2016
e41078e
Merge branch 'master' into outpatient
jkleinsc Oct 25, 2016
56ba112
Cleaning up layout
jkleinsc Oct 25, 2016
966019b
Set hasAppointment on visit checkin
jkleinsc Oct 25, 2016
65c5d73
Starting work on custom forms editor.
jkleinsc Oct 28, 2016
276aede
Working on custom form editor.
jkleinsc Nov 1, 2016
a396841
Merge branch 'master' into outpatient
jkleinsc Nov 2, 2016
6329d89
Changed to work with new custom-form model.
jkleinsc Nov 2, 2016
0f53066
Added preview and ordering.
jkleinsc Nov 2, 2016
5ed3ea8
Fix error when there are no fields.
jkleinsc Nov 3, 2016
d13fbbb
Fixed colspan layout.
jkleinsc Nov 3, 2016
faeeee9
Fixed column layout
jkleinsc Nov 3, 2016
3cddbea
Added formType and column validation
jkleinsc Nov 3, 2016
1a7faa1
Added index page to list custom forms.
jkleinsc Nov 3, 2016
60a74c4
Added Custom Forms to navigation.
jkleinsc Nov 3, 2016
35e754d
Fixed custom form delete
jkleinsc Nov 3, 2016
13d02d6
Updates for testing.
jkleinsc Nov 10, 2016
5b7a97e
Merge branch 'master' into outpatient
jkleinsc Nov 14, 2016
7df23d6
Finished custom form editor tests
jkleinsc Nov 14, 2016
b8f11aa
Added capability to run store query for additional models.
jkleinsc Nov 17, 2016
3e1c52a
Added custom-form-manager component
jkleinsc Nov 17, 2016
7357aab
Fixed patientVisits computed property
jkleinsc Nov 17, 2016
016cdb0
Added logic to track modifications made to customForms on an object.
jkleinsc Nov 17, 2016
a47fad5
Added custom forms to visit.
jkleinsc Nov 17, 2016
7ba0d4c
Merge branch 'master' into outpatient
jkleinsc Nov 17, 2016
22416a2
Fixed breaking test
jkleinsc Nov 17, 2016
a11646d
Merge branch 'master' into outpatient
jkleinsc Nov 21, 2016
76dbba3
Updated to use npm uuid
jkleinsc Nov 21, 2016
4eb036c
Moving diagnosis to its own model
jkleinsc Nov 22, 2016
35bc613
Merge branch 'master' into outpatient
jkleinsc Nov 23, 2016
3c62a4e
Added logic to edit and delete diagnoses.
jkleinsc Nov 23, 2016
586498b
Changed to disable changing diagnosis on existing record.
jkleinsc Nov 28, 2016
da60ecd
Added logic to copy diagnosis from patient
jkleinsc Nov 28, 2016
47ef2a2
Diagnosis list should be tied to diagnosis model
jkleinsc Nov 28, 2016
5662e95
Added primaryDiagnoses CP to visit.
jkleinsc Nov 28, 2016
5dba8c6
Prod build for testing
jkleinsc Nov 28, 2016
42a6ad6
Fix for model test
jkleinsc Nov 28, 2016
7d735ea
Merge branch 'master' into outpatient
jkleinsc Dec 6, 2016
d798cd7
Replaced observers from patient-submodule mixing.
jkleinsc Dec 6, 2016
a4780ce
Make sure New Patient button shows on patient index page.
jkleinsc Dec 6, 2016
0c7f4be
Fix visit edit to only show checkin on checkin
jkleinsc Dec 6, 2016
72195eb
Fixed error on patient index.
jkleinsc Dec 7, 2016
8b4a935
Fixed checkout action on outpatient.
jkleinsc Dec 7, 2016
31855b1
Made diagnosis async = false
jkleinsc Dec 9, 2016
36d2c5f
Fixed return to patient from visit
jkleinsc Dec 9, 2016
682ea0a
Fix return to outpatient from visit.
jkleinsc Dec 9, 2016
6666615
Changes to make sure visit screen works properly for admissions as we…
jkleinsc Dec 9, 2016
01fb7e9
Allow patient checkin from appointment
jkleinsc Dec 9, 2016
cf49963
Merge branch 'master' into outpatient
jkleinsc Dec 12, 2016
14026a4
Fixed validation when patient is already selected for checkin
jkleinsc Dec 13, 2016
d467a32
Visit checkin from appointment now updates appointment
jkleinsc Dec 13, 2016
fb81c67
Merge branch 'master' into outpatient
jkleinsc Dec 14, 2016
687f5b6
Cleaned up unused data values.
jkleinsc Dec 14, 2016
c4a15c4
Add reason for visit
jkleinsc Dec 14, 2016
3e2eb4b
Merge branch 'master' into outpatient
jkleinsc Dec 14, 2016
ce2b3a7
Merge branch 'master' into outpatient
jkleinsc Dec 14, 2016
024df2a
Set admitted status on admission.
jkleinsc Dec 14, 2016
c8010dc
Only show check in button if patient isn't already checked in.
jkleinsc Dec 14, 2016
b10e8bd
Close modal on diagnosis delete
jkleinsc Dec 14, 2016
6dada6e
Fixed broken tests
jkleinsc Dec 14, 2016
a00d101
Build for testing purposes only.
jkleinsc Dec 14, 2016
a497d43
Merging in master
jkleinsc Dec 16, 2016
c805ef1
Merge branch 'master' into outpatient
jkleinsc Dec 16, 2016
de0f4d0
Fix sex lookup list for patient quick add
jkleinsc Dec 16, 2016
502ed85
Fixed deleting orders/sorting/filtering
jkleinsc Dec 19, 2016
1db6309
Added filters to outpatient screen
jkleinsc Dec 19, 2016
71a71f3
Merge branch 'master' into outpatient
jkleinsc Dec 19, 2016
33a578d
New build for testing
jkleinsc Dec 19, 2016
fc20d3a
Updated allergies/procedures to match with diagnosis layout.
jkleinsc Dec 20, 2016
df35103
Updated tests to include diagnosis.
jkleinsc Dec 20, 2016
def7169
Add updateButtonIcon option to edit panel component.
jkleinsc Dec 20, 2016
4c75438
Add description of dateSetAction
jkleinsc Dec 20, 2016
7567065
Fixes return from visit under certain circumstances
jkleinsc Dec 20, 2016
cdc36c1
Show visit status and discharge/checkout time when applicable.
jkleinsc Dec 20, 2016
cdfbe0a
Normalize how checkin/admission works across the app
jkleinsc Dec 20, 2016
965a75a
Fixed issue when deleting visits.
jkleinsc Dec 20, 2016
f78d8c3
Fixed disabled update button when model isn't valid.
jkleinsc Dec 21, 2016
ed8a341
Make sure visitType isn't set to Admission when checking in from outp…
jkleinsc Dec 21, 2016
099d1af
Add phone and address to patient quick add
jkleinsc Dec 21, 2016
7d78bf6
Added create new patient checkbox for visit
jkleinsc Dec 21, 2016
be7721a
Changed layout to inline search button
jkleinsc Dec 21, 2016
6402ed9
Merge branch 'master' into outpatient
jkleinsc Dec 21, 2016
47b0332
Fixed diagnosis not displaying properly after update
jkleinsc Dec 27, 2016
037d1ae
Fix for getMinPouchId
jkleinsc Dec 27, 2016
ecf855d
Added tests for outpatient.
jkleinsc Dec 27, 2016
0502902
Merge branch 'master' into outpatient
jkleinsc Dec 27, 2016
72071b0
Merge branch 'master' into outpatient
jkleinsc Dec 27, 2016
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
160 changes: 160 additions & 0 deletions app/admin/custom-forms/edit/controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
import AbstractEditController from 'hospitalrun/controllers/abstract-edit-controller';
import Ember from 'ember';
import uuid from 'npm:uuid';

const {
computed,
isEmpty
} = Ember;

export default AbstractEditController.extend({
preview: false,
previewModel: Ember.Object.create(),
updateCapability: 'update_config',

afterUpdate() {
this.displayAlert(this.get('i18n').t('admin.customForms.titles.formSaved'), this.get('i18n').t('admin.customForms.messages.formSaved', this.get('model')));
},

actions: {
addField() {
let newField = this.store.createRecord('custom-field');
this.send('openModal', 'admin.custom-forms.field-edit', newField);
},

deleteField(field) {
let fields = this.get('model.fields');
fields.removeObject(field);
},

editField(field) {
if (isEmpty(field)) {
field = this.store.createRecord('custom-field');
}
this.send('openModal', 'admin.custom-forms.field-edit', field);
},

moveFieldDown(field) {
let fields = this.get('model.fields');
let currentFieldIdx = fields.indexOf(field);
let nextField = fields.objectAt(currentFieldIdx + 1);
fields.replace(currentFieldIdx, 2, [nextField, field]);
},

moveFieldUp(field) {
let fields = this.get('model.fields');
let previousFieldIdx = (fields.indexOf(field) - 1);
let previousField = fields.objectAt(previousFieldIdx);
fields.replace(previousFieldIdx, 2, [field, previousField]);
},

togglePreview() {
this.toggleProperty('preview');
},

updateField(field) {
if (field.get('isNew')) {
this._addNewField(field);
}
this.get('model').save();
}
},

formName: computed('model.name', function() {
let i18n = this.get('i18n');
let formName = this.get('model.name');
if (isEmpty(formName)) {
return i18n.t('admin.customForms.labels.newForm');
} else {
return formName;
}
}),

formTypeValues: [
'patient',
'visit'
],

formTypes: computed(function() {
let i18n = this.get('i18n');
let formTypeValues = this.get('formTypeValues');
return formTypeValues.map((formTypeId) => {
return {
id: formTypeId,
value: i18n.t(`admin.customForms.labels.${formTypeId}FormType`)
};
}).sort(function(a, b) {
return Ember.compare(a.value.toString(), b.value.toString());
});
}),

lastFieldIndex: computed('model.fields.length', function() {
return this.get('model.fields.length') - 1;
}),

fieldTypeLabel(fieldType) {
let i18n = this.get('i18n');
return i18n.t(`admin.customForms.labels.${fieldType}`);
},

_addNewField(field) {
let changedAttributes = field.changedAttributes();
let fieldAttributes = {};
let store = this.get('store');
this._generatePropertyNames(field);
Object.keys(changedAttributes).forEach((attributeName) => {
let [, newValue] = changedAttributes[attributeName];
fieldAttributes[attributeName] = newValue;
});
fieldAttributes.property = field.get('property');
let newField = store.push({
data: {
id: uuid.v4(),
type: 'custom-field',
attributes: fieldAttributes
}
});
let formFields = this.get('model.fields');
formFields.addObject(newField);
},

_generatePropertyNames(field) {
let type = field.get('type');
let propertyName = this._getPropertyName(field);
if (type === 'checkbox') {
let values = field.get('values');
values.forEach((value, index) => {
value.set('property', `${propertyName}${(index + 1)}`);
});
} else {
field.set('property', propertyName);
}
},

_getPropertyName(field) {
let camelizedLabel = field.get('label').camelize();
let labelIndex = 1;
let propertyName = camelizedLabel;
while (this._isPropertyUsed(propertyName) && labelIndex < 10) {
propertyName = `${camelizedLabel}${++labelIndex}`;
}
return propertyName;
},

_isPropertyUsed(propertyName) {
let fields = this.get('model.fields');
let existingProperty = fields.findBy('property', propertyName);
if (!isEmpty(existingProperty)) {
return true;
} else {
let checkboxes = fields.filterBy('type', 'checkbox');
return checkboxes.any((checkbox) =>{
existingProperty = checkbox.get('values').findBy('property', propertyName);
if (!isEmpty(existingProperty)) {
return true;
}
});
}
}

});
14 changes: 14 additions & 0 deletions app/admin/custom-forms/edit/route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import AbstractEditRoute from 'hospitalrun/routes/abstract-edit-route';
import { translationMacro as t } from 'ember-i18n';
export default AbstractEditRoute.extend({
hideNewButton: true,
newTitle: t('admin.customForms.titles.newCustomForm'),
editTitle: t('admin.customForms.titles.editCustomForm'),
modelName: 'custom-form',

actions: {
allItems() {
this.transitionTo('admin.custom-forms');
}
}
});
69 changes: 69 additions & 0 deletions app/admin/custom-forms/edit/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{{#edit-panel editPanelProps=editPanelProps}}
{{#em-form model=model submitButton=false}}
<div class="row">
{{em-input property="name" label=(t 'admin.customForms.labels.formName') class="form-input-group required col-xs-4 custom-form-name"}}
{{em-select class="col-xs-3 form-input-group required custom-form-type" label=(t 'admin.customForms.labels.formType')
property="formType" content=formTypes prompt=" "
}}
{{em-input property="columns" label=(t 'admin.customForms.labels.columns') class="form-input-group col-xs-2 custom-form-columns"}}
</div>
<h4>
{{t 'admin.customForms.titles.fields'}}
<button class="btn btn-default align-right" {{action 'addField'}}>
{{t 'admin.customForms.buttons.addField'}}
</button>
</h4>
<table class="table">
<tr class="table-header">
<th>{{t 'admin.customForms.labels.label'}}</th>
<th>{{t 'labels.type'}}</th>
<th>{{t 'labels.action'}}</th>
</tr>
{{#each model.fields as |field index|}}
<tr>
<td>{{field.label}}</td>
<td>
{{#if field.type}}
{{t (concat 'admin.customForms.labels.' field.type)}}
{{/if}}
</td>
<td>
<button class="btn btn-default warning" {{action "deleteField" field bubbles=false }}>
<span class="octicon octicon-x"></span>{{t "buttons.delete"}}
</button>
<button class="btn btn-default neutral" {{action 'editField' field bubbles=false }}>
{{t 'buttons.edit'}}
</button>
{{#if (not-eq index 0)}}
<button class="btn btn-default neutral" {{action 'moveFieldUp' field bubbles=false }}>
<span class="glyphicon glyphicon-chevron-up" aria-hidden="true"></span>
{{t 'admin.customForms.buttons.moveUp'}}
</button>
{{/if}}
{{#if (lt index lastFieldIndex)}}
<button class="btn btn-default neutral" {{action 'moveFieldDown' field bubbles=false }}>
<span class="glyphicon glyphicon-chevron-down" aria-hidden="true"></span>
{{t 'admin.customForms.buttons.moveDown'}}
</button>
{{/if}}
</td>
</tr>
{{/each}}
</table>
{{/em-form}}
<button class="btn btn-default neutral" {{action 'togglePreview' bubbles=false }}>
{{t 'admin.customForms.buttons.preview'}}
</button>
{{#if preview}}
<div class="panel panel-primary form-preview">
<div class="panel-heading">
<h3 class="panel-title">{{formName}}</h3>
</div>
<div class="panel-body">
{{#em-form model=previewModel submitButton=false}}
{{custom-form model=previewModel form=model}}
{{/em-form}}
</div>
</div>
{{/if}}
{{/edit-panel}}
66 changes: 66 additions & 0 deletions app/admin/custom-forms/field-edit/controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import AbstractEditController from 'hospitalrun/controllers/abstract-edit-controller';
import Ember from 'ember';

const {
computed,
isEmpty
} = Ember;

export default AbstractEditController.extend({
editController: Ember.inject.controller('admin/custom-forms/edit'),
cancelAction: 'closeModal',
i18n: Ember.inject.service(),

actions: {
addValue() {
let fieldValues = this.get('model.values');
if (isEmpty(fieldValues)) {
let model = this.get('model');
fieldValues = [];
model.set('values', fieldValues);
}
fieldValues.addObject(Ember.Object.create());
},

deleteValue(valueToDelete) {
let fieldValues = this.get('model.values');
fieldValues.removeObject(valueToDelete);
},

selectType(fieldType) {
this.get('model').set('type', fieldType);
},

update() {
this.get('editController').send('updateField', this.get('model'));
this.send('closeModal');
}
},

fieldTypeValues: [
'checkbox',
'radio',
'select',
'text',
'textarea'
],

fieldTypes: computed(function() {
let i18n = this.get('i18n');
let fieldTypeValues = this.get('fieldTypeValues');
return fieldTypeValues.map((fieldTypeId) => {
return {
id: fieldTypeId,
value: i18n.t(`admin.customForms.labels.${fieldTypeId}`)
};
}).sort(function(a, b) {
return Ember.compare(a.value.toString(), b.value.toString());
});
}),

showValues: computed('model.type', function() {
let type = this.get('model.type');
return (type === 'checkbox' || type === 'radio' || type === 'select');
})

});
77 changes: 77 additions & 0 deletions app/admin/custom-forms/field-edit/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{{#modal-dialog
isUpdateDisabled=isUpdateDisabled
title=(t (if model.isNew 'admin.lookup.edit.template.addTitle' 'admin.lookup.edit.template.editTitle'))
updateButtonAction=updateButtonAction
updateButtonText= updateButtonText}}
{{#em-form model=model submitButton=false}}
<div class="row">
<div class="form-input-group col-xs-6">
<label for="fieldTypeSelect">{{t 'labels.type'}}</label>
<select onchange={{action 'selectType' value="target.value"}} class="form-control custom-field-select" id="fieldTypeSelect">
<option disabled selected={{is-not model.type}}></option>
{{#each fieldTypes as |fieldType|}}
<option value="{{fieldType.id}}" selected={{eq model.type fieldType.id}}>
{{fieldType.value}}
</option>
{{/each}}
</select>
</div>
{{em-input property="label" class="col-xs-6 required custom-field-label" label=(t 'admin.customForms.labels.label')}}
</div>
<div class="row">
{{em-input property="colSpan" class="col-xs-5 custom-field-colspan" label=(t 'admin.customForms.labels.colSpan')}}
</div>
{{#if showValues}}
<h4>
{{#if (eq model.type 'radio')}}
{{t 'admin.customForms.titles.radioValues'}}
{{/if}}
{{#if (eq model.type 'select')}}
{{t 'admin.customForms.titles.dropDownValues'}}
{{/if}}
{{#if (eq model.type 'checkbox')}}
{{t 'admin.customForms.titles.checkboxValues'}}
{{/if}}
<button class="btn btn-primary align-right" {{action 'addValue'}}>
{{t "buttons.addValue"}}
</button>
</h4>
<table class="table">
<tr class="table-header">
{{#if (eq model.type 'checkbox')}}
<th>{{t 'admin.customForms.labels.label'}}</th>
{{else}}
<th>{{t 'labels.value'}}</th>
{{/if}}
<th>{{t 'labels.action'}}</th>
</tr>
{{#each model.values as |value|}}
<tr>
<td>
{{input value=value.label class="form-control custom-field-value"}}
</td>
<td>
<button class="btn btn-default warning delete-field-value" {{action "deleteValue" value bubbles=false }}>
<span class="octicon octicon-x"></span>{{t "buttons.delete"}}
</button>
</td>
</tr>
{{/each}}
</table>
{{/if}}
{{#if (eq model.type 'radio')}}
<div class="checkbox">
<label>
{{input type="checkbox" checked=model.includeOtherOption}}
{{t 'admin.customForms.labels.includeOtherOption'}}
</label>
</div>
{{#if model.includeOtherOption}}
<div class="form-group">
<label>{{t 'admin.customForms.labels.otherOptionLabel'}}</label>
{{input class="form-control" value=model.otherOptionLabel}}
</div>
{{/if}}
{{/if}}
{{/em-form}}
{{/modal-dialog}}
5 changes: 5 additions & 0 deletions app/admin/custom-forms/index/controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import AbstractPagedController from 'hospitalrun/controllers/abstract-paged-controller';
export default AbstractPagedController.extend({
addPermission: 'update_config',
deletePermission: 'update_config'
});
Loading