"use strict";

/* jshint ignore:start */



/* jshint ignore:end */

define('hospitalrun/adapters/application', ['exports', 'hospitalrun/mixins/check-for-errors', 'ember', 'npm:uuid', 'ember-concurrency-test-waiter/with-test-waiter', 'ember-pouch', 'ember-concurrency'], function (exports, _hospitalrunMixinsCheckForErrors, _ember, _npmUuid, _emberConcurrencyTestWaiterWithTestWaiter, _emberPouch, _emberConcurrency) {
  var reads = _ember['default'].computed.reads;
  var get = _ember['default'].get;
  var bind = _ember['default'].run.bind;
  exports['default'] = _emberPouch.Adapter.extend(_hospitalrunMixinsCheckForErrors['default'], {
    ajax: _ember['default'].inject.service(),
    database: _ember['default'].inject.service(),
    db: reads('database.mainDB'),
    usePouchFind: reads('database.usePouchFind'),

    _specialQueries: ['containsValue', 'mapReduce'],

    _esDefaultSize: 25,

    _executeContainsSearch: function _executeContainsSearch(store, type, query) {
      var _this = this;

      var usePouchFind = get(this, 'usePouchFind');
      if (usePouchFind) {
        return this._executePouchDBFind(store, type, query);
      }
      var typeName = this.getRecordTypeName(type);
      var searchUrl = '/search/hrdb/' + typeName + '/_search';
      if (query.containsValue && query.containsValue.value) {
        var _ret = (function () {
          var queryString = '';
          query.containsValue.keys.forEach(function (key) {
            if (!_ember['default'].isEmpty(queryString)) {
              queryString = queryString + ' OR ';
            }
            var queryValue = query.containsValue.value;
            switch (key.type) {
              case 'contains':
                {
                  queryValue = '*' + queryValue + '*';
                  break;
                }
              case 'fuzzy':
                {
                  queryValue = queryValue + '~';
                  break;
                }
            }
            queryString = queryString + 'data.' + key.name + ':' + queryValue;
          });
          var ajax = get(_this, 'ajax');
          if (_ember['default'].isEmpty(query.size)) {
            query.size = _this.get('_esDefaultSize');
          }

          return {
            v: ajax.request(searchUrl, {
              dataType: 'json',
              data: {
                q: queryString,
                size: _this.get('_esDefaultSize')
              }
            }).then(function (results) {
              if (results && results.hits && results.hits.hits) {
                var resultDocs = _ember['default'].A(results.hits.hits).map(function (hit) {
                  var mappedResult = hit._source;
                  mappedResult.id = hit._id;
                  return mappedResult;
                });
                var response = {
                  rows: resultDocs
                };
                return _this._handleQueryResponse(response, store, type);
              } else if (results.rows) {
                return _this._handleQueryResponse(results, store, type);
              } else {
                throw new Error('Search results are not valid');
              }
            })['catch'](function () {
              // Try pouch db find if ajax fails
              return _this._executePouchDBFind(store, type, query);
            })
          };
        })();

        if (typeof _ret === 'object') return _ret.v;
      } else {
        throw new Error('invalid query');
      }
    },

    _executePouchDBFind: function _executePouchDBFind(store, type, query) {
      this._init(store, type);
      var db = this.get('db');
      var recordTypeName = this.getRecordTypeName(type);
      var queryParams = {
        selector: {
          $or: []
        }
      };
      if (query.containsValue && query.containsValue.value) {
        (function () {
          var regexp = new RegExp(query.containsValue.value, 'i');
          query.containsValue.keys.forEach(function (key) {
            var subQuery = {};
            subQuery['data.' + key.name] = { $regex: regexp };
            queryParams.selector.$or.push(subQuery);
          });
        })();
      }

      return db.find(queryParams).then(function (pouchRes) {
        return db.rel.parseRelDocs(recordTypeName, pouchRes.docs);
      });
    },

    _handleQueryResponse: function _handleQueryResponse(response, store, type) {
      var _this2 = this;

      var database = this.get('database');
      return new _ember['default'].RSVP.Promise(function (resolve, reject) {
        if (response.rows.length > 0) {
          (function () {
            var ids = response.rows.map(function (row) {
              return database.getEmberId(row.id);
            });
            _this2.findRecord(store, type, ids).then(function (findResponse) {
              var primaryRecordName = type.modelName.camelize().pluralize();
              var sortedValues = [];
              // Sort response in order of ids
              ids.forEach(function (id) {
                var resolvedRecord = findResponse[primaryRecordName].findBy('id', id);
                sortedValues.push(resolvedRecord);
              });
              findResponse[primaryRecordName] = sortedValues;
              resolve(findResponse);
            }, reject);
          })();
        } else {
          var emptyResponse = {};
          emptyResponse[type.modelName] = [];
          resolve(emptyResponse);
        }
      });
    },

    /**
     * @private
     * Look for nulls and maxvalues in start key because those keys can't be handled by the sort/list function
     */
    _doesStartKeyContainSpecialCharacters: function _doesStartKeyContainSpecialCharacters(startkey) {
      var haveSpecialCharacters = false;
      var maxValue = this.get('maxValue');
      if (!_ember['default'].isEmpty(startkey) && _ember['default'].isArray(startkey)) {
        startkey.forEach(function (keyvalue) {
          if (keyvalue === null || keyvalue === maxValue) {
            haveSpecialCharacters = true;
          }
        });
      }
      return haveSpecialCharacters;
    },

    _startChangesToStoreListener: function _startChangesToStoreListener() {
      var db = this.get('db');
      if (db) {
        this.changes = db.changes({
          since: 'now',
          live: true,
          returnDocs: false
        }).on('change', bind(this, 'onChange')).on('error', _ember['default'].K); // Change sometimes throws weird 500 errors that we can ignore
        db.changesListener = this.changes;
      }
    },

    generateIdForRecord: function generateIdForRecord() {
      return _npmUuid['default'].v4();
    },

    query: function query(store, type, _query, options) {
      var _this3 = this;

      var specialQuery = false;
      for (var i = 0; i < this._specialQueries.length; i++) {
        if (_ember['default'].get(_query, this._specialQueries[i])) {
          specialQuery = true;
          break;
        }
      }

      if (!specialQuery) {
        if (_query.options) {
          this._init(store, type);
          var recordTypeName = this.getRecordTypeName(type);
          return this.get('db').rel.find(recordTypeName, _query.options);
        } else {
          return this._super(store, type, _query, options);
        }
      } else {
        var _ret4 = (function () {
          var mapReduce = null;
          var queryParams = {};
          if (_query.options) {
            queryParams = _ember['default'].copy(_query.options);
            if (_query.sortKey || _query.filterBy) {
              if (_query.sortDesc) {
                queryParams.sortDesc = _query.sortDesc;
              }
              if (_query.sortKey) {
                queryParams.sortKey = _query.sortKey;
              }
              if (!_this3._doesStartKeyContainSpecialCharacters(queryParams.startkey)) {
                queryParams.sortLimit = queryParams.limit;
                delete queryParams.limit;
                queryParams.sortStartKey = JSON.stringify(queryParams.startkey);
                delete queryParams.startkey;
              } else if (queryParams.startkey) {
                queryParams.startkey = JSON.stringify(queryParams.startkey);
              }
              if (_query.filterBy) {
                queryParams.filterBy = JSON.stringify(_query.filterBy);
              }
              if (queryParams.endkey) {
                queryParams.endkey = JSON.stringify(queryParams.endkey);
              }
              _query.useList = true;
            }
          }
          queryParams.reduce = false;
          queryParams.include_docs = false;
          if (_query.mapReduce) {
            mapReduce = _query.mapReduce;
          } else if (_query.containsValue) {
            return {
              v: _this3._executeContainsSearch(store, type, _query)
            };
          }
          var database = get(_this3, 'database');
          return {
            v: new _ember['default'].RSVP.Promise(function (resolve, reject) {
              var db = _this3.get('db');
              try {
                if (mapReduce) {
                  if (_query.useList) {
                    queryParams.include_docs = true;
                    var listParams = {
                      query: queryParams
                    };
                    db.list(mapReduce + '/sort/' + mapReduce, listParams, function (err, response) {
                      if (err) {
                        reject(database.handleErrorResponse(err));
                      } else {
                        var responseJSON = JSON.parse(response.body);
                        _this3._handleQueryResponse(responseJSON, store, type).then(resolve, reject);
                      }
                    });
                  } else {
                    db.query(mapReduce, queryParams, function (err, response) {
                      if (err) {
                        reject(database.handleErrorResponse(err));
                      } else {
                        _this3._handleQueryResponse(response, store, type).then(resolve, reject);
                      }
                    });
                  }
                } else {
                  db.allDocs(queryParams, function (err, response) {
                    if (err) {
                      reject(database.handleErrorResponse(err));
                    } else {
                      _this3._handleQueryResponse(response, store, type).then(resolve, reject);
                    }
                  });
                }
              } catch (err) {
                reject(database.handleErrorResponse(err));
              }
            }, 'findQuery in application-pouchdb-adapter')
          };
        })();

        if (typeof _ret4 === 'object') return _ret4.v;
      }
    },

    createRecord: function createRecord(store, type, record) {
      return this._checkForErrors(this._super(store, type, record));
    },

    findAll: function findAll(store, type) {
      return this._checkForErrors(this._super(store, type));
    },

    findMany: function findMany(store, type, ids) {
      return this._checkForErrors(this._super(store, type, ids));
    },

    findHasMany: function findHasMany(store, record, link, rel) {
      return this._checkForErrors(this._super(store, record, link, rel));
    },

    findRecord: function findRecord(store, type, id) {
      return this._checkForErrors(this._super(store, type, id));
    },

    updateRecord: function updateRecord(store, type, record) {
      return this._checkForErrors(this._super(store, type, record));
    },

    deleteRecord: function deleteRecord(store, type, record) {
      return this._checkForErrors(this._super(store, type, record));
    },

    checkForErrorsTask: (0, _emberConcurrencyTestWaiterWithTestWaiter['default'])((0, _emberConcurrency.task)(regeneratorRuntime.mark(function callee$0$0(callPromise) {
      return regeneratorRuntime.wrap(function callee$0$0$(context$1$0) {
        var _this4 = this;

        while (1) switch (context$1$0.prev = context$1$0.next) {
          case 0:
            context$1$0.next = 2;
            return new _ember['default'].RSVP.Promise(function (resolve, reject) {
              callPromise.then(resolve, function (err) {
                var database = get(_this4, 'database');
                reject(database.handleErrorResponse(err));
              });
            });

          case 2:
            return context$1$0.abrupt('return', context$1$0.sent);

          case 3:
          case 'end':
            return context$1$0.stop();
        }
      }, callee$0$0, this);
    }))),

    _checkForErrors: function _checkForErrors(callPromise) {
      return get(this, 'checkForErrorsTask').perform(callPromise);
    }

  });
});
define('hospitalrun/adapters/user', ['exports', 'ember', 'hospitalrun/mixins/check-for-errors', 'ember-data', 'hospitalrun/mixins/user-session'], function (exports, _ember, _hospitalrunMixinsCheckForErrors, _emberData, _hospitalrunMixinsUserSession) {

  var ENDPOINT = '/db/_users/';

  var RESTAdapter = _emberData['default'].RESTAdapter;
  var computed = _ember['default'].computed;
  var alias = _ember['default'].computed.alias;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  exports['default'] = RESTAdapter.extend(_hospitalrunMixinsCheckForErrors['default'], _hospitalrunMixinsUserSession['default'], {
    defaultSerializer: 'couchdb',

    config: inject.service(),
    database: inject.service(),
    session: inject.service(),

    oauthHeaders: alias('database.oauthHeaders'),
    standAlone: alias('config.standAlone'),
    usersDB: alias('database.usersDB'),

    headers: computed('oauthHeaders', function () {
      var oauthHeaders = get(this, 'oauthHeaders');
      if (_ember['default'].isEmpty(oauthHeaders)) {
        return {};
      } else {
        return oauthHeaders;
      }
    }),

    ajaxError: function ajaxError(jqXHR) {
      var error = this._super(jqXHR);
      if (jqXHR && jqXHR.status === 401) {
        var jsonErrors = _ember['default'].$.parseJSON(jqXHR.responseText);
        window.Hospitalrun.__container__.lookup('controller:application').transitionToRoute('login');
        return new _emberData['default'].InvalidError(jsonErrors);
      } else {
        return error;
      }
    },

    /**
    @method ajaxOptions Overriden here so that we can specify xhr with credentials
    @private
    @param {String} url
    @param {String} type The request type GET, POST, PUT, DELETE etc.
    @param {Object} options
    @return {Object} hash
    */
    ajaxOptions: function ajaxOptions(url, type, options) {
      options = options || {};
      options.xhrFields = { withCredentials: true };
      return this._super(url, type, options);
    },

    /**
      Called by the store when a newly created record is
      saved via the `save` method on a model record instance.
      The `createRecord` method serializes the record and makes an Ajax (HTTP POST) request
      to a URL computed by `buildURL`.
      See `serialize` for information on how to customize the serialized form
      of a record.
      @method createRecord
      @param {DS.Store} store
      @param {DS.Model} type
      @param {DS.Snapshot} snapshot
      @return {Promise} promise
    */
    createRecord: function createRecord(store, type, snapshot) {
      return this.updateRecord(store, type, snapshot);
    },

    /**
      Called by the store when a record is deleted.
      The `deleteRecord` method  makes an Ajax (HTTP DELETE) request to a URL computed by `buildURL`.
      @method deleteRecord
      @param {DS.Store} store
      @param {DS.Model} type
      @param {DS.Snapshot} snapshot
      @return {Promise} promise
    */
    deleteRecord: function deleteRecord(store, type, snapshot) {
      return this.updateRecord(store, type, snapshot, true);
    },

    /**
      Called by the store in order to fetch the JSON for a given
      type and ID.
      The `findRecord` method makes an Ajax request to a URL computed by
      `buildURL`, and returns a promise for the resulting payload.
      This method performs an HTTP `GET` request with the id provided as part of the query string.
      @since 1.13.0
      @method findRecord
      @param {DS.Store} store
      @param {DS.Model} type
      @param {String} id
      @param {DS.Snapshot} snapshot
      @return {Promise} promise
    */
    findRecord: function findRecord(store, type, id, snapshot) {
      if (get(this, 'standAlone') === true) {
        return this._offlineFind(id);
      } else {
        return this._checkForErrors(this._super(store, type, id, snapshot));
      }
    },

    /**
      Called by the store in order to fetch a JSON array for all
      of the records for a given type.
      The `findAll` method makes an Ajax (HTTP GET) request to a URL computed by `buildURL`, and returns a
      promise for the resulting payload.
      @method findAll
      @param {DS.Store} store
      @param {DS.Model} type
      @param {String} sinceToken
      @param {DS.SnapshotRecordArray} snapshotRecordArray
      @return {Promise} promise
    */
    findAll: function findAll(store, type, sinceToken, snapshotRecordArray) {
      var ajaxData = {
        data: {
          include_docs: true,
          startkey: '"org.couchdb.user"'
        }
      };
      if (get(this, 'standAlone') === true) {
        return this._offlineFindAll(ajaxData.data);
      } else {
        var url = this.buildURL(type.modelName, null, snapshotRecordArray, 'findAll');
        return this._checkForErrors(this.ajax(url, 'GET', ajaxData));
      }
    },

    shouldReloadAll: function shouldReloadAll() {
      return true;
    },

    /**
     Called by the store when an existing record is saved
     via the `save` method on a model record instance.
      The `updateRecord` method serializes the record and makes an Ajax (HTTP PUT) request
     to a URL computed by `buildURL`.
      See `serialize` for information on how to customize the serialized form
     of a record.
      @method updateRecord
     @param {DS.Store} store
     @param {subclass of DS.Model} type
     @param {DS.Snapshot} record
     @param {boolean} deleteUser true if we are deleting the user.
     @returns {Promise} promise
    */
    updateRecord: function updateRecord(store, type, record, deleteUser) {
      var data = {};
      var serializer = store.serializerFor(record.modelName);
      serializer.serializeIntoHash(data, type, record, { includeId: true });
      data.type = 'user';
      if (deleteUser) {
        data.deleted = true;
        delete data.oauth;
        data.roles = ['deleted'];
      }
      if (_ember['default'].isEmpty(data._rev)) {
        delete data._rev;
      }
      data = this._cleanPasswordAttrs(data);
      if (get(this, 'standAlone') === true) {
        return this._offlineUpdateRecord(data);
      } else {
        var putURL = this._buildURL('user', get(record, 'id'));
        return this._checkForErrors(this.ajax(putURL, 'PUT', {
          data: data
        }));
      }
    },
    /**
     Builds a URL for a `store.findAll(type)` call.
     Example:
     ```app/adapters/comment.js
     import DS from 'ember-data';
     export default DS.JSONAPIAdapter.extend({
       urlForFindAll(id, modelName, snapshot) {
         return 'data/comments.json';
       }
     });
     ```
     @method urlForFindAll
     @param {String} modelName
     @param {DS.SnapshotRecordArray} snapshot
     @return {String} url
     */
    urlForFindAll: function urlForFindAll() /* modelName, snapshot */{
      return ENDPOINT + '_all_docs';
    },

    /**
      @method urlPrefix
      @private
      @param {String} path
      @param {String} parentURL
      @return {String} urlPrefix
    */
    urlPrefix: function urlPrefix() /* path, parentURL */{
      return ENDPOINT;
    },

    /**
      @method _buildURL
      @private
      @param {String} modelName
      @param {String} id
      @return {String} url
    */
    _buildURL: function _buildURL(modelName, id) {
      return '' + ENDPOINT + id;
    },

    /**
     Remove null/empty password fields from payload sent to server
     */
    _cleanPasswordAttrs: function _cleanPasswordAttrs(data) {
      var attrsToCheck = ['derived_key', 'password', 'password_scheme', 'password_sha', 'salt', 'iterations'];
      attrsToCheck.forEach(function (attr) {
        if (_ember['default'].isEmpty(data[attr])) {
          delete data[attr];
        }
      });
      return data;
    },

    /**
     Called by find in we're in standAlone mode.
      @method private
      @param {String} id - document id we are retrieving
    @returns {Promise} promise
    */
    _offlineFind: function _offlineFind(id) {
      var _this = this;

      var usersDB = get(this, 'database.usersDB');
      return new _ember['default'].RSVP.Promise(function (resolve, reject) {
        usersDB.get(id).then(resolve)['catch'](function (err) {
          var database = get(_this, 'database');
          reject(database.handleErrorResponse(err));
        });
      });
    },

    /**
    Called by updateRecord in we're in standAlone mode.
     @method private
    @param {POJO} data - the data we're going to search for in Pouch
    @returns {Promise} promise
    */
    _offlineFindAll: function _offlineFindAll(data) {
      var usersDB = get(this, 'database.usersDB');
      return usersDB.allDocs(data);
    },

    /**
    Called by updateRecord in we're in standAlone mode.
     @method private
    @param {POJO} data - the data we're going to store in Pouch
    @returns {Promise} promise
    */
    _offlineUpdateRecord: function _offlineUpdateRecord(data) {
      var usersDB = get(this, 'usersDB');
      return usersDB.put(data);
    }

  });
});
define('hospitalrun/admin/address/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller'], function (exports, _hospitalrunControllersAbstractEditController) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend({
    hideCancelButton: true,
    updateCapability: 'update_config',

    afterUpdate: function afterUpdate() {
      this.displayAlert(this.get('i18n').t('admin.address.titles.optionsSaved'), this.get('i18n').t('admin.address.messages.addressSaved'));
    }
  });
});
define('hospitalrun/admin/address/route', ['exports', 'ember', 'hospitalrun/routes/abstract-edit-route', 'ember-concurrency', 'ember-i18n', 'hospitalrun/utils/unauthorized-error'], function (exports, _ember, _hospitalrunRoutesAbstractEditRoute, _emberConcurrency, _emberI18n, _hospitalrunUtilsUnauthorizedError) {
  function _instanceof(left, right) { if (right != null && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } }

  var computed = _ember['default'].computed;
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend({
    hideNewButton: true,
    newTitle: (0, _emberI18n.translationMacro)('admin.address.newTitle'),
    editTitle: (0, _emberI18n.translationMacro)('admin.address.editTitle'),

    model: function model() {
      return this.get('fetchAddressOptions').perform();
    },

    fetchAddressOptions: (0, _emberConcurrency.task)(regeneratorRuntime.mark(function callee$0$0() {
      var store;
      return regeneratorRuntime.wrap(function callee$0$0$(context$1$0) {
        while (1) switch (context$1$0.prev = context$1$0.next) {
          case 0:
            store = this.get('store');
            context$1$0.prev = 1;
            context$1$0.next = 4;
            return store.find('option', 'address_options');

          case 4:
            return context$1$0.abrupt('return', context$1$0.sent);

          case 7:
            context$1$0.prev = 7;
            context$1$0.t0 = context$1$0['catch'](1);

            if (!_instanceof(context$1$0.t0, _hospitalrunUtilsUnauthorizedError['default'])) {
              context$1$0.next = 11;
              break;
            }

            throw context$1$0.t0;

          case 11:
            return context$1$0.abrupt('return', store.push(this.get('defaultAddressOption')));

          case 12:
          case 'end':
            return context$1$0.stop();
        }
      }, callee$0$0, this, [[1, 7]]);
    })).keepLatest().cancelOn('deactivate'),

    defaultAddressOption: computed(function () {
      return this.get('store').normalize('option', {
        id: 'address_options',
        value: {
          address1Label: this.get('i18n').t('admin.address.addressLabel'),
          address1Include: true
        }
      });
    })
  });
});
define("hospitalrun/admin/address/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "j8d474bE", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.address.address1Label\"],null],\"value.address1Label\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.address.include1Label\"],null],\"value.address1Include\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.address.address2Label\"],null],\"value.address2Label\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.address.include2Label\"],null],\"value.address2Include\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.address.address3Label\"],null],\"value.address3Label\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.address.include3Label\"],null],\"value.address3Include\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.address.address4Label\"],null],\"value.address4Label\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.address.include4Label\"],null],\"value.address4Include\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/admin/address/template.hbs" } });
});
define('hospitalrun/admin/custom-forms/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember', 'npm:uuid'], function (exports, _hospitalrunControllersAbstractEditController, _ember, _npmUuid) {
  var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();

  var computed = _ember['default'].computed;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend({
    customForms: _ember['default'].inject.service(),
    preview: false,
    previewModel: _ember['default'].Object.create(),
    updateCapability: 'update_config',

    afterUpdate: function afterUpdate() {
      var customForms = this.get('customForms');
      var model = this.get('model');
      customForms.resetCustomFormByType(model.get('formType'));
      this.displayAlert(this.get('i18n').t('admin.customForms.titles.formSaved'), this.get('i18n').t('admin.customForms.messages.formSaved', this.get('model')));
    },

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

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

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

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

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

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

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

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

    formTypeValues: ['incident', 'operativePlan', 'patient', 'socialwork', 'visit', 'opdReport', 'dischargeReport', 'lab'],

    formTypes: computed(function () {
      var i18n = this.get('i18n');
      var formTypeValues = this.get('formTypeValues');
      return formTypeValues.map(function (formTypeId) {
        return {
          id: formTypeId,
          value: i18n.t('admin.customForms.labels.' + formTypeId + 'FormType')
        };
      }).sort(function (a, b) {
        return _ember['default'].compare(a.value.toString(), b.value.toString());
      });
    }),

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

    fieldTypeLabel: function fieldTypeLabel(fieldType) {
      var i18n = this.get('i18n');
      return i18n.t('admin.customForms.labels.' + fieldType);
    },

    _addNewField: function _addNewField(field) {
      var changedAttributes = field.changedAttributes();
      var fieldAttributes = {};
      var store = this.get('store');
      this._generatePropertyNames(field);
      Object.keys(changedAttributes).forEach(function (attributeName) {
        var _changedAttributes$attributeName = _slicedToArray(changedAttributes[attributeName], 2);

        var newValue = _changedAttributes$attributeName[1];

        fieldAttributes[attributeName] = newValue;
      });
      fieldAttributes.property = field.get('property');
      var newField = store.push({
        data: {
          id: _npmUuid['default'].v4(),
          type: 'custom-field',
          attributes: fieldAttributes
        }
      });
      var formFields = this.get('model.fields');
      formFields.addObject(newField);
    },

    _generatePropertyNames: function _generatePropertyNames(field) {
      var type = field.get('type');
      var propertyName = this._getPropertyName(field);
      if (type === 'checkbox') {
        var values = field.get('values');
        values.forEach(function (value, index) {
          value.set('property', '' + propertyName + (index + 1));
        });
      } else {
        field.set('property', propertyName);
      }
    },

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

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

  });
});
define('hospitalrun/admin/custom-forms/edit/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractEditRoute, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend({
    hideNewButton: true,
    newTitle: (0, _emberI18n.translationMacro)('admin.customForms.titles.newCustomForm'),
    editTitle: (0, _emberI18n.translationMacro)('admin.customForms.titles.editCustomForm'),
    modelName: 'custom-form',

    actions: {
      allItems: function allItems() {
        this.transitionTo('admin.custom-forms');
      }
    }
  });
});
define("hospitalrun/admin/custom-forms/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "J/0JioRf", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],7]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"custom-form\"],null,[[\"model\",\"form\"],[[\"get\",[\"previewModel\"]],[\"get\",[\"model\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-default form-preview\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"formName\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"previewModel\"]],false]],0],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"moveFieldDown\",[\"get\",[\"field\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                 \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-chevron-down\"],[\"static-attr\",\"aria-hidden\",\"true\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"t\"],[\"admin.customForms.buttons.moveDown\"],null],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"moveFieldUp\",[\"get\",[\"field\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                 \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-chevron-up\"],[\"static-attr\",\"aria-hidden\",\"true\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"t\"],[\"admin.customForms.buttons.moveUp\"],null],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"append\",[\"helper\",[\"t\"],[[\"helper\",[\"concat\"],[\"admin.customForms.labels.\",[\"get\",[\"field\",\"type\"]]],null]],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"field\",\"label\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"field\",\"type\"]]],null,4],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"deleteField\",[\"get\",[\"field\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editField\",[\"get\",[\"field\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.edit\"],null],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"helper\",[\"not-eq\"],[[\"get\",[\"index\"]],0],null]],null,3],[\"block\",[\"if\"],[[\"helper\",[\"lt\"],[[\"get\",[\"index\"]],[\"get\",[\"lastFieldIndex\"]]],null]],null,2],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"field\",\"index\"]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"name\",[\"helper\",[\"t\"],[\"admin.customForms.labels.formName\"],null],\"form-input-group required col-xs-4 custom-form-name\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\",\"prompt\"],[\"col-xs-3 form-input-group required custom-form-type\",[\"helper\",[\"t\"],[\"admin.customForms.labels.formType\"],null],\"formType\",[\"get\",[\"formTypes\"]],\" \"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"columns\",[\"helper\",[\"t\"],[\"admin.customForms.labels.columns\"],null],\"form-input-group col-xs-2 custom-form-columns\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"admin.customForms.labels.alwaysInclude\"],null],\"alwaysInclude\",\"form-input-group col-xs-2\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"h4\",[]],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"t\"],[\"admin.customForms.titles.fields\"],null],false],[\"text\",\"\\n      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"addField\"]],[\"flush-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"t\"],[\"admin.customForms.buttons.addField\"],null],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"admin.customForms.labels.label\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.type\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.action\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"fields\"]]],null,5],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],6],[\"text\",\"  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"togglePreview\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"t\"],[\"admin.customForms.buttons.preview\"],null],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"preview\"]]],null,1]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/admin/custom-forms/edit/template.hbs" } });
});
define('hospitalrun/admin/custom-forms/field-edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember'], function (exports, _hospitalrunControllersAbstractEditController, _ember) {
  var computed = _ember['default'].computed;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend({
    editController: _ember['default'].inject.controller('admin/custom-forms/edit'),
    cancelAction: 'closeModal',
    i18n: _ember['default'].inject.service(),

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

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

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

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

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

    fieldTypes: computed(function () {
      var i18n = this.get('i18n');
      var fieldTypeValues = this.get('fieldTypeValues');
      return fieldTypeValues.map(function (fieldTypeId) {
        return {
          id: fieldTypeId,
          value: i18n.t('admin.customForms.labels.' + fieldTypeId)
        };
      }).sort(function (a, b) {
        return _ember['default'].compare(a.value.toString(), b.value.toString());
      });
    }),

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

  });
});
define("hospitalrun/admin/custom-forms/field-edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "YMUr2kM3", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"helper\",[\"t\"],[[\"helper\",[\"if\"],[[\"get\",[\"model\",\"isNew\"]],\"admin.lookup.edit.template.addTitle\",\"admin.lookup.edit.template.editTitle\"],null]],null],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],11]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"admin.customForms.labels.otherOptionLabel\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"input\"],null,[[\"class\",\"value\"],[\"form-control\",[\"get\",[\"model\",\"otherOptionLabel\"]]]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"checkbox\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"input\"],null,[[\"type\",\"checked\"],[\"checkbox\",[\"get\",[\"model\",\"includeOtherOption\"]]]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"t\"],[\"admin.customForms.labels.includeOtherOption\"],null],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"model\",\"includeOtherOption\"]]],null,0]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"helper\",[\"input\"],null,[[\"value\",\"class\"],[[\"get\",[\"value\",\"label\"]],\"form-control custom-field-value\"]]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning delete-field-value\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"deleteValue\",[\"get\",[\"value\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"value\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.value\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"admin.customForms.labels.label\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"t\"],[\"admin.customForms.titles.checkboxValues\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"t\"],[\"admin.customForms.titles.dropDownValues\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"t\"],[\"admin.customForms.titles.radioValues\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"h4\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[[\"get\",[\"model\",\"type\"]],\"radio\"],null]],null,7],[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[[\"get\",[\"model\",\"type\"]],\"select\"],null]],null,6],[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[[\"get\",[\"model\",\"type\"]],\"checkbox\"],null]],null,5],[\"text\",\"        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"addValue\"]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.addValue\"],null],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[[\"get\",[\"model\",\"type\"]],\"checkbox\"],null]],null,4,3],[\"text\",\"          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.action\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"values\"]]],null,2],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"option\",[]],[\"dynamic-attr\",\"value\",[\"concat\",[[\"unknown\",[\"fieldType\",\"id\"]]]]],[\"dynamic-attr\",\"selected\",[\"helper\",[\"eq\"],[[\"get\",[\"model\",\"type\"]],[\"get\",[\"fieldType\",\"id\"]]],null],null],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"unknown\",[\"fieldType\",\"value\"]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"fieldType\"]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-input-group col-xs-6\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"for\",\"fieldTypeSelect\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.type\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"select\",[]],[\"dynamic-attr\",\"onchange\",[\"helper\",[\"action\"],[[\"get\",[null]],\"selectType\"],[[\"value\"],[\"target.value\"]]],null],[\"static-attr\",\"class\",\"form-control custom-field-select\"],[\"static-attr\",\"id\",\"fieldTypeSelect\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"option\",[]],[\"static-attr\",\"disabled\",\"\"],[\"dynamic-attr\",\"selected\",[\"helper\",[\"is-not\"],[[\"get\",[\"model\",\"type\"]]],null],null],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"fieldTypes\"]]],null,9],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"class\",\"label\"],[\"label\",\"col-xs-6 required custom-field-label\",[\"helper\",[\"t\"],[\"admin.customForms.labels.label\"],null]]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"class\",\"label\"],[\"colSpan\",\"col-xs-5 custom-field-colspan\",[\"helper\",[\"t\"],[\"admin.customForms.labels.colSpan\"],null]]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showValues\"]]],null,8],[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[[\"get\",[\"model\",\"type\"]],\"radio\"],null]],null,1]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],10]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/admin/custom-forms/field-edit/template.hbs" } });
});
define('hospitalrun/admin/custom-forms/index/controller', ['exports', 'hospitalrun/controllers/abstract-paged-controller'], function (exports, _hospitalrunControllersAbstractPagedController) {
  exports['default'] = _hospitalrunControllersAbstractPagedController['default'].extend({
    addPermission: 'update_config',
    deletePermission: 'update_config'
  });
});
define('hospitalrun/admin/custom-forms/index/route', ['exports', 'hospitalrun/routes/abstract-index-route', 'ember', 'hospitalrun/mixins/modal-helper', 'hospitalrun/mixins/user-session', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractIndexRoute, _ember, _hospitalrunMixinsModalHelper, _hospitalrunMixinsUserSession, _emberI18n) {
  var computed = _ember['default'].computed;
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend(_hospitalrunMixinsModalHelper['default'], _hospitalrunMixinsUserSession['default'], {
    newButtonAction: computed(function () {
      if (this.currentUserCan('update_config')) {
        return 'newItem';
      } else {
        return null;
      }
    }),
    newButtonText: (0, _emberI18n.translationMacro)('admin.customForms.buttons.newForm'),

    pageTitle: (0, _emberI18n.translationMacro)('admin.customForms.titles.customForms'),
    model: function model() {
      var store = this.get('store');
      return store.findAll('custom-form');
    },

    actions: {
      deleteItem: function deleteItem(item) {
        var i18n = this.get('i18n');
        var model = _ember['default'].Object.create({
          itemToDelete: item
        });
        var message = i18n.t('messages.delete', { name: item.get('name') });
        var title = i18n.t('admin.customForms.titles.deleteForm');
        this.displayConfirm(title, message, 'deleteCustomForm', model);
      },

      deleteCustomForm: function deleteCustomForm(model) {
        model.itemToDelete.set('archived', true);
        model.itemToDelete.save().then(function () {
          model.itemToDelete.unloadRecord();
        });
      },

      editItem: function editItem(item) {
        this.transitionTo('admin.custom-forms.edit', item);
      },

      newItem: function newItem() {
        this.transitionTo('admin.custom-forms.edit', 'new');
      }

    }
  });
});
define("hospitalrun/admin/custom-forms/index/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "JeXORsK8", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,null,7]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"deleteItem\",[\"get\",[\"customForm\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"customForm\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canEdit\"]]],null,1],[\"block\",[\"if\"],[[\"get\",[\"canDelete\"]]],null,0],[\"text\",\"            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"append\",[\"helper\",[\"t\"],[[\"helper\",[\"concat\"],[\"admin.customForms.labels.\",[\"get\",[\"customForm\",\"formType\"]],\"FormType\"],null]],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"clickable\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"customForm\"]]]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"custom-form-name\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"customForm\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"customForm\",\"formType\"]]],null,3],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,2],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"unless\"],[[\"get\",[\"customForm\",\"archived\"]]],null,4]],\"locals\":[\"customForm\"]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.name\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.type\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,6],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\"]]],null,5],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/admin/custom-forms/index/template.hbs" } });
});
define('hospitalrun/admin/loaddb/controller', ['exports', 'ember', 'ember-i18n', 'hospitalrun/mixins/modal-helper', 'hospitalrun/mixins/progress-dialog'], function (exports, _ember, _emberI18n, _hospitalrunMixinsModalHelper, _hospitalrunMixinsProgressDialog) {
  exports['default'] = _ember['default'].Controller.extend(_hospitalrunMixinsModalHelper['default'], _hospitalrunMixinsProgressDialog['default'], {
    database: _ember['default'].inject.service(),
    fileSystem: _ember['default'].inject.service('filesystem'),
    progressMessage: (0, _emberI18n.translationMacro)('admin.loaddb.progressMessage'),
    progressTitle: (0, _emberI18n.translationMacro)('admin.loaddb.progressTitle'),
    syncResults: null,
    fileImportedName: null,

    actions: {
      loadFile: function loadFile() {
        var _this = this;

        var fileSystem = this.get('fileSystem');
        var fileToImport = this.get('importFile');
        if (!fileToImport || !fileToImport.type) {
          this.displayAlert(this.get('i18n').t('admin.loaddb.displayAlertTitle'), this.get('i18n').t('admin.loaddb.displayAlertMessage'));
        } else {
          this.showProgressModal();
          this.set('syncResults');
          this.set('fileImportedName');
          fileSystem.fileToString(fileToImport).then(function (fileAsString) {
            var database = _this.get('database');
            var fileName = _this.get('importFile.name');
            _this.set('fileImportedName', fileName);
            _this.set('importFile');
            _this.set('model.importFileName');
            database.loadDBFromDump(fileAsString).then(function (results) {
              _this.closeProgressModal();
              _this.set('syncResults', results);
            })['catch'](function (err) {
              _this.displayAlert(_this.get('i18n').t('admin.loaddb.errorDisplayAlertTitle'), _this.get('i18n').t('admin.loaddb.errorDisplayAlertMessage', { error: JSON.stringify(err) }));
            });
          });
        }
      }
    }
  });
});
define('hospitalrun/admin/loaddb/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'ember', 'ember-i18n', 'hospitalrun/mixins/user-session'], function (exports, _hospitalrunRoutesAbstractEditRoute, _ember, _emberI18n, _hospitalrunMixinsUserSession) {
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend(_hospitalrunMixinsUserSession['default'], {
    hideNewButton: true,
    editTitle: (0, _emberI18n.translationMacro)('admin.loaddb.editTitle'),

    database: inject.service(),

    beforeModel: function beforeModel() {
      if (!this.currentUserCan('load_db')) {
        this.transitionTo('application');
      }
    },

    // Make sure database is available for import
    model: function model() {
      var _this = this;

      var database = get(this, 'database');
      return database.getDBInfo()['catch'](function (err) {
        return _this.send('error', database.handleErrorResponse(err));
      });
    }
  });
});
define("hospitalrun/admin/loaddb/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "qqHtKHhb", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],1],[\"block\",[\"if\"],[[\"get\",[\"syncResults\"]]],null,0],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"h4\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.fileLoadSuccessful\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-xs-4\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.fileName\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"fileImportedName\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-xs-2\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.startTime\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"syncResults\",\"start_time\"]]],[[\"format\"],[\"l h:mm A\"]]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-xs-2\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.endTime\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"syncResults\",\"end_time\"]]],[[\"format\"],[\"l h:mm A\"]]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-xs-2\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.docRead\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"syncResults\",\"docs_read\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-xs-2\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.docWritten\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"syncResults\",\"docs_written\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"file-upload\"],null,[[\"label\",\"property\",\"selectedFile\"],[[\"helper\",[\"t\"],[\"labels.fileToLoad\"],null],\"importFileName\",[\"get\",[\"importFile\"]]]]],false],[\"text\",\"\\n      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"loadFile\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.loadFile\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/admin/loaddb/template.hbs" } });
});
define('hospitalrun/admin/lookup/controller', ['exports', 'ember', 'hospitalrun/mixins/billing-categories', 'npm:csv-parse', 'hospitalrun/mixins/modal-helper', 'hospitalrun/mixins/inventory-type-list', 'hospitalrun/mixins/unit-types', 'hospitalrun/mixins/visit-types', 'ember-keyboard'], function (exports, _ember, _hospitalrunMixinsBillingCategories, _npmCsvParse, _hospitalrunMixinsModalHelper, _hospitalrunMixinsInventoryTypeList, _hospitalrunMixinsUnitTypes, _hospitalrunMixinsVisitTypes, _emberKeyboard) {
  var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();

  var computed = _ember['default'].computed;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  exports['default'] = _ember['default'].Controller.extend(_hospitalrunMixinsBillingCategories['default'], _emberKeyboard.EKMixin, _hospitalrunMixinsInventoryTypeList['default'], _hospitalrunMixinsModalHelper['default'], _hospitalrunMixinsUnitTypes['default'], _hospitalrunMixinsVisitTypes['default'], {
    fileSystem: inject.service('filesystem'),
    lookupLists: inject.service(),

    canEditValues: computed('model.lookupType', function () {
      var lookupType = this.get('model.lookupType');
      return lookupType !== 'imaging_pricing_types' && lookupType !== 'lab_pricing_types';
    }),

    lookupTypes: computed(function () {
      return [{
        name: this.get('i18n').t('admin.lookup.anesthesiaTypes'),
        value: 'anesthesia_types',
        model: {
          procedure: 'anesthesiaType'
        }
      }, {
        name: this.get('i18n').t('admin.lookup.anesthesiologists'),
        value: 'anesthesiologists',
        model: {
          procedure: 'anesthesiologist'
        }
      }, {
        defaultValues: 'defaultBillingCategories',
        name: this.get('i18n').t('admin.lookup.billingCategories'),
        value: 'billing_categories',
        models: {
          'billing-line-item': 'category'
        }
      }, {
        name: this.get('i18n').t('admin.lookup.clinicList'),
        value: 'clinic_list',
        models: { // Models that use this lookup -- use this later to update models on lookup changes
          patient: 'clinic'
        }
      }, {
        name: this.get('i18n').t('admin.lookup.countryList'),
        value: 'country_list',
        models: {
          patient: 'country'
        }
      }, {
        name: this.get('i18n').t('admin.lookup.diagnosisList'),
        value: 'diagnosis_list',
        models: {
          diagnosis: 'diagnosis'
        }
      }, {
        name: this.get('i18n').t('admin.lookup.cptCodeList'),
        value: 'cpt_code_list',
        models: {
          procedure: 'cptCode'
        }
      }, {
        name: this.get('i18n').t('admin.lookup.expenseAccountList'),
        value: 'expense_account_list',
        models: {
          'inv-request': 'expenseAccount',
          pricing: 'expenseAccount'
        }
      }, {
        name: this.get('i18n').t('admin.lookup.aisleLocationList'),
        value: 'aisle_location_list',
        models: {
          inventory: 'aisleLocation',
          'inv-location': 'aisleLocation',
          'inv-purchase': 'aisleLocation',
          'inv-request': ['deliveryAisle', 'locationsAffected' // Special use case that we need to handle
          ]
        }
      }, {
        name: this.get('i18n').t('admin.lookup.warehouseList'),
        value: 'warehouse_list',
        models: {
          inventory: 'location',
          'inv-location': 'location',
          'inv-purchase': 'location',
          'inv-request': ['deliveryLocation', 'locationsAffected' // Special use case that we need to handle
          ]
        }
      }, {
        name: this.get('i18n').t('admin.lookup.incidentDepartments'),
        value: 'incident_departments',
        models: {
          incident: 'department'
        }
      }, {
        defaultValues: 'defaultInventoryTypes',
        name: this.get('i18n').t('admin.lookup.inventoryTypes'),
        value: 'inventory_types',
        models: {
          inventory: 'inventoryType'
        }
      }, {
        name: this.get('i18n').t('admin.lookup.imagingPricingTypes'),
        value: 'imaging_pricing_types',
        models: {
          pricing: 'pricingType'
        }
      }, {
        name: this.get('i18n').t('admin.lookup.labPricingTypes'),
        value: 'lab_pricing_types',
        models: {
          pricing: 'pricingType'
        }
      }, {
        name: this.get('i18n').t('admin.lookup.patientStatusList'),
        value: 'patient_status_list',
        models: {
          patient: 'status'
        }
      }, {
        name: this.get('i18n').t('admin.lookup.physicianList'),
        value: 'physician_list',
        models: {
          appointment: 'provider',
          visit: 'examiner',
          procedure: ['assistant', 'physician']
        }
      }, {
        name: this.get('i18n').t('admin.lookup.procedureList'),
        value: 'procedure_list',
        models: {
          procedure: 'description'
        }
      }, {
        name: this.get('i18n').t('admin.lookup.procedureLocations'),
        value: 'procedure_locations',
        models: {
          procedure: 'location'
        }
      }, {
        name: this.get('i18n').t('admin.lookup.procedurePricingTypes'),
        value: 'procedure_pricing_types',
        models: {
          pricing: 'pricingType'
        }
      }, {
        name: this.get('i18n').t('admin.lookup.radiologists'),
        value: 'radiologists',
        model: {
          imaging: 'radiologist'
        }
      }, {
        name: this.get('i18n').t('labels.sex'),
        value: 'sex',
        model: {
          patient: 'sex'
        }
      }, {
        defaultValues: 'defaultUnitList',
        name: this.get('i18n').t('admin.lookup.unitTypes'),
        value: 'unit_types',
        models: {
          inventory: 'distributionUnit',
          'inv-purchase': 'distributionUnit'
        }
      }, {
        name: this.get('i18n').t('admin.lookup.vendorList'),
        value: 'vendor_list',
        models: {
          'inv-purchase': 'vendor'
        }
      }, {
        name: this.get('i18n').t('admin.lookup.visitLocationList'),
        value: 'visit_location_list',
        models: {
          appointment: 'location',
          visit: 'location'
        }
      }, {
        defaultValues: 'defaultVisitTypes',
        name: this.get('i18n').t('admin.lookup.visitTypes'),
        value: 'visit_types',
        models: {
          visit: 'visitType'
        }
      }, {
        name: this.get('i18n').t('admin.lookup.wardPricingTypes'),
        value: 'ward_pricing_types',
        models: {
          pricing: 'pricingType'
        }
      }];
    }),

    importFile: computed.alias('lookupTypeList.importFile'),

    lookupTitle: computed('model.lookupType', function () {
      var lookupType = this.get('model.lookupType');
      var lookupTypes = this.get('lookupTypes');
      var lookupDesc = undefined;
      if (!_ember['default'].isEmpty(lookupType)) {
        lookupDesc = lookupTypes.findBy('value', lookupType);
        if (!_ember['default'].isEmpty(lookupDesc)) {
          return lookupDesc.name;
        }
      }
    }),

    lookupTypeList: computed('model.lookupType', function () {
      var lookupType = this.get('model.lookupType');
      var lookupItem = undefined;
      if (!_ember['default'].isEmpty(lookupType)) {
        lookupItem = this.get('model').findBy('id', lookupType);
        if (_ember['default'].isEmpty(lookupItem) || !lookupItem.get('isLoaded')) {
          var defaultValues = [];
          var lookupTypes = this.get('lookupTypes');
          var lookupDesc = lookupTypes.findBy('value', lookupType);
          var store = this.get('store');
          if (!_ember['default'].isEmpty(lookupDesc) && !_ember['default'].isEmpty(lookupDesc.defaultValues)) {
            defaultValues = this.get(lookupDesc.defaultValues);
          }
          lookupItem = store.push(store.normalize('lookup', {
            id: lookupType,
            value: defaultValues
          }));
        }
        if (!_ember['default'].isEmpty(lookupItem) && _ember['default'].isEmpty(lookupItem.get('userCanAdd'))) {
          lookupItem.set('userCanAdd', true);
        }
        return lookupItem;
      }
    }),

    lookupTypeValues: computed('model.lookupType', 'lookupTypeList.value.[]', function () {
      var _this = this;

      var lookupType = this.get('model.lookupType');
      var values = this.get('lookupTypeList.value');
      if (!_ember['default'].isEmpty(values)) {
        values.sort(this._sortValues);
        values = values.map(function (value) {
          return {
            canModify: _this._canModifyValue(value, lookupType),
            value: value
          };
        });
      }
      return _ember['default'].ArrayProxy.create({ content: _ember['default'].A(values) });
    }),

    showOrganizeByType: computed('model.lookupType', function () {
      var lookupType = this.get('model.lookupType');
      return !_ember['default'].isEmpty(lookupType) && lookupType.indexOf('pricing_types') > 0;
    }),

    _canModifyValue: function _canModifyValue(value, lookupType) {
      switch (lookupType) {
        case 'inventory_types':
          {
            if (value === 'Medication') {
              return false;
            }
            break;
          }
        case 'lab_pricing_types':
          {
            if (value === 'Lab Procedure') {
              return false;
            }
            break;
          }
        case 'imaging_pricing_types':
          {
            if (value === 'Imaging Procedure') {
              return false;
            }
            break;
          }
        case 'visit_types':
          {
            if (value === 'Admission') {
              return false;
            } else if (value === 'Imaging') {
              return false;
            } else if (value === 'Lab') {
              return false;
            } else if (value === 'Pharmacy') {
              return false;
            }
          }
      }
      return true;
    },

    _importLookupList: function _importLookupList(file) {
      var _this2 = this;

      var fileSystem = get(this, 'fileSystem');
      var lookupTypeList = get(this, 'lookupTypeList');
      var lookupValues = get(lookupTypeList, 'value');
      fileSystem.fileToString(file).then(function (values) {
        (0, _npmCsvParse['default'])(values, { trim: true }, function (err, data) {
          data.forEach(function (row) {
            var _row = _slicedToArray(row, 1);

            var newValue = _row[0];

            if (!lookupValues.includes(newValue)) {
              lookupValues.addObject(newValue);
            }
          });
          lookupValues.sort();
          var i18n = get(_this2, 'i18n');
          var message = i18n.t('admin.lookup.alertImportListSaveMessage');
          var title = i18n.t('admin.lookup.alertImportListSaveTitle');
          lookupTypeList.save().then(function () {
            var lookupLists = get(_this2, 'lookupLists');
            lookupLists.resetLookupList(get(lookupTypeList, 'id'));
            _this2.displayAlert(title, message);
            _this2.set('importFile');
            _this2.set('model.importFileName');
          });
        });
      });
    },

    _sortValues: function _sortValues(a, b) {
      return _ember['default'].compare(a.toLowerCase(), b.toLowerCase());
    },

    activateKeyboard: _ember['default'].on('init', function () {
      this.set('keyboardActivated', true);
    }),

    updateListKeyboard: _ember['default'].on((0, _emberKeyboard.keyDown)('ctrl+KeyS'), (0, _emberKeyboard.keyDown)('cmd+KeyS'), function (event) {
      this.send('updateList');
      event.preventDefault();
    }),

    actions: {
      addValue: function addValue() {
        this.send('openModal', 'admin.lookup.edit', _ember['default'].Object.create({
          isNew: true
        }));
      },
      confirmDeleteValue: function confirmDeleteValue(value) {
        var i18n = this.get('i18n');
        var title = i18n.t('admin.lookup.titles.deleteLookupValue');
        var message = i18n.t('messages.delete', { name: value });
        this.displayConfirm(title, message, 'deleteValue', _ember['default'].Object.create({
          valueToDelete: value
        }));
      },
      deleteValue: function deleteValue(value) {
        var lookupTypeList = this.get('lookupTypeList');
        var lookupTypeValues = lookupTypeList.get('value');
        var valueToDelete = value.get('valueToDelete');
        lookupTypeValues.removeObject(valueToDelete.toString());
        lookupTypeList.save();
      },
      editValue: function editValue(value) {
        if (!_ember['default'].isEmpty(value)) {
          this.send('openModal', 'admin.lookup.edit', _ember['default'].Object.create({
            isNew: false,
            originalValue: value.toString(),
            value: value.toString()
          }));
        }
      },
      importList: function importList() {
        var fileToImport = this.get('importFile');
        if (!fileToImport || !fileToImport.type) {
          this.displayAlert(this.get('i18n').t('admin.lookup.alertImportListTitle'), this.get('i18n').t('admin.lookup.alertImportListMessage'));
        } else {
          this._importLookupList(fileToImport);
        }
      },
      updateList: function updateList() {
        var _this3 = this;

        var lookupTypeList = this.get('lookupTypeList');
        lookupTypeList.save().then(function () {
          var lookupLists = get(_this3, 'lookupLists');
          lookupLists.resetLookupList(get(lookupTypeList, 'id'));
          _this3.displayAlert(_this3.get('i18n').t('admin.lookup.alertImportListUpdateTitle'), _this3.get('i18n').t('admin.lookup.alertImportListUpdateMessage'));
        });
      },
      updateValue: function updateValue(valueObject) {
        var updateList = false;
        var lookupTypeList = this.get('lookupTypeList');
        var values = lookupTypeList.get('value');
        var value = valueObject.get('value');
        if (valueObject.get('isNew')) {
          updateList = true;
        } else {
          var originalValue = valueObject.get('originalValue');
          if (value !== originalValue) {
            values.removeObject(originalValue);
            updateList = true;
            // TODO UPDATE ALL EXISTING DATA LOOKUPS (NODEJS JOB)
          }
        }
        if (updateList) {
          values.addObject(value);
          values = values.sort(this._sortValues);
          lookupTypeList.set('value', values);
          this.send('updateList');
        }
      }
    }
  });
});
define('hospitalrun/admin/lookup/edit/controller', ['exports', 'ember', 'hospitalrun/mixins/is-update-disabled'], function (exports, _ember, _hospitalrunMixinsIsUpdateDisabled) {
  exports['default'] = _ember['default'].Controller.extend(_hospitalrunMixinsIsUpdateDisabled['default'], {
    editController: _ember['default'].inject.controller('admin/lookup'),
    showUpdateButton: true,

    updateButtonAction: 'update',
    updateButtonText: (function () {
      var i18n = this.get('i18n');
      if (this.get('model.isNew')) {
        return i18n.t('buttons.add');
      } else {
        return i18n.t('buttons.update');
      }
    }).property('model.isNew'),

    actions: {
      cancel: function cancel() {
        this.send('closeModal');
      },

      update: function update() {
        if (!_ember['default'].isEmpty(this.get('model.value'))) {
          this.get('editController').send('updateValue', this.get('model'));
          this.send('closeModal');
        }
      }
    }
  });
});
define("hospitalrun/admin/lookup/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "2fhdRW7b", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"helper\",[\"t\"],[[\"helper\",[\"if\"],[[\"get\",[\"model\",\"isNew\"]],\"admin.lookup.edit.template.addTitle\",\"admin.lookup.edit.template.editTitle\"],null]],null],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"admin.lookup.edit.template.labelTitle\"],null],\"value\",\"lookup-type-value\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\",\"action\"],[[\"get\",[\"model\"]],false,\"update\"]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/admin/lookup/edit/template.hbs" } });
});
define('hospitalrun/admin/lookup/route', ['exports', 'hospitalrun/routes/abstract-index-route', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractIndexRoute, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend({
    hideNewButton: true,
    pageTitle: (0, _emberI18n.translationMacro)('admin.lookup.pageTitle'),
    model: function model() {
      var _this = this;

      return this.store.findAll('lookup')['catch'](function (error) {
        return _this.send('error', error);
      });
    },

    afterModel: function afterModel(model) {
      model.set('lookupType', 'anesthesia_types');
    },

    actions: {
      deleteValue: function deleteValue(value) {
        this.controller.send('deleteValue', value);
      }
    }
  });
});
define("hospitalrun/admin/lookup/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "fI9CAoea", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],6],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"lookupTitle\"]],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canEditValues\"]]],null,5],[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canEditValues\"]]],null,2],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"lookupTypeList\"]],false]],1],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[\"Organize Pricing By Type\",\"organizeByType\",\"col-sm-4\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-sm-4\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"labels.userCanAddNewValue\"],null],\"userCanAdd\"]]],false],[\"text\",\"\\n          \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"updateList\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.update\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showOrganizeByType\"]]],null,0],[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-sm-4\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"file-upload\"],null,[[\"label\",\"property\",\"selectedFile\"],[[\"helper\",[\"t\"],[\"labels.importFile\"],null],\"importFileName\",[\"get\",[\"importFile\"]]]]],false],[\"text\",\"\\n          \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"importList\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.import\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"addValue\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.addValue\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editValue\",[\"get\",[\"lookupTypeValue\",\"value\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"confirmDeleteValue\",[\"get\",[\"lookupTypeValue\",\"value\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.delete\"],null],false],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"lookup-type-value\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"lookupTypeValue\",\"value\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"lookupTypeValue\",\"canModify\"]]],null,3],[\"text\",\"            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"lookupTypeValue\"]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.value\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"lookupTypeValues\"]]],null,4],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\",\"optionValuePath\",\"optionLabelPath\",\"selected\"],[\"col-xs-3 lookup-type form-input-group\",[\"helper\",[\"t\"],[\"labels.lookupType\"],null],\"lookupType\",[\"get\",[\"lookupTypes\"]],\"value\",\"name\",[\"get\",[\"model\",\"lookupType\"]]]]],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/admin/lookup/template.hbs" } });
});
define('hospitalrun/admin/print-header/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller'], function (exports, _hospitalrunControllersAbstractEditController) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend({
    hideCancelButton: true,
    updateCapability: 'update_config',

    afterUpdate: function afterUpdate() {
      this.displayAlert(this.get('i18n').t('admin.header.titles.optionsSaved'), this.get('i18n').t('admin.header.messages.headerSaved'));
    }
  });
});
define('hospitalrun/admin/print-header/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'ember', 'ember-i18n', 'hospitalrun/utils/unauthorized-error'], function (exports, _hospitalrunRoutesAbstractEditRoute, _ember, _emberI18n, _hospitalrunUtilsUnauthorizedError) {
  function _instanceof(left, right) { if (right != null && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } }

  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend({
    hideNewButton: true,
    newTitle: (0, _emberI18n.translationMacro)('admin.header.newTitle'),
    editTitle: (0, _emberI18n.translationMacro)('admin.header.editTitle'),
    model: function model() {
      var _this = this;

      return new _ember['default'].RSVP.Promise(function (resolve, reject) {
        _this.get('store').find('option', 'print_header').then(function (headerOptions) {
          resolve(headerOptions);
        }, function (err) {
          if (_instanceof(err, _hospitalrunUtilsUnauthorizedError['default'])) {
            reject(err);
          } else {
            var store = _this.get('store');
            var newConfig = store.push(store.normalize('option', {
              id: 'print_header',
              value: {
                facilityName: _this.get('i18n').t('admin.header.facilityName'),
                headerLine1: _this.get('i18n').t('admin.header.headerLine1')
              }
            }));
            resolve(newConfig);
          }
        });
      });
    }
  });
});
define("hospitalrun/admin/print-header/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "P8HLj9hB", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.header.facilityName\"],null],\"value.facilityName\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.header.headerLine1\"],null],\"value.headerLine1\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.header.headerLine2\"],null],\"value.headerLine2\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.header.headerLine3\"],null],\"value.headerLine3\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.header.logoURL\"],null],\"value.logoURL\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/admin/print-header/template.hbs" } });
});
define('hospitalrun/admin/query/controller', ['exports', 'ember', 'hospitalrun/mixins/edit-panel-props', 'hospitalrun/utils/select-values'], function (exports, _ember, _hospitalrunMixinsEditPanelProps, _hospitalrunUtilsSelectValues) {
  exports['default'] = _ember['default'].Controller.extend(_hospitalrunMixinsEditPanelProps['default'], {
    hideCancelButton: true,
    showUpdateButton: true,
    updateButtonAction: 'query',
    updateButtonText: 'Query', // admin function not requiring i8ln

    objectTypeList: ['appointment', 'imaging', 'inv-location', 'inv-purchase', 'inv-request', 'inventory', 'invoice', 'lab', 'medication', 'patient', 'photo', 'procedure', 'visit', 'vital'],

    objectTypes: _ember['default'].computed.map('objectTypeList', _hospitalrunUtilsSelectValues['default'].selectValuesMap),

    actions: {
      query: function query() {
        var fieldName = this.get('fieldName');
        var objectType = this.get('objectType');
        var queryValue = this.get('queryValue');
        var query = {
          containsValue: {
            value: queryValue,
            keys: [fieldName]
          }
        };
        this.store.query(objectType, query).then((function (results) {
          var _this = this;

          if (_ember['default'].isEmpty(results)) {
            this.set('errorMessage', 'Query returned no results.');
            this.set('haveError', true);
            this.set('showQueryResults', false);
          } else {
            (function () {
              var currentValue = undefined;
              var attributes = ['id'];
              var resultRows = [];
              results.get('firstObject').eachAttribute(function (name) {
                attributes.push(name);
              });

              results.forEach(function (result) {
                var resultRow = [];
                /* resultRow.push({
                    name: 'id',
                    value: result.get('id')
                }); */
                attributes.forEach(function (attribute) {
                  currentValue = result.get(attribute);
                  if (!_ember['default'].isEmpty(currentValue)) {
                    resultRow.push({
                      name: attribute,
                      value: currentValue
                    });
                  }
                });
                resultRows.push(resultRow);
              });
              _this.set('resultRows', resultRows);
              _this.set('haveError', false);
              _this.set('showQueryResults', true);
            })();
          }
        }).bind(this), (function (error) {
          this.set('errorMessage', error);
          this.set('haveError', true);
          this.set('showQueryResults', false);
        }).bind(this));
      }
    }
  });
});
define('hospitalrun/admin/query/route', ['exports', 'ember-simple-auth/mixins/authenticated-route-mixin', 'ember', 'hospitalrun/mixins/user-session'], function (exports, _emberSimpleAuthMixinsAuthenticatedRouteMixin, _ember, _hospitalrunMixinsUserSession) {
  exports['default'] = _ember['default'].Route.extend(_hospitalrunMixinsUserSession['default'], _emberSimpleAuthMixinsAuthenticatedRouteMixin['default'], {
    beforeModel: function beforeModel() {
      if (!this.currentUserCan('query_db')) {
        this.transitionTo('application');
      }
    }
  });
});
define("hospitalrun/admin/query/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "jNp4d1tp", "block": "{\"statements\":[[\"text\",\"\\n\"],[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],5]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"name\"]],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"value\"]],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"result\"]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"text\",\"Field\"],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"text\",\"Value\"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"resultRow\"]]],null,0],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"resultRow\"]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"text\",\"Query Results\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"resultRows\"]]],null,1],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger\"],[\"static-attr\",\"role\",\"alert\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"errorMessage\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\",\"selected\"],[\"col-xs-3\",\"Object Type\",\"objectType\",[\"get\",[\"objectTypes\"]],[\"get\",[\"objectType\"]]]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\"],[\"Field Name\",\"fieldName\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\"],[\"Query Value\",\"queryValue\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[null]],false]],4],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"haveError\"]]],null,3],[\"block\",[\"if\"],[[\"get\",[\"showQueryResults\"]]],null,2]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/admin/query/template.hbs" } });
});
define('hospitalrun/admin/roles/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember', 'hospitalrun/mixins/user-roles', 'hospitalrun/mixins/user-session'], function (exports, _hospitalrunControllersAbstractEditController, _ember, _hospitalrunMixinsUserRoles, _hospitalrunMixinsUserSession) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsUserRoles['default'], _hospitalrunMixinsUserSession['default'], {
    currentRole: '',
    disabledAction: false,
    hideCancelButton: true,
    updateCapability: 'define_user_roles',
    filteredRoles: _ember['default'].computed.filter('userRoles', function (userRole) {
      return userRole.name !== 'System Administrator';
    }),

    availableCapabilities: [{
      name: 'admin',
      capabilities: ['admin', 'loadDb', 'updateConfig', 'defineUserRoles']
    }, {
      name: 'appointments',
      capabilities: ['appointments', 'addAppointment']
    }, {
      name: 'billing',
      capabilities: ['billing', 'addBillingDiagnosis', 'addCharge', 'addPricing', 'addPricingProfile', 'addInvoice', 'addPayment', 'deleteInvoice', 'deletePricing', 'deletePricingProfile', 'editInvoice', 'invoices', 'overrideInvoice', 'pricing', 'cashier', 'listPaidInvoices']
    }, {
      name: 'patients',
      capabilities: ['patients', 'addAllergy', 'addDiagnosis', 'addNote', 'addOperativePlan', 'addOperationReport', 'addPhoto', 'addPatient', 'addProcedure', 'addSocialwork', 'addVisit', 'addVitals', 'admitPatient', 'deleteNote', 'deletePhoto', 'deletePatient', 'deleteAppointment', 'deleteDiagnosis', 'deleteProcedure', 'deleteSocialwork', 'deleteVitals', 'deleteVisit', 'dischargePatient', 'patientReports', 'visits']
    }, {
      name: 'medication',
      capabilities: ['medication', 'addMedication', 'deleteMedication', 'fulfillMedication']
    }, {
      name: 'labs',
      capabilities: ['labs', 'addLab', 'completeLab', 'deleteLab']
    }, {
      name: 'imaging',
      capabilities: ['imaging', 'addImaging', 'completeImaging', 'deleteImaging']
    }, {
      name: 'incident',
      capabilities: ['incident', 'addIncident', 'addIncidentCategory', 'deleteIncident', 'deleteIncidentCategory', 'manageIncidents', 'generateIncidentReport']
    }, {
      name: 'inventory',
      capabilities: ['inventory', 'addInventoryRequest', 'addInventoryItem', 'addInventoryPurchase', 'adjustInventoryLocation', 'deleteInventoryItem', 'fulfillInventory']
    }],

    missingCapablities: _ember['default'].computed('availableCapabilities', 'defaultCapabilities', function () {
      var availableCapabilities = this.get('availableCapabilities');
      var capabilityBySection = Object.keys(availableCapabilities);
      var defaultCapabilities = Object.keys(this.get('defaultCapabilities'));
      var missing = [];
      defaultCapabilities.forEach(function (capability) {
        var capabilityUsed = false;
        capabilityBySection.forEach(function (sectionName) {
          var section = availableCapabilities[sectionName];
          if (section.capabilities.includes(capability.camelize())) {
            capabilityUsed = true;
          }
        });
        if (!capabilityUsed) {
          missing.push(capability + ' - ' + capability.camelize());
        }
      });
      return missing;
    }),

    capabilitySections: _ember['default'].computed.map('availableCapabilities', function (section) {
      var _this = this;

      var mappedCapabilities = [];
      section.capabilities.forEach(function (key) {
        mappedCapabilities.push({
          key: key,
          name: _this.get('i18n').t('admin.roles.capability.' + key)
        });
      });
      return {
        name: this.get('i18n').t('admin.roles.capability.' + section.name),
        capabilities: mappedCapabilities
      };
    }),

    actions: {
      selectRole: function selectRole(role) {
        var _this2 = this;

        var roleToUpdate = this.get('model').findBy('id', role.dasherize());
        this.set('currentRole', role);
        this.set('roleToUpdate', roleToUpdate);
        try {
          if (roleToUpdate) {
            (function () {
              var capabilities = roleToUpdate.get('capabilities');
              _this2.get('availableCapabilities').forEach(function (section) {
                section.capabilities.forEach(function (capability) {
                  if (capabilities.includes(capability)) {
                    _this2.set(capability, true);
                  } else {
                    _this2.set(capability, false);
                  }
                });
              });
            })();
          } else {
            (function () {
              var defaultCapabilities = _this2.get('defaultCapabilities');
              Object.keys(defaultCapabilities).forEach(function (capability) {
                var capabilityRoles = defaultCapabilities[capability];
                if (capabilityRoles.includes(role)) {
                  _this2.set(capability.camelize(), true);
                } else {
                  _this2.set(capability.camelize(), false);
                }
              });
            })();
          }
        } catch (ex) {
          console.log('ex setting role:', ex);
        }
      },

      update: function update() {
        var _this3 = this;

        var currentRole = this.get('currentRole');
        var roleToUpdate = this.get('roleToUpdate');
        if (_ember['default'].isEmpty(roleToUpdate)) {
          roleToUpdate = this.get('store').createRecord('user-role', {
            id: currentRole.dasherize(),
            name: currentRole
          });
        }
        var capabilitiesToSave = [];
        this.get('availableCapabilities').forEach(function (section) {
          section.capabilities.forEach(function (capability) {
            if (_this3.get(capability) === true) {
              capabilitiesToSave.push(capability);
            }
          });
        });
        roleToUpdate.set('capabilities', capabilitiesToSave);
        roleToUpdate.save().then(function () {
          _this3.displayAlert(_this3.get('i18n').t('admin.roles.titles.roleSaved'), _this3.get('i18n').t('admin.roles.messages.roleSaved', { roleName: currentRole }));
        });
      }
    }

  });
});
define('hospitalrun/admin/roles/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractEditRoute, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend({
    hideNewButton: true,
    newTitle: (0, _emberI18n.translationMacro)('admin.userRoles'),
    editTitle: (0, _emberI18n.translationMacro)('admin.userRoles'),
    model: function model() {
      return this.get('store').findAll('user-role');
    }
  });
});
define("hospitalrun/admin/roles/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "2aNV3BOq", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],4]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"                \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"capability\",\"name\"]],[\"get\",[\"capability\",\"key\"]],[\"helper\",[\"concat\"],[\"checkbox\",\" checkbox-\",[\"get\",[\"capability\",\"key\"]]],null]]]],false],[\"text\",\"\\n\"]],\"locals\":[\"capability\"]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"detail-section\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"append\",[\"unknown\",[\"capabilitySection\",\"name\"]],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"capabilitySection\",\"capabilities\"]]],null,0],[\"text\",\"            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"capabilitySection\"]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"option\",[]],[\"dynamic-attr\",\"value\",[\"concat\",[[\"unknown\",[\"userRole\",\"name\"]]]]],[\"dynamic-attr\",\"selected\",[\"helper\",[\"eq\"],[[\"get\",[\"selectedRole\"]],[\"get\",[\"userRole\",\"name\"]]],null],null],[\"flush-element\"],[\"text\",\"\\n                \"],[\"append\",[\"unknown\",[\"userRole\",\"name\"]],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"userRole\"]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group has-success\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.role\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"select\",[]],[\"dynamic-attr\",\"onchange\",[\"helper\",[\"action\"],[[\"get\",[null]],\"selectRole\"],[[\"value\"],[\"target.value\"]]],null],[\"static-attr\",\"class\",\"form-control role-select\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"option\",[]],[\"static-attr\",\"disabled\",\"\"],[\"dynamic-attr\",\"selected\",[\"helper\",[\"is-not\"],[[\"get\",[\"selectedRole\"]]],null],null],[\"flush-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"filteredRoles\"]]],null,2],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"capabilitySections\"]]],null,1]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[null]],false]],3],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/admin/roles/template.hbs" } });
});
define('hospitalrun/admin/route', ['exports', 'hospitalrun/routes/abstract-module-route'], function (exports, _hospitalrunRoutesAbstractModuleRoute) {
  exports['default'] = _hospitalrunRoutesAbstractModuleRoute['default'].extend({
    addCapability: 'add_user',
    allowSearch: false,
    moduleName: 'admin',
    sectionTitle: 'Admin',

    editPath: (function () {
      return 'users.edit';
    }).property(),

    deletePath: (function () {
      return 'users.delete';
    }).property()
  });
});
define('hospitalrun/admin/textreplace/controller', ['exports', 'ember', 'ember-validations'], function (exports, _ember, _emberValidations) {
  exports['default'] = _ember['default'].Controller.extend(_emberValidations['default'], {
    hideCancelButton: true,
    updateCapability: 'update_config',

    createExpansion: (function () {
      var newExpansion = this.get('store').createRecord('text-expansion');
      this.set('newExpansion', newExpansion);
    }).on('init'),

    actions: {
      cancelExpansion: function cancelExpansion() {
        this.createExpansion();
      }
    },

    validations: {
      'newExpansion.from': {
        presence: true
      },
      'newExpansion.to': {
        presence: true
      }
    }
  });
});
define('hospitalrun/admin/textreplace/route', ['exports', 'hospitalrun/routes/abstract-index-route', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractIndexRoute, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend({
    pageTitle: (0, _emberI18n.translationMacro)('admin.textReplacements.pageTitle'),
    hideNewButton: true,

    model: function model() {
      var store = this.get('store');
      return store.findAll('text-expansion').then(function (result) {
        return result.filter(function (model) {
          var isNew = model.get('isNew');
          return !isNew;
        });
      });
    },

    setupController: function setupController(controller, model) {
      this._super(controller, model);
      controller.createExpansion();
    },

    actions: {
      addExpansion: function addExpansion(newExpansion) {
        var _this = this;

        newExpansion.save().then(function () {
          _this.refresh();
        })['catch'](function () {
          _this.refresh();
        });
      },

      deleteExpansion: function deleteExpansion(expansion) {
        var _this2 = this;

        expansion.deleteRecord();
        expansion.save().then(function () {
          _this2.refresh();
        })['catch'](function () {
          _this2.refresh();
        });
      }
    }
  });
});
define("hospitalrun/admin/textreplace/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "ixYKqrQh", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"admin.textReplacements.replDesc\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.from\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.to\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tbody\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\"]]],null,1],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"h3\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"admin.textReplacements.createNew\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"action\",\"formLayout\",\"showErrorsOnFocusIn\",\"submitButton\"],[[\"get\",[\"newExpansion\"]],\"addExpansion\",\"horizontal\",\"true\",false]],0],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn button-primary on-white\"],[\"dynamic-attr\",\"disabled\",[\"unknown\",[\"isInvalid\"]],null],[\"modifier\",[\"action\"],[[\"get\",[null]],\"addExpansion\",[\"get\",[\"newExpansion\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.add\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn button-default on-white\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"cancelExpansion\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.cancel\"],null],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"placeholder\"],[\"from\",[\"helper\",[\"t\"],[\"labels.from\"],null],[\"helper\",[\"t\"],[\"admin.textReplacements.toReplace\"],null]]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"placeholder\"],[\"to\",[\"helper\",[\"t\"],[\"labels.to\"],null],[\"helper\",[\"t\"],[\"admin.textReplacements.replaceWith\"],null]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"#\"],[\"append\",[\"unknown\",[\"expansion\",\"from\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"expansion\",\"to\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"pull-right btn button-default on-white\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"deleteExpansion\",[\"get\",[\"expansion\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"expansion\"]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/admin/textreplace/template.hbs" } });
});
define('hospitalrun/admin/visit-forms/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember', 'hospitalrun/mixins/visit-types'], function (exports, _hospitalrunControllersAbstractEditController, _ember, _hospitalrunMixinsVisitTypes) {
  var computed = _ember['default'].computed;
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsVisitTypes['default'], {
    hideCancelButton: true,
    updateCapability: 'update_config',
    visitTypesList: computed.alias('model.visitTypesList'),

    visitFormsForEditing: computed('model.visitForms', 'visitTypes', function () {
      var visitForms = this.get('model.visitForms');
      var visitTypes = this.get('visitTypes');

      var editList = visitTypes.map(function (visitType) {
        if (!visitForms[visitType.value]) {
          visitForms[visitType.value] = 'initial';
        }
        return {
          type: visitType.value,
          form: visitForms[visitType.value]
        };
      });
      return editList;
    }),

    visitTemplateIds: ['initial', 'followup'],

    visitTemplates: computed(function () {
      var i18n = this.get('i18n');
      var visitTemplateIds = this.get('visitTemplateIds');
      return visitTemplateIds.map(function (currentId) {
        return {
          id: currentId,
          value: i18n.t('admin.visitForms.labels.' + currentId)
        };
      });
    }),

    afterUpdate: function afterUpdate() {
      this.displayAlert(this.get('i18n').t('admin.address.titles.optionsSaved'), this.get('i18n').t('admin.address.messages.addressSaved'));
    },

    actions: {
      selectForm: function selectForm(visitType, event) {
        var visitForms = this.get('model.visitForms');
        visitForms[visitType] = event.target.value;
      }
    }
  });
});
define('hospitalrun/admin/visit-forms/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'ember', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractEditRoute, _ember, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend({
    hideNewButton: true,
    editTitle: (0, _emberI18n.translationMacro)('admin.visitForms.titles.visitForms'),
    newTitle: _ember['default'].computed.alias('editTitle'),
    model: function model() {
      var store = this.get('store');
      var promiseHash = {
        visitFormsOption: store.find('option', 'visit_forms'),
        visitTypes: store.find('lookup', 'visit_types')
      };
      return new _ember['default'].RSVP.Promise(function (resolve, reject) {
        _ember['default'].RSVP.hashSettled(promiseHash).then(function (results) {
          var model = _ember['default'].Object.create();
          if (results.visitTypes.state === 'fulfilled') {
            model.set('visitTypesList', results.visitTypes.value);
          }
          if (results.visitFormsOption.state === 'fulfilled') {
            model.set('visitForms', results.visitFormsOption.value);
          } else {
            model.set('visitForms', {});
          }
          resolve(model);
        }, reject);
      });
    }
  });
});
define("hospitalrun/admin/visit-forms/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "Wi/FzQog", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],3]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"option\",[]],[\"dynamic-attr\",\"value\",[\"concat\",[[\"unknown\",[\"visitTemplate\",\"id\"]]]]],[\"dynamic-attr\",\"selected\",[\"helper\",[\"eq\"],[[\"get\",[\"visitForm\",\"form\"]],[\"get\",[\"visitTemplate\",\"id\"]]],null],null],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"append\",[\"unknown\",[\"visitTemplate\",\"value\"]],false],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"visitTemplate\"]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"visitForm\",\"type\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"select\",[]],[\"dynamic-attr\",\"onchange\",[\"helper\",[\"action\"],[[\"get\",[null]],\"selectForm\",[\"get\",[\"visitForm\",\"type\"]]],null],null],[\"static-attr\",\"class\",\"form-control role-select\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"visitTemplates\"]]],null,1],[\"text\",\"            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"visitForm\"]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n\\n    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"admin.visitForms.labels.visitType\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"admin.visitForms.labels.form\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"visitFormsForEditing\"]]],null,2],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[null]],false]],0],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/admin/visit-forms/template.hbs" } });
});
define('hospitalrun/admin/workflow/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller'], function (exports, _hospitalrunControllersAbstractEditController) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend({
    hideCancelButton: true,
    updateCapability: 'update_config',

    afterUpdate: function afterUpdate() {
      this.displayAlert(this.get('i18n').t('admin.workflow.titles.optionsSaved'), this.get('i18n').t('admin.workflow.messages.optionsSaved'));
    }
  });
});
define('hospitalrun/admin/workflow/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractEditRoute, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend({
    hideNewButton: true,
    editTitle: (0, _emberI18n.translationMacro)('admin.workflow.editTitle'),

    model: function model() {
      var store = this.get('store');
      return store.find('option', 'workflow_options')['catch'](function () {
        // create a new workflow_option if none exists
        return store.push(store.normalize('option', {
          id: 'workflow_options',
          value: {
            admissionDeposit: false,
            clinicPrepayment: false,
            followupPrepayment: false,
            outpatientLabPrepayment: false,
            outpatientImagingPrepayment: false,
            outpatientMedicationPrepayment: false
          }
        }));
      });
    }
  });
});
define("hospitalrun/admin/workflow/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "Mr+Jr99y", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.workflow.admissionDepositLabel\"],null],\"value.admissionDeposit\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.workflow.clinicPrepaymentLabel\"],null],\"value.clinicPrepayment\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.workflow.followupPrepaymentLabel\"],null],\"value.followupPrepayment\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.workflow.outpatientLabLabel\"],null],\"value.outpatientLabPrepayment\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.workflow.outpatientImagingLabel\"],null],\"value.outpatientImagingPrepayment\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"admin.workflow.outpatientMedicationLabel\"],null],\"value.outpatientMedicationPrepayment\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/admin/workflow/template.hbs" } });
});
define('hospitalrun/allergy/edit/controller', ['exports', 'ember', 'hospitalrun/controllers/abstract-edit-controller'], function (exports, _ember, _hospitalrunControllersAbstractEditController) {
  var computed = _ember['default'].computed;
  var alias = _ember['default'].computed.alias;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var set = _ember['default'].set;
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend({
    i18n: inject.service(),
    editController: alias('model.editController'),
    newAllergy: false,

    additionalButtons: computed('model.isNew', function () {
      var model = get(this, 'model');
      var btn = get(this, 'i18n').t('buttons.delete');
      var isNew = get(model, 'isNew');
      if (!isNew) {
        return [{
          'class': 'btn btn-default warning',
          buttonAction: 'deleteAllergy',
          buttonIcon: 'octicon octicon-x',
          buttonText: btn
        }];
      }
    }),

    title: _ember['default'].computed('model', function () {
      var model = get(this, 'model');
      var i18n = get(this, 'i18n');
      var isNew = get(model, 'isNew');
      if (!isNew) {
        return i18n.t('allergies.titles.editAllergy');
      } else {
        return i18n.t('allergies.titles.addAllergy');
      }
    }),

    beforeUpdate: function beforeUpdate() {
      var allergy = get(this, 'model');
      set(this, 'newAllergy', get(allergy, 'isNew'));
      return _ember['default'].RSVP.Promise.resolve();
    },

    afterUpdate: function afterUpdate(allergy) {
      var newAllergy = get(this, 'newAllergy');
      if (newAllergy) {
        get(this, 'editController').send('addAllergy', allergy);
        set(this, 'name', '');
      } else {
        this.send('closeModal');
      }
    },

    actions: {
      cancel: function cancel() {
        this.send('closeModal');
      },

      deleteAllergy: function deleteAllergy() {
        var allergy = get(this, 'model');
        get(this, 'editController').send('deleteAllergy', allergy);
      }
    }
  });
});
define("hospitalrun/allergy/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "pZACHNtQ", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"title\",\"updateButtonText\",\"hideCancelButton\",\"isUpdateDisabled\",\"updateButtonAction\",\"additionalButtons\"],[[\"get\",[\"title\"]],[\"get\",[\"updateButtonText\"]],true,[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"additionalButtons\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"class\",\"label\",\"property\"],[\"col-xs-12 form-group required test-allergy\",[\"helper\",[\"t\"],[\"allergies.labels.allergyName\"],null],\"name\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/allergy/edit/template.hbs" } });
});
define('hospitalrun/app', ['exports', 'ember', 'hospitalrun/resolver', 'ember-load-initializers', 'hospitalrun/config/environment'], function (exports, _ember, _hospitalrunResolver, _emberLoadInitializers, _hospitalrunConfigEnvironment) {

  var App = undefined;

  _ember['default'].MODEL_FACTORY_INJECTIONS = true;

  App = _ember['default'].Application.extend({
    modulePrefix: _hospitalrunConfigEnvironment['default'].modulePrefix,
    podModulePrefix: _hospitalrunConfigEnvironment['default'].podModulePrefix,
    Resolver: _hospitalrunResolver['default']
  });

  (0, _emberLoadInitializers['default'])(App, _hospitalrunConfigEnvironment['default'].modulePrefix);

  exports['default'] = App;
});
define('hospitalrun/appointments/calendar/controller', ['exports', 'hospitalrun/appointments/index/controller', 'hospitalrun/mixins/appointment-statuses', 'moment', 'hospitalrun/mixins/visit-types', 'hospitalrun/utils/select-values', 'ember'], function (exports, _hospitalrunAppointmentsIndexController, _hospitalrunMixinsAppointmentStatuses, _moment, _hospitalrunMixinsVisitTypes, _hospitalrunUtilsSelectValues, _ember) {
  var computed = _ember['default'].computed;
  var alias = _ember['default'].computed.alias;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var isEmpty = _ember['default'].isEmpty;
  var set = _ember['default'].set;
  exports['default'] = _hospitalrunAppointmentsIndexController['default'].extend(_hospitalrunMixinsAppointmentStatuses['default'], _hospitalrunMixinsVisitTypes['default'], {
    appointmentType: null,
    endDate: null,
    location: null,
    provider: null,
    queryParams: ['appointmentType', 'endDate', 'provider', 'status', 'startDate', 'location', 'viewType'],
    startDate: null,
    status: null,
    viewType: 'agendaWeek',

    appointmentsController: inject.controller('appointments'),
    locations: alias('appointmentsController.locationList.value'),
    physicians: alias('appointmentsController.physicianList.value'),

    calendarDate: computed('startDate', function () {
      var startDate = get(this, 'startDate');
      if (!isEmpty(startDate)) {
        return (0, _moment['default'])(parseInt(startDate));
      }
    }),

    locationList: computed('locations', function () {
      return _hospitalrunUtilsSelectValues['default'].selectValues(get(this, 'locations'), true);
    }),

    physicianList: computed('physicians', function () {
      return _hospitalrunUtilsSelectValues['default'].selectValues(get(this, 'physicians'), true);
    }),

    _getSelectedFilteringCriteria: function _getSelectedFilteringCriteria() {
      var rawCriteria = {
        status: get(this, 'model.selectedStatus'),
        type: get(this, 'model.selectedAppointmentType'),
        provider: get(this, 'model.selectedProvider'),
        location: get(this, 'model.selectedLocation')
      };

      return {
        status: isEmpty(rawCriteria.status) ? null : rawCriteria.status,
        type: isEmpty(rawCriteria.type) ? null : rawCriteria.type,
        provider: isEmpty(rawCriteria.provider) ? null : rawCriteria.provider,
        location: isEmpty(rawCriteria.location) ? null : rawCriteria.location
      };
    },

    actions: {
      clearFilteringCriteria: function clearFilteringCriteria() {
        set(this, 'model.selectedStatus', null);
        set(this, 'model.selectedAppointmentType', null);
        set(this, 'model.selectedProvider', null);
        set(this, 'model.selectedLocation', null);
        this.send('filter');
      },

      createNewAppointment: function createNewAppointment(dateClicked) {
        var newAppointment = this.store.createRecord('appointment', {
          appointmentType: 'Admission',
          allDay: false,
          selectPatient: true,
          startDate: dateClicked.local().toDate()
        });
        this.send('editAppointment', newAppointment);
      },

      filter: function filter() {
        var criteria = this._getSelectedFilteringCriteria();
        this.setProperties({
          appointmentType: criteria.type,
          provider: criteria.provider,
          status: criteria.status,
          location: criteria.location
        });
      },

      handleVisualConfigurationChanged: function handleVisualConfigurationChanged(newConfiguration) {
        this.setProperties(newConfiguration);
      },

      navigateToAppointment: function navigateToAppointment(calendarEvent) {
        this.send('editAppointment', calendarEvent.referencedAppointment);
      },

      updateAppointment: function updateAppointment(calendarEvent) {
        var _this = this;

        var appointmentToUpdate = calendarEvent.referencedAppointment;
        var newEnd = calendarEvent.end.local().toDate();
        var newStart = calendarEvent.start.local().toDate();
        set(appointmentToUpdate, 'startDate', newStart);
        set(appointmentToUpdate, 'endDate', newEnd);
        appointmentToUpdate.save()['catch'](function (error) {
          _this.send('error', error, 'appointments.calendar');
        });
      }
    }
  });
});
define('hospitalrun/appointments/calendar/route', ['exports', 'hospitalrun/appointments/index/route', 'ember', 'ember-i18n'], function (exports, _hospitalrunAppointmentsIndexRoute, _ember, _emberI18n) {
  var get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _hospitalrunAppointmentsIndexRoute['default'].extend({
    dateIntervalEnd: null,
    dateIntervalStart: null,
    editReturn: 'appointments.calendar',
    filterParams: ['appointmentType', 'provider', 'status', 'location'],
    modelName: 'appointment',
    pageTitle: (0, _emberI18n.translationMacro)('appointments.calendarTitle'),

    queryParams: {
      appointmentType: { refreshModel: true },
      endDate: { refreshModel: true },
      provider: { refreshModel: true },
      status: { refreshModel: true },
      startDate: { refreshModel: true },
      location: { refreshModel: true },
      viewType: { refreshModel: false }
    },

    model: function model(params) {
      return this._super(params).then(this._createCalendarEvents.bind(this)).then(function (calendarEvents) {
        calendarEvents.selectedAppointmentType = params.appointmentType;
        calendarEvents.selectedProvider = params.provider;
        calendarEvents.selectedStatus = params.status;
        calendarEvents.selectedLocation = params.location;
        return calendarEvents;
      });
    },

    _createCalendarEvent: function _createCalendarEvent(appointment) {
      var title = get(appointment, 'patient.displayName');
      var provider = get(appointment, 'provider');
      if (!isEmpty(provider)) {
        title = title + '\n' + provider;
      }
      var event = {
        allDay: get(appointment, 'allDay'),
        title: title,
        start: get(appointment, 'startDate'),
        end: get(appointment, 'endDate'),
        referencedAppointment: appointment
      };
      var location = get(appointment, 'location');
      if (isEmpty(location)) {
        var i18n = get(this, 'i18n');
        location = i18n.t('appointments.labels.noLocation').toString();
      }
      event.resourceId = location.toLowerCase();
      return event;
    },

    _createCalendarEvents: function _createCalendarEvents(appointments) {
      var _this = this;

      var events = [];
      var resources = [];
      appointments.forEach(function (appointment) {
        var event = _this._createCalendarEvent(appointment);
        events.push(event);
        var resourceId = get(event, 'resourceId');
        if (!resources.findBy('id', resourceId)) {
          resources.push({
            id: resourceId,
            title: get(event, 'referencedAppointment.location')
          });
        }
      });
      return {
        events: events,
        resources: resources
      };
    },

    _modelQueryParams: function _modelQueryParams(params) {
      var endDate = params.endDate;
      var startDate = params.startDate;

      if (endDate === null || startDate === null) {
        return this._super(params);
      }
      var searchOptions = {
        startkey: [parseInt(startDate), parseInt(startDate), this._getMinPouchId()],
        endkey: [parseInt(endDate), parseInt(endDate), this._getMaxPouchId()]
      };

      return {
        options: searchOptions,
        mapReduce: 'appointments_by_date'
      };
    }
  });
});
define("hospitalrun/appointments/calendar/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "lDeJjJGt", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-info\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0],[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"clearFilteringCriteria\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.clear\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"filter\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.filter\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"calendar-control\"],null,[[\"events\",\"defaultDate\",\"defaultView\",\"onDayClick\",\"onEventClick\",\"onEventDrop\",\"onEventResize\",\"onVisualConfigurationChanged\",\"userCanEdit\"],[[\"get\",[\"model\",\"events\"]],[\"get\",[\"calendarDate\"]],[\"get\",[\"viewType\"]],[\"helper\",[\"action\"],[[\"get\",[null]],\"createNewAppointment\"],null],[\"helper\",[\"action\"],[[\"get\",[null]],\"navigateToAppointment\"],null],[\"helper\",[\"action\"],[[\"get\",[null]],\"updateAppointment\"],null],[\"helper\",[\"action\"],[[\"get\",[null]],\"updateAppointment\"],null],[\"helper\",[\"action\"],[[\"get\",[null]],\"handleVisualConfigurationChanged\"],null],[\"get\",[\"canEdit\"]]]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\"],[\"col-sm-3 form-input-group\",[\"helper\",[\"t\"],[\"models.appointment.labels.status\"],null],\"selectedStatus\",[\"get\",[\"appointmentStatusesWithEmpty\"]]]]],false],[\"text\",\"\\n              \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\"],[\"col-sm-3 form-input-group\",[\"helper\",[\"t\"],[\"models.appointment.labels.type\"],null],\"selectedAppointmentType\",[\"get\",[\"visitTypesWithEmpty\"]]]]],false],[\"text\",\"\\n              \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\"],[\"col-sm-3 form-input-group\",[\"helper\",[\"t\"],[\"models.appointment.labels.provider\"],null],\"selectedProvider\",[\"get\",[\"physicianList\"]]]]],false],[\"text\",\"\\n              \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\"],[\"col-sm-3 form-input-group\",[\"helper\",[\"t\"],[\"models.appointment.labels.location\"],null],\"selectedLocation\",[\"get\",[\"locationList\"]]]]],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/appointments/calendar/template.hbs" } });
});
define('hospitalrun/appointments/delete/controller', ['exports', 'hospitalrun/controllers/abstract-delete-controller'], function (exports, _hospitalrunControllersAbstractDeleteController) {
  exports['default'] = _hospitalrunControllersAbstractDeleteController['default'].extend({
    title: 'Delete Appointment',

    afterDeleteAction: (function () {
      var deleteFromPatient = this.get('model.deleteFromPatient');
      if (deleteFromPatient) {
        return 'appointmentDeleted';
      } else {
        return 'closeModal';
      }
    }).property('model.deleteFromPatient')
  });
});
define("hospitalrun/appointments/delete/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "UFg2bH6V", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-warning-sign\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\\n    \"],[\"append\",[\"helper\",[\"t\"],[\"messages.delete_singular\"],[[\"name\"],[[\"helper\",[\"t\"],[\"models.appointment.names.singular\"],null]]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/appointments/delete/template.hbs" } });
});
define('hospitalrun/appointments/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'hospitalrun/mixins/appointment-statuses', 'ember', 'hospitalrun/mixins/patient-submodule', 'hospitalrun/mixins/visit-types'], function (exports, _hospitalrunControllersAbstractEditController, _hospitalrunMixinsAppointmentStatuses, _ember, _hospitalrunMixinsPatientSubmodule, _hospitalrunMixinsVisitTypes) {
  var computed = _ember['default'].computed;
  var alias = _ember['default'].computed.alias;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var set = _ember['default'].set;
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsAppointmentStatuses['default'], _hospitalrunMixinsPatientSubmodule['default'], _hospitalrunMixinsVisitTypes['default'], {
    findPatientVisits: false,
    updateCapability: 'add_appointment',

    appointmentsController: inject.controller('appointments'),
    physicianList: alias('appointmentsController.physicianList'),
    surgeryLocationList: alias('appointmentsController.surgeryLocationList'),
    visitLocationList: alias('appointmentsController.locationList'),
    visitTypesList: alias('appointmentsController.visitTypesList'),

    cancelAction: computed('model.returnTo', function () {
      var returnTo = get(this, 'model.returnTo');
      if (_ember['default'].isEmpty(returnTo)) {
        return this._super();
      } else {
        return 'returnTo';
      }
    }),

    isAdmissionAppointment: computed('model.appointmentType', function () {
      var model = get(this, 'model');
      var appointmentType = get(model, 'appointmentType');
      var isAdmissionAppointment = appointmentType === 'Admission';
      return isAdmissionAppointment;
    }),

    lookupListsToUpdate: computed('model.appointmentType', function () {
      var appointmentType = get(this, 'model.appointmentType');
      var lists = [{
        name: 'physicianList',
        property: 'model.provider',
        id: 'physician_list'
      }];
      if (appointmentType === 'Surgery') {
        lists.push({
          name: 'visitLocationList',
          property: 'model.location',
          id: 'visit_location_list'
        });
      } else {
        lists.push({
          name: 'surgeryLocationList',
          property: 'model.location',
          id: 'procedure_locations'
        });
      }
    }),

    showTime: computed('model.allDay', 'isAdmissionAppointment', function () {
      var allDay = get(this, 'model.allDay');
      var isAdmissionAppointment = get(this, 'isAdmissionAppointment');
      return !allDay && isAdmissionAppointment;
    }),

    afterUpdate: function afterUpdate(model) {
      var i18n = get(this, 'i18n');
      var patientInfo = {
        patient: get(model, 'patient.displayName')
      };
      var message = i18n.t('appointments.messages.appointmentSaved', patientInfo);
      var title = i18n.t('appointments.titles.appointmentSaved');
      this.displayAlert(title, message);
    },

    actions: {
      appointmentTypeChanged: function appointmentTypeChanged(appointmentType) {
        var model = get(this, 'model');
        set(model, 'appointmentType', appointmentType);
        var isAdmissionAppointment = get(this, 'isAdmissionAppointment');
        set(model, 'allDay', isAdmissionAppointment);
      }
    }
  });
});
define('hospitalrun/appointments/edit/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'hospitalrun/mixins/add-to-patient-route', 'ember', 'moment', 'hospitalrun/mixins/patient-list-route', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractEditRoute, _hospitalrunMixinsAddToPatientRoute, _ember, _moment, _hospitalrunMixinsPatientListRoute, _emberI18n) {
  var get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;
  var resolve = _ember['default'].RSVP.resolve;
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend(_hospitalrunMixinsAddToPatientRoute['default'], _hospitalrunMixinsPatientListRoute['default'], {

    editTitle: (0, _emberI18n.translationMacro)('appointments.editTitle'),
    modelName: 'appointment',
    newButtonText: (0, _emberI18n.translationMacro)('appointments.buttons.newButton'),

    newTitle: (0, _emberI18n.translationMacro)('appointments.newTitle'),

    getNewData: function getNewData(params) {
      var idParam = get(this, 'idParam');
      var newData = {
        appointmentType: 'Admission',
        allDay: true,
        selectPatient: true,
        startDate: new Date()
      };
      if (!isEmpty(idParam) && params[idParam] === 'newsurgery') {
        newData.appointmentType = 'Surgery';
        newData.allDay = false;
        newData.endDate = (0, _moment['default'])().add('1', 'hours').toDate();
        newData.returnTo = 'appointments.theater';
      }
      return resolve(newData);
    },

    getScreenTitle: function getScreenTitle(model) {
      var appointmentType = get(model, 'appointmentType');
      if (appointmentType === 'Surgery') {
        var i18n = get(this, 'i18n');
        var isNew = get(model, 'isNew');
        if (isNew) {
          return i18n.t('appointments.titles.newSurgicalAppointment');
        } else {
          return i18n.t('appointments.titles.editSurgicalAppointment');
        }
      } else {
        return this._super(model);
      }
    },

    model: function model(params) {
      var idParam = this.get('idParam');
      var modelId = params[idParam];
      if (!isEmpty(idParam) && modelId.indexOf('new') === 0) {
        if (!isEmpty(params.forPatientId)) {
          var modelPromise = this._super(params);
          return this._setPatientOnModel(modelPromise, params.forPatientId);
        } else if (!isEmpty(params.forVisitId)) {
          var modelPromise = this._super(params);
          return this._setVisitOnModel(modelPromise, params.forVisitId);
        } else {
          return this._createNewRecord(params);
        }
      } else {
        return this._super(params);
      }
    }

  });
});
define("hospitalrun/appointments/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "TCL5xbjW", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],7]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-input-group col-sm-6 required test-appointment-type\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"static-attr\",\"for\",\"startTime\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"models.appointment.labels.type\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"select-list\"],null,[[\"content\",\"optionLabelPath\",\"optionValuePath\",\"value\",\"class\",\"id\",\"action\"],[[\"get\",[\"visitTypes\"]],\"value\",\"id\",[\"get\",[\"model\",\"appointmentType\"]],\"form-control\",\"appointmentType\",[\"helper\",[\"action\"],[[\"get\",[null]],\"appointmentTypeChanged\"],null]]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\"],[\"col-sm-6 test-appointment-with\",\"provider\",[\"helper\",[\"t\"],[\"models.appointment.labels.provider\"],null],[\"get\",[\"physicianList\"]],[\"get\",[\"model\",\"provider\"]]]]],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\"],[\"col-sm-6 test-appointment-location\",\"location\",[\"helper\",[\"t\"],[\"models.appointment.labels.location\"],null],[\"get\",[\"visitLocationList\"]],[\"get\",[\"model\",\"location\"]]]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"property\",\"label\",\"content\"],[\"form-input-group col-sm-3 test-appointment-status\",\"status\",[\"helper\",[\"t\"],[\"models.appointment.labels.status\"],null],[\"get\",[\"appointmentStatuses\"]]]]],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\"],[\"col-sm-6 test-appointment-with\",\"provider\",[\"helper\",[\"t\"],[\"models.appointment.labels.provider\"],null],[\"get\",[\"physicianList\"]],[\"get\",[\"model\",\"provider\"]]]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\"],[\"col-sm-6 test-appointment-location\",\"location\",[\"helper\",[\"t\"],[\"models.appointment.labels.location\"],null],[\"get\",[\"surgeryLocationList\"]],[\"get\",[\"model\",\"location\"]]]]],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"date-time-picker\"],null,[[\"datePickerClass\",\"label\",\"model\"],[\"required test-appointment-date\",[\"helper\",[\"t\"],[\"labels.date\"],null],[\"get\",[\"model\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"showTime\",\"class\"],[\"startDate\",[\"helper\",[\"t\"],[\"models.appointment.labels.startDate\"],null],[\"get\",[\"showTime\"]],\"col-sm-4 required test-appointment-start\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"showTime\",\"class\"],[\"endDate\",[\"helper\",[\"t\"],[\"models.appointment.labels.endDate\"],null],[\"get\",[\"showTime\"]],\"col-sm-4 required test-appointment-end\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"patient-summary\"],null,[[\"patient\",\"returnTo\",\"returnToContext\",\"disablePatientLink\"],[[\"get\",[\"model\",\"patient\"]],\"appointments.edit\",[\"get\",[\"model\",\"id\"]],[\"get\",[\"model\",\"isNew\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"patient-typeahead\"],null,[[\"property\",\"label\",\"content\",\"selection\",\"class\"],[\"patientTypeAhead\",[\"helper\",[\"t\"],[\"models.patient.names.singular\"],null],[\"get\",[\"patientList\"]],[\"get\",[\"selectedPatient\"]],\"required test-patient-input\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"model\",\"selectPatient\"]]],null,5,4],[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"isAdmissionAppointment\"]]],null,3,2],[\"text\",\"      \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"models.appointment.labels.allDay\"],null],\"allDay\",\"col-sm-2 appointment-all-day\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\\n\"],[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[[\"get\",[\"model\",\"appointmentType\"]],\"Surgery\"],null]],null,1,0],[\"text\",\"    \"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"label\",\"property\",\"rows\"],[[\"helper\",[\"t\"],[\"models.appointment.labels.notes\"],null],\"notes\",3]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],6]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/appointments/edit/template.hbs" } });
});
define('hospitalrun/appointments/index/controller', ['exports', 'hospitalrun/controllers/abstract-paged-controller', 'hospitalrun/mixins/user-session'], function (exports, _hospitalrunControllersAbstractPagedController, _hospitalrunMixinsUserSession) {
  exports['default'] = _hospitalrunControllersAbstractPagedController['default'].extend(_hospitalrunMixinsUserSession['default'], {
    startKey: [],
    canAddVisit: (function () {
      return this.currentUserCan('add_visit');
    }).property(),

    canEdit: (function () {
      // Add and edit are the same capability
      return this.currentUserCan('add_appointment');
    }).property(),

    canDelete: (function () {
      return this.currentUserCan('delete_appointment');
    }).property(),

    sortProperties: ['startDate', 'endDate'],
    sortAscending: true
  });
});
define('hospitalrun/appointments/index/route', ['exports', 'hospitalrun/routes/abstract-index-route', 'moment', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractIndexRoute, _moment, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend({
    editReturn: 'appointments.index',
    modelName: 'appointment',
    newButtonText: (0, _emberI18n.translationMacro)('appointments.buttons.newButton'),
    pageTitle: (0, _emberI18n.translationMacro)('appointments.thisWeek'),

    _getStartKeyFromItem: function _getStartKeyFromItem(item) {
      var endDate = item.get('endDate');
      var id = this._getPouchIdFromItem(item);
      var startDate = item.get('startDate');
      if (endDate && endDate !== '') {
        endDate = new Date(endDate);
        if (endDate.getTime) {
          endDate = endDate.getTime();
        }
      }
      if (startDate && startDate !== '') {
        startDate = new Date(startDate);
        if (startDate.getTime) {
          startDate = startDate.getTime();
        }
      }

      return [startDate, endDate, id];
    },

    _modelQueryParams: function _modelQueryParams() {
      var endOfWeek = (0, _moment['default'])().endOf('week').toDate().getTime();
      var startOfWeek = (0, _moment['default'])().startOf('week').toDate().getTime();
      var maxId = this._getMaxPouchId();
      return {
        options: {
          startkey: [startOfWeek, null, null],
          endkey: [endOfWeek, endOfWeek, maxId]
        },
        mapReduce: 'appointments_by_date'
      };
    },

    actions: {
      editAppointment: function editAppointment(appointment) {
        appointment.set('returnTo', this.get('editReturn'));
        this.send('editItem', appointment);
      }
    }
  });
});
define("hospitalrun/appointments/index/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "iYHwvIbB", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"      \"],[\"partial\",\"appointments/item\"],[\"text\",\"\\n\"]],\"locals\":[\"appointment\"]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"models.appointment.labels.appointmentDate\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"models.patient.labels.name\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"models.appointment.labels.type\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"models.appointment.labels.location\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"models.appointment.labels.provider\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"models.appointment.labels.status\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\"]]],null,0],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/appointments/index/template.hbs" } });
});
define("hospitalrun/appointments/item/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "nE13fpXw", "block": "{\"statements\":[[\"open-element\",\"tr\",[]],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editAppointment\",[\"get\",[\"appointment\"]]]],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"appointment-date\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"append\",[\"unknown\",[\"appointment\",\"formattedAppointmentDate\"]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"appointment\",\"patient\",\"displayName\"]],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"appointment\",\"appointmentType\"]],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"appointment\",\"location\"]],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"appointment\",\"provider\"]],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"appointment-status\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"appointment\",\"displayStatus\"]],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canEdit\"]]],null,3],[\"block\",[\"if\"],[[\"get\",[\"canAddVisit\"]]],null,2],[\"block\",[\"if\"],[[\"get\",[\"canDelete\"]]],null,0],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"deleteItem\",[\"get\",[\"appointment\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"checkIn\",[\"get\",[\"appointment\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-log-in\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"t\"],[\"visits.buttons.checkIn\"],null],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[[\"get\",[\"appointment\",\"displayStatus\"]],\"Scheduled\"],null]],null,1]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editAppointment\",[\"get\",[\"appointment\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/appointments/item/template.hbs" } });
});
define('hospitalrun/appointments/route', ['exports', 'hospitalrun/routes/abstract-module-route', 'hospitalrun/mixins/user-session', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractModuleRoute, _hospitalrunMixinsUserSession, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractModuleRoute['default'].extend(_hospitalrunMixinsUserSession['default'], {
    addCapability: 'add_appointment',
    allowSearch: false,
    currentScreenTitle: (0, _emberI18n.translationMacro)('appointments.currentScreenTitle'),
    editTitle: (0, _emberI18n.translationMacro)('appointments.editTitle'),
    newTitle: (0, _emberI18n.translationMacro)('appointments.newTitle'),
    moduleName: 'appointments',
    newButtonText: (0, _emberI18n.translationMacro)('appointments.buttons.newButton'),
    sectionTitle: (0, _emberI18n.translationMacro)('appointments.sectionTitle'),

    actions: {
      checkIn: function checkIn(appointment) {
        var patient = appointment.get('patient');
        var visitProps = appointment.getProperties('startDate', 'endDate', 'location', 'patient');
        visitProps.visitType = appointment.get('appointmentType');
        visitProps.examiner = appointment.get('provider');
        visitProps.appointment = appointment;
        visitProps.hidePatientSelection = true;
        visitProps.patient = patient;
        visitProps.returnTo = 'appointments';
        this.transitionTo('visits.edit', 'checkin').then((function (newRoute) {
          newRoute.currentModel.setProperties(visitProps);
          newRoute.controller.getPatientDiagnoses(patient, newRoute.currentModel);
        }).bind(this));
      }
    },

    additionalModels: [{
      name: 'physicianList',
      findArgs: ['lookup', 'physician_list']
    }, {
      name: 'locationList',
      findArgs: ['lookup', 'visit_location_list']
    }, {
      name: 'surgeryLocationList',
      findArgs: ['lookup', 'procedure_locations']
    }, {
      name: 'visitTypesList',
      findArgs: ['lookup', 'visit_types']
    }]
  });
});
define('hospitalrun/appointments/search/controller', ['exports', 'hospitalrun/appointments/index/controller', 'hospitalrun/mixins/appointment-statuses', 'ember', 'hospitalrun/utils/select-values', 'hospitalrun/mixins/visit-types'], function (exports, _hospitalrunAppointmentsIndexController, _hospitalrunMixinsAppointmentStatuses, _ember, _hospitalrunUtilsSelectValues, _hospitalrunMixinsVisitTypes) {
  exports['default'] = _hospitalrunAppointmentsIndexController['default'].extend(_hospitalrunMixinsAppointmentStatuses['default'], _hospitalrunMixinsVisitTypes['default'], {
    appointmentsController: _ember['default'].inject.controller('appointments'),
    appointmentType: null,
    physicians: _ember['default'].computed.alias('appointmentsController.physicianList.value'),
    physicianList: (function () {
      return _hospitalrunUtilsSelectValues['default'].selectValues(this.get('physicians'), true);
    }).property('physicians'),

    provider: null,
    queryParams: ['appointmentType', 'provider', 'status', 'startKey', 'startDate'],
    selectedProvider: null,
    selectedStatus: null,
    sortProperties: null,
    startDate: null,
    startKey: [],
    status: null,
    visitTypesList: _ember['default'].computed.alias('appointmentsController.visitTypesList'),

    actions: {
      search: function search() {
        var appointmentType = this.get('model.selectedAppointmentType');
        var fieldsToSet = {
          startKey: [],
          previousStartKey: null,
          previousStartKeys: []
        };
        var provider = this.get('model.selectedProvider');
        var status = this.get('model.selectedStatus');
        var startDate = this.get('model.selectedStartingDate');

        if (_ember['default'].isEmpty(appointmentType)) {
          fieldsToSet.appointmentType = null;
        } else {
          fieldsToSet.appointmentType = appointmentType;
        }
        if (_ember['default'].isEmpty(provider)) {
          fieldsToSet.provider = null;
        } else {
          fieldsToSet.provider = provider;
        }
        if (_ember['default'].isEmpty(status)) {
          fieldsToSet.status = null;
        } else {
          fieldsToSet.status = status;
        }
        if (!_ember['default'].isEmpty(startDate)) {
          fieldsToSet.startDate = startDate.getTime();
        }
        if (!_ember['default'].isEmpty(fieldsToSet)) {
          this.setProperties(fieldsToSet);
        }
      }
    }
  });
});
define('hospitalrun/appointments/search/route', ['exports', 'hospitalrun/appointments/index/route', 'hospitalrun/mixins/date-format', 'ember', 'moment', 'ember-i18n'], function (exports, _hospitalrunAppointmentsIndexRoute, _hospitalrunMixinsDateFormat, _ember, _moment, _emberI18n) {
  exports['default'] = _hospitalrunAppointmentsIndexRoute['default'].extend(_hospitalrunMixinsDateFormat['default'], {
    editReturn: 'appointments.search',
    filterParams: ['appointmentType', 'provider', 'status'],
    modelName: 'appointment',
    pageTitle: (0, _emberI18n.translationMacro)('appointments.searchTitle'),

    queryParams: {
      appointmentType: { refreshModel: true },
      provider: { refreshModel: true },
      status: { refreshModel: true },
      startDate: { refreshModel: true },
      startKey: { refreshModel: true }
    },

    _modelQueryParams: function _modelQueryParams(params) {
      var startDate = params.startDate;

      var maxValue = this.get('maxValue');
      if (_ember['default'].isEmpty(startDate)) {
        startDate = (0, _moment['default'])();
      } else {
        startDate = (0, _moment['default'])(parseInt(startDate));
      }
      var startOfDay = startDate.startOf('day').toDate().getTime();
      var searchOptions = {
        startkey: [startOfDay, null, 'appointment_'],
        endkey: [maxValue, maxValue, 'appointment_' + maxValue]
      };
      return {
        options: searchOptions,
        mapReduce: 'appointments_by_date'
      };
    },

    model: function model(params) {
      return this._super(params).then((function (model) {
        model.setProperties({
          selectedAppointmentType: params.appointmentType,
          selectedProvider: params.provider,
          selectedStatus: params.status
        });
        var startDate = params.startDate;

        startDate = new Date();
        if (!_ember['default'].isEmpty(params.startDate)) {
          startDate.setTime(params.startDate);
        }
        model.set('selectedStartingDate', startDate);
        model.set('display_selectedStartingDate', this._dateFormat(startDate));
        return model;
      }).bind(this));
    }

  });
});
define("hospitalrun/appointments/search/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "AlV13qLa", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]],7]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"      \"],[\"partial\",\"appointments/item\"],[\"text\",\"\\n\"]],\"locals\":[\"appointment\"]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"models.appointment.labels.status\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"models.appointment.labels.provider\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"models.appointment.labels.location\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"models.appointment.labels.type\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"models.appointment.labels.appointmentDate\"],null],false]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"selectedStartingDate\",[\"helper\",[\"t\"],[\"appointments.labels.selectedStartingDate\"],null],\"col-sm-3\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"property\",\"label\",\"content\"],[\"col-sm-3 form-input-group\",\"selectedStatus\",[\"helper\",[\"t\"],[\"models.appointment.labels.status\"],null],[\"get\",[\"appointmentStatusesWithEmpty\"]]]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\"],[\"col-sm-3 form-input-group\",[\"helper\",[\"t\"],[\"models.appointment.labels.type\"],null],\"selectedAppointmentType\",[\"get\",[\"visitTypesWithEmpty\"]]]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"property\",\"label\",\"content\"],[\"col-sm-3 form-input-group\",\"selectedProvider\",[\"helper\",[\"t\"],[\"models.appointment.labels.provider\"],null],[\"get\",[\"physicianList\"]]]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-info\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],6],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"search\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.search\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"date\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],5],[\"text\",\"\\n      \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"models.patient.labels.name\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"appointmentType\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],4],[\"text\",\"\\n      \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"location\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],3],[\"text\",\"\\n      \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"provider\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],2],[\"text\",\"\\n      \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"status\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],1],[\"text\",\"\\n      \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\"]]],null,0],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/appointments/search/template.hbs" } });
});
define('hospitalrun/appointments/theater/controller', ['exports', 'hospitalrun/appointments/calendar/controller'], function (exports, _hospitalrunAppointmentsCalendarController) {
  exports['default'] = _hospitalrunAppointmentsCalendarController['default'].extend({
    dayGroupByResource: {
      day: {
        groupByResource: true
      }
    },

    actions: {
      createNewAppointment: function createNewAppointment(dateClicked) {
        var newAppointment = this.store.createRecord('appointment', {
          appointmentType: 'Surgery',
          selectPatient: true,
          startDate: dateClicked.local().toDate(),
          endDate: dateClicked.add('1', 'hours').local().toDate()
        });
        this.send('editAppointment', newAppointment);
      }
    }
  });
});
define('hospitalrun/appointments/theater/route', ['exports', 'hospitalrun/appointments/calendar/route', 'ember-i18n'], function (exports, _hospitalrunAppointmentsCalendarRoute, _emberI18n) {
  exports['default'] = _hospitalrunAppointmentsCalendarRoute['default'].extend({
    editReturn: 'appointments.theater',
    newButtonText: (0, _emberI18n.translationMacro)('appointments.buttons.scheduleSurgery'),
    pageTitle: (0, _emberI18n.translationMacro)('appointments.titles.theaterSchedule'),

    _modelQueryParams: function _modelQueryParams(params) {
      var queryParams = this._super(params);
      queryParams.mapReduce = 'surgical_appointments_by_date';
      return queryParams;
    },

    actions: {
      newItem: function newItem() {
        this.transitionTo('appointments.edit', 'newsurgery');
      }
    }
  });
});
define("hospitalrun/appointments/theater/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "ExdA/9xg", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-info\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0],[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"clearFilteringCriteria\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.clear\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"filter\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.filter\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"calendar-control\"],null,[[\"events\",\"defaultDate\",\"defaultView\",\"onDayClick\",\"onEventClick\",\"onEventDrop\",\"onEventResize\",\"onVisualConfigurationChanged\",\"resources\",\"userCanEdit\",\"views\"],[[\"get\",[\"model\",\"events\"]],[\"get\",[\"calendarDate\"]],[\"get\",[\"viewType\"]],[\"helper\",[\"action\"],[[\"get\",[null]],\"createNewAppointment\"],null],[\"helper\",[\"action\"],[[\"get\",[null]],\"navigateToAppointment\"],null],[\"helper\",[\"action\"],[[\"get\",[null]],\"updateAppointment\"],null],[\"helper\",[\"action\"],[[\"get\",[null]],\"updateAppointment\"],null],[\"helper\",[\"action\"],[[\"get\",[null]],\"handleVisualConfigurationChanged\"],null],[\"get\",[\"model\",\"resources\"]],[\"get\",[\"canEdit\"]],[\"get\",[\"dayGroupByResource\"]]]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\"],[\"col-sm-3 form-input-group\",[\"helper\",[\"t\"],[\"models.appointment.labels.status\"],null],\"selectedStatus\",[\"get\",[\"appointmentStatusesWithEmpty\"]]]]],false],[\"text\",\"\\n              \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\"],[\"col-sm-3 form-input-group\",[\"helper\",[\"t\"],[\"models.appointment.labels.provider\"],null],\"selectedProvider\",[\"get\",[\"physicianList\"]]]]],false],[\"text\",\"\\n              \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\"],[\"col-sm-3 form-input-group\",[\"helper\",[\"t\"],[\"models.appointment.labels.location\"],null],\"selectedLocation\",[\"get\",[\"locationList\"]]]]],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/appointments/theater/template.hbs" } });
});
define('hospitalrun/appointments/today/controller', ['exports', 'hospitalrun/appointments/index/controller'], function (exports, _hospitalrunAppointmentsIndexController) {
  exports['default'] = _hospitalrunAppointmentsIndexController['default'].extend({
    startKey: []
  });
});
define('hospitalrun/appointments/today/route', ['exports', 'hospitalrun/appointments/index/route', 'moment', 'ember-i18n'], function (exports, _hospitalrunAppointmentsIndexRoute, _moment, _emberI18n) {
  exports['default'] = _hospitalrunAppointmentsIndexRoute['default'].extend({
    editReturn: 'appointments.today',
    modelName: 'appointment',
    pageTitle: (0, _emberI18n.translationMacro)('appointments.todayTitle'),

    _modelQueryParams: function _modelQueryParams() {
      var endOfDay = (0, _moment['default'])().endOf('day').toDate().getTime();
      var maxValue = this.get('maxValue');
      var startOfDay = (0, _moment['default'])().startOf('day').toDate().getTime();
      return {
        options: {
          startkey: [startOfDay, null, 'appointment_'],
          endkey: [endOfDay, endOfDay, 'appointment_' + maxValue]
        },
        mapReduce: 'appointments_by_date'
      };
    }
  });
});
define("hospitalrun/appointments/today/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "NpXWri4D", "block": "{\"statements\":[[\"partial\",\"appointments/index\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/appointments/today/template.hbs" } });
});
define('hospitalrun/authenticators/custom', ['exports', 'ember', 'ember-simple-auth/authenticators/base', 'npm:crypto', 'hospitalrun/mixins/map-oauth-params', 'hospitalrun/mixins/oauth-headers'], function (exports, _ember, _emberSimpleAuthAuthenticatorsBase, _npmCrypto, _hospitalrunMixinsMapOauthParams, _hospitalrunMixinsOauthHeaders) {
  var alias = _ember['default'].computed.alias;
  var get = _ember['default'].get;
  var RSVP = _ember['default'].RSVP;
  exports['default'] = _emberSimpleAuthAuthenticatorsBase['default'].extend(_hospitalrunMixinsMapOauthParams['default'], _hospitalrunMixinsOauthHeaders['default'], {
    ajax: _ember['default'].inject.service(),
    config: _ember['default'].inject.service(),
    database: _ember['default'].inject.service(),
    serverEndpoint: '/auth/login',

    standAlone: alias('config.standAlone'),
    usersDB: alias('database.usersDB'),

    _checkUser: function _checkUser(user, oauthConfigs) {
      var _this = this;

      return new RSVP.Promise(function (resolve, reject) {
        var headers = _this.getOAuthHeaders(oauthConfigs);
        _this._makeRequest({ name: user.name }, '/chkuser', headers).then(function (response) {
          if (response.error) {
            reject(response);
          }
          user.displayName = response.displayName;
          user.role = response.role;
          user.prefix = response.prefix;
          resolve(user);
        })['catch'](function () {
          // If chkuser fails, user is probably offline; resolve with currently stored credentials
          resolve(user);
        });
      });
    },

    _finishAuth: function _finishAuth(user, oauthConfigs) {
      var config = this.get('config');
      var database = this.get('database');
      config.setCurrentUser(user);
      return database.setup().then(function () {
        user.oauthConfigs = oauthConfigs;
        return user;
      });
    },

    _makeRequest: function _makeRequest(data, url, headers, method) {
      if (!url) {
        url = this.serverEndpoint;
      }
      var ajax = get(this, 'ajax');
      var params = {
        type: 'POST',
        data: data,
        dataType: 'json',
        contentType: 'application/x-www-form-urlencoded',
        xhrFields: {
          withCredentials: true
        }
      };
      if (method) {
        params.type = method;
      }
      if (headers) {
        params.headers = headers;
      }

      return ajax.request(url, params);
    },

    _saveOAuthConfigs: function _saveOAuthConfigs(params) {
      var config = get(this, 'config');
      var oauthConfigs = this.mapOauthParams(params);
      return config.saveOauthConfigs(oauthConfigs).then(function () {
        return oauthConfigs;
      });
    },

    /**
     Authenticate using google auth credentials or credentials from couch db.
     @method authenticate
     @param {Object} credentials The credentials to authenticate the session with
     @return {RSVP.Promise} A promise that resolves when an access token is successfully acquired from the server and rejects otherwise
     */
    authenticate: function authenticate(credentials) {
      var _this2 = this;

      var standAlone = get(this, 'standAlone');
      if (standAlone === true) {
        return this._authenticateStandAlone(credentials);
      }
      if (credentials.google_auth) {
        return this._saveOAuthConfigs(credentials.params).then(function (oauthConfigs) {
          return _this2._checkUser({ name: credentials.params.i }, oauthConfigs).then(function (user) {
            return _this2._finishAuth(user, oauthConfigs);
          });
        });
      }

      var username = this._getUserName(credentials);
      var data = { name: username, password: credentials.password };
      return this._makeRequest(data).then(function (user) {
        if (user.error) {
          throw new Error(user.errorResult || 'Unauthorized user');
        }
        var userInfo = {
          displayName: user.displayName,
          prefix: user.prefix,
          role: user.role
        };
        userInfo.name = username;

        return _this2._saveOAuthConfigs(user).then(function (oauthConfigs) {
          return _this2._finishAuth(userInfo, oauthConfigs);
        });
      });
    },

    invalidate: function invalidate(data) {
      var standAlone = get(this, 'standAlone');
      if (this.useGoogleAuth || standAlone) {
        return RSVP.resolve();
      } else {
        // Ping the remote db to make sure we still have connectivity before logging off.
        var headers = this.getOAuthHeaders(data.oauthConfigs);
        var remoteDBUrl = get(this, 'database').getRemoteDBUrl();
        return this._makeRequest({}, remoteDBUrl, headers, 'GET');
      }
    },

    restore: function restore(data) {
      if (window.ELECTRON) {
        // config service has not been setup yet, so config.standAlone not available yet
        return RSVP.resolve(data);
      }
      return this._checkUser(data, data.oauthConfigs);
    },

    _authenticateStandAlone: function _authenticateStandAlone(credentials) {
      var _this3 = this;

      var usersDB = get(this, 'usersDB');
      return new RSVP.Promise(function (resolve, reject) {
        var username = _this3._getUserName(credentials);
        usersDB.get('org.couchdb.user:' + username).then(function (user) {
          var salt = user.salt;
          var iterations = user.iterations;
          var derived_key = user.derived_key;
          var password = credentials.password;

          _this3._checkPassword(password, salt, iterations, derived_key, function (error, isCorrectPassword) {
            if (error) {
              reject(error);
            }
            if (!isCorrectPassword) {
              reject(new Error('UNAUTHORIZED'));
            }
            user.role = _this3._getPrimaryRole(user);
            _this3._finishAuth(user, {}).then(resolve, reject);
          });
        }, reject);
      });
    },

    // Based on https://github.com/hoodiehq/hoodie-account-server-api/blob/master/lib/utils/validate-password.js
    _checkPassword: function _checkPassword(password, salt, iterations, derivedKey, callback) {
      _npmCrypto['default'].pbkdf2(password, salt, iterations, 20, 'sha1', function (error, derivedKeyCheck) {
        if (error) {
          return callback(error);
        }
        callback(null, derivedKeyCheck.toString('hex') === derivedKey);
      });
    },

    _getPrimaryRole: function _getPrimaryRole(user) {
      var primaryRole = '';
      if (user.roles) {
        user.roles.forEach(function (role) {
          if (role !== 'user' && role !== 'admin') {
            primaryRole = role;
          }
        });
      }
      return primaryRole;
    },

    _getUserName: function _getUserName(credentials) {
      var username = credentials.identification;
      if (typeof username === 'string' && username) {
        username = username.trim();
      }
      return username;
    }

  });
});
define('hospitalrun/components/action-checkbox', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    // From http://emberjs.jsbin.com/rwjblue/58/edit?html,css,js,output
    attributeBindings: ['type', 'value'],
    tagName: 'input',
    type: 'checkbox',
    checked: false,

    _updateElementValue: (function () {
      this.set('checked', this.$().prop('checked'));
    }).on('didInsertElement'),

    change: function change() {
      this._updateElementValue();
      this.sendAction('action', this.get('value'), this.get('checked'));
    }
  });
});
define('hospitalrun/components/active-link', ['exports', 'ember-cli-active-link-wrapper/components/active-link'], function (exports, _emberCliActiveLinkWrapperComponentsActiveLink) {
  exports['default'] = _emberCliActiveLinkWrapperComponentsActiveLink['default'];
});
define('hospitalrun/components/array-display', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    isArray: (function () {
      var content = this.get('content');
      return _ember['default'].isArray(content);
    }).property('content')
  });
});
define('hospitalrun/components/calendar-control', ['exports', 'ember', 'moment'], function (exports, _ember, _moment) {
  var get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;
  var set = _ember['default'].set;
  exports['default'] = _ember['default'].Component.extend({
    calendarHeader: {
      center: 'agendaDay,agendaWeek,month',
      left: 'title',
      right: 'today prev,next'
    },
    defaultDate: null,
    defaultView: 'agendaWeek',
    height: 500,
    onDayClick: null,
    onEventClick: null,
    onEventDrop: null,
    onEventResize: null,
    userCanEdit: false,

    visualConfiguration: {
      endDate: null,
      startDate: null,
      viewType: null
    },

    /**
     * FullCalendar gives the start and end timestamps based on UTC (eg start at
     * midnight UTC and end at 11:59PM UTC), but for our purposes we want to show
     * users events that start at midnight their timezone and end at 11:59PM in
     * their timezone.  This function takes a UTC timestamps from fullcalendar
     * and returns the timestamp in the users timezone (eg midnight UTC is returned
     * as midnight EST for EST users).
     * @param timestamp A number representing the milliseconds elapsed between
     * 1 January 1970 00:00:00 UTC and the given date.
     * @return String timestamp in users timezone.
     */
    _convertDateFromUTCToLocal: function _convertDateFromUTCToLocal(date) {
      return (0, _moment['default'])(date.utc().format('YYYY-MM-DD HH:mm:ss')).valueOf();
    },

    actions: {
      handleRenderingComplete: function handleRenderingComplete(view) {
        function configurationsDiffer(firstConfig, secondConfig) {
          return firstConfig.startDate !== secondConfig.startDate || firstConfig.endDate !== secondConfig.endDate || firstConfig.viewType !== secondConfig.viewType;
        }

        var currentConfiguration = get(this, 'visualConfiguration');

        var newConfiguration = {
          startDate: this._convertDateFromUTCToLocal(view.intervalStart),
          endDate: this._convertDateFromUTCToLocal(view.intervalEnd),
          viewType: view.name
        };

        if (isEmpty(currentConfiguration.startDate) && isEmpty(currentConfiguration.endDate)) {
          set(this, 'visualConfiguration', newConfiguration);
        } else if (configurationsDiffer(currentConfiguration, newConfiguration)) {
          set(this, 'visualConfiguration', newConfiguration);
          get(this, 'onVisualConfigurationChanged')(newConfiguration);
        }
      }
    }
  });
});
define('hospitalrun/components/charge-quantity', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    i18n: _ember['default'].inject.service(),
    classNames: ['col-xs-2', 'form-group'],
    classNameBindings: ['hasError'],
    tagName: 'td',
    pricingItem: null,

    didReceiveAttrs: function didReceiveAttrs() /* attrs */{
      this._super.apply(this, arguments);
      this.quantitySelected = _ember['default'].computed.alias('model.' + this.get('pricingItem.id'));
    },

    hasError: (function () {
      var quantitySelected = this.get('quantitySelected');
      return !_ember['default'].isEmpty(quantitySelected) && isNaN(quantitySelected);
    }).property('quantitySelected'),

    quantityHelp: (function () {
      if (this.get('hasError')) {
        return this.get('i18n').t('errors.invalidNumber');
      }
    }).property('hasError')

  });
});
define('hospitalrun/components/charges-by-type-tab', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    attributeBindings: ['role'],
    classNameBindings: ['active'],
    index: null,
    pricingList: null,
    role: 'presentation',
    tagName: 'li',

    active: (function () {
      var index = this.get('index');
      return index === 0;
    }).property(),

    tabId: (function () {
      return this.get('pricingType').toLowerCase().dasherize();
    }).property('pricingType'),

    tabHref: (function () {
      var tabId = this.get('tabId');
      return '#' + tabId;
    }).property('tabId')
  });
});
define('hospitalrun/components/checkbox-or-typeahead', ['exports', 'ember', 'hospitalrun/components/select-or-typeahead'], function (exports, _ember, _hospitalrunComponentsSelectOrTypeahead) {
  exports['default'] = _hospitalrunComponentsSelectOrTypeahead['default'].extend({
    checkboxesPerRow: 5,
    model: null,

    _getLabelFromContent: function _getLabelFromContent(object) {
      var optionLabelPath = this.get('optionLabelPath');
      return _ember['default'].get(object, optionLabelPath);
    },

    _getValueFromContent: function _getValueFromContent(object) {
      var optionValuePath = this.get('optionValuePath');
      return _ember['default'].get(object, optionValuePath);
    },

    _mapCheckboxValues: function _mapCheckboxValues(value) {
      return {
        label: this._getLabelFromContent(value),
        value: this._getValueFromContent(value)
      };
    },

    _setup: (function () {
      var property = this.get('property');
      _ember['default'].defineProperty(this, 'errors', _ember['default'].computed('model.errors.' + property, function () {
        var property = this.get('property');
        var errors = this.get('model.errors.' + property);
        if (!_ember['default'].isEmpty(errors)) {
          return errors[0];
        }
      }));
    }).on('init'),

    checkboxRows: (function () {
      var checkboxRows = [];
      var checkboxesPerRow = this.get('checkboxesPerRow');
      var content = this.get('content');
      var allValues = content.copy();
      while (allValues.length > 0) {
        var checkBoxRowValues = allValues.splice(0, checkboxesPerRow).map(this._mapCheckboxValues.bind(this));
        checkboxRows.push(checkBoxRowValues);
      }
      return checkboxRows;
    }).property('content', 'checkboxesPerRow'),

    actions: {
      checkboxChanged: function checkboxChanged(value, checked) {
        var property = this.get('property');
        var propertyName = 'model.' + property;
        var selectedValues = this.get(propertyName);
        if (!_ember['default'].isArray(selectedValues)) {
          selectedValues = [];
        }
        if (checked && !selectedValues.includes(value)) {
          selectedValues.addObject(value);
        } else if (!checked && selectedValues.includes(value)) {
          selectedValues.removeObject(value);
        }
        this.set(propertyName, selectedValues);
        this.set('selection', selectedValues);
        this.get('model').validate()['catch'](_ember['default'].K);
      }
    }

  });
});
define('hospitalrun/components/control-within-label', ['exports', 'ember-rapid-forms/components/control-within-label'], function (exports, _emberRapidFormsComponentsControlWithinLabel) {
  exports['default'] = _emberRapidFormsComponentsControlWithinLabel['default'];
});
//import Ember from 'ember';
define('hospitalrun/components/custom-form-manager', ['exports', 'ember', 'hospitalrun/utils/select-values'], function (exports, _ember, _hospitalrunUtilsSelectValues) {
  var Component = _ember['default'].Component;
  var alias = _ember['default'].computed.alias;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  exports['default'] = Component.extend(_hospitalrunUtilsSelectValues['default'], {
    customForms: inject.service(),
    formType: null,
    formsForType: null,
    model: null,
    openModalAction: 'openModal',

    formsForSelect: alias('customForms.formsForSelect'),
    formsToDisplay: alias('customForms.formsToDisplay'),
    showAddButton: alias('customForms.showAddButton'),

    didReceiveAttrs: function didReceiveAttrs() /* attrs */{
      this._super.apply(this, arguments);
      var customForms = get(this, 'customForms');
      var formType = get(this, 'formType');
      var model = get(this, 'model');
      customForms.setupForms(formType, model);
    },

    actions: {
      addForm: function addForm() {
        var model = get(this, 'model');
        var formsForSelect = get(this, 'formsForSelect');
        this.sendAction('openModalAction', 'custom-form-add', _ember['default'].Object.create({
          modelToAddTo: model,
          customForms: formsForSelect
        }));
      }
    }
  });
});
define('hospitalrun/components/custom-form', ['exports', 'ember', 'hospitalrun/utils/select-values'], function (exports, _ember, _hospitalrunUtilsSelectValues) {
  var computed = _ember['default'].computed;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _ember['default'].Component.extend(_hospitalrunUtilsSelectValues['default'], {
    classNames: 'detail-section-content',
    propertyPrefix: '',
    fieldsByRow: computed('form', 'form.fields.[]', 'form.columns', function () {
      var _this = this;

      var rows = [];
      var form = this.get('form');
      var fields = this.get('form.fields');
      if (!isEmpty(form) && !isEmpty(fields)) {
        (function () {
          var numberOfColumns = _this.getWithDefault('form.columns', 1);
          var currentRow = [];

          var colCount = 0;
          var colWidth = Math.floor(12 / numberOfColumns);
          fields.forEach(function (field) {
            var classNames = field.get('classNames');
            if (!classNames) {
              classNames = '';
            }
            var colSpan = field.get('colSpan') || 1;
            if (colCount === numberOfColumns || colCount + colSpan > numberOfColumns) {
              rows.push(currentRow.slice());
              currentRow = [];
              colCount = 0;
            }
            classNames += ' col-sm-' + colWidth * colSpan;
            field.set('displayClassNames', classNames);
            if (field.get('type') === 'radio') {
              field.set('mappedValues', field.get('values').map(function (value) {
                return _ember['default'].get(value, 'label');
              }));
            }
            currentRow.push(field);
            colCount += colSpan;
          });
          if (colCount > 0) {
            rows.push(currentRow);
          }
        })();
      }
      return rows;
    })
  });
});
define('hospitalrun/components/date-filter', ['exports', 'ember', 'hospitalrun/mixins/pikaday-component'], function (exports, _ember, _hospitalrunMixinsPikadayComponent) {
  var Component = _ember['default'].Component;
  exports['default'] = Component.extend(_hospitalrunMixinsPikadayComponent['default'], {
    classNames: ['input-group'],
    dateSetAction: 'filter',

    actions: {
      clearFilter: function clearFilter() {
        var $input = this.$('input');
        $input.val('');
        this.sendAction('dateSetAction');
      }
    }
  });
});
define('hospitalrun/components/date-input', ['exports', 'ember', 'ember-rapid-forms/components/html-input', 'hospitalrun/mixins/pikaday-component'], function (exports, _ember, _emberRapidFormsComponentsHtmlInput, _hospitalrunMixinsPikadayComponent) {
  exports['default'] = _emberRapidFormsComponentsHtmlInput['default'].extend(_hospitalrunMixinsPikadayComponent['default'], {
    _shouldSetDate: function _shouldSetDate(currentDate, picker) {
      return picker && (_ember['default'].isEmpty(currentDate) || _ember['default'].isEmpty(picker.getDate()) || currentDate.getTime && picker.getDate().getTime() !== currentDate.getTime());
    },

    currentDateChangedValue: function currentDateChangedValue() {
      var currentDate = this.get('currentDate');
      var picker = this.get('_picker');
      if (!_ember['default'].isEmpty(currentDate) && this._shouldSetDate(currentDate, picker)) {
        picker.setDate(currentDate);
      }
    },

    format: (function () {
      var showTime = this.get('showTime');
      if (showTime) {
        return 'l h:mm A';
      } else {
        return 'l';
      }
    }).property('mainComponent.showTime'),

    showTimeChanged: (function () {
      var picker = this.get('_picker');
      if (picker) {
        picker.destroy();
        this.didInsertElement();
      }
    }).observes('mainComponent.showTime'),

    dateSet: function dateSet() {
      var currentDate = this.get('currentDate');
      var picker = this.get('_picker');
      if (this._shouldSetDate(currentDate, picker)) {
        var newDate = picker.getDate();
        var mainComponent = this.get('mainComponent');
        var dateSetAction = mainComponent.get('dateSetAction');
        this.set('currentDate', newDate);
        if (!_ember['default'].isEmpty(dateSetAction)) {
          mainComponent.sendAction('dateSetAction', newDate);
        }
      }
    },

    didReceiveAttrs: function didReceiveAttrs() /* attrs */{
      this._super.apply(this, arguments);
      var dateProperty = this.get('mainComponent.originalPropery');
      var displayPropertyName = 'display_' + dateProperty;
      this.currentDate = _ember['default'].computed.alias('mainComponent.model.' + dateProperty);
      this.minDate = _ember['default'].computed.alias('mainComponent.minDate');
      this.maxDate = _ember['default'].computed.alias('mainComponent.maxDate');
      this.showTime = _ember['default'].computed.alias('mainComponent.showTime');
      this.yearRange = _ember['default'].computed.alias('mainComponent.yearRange');
      this.addObserver('mainComponent.model.' + dateProperty, this, this.currentDateChangedValue);
      _ember['default'].Binding.from('mainComponent.model.errors.' + dateProperty).to('mainComponent.model.errors.' + displayPropertyName).connect(this);
    }

  });
});
define('hospitalrun/components/date-picker', ['exports', 'ember-rapid-forms/components/em-input'], function (exports, _emberRapidFormsComponentsEmInput) {
  exports['default'] = _emberRapidFormsComponentsEmInput['default'].extend({
    dateSetAction: null, // Specify an action to fire when a date is selected
    htmlComponent: 'date-input',
    minDate: null,
    maxDate: null,
    originalPropery: null,
    showTime: false,
    yearRange: 10,

    didReceiveAttrs: function didReceiveAttrs(attrs) {
      var dateProperty = this.get('property');
      var displayPropertyName = 'display_' + dateProperty;
      this.set('property', displayPropertyName);
      this.set('originalPropery', dateProperty);
      this._super(attrs);
    }
  });
});
// Dervied from http://spin.atomicobject.com/2013/10/29/ember-js-date-picker/
define('hospitalrun/components/date-time-picker', ['exports', 'ember', 'moment'], function (exports, _ember, _moment) {
  var computed = _ember['default'].computed;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _ember['default'].Component.extend({
    i18n: _ember['default'].inject.service(),
    dateTimePickerDate: null,
    datePickerClass: '',
    endDate: _ember['default'].computed.alias('model.endDate'),
    endHour: null,
    endMinute: null,
    label: '',
    startDate: _ember['default'].computed.alias('model.startDate'),
    startHour: null,
    startMinute: null,

    didReceiveAttrs: function didReceiveAttrs() {
      var endDate = (0, _moment['default'])(this.get('endDate'));
      var startDate = (0, _moment['default'])(this.get('startDate'));
      if (isEmpty(endDate)) {
        endDate = startDate;
      }
      this.set('endHour', endDate.hour());
      this.set('endMinute', endDate.minute());
      this.set('startHour', startDate.hour());
      this.set('startMinute', startDate.minute());
      this.set('dateTimePickerDate', startDate.toDate());
      this._updateDates();
    },

    hourList: computed(function () {
      var hour = undefined;
      var hourList = [];
      var i18n = this.get('i18n');
      for (hour = 0; hour < 24; hour++) {
        var hourText = undefined;
        var hourProp = {
          hour: hour % 12 // Show hour in 12 hour am/pm format
        };
        if (hour === 0) {
          hourText = i18n.t('components.dateTimePicker.midnight');
        } else if (hour === 12) {
          hourText = i18n.t('components.dateTimePicker.noon');
        } else if (hour < 12) {
          hourText = i18n.t('components.dateTimePicker.amHour', hourProp);
        } else {
          hourText = i18n.t('components.dateTimePicker.pmHour', hourProp);
        }
        hourList.push({
          name: hourText,
          value: hour
        });
      }
      return hourList;
    }),

    isAllDay: computed('model.allDay', function () {
      var allDay = this.get('model.allDay');
      if (allDay) {
        this.set('startHour', 0);
        this.set('startMinute', 0);
        this.set('endHour', 23);
        this.set('endMinute', 59);
        this._updateDates();
      }
      return allDay;
    }),

    minuteList: computed(function () {
      var minute = undefined;
      var minuteList = [];
      for (minute = 0; minute < 60; minute++) {
        minuteList.push({
          name: String('00' + minute).slice(-2),
          value: minute
        });
      }
      return minuteList;
    }),

    actions: {
      dateChanged: function dateChanged() /* newDate */{
        this._updateDates();
      },

      endHourChanged: function endHourChanged(endHour) {
        this.set('endHour', endHour);
        this._updateDates();
      },

      endMinuteChanged: function endMinuteChanged(endMinute) {
        this.set('endMinute', endMinute);
        this._updateDates();
      },

      startHourChanged: function startHourChanged(startHour) {
        this.set('startHour', startHour);
        this._updateDates();
      },

      startMinuteChanged: function startMinuteChanged(startMinute) {
        this.set('startMinute', startMinute);
        this._updateDates();
      }
    },

    endTimeHasError: computed('model.isValid', function () {
      var endDateError = this.get('model.errors.endDate');
      return endDateError.length > 0;
    }),

    _updateDates: function _updateDates() {
      var _this = this;

      _ember['default'].run.once(this, function () {
        var datePrefixes = ['start', 'end'];
        datePrefixes.forEach(function (datePrefix) {
          var dateProperty = datePrefix + 'Date';
          var dateToChange = _this.get(dateProperty);
          var dateSelected = _this.get('dateTimePickerDate');
          var hour = _this.get(datePrefix + 'Hour');
          var minute = _this.get(datePrefix + 'Minute');
          if (!_ember['default'].isEmpty(dateSelected)) {
            dateToChange = (0, _moment['default'])(dateSelected);
            dateToChange.hour(hour);
            dateToChange.minute(minute);
            _this.set(dateProperty, dateToChange.toDate());
          }
        });
        var model = _this.get('model');
        model.validate()['catch'](_ember['default'].K);
      });
    }

  });
});
define('hospitalrun/components/edit-panel', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    editPanelProps: null,
    cancelAction: 'cancel',

    actions: {
      cancel: function cancel() {
        this.sendAction('cancelAction');
      },
      disabledAction: function disabledAction() {
        this.sendAction('editPanelProps.disabledAction');
      },
      fireButtonAction: function fireButtonAction(buttonAction) {
        this.set(buttonAction, buttonAction);
        this.sendAction(buttonAction);
      },
      updateButtonAction: function updateButtonAction() {
        this.sendAction('editPanelProps.updateButtonAction');
      }
    }
  });
});
define('hospitalrun/components/em-checkbox', ['exports', 'ember-rapid-forms/components/em-checkbox'], function (exports, _emberRapidFormsComponentsEmCheckbox) {
  exports['default'] = _emberRapidFormsComponentsEmCheckbox['default'];
});
//import Ember from 'ember';
define('hospitalrun/components/em-custom-input', ['exports', 'ember-rapid-forms/components/em-custom-input'], function (exports, _emberRapidFormsComponentsEmCustomInput) {
  exports['default'] = _emberRapidFormsComponentsEmCustomInput['default'];
});
define('hospitalrun/components/em-form-control-help', ['exports', 'ember-rapid-forms/components/em-form-control-help'], function (exports, _emberRapidFormsComponentsEmFormControlHelp) {
  exports['default'] = _emberRapidFormsComponentsEmFormControlHelp['default'];
});
//import Ember from 'ember';
define('hospitalrun/components/em-form-group', ['exports', 'ember-rapid-forms/components/em-form-group'], function (exports, _emberRapidFormsComponentsEmFormGroup) {
  exports['default'] = _emberRapidFormsComponentsEmFormGroup['default'];
});
//import Ember from 'ember';
define('hospitalrun/components/em-form-label', ['exports', 'ember-rapid-forms/components/em-form-label'], function (exports, _emberRapidFormsComponentsEmFormLabel) {
  exports['default'] = _emberRapidFormsComponentsEmFormLabel['default'];
});
//import Ember from 'ember';
define('hospitalrun/components/em-form-submit', ['exports', 'ember-rapid-forms/components/em-form-submit'], function (exports, _emberRapidFormsComponentsEmFormSubmit) {
  exports['default'] = _emberRapidFormsComponentsEmFormSubmit['default'];
});
//import Ember from 'ember';
define('hospitalrun/components/em-form', ['exports', 'ember-rapid-forms/components/em-form'], function (exports, _emberRapidFormsComponentsEmForm) {
  exports['default'] = _emberRapidFormsComponentsEmForm['default'];
});
//import Ember from 'ember';
define('hospitalrun/components/em-input', ['exports', 'ember-rapid-forms/components/em-input'], function (exports, _emberRapidFormsComponentsEmInput) {
  exports['default'] = _emberRapidFormsComponentsEmInput['default'];
});
//import Ember from 'ember';
define('hospitalrun/components/em-select', ['exports', 'ember-rapid-forms/components/em-select'], function (exports, _emberRapidFormsComponentsEmSelect) {
  exports['default'] = _emberRapidFormsComponentsEmSelect['default'];
});
//import Ember from 'ember';
define('hospitalrun/components/em-text', ['exports', 'ember-rapid-forms/components/em-text'], function (exports, _emberRapidFormsComponentsEmText) {
  exports['default'] = _emberRapidFormsComponentsEmText['default'];
});
//import Ember from 'ember';
define('hospitalrun/components/erf-html-checkbox', ['exports', 'ember-rapid-forms/components/html-checkbox'], function (exports, _emberRapidFormsComponentsHtmlCheckbox) {
  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _emberRapidFormsComponentsHtmlCheckbox['default'];
    }
  });
});
define('hospitalrun/components/erf-html-custom-input', ['exports', 'ember-rapid-forms/components/html-custom-input'], function (exports, _emberRapidFormsComponentsHtmlCustomInput) {
  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _emberRapidFormsComponentsHtmlCustomInput['default'];
    }
  });
});
define('hospitalrun/components/erf-html-input', ['exports', 'ember-rapid-forms/components/html-input'], function (exports, _emberRapidFormsComponentsHtmlInput) {
  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _emberRapidFormsComponentsHtmlInput['default'];
    }
  });
});
define('hospitalrun/components/erf-html-select', ['exports', 'ember-rapid-forms/components/html-select'], function (exports, _emberRapidFormsComponentsHtmlSelect) {
  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _emberRapidFormsComponentsHtmlSelect['default'];
    }
  });
});
define('hospitalrun/components/erf-html-text', ['exports', 'ember-rapid-forms/components/html-text'], function (exports, _emberRapidFormsComponentsHtmlText) {
  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _emberRapidFormsComponentsHtmlText['default'];
    }
  });
});
define('hospitalrun/components/expand-text', ['exports', 'ember', 'hospitalrun/utils/text-expansion'], function (exports, _ember, _hospitalrunUtilsTextExpansion) {
  var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();

  var Component = _ember['default'].Component;
  var htmlSafe = _ember['default'].String.htmlSafe;
  var computed = _ember['default'].computed;
  var inject = _ember['default'].inject;
  exports['default'] = Component.extend({
    i18n: inject.service(),
    store: inject.service(),

    userText: '',

    didInsertElement: function didInsertElement() {
      var _this = this;

      var feedbackDiv = document.createElement('div');
      feedbackDiv.style.position = 'absolute';

      var _$ = this.$('textarea');

      var _$2 = _slicedToArray(_$, 1);

      var textarea = _$2[0];

      this.set('textarea', textarea);
      var textPos = textarea.getBoundingClientRect();
      var fbStyle = feedbackDiv.style;
      fbStyle.top = textPos.bottom + 'px';
      fbStyle.left = textPos.left + 'px';
      fbStyle.width = textarea.offsetWidth + 'px';
      // THIS CODE NEEDS TO BE CHANGED -- INLINE STYLES ARE EVIL!
      fbStyle.backgroundColor = 'lightyellow';
      fbStyle.borderStyle = 'solid';
      fbStyle.borderWidth = '1px';
      fbStyle.borderRadius = '3px';
      fbStyle.paddingLeft = '5px';
      fbStyle.visibility = 'hidden';

      this.set('feedbackDiv', feedbackDiv);
      this.get('feedbackText');
      this.get('activeExpansionSite');

      this.get('store').findAll('text-expansion').then(function (expansions) {
        return expansions.reduce(function (prev, curr) {
          prev[curr.get('from')] = curr.get('to');
          return prev;
        }, {});
      }).then(function (expansions) {
        _this.set('expansions', expansions);
      });
    },

    keyUp: function keyUp(k) {
      var textArea = k.target;
      var text = textArea.value;
      this.set('userText', text);
      this.set('cursorLocation', textArea.selectionStart);
    },

    keyDown: function keyDown(k) {
      if (k.keyCode === 13) {
        var possibleSwaps = this.get('possibleSwaps');
        if (possibleSwaps && possibleSwaps.length === 1) {
          var swapTo = possibleSwaps[0].to;
          var activeSite = this.get('activeExpansionSite');
          var sliceLength = activeSite.match.length;
          var currentText = k.target.value;
          var modifiedText = currentText.slice(0, activeSite.index) + swapTo + currentText.slice(activeSite.index + sliceLength);
          k.target.value = modifiedText;

          k.preventDefault();
          k.returnValue = false;
          k.cancelBubble = true;
          return false;
        }
      }
    },

    // Find an expandable word that has the cursor within it
    activeExpansionSite: computed('userText', 'cursorLocation', function () {

      var userText = this.get('userText');
      var textarea = this.get('textarea');
      if (!textarea) {
        return null;
      }
      var cursorLoc = textarea.selectionStart;
      var subjects = _hospitalrunUtilsTextExpansion['default'].findExpansionSubjects(userText);
      var sites = _hospitalrunUtilsTextExpansion['default'].findExpansionSites(userText, subjects);

      return sites.find(function (s) {
        var endIndex = s.index + s.match.length;

        return cursorLoc >= s.index && cursorLoc <= endIndex;
      });
    }),

    // If an expansion site is active, which possible swaps could occur there?
    possibleSwaps: computed('activeExpansionSite', 'expansions', function () {
      var _this2 = this;

      var activeSite = this.get('activeExpansionSite');

      if (activeSite) {
        var _ret = (function () {
          var expansions = _this2.get('expansions');
          return {
            v: Object.keys(expansions).filter(function (ex) {
              return ex.startsWith(activeSite.term);
            }).sort().map(function (from) {
              return {
                from: from,
                to: expansions[from]
              };
            })
          };
        })();

        if (typeof _ret === 'object') return _ret.v;
      }
    }),

    expansionText: computed('possibleSwaps', 'activeExpansionSite', 'userText', function () {
      var result = '';

      var i18n = this.get('i18n');
      var possibleSwaps = this.get('possibleSwaps');
      if (possibleSwaps) {
        var activeSite = this.get('activeExpansionSite');

        if (possibleSwaps.length === 1) {
          var swapTo = possibleSwaps[0].to;
          result = i18n.t('admin.textReplacements.performExpand', { from: activeSite.term, to: swapTo });
        } else if (possibleSwaps.length > 1) {
          var possible = possibleSwaps.map(function (swap) {
            return swap.from;
          }).join(', ');
          result = i18n.t('admin.textReplacements.possibleExpansions', { possible: possible });
        } else {
          result = i18n.t('admin.textReplacements.noMatches', { term: activeSite.term });
        }
      }

      return result;
    }),

    expansionDivStyle: computed('expansionText', function () {
      var expansionText = this.get('expansionText');
      var visiblility = expansionText ? 'visible' : 'hidden';
      var textArea = this.get('textarea');

      var styleString = 'visibility: ' + visiblility + ';';

      if (textArea) {
        var textPos = textArea.getBoundingClientRect();
        styleString += ' top: ' + textPos.bottom + 'px; left: ' + textPos.left + 'px; width: ' + textArea.offsetWidth + 'px;';
      }
      return htmlSafe(styleString);
    })
  });
});
define('hospitalrun/components/ext-radio', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    includeOtherOption: false,
    otherOptionLabel: null,
    showInline: false,

    haveLabel: (function () {
      var firstRadio = this.get('content.firstObject');
      return !_ember['default'].isEmpty(firstRadio.label);
    }).property('content'),

    radioClass: (function () {
      if (this.get('showInline')) {
        return 'radio-inline';
      } else {
        return 'radio';
      }
    }).property('showInline')
  });
});
define('hospitalrun/components/file-upload', ['exports', 'hospitalrun/components/image-upload'], function (exports, _hospitalrunComponentsImageUpload) {
  exports['default'] = _hospitalrunComponentsImageUpload['default'].extend({
    resizeFile: false
  });
});
define('hospitalrun/components/form-group-control', ['exports', 'ember-rapid-forms/components/form-group-control'], function (exports, _emberRapidFormsComponentsFormGroupControl) {
  exports['default'] = _emberRapidFormsComponentsFormGroupControl['default'];
});
//import Ember from 'ember';
define('hospitalrun/components/form-group', ['exports', 'ember-rapid-forms/components/form-group'], function (exports, _emberRapidFormsComponentsFormGroup) {
  exports['default'] = _emberRapidFormsComponentsFormGroup['default'];
});
//import Ember from 'ember';
define('hospitalrun/components/full-calendar', ['exports', 'ember-fullcalendar/components/full-calendar'], function (exports, _emberFullcalendarComponentsFullCalendar) {
  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _emberFullcalendarComponentsFullCalendar['default'];
    }
  });
});
define('hospitalrun/components/icd10-pcs-typeahead', ['exports', 'hospitalrun/components/icd10-typeahead'], function (exports, _hospitalrunComponentsIcd10Typeahead) {
  exports['default'] = _hospitalrunComponentsIcd10Typeahead['default'].extend();
});
define('hospitalrun/components/icd10-typeahead', ['exports', 'hospitalrun/components/type-ahead'], function (exports, _hospitalrunComponentsTypeAhead) {
  exports['default'] = _hospitalrunComponentsTypeAhead['default'].extend({
    'class': 'scrollable-typeahead',
    minlength: 2,
    selectionKey: 'id',
    setOnBlur: true,
    templates: {
      header: '<div class="alert alert-success well-sm query-results" role="alert"></div>'
    },

    _sourceQuery: function _sourceQuery(query, cb) {
      // Custom source function
      // Get the data from the Blodhound engine and process it.
      this.bloodhound.get(query, (function (suggestions) {
        cb(suggestions);
        // Set the headers content.
        var $header = this.$('.query-results');
        $header.html('<strong><em>' + query + '</em></strong> returned <strong>' + suggestions.length + '</strong> results');
      }).bind(this));
    },

    _getSource: function _getSource() {
      return this._sourceQuery.bind(this);
    }
  });
});
define('hospitalrun/components/image-upload', ['exports', 'ember', 'ember-rapid-forms/components/em-input'], function (exports, _ember, _emberRapidFormsComponentsEmInput) {
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _emberRapidFormsComponentsEmInput['default'].extend({
    fileInputEl: null,
    isImage: true,
    resizeFile: true,
    selectedFile: null,
    type: 'file',

    _fileChanged: function _fileChanged() {
      var _this = this;

      var inputEl = this.get('fileInputEl');
      var resize = this.get('resizeFile');

      if (!isEmpty(inputEl.files[0]) && resize) {
        (function () {
          // Derived from https://github.com/josefrichter/resize/blob/master/public/preprocess.js
          var blobURL = window.URL.createObjectURL(inputEl.files[0]); // and get it's URL
          // helper Image object
          var image = new Image();
          image.src = blobURL;
          image.addEventListener('load', (function () {
            window.URL.revokeObjectURL(blobURL);
            // have to wait till it's loaded
            this.set('selectedFile', this._resizeImage(image)); // send it to canvas
            this.set('isImage', true);
          }).bind(_this));
          image.addEventListener('error', (function () {
            // if image load fails, file probably isn't an image, so don't resize
            window.URL.revokeObjectURL(blobURL);
            this.set('selectedFile', inputEl.files[0]);
            this.set('isImage', false);
          }).bind(_this));
        })();
      } else {
        this.set('isImage', false);
        this.set('selectedFile', inputEl.files[0]);
      }
    },

    /**
     * Resize the image to no larger than 1024px so that file sizes
     * are not too large.
     */
    _resizeImage: function _resizeImage(img) {
      // Derived from https://github.com/josefrichter/resize/blob/master/public/preprocess.js
      var canvas = document.createElement('canvas');
      var height = img.height;
      var width = img.width;

      var maxHeight = 1024;
      var maxWidth = 1024;

      // calculate the width and height, constraining the proportions
      if (width > height) {
        if (width > maxWidth) {
          // height *= max_width / width;
          height = Math.round(height *= maxWidth / width);
          width = maxWidth;
        }
      } else {
        if (height > maxHeight) {
          // width *= max_height / height;
          width = Math.round(width *= maxHeight / height);
          height = maxHeight;
        }
      }

      // resize the canvas and draw the image data into it
      canvas.width = width;
      canvas.height = height;
      var ctx = canvas.getContext('2d');
      ctx.drawImage(img, 0, 0, width, height);

      var dataURI = canvas.toDataURL('image/png');
      var binary = atob(dataURI.split(',')[1]);
      var array = [];
      for (var i = 0; i < binary.length; i++) {
        array.push(binary.charCodeAt(i));
      }
      return new Blob([new Uint8Array(array)], { type: 'image/png' });
    },

    didInsertElement: function didInsertElement() {
      var $input = this.$('input');
      this.set('fileInputEl', $input[0]);
      $input.on('change', this._fileChanged.bind(this));
    }

  });
});
define('hospitalrun/components/inventory-location-picker', ['exports', 'ember', 'hospitalrun/utils/select-values'], function (exports, _ember, _hospitalrunUtilsSelectValues) {
  exports['default'] = _ember['default'].Component.extend({
    calculatedLocationPickers: null,
    doingSetup: false,
    label: null,
    locationList: null,
    quantityRequested: null,

    locationChange: function locationChange() {
      var doingSetup = this.get('doingSetup');
      var locationList = this.get('locationList');
      var locationPickers = this.get('calculatedLocationPickers');
      var quantityRequested = this.get('quantityRequested');
      var quantitySatisfiedIdx = -1;
      var selectedLocations = [];
      if (!doingSetup) {
        locationPickers.reduce(function (previousValue, item, index) {
          var selectedLocation = item.get('selectedLocation');
          var returnValue = undefined;
          if (_ember['default'].isEmpty(selectedLocation)) {
            returnValue = previousValue;
          } else {
            returnValue = previousValue + selectedLocation.get('quantity');
          }
          if (quantitySatisfiedIdx === -1 && returnValue >= quantityRequested) {
            quantitySatisfiedIdx = index;
          }
          return returnValue;
        }, 0);
        if (quantitySatisfiedIdx > -1) {
          if (locationPickers.get('length') > quantitySatisfiedIdx + 1) {
            locationPickers = locationPickers.slice(0, quantitySatisfiedIdx + 1);
            this.set('calculatedLocationPickers', locationPickers);
          }
        } else {
          locationPickers.addObject(_ember['default'].Object.create());
        }
        this._setupLocationPickers(locationPickers, locationList);
      }
      locationPickers.forEach(function (locationPicker) {
        selectedLocations.addObject(locationPicker.get('selectedLocation'));
      });
      this.set('componentSelectedLocations', selectedLocations);
    },

    _setup: (function () {
      _ember['default'].Binding.from('selectedLocations').to('componentSelectedLocations').connect(this);
    }).on('init'),

    _setupLocationPickers: function _setupLocationPickers(locationPickers, locationList, setInitialLocation) {
      locationPickers.reduce(function (previousValue, item) {
        var selectedLocation = item.get('selectedLocation');
        item.set('subLocationList', previousValue.map(_hospitalrunUtilsSelectValues['default'].selectObjectMap));
        if (!previousValue.includes(selectedLocation) || setInitialLocation) {
          item.set('selectedLocation', previousValue.get('firstObject'));
        }
        item.set('label', 'And');
        return previousValue.filter(function (location) {
          return item.get('selectedLocation.id') !== location.get('id');
        });
      }, locationList);
      var firstPicker = locationPickers.get('firstObject');
      if (!_ember['default'].isEmpty(firstPicker)) {
        firstPicker.set('label', this.get('label'));
      }
      this.set('calculatedLocationPickers', locationPickers);
    },

    locationPickers: (function () {
      var locationList = this.get('locationList');
      var locationPickers = [];
      var quantityRequested = this.get('quantityRequested');
      if (_ember['default'].isEmpty(locationList) || _ember['default'].isEmpty(quantityRequested)) {
        // We need both a locationList and a quantityRequested
        return;
      }
      this.set('doingSetup', true);
      locationList.reduce(function (previousValue, location) {
        if (previousValue < quantityRequested) {
          locationPickers.addObject(_ember['default'].Object.create());
        }
        return previousValue + location.get('quantity');
      }, 0);
      this._setupLocationPickers(locationPickers, locationList, true);
      this.locationChange();
      this.set('doingSetup', false);
      return this.get('calculatedLocationPickers');
    }).property('calculatedLocationPickers', 'locationList', 'quantityRequested')
  });
});
define('hospitalrun/components/inventory-typeahead', ['exports', 'ember', 'hospitalrun/components/type-ahead'], function (exports, _ember, _hospitalrunComponentsTypeAhead) {
  exports['default'] = _hospitalrunComponentsTypeAhead['default'].extend({
    classNameBindings: ['haveInventoryItems'],
    displayKey: 'name',
    showQuantity: true,
    i18n: _ember['default'].inject.service(),
    store: _ember['default'].inject.service(),

    _mapInventoryItems: function _mapInventoryItems(item) {
      var returnObj = {};
      if (this.get('showQuantity') && item.quantity) {
        returnObj.name = item.name + ' - ' + item.friendlyId + ' (' + this.get('i18n').t('inventory.labels.availableQuantity', { quantity: item.quantity }) + ')';
      } else {
        returnObj.name = item.name + ' - ' + item.friendlyId;
      }
      returnObj[this.get('selectionKey')] = item;
      return returnObj;
    },

    haveInventoryItems: (function () {
      var content = this.get('content');
      if (!_ember['default'].isEmpty(content) && content.length > 0) {
        return 'have-inventory-items';
      }
    }).property('content'),

    mappedContent: (function () {
      var content = this.get('content');
      var mapped = [];
      if (content) {
        mapped = content.map(this._mapInventoryItems.bind(this));
      }
      return mapped;
    }).property('content'),

    contentChanged: (function () {
      var bloodhound = this.get('bloodhound');
      var content = this.get('content');
      if (bloodhound) {
        bloodhound.clear();
        bloodhound.add(content.map(this._mapInventoryItems.bind(this)));
      }
    }).observes('content.[]'),

    itemSelected: function itemSelected(selectedInventoryItem) {
      var _this = this;

      this._super();
      var store = this.get('store');
      if (!_ember['default'].isEmpty(selectedInventoryItem)) {
        store.find('inventory', selectedInventoryItem.id).then(function (inventoryItem) {
          var model = _this.get('model');
          model.set('inventoryItem', inventoryItem);
          _ember['default'].run.once(_this, function () {
            model.validate()['catch'](_ember['default'].K);
          });
        });
      }
    }
  });
});
define('hospitalrun/components/item-listing', ['exports', 'ember', 'hospitalrun/mixins/paging-actions'], function (exports, _ember, _hospitalrunMixinsPagingActions) {
  exports['default'] = _ember['default'].Component.extend(_hospitalrunMixinsPagingActions['default'], {
    classNames: ['panel', 'panel-primary']
  });
});
define('hospitalrun/components/loading-message', ['exports', 'ember', 'ember-i18n'], function (exports, _ember, _emberI18n) {
  exports['default'] = _ember['default'].Component.extend({
    tagName: 'span',
    showLoadingMessages: false,
    loadingMessages: [(0, _emberI18n.translationMacro)('loading.messages.0'), (0, _emberI18n.translationMacro)('loading.messages.1'), (0, _emberI18n.translationMacro)('loading.messages.2'), (0, _emberI18n.translationMacro)('loading.messages.3'), (0, _emberI18n.translationMacro)('loading.messages.4'), (0, _emberI18n.translationMacro)('loading.messages.5'), (0, _emberI18n.translationMacro)('loading.messages.6'), (0, _emberI18n.translationMacro)('loading.messages.7'), (0, _emberI18n.translationMacro)('loading.messages.8'), (0, _emberI18n.translationMacro)('loading.messages.9'), (0, _emberI18n.translationMacro)('loading.messages.10'), (0, _emberI18n.translationMacro)('loading.messages.11')],

    _setRandomMessage: function _setRandomMessage() {
      var loadingMessages = this.get('loadingMessages');
      var idx = Math.floor(Math.random() * loadingMessages.length);
      this.set('message', loadingMessages[idx]);
      this.set('timer', _ember['default'].run.later(this, this._setRandomMessage, 1000));
    },

    didInsertElement: function didInsertElement() {
      this._setRandomMessage();
    },

    willDestroyElement: function willDestroyElement() {
      var timer = this.get('timer');
      if (!_ember['default'].isEmpty(timer)) {
        _ember['default'].run.cancel(timer);
      }
    }
  });
});
define('hospitalrun/components/location-select', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    locationPicker: null,

    _setup: (function () {
      this.locationChange = this.currentLocationChanged.bind(this);
    }).on('init'),

    currentLocationChanged: function currentLocationChanged(newLocation) {
      this.get('locationPicker').set('selectedLocation', newLocation);
      _ember['default'].run.once(this, function () {
        this.get('parentView').locationChange();
      });
    }

  });
});
define('hospitalrun/components/medication-allergy', ['exports', 'ember'], function (exports, _ember) {
  var computed = _ember['default'].computed;
  var _get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _ember['default'].Component.extend({
    classNames: 'ps-info-group long-form',

    canAddAllergy: null,
    patient: null,
    editAllergyAction: 'editAllergy',
    showAddAllergyAction: 'showAddAllergy',

    showAllergies: computed('canAddAllergy', 'patient.allergies.[]', {
      get: function get() {
        var canAddAllergy = _get(this, 'canAddAllergy');
        var patientAllergies = _get(this, 'patient.allergies');
        return canAddAllergy || !isEmpty(patientAllergies);
      }
    }),

    actions: {
      editAllergy: function editAllergy(allergy) {
        this.sendAction('editAllergyAction', allergy);
      },

      createNewAllergy: function createNewAllergy() {
        this.sendAction('showAddAllergyAction');
      }
    }
  });
});
define('hospitalrun/components/modal-dialog', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    i18n: _ember['default'].inject.service(),
    cancelAction: 'cancel',
    closeModalAction: 'closeModal',
    hideCancelButton: false,
    hideUpdateButton: false,
    isUpdateDisabled: false,
    title: '',
    updateButtonAction: '',
    updateButtonClass: '',
    updateButtonText: '',
    cancelButtonText: '',
    cancelBtnText: (function () {
      var cancelText = this.get('cancelButtonText');
      if (_ember['default'].isEmpty(cancelText)) {
        return this.get('i18n').t('buttons.cancel');
      } else {
        return cancelText;
      }
    }).property('cancelButtonText'),
    actions: {
      cancelAction: function cancelAction() {
        this.sendAction('cancelAction');
      },

      fireButtonAction: function fireButtonAction(buttonAction) {
        this.set(buttonAction, buttonAction);
        this.sendAction(buttonAction);
      },

      updateAction: function updateAction() {
        this.sendAction('updateButtonAction');
      }

    },

    didInsertElement: function didInsertElement() {
      var $modal = this.$('.modal').modal();

      $modal.on('hidden.bs.modal', (function () {
        this.sendAction('closeModalAction');
        this.sendAction('cancelAction');
      }).bind(this));
    },

    willDestroyElement: function willDestroyElement() {
      var $modal = this.$('.modal');
      $modal.off('hidden.bs.modal');
      $modal.modal('hide');
      // jquery fixes
      $('body').removeClass('modal-open');
      $('.modal-backdrop').remove();
    }
  });
});
define('hospitalrun/components/nav-menu', ['exports', 'ember', 'hospitalrun/mixins/user-session'], function (exports, _ember, _hospitalrunMixinsUserSession) {
  var computed = _ember['default'].computed;
  var get = _ember['default'].get;
  var set = _ember['default'].set;
  exports['default'] = _ember['default'].Component.extend(_hospitalrunMixinsUserSession['default'], {
    callCloseSettings: 'closeSettings',
    callNavAction: 'navAction',
    classNames: ['primary-nav-item'],
    isShowing: false,
    nav: null,
    tagName: 'div',

    show: computed('nav', 'session.data.authenticated.userCaps', function () {
      this._setupSubNav();
      return this.currentUserCan(get(this, 'nav').capability);
    }),

    _setup: (function () {
      var nav = get(this, 'nav');
      nav.closeSubnav = (function () {
        set(this, 'isShowing', false);
      }).bind(this);
      this._setupSubNav();
    }).on('init'),

    _setupSubNav: function _setupSubNav() {
      var _this = this;

      var nav = get(this, 'nav');
      nav.subnav.forEach(function (item) {
        set(item, 'show', _this.currentUserCan(item.capability));
      });
    },

    actions: {
      resetNav: function resetNav() {
        this.sendAction('callCloseSettings');
      },

      toggleContent: function toggleContent() {
        this.toggleProperty('isShowing');
        this.sendAction('callNavAction', this.nav);
      }
    }
  });
});
define('hospitalrun/components/nav-paging', ['exports', 'ember', 'hospitalrun/mixins/paging-actions'], function (exports, _ember, _hospitalrunMixinsPagingActions) {
  exports['default'] = _ember['default'].Component.extend(_hospitalrunMixinsPagingActions['default'], {
    classNames: ['paging-buttons'],
    paginationProps: null
  });
});
define('hospitalrun/components/number-input', ['exports', 'ember-rapid-forms/components/em-input'], function (exports, _emberRapidFormsComponentsEmInput) {
  exports['default'] = _emberRapidFormsComponentsEmInput['default'].extend({
    sanitizeFunction: function sanitizeFunction(value) {
      return value.replace(new RegExp(/([^0-9|.]+)/g), '');
    },

    focusOut: function focusOut() {
      this._sanitizeValue();
      return this._super();
    },

    keyUp: function keyUp() {
      this._sanitizeValue();
      return this._super();
    },

    _sanitizeValue: function _sanitizeValue() {
      var model = this.get('model');
      var property = this.get('property');
      var currentValue = model.get(property);
      var clean = this.get('sanitizeFunction')(currentValue);
      model.set(property, clean);
    }
  });
});
define('hospitalrun/components/operative-procedures', ['exports', 'ember'], function (exports, _ember) {
  exports.addProcedure = _addProcedure;
  var computed = _ember['default'].computed;
  var isEmpty = _ember['default'].isEmpty;
  var _get = _ember['default'].get;
  var set = _ember['default'].set;

  function _addProcedure(model) {
    var procedures = _get(model, 'procedures');
    var description = _get(model, 'procedureDescription');
    if (!isEmpty(description)) {
      procedures.addObject({
        description: description
      });
      set(model, 'procedureDescription', null);
    }
  }

  exports['default'] = _ember['default'].Component.extend({
    model: null,
    procedureList: null,
    haveProcedures: computed('model.procedures.[]', {
      get: function get() {
        return !isEmpty(_get(this, 'model.procedures'));
      }
    }),

    actions: {
      addProcedure: function addProcedure() {
        var model = _get(this, 'model');
        _addProcedure(model);
      },

      deleteProcedure: function deleteProcedure(procedureToDelete) {
        var model = _get(this, 'model');
        var procedures = _get(model, 'procedures');
        procedures.removeObject(procedureToDelete);
        model.validate();
      }
    }

  });
});
define('hospitalrun/components/patient-diagnosis', ['exports', 'ember', 'hospitalrun/mixins/patient-diagnosis', 'ember-i18n', 'hospitalrun/mixins/user-session'], function (exports, _ember, _hospitalrunMixinsPatientDiagnosis, _emberI18n, _hospitalrunMixinsUserSession) {
  var computed = _ember['default'].computed;
  var _get = _ember['default'].get;

  var DIAGNOSIS_KEYS = ['diagnosisContainer', 'hideInActiveDiagnoses', 'diagnosisContainer.diagnoses.@each.active', 'diagnosisContainer.diagnoses.@each.secondaryDiagnosis'];

  exports['default'] = _ember['default'].Component.extend(_hospitalrunMixinsPatientDiagnosis['default'], _hospitalrunMixinsUserSession['default'], {
    i18n: _ember['default'].inject.service(),
    allowAddDiagnosis: false,
    diagnosisContainer: null,
    diagnosisProperty: null,
    diagnosisList: null,
    editDiagnosisAction: 'editDiagnosis',
    hideInActiveDiagnoses: true,
    showAddDiagnosisAction: 'showAddDiagnosis',
    primaryDiagnosisLabel: (0, _emberI18n.translationMacro)('patients.labels.primaryDiagnosis'),
    secondaryDiagnosisLabel: (0, _emberI18n.translationMacro)('patients.labels.secondaryDiagnosis'),

    canAddDiagnosis: computed('allowAddDiagnosis', {
      get: function get() {
        var allowAddDiagnosis = _get(this, 'allowAddDiagnosis');
        return allowAddDiagnosis && this.currentUserCan('add_diagnosis');
      }
    }),

    havePrimaryDiagnoses: computed('primaryDiagnoses.length', {
      get: function get() {
        var primaryDiagnosesLength = this.get('primaryDiagnoses.length');
        return primaryDiagnosesLength > 0;
      }
    }),

    haveSecondaryDiagnoses: computed('secondaryDiagnoses.length', {
      get: function get() {
        var secondaryDiagnosesLength = this.get('secondaryDiagnoses.length');
        return secondaryDiagnosesLength > 0;
      }
    }),

    primaryDiagnoses: computed.apply(undefined, DIAGNOSIS_KEYS.concat([{
      get: function get() {
        var diagnosisContainer = this.get('diagnosisContainer');
        var hideInActiveDiagnoses = this.get('hideInActiveDiagnoses');
        return this.getDiagnoses(diagnosisContainer, hideInActiveDiagnoses, false);
      }
    }])),

    secondaryDiagnoses: computed.apply(undefined, DIAGNOSIS_KEYS.concat([{
      get: function get() {
        var diagnosisContainer = this.get('diagnosisContainer');
        var hideInActiveDiagnoses = this.get('hideInActiveDiagnoses');
        return this.getDiagnoses(diagnosisContainer, hideInActiveDiagnoses, true);
      }
    }])),

    showPrimaryDiagnoses: computed('canAddDiagnosis', 'havePrimaryDiagnoses', {
      get: function get() {
        return this.get('canAddDiagnosis') || this.get('havePrimaryDiagnoses');
      }
    }),

    actions: {
      editDiagnosis: function editDiagnosis(diagnosis) {
        this.sendAction('editDiagnosisAction', diagnosis);
      },

      showAddDiagnosis: function showAddDiagnosis() {
        this.sendAction('showAddDiagnosisAction');
      }
    }

  });
});
define('hospitalrun/components/patient-orders', ['exports', 'ember', 'hospitalrun/mixins/filter-list', 'hospitalrun/mixins/user-session'], function (exports, _ember, _hospitalrunMixinsFilterList, _hospitalrunMixinsUserSession) {
  var computed = _ember['default'].computed;
  exports['default'] = _ember['default'].Component.extend(_hospitalrunMixinsFilterList['default'], _hospitalrunMixinsUserSession['default'], {
    editImagingAction: 'editImaging',
    editLabAction: 'editLab',
    editMedicationAction: 'editMedication',
    filterBy: null,
    filterValue: null,
    newImagingAction: 'newImaging',
    newLabAction: 'newLab',
    newMedicationAction: 'newMedication',
    showDeleteImagingAction: 'showDeleteImaging',
    showDeleteLabAction: 'showDeleteLab',
    showDeleteMedicationAction: 'showDeleteMedication',
    sortKey: null,
    sortDesc: false,
    orderTypeFilters: _ember['default'].computed(function () {
      var i18n = this.get('i18n');
      return [i18n.t('components.patientOrders.labels.imagingOrderType').toString(), i18n.t('components.patientOrders.labels.labOrderType').toString(), i18n.t('components.patientOrders.labels.medicationOrderType').toString()];
    }),

    canAddImaging: _ember['default'].computed(function () {
      return this.currentUserCan('add_imaging');
    }),

    canAddLab: _ember['default'].computed(function () {
      return this.currentUserCan('add_lab');
    }),

    canAddMedication: _ember['default'].computed(function () {
      return this.currentUserCan('add_medication');
    }),

    canDeleteImaging: _ember['default'].computed(function () {
      return this.currentUserCan('delete_imaging');
    }),

    canDeleteLab: _ember['default'].computed(function () {
      return this.currentUserCan('delete_lab');
    }),

    canDeleteMedication: _ember['default'].computed(function () {
      return this.currentUserCan('delete_medication');
    }),

    filteredList: computed('orderList.[]', 'filterBy', 'filterValue', function () {
      var filterBy = this.get('filterBy');
      var filterValue = this.get('filterValue');
      var orderList = this.get('orderList');
      orderList = this.filterList(orderList, filterBy, filterValue);
      return orderList;
    }),

    orderList: computed('visit.imaging.[]', 'visit.labs.[]', 'visit.medication.[]', function () {
      var _this = this;

      var i18n = this.get('i18n');
      var imaging = this.get('visit.imaging');
      var labs = this.get('visit.labs');
      var medication = this.get('visit.medication');
      var orderList = new _ember['default'].A();
      orderList.addObjects(imaging.map(function (item) {
        item.set('orderType', i18n.t('components.patientOrders.labels.imagingOrderType'));
        item.set('name', item.get('imagingType.name'));
        item.set('dateProcessed', item.get('imagingDate'));
        _this._setPermissions(item, 'canAddImaging', 'canDeleteImaging');
        return item;
      }));
      orderList.addObjects(labs.map(function (item) {
        item.set('orderType', i18n.t('components.patientOrders.labels.labOrderType'));
        item.set('name', item.get('labType.name'));
        item.set('dateProcessed', item.get('labDate'));
        _this._setPermissions(item, 'canAddLab', 'canDeleteLab');
        return item;
      }));
      orderList.addObjects(medication.map(function (item) {
        item.set('orderType', i18n.t('components.patientOrders.labels.medicationOrderType'));
        item.set('name', item.get('medicationName'));
        item.set('dateProcessed', item.get('prescriptionDate'));
        item.set('result', '');
        item.set('notes', item.get('prescription'));
        _this._setPermissions(item, 'canAddMedication', 'canDeleteMedication');
        return item;
      }));
      return orderList;
    }),

    sortedOrders: _ember['default'].computed('filteredList', 'sortKey', 'sortDesc', function () {
      var filteredList = this.get('filteredList');
      var sortDesc = this.get('sortDesc');
      var sortKey = this.get('sortKey');
      if (_ember['default'].isEmpty(filteredList) || _ember['default'].isEmpty(sortKey)) {
        return filteredList;
      }
      filteredList = filteredList.sort(function (a, b) {
        var compareA = a.get(sortKey);
        var compareB = b.get(sortKey);
        if (sortKey === 'orderType') {
          compareA = compareA.toString();
          compareB = compareB.toString();
        }
        if (sortDesc) {
          return _ember['default'].compare(compareB, compareA);
        } else {
          return _ember['default'].compare(compareA, compareB);
        }
      });
      return filteredList;
    }),

    i18n: _ember['default'].inject.service(),
    visit: null,

    _setPermissions: function _setPermissions(item, editPerm, deletePerm) {
      if (item.get('canEdit')) {
        if (this.get(editPerm)) {
          item.set('canEdit', true);
        }
        if (this.get(deletePerm)) {
          item.set('canDelete', true);
        }
      }
    },

    actions: {
      filter: function filter(filterBy, filterValue) {
        this.setProperties({
          filterBy: filterBy,
          filterValue: filterValue
        });
      },

      newImaging: function newImaging() {
        this.sendAction('newImagingAction');
      },

      newLab: function newLab() {
        this.sendAction('newLabAction');
      },

      newMedication: function newMedication() {
        this.sendAction('newMedicationAction');
      },

      editOrder: function editOrder(order) {
        var modelName = order.get('constructor.modelName').capitalize();
        this.sendAction('edit' + modelName + 'Action', order);
      },

      showDeleteOrder: function showDeleteOrder(order) {
        var modelName = order.get('constructor.modelName').capitalize();
        this.sendAction('showDelete' + modelName + 'Action', order);
      },

      sortByKey: function sortByKey(sortBy, sortDesc) {
        this.setProperties({
          sortKey: sortBy,
          sortDesc: sortDesc
        });
      }
    }

  });
});
define('hospitalrun/components/patient-summary', ['exports', 'ember', 'hospitalrun/mixins/user-session'], function (exports, _ember, _hospitalrunMixinsUserSession) {
  var computed = _ember['default'].computed;
  var _get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;
  var set = _ember['default'].set;
  exports['default'] = _ember['default'].Component.extend(_hospitalrunMixinsUserSession['default'], {
    allowAddAllergy: false,
    allowAddDiagnosis: false,
    allowAddOperativePlan: false,
    classNames: ['patient-summary'],
    diagnosisContainer: null,
    diagnosisList: null,
    disablePatientLink: false,
    editAllergyAction: 'editAllergy',
    editDiagnosisAction: 'editDiagnosis',
    editOperativePlanAction: 'editOperativePlan',
    editOperationReportAction: 'editOperationReport',
    editProcedureAction: 'editProcedure',
    hideInActiveDiagnoses: true,
    patient: null,
    patientProcedures: null,
    showAddAllergyAction: 'showAddAllergy',
    showAddDiagnosisAction: 'showAddDiagnosis',
    showPatientAction: 'showPatient',

    canAddAllergy: computed('allowAddAllergy', {
      get: function get() {
        var allowAddAllergy = _get(this, 'allowAddAllergy');
        return allowAddAllergy && this.currentUserCan('add_allergy');
      }
    }),

    canAddOperativePlan: computed('allowAddOperativePlan', {
      get: function get() {
        var allowAddOperativePlan = _get(this, 'allowAddOperativePlan');
        return allowAddOperativePlan && this.currentUserCan('add_operative_plan');
      }
    }),

    currentOperativePlan: computed('patient.operativePlans.@each.status', {
      get: function get() {
        var operativePlans = _get(this, 'patient.operativePlans');
        return operativePlans.findBy('isPlanned', true);
      }
    }),

    haveProcedures: computed('patientProcedures.length', function () {
      var proceduresLength = this.get('patientProcedures.length');
      return proceduresLength > 0;
    }),

    shouldLinkToPatient: computed('disablePatientLink', function () {
      var disablePatientLink = this.get('disablePatientLink');
      return !disablePatientLink;
    }),

    didReceiveAttrs: function didReceiveAttrs() {
      this._super.apply(this, arguments);
      var diagnosisContainer = _get(this, 'diagnosisContainer');
      if (isEmpty(diagnosisContainer)) {
        set(this, 'diagnosisContainer', _get(this, 'patient'));
      }
    },

    actions: {
      addOperativePlan: function addOperativePlan() {
        this.sendAction('editOperativePlanAction');
      },

      editOperativePlan: function editOperativePlan(operativePlan) {
        this.sendAction('editOperativePlanAction', operativePlan);
      },

      linkToPatient: function linkToPatient() {
        var shouldLink = this.get('shouldLinkToPatient');
        if (shouldLink) {
          var patient = this.get('patient');
          var returnTo = this.get('returnTo');
          var returnToContext = this.get('returnToContext');
          patient.set('returnTo', returnTo);
          patient.set('returnToContext', returnToContext);
          this.sendAction('showPatientAction', this.get('patient'));
        }
      },

      editAllergy: function editAllergy(allergy) {
        this.sendAction('editAllergyAction', allergy);
      },

      editDiagnosis: function editDiagnosis(diagnosis) {
        this.sendAction('editDiagnosisAction', diagnosis);
      },

      editProcedure: function editProcedure(procedure) {
        var report = _get(procedure, 'report');
        if (isEmpty(report)) {
          this.sendAction('editProcedureAction', procedure);
        } else {
          this.sendAction('editOperationReportAction', report);
        }
      },

      showAddAllergy: function showAddAllergy() {
        this.sendAction('showAddAllergyAction');
      },

      showAddDiagnosis: function showAddDiagnosis() {
        this.sendAction('showAddDiagnosisAction');
      }
    }
  });
});
define('hospitalrun/components/patient-typeahead', ['exports', 'ember', 'hospitalrun/mixins/patient-name', 'hospitalrun/components/type-ahead'], function (exports, _ember, _hospitalrunMixinsPatientName, _hospitalrunComponentsTypeAhead) {
  exports['default'] = _hospitalrunComponentsTypeAhead['default'].extend(_hospitalrunMixinsPatientName['default'], {
    displayKey: 'name',
    selectedAction: 'selectedPatientChanged',
    setOnBlur: true,

    _mapPatient: function _mapPatient(item) {
      var returnObj = {};
      returnObj.name = this.getPatientDisplayName(item) + ' - ' + this.getPatientDisplayId(item);
      returnObj[this.get('selectionKey')] = item;
      return returnObj;
    },

    contentChanged: (function () {
      var bloodhound = this.get('bloodhound');
      var content = this.get('content');
      if (bloodhound) {
        bloodhound.clear();
        if (!_ember['default'].isEmpty(content)) {
          bloodhound.add(content.map(this._mapPatient.bind(this)));
        }
      }
    }).observes('content.[]'),

    mappedContent: (function () {
      var content = this.get('content');
      var mapped = [];
      if (content) {
        mapped = content.map(this._mapPatient.bind(this));
      }
      return mapped;
    }).property('content')

  });
});
define('hospitalrun/components/photo-display', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    computedPhotoUrl: null,
    filesystem: _ember['default'].inject.service(),
    isFileSystemEnabled: _ember['default'].computed.alias('filesystem.isFileSystemEnabled'),
    fileName: _ember['default'].computed.alias('photo.fileName'),
    photo: null,
    url: _ember['default'].computed.alias('photo.url'),

    photoUrl: (function () {
      var computedPhotoUrl = this.get('computedPhotoUrl');
      var fileName = this.get('fileName');
      var filesystem = this.get('filesystem');
      var isFileSystemEnabled = this.get('isFileSystemEnabled');
      var url = this.get('url');
      if (!_ember['default'].isEmpty(computedPhotoUrl)) {
        return computedPhotoUrl;
      } else if (isFileSystemEnabled) {
        filesystem.pathToFileSystemURL(fileName).then((function (photoUrl) {
          if (!_ember['default'].isEmpty(photoUrl)) {
            this.set('computedPhotoUrl', photoUrl);
          }
        }).bind(this));
      }
      return url;
    }).property('computedPhotoUrl', 'fileName', 'url')
  });
});
define('hospitalrun/components/price-list', ['exports', 'ember', 'hospitalrun/mixins/charge-actions'], function (exports, _ember, _hospitalrunMixinsChargeActions) {
  exports['default'] = _ember['default'].Component.extend(_hospitalrunMixinsChargeActions['default'], {
    attributeBindings: ['tabId:id', 'role'],
    charges: _ember['default'].computed.alias('model.charges'),
    classNameBindings: ['active'],
    classNames: ['tab-pane'],
    index: null,
    model: null,
    pricingList: null,
    pricingType: null,
    role: 'tab',
    setChargeQuantityAction: 'setChargeQuantity',

    active: (function () {
      var index = this.get('index');
      return index === 0;
    }).property(),

    pricingListByType: (function () {
      var pricingList = this.get('pricingList');
      var pricingType = this.get('pricingType');
      var rows = [];
      if (!_ember['default'].isEmpty(pricingList)) {
        pricingList = pricingList.filterBy('pricingType', pricingType);
        pricingList = pricingList.map((function (pricingItem) {
          var chargesForItem = this.findChargeForPricingItem(pricingItem, this.get('charges'));
          if (chargesForItem) {
            this.sendAction('setChargeQuantityAction', pricingItem.id, chargesForItem.get('quantity'));
          }
          return pricingItem;
        }).bind(this));
        var offset = 0;
        var _pricingList = pricingList;
        var _length = _pricingList.length;

        while (offset < _length) {
          rows.push(pricingList.slice(offset, offset + 6));
          offset += 6;
        }
      }
      return rows;
    }).property('pricingType', 'pricingList'),

    tabId: (function () {
      return this.get('pricingType').toLowerCase().dasherize();
    }).property('pricingType')

  });
});
define('hospitalrun/components/pricing-typeahead', ['exports', 'ember', 'hospitalrun/components/type-ahead'], function (exports, _ember, _hospitalrunComponentsTypeAhead) {
  exports['default'] = _hospitalrunComponentsTypeAhead['default'].extend({
    displayKey: 'name',
    setOnBlur: true,

    _mapContentItems: function _mapContentItems() {
      var content = this.get('content');
      if (content) {
        var mapped = content.filter(function (item) {
          return !_ember['default'].isEmpty(item);
        });
        mapped = mapped.map((function (item) {
          var returnObj = {};
          returnObj.name = item.name;
          returnObj[this.get('selectionKey')] = item;
          return returnObj;
        }).bind(this));
        return mapped;
      } else {
        return [];
      }
    }
  });
});
define('hospitalrun/components/print-this', ['exports', 'ember'], function (exports, _ember) {
  var get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _ember['default'].Component.extend({
    print: true,
    delay: null,

    didInsertElement: function didInsertElement() {
      if (get(this, 'print')) {
        var delay = get(this, 'delay');
        if (!isEmpty(delay) && !isNaN(delay) && delay > 0) {
          _ember['default'].run.later(null, function () {
            window.print();
          }, delay);
        } else {
          _ember['default'].run.scheduleOnce('afterRender', this, function () {
            window.print();
          });
        }
      }
    }
  });
});
define('hospitalrun/components/quantity-calc', ['exports', 'ember'], function (exports, _ember) {
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _ember['default'].Component.extend({
    quantityGroups: [],
    calculated: null,
    currentUnit: null,
    targetUnit: null,
    unitList: null,

    didReceiveAttrs: function didReceiveAttrs() /* attrs */{
      this._super.apply(this, arguments);
      var quantityGroups = this.get('quantityGroups');
      if (isEmpty(quantityGroups)) {
        var calculated = this.get('calculated');
        var targetUnit = this.get('targetUnit');
        quantityGroups.addObject({
          index: 0,
          unit: targetUnit,
          firstQuantity: true,
          quantity: calculated
        });
      }
    },

    showTotal: (function () {
      var calculated = this.get('calculated');
      var quantityGroups = this.get('quantityGroups');
      if (quantityGroups.length > 1 && !_ember['default'].isEmpty(calculated) && !isNaN(calculated)) {
        return true;
      }
      return false;
    }).property('calculated'),

    currentQuantityGroups: (function () {
      var firstQuantityObject = undefined;
      var quantityGroups = this.get('quantityGroups');
      var targetUnit = this.get('targetUnit');
      firstQuantityObject = quantityGroups.get('firstObject');
      if (!_ember['default'].isEmpty(firstQuantityObject)) {
        var selectedUnit = firstQuantityObject.unit;
        if (_ember['default'].isEmpty(selectedUnit)) {
          this.set('quantityGroups.firstObject.unit', targetUnit);
        } else {
          this.updateCurrentUnit(selectedUnit, 0);
        }
      }
      return quantityGroups;
    }).property('quantityGroups', 'targetUnit'),

    calculateTotal: function calculateTotal() {
      var quantityGroups = this.get('quantityGroups');
      var haveQuantities = false;
      var lastObject = quantityGroups.get('lastObject');
      var targetUnit = this.get('targetUnit');
      haveQuantities = quantityGroups.every(function (item) {
        var quantity = item.quantity;
        var unit = item.unit;

        return !_ember['default'].isEmpty(quantity) && !_ember['default'].isEmpty(unit) && !isNaN(quantity);
      });
      if (haveQuantities && lastObject.unit === targetUnit) {
        var newValue = quantityGroups.reduce(function (previousValue, item) {
          return previousValue * parseInt(item.quantity);
        }, 1);
        this.set('calculated', newValue);
      } else {
        this.set('calculated');
      }
    },

    updateCurrentUnit: function updateCurrentUnit(selectedUnit, index) {
      var targetUnit = this.get('targetUnit');
      var quantityGroups = this.get('quantityGroups');
      var groupLength = quantityGroups.length;
      if (!_ember['default'].isEmpty(targetUnit)) {
        if (selectedUnit === targetUnit) {
          // Done
          if (index < groupLength - 1) {
            quantityGroups.removeAt(index + 1, groupLength - 1 - index);
          }
        } else {
          if (index === groupLength - 1) {
            quantityGroups.addObject({
              unitName: selectedUnit,
              unit: targetUnit,
              index: quantityGroups.length
            });
          } else {
            _ember['default'].set(quantityGroups.objectAt(index + 1), 'unitName', selectedUnit);
          }
        }
        _ember['default'].run.once(this, this.calculateTotal);
      }
    }
  });
});
define('hospitalrun/components/quantity-conv', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    firstQuantity: false,
    quantity: null,
    quantityHelp: null,
    unitName: null,
    unit: null,
    resetUnitName: false,
    targetUnit: _ember['default'].computed.alias('parentView.targetUnit'),
    unitList: null,

    unitClass: (function () {
      var selectedUnit = this.get('unit');
      var targetUnit = this.get('targetUnit');
      var unitClass = 'has-success';
      if (!_ember['default'].isEmpty(targetUnit) && _ember['default'].isEmpty(selectedUnit)) {
        this.set('unitHelp', 'please select a unit');
        unitClass = 'has-error';
      } else {
        if (_ember['default'].isEmpty(targetUnit)) {
          unitClass = '';
        }
        this.set('unitHelp');
      }
      this.get('parentView').updateCurrentUnit(selectedUnit, this.get('index'));
      return unitClass;
    }).property('targetUnit', 'unit'),

    quantityClass: (function () {
      var quantity = this.get('quantity');
      var quantityClass = 'has-success';
      var targetUnit = this.get('targetUnit');
      if (!_ember['default'].isEmpty(targetUnit) && (_ember['default'].isEmpty(quantity) || isNaN(quantity) || quantity < 0)) {
        this.set('quantityHelp', 'not a valid number');
        quantityClass = 'has-error';
      } else {
        if (_ember['default'].isEmpty(targetUnit)) {
          quantityClass = '';
        }
        this.set('quantityHelp');
      }
      _ember['default'].run.once(this, function () {
        this.get('parentView').calculateTotal();
      });
      return quantityClass;
    }).property('quantity', 'targetUnit')
  });
});
define('hospitalrun/components/radio-button', ['exports', 'ember-radio-buttons/components/radio-button'], function (exports, _emberRadioButtonsComponentsRadioButton) {
  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _emberRadioButtonsComponentsRadioButton['default'];
    }
  });
});
define('hospitalrun/components/role-select', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    // possible passed-in values with their defaults:
    content: null,
    prompt: null,
    optionValuePath: 'roles',
    optionLabelPath: 'name',
    action: _ember['default'].K, // action to fire on change

    // shadow the passed-in `selection` to avoid
    // leaking changes to it via a 2-way binding
    _selection: _ember['default'].computed.reads('selection'),

    init: function init() {
      this._super.apply(this, arguments);
      if (!this.get('content')) {
        this.set('content', []);
      }
    },

    actions: {
      change: function change() {
        var selectEl = this.$('select').get(0);
        var selectedIndex = selectEl.selectedIndex;

        var content = this.get('content');

        // decrement index by 1 if we have a prompt
        var hasPrompt = !!this.get('prompt');
        var contentIndex = hasPrompt ? selectedIndex - 1 : selectedIndex;

        var selection = content[contentIndex].roles;

        // set the local, shadowed selection to avoid leaking
        // changes to `selection` out via 2-way binding
        this.set('_selection', selection);

        var changeCallback = this.get('action');
        changeCallback(selection);
      }
    }
  });
});
define('hospitalrun/components/search-listing', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    action: 'allItems',
    actions: {
      allItems: function allItems() {
        this.sendAction();
      }
    }
  });
});
define('hospitalrun/components/select-list', ['exports', 'ember-select-list/components/select-list'], function (exports, _emberSelectListComponentsSelectList) {
  exports['default'] = _emberSelectListComponentsSelectList['default'];
});
define('hospitalrun/components/select-or-typeahead', ['exports', 'ember', 'hospitalrun/utils/select-values'], function (exports, _ember, _hospitalrunUtilsSelectValues) {
  exports['default'] = _ember['default'].Component.extend({
    name: 'select-or-typeahead',
    className: null,
    hint: true,
    label: null,
    list: null,
    optionLabelPath: 'value',
    optionValuePath: 'id',
    property: null,
    prompt: ' ',
    selection: null,
    setOnBlur: true,
    typeAheadType: null,

    content: (function () {
      var list = this.get('list');
      var optionLabelPath = this.get('optionLabelPath');
      var optionValuePath = this.get('optionValuePath');
      var userCanAdd = this.get('userCanAdd');

      if (!_ember['default'].isEmpty(list) && list.get) {
        var contentList = list.get('value');
        if (_ember['default'].isEmpty(contentList)) {
          return [];
        }

        if (!userCanAdd && optionLabelPath === 'value' && optionValuePath === 'id') {
          return contentList.map(_hospitalrunUtilsSelectValues['default'].selectValuesMap);
        } else {
          return contentList;
        }
      }
    }).property('list.value.[]'),

    usePricingTypeAhead: (function () {
      return this.get('typeAheadType') === 'pricing';
    }).property('typeAheadType'),

    userCanAdd: (function () {
      var list = this.get('list');
      if (!_ember['default'].isEmpty(list) && list.get) {
        return list.get('userCanAdd');
      } else {
        return true;
      }
    }).property('list.userCanAdd')
  });
});
define('hospitalrun/components/smart-prescription', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].TextArea.extend(_ember['default'].TargetActionSupport, {
    valueDidChange: _ember['default'].observer('value', function () {
      this.triggerAction({
        action: 'search'
      });
    })
  });
});
define('hospitalrun/components/sortable-column', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    classNames: ['sortable-column'],
    tagName: 'th',
    action: 'sortByKey',
    filterAction: 'filter',
    filterBy: null,
    filteredBy: null,
    filterType: 'list',
    sortDesc: false,
    sortBy: null,
    sortKey: null,
    filtered: false,

    sorted: (function () {
      var sortBy = this.get('sortBy');
      var sortKey = this.get('sortKey');
      return sortBy === sortKey;
    }).property('sortBy', 'sortKey'),

    actions: {
      sort: function sort() {
        var sortBy = this.get('sortBy');
        var sorted = this.get('sorted');
        var sortDesc = false;
        if (sorted) {
          sortDesc = this.toggleProperty('sortDesc');
        }
        this.sendAction('action', sortBy, sortDesc);
      },

      filter: function filter(filterValue) {
        if (_ember['default'].isEmpty(filterValue)) {
          this.set('filtered');
        } else {
          this.set('filtered', true);
        }
        var filterBy = this.get('filterBy');
        var $dropdown = this.$('.dropdown-toggle');
        $dropdown.dropdown('toggle');
        this.sendAction('filterAction', filterBy, filterValue);
      }
    }
  });
});
define('hospitalrun/components/take-photo', ['exports', 'ember'], function (exports, _ember) {
  var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();

  var TAKE_PICTURE = 'takeAPicture';
  var UPLOAD_FILE = 'uploadAFile';
  var FILE_SOURCES = [TAKE_PICTURE, UPLOAD_FILE];

  var computed = _ember['default'].computed;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var isEmpty = _ember['default'].isEmpty;
  var set = _ember['default'].set;

  // Derived from https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Taking_still_photos and
  // https://github.com/samdutton/simpl/blob/master/getusermedia/sources/js/main.js
  exports['default'] = _ember['default'].Component.extend({
    defaultPhotoSource: null,
    canvas: null,
    height: 0,
    isImage: false,
    photo: null,
    photoFile: null,
    photoSource: null,
    selectedCamera: null,
    setupCamera: false,
    sourceLabel: null,
    video: null,
    videoSources: null,
    width: 200,

    i18n: inject.service(),

    canCaptureVideo: computed(function () {
      return navigator.mediaDevices && navigator.mediaDevices.getUserMedia;
    }),

    photoSources: computed(function () {
      var i18n = get(this, 'i18n');
      return FILE_SOURCES.map(function (source) {
        return {
          label: i18n.t('components.takePhoto.labels.' + source),
          value: source
        };
      });
    }),

    sourceChooserLabel: computed('sourceLabel', function () {
      var i18n = get(this, 'i18n');
      var sourceLabel = get(this, 'sourceLabel');
      if (isEmpty(sourceLabel)) {
        return i18n.t('components.takePhoto.how');
      } else {
        return sourceLabel;
      }
    }),

    showFileUpload: computed('photoSource', function () {
      var photoSource = get(this, 'photoSource');
      return photoSource === UPLOAD_FILE;
    }),

    showCameraSelect: computed('videoSources', function () {
      var showFileUpload = get(this, 'showFileUpload');
      var videoSources = get(this, 'videoSources');
      return !showFileUpload && videoSources && videoSources.length > 1;
    }),

    didInsertElement: function didInsertElement() {
      var canCaptureVideo = get(this, 'canCaptureVideo');
      var photoSource = get(this, 'defaultPhotoSource');
      if (isEmpty(photoSource)) {
        if (canCaptureVideo) {
          photoSource = TAKE_PICTURE;
        } else {
          photoSource = UPLOAD_FILE;
        }
      }
      this._photoSourceChanged(photoSource);
    },

    willDestroyElement: function willDestroyElement() {
      this._stopStream();
    },

    /**
     * Setup the specified camera
     */
    _cameraChange: function _cameraChange(selectedCamera) {
      set(this, 'selectedCamera', selectedCamera);
      var stream = get(this, 'stream');
      var video = get(this, 'video');
      if (!_ember['default'].isEmpty(stream)) {
        video.src = null;
        this._stopStream();
      }
      var videoSource = get(this, 'selectedCamera');
      var constraints = {
        audio: false,
        video: {
          deviceId: videoSource
        }
      };
      navigator.mediaDevices.getUserMedia(constraints).then(this._gotStream.bind(this))['catch'](this._errorCallback);
      this._setupVideo();
    },

    _errorCallback: function _errorCallback(error) {
      console.log('navigator.mediaDevices.getUserMedia error: ', error);
    },

    /**
     * Callback for MediaStreamTrack.getSources
     */
    _gotSources: function _gotSources(sourceInfos) {
      var cameraCount = 0;
      var cameraLabel = undefined;
      var videoSources = [];
      for (var i = 0; i !== sourceInfos.length; ++i) {
        var sourceInfo = sourceInfos[i];
        if (sourceInfo.kind === 'videoinput') {
          cameraLabel = 'Camera \'' + ++cameraCount;
          if (sourceInfo.label) {
            cameraLabel += ' (' + sourceInfo.label + ')';
          }
          videoSources.addObject({
            deviceId: sourceInfo.deviceId,
            label: cameraLabel
          });
        }
      }
      set(this, 'videoSources', videoSources);
      if (videoSources.length > 0) {
        set(this, 'selectedCamera', videoSources[0].deviceId);
        this._cameraChange(videoSources[0].deviceId);
      }
    },

    /**
     * Callback handler for getUserMedia.
     */
    _gotStream: function _gotStream(stream) {
      if (this.isDestroyed) {
        this._stopStream(stream);
      } else {
        var video = get(this, 'video');
        set(this, 'stream', stream); // make stream available to object
        video.srcObject = stream;
        video.play();
      }
    },

    _photoSourceChanged: function _photoSourceChanged(photoSource) {
      var camera = this.$('.camera');
      var setupCamera = get(this, 'setupCamera');
      set(this, 'photoSource', photoSource);
      if (photoSource === UPLOAD_FILE) {
        camera.hide();
      } else {
        camera.show();
        if (!setupCamera) {
          var canvas = this.$('canvas').get(0);
          var photo = this.$('img').get(0);
          var video = this.$('video').get(0);
          this.setProperties({
            canvas: canvas,
            photo: photo,
            video: video
          });
          if (navigator.mediaDevices) {
            if (!navigator.mediaDevices.enumerateDevices) {
              if (navigator.mediaDevices.getUserMedia) {
                var constraints = { audio: false, video: true };
                navigator.mediaDevices.getUserMedia(constraints).then(this._gotStream.bind(this))['catch'](this._errorCallback);
                this._setupCanPlayListener(video);
              }
            } else {
              navigator.mediaDevices.enumerateDevices().then(this._gotSources.bind(this))['catch'](this._errorCallback);
              this._setupCanPlayListener(video);
            }
          }
          set(this, 'setupCamera', true);
        }
      }
    },

    _setupCanPlayListener: function _setupCanPlayListener(video) {
      // Remove listener if it was already added before.
      video.removeEventListener('canplay', this._setupVideo.bind(this), false);
      video.addEventListener('canplay', this._setupVideo.bind(this), false);
    },

    /**
     * Setup the dimensions for the video preview and picture elements.
     */
    _setupVideo: function _setupVideo() {
      var canvas = get(this, 'canvas');
      var height = get(this, 'height');
      var video = get(this, 'video');
      var width = get(this, 'width');
      height = video.videoHeight / (video.videoWidth / width);
      video.setAttribute('width', width);
      video.setAttribute('height', height);
      canvas.setAttribute('width', width);
      canvas.setAttribute('height', height);
      this.setProperties({
        height: height,
        width: width
      });
    },

    _stopStream: function _stopStream(stream) {
      var streamToStop = stream || get(this, 'stream');
      if (!_ember['default'].isEmpty(streamToStop)) {
        if (typeof streamToStop.active === 'undefined') {
          streamToStop.stop();
        } else {
          var _streamToStop$getTracks = streamToStop.getTracks();

          var _streamToStop$getTracks2 = _slicedToArray(_streamToStop$getTracks, 1);

          var track = _streamToStop$getTracks2[0];

          track.stop();
        }
      }
    },

    actions: {
      cameraChange: function cameraChange(selectedCamera) {
        this._cameraChange(selectedCamera);
      },

      photoSourceChange: function photoSourceChange(photoSource) {
        this._photoSourceChanged(photoSource);
      },

      takePhoto: function takePhoto() {
        var canvas = get(this, 'canvas');
        var height = get(this, 'height');
        var video = get(this, 'video');
        var width = get(this, 'width');
        canvas.width = width;
        canvas.height = height;
        canvas.getContext('2d').drawImage(video, 0, 0, width, height);
        var data = canvas.toDataURL('image/png');
        var binary = atob(data.split(',')[1]);
        var array = [];
        for (var i = 0; i < binary.length; i++) {
          array.push(binary.charCodeAt(i));
        }
        set(this, 'photoFile', new Blob([new Uint8Array(array)], { type: 'image/png' }));
        set(this, 'isImage', true);
      }
    }

  });
});
define('hospitalrun/components/text-search', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].TextField.extend(_ember['default'].TargetActionSupport, {
    change: function change() {
      this.triggerAction({
        action: 'search'
      });
    },
    didInsertElement: function didInsertElement() {
      this.$().focus();
    }
  });
});
define('hospitalrun/components/type-ahead', ['exports', 'ember-rapid-forms/components/em-input', 'hospitalrun/mixins/typeahead'], function (exports, _emberRapidFormsComponentsEmInput, _hospitalrunMixinsTypeahead) {
  exports['default'] = _emberRapidFormsComponentsEmInput['default'].extend(_hospitalrunMixinsTypeahead['default']);
});
define('hospitalrun/components/typeahead-filter', ['exports', 'ember', 'hospitalrun/mixins/typeahead'], function (exports, _ember, _hospitalrunMixinsTypeahead) {
  exports['default'] = _ember['default'].Component.extend(_hospitalrunMixinsTypeahead['default'], {
    classNames: ['input-group'],
    selectedAction: 'filter',
    setOnBlur: false,

    actions: {
      clearFilter: function clearFilter() {
        var $input = this.$('.tt-input');
        $input.val('');
        this.sendAction('selectedAction');
      }
    }
  });
});
define('hospitalrun/components/upcoming-appointments', ['exports', 'ember-data', 'ember', 'moment'], function (exports, _emberData, _ember, _moment) {
  var PromiseArray = _emberData['default'].PromiseArray;
  var Component = _ember['default'].Component;
  var computed = _ember['default'].computed;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = Component.extend({
    patient: null,

    database: inject.service(),
    store: inject.service(),

    appointments: computed('patient', function () {
      var patient = get(this, 'patient');
      if (!isEmpty(patient)) {
        var database = get(this, 'database');
        var endDate = (0, _moment['default'])().add(10, 'years').toDate().getTime();
        var maxApptId = database.getMaxPouchId('appointment');
        var minApptId = database.getMinPouchId('appointment');
        var patientId = get(patient, 'id');
        var startDate = (0, _moment['default'])().toDate().getTime();
        var store = get(this, 'store');
        var appointmentPromise = store.query('appointment', {
          options: {
            startkey: [patientId, startDate, startDate, minApptId],
            endkey: [patientId, endDate, endDate, maxApptId]
          },
          mapReduce: 'appointments_by_patient'
        });
        return PromiseArray.create({
          promise: appointmentPromise
        });
      }
    })
  });
});
define('hospitalrun/controllers/abstract-delete-controller', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Controller.extend({
    afterDeleteAction: 'closeModal',
    showUpdateButton: true,
    updateButtonText: 'Delete',
    updateButtonAction: 'delete',

    isUpdateDisabled: false,

    actions: {
      cancel: function cancel() {
        this.send('closeModal');
      },

      'delete': function _delete() {
        var recordToDelete = this.get('model');
        recordToDelete.set('archived', true);
        recordToDelete.save().then((function () {
          recordToDelete.unloadRecord();
          this.send(this.get('afterDeleteAction'), recordToDelete);
        }).bind(this));
      }
    }
  });
});
define('hospitalrun/controllers/abstract-edit-controller', ['exports', 'ember', 'hospitalrun/mixins/edit-panel-props', 'hospitalrun/mixins/is-update-disabled', 'hospitalrun/mixins/modal-helper', 'ember-concurrency', 'hospitalrun/mixins/user-session'], function (exports, _ember, _hospitalrunMixinsEditPanelProps, _hospitalrunMixinsIsUpdateDisabled, _hospitalrunMixinsModalHelper, _emberConcurrency, _hospitalrunMixinsUserSession) {
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var isEmpty = _ember['default'].isEmpty;
  var RSVP = _ember['default'].RSVP;
  var set = _ember['default'].set;
  exports['default'] = _ember['default'].Controller.extend(_hospitalrunMixinsEditPanelProps['default'], _hospitalrunMixinsIsUpdateDisabled['default'], _hospitalrunMixinsModalHelper['default'], _hospitalrunMixinsUserSession['default'], {
    cancelAction: 'allItems',

    cancelButtonText: (function () {
      var i18n = get(this, 'i18n');
      var hasDirtyAttributes = get(this, 'model.hasDirtyAttributes');
      if (hasDirtyAttributes) {
        return i18n.t('buttons.cancel');
      } else {
        return i18n.t('buttons.returnButton');
      }
    }).property('model.hasDirtyAttributes'),

    disabledAction: (function () {
      var model = get(this, 'model');
      if (model.validate) {
        model.validate()['catch'](_ember['default'].K);
      }
      var isValid = model.get('isValid');
      if (!isValid) {
        return 'showDisabledDialog';
      }
    }).property('model.isValid'),

    isNewOrDeleted: (function () {
      return get(this, 'model.isNew') || get(this, 'model.isDeleted');
    }).property('model.isNew', 'model.isDeleted'),

    lookupLists: inject.service(),
    /**
     *  Lookup lists that should be updated when the model has a new value to add to the lookup list.
     *  lookupListsToUpdate: [{
     *      name: 'countryList', //Name of property containing lookup list
     *      property: 'country', //Corresponding property on model that potentially contains a new value to add to the list
     *      id: 'country_list' //Id of the lookup list to update
     *  }
     */
    lookupListsLastUpdate: null,
    lookupListsToUpdate: null,

    showUpdateButton: (function () {
      var updateButtonCapability = get(this, 'updateCapability');
      return this.currentUserCan(updateButtonCapability);
    }).property('updateCapability'),

    updateButtonAction: 'update',
    updateButtonText: (function () {
      var i18n = get(this, 'i18n');
      if (get(this, 'model.isNew')) {
        return i18n.t('buttons.add');
      } else {
        return i18n.t('buttons.update');
      }
    }).property('model.isNew'),
    updateCapability: null,

    /* Silently update and then fire the specified action. */
    silentUpdate: function silentUpdate(action, whereFrom) {
      var _this = this;

      return this.get('updateTask').perform(true).then(function () {
        _this.send(action, whereFrom);
      });
    },

    /**
     * Task to update the model and perform the before update and after update
     * @param skipAfterUpdate boolean (optional) indicating whether or not
     * to skip the afterUpdate call.
     */
    updateTask: (0, _emberConcurrency.task)(regeneratorRuntime.mark(function callee$0$0(skipAfterUpdate) {
      return regeneratorRuntime.wrap(function callee$0$0$(context$1$0) {
        var _this2 = this;

        while (1) switch (context$1$0.prev = context$1$0.next) {
          case 0:
            context$1$0.prev = 0;
            context$1$0.next = 3;
            return this.beforeUpdate().then(function () {
              return _this2.saveModel(skipAfterUpdate);
            })['catch'](function (err) {
              return _this2._handleError(err);
            });

          case 3:
            context$1$0.next = 8;
            break;

          case 5:
            context$1$0.prev = 5;
            context$1$0.t0 = context$1$0['catch'](0);

            this._handleError(context$1$0.t0);

          case 8:
          case 'end':
            return context$1$0.stop();
        }
      }, callee$0$0, this, [[0, 5]]);
    })).enqueue(),

    /**
     * Add the specified value to the lookup list if it doesn't already exist in the list.
     * @param lookupList array the lookup list to add to.
     * @param value string the value to add.
     * @param listsToUpdate array the lookup lists that need to be saved.
     * @param listsName string name of the list to add the value to.
     */
    _addValueToLookupList: function _addValueToLookupList(lookupList, value, listsToUpdate, listName) {
      var lookupListValues = lookupList.get('value');
      if (!_ember['default'].isArray(lookupListValues)) {
        lookupListValues = [];
      }
      if (!lookupListValues.includes(value)) {
        lookupListValues.push(value);
        lookupListValues.sort();
        lookupList.set('value', lookupListValues);
        if (!listsToUpdate.includes(lookupList)) {
          listsToUpdate.push(lookupList);
        }
        this.set(listName, lookupList);
      }
    },

    _cancelUpdate: function _cancelUpdate() {
      var cancelledItem = get(this, 'model');
      cancelledItem.rollbackAttributes();
    },

    _handleError: function _handleError(err) {
      if (!err.ignore) {
        var i18n = get(this, 'i18n');
        var errorDetails = err;
        if (!errorDetails.message) {
          errorDetails.message = err.toString();
        }
        this.displayAlert(i18n.t('alerts.errorExclamation'), i18n.t('messages.saveActionException', errorDetails));
      }
    },

    actions: {
      cancel: function cancel() {
        this._cancelUpdate();
        this.send(get(this, 'cancelAction'));
      },

      returnTo: function returnTo() {
        this._cancelUpdate();
        var returnTo = get(this, 'model.returnTo');
        var returnToContext = get(this, 'model.returnToContext');
        if (isEmpty(returnToContext)) {
          this.transitionToRoute(returnTo);
        } else {
          this.transitionToRoute(returnTo, returnToContext);
        }
      },

      showDisabledDialog: function showDisabledDialog() {
        var i18n = get(this, 'i18n');
        this.displayAlert(i18n.t('alerts.warningExclamation'), i18n.t('messages.requiredFieldsCorrectErrors'));
      },

      /**
       * Update the model and perform the before update and after update
       * @param skipAfterUpdate boolean (optional) indicating whether or not
       * to skip the afterUpdate call.
       */
      update: function update(skipAfterUpdate) {
        return this.get('updateTask').perform(skipAfterUpdate);
      }
    },

    /**
     * Override this function to perform logic after record update
     * @param record the record that was just updated.
     */
    afterUpdate: function afterUpdate() {},

    /**
     * Override this function to perform logic before record update.
     * @returns {Promise} Promise that resolves after before update is done.
     */
    beforeUpdate: function beforeUpdate() {
      return _ember['default'].RSVP.Promise.resolve();
    },

    /**
     * Save the model and then (optionally) run the after update.
     * @param skipAfterUpdate boolean (optional) indicating whether or not
     * to skip the afterUpdate call.
     */
    saveModel: function saveModel(skipAfterUpdate) {
      var _this3 = this;

      return get(this, 'model').save().then(function (record) {
        _this3.updateLookupLists().then(function () {
          if (!skipAfterUpdate) {
            _this3.afterUpdate(record);
          }
        });
      })['catch'](function (error) {
        _this3.send('error', error);
      });
    },

    /**
     * Update any new values added to a lookup list
     */
    updateLookupLists: function updateLookupLists() {
      var _this4 = this;

      var lookupListsToUpdate = get(this, 'lookupListsToUpdate');
      var listsToUpdate = _ember['default'].A();
      var lookupPromises = [];
      if (!isEmpty(lookupListsToUpdate)) {
        lookupListsToUpdate.forEach(function (list) {
          var propertyValue = get(_this4, get(list, 'property'));
          var lookupListToUpdate = get(_this4, get(list, 'name'));
          if (!isEmpty(propertyValue)) {
            if (!isEmpty(lookupListToUpdate) && lookupListToUpdate.then) {
              lookupPromises.push(lookupListToUpdate.then(function (lookupList) {
                return _this4._checkListForUpdate(list, lookupList, listsToUpdate, propertyValue);
              }));
            } else {
              _this4._checkListForUpdate(list, lookupListToUpdate, listsToUpdate, propertyValue);
            }
          }
        });
        if (!isEmpty(lookupPromises)) {
          return RSVP.all(lookupPromises).then(function () {
            var lookupLists = get(_this4, 'lookupLists');
            var updatePromises = [];
            listsToUpdate.forEach(function (list) {
              updatePromises.push(list.save().then(function () {
                set(_this4, 'lookupListsLastUpdate', new Date().getTime());
                lookupLists.resetLookupList(get(list, 'id'));
              }));
            });
            return RSVP.all(updatePromises);
          });
        }
      }
      return RSVP.resolve();
    },

    _checkListForUpdate: function _checkListForUpdate(listInfo, lookupList, listsToUpdate, propertyValue) {
      var store = get(this, 'store');
      if (!lookupList) {
        lookupList = store.push(store.normalize('lookup', {
          id: listInfo.id,
          value: [],
          userCanAdd: true
        }));
      }
      if (_ember['default'].isArray(propertyValue)) {
        propertyValue.forEach((function (value) {
          this._addValueToLookupList(lookupList, value, listsToUpdate, listInfo.name);
        }).bind(this));
      } else {
        this._addValueToLookupList(lookupList, propertyValue, listsToUpdate, listInfo.name);
      }
      return lookupList;
    }

  });
});
define('hospitalrun/controllers/abstract-paged-controller', ['exports', 'ember', 'hospitalrun/mixins/pagination-props', 'hospitalrun/mixins/progress-dialog', 'hospitalrun/mixins/user-session'], function (exports, _ember, _hospitalrunMixinsPaginationProps, _hospitalrunMixinsProgressDialog, _hospitalrunMixinsUserSession) {
  exports['default'] = _ember['default'].Controller.extend(_hospitalrunMixinsPaginationProps['default'], _hospitalrunMixinsProgressDialog['default'], _hospitalrunMixinsUserSession['default'], {
    addPermission: null,
    deletePermission: null,
    nextStartKey: null,
    previousStartKey: null,
    previousStartKeys: [],
    progressMessage: 'Loading Records.  Please wait...',
    progressTitle: 'Loading',
    queryParams: ['startKey', 'sortKey', 'sortDesc'],
    sortDesc: false,
    sortKey: null,

    canAdd: (function () {
      return this.currentUserCan(this.get('addPermission'));
    }).property(),

    canDelete: (function () {
      return this.currentUserCan(this.get('deletePermission'));
    }).property(),

    canEdit: (function () {
      // Default to using add permission
      return this.currentUserCan(this.get('addPermission'));
    }).property(),

    showActions: (function () {
      return this.get('canAdd') || this.get('canEdit') || this.get('canDelete');
    }).property('canAdd', 'canEdit', 'canDelete'),

    disablePreviousPage: (function () {
      return _ember['default'].isEmpty(this.get('previousStartKey'));
    }).property('previousStartKey'),

    disableNextPage: (function () {
      return _ember['default'].isEmpty(this.get('nextStartKey'));
    }).property('nextStartKey'),

    showPagination: (function () {
      return !_ember['default'].isEmpty(this.get('previousStartKey')) || !_ember['default'].isEmpty(this.get('nextStartKey'));
    }).property('nextStartKey', 'previousStartKey'),

    hasRecords: _ember['default'].computed('model.length', {
      get: function get() {
        var model = this.get('model');
        if (!_ember['default'].isEmpty(model)) {
          return model.get('length') > 0;
        } else {
          return false;
        }
      }
    }),

    actions: {
      nextPage: function nextPage() {
        var key = this.get('nextStartKey');
        var previousStartKeys = this.get('previousStartKeys');
        var firstKey = this.get('firstKey');
        this.set('previousStartKey', firstKey);
        previousStartKeys.push(firstKey);
        this.set('startKey', key);
        this.showProgressModal();
      },
      previousPage: function previousPage() {
        var key = this.get('previousStartKey');
        var previousStartKeys = this.get('previousStartKeys');
        previousStartKeys.pop();
        this.set('startKey', key);
        this.set('previousStartKey', previousStartKeys.pop());
        this.set('previousStartKeys', previousStartKeys);
        this.showProgressModal();
      },
      sortByKey: function sortByKey(sortKey, sortDesc) {
        this.setProperties({
          previousStartKey: null,
          previousStartKeys: [],
          nextStartKey: null,
          sortDesc: sortDesc,
          sortKey: sortKey,
          startKey: null,
          firstKey: null
        });
        this.showProgressModal();
      }
    }
  });
});
define('hospitalrun/controllers/abstract-report-controller', ['exports', 'ember', 'hospitalrun/mixins/date-format', 'hospitalrun/mixins/modal-helper', 'moment', 'hospitalrun/mixins/number-format', 'hospitalrun/mixins/pagination-props', 'hospitalrun/mixins/pouchdb', 'hospitalrun/mixins/progress-dialog'], function (exports, _ember, _hospitalrunMixinsDateFormat, _hospitalrunMixinsModalHelper, _moment, _hospitalrunMixinsNumberFormat, _hospitalrunMixinsPaginationProps, _hospitalrunMixinsPouchdb, _hospitalrunMixinsProgressDialog) {
  exports['default'] = _ember['default'].Controller.extend(_hospitalrunMixinsDateFormat['default'], _hospitalrunMixinsModalHelper['default'], _hospitalrunMixinsNumberFormat['default'], _hospitalrunMixinsPaginationProps['default'], _hospitalrunMixinsPouchdb['default'], _hospitalrunMixinsProgressDialog['default'], {
    defaultErrorMessage: 'An error was encountered while generating the requested report.  Please let your system administrator know that you have encountered an error.',
    offset: 0,
    limit: 25,
    progressMessage: 'Please wait while your report is generated.',
    progressTitle: 'Generating Report',
    reportColumns: null,
    reportHeaders: null,
    reportRows: [],
    reportTitle: null,
    reportType: null,
    reportTypes: null,
    showFirstPageButton: true,
    showLastPageButton: true,
    showReportResults: false,

    /**
     * Add a row to the report using the selected columns to add the row.
     * @param {Array} row the row to add
     * @param {boolean} skipFormatting true if formatting should be skipped.
     * @param reportColumns {Object} the columns to display on the report;
     * optional, if not set, the property reportColumns on the controller
     * will be used.
     * @param reportAction {Object} action to fire on row when row is clicked.
     */
    _addReportRow: function _addReportRow(row, skipFormatting, reportColumns, rowAction) {
      var columnValue = undefined;
      var reportRows = this.get('reportRows');
      var reportRow = [];
      if (_ember['default'].isEmpty(reportColumns)) {
        reportColumns = this.get('reportColumns');
      }
      for (var column in reportColumns) {
        if (reportColumns[column].include) {
          columnValue = _ember['default'].get(row, reportColumns[column].property);
          if (_ember['default'].isEmpty(columnValue)) {
            reportRow.push('');
          } else if (reportColumns[column].format === '_numberFormat') {
            if (skipFormatting) {
              reportRow.push(columnValue);
            } else {
              reportRow.push(this._numberFormat(columnValue));
            }
          } else if (!skipFormatting && reportColumns[column].format) {
            reportRow.push(this[reportColumns[column].format](columnValue));
          } else {
            reportRow.push(columnValue);
          }
        }
      }
      if (rowAction) {
        reportRows.addObject({
          rowAction: rowAction,
          row: reportRow
        });
      } else {
        reportRows.addObject(reportRow);
      }
    },

    /**
     * Finish up the report by setting headers, titles and export.
     * @param reportColumns {Object} the columns to display on the report;
     * optional, if not set, the property reportColumns on the controller
     * will be used.
     */
    _finishReport: function _finishReport(reportColumns) {
      this.set('showReportResults', true);
      this.set('offset', 0);
      this._setReportHeaders(reportColumns);
      this._setReportTitle();
      this._generateExport();
      this.closeProgressModal();
    },

    _generateExport: function _generateExport() {
      var csvRows = [];
      var reportHeaders = this.get('reportHeaders');
      var dataArray = [reportHeaders];
      dataArray.addObjects(this.get('reportRows'));
      dataArray.forEach(function (reportRow) {
        var rowToAdd = undefined;
        if (reportRow.row) {
          rowToAdd = reportRow.row;
        } else {
          rowToAdd = reportRow;
        }
        rowToAdd = rowToAdd.map(function (column) {
          if (!column) {
            return '';
          } else if (column.replace) {
            return column.replace('"', '""');
          } else {
            return column;
          }
        });
        csvRows.push('"' + rowToAdd.join('","') + '"');
      });
      var csvString = csvRows.join('\r\n');
      var uriContent = 'data:application/csv;charset=utf-8,' + encodeURIComponent(csvString);
      this.set('csvExport', uriContent);
    },

    _notifyReportError: function _notifyReportError(errorMessage) {
      var i18n = this.get('i18n');
      this.closeProgressModal();
      this.displayAlert(i18n.t('alerts.reportError'), i18n.t('messages.reportError'));
      throw new Error(errorMessage);
    },

    _setReportHeaders: function _setReportHeaders(reportColumns) {
      var reportHeaders = [];
      if (_ember['default'].isEmpty(reportColumns)) {
        reportColumns = this.get('reportColumns');
      }
      for (var column in reportColumns) {
        if (reportColumns[column].include) {
          reportHeaders.push(reportColumns[column].label);
        }
      }
      this.set('reportHeaders', reportHeaders);
    },

    _setReportTitle: function _setReportTitle() {
      var endDate = this.get('endDate');
      var formattedEndDate = '';
      var formattedStartDate = '';
      var reportType = this.get('reportType');
      var reportTypes = this.get('reportTypes');
      var startDate = this.get('startDate');
      if (!_ember['default'].isEmpty(endDate)) {
        formattedEndDate = (0, _moment['default'])(endDate).format('l');
      }

      var reportDesc = reportTypes.findBy('value', reportType);
      if (_ember['default'].isEmpty(startDate)) {
        this.set('reportTitle', this.get('i18n').t('inventory.reports.titleSingleDate', {
          name: reportDesc.name,
          date: formattedEndDate
        }));
      } else {
        formattedStartDate = (0, _moment['default'])(startDate).format('l');
        this.set('reportTitle', this.get('i18n').t('inventory.reports.titleDateRange', {
          name: reportDesc.name,
          startDate: formattedStartDate,
          endDate: formattedEndDate
        }));
      }
    },

    actions: {
      firstPage: function firstPage() {
        this.set('offset', 0);
      },

      nextPage: function nextPage() {
        var limit = this.get('limit');
        this.incrementProperty('offset', limit);
      },

      previousPage: function previousPage() {
        var limit = this.get('limit');
        this.decrementProperty('offset', limit);
      },

      lastPage: function lastPage() {
        var reportRowLength = this.get('reportRows.length');
        var limit = this.get('limit');
        var pages = parseInt(reportRowLength / limit);
        this.set('offset', pages * limit);
      }

    },

    currentReportRows: (function () {
      var limit = this.get('limit');
      var offset = this.get('offset');
      var reportRows = this.get('reportRows');
      return reportRows.slice(offset, offset + limit);
    }).property('reportRows.[]', 'offset', 'limit'),

    disablePreviousPage: (function () {
      return this.get('offset') === 0;
    }).property('offset'),

    disableNextPage: (function () {
      var limit = this.get('limit');
      var length = this.get('reportRows.length');
      var offset = this.get('offset');
      return offset + limit >= length;
    }).property('offset', 'limit', 'reportRows.length'),

    showPagination: (function () {
      var length = this.get('reportRows.length');
      var limit = this.get('limit');
      return length > limit;
    }).property('reportRows.length')

  });
});
define('hospitalrun/controllers/application', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Controller.extend({
    filesystem: _ember['default'].inject.service(),
    session: _ember['default'].inject.service(),
    _setup: (function () {
      var fileSystem = this.get('filesystem');
      fileSystem.setup();
    }).on('init')
  });
});
define('hospitalrun/controllers/index', ['exports', 'ember', 'hospitalrun/mixins/user-session'], function (exports, _ember, _hospitalrunMixinsUserSession) {
  var alias = _ember['default'].computed.alias;
  var inject = _ember['default'].inject;
  var get = _ember['default'].get;
  var set = _ember['default'].set;
  exports['default'] = _ember['default'].Controller.extend(_hospitalrunMixinsUserSession['default'], {
    config: inject.service(),
    database: inject.service(),
    standAlone: alias('config.standAlone'),
    needsUserSetup: alias('config.needsUserSetup'),
    // on init, look up the list of users and determine if there's a need for a needsUserSetup msg
    init: function init() {
      var _this = this;

      if (get(this, 'standAlone')) {
        get(this, 'database.usersDB').allDocs().then(function (results) {
          if (results.total_rows <= 1) {
            set(_this, 'config.needsUserSetup', true);
          }
        });
      }
    },
    actions: {
      newUser: function newUser() {
        this.send('createNewUser');
      }
    }
  });
});
define('hospitalrun/controllers/login', ['exports', 'ember', 'ember-ajax/errors'], function (exports, _ember, _emberAjaxErrors) {

  var LoginController = _ember['default'].Controller.extend({
    session: _ember['default'].inject.service(),
    errorMessage: null,
    identification: null,
    password: null,

    actions: {
      authenticate: function authenticate() {
        var _this = this;

        var _getProperties = this.getProperties('identification', 'password');

        var identification = _getProperties.identification;
        var password = _getProperties.password;

        this.get('session').authenticate('authenticator:custom', {
          identification: identification,
          password: password
        })['catch'](function (err) {
          if ((0, _emberAjaxErrors.isAbortError)(err) || (0, _emberAjaxErrors.isTimeoutError)(err)) {
            _this.set('errorMessage', false);
            _this.set('offlineError', true);
          } else {
            _this.set('errorMessage', true);
            _this.set('offlineError', false);
          }
        });
      }
    }
  });

  exports['default'] = LoginController;
});
define('hospitalrun/controllers/navigation', ['exports', 'ember', 'hospitalrun/mixins/hospitalrun-version', 'hospitalrun/mixins/modal-helper', 'hospitalrun/mixins/progress-dialog', 'hospitalrun/mixins/user-session', 'hospitalrun/mixins/navigation'], function (exports, _ember, _hospitalrunMixinsHospitalrunVersion, _hospitalrunMixinsModalHelper, _hospitalrunMixinsProgressDialog, _hospitalrunMixinsUserSession, _hospitalrunMixinsNavigation) {
  exports['default'] = _ember['default'].Controller.extend(_hospitalrunMixinsHospitalrunVersion['default'], _hospitalrunMixinsModalHelper['default'], _hospitalrunMixinsProgressDialog['default'], _hospitalrunMixinsUserSession['default'], _hospitalrunMixinsNavigation['default'], {
    ajax: _ember['default'].inject.service(),
    application: _ember['default'].inject.controller(),
    allowSearch: false,
    config: _ember['default'].inject.service(),
    currentSearchText: null,
    currentRouteName: _ember['default'].computed.alias('application.currentRouteName'),
    progressTitle: 'Searching',
    searchRoute: null,
    session: _ember['default'].inject.service(),
    syncStatus: '',
    currentOpenNav: null,

    actions: {
      about: function about() {
        var _this = this;

        var version = this.get('version');
        this.get('ajax').request('/serverinfo').then(function (siteInfo) {
          var message = 'Version: ' + version;
          if (!_ember['default'].isEmpty(siteInfo)) {
            message += ' Site Info: ' + siteInfo;
          }
          _this.displayAlert(_this.get('i18n').t('navigation.about'), message);
        });
      },

      invalidateSession: function invalidateSession() {
        var _this2 = this;

        var session = this.get('session');
        if (session.get('isAuthenticated')) {
          session.invalidate()['catch'](function () {
            var i18n = _this2.get('i18n');
            var message = i18n.t('navigation.messages.logoutFailed');
            var title = i18n.t('navigation.titles.logoutFailed');
            _this2.displayAlert(title, message);
          });
        }
      },

      search: function search() {
        if (this.allowSearch && this.searchRoute) {
          var currentRouteName = this.get('currentRouteName');
          var currentSearchText = this.get('currentSearchText');
          var textToFind = this.get('searchText');
          if (currentSearchText !== textToFind || currentRouteName.indexOf('.search') === -1) {
            this.set('searchText', '');
            this.set('progressMessage', 'Searching for ' + textToFind + '. Please wait...');
            this.showProgressModal();
            this.transitionToRoute(this.searchRoute + '/' + textToFind);
          }
        }
      },

      navAction: function navAction(nav) {
        if (this.currentOpenNav && this.currentOpenNav.route !== nav.route) {
          this.currentOpenNav.closeSubnav();
        }
        this.set('currentOpenNav', nav);
        this.transitionToRoute(nav.route);
        this.set('isShowingSettings', false);
      },

      toggleSettings: function toggleSettings() {
        this.toggleProperty('isShowingSettings');
      },

      closeSettings: function closeSettings() {
        this.set('isShowingSettings', false);
      }

    }
  });
});
define('hospitalrun/custom-form-add/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember'], function (exports, _hospitalrunControllersAbstractEditController, _ember) {
  var computed = _ember['default'].computed;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend({
    updateAction: 'addForm',

    actions: {
      addForm: function addForm() {
        var modelToAddTo = this.get('model.modelToAddTo');
        var modelCustomForms = modelToAddTo.get('customForms');
        var selectedForm = this.get('model.selectedForm');
        if (isEmpty(modelCustomForms)) {
          modelCustomForms = _ember['default'].Object.create();
          modelToAddTo.set('customForms', modelCustomForms);
        }
        modelCustomForms.set(selectedForm, _ember['default'].Object.create());
        modelToAddTo.notifyPropertyChange('customForms');
        this.send('closeModal');
      }
    },

    isUpdateDisabled: computed('model.selectedForm', function () {
      return isEmpty(this.get('model.selectedForm'));
    })

  });
});
define("hospitalrun/custom-form-add/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "1q7fCvJu", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"cancelAction\",\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[\"closeModal\",[\"get\",[\"isUpdateDisabled\"]],[\"helper\",[\"t\"],[\"customForms.titles.addCustomForm\"],null],\"addForm\",[\"helper\",[\"t\"],[\"customForms.buttons.addForm\"],null]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"label\",\"property\",\"content\",\"prompt\",\"class\"],[[\"helper\",[\"t\"],[\"customForms.labels.formToAdd\"],null],\"selectedForm\",[\"get\",[\"model\",\"customForms\"]],\" \",\"form-to-add\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/custom-form-add/template.hbs" } });
});
define('hospitalrun/diagnosis/edit/controller', ['exports', 'ember', 'hospitalrun/controllers/abstract-edit-controller'], function (exports, _ember, _hospitalrunControllersAbstractEditController) {
  var computed = _ember['default'].computed;
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend({
    updateCapability: 'add_diagnosis',
    editController: _ember['default'].computed.alias('model.editController'),
    diagnosisList: _ember['default'].computed.alias('editController.diagnosisList'),
    newDiagnosis: false,

    lookupListsToUpdate: [{
      name: 'diagnosisList',
      property: 'model.diagnosis',
      id: 'diagnosis_list'
    }],

    additionalButtons: computed('model.isNew', function () {
      var i8n = this.get('i18n');
      var isNew = this.get('model.isNew');
      if (!isNew) {
        return [{
          'class': 'btn btn-default warning',
          buttonAction: 'deleteDiagnosis',
          buttonIcon: 'octicon octicon-x',
          buttonText: i8n.t('buttons.delete')
        }];
      }
    }),

    canDeleteDiagnosis: computed(function () {
      return this.currentUserCan('delete_diagnosis');
    }),

    title: computed('model.isNew', function () {
      var i8n = this.get('i18n');
      var isNew = this.get('model.isNew');
      if (isNew) {
        return i8n.t('diagnosis.titles.addDiagnosis');
      } else {
        return i8n.t('diagnosis.titles.editDiagnosis');
      }
    }),

    afterUpdate: function afterUpdate(diagnosis) {
      var newDiagnosis = this.get('newDiagnosis');
      if (newDiagnosis) {
        this.get('editController').send('addDiagnosis', diagnosis);
      } else {
        this.send('closeModal');
      }
    },

    beforeUpdate: function beforeUpdate() {
      var diagnosis = this.get('model');
      this.set('newDiagnosis', diagnosis.get('isNew'));
      return _ember['default'].RSVP.Promise.resolve();
    },

    actions: {
      cancel: function cancel() {
        this.send('closeModal');
      },

      deleteDiagnosis: function deleteDiagnosis() {
        var diagnosis = this.get('model');
        this.get('editController').send('deleteDiagnosis', diagnosis);
      }
    }
  });
});
define("hospitalrun/diagnosis/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "i1WyGKMG", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"additionalButtons\",\"hideCancelButton\",\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"additionalButtons\"]],[\"get\",[\"hideCancelButton\"]],[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],4]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"diagnosis.labels.activeDiagnosis\"],null],\"active\",\"col-sm-4\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"diagnosis.labels.diagnosis\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"diagnosis\"]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"hint\",\"class\"],[\"diagnosis\",[\"helper\",[\"t\"],[\"diagnosis.labels.diagnosis\"],null],[\"get\",[\"diagnosisList\"]],false,\"diagnosis-text required\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"model\",\"isNew\"]]],null,2,1],[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"date\",[\"helper\",[\"t\"],[\"diagnosis.labels.date\"],null],\"col-sm-4 required\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"diagnosis.labels.secondaryDiagnosis\"],null],\"secondaryDiagnosis\",\"col-sm-4 secondary-diagnosis\"]]],false],[\"text\",\"\\n\"],[\"block\",[\"unless\"],[[\"get\",[\"model\",\"isNew\"]]],null,0],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],3]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/diagnosis/edit/template.hbs" } });
});
define('hospitalrun/dialog/controller', ['exports', 'ember'], function (exports, _ember) {
  var computed = _ember['default'].computed;
  var get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _ember['default'].Controller.extend({
    showUpdateButton: true,
    isUpdateDisabled: false,

    cancelAction: computed('model.cancelAction', function () {
      var cancelAction = get(this, 'model.cancelAction');
      if (isEmpty(cancelAction)) {
        cancelAction = 'cancel';
      }
      return cancelAction;
    }),

    actions: {
      cancel: function cancel() {
        this.send('closeModal');
      },

      confirm: function confirm() {
        var closeModalOnConfirm = this.getWithDefault('model.closeModalOnConfirm', true);
        var confirmAction = this.getWithDefault('model.confirmAction', 'model.confirm');
        this.send(confirmAction, get(this, 'model'));
        if (closeModalOnConfirm) {
          this.send('closeModal');
        }
      },

      ok: function ok() {
        var okAction = get(this, 'model.okAction');
        var okContext = get(this, 'model.okContext');
        if (isEmpty(okContext)) {
          okContext = get(this, 'model');
        }
        if (!isEmpty(okAction)) {
          this.send(okAction, okContext);
        }
        this.send('closeModal');
      }
    }
  });
});
define("hospitalrun/dialog/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "CVjH3ZEN", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"cancelAction\",\"hideCancelButton\",\"hideUpdateButton\",\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\",\"cancelButtonText\"],[[\"get\",[\"cancelAction\"]],[\"get\",[\"model\",\"hideCancelButton\"]],[\"get\",[\"model\",\"hideUpdateButton\"]],[\"get\",[\"model\",\"isUpdateDisabled\"]],[\"get\",[\"model\",\"title\"]],[\"get\",[\"model\",\"updateButtonAction\"]],[\"get\",[\"model\",\"updateButtonText\"]],[\"get\",[\"model\",\"cancelButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"progress\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"progress-bar progress-bar-striped active\"],[\"static-attr\",\"role\",\"progressbar\"],[\"dynamic-attr\",\"aria-valuenow\",[\"unknown\",[\"model\",\"progressBarValue\"]],null],[\"static-attr\",\"aria-valuemin\",\"0\"],[\"static-attr\",\"aria-valuemax\",\"100\"],[\"dynamic-attr\",\"style\",[\"unknown\",[\"model\",\"progressBarStyle\"]],null],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"sr-only\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"loading.progressBar.progress\"],[[\"progressBarValue\"],[[\"get\",[\"model\",\"progressBarValue\"]]]]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"model\",\"showProgress\"]]],null,0],[\"text\",\"  \"],[\"append\",[\"unknown\",[\"model\",\"message\"]],false],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/dialog/template.hbs" } });
});
define('hospitalrun/electron/reload', ['exports'], function (exports) {
  function setupLivereload() {
    var process = window ? window.process : null;

    // Exit immediately if we're not running in Electron
    if (!window.ELECTRON || process && process.env && process.env.DO_NOT_SETUP_LIVERELOAD) {
      return;
    }

    // Reload the page when anything in `dist` changes
    var fs = undefined;
    var path = undefined;
    var devtron = undefined;

    try {
      fs = window.requireNode('fs');
      path = window.requireNode('path');
    } catch (e) {
      console.warn('ember-electron tried to require fs and path to enable live-reload features, but failed.');
      console.warn('Automatic reloading is therefore disabled.');
      console.warn(e);

      return;
    }

    /**
     * @private
     * Watch a given directory for changes and reload
     * on change
     *
     * @param sub directory
     */
    function watch() {
      var _path;

      for (var _len = arguments.length, sub = Array(_len), _key = 0; _key < _len; _key++) {
        sub[_key] = arguments[_key];
      }

      var dirname = (_path = path).join.apply(_path, [__dirname].concat(sub));

      fs.watch(dirname, { recursive: true }, function () {
        return window.location.reload();
      });
    }

    /**
     * @private
     * Install Devtron in the current window.
     */
    function installDevtron() {
      try {
        devtron = window.requireNode('devtron');

        if (devtron) {
          devtron.install();
        }
      } catch (e) {
        // no-op
      }
    }

    /**
     * @private
     * Install Ember-Inspector in the current window.
     */
    function installEmberInspector() {
      var location = undefined;

      try {
        var eiLocation = window.requireNode.resolve('ember-inspector');
        location = path.join(eiLocation, 'dist', 'chrome');
      } catch (error) {
        location = path.join(__dirname, '..', 'node_modules', 'ember-inspector', 'dist', 'chrome');
      }

      fs.lstat(location, function (err, results) {
        if (err) {
          console.warn('Error loading Ember Inspector', err);

          return;
        }

        if (results && results.isDirectory && results.isDirectory()) {
          var BrowserWindow = window.requireNode('electron').remote.BrowserWindow;

          var added = BrowserWindow.getDevToolsExtensions && BrowserWindow.getDevToolsExtensions().hasOwnProperty('Ember Inspector');

          try {
            if (!added) {
              BrowserWindow.addDevToolsExtension(location);
            }
          } catch (err) {
            // no-op
          }
        }
      });
    }

    document.addEventListener('DOMContentLoaded', function () /* e */{
      var dirname = __dirname || (process && (process || {}).cwd ? process.cwd() : null);

      if (!dirname) {
        return;
      }

      fs.stat(dirname, function (err /* , stat */) {
        if (!err) {
          watch();

          // On linux, the recursive `watch` command is not fully supported:
          // https://nodejs.org/docs/latest/api/fs.html#fs_fs_watch_filename_options_listener
          //
          // However, the recursive option WILL watch direct children of the
          // given directory.  So, this hack just manually sets up watches on
          // the expected subdirs -- that is, `assets` and `tests`.
          if (process && process.platform === 'linux') {
            watch('assets');
            watch('tests');
          }
        }
      });

      installDevtron();
      installEmberInspector();
    });
  }

  setupLivereload();
});
define('hospitalrun/finishgauth/route', ['exports', 'ember', 'hospitalrun/mixins/map-oauth-params', 'hospitalrun/mixins/setup-user-role'], function (exports, _ember, _hospitalrunMixinsMapOauthParams, _hospitalrunMixinsSetupUserRole) {
  exports['default'] = _ember['default'].Route.extend(_hospitalrunMixinsMapOauthParams['default'], _hospitalrunMixinsSetupUserRole['default'], {
    config: _ember['default'].inject.service(),
    database: _ember['default'].inject.service(),
    session: _ember['default'].inject.service(),
    model: function model(params) {
      if (params.k && params.s1 && params.s2 && params.t) {
        this.get('session').authenticate('authenticator:custom', {
          google_auth: true,
          params: params
        });
      }
    }
  });
});
define('hospitalrun/helpers/and', ['exports', 'ember', 'ember-truth-helpers/helpers/and'], function (exports, _ember, _emberTruthHelpersHelpersAnd) {

  var forExport = null;

  if (_ember['default'].Helper) {
    forExport = _ember['default'].Helper.helper(_emberTruthHelpersHelpersAnd.andHelper);
  } else if (_ember['default'].HTMLBars.makeBoundHelper) {
    forExport = _ember['default'].HTMLBars.makeBoundHelper(_emberTruthHelpersHelpersAnd.andHelper);
  }

  exports['default'] = forExport;
});
define('hospitalrun/helpers/app-version', ['exports', 'ember', 'hospitalrun/config/environment', 'ember-cli-app-version/utils/regexp'], function (exports, _ember, _hospitalrunConfigEnvironment, _emberCliAppVersionUtilsRegexp) {
  exports.appVersion = appVersion;
  var version = _hospitalrunConfigEnvironment['default'].APP.version;

  function appVersion(_) {
    var hash = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

    if (hash.hideSha) {
      return version.match(_emberCliAppVersionUtilsRegexp.versionRegExp)[0];
    }

    if (hash.hideVersion) {
      return version.match(_emberCliAppVersionUtilsRegexp.shaRegExp)[0];
    }

    return version;
  }

  exports['default'] = _ember['default'].Helper.helper(appVersion);
});
define('hospitalrun/helpers/cancel-all', ['exports', 'ember', 'ember-concurrency/-helpers'], function (exports, _ember, _emberConcurrencyHelpers) {
  exports.cancelHelper = cancelHelper;

  var CANCEL_REASON = "the 'cancel-all' template helper was invoked";

  function cancelHelper(args) {
    var cancelable = args[0];
    if (!cancelable || typeof cancelable.cancelAll !== 'function') {
      _ember['default'].assert('The first argument passed to the `cancel-all` helper should be a Task or TaskGroup (without quotes); you passed ' + cancelable, false);
    }

    return (0, _emberConcurrencyHelpers.taskHelperClosure)('cancelAll', [cancelable, CANCEL_REASON]);
  }

  exports['default'] = _ember['default'].Helper.helper(cancelHelper);
});
define('hospitalrun/helpers/date-format', ['exports', 'ember', 'moment'], function (exports, _ember, _moment) {
  var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();

  exports['default'] = _ember['default'].Helper.helper(function (params, hash) {
    if (!_ember['default'].isEmpty(params[0])) {
      var dateFormat = 'l';

      var _params = _slicedToArray(params, 1);

      var date = _params[0];

      if (hash && hash.format) {
        dateFormat = hash.format;
      }
      if (date && typeof date.get == 'function') {
        date = date.get('content');
      }
      return (0, _moment['default'])(date).format(dateFormat);
    }
  });
});
define('hospitalrun/helpers/eq', ['exports', 'ember', 'ember-truth-helpers/helpers/equal'], function (exports, _ember, _emberTruthHelpersHelpersEqual) {

  var forExport = null;

  if (_ember['default'].Helper) {
    forExport = _ember['default'].Helper.helper(_emberTruthHelpersHelpersEqual.equalHelper);
  } else if (_ember['default'].HTMLBars.makeBoundHelper) {
    forExport = _ember['default'].HTMLBars.makeBoundHelper(_emberTruthHelpersHelpersEqual.equalHelper);
  }

  exports['default'] = forExport;
});
define('hospitalrun/helpers/gt', ['exports', 'ember', 'ember-truth-helpers/helpers/gt'], function (exports, _ember, _emberTruthHelpersHelpersGt) {

  var forExport = null;

  if (_ember['default'].Helper) {
    forExport = _ember['default'].Helper.helper(_emberTruthHelpersHelpersGt.gtHelper);
  } else if (_ember['default'].HTMLBars.makeBoundHelper) {
    forExport = _ember['default'].HTMLBars.makeBoundHelper(_emberTruthHelpersHelpersGt.gtHelper);
  }

  exports['default'] = forExport;
});
define('hospitalrun/helpers/gte', ['exports', 'ember', 'ember-truth-helpers/helpers/gte'], function (exports, _ember, _emberTruthHelpersHelpersGte) {

  var forExport = null;

  if (_ember['default'].Helper) {
    forExport = _ember['default'].Helper.helper(_emberTruthHelpersHelpersGte.gteHelper);
  } else if (_ember['default'].HTMLBars.makeBoundHelper) {
    forExport = _ember['default'].HTMLBars.makeBoundHelper(_emberTruthHelpersHelpersGte.gteHelper);
  }

  exports['default'] = forExport;
});
define('hospitalrun/helpers/html-line-break', ['exports', 'ember'], function (exports, _ember) {
  var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();

  exports['default'] = _ember['default'].Helper.helper(function (_ref) {
    var _ref2 = _slicedToArray(_ref, 1);

    var text = _ref2[0];

    if (text !== null && typeof text !== 'undefined') {
      return _ember['default'].String.htmlSafe(text.replace(/\n/g, '<br>'));
    } else {
      return null;
    }
  });
});
define('hospitalrun/helpers/is-array', ['exports', 'ember', 'ember-truth-helpers/helpers/is-array'], function (exports, _ember, _emberTruthHelpersHelpersIsArray) {

  var forExport = null;

  if (_ember['default'].Helper) {
    forExport = _ember['default'].Helper.helper(_emberTruthHelpersHelpersIsArray.isArrayHelper);
  } else if (_ember['default'].HTMLBars.makeBoundHelper) {
    forExport = _ember['default'].HTMLBars.makeBoundHelper(_emberTruthHelpersHelpersIsArray.isArrayHelper);
  }

  exports['default'] = forExport;
});
define('hospitalrun/helpers/is-equal-array', ['exports', 'ember'], function (exports, _ember) {
  var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();

  exports['default'] = _ember['default'].Helper.helper(function (_ref) {
    var _ref2 = _slicedToArray(_ref, 2);

    var lhs = _ref2[0];
    var rhs = _ref2[1];

    if (!_ember['default'].isArray(lhs) || !_ember['default'].isArray(rhs) || lhs.get('length') !== rhs.get('length')) {
      return false;
    }
    return lhs.every(function (item) {
      return rhs.includes(item);
    });
  });
});
define('hospitalrun/helpers/is-equal-by-path', ['exports', 'ember'], function (exports, _ember) {
  var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();

  exports['default'] = _ember['default'].Helper.helper(function (_ref) {
    var _ref2 = _slicedToArray(_ref, 3);

    var leftSide = _ref2[0];
    var rightSide = _ref2[1];
    var path = _ref2[2];

    if (path) {
      return _ember['default'].get(leftSide, path) === rightSide;
    } else {
      return leftSide === rightSide;
    }
  });
});
define('hospitalrun/helpers/is-equal', ['exports', 'ember'], function (exports, _ember) {
  var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();

  exports['default'] = _ember['default'].Helper.helper(function (_ref) {
    var _ref2 = _slicedToArray(_ref, 2);

    var lhs = _ref2[0];
    var rhs = _ref2[1];

    return lhs === rhs;
  });
});
define('hospitalrun/helpers/is-not', ['exports', 'ember'], function (exports, _ember) {
  var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();

  exports['default'] = _ember['default'].Helper.helper(function (_ref) {
    var _ref2 = _slicedToArray(_ref, 1);

    var value = _ref2[0];

    return !value;
  });
});
define('hospitalrun/helpers/lt', ['exports', 'ember', 'ember-truth-helpers/helpers/lt'], function (exports, _ember, _emberTruthHelpersHelpersLt) {

  var forExport = null;

  if (_ember['default'].Helper) {
    forExport = _ember['default'].Helper.helper(_emberTruthHelpersHelpersLt.ltHelper);
  } else if (_ember['default'].HTMLBars.makeBoundHelper) {
    forExport = _ember['default'].HTMLBars.makeBoundHelper(_emberTruthHelpersHelpersLt.ltHelper);
  }

  exports['default'] = forExport;
});
define('hospitalrun/helpers/lte', ['exports', 'ember', 'ember-truth-helpers/helpers/lte'], function (exports, _ember, _emberTruthHelpersHelpersLte) {

  var forExport = null;

  if (_ember['default'].Helper) {
    forExport = _ember['default'].Helper.helper(_emberTruthHelpersHelpersLte.lteHelper);
  } else if (_ember['default'].HTMLBars.makeBoundHelper) {
    forExport = _ember['default'].HTMLBars.makeBoundHelper(_emberTruthHelpersHelpersLte.lteHelper);
  }

  exports['default'] = forExport;
});
define('hospitalrun/helpers/not-eq', ['exports', 'ember', 'ember-truth-helpers/helpers/not-equal'], function (exports, _ember, _emberTruthHelpersHelpersNotEqual) {

  var forExport = null;

  if (_ember['default'].Helper) {
    forExport = _ember['default'].Helper.helper(_emberTruthHelpersHelpersNotEqual.notEqualHelper);
  } else if (_ember['default'].HTMLBars.makeBoundHelper) {
    forExport = _ember['default'].HTMLBars.makeBoundHelper(_emberTruthHelpersHelpersNotEqual.notEqualHelper);
  }

  exports['default'] = forExport;
});
define('hospitalrun/helpers/not', ['exports', 'ember', 'ember-truth-helpers/helpers/not'], function (exports, _ember, _emberTruthHelpersHelpersNot) {

  var forExport = null;

  if (_ember['default'].Helper) {
    forExport = _ember['default'].Helper.helper(_emberTruthHelpersHelpersNot.notHelper);
  } else if (_ember['default'].HTMLBars.makeBoundHelper) {
    forExport = _ember['default'].HTMLBars.makeBoundHelper(_emberTruthHelpersHelpersNot.notHelper);
  }

  exports['default'] = forExport;
});
define('hospitalrun/helpers/number-format', ['exports', 'ember', 'hospitalrun/mixins/number-format'], function (exports, _ember, _hospitalrunMixinsNumberFormat) {
  var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();

  var NumberHandler = _ember['default'].Object.extend(_hospitalrunMixinsNumberFormat['default']);
  exports['default'] = _ember['default'].Helper.helper(function (_ref) {
    var _ref2 = _slicedToArray(_ref, 1);

    var number = _ref2[0];

    var numberHandler = new NumberHandler();
    return numberHandler._numberFormat(number);
  });
});
define('hospitalrun/helpers/or', ['exports', 'ember', 'ember-truth-helpers/helpers/or'], function (exports, _ember, _emberTruthHelpersHelpersOr) {

  var forExport = null;

  if (_ember['default'].Helper) {
    forExport = _ember['default'].Helper.helper(_emberTruthHelpersHelpersOr.orHelper);
  } else if (_ember['default'].HTMLBars.makeBoundHelper) {
    forExport = _ember['default'].HTMLBars.makeBoundHelper(_emberTruthHelpersHelpersOr.orHelper);
  }

  exports['default'] = forExport;
});
define('hospitalrun/helpers/perform', ['exports', 'ember', 'ember-concurrency/-helpers'], function (exports, _ember, _emberConcurrencyHelpers) {
  exports.performHelper = performHelper;

  function performHelper(args, hash) {
    return (0, _emberConcurrencyHelpers.taskHelperClosure)('perform', args, hash);
  }

  exports['default'] = _ember['default'].Helper.helper(performHelper);
});
define('hospitalrun/helpers/pluralize', ['exports', 'ember-inflector/lib/helpers/pluralize'], function (exports, _emberInflectorLibHelpersPluralize) {
  exports['default'] = _emberInflectorLibHelpersPluralize['default'];
});
define('hospitalrun/helpers/read-path', ['exports', 'ember'], function (exports, _ember) {
  var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();

  exports['default'] = _ember['default'].Helper.helper(function (_ref) {
    var _ref2 = _slicedToArray(_ref, 2);

    var object = _ref2[0];
    var path = _ref2[1];

    if (_ember['default'].isEmpty(path)) {
      return object;
    } else {
      return _ember['default'].get(object, path);
    }
  });
});
define('hospitalrun/helpers/singularize', ['exports', 'ember-inflector/lib/helpers/singularize'], function (exports, _emberInflectorLibHelpersSingularize) {
  exports['default'] = _emberInflectorLibHelpersSingularize['default'];
});
define('hospitalrun/helpers/t', ['exports', 'ember-i18n/helper'], function (exports, _emberI18nHelper) {
  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _emberI18nHelper['default'];
    }
  });
});
define('hospitalrun/helpers/task', ['exports', 'ember'], function (exports, _ember) {
  function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }

  function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); }

  function taskHelper(_ref) {
    var _ref2 = _toArray(_ref);

    var task = _ref2[0];

    var args = _ref2.slice(1);

    return task._curry.apply(task, _toConsumableArray(args));
  }

  exports['default'] = _ember['default'].Helper.helper(taskHelper);
});
define('hospitalrun/helpers/xor', ['exports', 'ember', 'ember-truth-helpers/helpers/xor'], function (exports, _ember, _emberTruthHelpersHelpersXor) {

  var forExport = null;

  if (_ember['default'].Helper) {
    forExport = _ember['default'].Helper.helper(_emberTruthHelpersHelpersXor.xorHelper);
  } else if (_ember['default'].HTMLBars.makeBoundHelper) {
    forExport = _ember['default'].HTMLBars.makeBoundHelper(_emberTruthHelpersHelpersXor.xorHelper);
  }

  exports['default'] = forExport;
});
define('hospitalrun/imaging/charge/controller', ['exports', 'hospitalrun/procedures/charge/controller', 'ember'], function (exports, _hospitalrunProceduresChargeController, _ember) {
  exports['default'] = _hospitalrunProceduresChargeController['default'].extend({
    cancelAction: 'closeModal',
    newPricingItem: false,
    requestingController: _ember['default'].inject.controllers('imaging/edit'),
    pricingList: _ember['default'].computed.alias('requestingController.chargesPricingList')
  });
});
define("hospitalrun/imaging/charge/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "bkPMKXlR", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"partial\",\"procedures/charge\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/imaging/charge/template.hbs" } });
});
define('hospitalrun/imaging/completed/completed-list-item/component', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    tagName: 'tr'
  });
});
define("hospitalrun/imaging/completed/completed-list-item/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "mAPPy+fo", "block": "{\"statements\":[[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"requested-date\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"imaging\",\"requestedDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"imaging-date\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"imaging\",\"imagingDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"requested-by\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"imaging\",\"requestedBy\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"display-name\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"imaging\",\"patient\",\"displayName\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"type\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"imaging\",\"imagingType\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"results\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"imaging\",\"result\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"notes\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"imaging\",\"notes\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/imaging/completed/completed-list-item/template.hbs" } });
});
define('hospitalrun/imaging/completed/controller', ['exports', 'hospitalrun/controllers/abstract-paged-controller'], function (exports, _hospitalrunControllersAbstractPagedController) {
  exports['default'] = _hospitalrunControllersAbstractPagedController['default'].extend({
    startKey: [],
    showActions: false
  });
});
define('hospitalrun/imaging/completed/route', ['exports', 'ember-i18n', 'hospitalrun/imaging/index/route'], function (exports, _emberI18n, _hospitalrunImagingIndexRoute) {
  exports['default'] = _hospitalrunImagingIndexRoute['default'].extend({
    pageTitle: (0, _emberI18n.translationMacro)('imaging.titles.completedImaging'),
    searchStatus: 'Completed'
  });
});
define("hospitalrun/imaging/completed/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "Rfh3vstr", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]],3]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-info\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"imaging.messages.noCompleted\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"imaging/completed/completed-list-item\"],null,[[\"imaging\"],[[\"get\",[\"imaging\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[\"imaging\"]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table imaging-completed-table\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.dateRequested\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.dateCompleted\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.requestedBy\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.patient\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.imagingType\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.results\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.notes\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\"]]],null,1],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"model\"]]],null,2,0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/imaging/completed/template.hbs" } });
});
define('hospitalrun/imaging/delete/controller', ['exports', 'hospitalrun/controllers/abstract-delete-controller', 'hospitalrun/mixins/patient-submodule'], function (exports, _hospitalrunControllersAbstractDeleteController, _hospitalrunMixinsPatientSubmodule) {
  exports['default'] = _hospitalrunControllersAbstractDeleteController['default'].extend(_hospitalrunMixinsPatientSubmodule['default'], {
    title: 'Delete Request',

    actions: {
      'delete': function _delete() {
        this.deleteChildFromVisit('imaging');
      }
    }
  });
});
define("hospitalrun/imaging/delete/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "oCNNOcNl", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-warning-sign\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"t\"],[\"messages.delete_singular\"],[[\"name\"],[[\"helper\",[\"t\"],[[\"get\",[\"models\",\"imaging\",\"request\",\"singular\"]]],null]]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/imaging/delete/template.hbs" } });
});
define('hospitalrun/imaging/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'hospitalrun/mixins/charge-actions', 'ember', 'hospitalrun/mixins/patient-submodule'], function (exports, _hospitalrunControllersAbstractEditController, _hospitalrunMixinsChargeActions, _ember, _hospitalrunMixinsPatientSubmodule) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsChargeActions['default'], _hospitalrunMixinsPatientSubmodule['default'], {
    imagingController: _ember['default'].inject.controller('imaging'),

    chargePricingCategory: 'Imaging',
    chargeRoute: 'imaging.charge',
    selectedImagingType: null,

    canComplete: (function () {
      var isNew = this.get('model.isNew');
      var imagingTypeName = this.get('model.imagingTypeName');
      var selectedImagingType = this.get('selectedImagingType');
      if (isNew && (_ember['default'].isEmpty(imagingTypeName) || _ember['default'].isArray(selectedImagingType) && selectedImagingType.length > 1)) {
        return false;
      } else {
        return this.currentUserCan('complete_imaging');
      }
    }).property('selectedImagingType.[]', 'model.imagingTypeName'),

    actions: {
      completeImaging: function completeImaging() {
        this.set('model.status', 'Completed');
        this.get('model').validate().then((function () {
          if (this.get('model.isValid')) {
            this.set('model.imagingDate', new Date());
            this.send('update');
          }
        }).bind(this))['catch'](_ember['default'].K);
      },

      /**
       * Save the imaging request(s), creating multiples when user selects multiple imaging tests.
       */
      update: function update() {
        var _this = this;

        if (this.get('model.isNew')) {
          (function () {
            var newImaging = _this.get('model');
            var selectedImagingType = _this.get('selectedImagingType');
            if (_ember['default'].isEmpty(_this.get('model.status'))) {
              _this.set('model.status', 'Requested');
            }
            _this.set('model.requestedBy', newImaging.getUserName());
            _this.set('model.requestedDate', new Date());
            if (_ember['default'].isEmpty(selectedImagingType)) {
              _this.saveNewPricing(_this.get('model.imagingTypeName'), 'Imaging', 'model.imagingType').then((function () {
                this.addChildToVisit(newImaging, 'imaging', 'Imaging').then((function () {
                  this.saveModel();
                }).bind(this));
              }).bind(_this));
            } else {
              _this.getSelectedPricing('selectedImagingType').then((function (pricingRecords) {
                if (_ember['default'].isArray(pricingRecords)) {
                  this.createMultipleRequests(pricingRecords, 'imagingType', 'imaging', 'Imaging');
                } else {
                  this.set('model.imagingType', pricingRecords);
                  this.addChildToVisit(newImaging, 'imaging', 'Imaging').then((function () {
                    this.saveModel();
                  }).bind(this));
                }
              }).bind(_this));
            }
          })();
        } else {
          this.saveModel();
        }
      }
    },

    additionalButtons: (function () {
      var i18n = this.get('i18n');
      var canComplete = this.get('canComplete');
      var isValid = this.get('model.isValid');
      if (isValid && canComplete) {
        return [{
          buttonAction: 'completeImaging',
          buttonIcon: 'glyphicon glyphicon-ok',
          'class': 'btn btn-primary on-white',
          buttonText: i18n.t('buttons.complete')
        }];
      }
    }).property('canComplete', 'model.isValid'),

    lookupListsToUpdate: [{
      name: 'radiologistList',
      property: 'model.radiologist',
      id: 'radiologists'
    }],

    pricingTypeForObjectType: 'Imaging Procedure',
    pricingTypes: _ember['default'].computed.alias('imagingController.imagingPricingTypes'),

    pricingList: null, // This gets filled in by the route

    radiologistList: _ember['default'].computed.alias('imagingController.radiologistList'),

    updateCapability: 'add_imaging',

    afterUpdate: function afterUpdate(saveResponse, multipleRecords) {
      var i18n = this.get('i18n');
      this.updateLookupLists();
      var afterDialogAction = undefined,
          alertTitle = undefined,
          alertMessage = undefined;
      if (this.get('model.status') === 'Completed') {
        alertTitle = i18n.t('imaging.alerts.completedTitle');
        alertMessage = i18n.t('imaging.alerts.completedMessage');
      } else {
        alertTitle = i18n.t('imaging.alerts.savedTitle');
        alertMessage = i18n.t('imaging.alerts.savedMessage');
      }
      if (multipleRecords) {
        afterDialogAction = this.get('cancelAction');
      }
      this.saveVisitIfNeeded(alertTitle, alertMessage, afterDialogAction);
      this.set('model.selectPatient', false);
    }

  });
});
define('hospitalrun/imaging/edit/route', ['exports', 'ember-i18n', 'hospitalrun/routes/abstract-edit-route', 'hospitalrun/mixins/add-to-patient-route', 'hospitalrun/mixins/charge-route', 'ember', 'moment', 'hospitalrun/mixins/patient-list-route'], function (exports, _emberI18n, _hospitalrunRoutesAbstractEditRoute, _hospitalrunMixinsAddToPatientRoute, _hospitalrunMixinsChargeRoute, _ember, _moment, _hospitalrunMixinsPatientListRoute) {
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend(_hospitalrunMixinsAddToPatientRoute['default'], _hospitalrunMixinsChargeRoute['default'], _hospitalrunMixinsPatientListRoute['default'], {
    editTitle: (0, _emberI18n.translationMacro)('imaging.titles.editTitle'),
    modelName: 'imaging',
    newTitle: (0, _emberI18n.translationMacro)('imaging.titles.editTitle'),
    pricingCategory: 'Imaging',

    actions: {
      returnToAllItems: function returnToAllItems() {
        this.controller.send('returnToAllItems');
      }
    },

    getNewData: function getNewData() {
      return _ember['default'].RSVP.resolve({
        selectPatient: true,
        requestDate: (0, _moment['default'])().startOf('day').toDate()
      });
    }
  });
});
define("hospitalrun/imaging/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "FCK9YPgE", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],6]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"prompt\",\"class\"],[\"radiologist\",[\"helper\",[\"t\"],[\"imaging.labels.radiologist\"],null],[\"get\",[\"radiologistList\"]],\" \",\"radiologist-input\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"result\",[\"helper\",[\"t\"],[\"labels.result\"],null],\"result-input\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-xs-3\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.visit\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"visit\",\"visitDate\"]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-xs-9\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.imagingType\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"imagingType\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-xs-12\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.requestedBy\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"requestedBy\"]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\",\"optionValuePath\",\"optionLabelPath\",\"prompt\",\"selected\"],[\"col-xs-3 required\",[\"helper\",[\"t\"],[\"labels.visit\"],null],\"visit\",[\"get\",[\"patientVisitsForSelect\"]],\"selectObject\",\"selectObject.visitDescription\",[\"helper\",[\"t\"],[\"imaging.labels.addNewVisit\"],null],[\"get\",[\"model\",\"visit\"]]]]],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"checkbox-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"optionLabelPath\",\"typeAheadType\",\"className\",\"prompt\",\"model\",\"class\"],[\"imagingTypeName\",[\"helper\",[\"t\"],[\"labels.imagingType\"],null],[\"get\",[\"objectTypeList\"]],[\"get\",[\"selectedImagingType\"]],\"name\",\"pricing\",\"required\",\" \",[\"get\",[\"model\"]],\"imaging-type-input\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"patient-summary\"],null,[[\"patient\",\"returnTo\",\"returnToContext\",\"disablePatientLink\"],[[\"get\",[\"model\",\"patient\"]],\"imaging.edit\",[\"get\",[\"model\",\"id\"]],[\"get\",[\"model\",\"isNew\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"patient-typeahead\"],null,[[\"property\",\"label\",\"content\",\"selection\",\"class\"],[\"patientTypeAhead\",[\"helper\",[\"t\"],[\"labels.patient\"],null],[\"get\",[\"patientList\"]],[\"get\",[\"selectedPatient\"]],\"required patient-input\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"model\",\"selectPatient\"]]],null,4,3],[\"block\",[\"if\"],[[\"get\",[\"model\",\"isNew\"]]],null,2,1],[\"block\",[\"if\"],[[\"get\",[\"canComplete\"]]],null,0],[\"text\",\"    \"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"property\",\"label\",\"rows\"],[\"notes\",[\"helper\",[\"t\"],[\"labels.notes\"],null],3]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],5]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/imaging/edit/template.hbs" } });
});
define('hospitalrun/imaging/index/controller', ['exports', 'hospitalrun/controllers/abstract-paged-controller', 'hospitalrun/mixins/user-session'], function (exports, _hospitalrunControllersAbstractPagedController, _hospitalrunMixinsUserSession) {
  exports['default'] = _hospitalrunControllersAbstractPagedController['default'].extend(_hospitalrunMixinsUserSession['default'], {
    startKey: [],
    addPermission: 'add_imaging'
  });
});
define('hospitalrun/imaging/index/imaging-edit-button/component', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    tagName: 'button',
    classNames: ['btn', 'btn-default', 'neutral']
  });
});
define("hospitalrun/imaging/index/imaging-edit-button/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "fgj2GO/M", "block": "{\"statements\":[[\"block\",[\"link-to\"],[\"imaging.edit\",[\"get\",[\"imaging\"]]],null,0],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/imaging/index/imaging-edit-button/template.hbs" } });
});
define('hospitalrun/imaging/index/requested-list-item/component', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    tagName: 'tr',
    classNames: ['clickable'],

    click: function click() {
      this.sendAction('action', this.imaging);
    }
  });
});
define("hospitalrun/imaging/index/requested-list-item/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "JWG9328s", "block": "{\"statements\":[[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"date\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"imaging\",\"requestedDate\"]]],[[\"format\"],[\"l h:mm A\"]]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"requested-by\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"imaging\",\"requestedBy\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"patient\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"imaging\",\"patient\",\"displayName\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"type\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"imaging\",\"imagingType\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"notes\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"imaging\",\"notes\"]],false],[\"close-element\"],[\"text\",\"\\n\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"imaging/index/imaging-edit-button\"],null,[[\"imaging\"],[[\"get\",[\"imaging\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canEdit\"]]],null,0],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/imaging/index/requested-list-item/template.hbs" } });
});
define('hospitalrun/imaging/index/route', ['exports', 'ember-i18n', 'hospitalrun/routes/abstract-index-route'], function (exports, _emberI18n, _hospitalrunRoutesAbstractIndexRoute) {
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend({
    modelName: 'imaging',
    pageTitle: (0, _emberI18n.translationMacro)('imaging.pageTitle'),
    searchStatus: 'Requested',

    _getStartKeyFromItem: function _getStartKeyFromItem(item) {
      var imagingDateAsTime = item.get('imagingDateAsTime');
      var id = this._getPouchIdFromItem(item);
      var requestedDateAsTime = item.get('requestedDateAsTime');
      var searchStatus = this.get('searchStatus');
      return [searchStatus, requestedDateAsTime, imagingDateAsTime, id];
    },
    _modelQueryParams: function _modelQueryParams() {
      var maxId = this._getMaxPouchId();
      var maxValue = this.get('maxValue');
      var minId = this._getMinPouchId();
      var searchStatus = this.get('searchStatus');
      return {
        options: {
          startkey: [searchStatus, null, null, minId],
          endkey: [searchStatus, maxValue, maxValue, maxId]
        },
        mapReduce: 'imaging_by_status'
      };
    }
  });
});
define("hospitalrun/imaging/index/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "bA1O68vE", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]],5]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\" \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newItem\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"messages.createNewRecord\"],null],false],[\"close-element\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-info\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"messages.noItemsFound\"],null],false],[\"text\",\" \"],[\"block\",[\"if\"],[[\"get\",[\"canAdd\"]]],null,0],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"imaging/index/requested-list-item\"],null,[[\"imaging\",\"action\",\"showActions\",\"canEdit\"],[[\"get\",[\"imaging\"]],\"editItem\",[\"get\",[\"showActions\"]],[\"get\",[\"canEdit\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[\"imaging\"]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-2\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-2\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.dateRequested\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-2\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.requestedBy\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-2\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.patient\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-2\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.imagingType\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-2\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.notes\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,3],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\"]]],null,2],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"hasRecords\"]]],null,4,1]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/imaging/index/template.hbs" } });
});
define('hospitalrun/imaging/route', ['exports', 'ember-i18n', 'hospitalrun/routes/abstract-module-route'], function (exports, _emberI18n, _hospitalrunRoutesAbstractModuleRoute) {
  exports['default'] = _hospitalrunRoutesAbstractModuleRoute['default'].extend({
    addCapability: 'add_imaging',
    additionalModels: [{
      name: 'imagingPricingTypes',
      findArgs: ['lookup', 'imaging_pricing_types']
    }, {
      name: 'radiologistList',
      findArgs: ['lookup', 'radiologists']
    }],
    allowSearch: false,
    moduleName: 'imaging',
    newButtonText: (0, _emberI18n.translationMacro)('imaging.buttons.newButton'),
    sectionTitle: (0, _emberI18n.translationMacro)('imaging.sectionTitle')
  });
});
define('hospitalrun/inc-category/add-item/controller', ['exports', 'ember', 'ember-i18n'], function (exports, _ember, _emberI18n) {
  var Controller = _ember['default'].Controller;
  var alias = _ember['default'].computed.alias;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  exports['default'] = Controller.extend({
    showUpdateButton: true,
    title: (0, _emberI18n.translationMacro)('incident.titles.addCategoryItem'),
    updateButtonAction: 'add',
    updateButtonText: 'Add',

    incidentCategoryEdit: inject.controller('inc-category/edit'),
    editController: alias('incidentCategoryEdit'),

    actions: {
      add: function add() {
        var newItem = get(this, 'model');
        get(this, 'editController').send('addItem', newItem);
      },

      cancel: function cancel() {
        this.send('closeModal');
      }
    }
  });
});
define("hospitalrun/inc-category/add-item/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "vKfk7Zs7", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"hideCancelButton\",\"hideUpdateButton\",\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"hideCancelButton\"]],[\"get\",[\"hideUpdateButton\"]],[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"incident.labels.item\"],null],\"item\",\"incident-category-item\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/inc-category/add-item/template.hbs" } });
});
define('hospitalrun/inc-category/delete/controller', ['exports', 'hospitalrun/controllers/abstract-delete-controller', 'ember-i18n'], function (exports, _hospitalrunControllersAbstractDeleteController, _emberI18n) {
  exports['default'] = _hospitalrunControllersAbstractDeleteController['default'].extend({
    title: (0, _emberI18n.translationMacro)('incident.titles.deleteIncidentCategory')
  });
});
define("hospitalrun/inc-category/delete/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "WDQepTMs", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-warning-sign\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"t\"],[\"messages.delete\"],[[\"name\"],[[\"get\",[\"model\",\"incidentCategoryName\"]]]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/inc-category/delete/template.hbs" } });
});
define('hospitalrun/inc-category/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember'], function (exports, _hospitalrunControllersAbstractEditController, _ember) {
  var get = _ember['default'].get;
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend({
    updateCapability: 'add_incident_category',

    afterUpdate: function afterUpdate(record) {
      var i18n = get(this, 'i18n');
      var message = i18n.t('incident.messages.incidentCategorySaved', { name: get(record, 'incidentCategoryName') });
      var title = i18n.t('incident.titles.incidentCategorySaved');
      this.displayAlert(title, message);
    },

    actions: {
      addItem: function addItem(newItem) {
        var categoryItems = this.getWithDefault('model.incidentCategoryItems', []);
        var model = get(this, 'model');
        categoryItems.addObject(newItem);
        model.set('incidentCategoryItems', categoryItems);
        this.send('update', true);
        this.send('closeModal');
      },

      deleteItem: function deleteItem(model) {
        var item = model.get('itemToDelete');
        var categoryItems = get(this, 'model.incidentCategoryItems');
        categoryItems.removeObject(item);
        this.send('update', true);
      },

      showAddItem: function showAddItem() {
        this.send('openModal', 'inc-category.add-item', _ember['default'].Object.create());
      },

      showDeleteItem: function showDeleteItem(item) {
        var i18n = get(this, 'i18n');
        var modelName = i18n.t('models.item.names.singular');
        var message = i18n.t('messages.delete_singular', { name: modelName });
        var title = i18n.t('incident.titles.deleteItem');
        this.displayConfirm(title, message, 'deleteItem', _ember['default'].Object.create({
          itemToDelete: item
        }));
      }
    }

  });
});
define('hospitalrun/inc-category/edit/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractEditRoute, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend({
    editTitle: (0, _emberI18n.translationMacro)('incident.titles.editIncidentCategory'),
    modelName: 'inc-category',
    newTitle: (0, _emberI18n.translationMacro)('incident.titles.newIncidentCategory'),

    actions: {
      deleteItem: function deleteItem(model) {
        this.controller.send('deleteItem', model);
      }
    }
  });
});
define("hospitalrun/inc-category/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "lHIEhMMk", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],2]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"incident-category-item\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"incidentCategoryItem\",\"item\"]],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteItem\",[\"get\",[\"incidentCategoryItem\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.buttons.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"incidentCategoryItem\"]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group has-success\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel detail-section\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"t\"],[\"incident.titles.incidentCategoryName\"],null],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"class\"],[\"incidentCategoryName\",\"incident-category-name col-sm-12\"]]],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel detail-section\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"t\"],[\"incident.titles.incidentCategoryItem\"],null],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.item\"],null],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"incidentCategoryItems\"]]],null,0],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddItem\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.buttons.addItem\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],1]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/inc-category/edit/template.hbs" } });
});
define('hospitalrun/inc-category/index/controller', ['exports', 'hospitalrun/controllers/abstract-paged-controller', 'ember'], function (exports, _hospitalrunControllersAbstractPagedController, _ember) {
  exports['default'] = _hospitalrunControllersAbstractPagedController['default'].extend({
    startKey: [],

    canDeleteIncidentCategory: _ember['default'].computed(function () {
      return this.currentUserCan('delete_incident_category');
    }),

    actions: {
      showDeleteIncidentCategory: function showDeleteIncidentCategory(category) {
        this.send('openModal', 'inc-category.delete', category);
      }
    }
  });
});
define('hospitalrun/inc-category/index/route', ['exports', 'hospitalrun/routes/abstract-index-route', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractIndexRoute, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend({
    modelName: 'inc-category',
    newButtonAction: 'newItem',
    newButtonText: (0, _emberI18n.translationMacro)('incident.buttons.newCategory'),
    pageTitle: (0, _emberI18n.translationMacro)('incident.titles.incidentCategories'),

    actions: {
      editItem: function editItem(category) {
        this.transitionTo('inc-category.edit', category);
      },

      newItem: function newItem() {
        this.transitionTo('inc-category.edit', 'new');
      }
    }
  });
});
define("hospitalrun/inc-category/index/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "e+LcjQOv", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]],5]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-info\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"em\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.messages.noIncidentCategoriesFound\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"em\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.messages.createNewIncidentCategory\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary on-white\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newItem\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.buttons.newCategory\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteIncidentCategory\",[\"get\",[\"category\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.buttons.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"tr\",[]],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"category\"]]]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"incident-catergory-name\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"category\",\"incidentCategoryName\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"category\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.buttons.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canDeleteIncidentCategory\"]]],null,1],[\"text\",\"            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"unless\"],[[\"get\",[\"category\",\"archived\"]]],null,2]],\"locals\":[\"category\"]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.titles.incidentCategoryName\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\"]]],null,3],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"hasRecords\"]]],null,4,0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/inc-category/index/template.hbs" } });
});
define('hospitalrun/inc-category/route', ['exports', 'ember-simple-auth/mixins/authenticated-route-mixin', 'ember'], function (exports, _emberSimpleAuthMixinsAuthenticatedRouteMixin, _ember) {
  exports['default'] = _ember['default'].Route.extend(_emberSimpleAuthMixinsAuthenticatedRouteMixin['default'], {
    actions: {
      allItems: function allItems() {
        this.transitionTo('inc-category.index');
      }
    }
  });
});
define('hospitalrun/incident/attachment/controller', ['exports', 'hospitalrun/patients/photo/controller', 'ember', 'ember-i18n'], function (exports, _hospitalrunPatientsPhotoController, _ember, _emberI18n) {
  var inject = _ember['default'].inject;
  exports['default'] = _hospitalrunPatientsPhotoController['default'].extend({
    addAction: 'addAttachment',
    editTitle: (0, _emberI18n.translationMacro)('incident.titles.editAttachment'),
    modelName: 'attachment',
    newTitle: (0, _emberI18n.translationMacro)('incident.titles.addAttachment'),
    fileRequiredMessage: (0, _emberI18n.translationMacro)('incident.messages.attachmentFileRequired'),

    editController: inject.controller('incident/edit')

  });
});
define("hospitalrun/incident/attachment/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "PyR3FXRE", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"hideCancelButton\",\"hideUpdateButton\",\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonClass\",\"updateButtonText\"],[[\"get\",[\"hideCancelButton\"]],[\"get\",[\"hideUpdateButton\"]],[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonClass\"]],[\"get\",[\"updateButtonText\"]]]],6]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-warning\"],[\"static-attr\",\"role\",\"alert\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"fileRequiredMessage\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"a\",[]],[\"dynamic-attr\",\"href\",[\"unknown\",[\"model\",\"url\"]],null],[\"static-attr\",\"target\",\"_blank\"],[\"dynamic-attr\",\"download\",[\"concat\",[[\"unknown\",[\"model\",\"shortFileName\"]]]]],[\"static-attr\",\"class\",\"btn btn-default\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-download\"],[\"static-attr\",\"aria-hidden\",\"true\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"incident.buttons.download\"],null],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"thumbnail\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"img\",[]],[\"dynamic-attr\",\"alt\",[\"unknown\",[\"model\",\"title\"]],null],[\"dynamic-attr\",\"src\",[\"unknown\",[\"model\",\"url\"]],null],[\"static-attr\",\"class\",\"img-responsive\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"model\",\"isImage\"]]],null,2,1]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"take-photo\"],null,[[\"defaultPhotoSource\",\"isImage\",\"photoFile\",\"sourceLabel\"],[\"uploadAFile\",[\"get\",[\"model\",\"isImage\"]],[\"get\",[\"model\",\"photoFile\"]],[\"helper\",[\"t\"],[\"incident.labels.howToAddAttachment\"],null]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"title\",[\"helper\",[\"t\"],[\"incident.labels.title\"],null],\"attachment-title\"]]],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"model\",\"isNew\"]]],null,4,3],[\"block\",[\"if\"],[[\"get\",[\"showFileRequired\"]]],null,0]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],5]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/incident/attachment/template.hbs" } });
});
define('hospitalrun/incident/completed/controller', ['exports', 'hospitalrun/incident/index/controller'], function (exports, _hospitalrunIncidentIndexController) {
  exports['default'] = _hospitalrunIncidentIndexController['default'].extend({
    canDelete: false,
    startKey: []
  });
});
define('hospitalrun/incident/completed/route', ['exports', 'hospitalrun/incident/index/route', 'hospitalrun/mixins/user-session', 'ember-i18n'], function (exports, _hospitalrunIncidentIndexRoute, _hospitalrunMixinsUserSession, _emberI18n) {
  exports['default'] = _hospitalrunIncidentIndexRoute['default'].extend(_hospitalrunMixinsUserSession['default'], {
    editReturn: 'incident.completed',
    modelName: 'incident',
    pageTitle: (0, _emberI18n.translationMacro)('incident.titles.closed'),

    _getStartKeyFromItem: function _getStartKeyFromItem(item) {
      var id = this._getPouchIdFromItem(item);
      return [item.get('reportedBy'), id];
    },

    _modelQueryParams: function _modelQueryParams() {
      var maxId = this._getMaxPouchId();
      var currentUser = this.getUserName(true);
      var queryParams = {
        mapReduce: 'closed_incidents_by_user'
      };
      if (!this.currentUserCan('manage_incidents')) {
        queryParams.options = {
          startkey: [currentUser, null],
          endkey: [currentUser, maxId]
        };
      }
      return queryParams;
    }
  });
});
define("hospitalrun/incident/completed/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "M/U8O1VD", "block": "{\"statements\":[[\"partial\",\"incident/index\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/incident/completed/template.hbs" } });
});
define('hospitalrun/incident/delete/controller', ['exports', 'hospitalrun/controllers/abstract-delete-controller', 'ember', 'ember-i18n'], function (exports, _hospitalrunControllersAbstractDeleteController, _ember, _emberI18n) {
  var get = _ember['default'].get;
  var RSVP = _ember['default'].RSVP;
  exports['default'] = _hospitalrunControllersAbstractDeleteController['default'].extend({
    title: (0, _emberI18n.translationMacro)('incident.titles.deleteIncident'),

    _deleteChildObject: function _deleteChildObject(incident, childObject, destroyPromises) {
      incident.get(childObject).then(function (childObject) {
        childObject.forEach(function (child) {
          destroyPromises.push(child.destroyRecord()); // Add the destroy promise to the list
        });
      });
    },

    actions: {
      'delete': function _delete() {
        var destroyPromises = [];
        var incident = get(this, 'model');
        this._deleteChildObject(incident, 'notes', destroyPromises);
        RSVP.all(destroyPromises).then((function () {
          // fires when all the destroys have been completed.
          get(this, 'model').destroyRecord().then((function () {
            // delete incident
            this.send('closeModal');
          }).bind(this));
        }).bind(this));
      }
    }
  });
});
define("hospitalrun/incident/delete/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "VVl8A6E/", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-warning-sign\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"messages.delete_singular\"],[[\"name\"],[[\"helper\",[\"t\"],[\"models.incident.names.singular\"],null]]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/incident/delete/template.hbs" } });
});
define('hospitalrun/incident/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember-data', 'ember', 'hospitalrun/mixins/friendly-id', 'hospitalrun/mixins/incident-statuses', 'hospitalrun/mixins/patient-submodule', 'hospitalrun/utils/select-values', 'hospitalrun/mixins/user-session'], function (exports, _hospitalrunControllersAbstractEditController, _emberData, _ember, _hospitalrunMixinsFriendlyId, _hospitalrunMixinsIncidentStatuses, _hospitalrunMixinsPatientSubmodule, _hospitalrunUtilsSelectValues, _hospitalrunMixinsUserSession) {
  var PromiseArray = _emberData['default'].PromiseArray;
  var PromiseObject = _emberData['default'].PromiseObject;
  var computed = _ember['default'].computed;
  var alias = _ember['default'].computed.alias;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var set = _ember['default'].set;
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsIncidentStatuses['default'], _hospitalrunMixinsFriendlyId['default'], _hospitalrunMixinsPatientSubmodule['default'], _hospitalrunUtilsSelectValues['default'], _hospitalrunMixinsUserSession['default'], {
    lookupListsToUpdate: [{
      name: 'incidentDepartmentList',
      property: 'model.department',
      id: 'incident_departments'
    }],
    sequenceName: 'incident',
    sequenceView: 'incident_by_friendly_id',
    updateCapability: 'add_incident',

    customForms: inject.service(),
    database: inject.service(),
    filesystem: inject.service(),
    lookupLists: inject.service(),

    customFormsToAdd: alias('customForms.formsForSelect'),
    customFormsToDisplay: alias('customForms.formsToDisplay'),
    showAddFormButton: alias('customForms.showAddButton'),
    incidentController: inject.controller('incident'),

    canManageIncident: computed('model.{isNew,status}', function () {
      var canManageIncident = this.currentUserCan('manage_incidents');
      var status = get(this, 'model.status');
      var isNew = get(this, 'model.isNew');
      if (isNew || status === _hospitalrunMixinsIncidentStatuses.CLOSED) {
        canManageIncident = false;
      }
      return canManageIncident;
    }),

    canUpdateStatus: computed('model.isNew', function () {
      var canManageIncident = this.currentUserCan('manage_incidents');
      var isNew = get(this, 'model.isNew');
      return canManageIncident && !isNew;
    }),

    categoryNameList: computed('incidentCategoryList.@each.archived', function () {
      return PromiseArray.create({
        promise: get(this, 'incidentCategoryList').then(function (categoryList) {
          return categoryList.map(function (value) {
            return {
              id: get(value, 'incidentCategoryName'),
              value: get(value, 'incidentCategoryName')
            };
          });
        })
      });
    }),

    incidentCategoryList: computed(function () {
      var lookupLists = get(this, 'lookupLists');
      return lookupLists.getLookupList('incidentCategories');
    }).volatile(),

    incidentDepartmentList: computed('lookupListsLastUpdate', function () {
      var lookupLists = get(this, 'lookupLists');
      return PromiseObject.create({
        promise: lookupLists.getLookupList('incident_departments')
      });
    }).volatile(),

    incidentStatuses: computed(function () {
      var _this = this;

      return get(this, 'statusList').map(function (status) {
        return {
          id: status,
          value: _this.getLocalizedStatus(status)
        };
      });
    }),

    itemList: computed('model.categoryName', function () {
      var categoryNameSelected = get(this, 'model.categoryName');
      if (!_ember['default'].isEmpty(categoryNameSelected)) {
        return PromiseArray.create({
          promise: get(this, 'incidentCategoryList').then(function (categoryList) {
            var incidentCategory = categoryList.findBy('incidentCategoryName', categoryNameSelected);
            return get(incidentCategory, 'incidentCategoryItems');
          })
        });
      }
    }),

    afterUpdate: function afterUpdate() {
      var i18n = get(this, 'i18n');
      this.displayAlert(i18n.t('incident.titles.incidentSaved'), i18n.t('incident.messages.saved'));
    },

    beforeUpdate: function beforeUpdate() {
      var model = get(this, 'model');
      set(model, 'modifiedByDisplayName', this.getUserName(false));
      if (get(model, 'isNew')) {
        return this.generateFriendlyId('incident').then(function (friendlyId) {
          set(model, 'friendlyId', friendlyId);
        });
      } else {
        return _ember['default'].RSVP.resolve();
      }
    },

    setupCustomForms: function setupCustomForms() {
      var customForms = get(this, 'customForms');
      var model = get(this, 'model');
      customForms.setupForms('incident', model);
    },

    /**
     * Adds or removes the specified object from the specified list.
     * @param {String} listName The name of the list to operate on.
     * @param {Object} listObject The object to add or removed from the
     * specified list.
     * @param {boolean} removeObject If true remove the object from the list;
     * otherwise add the specified object to the list.
     */
    _updateList: function _updateList(listName, listObject, removeObject) {
      var model = get(this, 'model');
      get(model, listName).then((function (list) {
        if (removeObject) {
          list.removeObject(listObject);
        } else {
          list.addObject(listObject);
        }
        this.send('update', true);
        this.send('closeModal');
      }).bind(this));
    },

    actions: {
      addNote: function addNote(newNote) {
        this._updateList('notes', newNote);
      },

      addAttachment: function addAttachment(newAttachment) {
        this._updateList('incidentAttachments', newAttachment);
      },

      addCustomForm: function addCustomForm() {
        var model = get(this, 'model');
        var customFormsToAdd = get(this, 'customFormsToAdd');
        this.send('openModal', 'custom-form-add', _ember['default'].Object.create({
          modelToAddTo: model,
          customForms: customFormsToAdd
        }));
      },

      showAddAttachment: function showAddAttachment() {
        var newNote = get(this, 'store').createRecord('attachment', {
          dateAdded: new Date(),
          addedBy: this.getUserName(true),
          addedByDisplayName: this.getUserName(false),
          saveToDir: '/incidents/' + get(this, 'model.id') + '/'
        });
        this.send('openModal', 'incident.attachment', newNote);
      },

      showAddNote: function showAddNote() {
        var newNote = get(this, 'store').createRecord('incident-note', {
          dateRecorded: new Date(),
          givenBy: this.getUserName(true),
          givenByDisplayName: this.getUserName(false)
        });
        this.send('openModal', 'incident.note.edit', newNote);
      },

      deleteAttachment: function deleteAttachment(model) {
        var _this2 = this;

        var attachment = get(model, 'itemToDelete');
        this._updateList('incidentAttachments', attachment, true);
        attachment.destroyRecord().then(function () {
          var attachmentId = get(attachment, 'id');
          var database = get(_this2, 'database');
          var filePath = get(attachment, 'fileName');
          var fileSystem = get(_this2, 'filesystem');
          var isFileSystemEnabled = get(fileSystem, 'isFileSystemEnabled');
          if (isFileSystemEnabled) {
            var pouchDbId = database.getPouchId(attachmentId, 'attachment');
            fileSystem.deleteFile(filePath, pouchDbId)['catch'](function () /* ignored */{});
          }
        });
      },

      deleteNote: function deleteNote(note) {
        this._updateList('notes', note, true);
      },

      showDeleteAttachment: function showDeleteAttachment(attachment) {
        var i18n = get(this, 'i18n');
        var modelName = i18n.t('models.attachment.names.singular');
        var message = i18n.t('messages.delete_singular', { name: modelName });
        var model = _ember['default'].Object.create({
          itemToDelete: attachment
        });
        var title = i18n.t('incident.titles.deleteAttachment');
        this.displayConfirm(title, message, 'deleteAttachment', model);
      },

      showDeleteNote: function showDeleteNote(note) {
        this.send('openModal', 'incident.note.delete', note);
      },

      showEditAttachment: function showEditAttachment(attachment) {
        this.send('openModal', 'incident.attachment', attachment);
      },

      showEditNote: function showEditNote(note) {
        this.send('openModal', 'incident.note.edit', note);
      }

    }

  });
});
define('hospitalrun/incident/edit/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'ember', 'hospitalrun/mixins/patient-list-route', 'hospitalrun/mixins/user-session', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractEditRoute, _ember, _hospitalrunMixinsPatientListRoute, _hospitalrunMixinsUserSession, _emberI18n) {
  var get = _ember['default'].get;
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend(_hospitalrunMixinsPatientListRoute['default'], _hospitalrunMixinsUserSession['default'], {
    editTitle: (0, _emberI18n.translationMacro)('incident.titles.editIncident'),
    modelName: 'incident',
    newTitle: (0, _emberI18n.translationMacro)('incident.titles.newIncident'),

    customForms: _ember['default'].inject.service(),

    getNewData: function getNewData() {
      var customForms = get(this, 'customForms');
      var now = new Date();
      var newData = {
        customForms: _ember['default'].Object.create(),
        dateOfIncident: now,
        reportedDate: now,
        reportedBy: this.getUserName(true),
        reportedByDisplayName: this.getUserName(false)
      };
      return customForms.setDefaultCustomForms(['incident'], newData);
    },

    setupController: function setupController(controller, model) {
      this._super(controller, model);
      controller.setupCustomForms();
    },

    actions: {
      deleteAttachment: function deleteAttachment(model) {
        this.controller.send('deleteAttachment', model);
      }
    }
  });
});
define("hospitalrun/incident/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "LL98wjJL", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],11]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"role\",\"tabpanel\"],[\"static-attr\",\"class\",\"tab-pane\"],[\"dynamic-attr\",\"id\",[\"helper\",[\"concat\"],[\"customForm\",[\"get\",[\"index\"]]],null],null],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"custom-form\"],null,[[\"model\",\"form\",\"propertyPrefix\"],[[\"get\",[\"model\"]],[\"get\",[\"customForm\",\"form\"]],[\"get\",[\"customForm\",\"propertyPrefix\"]]]]],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"customForm\",\"index\"]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"attachment\",\"dateAdded\"]]],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"attachment\",\"addedByDisplayName\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"attachment\",\"title\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showEditAttachment\",[\"get\",[\"attachment\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.buttons.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"a\",[]],[\"dynamic-attr\",\"href\",[\"unknown\",[\"attachment\",\"url\"]],null],[\"static-attr\",\"target\",\"_blank\"],[\"dynamic-attr\",\"download\",[\"concat\",[[\"unknown\",[\"attachment\",\"shortFileName\"]]]]],[\"static-attr\",\"class\",\"btn btn-default\"],[\"flush-element\"],[\"text\",\"\\n                        \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-download\"],[\"static-attr\",\"aria-hidden\",\"true\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"incident.buttons.download\"],null],false],[\"text\",\"\\n                      \"],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteAttachment\",[\"get\",[\"attachment\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"incident.buttons.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"close-element\"],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"attachment\"]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"note\",\"dateRecorded\"]]],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"note\",\"givenByDisplayName\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"note-description\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"note\",\"description\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showEditNote\",[\"get\",[\"note\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.buttons.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteNote\",[\"get\",[\"note\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"incident.buttons.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"close-element\"],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"note\"]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"addCustomForm\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"helper\",[\"t\"],[\"incident.buttons.addForm\"],null],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"a\",[]],[\"dynamic-attr\",\"href\",[\"helper\",[\"concat\"],[\"#customForm\",[\"get\",[\"index\"]]],null],null],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"unknown\",[\"customForm\",\"form\",\"name\"]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"customForm\",\"index\"]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"ul\",[]],[\"static-attr\",\"class\",\"nav nav-pills tab-nav\"],[\"static-attr\",\"role\",\"tablist\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"static-attr\",\"class\",\"active\"],[\"flush-element\"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#notes\"],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.titles.notes\"],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"flush-element\"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#attachments\"],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.titles.attachments\"],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"customFormsToDisplay\"]]],null,4],[\"block\",[\"if\"],[[\"get\",[\"showAddFormButton\"]]],null,3],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"tab-content\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"role\",\"tabpanel\"],[\"static-attr\",\"class\",\"tab-pane active\"],[\"static-attr\",\"id\",\"notes\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddNote\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.buttons.newNote\"],null],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.date\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.givenBy\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.note\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"notes\"]]],null,2],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"role\",\"tabpanel\"],[\"static-attr\",\"class\",\"tab-pane\"],[\"static-attr\",\"id\",\"attachments\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddAttachment\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.buttons.newAttachment\"],null],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.date\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.addedBy\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.title\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"incidentAttachments\"]]],null,1],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"customFormsToDisplay\"]]],null,0],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-sm-3\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.patientId\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static patient-id\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"patient\",\"friendlyId\"]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-sm-3\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.status\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"status\"]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"label\",\"property\",\"content\",\"class\"],[[\"helper\",[\"t\"],[\"incident.labels.status\"],null],\"status\",[\"get\",[\"incidentStatuses\"]],\"required form-input-group col-sm-3\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-sm-2\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.incidentId\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"friendlyId\"]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-sm-2\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.reportedDate\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"model\",\"reportedDate\"]]],[[\"format\"],[\"l h:mm A\"]]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-sm-2\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.reportedBy\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"reportedByDisplayName\"]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-sm-2\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.lastUpdated\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"model\",\"lastModified\"]]],[[\"format\"],[\"l h:mm A\"]]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-sm-2\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.updatedBy\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"modifiedByDisplayName\"]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"unless\"],[[\"get\",[\"model\",\"isNew\"]]],null,9],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n\\n      \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"incident.labels.sentinelEvent\"],null],\"sentinelEvent\",\"col-sm-3 sentinel-event\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\",\"showTime\"],[\"dateOfIncident\",[\"helper\",[\"t\"],[\"incident.labels.incidentDate\"],null],\"col-sm-3 required incident-date\",true]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\"],[\"col-sm-3 required incident-department\",\"department\",[\"helper\",[\"t\"],[\"incident.labels.department\"],null],[\"get\",[\"incidentDepartmentList\"]],[\"get\",[\"model\",\"location\"]]]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"reportedTo\",[\"helper\",[\"t\"],[\"incident.labels.reportedTo\"],null],\"col-sm-3 reported-to\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"prompt\",\"property\",\"content\"],[\"col-sm-4 form-input-group required incident-category\",[\"helper\",[\"t\"],[\"incident.labels.category\"],null],\" \",\"categoryName\",[\"get\",[\"categoryNameList\"]]]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"prompt\",\"property\",\"content\",\"optionLabelPath\",\"optionValuePath\"],[\"col-sm-4 form-input-group incident-category-item\",[\"helper\",[\"t\"],[\"incident.labels.categoryItem\"],null],\" \",\"categoryItem\",[\"get\",[\"itemList\"]],\"item\",\"item\"]]],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canUpdateStatus\"]]],null,8,7],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"patient-typeahead\"],null,[[\"property\",\"label\",\"content\",\"class\",\"selection\"],[\"patientTypeAhead\",[\"helper\",[\"t\"],[\"incident.labels.patientImpacted\"],null],[\"get\",[\"patientList\"]],\"patient-name col-sm-9\",[\"get\",[\"selectedPatient\"]]]]],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"model\",\"patient\"]]],null,6],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"label\",\"property\",\"class\",\"rows\"],[[\"helper\",[\"t\"],[\"incident.labels.description\"],null],\"description\",\"required col-sm-12 incident-description\",3]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canManageIncident\"]]],null,5]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],10]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/incident/edit/template.hbs" } });
});
define('hospitalrun/incident/index/controller', ['exports', 'hospitalrun/controllers/abstract-paged-controller', 'ember', 'hospitalrun/mixins/filter-list', 'hospitalrun/mixins/user-session'], function (exports, _hospitalrunControllersAbstractPagedController, _ember, _hospitalrunMixinsFilterList, _hospitalrunMixinsUserSession) {
  var computed = _ember['default'].computed;
  var alias = _ember['default'].computed.alias;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _hospitalrunControllersAbstractPagedController['default'].extend(_hospitalrunMixinsFilterList['default'], _hospitalrunMixinsUserSession['default'], {
    addPermission: 'add_incident',
    deletePermission: 'delete_incident',
    startKey: [],

    incidentController: inject.controller('incident'),
    departmentNames: alias('incidentController.incidentDepartmentList.value'),

    categoryItems: computed('model.@each.categoryItem', function () {
      return this._getUniqueValues('categoryItem');
    }),

    categoryNames: computed('model.@each.categoryName', function () {
      return this._getUniqueValues('categoryName');
    }),

    statusList: computed('model.@each.localizedStatus', function () {
      return this._getUniqueValues('localizedStatus');
    }),

    filteredIncidents: computed('model.[]', 'filterBy', 'filterValue', function () {
      var filterBy = get(this, 'filterBy');
      var filterValue = get(this, 'filterValue');
      var incidents = get(this, 'model');
      return this.filterList(incidents, filterBy, filterValue);
    }),

    sortedIncidents: computed('filteredIncidents', 'sortByKey', 'sortByDesc', function () {
      var filteredList = get(this, 'filteredIncidents');
      return this.sortFilteredList(filteredList);
    }),

    _getUniqueValues: function _getUniqueValues(attribute) {
      var uniqueValues = get(this, 'model').map(function (incident) {
        return get(incident, attribute);
      }).uniq();
      return uniqueValues.filter(function (value) {
        return !isEmpty(value);
      });
    },

    actions: {
      showDeleteIncident: function showDeleteIncident(incident) {
        this.send('openModal', 'incident.delete', incident);
      }
    }
  });
});
define('hospitalrun/incident/index/route', ['exports', 'hospitalrun/routes/abstract-index-route', 'hospitalrun/mixins/user-session', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractIndexRoute, _hospitalrunMixinsUserSession, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend(_hospitalrunMixinsUserSession['default'], {
    editReturn: 'incident.index',
    itemsPerPage: null, // Fetch all incidents as one page
    modelName: 'incident',
    pageTitle: (0, _emberI18n.translationMacro)('incident.titles.incidents'),

    _getStartKeyFromItem: function _getStartKeyFromItem(item) {
      var id = this._getPouchIdFromItem(item);
      return [item.get('reportedBy'), id];
    },

    _modelQueryParams: function _modelQueryParams() {
      var maxId = this._getMaxPouchId();
      var currentUser = this.getUserName(true);
      var queryParams = {
        mapReduce: 'open_incidents_by_user'
      };
      if (!this.currentUserCan('manage_incidents')) {
        queryParams.options = {
          startkey: [currentUser, null],
          endkey: [currentUser, maxId]
        };
      }
      return queryParams;
    }

  });
});
define("hospitalrun/incident/index/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "2kjrShWl", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]],13]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newItem\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.messages.createNew\"],null],false],[\"close-element\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-info\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"t\"],[\"incident.messages.noIncidents\"],null],false],[\"text\",\" \"],[\"block\",[\"if\"],[[\"get\",[\"canAdd\"]]],null,0],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"\\n                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteIncident\",[\"get\",[\"incident\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"incident.buttons.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"incident\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.buttons.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n              \"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAdd\"]]],null,3],[\"text\",\" \"],[\"block\",[\"if\"],[[\"get\",[\"canDelete\"]]],null,2],[\"text\",\"            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"incident-row\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"incident\"]]]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"incident-date\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"incident\",\"dateOfIncident\"]]],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"incident-department\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"incident\",\"department\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"incident-category\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"incident\",\"categoryName\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"incident-category-item\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"incident\",\"categoryItem\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"incident-status\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"incident\",\"localizedStatus\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,4],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"incident\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.status\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.categoryItem\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.category\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.department\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.incidentDate\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table incident-listing\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\",\"filterBy\",\"filteredBy\",\"filterType\"],[\"dateOfIncident\",[\"get\",[\"sortByDesc\"]],[\"get\",[\"sortByKey\"]],\"dateForFilter\",[\"get\",[\"filteredBy\"]],\"date\"]],11],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\",\"filterBy\",\"filteredBy\",\"filterType\",\"filterValues\"],[\"department\",[\"get\",[\"sortByDesc\"]],[\"get\",[\"sortByKey\"]],\"department\",[\"get\",[\"filteredBy\"]],\"list\",[\"get\",[\"departmentNames\"]]]],10],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\",\"filterBy\",\"filteredBy\",\"filterType\",\"filterValues\"],[\"categoryName\",[\"get\",[\"sortByDesc\"]],[\"get\",[\"sortByKey\"]],\"categoryName\",[\"get\",[\"filteredBy\"]],\"list\",[\"get\",[\"categoryNames\"]]]],9],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\",\"filterBy\",\"filteredBy\",\"filterType\",\"filterValues\"],[\"categoryItem\",[\"get\",[\"sortByDesc\"]],[\"get\",[\"sortByKey\"]],\"categoryItem\",[\"get\",[\"filteredBy\"]],\"list\",[\"get\",[\"categoryItems\"]]]],8],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\",\"filterBy\",\"filteredBy\",\"filterType\",\"filterValues\"],[\"localizedStatus\",[\"get\",[\"sortByDesc\"]],[\"get\",[\"sortByKey\"]],\"localizedStatus\",[\"get\",[\"filteredBy\"]],\"list\",[\"get\",[\"statusList\"]]]],7],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,6],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"sortedIncidents\"]]],null,5],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"hasRecords\"]]],null,12,1]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/incident/index/template.hbs" } });
});
define('hospitalrun/incident/note/delete/controller', ['exports', 'hospitalrun/controllers/abstract-delete-controller', 'ember', 'ember-i18n'], function (exports, _hospitalrunControllersAbstractDeleteController, _ember, _emberI18n) {
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  exports['default'] = _hospitalrunControllersAbstractDeleteController['default'].extend({
    afterDeleteAction: 'notifyNoteDelete',
    editController: inject.controller('incident/edit'),

    title: (0, _emberI18n.translationMacro)('incident.titles.deleteNote'),

    actions: {
      notifyNoteDelete: function notifyNoteDelete() {
        get(this, 'editController').send('deleteNote', get(this, 'model'));
        this.send('closeModal');
      }
    }
  });
});
define("hospitalrun/incident/note/delete/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "b19yNOlb", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-warning-sign\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"t\"],[\"messages.delete_singular\"],[[\"name\"],[[\"helper\",[\"t\"],[\"models.note.names.singular\"],null]]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/incident/note/delete/template.hbs" } });
});
define('hospitalrun/incident/note/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember'], function (exports, _hospitalrunControllersAbstractEditController, _ember) {
  var computed = _ember['default'].computed;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var RSVP = _ember['default'].RSVP;
  var set = _ember['default'].set;
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend({
    cancelAction: 'closeModal',
    newNote: false,
    updateCapability: 'manage_incidents',

    editController: inject.controller('incident/edit'),

    title: computed('model.isNew', function () {
      var i18n = get(this, 'i18n');
      var isNew = get(this, 'model.isNew');
      if (isNew) {
        return i18n.t('incident.titles.addNote');
      }
      return i18n.t('incident.titles.editNote');
    }),

    afterUpdate: function afterUpdate(note) {
      if (get(this, 'newNote')) {
        get(this, 'editController').send('addNote', note);
      } else {
        this.send('closeModal');
      }
    },

    beforeUpdate: function beforeUpdate() {
      set(this, 'newNote', get(this, 'model.isNew'));
      return RSVP.resolve();
    }

  });
});
define("hospitalrun/incident/note/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "Ha08JwR2", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\",\"format\",\"showTime\"],[\"dateRecorded\",[\"helper\",[\"t\"],[\"incident.labels.dateRecorded\"],null],\"col-sm-6\",\"l h:mm A\",true]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"property\",\"label\",\"class\"],[\"description\",[\"helper\",[\"t\"],[\"incident.labels.note\"],null],\"col-sm-12 note-description\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/incident/note/edit/template.hbs" } });
});
define('hospitalrun/incident/reports/controller', ['exports', 'hospitalrun/controllers/abstract-report-controller', 'ember', 'hospitalrun/mixins/number-format', 'hospitalrun/mixins/user-session', 'moment'], function (exports, _hospitalrunControllersAbstractReportController, _ember, _hospitalrunMixinsNumberFormat, _hospitalrunMixinsUserSession, _moment) {
  var get = _ember['default'].get;
  var computed = _ember['default'].computed;
  var isEmpty = _ember['default'].isEmpty;
  var RSVP = _ember['default'].RSVP;
  exports['default'] = _hospitalrunControllersAbstractReportController['default'].extend(_hospitalrunMixinsUserSession['default'], _hospitalrunMixinsNumberFormat['default'], {
    reportType: 'department',

    canGenerateReport: computed(function () {
      return this.currentUserCan('generate_incident_report');
    }),

    departmentReportColumns: computed(function () {
      var i18n = get(this, 'i18n');
      return {
        department: {
          label: i18n.t('incident.labels.department'),
          include: true,
          property: 'type' // property type because in _addReportRow function looks for column name with value as type
        },
        total: {
          label: i18n.t('incident.labels.total'),
          include: true,
          property: 'total',
          format: '_numberFormat'
        }
      };
    }),
    incidentCategoryReportColumns: computed(function () {
      var i18n = get(this, 'i18n');
      return {
        incidentCategory: {
          label: i18n.t('incident.labels.category'),
          include: true,
          property: 'type'
        },
        total: {
          label: i18n.t('incident.labels.total'),
          include: true,
          property: 'total',
          format: '_numberFormat'
        }
      };
    }),

    reportTypes: computed(function () {
      var i18n = get(this, 'i18n');
      return [{
        name: i18n.t('incident.titles.incidentsByDepartment'),
        value: 'department'
      }, {
        name: i18n.t('incident.titles.incidentsByCategory'),
        value: 'incidentCategory'
      }];
    }),

    /**
     * Find Incidents by the specified dates and the incidents's date.
     */
    _findIncidentsByDate: function _findIncidentsByDate() {
      var filterEndDate = get(this, 'endDate');
      var filterStartDate = get(this, 'startDate');
      var findParams = {
        options: {},
        mapReduce: 'incident_by_date'
      };
      var maxValue = get(this, 'maxValue');
      return new RSVP.Promise((function (resolve, reject) {
        if (isEmpty(filterStartDate)) {
          reject();
        }
        findParams.options.startkey = [filterStartDate.getTime(), null];

        if (!isEmpty(filterEndDate)) {
          filterEndDate = (0, _moment['default'])(filterEndDate).endOf('day').toDate();
          findParams.options.endkey = [filterEndDate.getTime(), maxValue];
        }
        return this.store.query('incident', findParams).then(resolve, reject);
      }).bind(this));
    },

    _generateByDepartmentOrByIncidentCategoryReport: function _generateByDepartmentOrByIncidentCategoryReport(incidents, reportType) {
      var reportColumns = undefined,
          reportProperty = undefined;
      if (reportType === 'department') {
        reportColumns = get(this, 'departmentReportColumns');
        reportProperty = 'department';
      } else {
        reportColumns = get(this, 'incidentCategoryReportColumns');
        reportProperty = 'categoryName';
      }
      this._addRowsByType(incidents, reportProperty, 'Total incidents: ', reportColumns);
      this._finishReport(reportColumns);
    },

    /**
     * Given a list of records, organize and total by them by type and then add them to the report.
     * @param records {Array} list of records to total.
     * @param typeField {String} the field in the records containing the type.
     * @param totalLabel {String} the label for the grand total.
     * @param reportColumns
     */
    _addRowsByType: function _addRowsByType(records, typeField, totalLabel, reportColumns) {
      var types = this._totalByType(records, typeField, totalLabel);
      types.forEach((function (type) {
        this._addReportRow(type, true, reportColumns);
      }).bind(this));
    },

    /**
     * Given a list of records, total them by type and also add a grand total.
     * @param records {Array} list of records to total.
     * @param typeField {String} the field in the records containing the type.
     * @param totalLabel {String} the label for the grand total.
     * @param reportColumns
     */
    _totalByType: function _totalByType(records, typeField, totalLabel) {
      var total = 0;
      var types = [];
      records.forEach(function (record) {
        var type = record.get(typeField);
        var typeObject = undefined;
        if (!isEmpty(type)) {
          typeObject = types.findBy('type', type);
          if (isEmpty(typeObject)) {
            typeObject = {
              type: type,
              total: 0,
              records: []
            };
            types.push(typeObject);
          }
          typeObject.total++;
          typeObject.records.push(record);
          total++;
        }
      });
      types = types.sortBy('type');
      types.push({ type: totalLabel, total: total });
      return types;
    },

    actions: {
      generateReport: function generateReport() {
        var _this = this;

        var reportRows = get(this, 'reportRows');
        var reportType = get(this, 'reportType');
        reportRows.clear();
        this.showProgressModal();
        switch (reportType) {
          case 'department':
          case 'incidentCategory':
            {
              this._findIncidentsByDate().then(function (incidents) {
                _this._generateByDepartmentOrByIncidentCategoryReport(incidents, reportType);
              })['catch'](function (ex) {
                console.log('Error:', ex);
                _this.closeProgressModal();
              });
              break;
            }
        }
      }
    }
  });
});
define('hospitalrun/incident/reports/route', ['exports', 'hospitalrun/routes/abstract-index-route', 'ember'], function (exports, _hospitalrunRoutesAbstractIndexRoute, _ember) {
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend({
    pageTitle: 'Incident Report',

    // No model for reports; data gets retrieved when report is run.
    model: function model() {
      return _ember['default'].RSVP.resolve(_ember['default'].Object.create({}));
    }

  });
});
define("hospitalrun/incident/reports/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "WbfoMb69", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canGenerateReport\"]]],null,5],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showReportResults\"]]],null,3]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"get\",[\"subrow\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"subrow\"]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"row\"]]],null,0],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"row\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"get\",[\"header\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"header\"]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"reportTitle\"]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"reportHeaders\"]]],null,2],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"reportRows\"]]],null,1],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"a\",[]],[\"dynamic-attr\",\"href\",[\"unknown\",[\"csvExport\"]],null],[\"static-attr\",\"target\",\"_blank\"],[\"dynamic-attr\",\"download\",[\"concat\",[[\"unknown\",[\"reportTitle\"]],\".csv\"]]],[\"static-attr\",\"class\",\"btn btn-default\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.buttons.export\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"startDate\",[\"helper\",[\"t\"],[\"incident.labels.startDate\"],null],\"col-sm-4\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"endDate\",[\"helper\",[\"t\"],[\"incident.labels.endDate\"],null],\"col-sm-4\"]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"static-attr\",\"data-test-selector\",\"select-report-type\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-xs-6\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"static-attr\",\"for\",\"report-type\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.labels.reportType\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"select-list\"],null,[[\"action\",\"class\",\"content\",\"id\",\"optionValuePath\",\"optionLabelPath\",\"value\"],[[\"helper\",[\"action\"],[[\"get\",[null]],[\"helper\",[\"mut\"],[[\"get\",[\"reportType\"]]],null]],null],\"form-control\",[\"get\",[\"reportTypes\"]],\"report-type\",\"value\",\"name\",[\"get\",[\"reportType\"]]]]],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[null]],false]],4],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"generateReport\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"incident.buttons.generateRep\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/incident/reports/template.hbs" } });
});
define('hospitalrun/incident/route', ['exports', 'hospitalrun/routes/abstract-module-route', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractModuleRoute, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractModuleRoute['default'].extend({
    addCapability: 'add_incident',
    additionalModels: [{
      name: 'incidentDepartmentList',
      findArgs: ['lookup', 'incident_departments']
    }, {
      name: 'incidentCategoryList',
      findArgs: ['inc-category']
    }],
    moduleName: 'incident',
    newButtonText: (0, _emberI18n.translationMacro)('incident.buttons.newIncident'),
    sectionTitle: (0, _emberI18n.translationMacro)('incident.titles.incidents')
  });
});
define('hospitalrun/initializers/app-version', ['exports', 'ember-cli-app-version/initializer-factory', 'hospitalrun/config/environment'], function (exports, _emberCliAppVersionInitializerFactory, _hospitalrunConfigEnvironment) {
  var _config$APP = _hospitalrunConfigEnvironment['default'].APP;
  var name = _config$APP.name;
  var version = _config$APP.version;
  exports['default'] = {
    name: 'App Version',
    initialize: (0, _emberCliAppVersionInitializerFactory['default'])(name, version)
  };
});
define('hospitalrun/initializers/container-debug-adapter', ['exports', 'ember-resolver/container-debug-adapter'], function (exports, _emberResolverContainerDebugAdapter) {
  exports['default'] = {
    name: 'container-debug-adapter',

    initialize: function initialize() {
      var app = arguments[1] || arguments[0];

      app.register('container-debug-adapter:main', _emberResolverContainerDebugAdapter['default']);
      app.inject('container-debug-adapter:main', 'namespace', 'application:main');
    }
  };
});
define('hospitalrun/initializers/data-adapter', ['exports', 'ember'], function (exports, _ember) {

  /*
    This initializer is here to keep backwards compatibility with code depending
    on the `data-adapter` initializer (before Ember Data was an addon).
  
    Should be removed for Ember Data 3.x
  */

  exports['default'] = {
    name: 'data-adapter',
    before: 'store',
    initialize: _ember['default'].K
  };
});
define('hospitalrun/initializers/ember-concurrency', ['exports', 'ember-concurrency'], function (exports, _emberConcurrency) {
  exports['default'] = {
    name: 'ember-concurrency',
    initialize: function initialize() {}
  };
});
// This initializer exists only to make sure that the following
// imports happen before the app boots.
define('hospitalrun/initializers/ember-data', ['exports', 'ember-data/setup-container', 'ember-data/-private/core'], function (exports, _emberDataSetupContainer, _emberDataPrivateCore) {

  /*
  
    This code initializes Ember-Data onto an Ember application.
  
    If an Ember.js developer defines a subclass of DS.Store on their application,
    as `App.StoreService` (or via a module system that resolves to `service:store`)
    this code will automatically instantiate it and make it available on the
    router.
  
    Additionally, after an application's controllers have been injected, they will
    each have the store made available to them.
  
    For example, imagine an Ember.js application with the following classes:
  
    App.StoreService = DS.Store.extend({
      adapter: 'custom'
    });
  
    App.PostsController = Ember.Controller.extend({
      // ...
    });
  
    When the application is initialized, `App.ApplicationStore` will automatically be
    instantiated, and the instance of `App.PostsController` will have its `store`
    property set to that instance.
  
    Note that this code will only be run if the `ember-application` package is
    loaded. If Ember Data is being used in an environment other than a
    typical application (e.g., node.js where only `ember-runtime` is available),
    this code will be ignored.
  */

  exports['default'] = {
    name: 'ember-data',
    initialize: _emberDataSetupContainer['default']
  };
});
define('hospitalrun/initializers/ember-i18n', ['exports', 'ember-i18n/initializers/ember-i18n'], function (exports, _emberI18nInitializersEmberI18n) {
  exports['default'] = _emberI18nInitializersEmberI18n['default'];
});
define('hospitalrun/initializers/ember-keyboard-first-responder-inputs', ['exports', 'ember-keyboard/initializers/ember-keyboard-first-responder-inputs'], function (exports, _emberKeyboardInitializersEmberKeyboardFirstResponderInputs) {
  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _emberKeyboardInitializersEmberKeyboardFirstResponderInputs['default'];
    }
  });
  Object.defineProperty(exports, 'initialize', {
    enumerable: true,
    get: function get() {
      return _emberKeyboardInitializersEmberKeyboardFirstResponderInputs.initialize;
    }
  });
});
define('hospitalrun/initializers/ember-simple-auth', ['exports', 'hospitalrun/config/environment', 'ember-simple-auth/configuration', 'ember-simple-auth/initializers/setup-session', 'ember-simple-auth/initializers/setup-session-service'], function (exports, _hospitalrunConfigEnvironment, _emberSimpleAuthConfiguration, _emberSimpleAuthInitializersSetupSession, _emberSimpleAuthInitializersSetupSessionService) {
  exports['default'] = {
    name: 'ember-simple-auth',

    initialize: function initialize(registry) {
      var config = _hospitalrunConfigEnvironment['default']['ember-simple-auth'] || {};
      config.baseURL = _hospitalrunConfigEnvironment['default'].rootURL || _hospitalrunConfigEnvironment['default'].baseURL;
      _emberSimpleAuthConfiguration['default'].load(config);

      (0, _emberSimpleAuthInitializersSetupSession['default'])(registry);
      (0, _emberSimpleAuthInitializersSetupSessionService['default'])(registry);
    }
  };
});
define('hospitalrun/initializers/export-application-global', ['exports', 'ember', 'hospitalrun/config/environment'], function (exports, _ember, _hospitalrunConfigEnvironment) {
  exports.initialize = initialize;

  function initialize() {
    var application = arguments[1] || arguments[0];
    if (_hospitalrunConfigEnvironment['default'].exportApplicationGlobal !== false) {
      var theGlobal;
      if (typeof window !== 'undefined') {
        theGlobal = window;
      } else if (typeof global !== 'undefined') {
        theGlobal = global;
      } else if (typeof self !== 'undefined') {
        theGlobal = self;
      } else {
        // no reasonable global, just bail
        return;
      }

      var value = _hospitalrunConfigEnvironment['default'].exportApplicationGlobal;
      var globalName;

      if (typeof value === 'string') {
        globalName = value;
      } else {
        globalName = _ember['default'].String.classify(_hospitalrunConfigEnvironment['default'].modulePrefix);
      }

      if (!theGlobal[globalName]) {
        theGlobal[globalName] = application;

        application.reopen({
          willDestroy: function willDestroy() {
            this._super.apply(this, arguments);
            delete theGlobal[globalName];
          }
        });
      }
    }
  }

  exports['default'] = {
    name: 'export-application-global',

    initialize: initialize
  };
});
define('hospitalrun/initializers/i18n', ['exports'], function (exports) {
  exports['default'] = {
    name: 'i18n',

    after: 'ember-i18n',

    initialize: function initialize(app) {
      app.inject('route', 'i18n', 'service:i18n');
      app.inject('controller', 'i18n', 'service:i18n');
      app.inject('mixin', 'i18n', 'service:i18n');
      app.inject('model', 'i18n', 'service:i18n');
    }
  };
});
define('hospitalrun/initializers/injectStore', ['exports', 'ember'], function (exports, _ember) {

  /*
    This initializer is here to keep backwards compatibility with code depending
    on the `injectStore` initializer (before Ember Data was an addon).
  
    Should be removed for Ember Data 3.x
  */

  exports['default'] = {
    name: 'injectStore',
    before: 'store',
    initialize: _ember['default'].K
  };
});
define('hospitalrun/initializers/store', ['exports', 'ember'], function (exports, _ember) {

  /*
    This initializer is here to keep backwards compatibility with code depending
    on the `store` initializer (before Ember Data was an addon).
  
    Should be removed for Ember Data 3.x
  */

  exports['default'] = {
    name: 'store',
    after: 'ember-data',
    initialize: _ember['default'].K
  };
});
define('hospitalrun/initializers/transforms', ['exports', 'ember'], function (exports, _ember) {

  /*
    This initializer is here to keep backwards compatibility with code depending
    on the `transforms` initializer (before Ember Data was an addon).
  
    Should be removed for Ember Data 3.x
  */

  exports['default'] = {
    name: 'transforms',
    before: 'store',
    initialize: _ember['default'].K
  };
});
define('hospitalrun/initializers/truth-helpers', ['exports', 'ember', 'ember-truth-helpers/utils/register-helper', 'ember-truth-helpers/helpers/and', 'ember-truth-helpers/helpers/or', 'ember-truth-helpers/helpers/equal', 'ember-truth-helpers/helpers/not', 'ember-truth-helpers/helpers/is-array', 'ember-truth-helpers/helpers/not-equal', 'ember-truth-helpers/helpers/gt', 'ember-truth-helpers/helpers/gte', 'ember-truth-helpers/helpers/lt', 'ember-truth-helpers/helpers/lte'], function (exports, _ember, _emberTruthHelpersUtilsRegisterHelper, _emberTruthHelpersHelpersAnd, _emberTruthHelpersHelpersOr, _emberTruthHelpersHelpersEqual, _emberTruthHelpersHelpersNot, _emberTruthHelpersHelpersIsArray, _emberTruthHelpersHelpersNotEqual, _emberTruthHelpersHelpersGt, _emberTruthHelpersHelpersGte, _emberTruthHelpersHelpersLt, _emberTruthHelpersHelpersLte) {
  exports.initialize = initialize;

  function initialize() /* container, application */{

    // Do not register helpers from Ember 1.13 onwards, starting from 1.13 they
    // will be auto-discovered.
    if (_ember['default'].Helper) {
      return;
    }

    (0, _emberTruthHelpersUtilsRegisterHelper.registerHelper)('and', _emberTruthHelpersHelpersAnd.andHelper);
    (0, _emberTruthHelpersUtilsRegisterHelper.registerHelper)('or', _emberTruthHelpersHelpersOr.orHelper);
    (0, _emberTruthHelpersUtilsRegisterHelper.registerHelper)('eq', _emberTruthHelpersHelpersEqual.equalHelper);
    (0, _emberTruthHelpersUtilsRegisterHelper.registerHelper)('not', _emberTruthHelpersHelpersNot.notHelper);
    (0, _emberTruthHelpersUtilsRegisterHelper.registerHelper)('is-array', _emberTruthHelpersHelpersIsArray.isArrayHelper);
    (0, _emberTruthHelpersUtilsRegisterHelper.registerHelper)('not-eq', _emberTruthHelpersHelpersNotEqual.notEqualHelper);
    (0, _emberTruthHelpersUtilsRegisterHelper.registerHelper)('gt', _emberTruthHelpersHelpersGt.gtHelper);
    (0, _emberTruthHelpersUtilsRegisterHelper.registerHelper)('gte', _emberTruthHelpersHelpersGte.gteHelper);
    (0, _emberTruthHelpersUtilsRegisterHelper.registerHelper)('lt', _emberTruthHelpersHelpersLt.ltHelper);
    (0, _emberTruthHelpersUtilsRegisterHelper.registerHelper)('lte', _emberTruthHelpersHelpersLte.lteHelper);
  }

  exports['default'] = {
    name: 'truth-helpers',
    initialize: initialize
  };
});
define("hospitalrun/instance-initializers/ember-data", ["exports", "ember-data/-private/instance-initializers/initialize-store-service"], function (exports, _emberDataPrivateInstanceInitializersInitializeStoreService) {
  exports["default"] = {
    name: "ember-data",
    initialize: _emberDataPrivateInstanceInitializersInitializeStoreService["default"]
  };
});
define('hospitalrun/instance-initializers/ember-i18n', ['exports', 'ember-i18n/instance-initializers/ember-i18n'], function (exports, _emberI18nInstanceInitializersEmberI18n) {
  exports['default'] = _emberI18nInstanceInitializersEmberI18n['default'];
});
define('hospitalrun/instance-initializers/ember-simple-auth', ['exports', 'ember-simple-auth/instance-initializers/setup-session-restoration'], function (exports, _emberSimpleAuthInstanceInitializersSetupSessionRestoration) {
  exports['default'] = {
    name: 'ember-simple-auth',

    initialize: function initialize(instance) {
      (0, _emberSimpleAuthInstanceInitializersSetupSessionRestoration['default'])(instance);
    }
  };
});
define('hospitalrun/inventory/adjust/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'hospitalrun/mixins/inventory-adjustment-types', 'ember', 'ember-i18n'], function (exports, _hospitalrunControllersAbstractEditController, _hospitalrunMixinsInventoryAdjustmentTypes, _ember, _emberI18n) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsInventoryAdjustmentTypes['default'], {
    inventoryController: _ember['default'].inject.controller('inventory'),

    expenseAccountList: _ember['default'].computed.alias('inventoryController.expenseAccountList'),

    title: (0, _emberI18n.translationMacro)('inventory.titles.adjustment'),

    transactionTypeChanged: (function () {
      _ember['default'].run.once(this, function () {
        this.get('model').validate()['catch'](_ember['default'].K);
      });
    }).observes('transactionType'),

    updateButtonText: (function () {
      var transactionType = this.get('model.transactionType');
      var adjustmentType = this.get('adjustmentTypes').findBy('type', transactionType);
      return adjustmentType.name;
    }).property('model.transactionType'),

    updateButtonAction: 'adjust',

    updateCapability: 'adjust_inventory_location',

    actions: {
      cancel: function cancel() {
        this.send('closeModal');
      },

      adjust: function adjust() {
        this.send('adjustItems', this.get('model'), true);
      }
    }
  });
});
define("hospitalrun/inventory/adjust/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "Bedatsd4", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.item\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"adjustmentItem\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.adjustmentFor\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"locationName\"]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.currentQuantity\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"quantity\"]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\",\"optionValuePath\",\"optionLabelPath\"],[\"col-sm-4\",[\"helper\",[\"t\"],[\"inventory.labels.adjustmentType\"],null],\"transactionType\",[\"get\",[\"adjustmentTypes\"]],\"type\",\"name\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"property\",\"label\",\"class\"],[\"adjustmentQuantity\",[\"helper\",[\"t\"],[\"labels.quantity\"],null],\"col-sm-3 required\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"label\",\"property\",\"rows\"],[[\"helper\",[\"t\"],[\"inventory.labels.reason\"],null],\"reason\",3]]],false],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"dateCompleted\",[\"helper\",[\"t\"],[\"inventory.labels.adjustmentDate\"],null],\"col-sm-4 required\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"class\"],[\"expenseAccount\",[\"helper\",[\"t\"],[\"inventory.labels.expense\"],null],[\"get\",[\"expenseAccountList\"]],[\"get\",[\"model\",\"expenseAccount\"]],\"col-sm-8\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/inventory/adjust/template.hbs" } });
});
define('hospitalrun/inventory/barcode/controller', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Controller.extend({
    selectedPrinter: null,

    barcodeUri: (function () {
      var id = this.get('model.id');
      var name = this.get('model.name');

      /* eslint new-cap: ['error', { 'capIsNew': false }]  */
      return _ember['default'].$(document).JsBarcode(id, {
        width: 1,
        height: 20,
        fontSize: 10,
        displayValue: name,
        returnUri: true
      });
    }).property('model.id', 'model.name'),

    printers: (function () {
      return dymo.label.framework.getTapePrinters();
    }).property(),

    havePrinters: (function () {
      var printers = this.get('printers');
      if (printers.length > 0) {
        return true;
      } else {
        return false;
      }
    }).property('printers'),

    singlePrinter: (function () {
      var printers = this.get('printers');
      if (printers.length === 1) {
        return true;
      } else {
        return false;
      }
    }).property('printers'),

    actions: {
      print: function print() {
        var barcodeUri = this.get('barcodeUri');
        var selectedPrinter = this.get('selectedPrinter');
        if (!selectedPrinter) {
          selectedPrinter = this.get('printers')[0].name;
        }
        _ember['default'].$.get('/dymo/BarcodeAsImage.label', function (labelXml) {
          var barcodeAsImageLabel = dymo.label.framework.openLabelXml(labelXml);
          var pngBase64 = barcodeUri.substr('data:image/png;base64,'.length);
          barcodeAsImageLabel.setObjectText('Image', pngBase64);
          barcodeAsImageLabel.print(selectedPrinter);
        }, 'text');
      }
    }

  });
});
define('hospitalrun/inventory/barcode/route', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Route.extend({
    model: function model(params) {
      return this.store.find('inventory', params.inventory_id);
    }

  });
});
define("hospitalrun/inventory/barcode/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "PD6MlfyD", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-default\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"img\",[]],[\"dynamic-attr\",\"src\",[\"unknown\",[\"barcodeUri\"]],null],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\\n\"],[\"block\",[\"if\"],[[\"get\",[\"havePrinters\"]]],null,1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"for\",\"printerSelect\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.printer\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"select-list\"],null,[[\"content\",\"optionLabelPath\",\"optionValuePath\",\"value\",\"class\",\"action\",\"id\"],[[\"get\",[\"printers\"]],\"name\",\"name\",[\"get\",[\"selectedPrinter\"]],\"form-control\",[\"helper\",[\"action\"],[[\"get\",[null]],[\"helper\",[\"mut\"],[[\"get\",[\"selectedPrinter\"]]],null]],null],\"printerSelect\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.printBarcode\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"unless\"],[[\"get\",[\"singlePrinter\"]]],null,0],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"print\"]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\" glyphicon glyphicon-print\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.print\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/inventory/barcode/template.hbs" } });
});
define('hospitalrun/inventory/batch/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'hospitalrun/mixins/inventory-id', 'hospitalrun/mixins/inventory-locations', 'ember', 'ember-i18n'], function (exports, _hospitalrunControllersAbstractEditController, _hospitalrunMixinsInventoryId, _hospitalrunMixinsInventoryLocations, _ember, _emberI18n) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsInventoryId['default'], _hospitalrunMixinsInventoryLocations['default'], {
    doingUpdate: false,
    inventoryController: _ember['default'].inject.controller('inventory'),
    inventoryItems: null,
    warehouseList: _ember['default'].computed.alias('inventoryController.warehouseList'),
    aisleLocationList: _ember['default'].computed.alias('inventoryController.aisleLocationList'),
    vendorList: _ember['default'].computed.alias('inventoryController.vendorList'),
    purchaseAttributes: ['expirationDate', 'inventoryItem', 'lotNumber', 'purchaseCost', 'quantity', 'vendorItemNo'],

    inventoryList: (function () {
      var inventoryItems = this.get('inventoryItems');
      if (!_ember['default'].isEmpty(inventoryItems)) {
        var mappedItems = inventoryItems.map(function (item) {
          return item.doc;
        });
        return mappedItems;
      }
    }).property('inventoryItems.[]'),

    lookupListsToUpdate: [{
      name: 'aisleLocationList', // Name of property containing lookup list
      property: 'model.aisleLocation', // Corresponding property on model that potentially contains a new value to add to the list
      id: 'aisle_location_list' // Id of the lookup list to update
    }, {
      name: 'vendorList', // Name of property containing lookup list
      property: 'model.vendor', // Corresponding property on model that potentially contains a new value to add to the list
      id: 'vendor_list' // Id of the lookup list to update
    }, {
      name: 'warehouseList', // Name of property containing lookup list
      property: 'model.location', // Corresponding property on model that potentially contains a new value to add to the list
      id: 'warehouse_list' // Id of the lookup list to update
    }],

    showDistributionUnit: (function () {
      return this._haveValidInventoryItem();
    }).property('model.inventoryItemTypeAhead', 'model.inventoryItem'),

    showInvoiceItems: (function () {
      var invoiceItems = this.get('model.invoiceItems');
      return !_ember['default'].isEmpty(invoiceItems);
    }).property('model.invoiceItems.[]'),

    totalReceived: (function () {
      var invoiceItems = this.get('model.invoiceItems');
      var total = 0;
      if (!_ember['default'].isEmpty('invoiceItems')) {
        total = invoiceItems.reduce(function (previousValue, item) {
          return previousValue + Number(item.get('purchaseCost'));
        }, total);
      }
      var purchaseCost = this.get('model.purchaseCost');
      if (this.get('model.isValid') && !_ember['default'].isEmpty(purchaseCost)) {
        total += Number(purchaseCost);
      }
      return total;
    }).property('model.invoiceItems.[].purchaseCost', 'model.isValid', 'model.purchaseCost'),

    updateButtonText: (0, _emberI18n.translationMacro)('inventory.labels.save'),

    updateCapability: 'add_inventory_item',

    _addNewInventoryItem: function _addNewInventoryItem() {
      this.generateId().then((function (inventoryId) {
        var inventoryItem = this.store.createRecord('inventory', {
          id: inventoryId,
          name: this.get('model.inventoryItemTypeAhead'),
          quantity: 0, // Needed for validation purposes
          skipSavePurchase: true
        });
        this.send('openModal', 'inventory.quick-add', inventoryItem);
      }).bind(this));
    },

    _addInventoryItem: function _addInventoryItem() {
      var model = this.get('model');
      var inventoryItemTypeAhead = this.get('model.inventoryItemTypeAhead');
      var purchaseCost = this.get('model.purchaseCost');
      var quantity = this.get('model.quantity');
      return model.validate().then((function () {
        if (this.get('model.isValid') && !_ember['default'].isEmpty(inventoryItemTypeAhead) && !_ember['default'].isEmpty(quantity) && !_ember['default'].isEmpty(purchaseCost)) {
          if (this._haveValidInventoryItem()) {
            this._addInvoiceItem();
          } else {
            this._addNewInventoryItem();
            return true;
          }
        } else {
          throw Error('invalid');
        }
      }).bind(this))['catch']((function () {
        this.displayAlert(this.get('i18n').t('inventory.titles.warning'), this.get('i18n').t('inventory.messages.warning'));
      }).bind(this));
    },

    _addInvoiceItem: function _addInvoiceItem() {
      var model = this.get('model');
      var invoiceItems = model.get('invoiceItems');
      var itemProperties = model.getProperties(this.get('purchaseAttributes'));
      var invoiceItem = _ember['default'].Object.create(itemProperties);
      invoiceItems.addObject(invoiceItem);
      model.set('expirationDate');
      model.set('inventoryItem');
      model.set('inventoryItemTypeAhead');
      model.set('lotNumber');
      model.set('purchaseCost');
      model.set('quantity');
      model.set('selectedInventoryItem');
      model.set('vendorItemNo');
    },

    _findInventoryItem: function _findInventoryItem(purchase) {
      var invoiceItems = this.get('model.invoiceItems');
      var inventoryId = purchase.get('inventoryItem');
      if (!_ember['default'].isEmpty(inventoryId)) {
        var invoiceItem = invoiceItems.find(function (item) {
          return item.get('inventoryItem.id') === inventoryId;
        }, this);
        if (!_ember['default'].isEmpty(invoiceItem)) {
          return invoiceItem.get('inventoryItem');
        }
      }
    },

    _haveValidInventoryItem: function _haveValidInventoryItem() {
      var inventoryItemTypeAhead = this.get('model.inventoryItemTypeAhead');
      var inventoryItem = this.get('model.inventoryItem');
      if (_ember['default'].isEmpty(inventoryItemTypeAhead) || _ember['default'].isEmpty(inventoryItem)) {
        return false;
      } else {
        var inventoryItemName = inventoryItem.get('name');
        var typeAheadName = inventoryItemTypeAhead.substr(0, inventoryItemName.length);
        if (typeAheadName !== inventoryItemName) {
          return false;
        } else {
          return true;
        }
      }
    },

    _savePurchases: function _savePurchases() {
      var model = this.get('model');
      var purchaseDefaults = model.getProperties(['dateReceived', 'vendor', 'invoiceNo', 'location', 'aisleLocation', 'giftInKind']);
      var invoiceItems = model.get('invoiceItems');
      var inventoryPurchase = undefined;
      var savePromises = [];
      invoiceItems.forEach((function (invoiceItem) {
        var inventoryItem = invoiceItem.get('inventoryItem');
        var quantity = invoiceItem.get('quantity');
        inventoryPurchase = this.store.createRecord('inv-purchase', purchaseDefaults);
        inventoryPurchase.setProperties(invoiceItem.getProperties(this.get('purchaseAttributes')));
        inventoryPurchase.setProperties({
          distributionUnit: inventoryItem.get('distributionUnit'),
          currentQuantity: quantity,
          originalQuantity: quantity,
          inventoryItem: inventoryItem.get('id')
        });
        savePromises.push(inventoryPurchase.save());
      }).bind(this));
      _ember['default'].RSVP.all(savePromises).then((function (results) {
        var inventorySaves = [];
        var purchasesAdded = [];
        results.forEach((function (newPurchase) {
          var inventoryItem = this._findInventoryItem(newPurchase);
          var purchases = inventoryItem.get('purchases');
          purchases.addObject(newPurchase);
          purchasesAdded.push(this.newPurchaseAdded(inventoryItem, newPurchase));
        }).bind(this));

        _ember['default'].RSVP.all(inventorySaves).then((function () {
          results.forEach((function (newPurchase) {
            var inventoryItem = this._findInventoryItem(newPurchase);
            inventoryItem.updateQuantity();
            inventorySaves.push(inventoryItem.save());
          }).bind(this));
          _ember['default'].RSVP.all(inventorySaves).then((function () {
            this.updateLookupLists();
            this.displayAlert(this.get('i18n').t('inventory.titles.purchaseSaved'), this.get('i18n').t('inventory.messages.purchaseSaved'), 'allItems');
          }).bind(this));
        }).bind(this));
      }).bind(this));
    },

    actions: {
      addInventoryItem: function addInventoryItem() {
        this._addInventoryItem();
      },

      addedNewInventoryItem: function addedNewInventoryItem(inventoryItem) {
        this.set('model.inventoryItem', inventoryItem);
        this._addInvoiceItem();
        this.send('closeModal');
        if (this.get('doingUpdate')) {
          this._savePurchases();
        }
      },

      removeItem: function removeItem(removeInfo) {
        var invoiceItems = this.get('model.invoiceItems');
        var item = removeInfo.itemToRemove;
        invoiceItems.removeObject(item);
        this.send('closeModal');
      },

      showRemoveItem: function showRemoveItem(item) {
        var message = this.get('i18n').t('inventory.messages.removeItem');
        var model = _ember['default'].Object.create({
          itemToRemove: item
        });
        var title = this.get('i18n').t('inventory.titles.removeItem');
        this.displayConfirm(title, message, 'removeItem', model);
      },

      /**
       * Update the model
       */
      update: function update() {
        this.set('doingUpdate', true);
        this._addInventoryItem().then((function (addingNewInventory) {
          if (!addingNewInventory) {
            this._savePurchases();
          }
        }).bind(this));
      }
    }
  });
});
define('hospitalrun/inventory/batch/route', ['exports', 'hospitalrun/inventory/request/route', 'ember', 'ember-i18n'], function (exports, _hospitalrunInventoryRequestRoute, _ember, _emberI18n) {
  exports['default'] = _hospitalrunInventoryRequestRoute['default'].extend({
    editTitle: (0, _emberI18n.translationMacro)('navigation.subnav.inventoryReceived'),
    modelName: 'inventory-batch',
    newTitle: (0, _emberI18n.translationMacro)('navigation.subnav.inventoryReceived'),
    getNewData: function getNewData() {
      return _ember['default'].RSVP.resolve({
        invoiceItems: [],
        dateReceived: new Date()
      });
    },

    actions: {
      addedNewInventoryItem: function addedNewInventoryItem(model) {
        this.controller.send('addedNewInventoryItem', model);
      }
    }
  });
});
define("hospitalrun/inventory/batch/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "9T4fAteu", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],4]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-sm-2\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"unknown\",[\"invoiceItem\",\"inventoryItem\",\"name\"]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-sm-2\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"input-group\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"input\"],null,[[\"class\",\"value\"],[\"form-control\",[\"get\",[\"invoiceItem\",\"quantity\"]]]]],false],[\"text\",\"\\n                \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"input-group-addon\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"append\",[\"unknown\",[\"invoiceItem\",\"inventoryItem\",\"distributionUnit\"]],false],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-sm-2\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"input\"],null,[[\"class\",\"value\"],[\"form-control\",[\"get\",[\"invoiceItem\",\"purchaseCost\"]]]]],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-sm-2\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"input\"],null,[[\"class\",\"value\"],[\"form-control\",[\"get\",[\"invoiceItem\",\"vendorItemNo\"]]]]],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-sm-2\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"input\"],null,[[\"class\",\"value\"],[\"form-control\",[\"get\",[\"invoiceItem\",\"lotNumber\"]]]]],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-sm-2\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"minDate\",\"model\"],[\"expirationDate\",\"now\",[\"get\",[\"invoiceItem\"]]]]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-sm-1\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showRemoveItem\",[\"get\",[\"invoiceItem\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.remove\"],null],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"invoiceItem\"]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"h3\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.invoiceItems\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.name\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.quantity\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.cost\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.itemNumber\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.serialNumber\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.expirationDate\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.action\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"invoiceItems\"]]],null,0],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"h4\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.totalReceived\"],[[\"total\"],[[\"get\",[\"totalReceived\"]]]]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static inventory-distribution-unit\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"inventoryItem\",\"distributionUnit\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"dateReceived\",[\"helper\",[\"t\"],[\"inventory.labels.dateReceived\"],null],\"col-sm-4 required\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"className\"],[\"vendor\",[\"helper\",[\"t\"],[\"inventory.labels.vendor\"],null],[\"get\",[\"vendorList\"]],[\"get\",[\"model\",\"vendor\"]],\"col-sm-4 required test-vendor\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"invoiceNo\",[\"helper\",[\"t\"],[\"inventory.labels.invoiceNumber\"],null],\"col-sm-4 test-invoice-number\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"className\"],[\"location\",[\"helper\",[\"t\"],[\"inventory.labels.location\"],null],[\"get\",[\"warehouseList\"]],[\"get\",[\"model\",\"location\"]],\"col-sm-5\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"className\"],[\"aisleLocation\",[\"helper\",[\"t\"],[\"inventory.labels.aisleLocation\"],null],[\"get\",[\"aisleLocationList\"]],[\"get\",[\"model\",\"aisleLocation\"]],\"col-sm-5\"]]],false],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-sm-2 checkbox-label-space\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-check\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label sr-only\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.gift\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"inventory.labels.gift\"],null],\"giftInKind\"]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.invoiceLineItem\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"inventory-typeahead\"],null,[[\"class\",\"property\",\"label\",\"content\",\"selection\",\"showQuantity\"],[\"col-sm-7 required test-inv-item\",\"inventoryItemTypeAhead\",[\"helper\",[\"t\"],[\"inventory.labels.inventoryItem\"],null],[\"get\",[\"inventoryList\"]],[\"get\",[\"selectedInventoryItem\"]],false]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"property\",\"label\",\"class\"],[\"quantity\",[\"helper\",[\"t\"],[\"labels.quantity\"],null],\"col-sm-2 required test-inv-quantity\"]]],false],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-sm-1\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.unit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showDistributionUnit\"]]],null,2],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"property\",\"label\",\"class\"],[\"purchaseCost\",[\"helper\",[\"t\"],[\"inventory.labels.purchaseCost\"],null],\"col-sm-2 required test-inv-cost\"]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"vendorItemNo\",[\"helper\",[\"t\"],[\"inventory.labels.vendorItemNumber\"],null],\"col-sm-4\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"lotNumber\",[\"helper\",[\"t\"],[\"inventory.labels.serialNumber\"],null],\"col-sm-4\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"minDate\",\"class\"],[\"expirationDate\",[\"helper\",[\"t\"],[\"inventory.labels.expirationDate\"],null],\"now\",\"col-sm-2\"]]],false],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-sm-2\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"text\",\" \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"addInventoryItem\"]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.add\"],null],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"model\",\"invoiceItems\"]]],null,1]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],3]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/inventory/batch/template.hbs" } });
});
define('hospitalrun/inventory/delete/controller', ['exports', 'ember-i18n', 'hospitalrun/controllers/abstract-delete-controller'], function (exports, _emberI18n, _hospitalrunControllersAbstractDeleteController) {
  exports['default'] = _hospitalrunControllersAbstractDeleteController['default'].extend({
    title: (0, _emberI18n.translationMacro)('inventory.labels.deleteItem')
  });
});
define("hospitalrun/inventory/delete/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "flD7Jxyi", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-warning-sign\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \\n    \"],[\"append\",[\"helper\",[\"t\"],[\"messages.delete\"],[[\"name\"],[[\"get\",[\"model\",\"name\"]]]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/inventory/delete/template.hbs" } });
});
define('hospitalrun/inventory/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember', 'hospitalrun/mixins/friendly-id', 'hospitalrun/mixins/inventory-locations', 'hospitalrun/mixins/inventory-type-list', 'hospitalrun/mixins/return-to', 'hospitalrun/mixins/unit-types', 'hospitalrun/mixins/user-session'], function (exports, _hospitalrunControllersAbstractEditController, _ember, _hospitalrunMixinsFriendlyId, _hospitalrunMixinsInventoryLocations, _hospitalrunMixinsInventoryTypeList, _hospitalrunMixinsReturnTo, _hospitalrunMixinsUnitTypes, _hospitalrunMixinsUserSession) {
  var computed = _ember['default'].computed;
  var get = _ember['default'].get;
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsFriendlyId['default'], _hospitalrunMixinsInventoryLocations['default'], _hospitalrunMixinsInventoryTypeList['default'], _hospitalrunMixinsReturnTo['default'], _hospitalrunMixinsUnitTypes['default'], _hospitalrunMixinsUserSession['default'], {
    inventory: _ember['default'].inject.controller(),
    savingNewItem: false,
    sequenceView: 'inventory_by_friendly_id',

    canAddPurchase: (function () {
      return this.currentUserCan('add_inventory_purchase');
    }).property(),

    canAdjustLocation: function canAdjustLocation() {
      return this.currentUserCan('adjust_inventory_location');
    },

    warehouseList: _ember['default'].computed.alias('inventory.warehouseList'),
    aisleLocationList: _ember['default'].computed.alias('inventory.aisleLocationList'),
    inventoryTypeList: _ember['default'].computed.alias('inventory.inventoryTypeList.value'),
    inventoryUnitList: _ember['default'].computed.alias('inventory.inventoryUnitList.value'),
    vendorList: _ember['default'].computed.alias('inventory.vendorList'),
    database: _ember['default'].inject.service(),

    lookupListsToUpdate: [{
      name: 'aisleLocationList', // Name of property containing lookup list
      property: 'model.aisleLocation', // Corresponding property on model that potentially contains a new value to add to the list
      id: 'aisle_location_list' // Id of the lookup list to update
    }, {
      name: 'vendorList', // Name of property containing lookup list
      property: 'model.vendor', // Corresponding property on model that potentially contains a new value to add to the list
      id: 'vendor_list' // Id of the lookup list to update
    }, {
      name: 'warehouseList', // Name of property containing lookup list
      property: 'model.location', // Corresponding property on model that potentially contains a new value to add to the list
      id: 'warehouse_list' // Id of the lookup list to update
    }],

    canEditQuantity: (function () {
      return this.get('model.isNew');
    }).property('model.isNew'),

    haveTransactions: (function () {
      var transactions = this.get('transactions');
      return transactions !== null;
    }).property('transactions.[]'),

    locationQuantityTotal: (function () {
      var locations = this.get('model.locations');
      var total = locations.reduce(function (previousValue, location) {
        return previousValue + parseInt(location.get('quantity'));
      }, 0);
      return total;
    }).property('model.locations'),

    /**
     * Check to see if the total quantity by location matches the quantity calculated on the item
     * @return {boolean} true if there is a discrepency;otherwise false.
     */
    quantityDiscrepency: (function () {
      var locationQuantityTotal = this.get('locationQuantityTotal');
      var quantity = this.get('model.quantity');
      return !_ember['default'].isEmpty(locationQuantityTotal) && !_ember['default'].isEmpty(quantity) && locationQuantityTotal !== quantity;
    }).property('locationQuantityTotal', 'model.quantity'),

    /**
     * Get the difference in quantity between the total quantity by location and the quantity on the item.
     * @return {int} the difference.
     */
    quantityDifferential: (function () {
      var locationQuantityTotal = this.get('locationQuantityTotal');
      var quantity = this.get('model.quantity');
      return Math.abs(locationQuantityTotal - quantity);
    }).property('locationQuantityTotal', 'model.quantity'),

    originalQuantityUpdated: (function () {
      var isNew = this.get('model.isNew');
      var quantity = this.get('model.originalQuantity');
      if (isNew && !_ember['default'].isEmpty(quantity)) {
        this.set('model.quantity', quantity);
      }
    }).observes('model.isNew', 'model.originalQuantity'),

    sequenceName: computed('model.inventoryType', function () {
      var inventoryType = get(this, 'model.inventoryType');
      return 'inventory_' + inventoryType;
    }),

    showTransactions: (function () {
      var transactions = this.get('transactions');
      return !_ember['default'].isEmpty(transactions);
    }).property('transactions.[]'),

    transactions: null,

    updateCapability: 'add_inventory_item',

    actions: {
      adjustItems: function adjustItems(inventoryLocation) {
        var adjustmentQuantity = parseInt(inventoryLocation.get('adjustmentQuantity'));
        var inventoryItem = this.get('model');
        var transactionType = inventoryLocation.get('transactionType');
        var request = this.get('store').createRecord('inv-request', {
          adjustPurchases: true,
          dateCompleted: inventoryLocation.get('dateCompleted'),
          expenseAccount: inventoryLocation.get('expenseAccount'),
          inventoryItem: inventoryItem,
          quantity: adjustmentQuantity,
          transactionType: transactionType,
          reason: inventoryLocation.get('reason'),
          deliveryAisle: inventoryLocation.get('aisleLocation'),
          deliveryLocation: inventoryLocation.get('location')
        });
        request.set('inventoryLocations', [inventoryLocation]);
        var increment = false;
        if (transactionType === 'Adjustment (Add)' || transactionType === 'Return') {
          increment = true;
        }
        request.set('markAsConsumed', true);
        // Make sure inventory item is resolved first.
        request.get('inventoryItem').then((function () {
          this.send('fulfillRequest', request, true, increment, true);
        }).bind(this));
      },

      editNewItem: function editNewItem() {
        this.send('editItem', this.get('model.id'));
      },

      showAdjustment: function showAdjustment(inventoryLocation) {
        inventoryLocation.setProperties({
          dateCompleted: new Date(),
          adjustmentItem: this.get('model'),
          adjustmentQuantity: '',
          reason: '',
          transferItem: null,
          transactionType: 'Adjustment (Add)'
        });
        this.send('openModal', 'inventory.adjust', inventoryLocation);
      },

      showTransfer: function showTransfer(inventoryLocation) {
        inventoryLocation.set('adjustmentQuantity');
        inventoryLocation.set('transferItem', this.get('model'));
        inventoryLocation.set('dateCompleted', new Date());
        this.send('openModal', 'inventory.transfer', inventoryLocation);
      },

      transferItems: function transferItems(inventoryLocation) {
        var inventoryItem = this.get('model');
        var request = this.get('store').createRecord('inv-request', {
          adjustPurchases: false,
          dateCompleted: inventoryLocation.get('dateCompleted'),
          inventoryItem: inventoryItem,
          quantity: inventoryLocation.get('adjustmentQuantity'),
          deliveryAisle: inventoryLocation.get('transferAisleLocation'),
          deliveryLocation: inventoryLocation.get('transferLocation'),
          transactionType: 'Transfer'
        });
        this.transferToLocation(inventoryItem, inventoryLocation).then((function () {
          inventoryLocation.setProperties({
            transferItem: null,
            transferLocation: null,
            transferAisleLocation: null,
            adjustmentQuantity: null
          });
          request.set('locationsAffected', [{
            name: inventoryLocation.get('locationName'),
            quantity: request.get('quantity')
          }]);
          request.get('inventoryItem').then((function () {
            // Make sure relationships are resolved before saving
            this._saveRequest(request);
          }).bind(this));
        }).bind(this));
      },

      updatePurchase: function updatePurchase(purchase, updateQuantity) {
        if (updateQuantity) {
          this.get('model').updateQuantity();
          this.send('update', true);
        }
        this.send('closeModal');
      }
    },

    _completeBeforeUpdate: function _completeBeforeUpdate(friendlyId) {
      var promises = [];
      var model = this.get('model');
      var newPurchase = model.getProperties('aisleLocation', 'dateReceived', 'purchaseCost', 'lotNumber', 'expirationDate', 'giftInKind', 'invoiceNo', 'location', 'originalQuantity', 'quantityGroups', 'vendor', 'vendorItemNo');
      var quantity = this.get('model.originalQuantity');
      if (!_ember['default'].isEmpty(quantity)) {
        newPurchase.currentQuantity = quantity;
        newPurchase.inventoryItem = this.get('model.id');
        var purchase = this.get('store').createRecord('inv-purchase', newPurchase);
        promises.push(purchase.save());
        this.get('model.purchases').addObject(purchase);
        promises.push(this.newPurchaseAdded(this.get('model'), purchase));
      }
      model.set('friendlyId', friendlyId);
      return _ember['default'].RSVP.all(promises, 'All before update done for inventory item');
    },

    /**
     * Saves the specified request, then updates the inventory item and closes the modal.
     */
    _saveRequest: function _saveRequest(request) {
      request.set('status', 'Completed');
      request.set('completedBy', request.getUserName());
      request.save().then((function () {
        this.send('update', true);
        this.send('closeModal');
        this.getTransactions();
      }).bind(this));
    },

    getTransactions: function getTransactions() {
      var inventoryId = this.get('model.id');
      this.set('transactions', null);
      this.store.query('inv-request', {
        options: {
          endkey: [inventoryId, 'Completed', 0],
          startkey: [inventoryId, 'Completed', 9999999999999],
          descending: true
        },
        mapReduce: 'inventory_request_by_item'
      }).then((function (transactions) {
        this.set('transactions', transactions);
      }).bind(this));
    },

    beforeUpdate: function beforeUpdate() {
      var _this = this;

      if (this.get('model.isNew')) {
        var _ret = (function () {
          var model = _this.get('model');
          return {
            v: model.validate().then(function () {
              if (model.get('isValid')) {
                _this.set('savingNewItem', true);
                return _this.generateFriendlyId('inventory').then(function (friendlyId) {
                  return _this._completeBeforeUpdate(friendlyId);
                });
              } else {
                throw Error('invalid model');
              }
            })['catch'](function () {
              _this.send('showDisabledDialog');
            })
          };
        })();

        if (typeof _ret === 'object') return _ret.v;
      } else {
        return _ember['default'].RSVP.Promise.resolve();
      }
    },

    afterUpdate: function afterUpdate() {
      var afterUpdateAction = null;
      if (this.get('savingNewItem')) {
        afterUpdateAction = 'editNewItem';
        this.set('savingNewItem', false);
      }
      this.displayAlert('Inventory Item Saved', 'The inventory item has been saved.', afterUpdateAction);
    }
  });
});
define('hospitalrun/inventory/edit/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'ember', 'ember-i18n', 'hospitalrun/mixins/inventory-id'], function (exports, _hospitalrunRoutesAbstractEditRoute, _ember, _emberI18n, _hospitalrunMixinsInventoryId) {
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend(_hospitalrunMixinsInventoryId['default'], {
    editTitle: (0, _emberI18n.translationMacro)('inventory.labels.editItem'),
    modelName: 'inventory',
    newTitle: (0, _emberI18n.translationMacro)('inventory.labels.newItem'),

    actions: {
      adjustItems: function adjustItems(inventoryLocation) {
        this.controller.send('adjustItems', inventoryLocation);
      },

      doneFulfillRequest: function doneFulfillRequest() {
        this.controller.getTransactions();
      },

      editNewItem: function editNewItem() {
        this.controller.send('editNewItem');
      },

      transferItems: function transferItems(inventoryLocation) {
        this.controller.send('transferItems', inventoryLocation);
      },

      updatePurchase: function updatePurchase(purchase, updateQuantity) {
        this.controller.send('updatePurchase', purchase, updateQuantity);
      }
    },

    getNewData: function getNewData() {
      return _ember['default'].RSVP.resolve({
        dateReceived: new Date(),
        quantityGroups: []
      });
    },

    setupController: function setupController(controller, model) {
      this._super(controller, model);
      controller.getTransactions();
    }
  });
});
define("hospitalrun/inventory/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "fT4+Xn0L", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],27]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"colspan\",\"4\"],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-refresh glyphicon-refresh-animate\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"inventory.messages.loading\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                      \"],[\"append\",[\"unknown\",[\"location\",\"name\"]],false],[\"open-element\",\"br\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"location\"]},{\"statements\":[[\"text\",\"                    \"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.edit.transferredFrom\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"transaction\",\"locationsAffected\"]]],null,1],[\"text\",\"                    \"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.edit.transferredTo\"],null],false],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"unknown\",[\"transaction\",\"deliveryDetails\"]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                      \"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.edit.delivered\"],null],false],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"unknown\",[\"transaction\",\"deliveryDetails\"]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                      \"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.edit.prescription\"],null],false],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"unknown\",[\"transaction\",\"deliveryDetails\"]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                      \"],[\"append\",[\"unknown\",[\"location\",\"name\"]],false],[\"open-element\",\"br\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"location\"]},{\"statements\":[[\"text\",\"                    \"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.edit.cost\"],null],false],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"unknown\",[\"transaction\",\"costPerUnit\"]],false],[\"open-element\",\"br\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.edit.quantity\"],null],false],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"unknown\",[\"transaction\",\"quantityAtCompletion\"]],false],[\"open-element\",\"br\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.edit.pulled\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"transaction\",\"locationsAffected\"]]],null,5],[\"block\",[\"if\"],[[\"get\",[\"transaction\",\"patient\"]]],null,4,3]],\"locals\":[]},{\"statements\":[[\"text\",\"                      \"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.edit.location\"],null],false],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"unknown\",[\"transaction\",\"deliveryDetails\"]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                      \"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.edit.returned\"],null],false],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"unknown\",[\"transaction\",\"deliveryDetails\"]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                      \"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.edit.reason\"],null],false],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"unknown\",[\"transaction\",\"reason\"]],false],[\"open-element\",\"br\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"transaction\",\"haveReason\"]]],null,9],[\"block\",[\"if\"],[[\"get\",[\"transaction\",\"patient\"]]],null,8,7]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"transaction\",\"dateCompleted\"]]],null],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"transaction\",\"quantity\"]],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"transaction\",\"transactionType\"]],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"transaction\",\"expenseAccount\"]],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"transaction\",\"isAdjustment\"]]],null,10],[\"block\",[\"if\"],[[\"get\",[\"transaction\",\"isFulfillment\"]]],null,6],[\"block\",[\"if\"],[[\"get\",[\"transaction\",\"isTransfer\"]]],null,2],[\"text\",\"                \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"transaction\"]},{\"statements\":[[\"block\",[\"each\"],[[\"get\",[\"transactions\"]]],null,11]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"h3\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.transactions\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.dateCompleted\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.quantity\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.transaction\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.expense\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.details\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"haveTransactions\"]]],null,12,0],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAdjustment\",[\"get\",[\"location\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.adjust\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary btn-extra\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showTransfer\",[\"get\",[\"location\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.transfer\"],null],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"location\",\"location\"]],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"location\",\"aisleLocation\"]],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"location\",\"quantity\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAdjustLocation\"]]],null,14],[\"text\",\"            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"location\",\"quantity\"]]],null,15]],\"locals\":[\"location\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.action\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"h3\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.locations\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.location\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.aisleLocation\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.quantity\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAdjustLocation\"]]],null,17],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"locations\"]]],null,16],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showTransactions\"]]],null,13]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.giftInKindNo\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.giftInKindYes\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"tr\",[]],[\"dynamic-attr\",\"class\",[\"helper\",[\"if\"],[[\"get\",[\"purchase\",\"expired\"]],\"warning\"],null],null],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"purchase\",\"dateReceived\"]]],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"purchase\",\"purchaseCost\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"purchase\",\"costPerUnit\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"purchase\",\"originalQuantity\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"purchase\",\"currentQuantity\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"purchase\",\"giftInKind\"]]],null,20,19],[\"text\",\"            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"purchase\",\"lotNumber\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"purchase\",\"expirationDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"purchase\",\"vendor\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"purchase\",\"invoiceNo\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"purchase\"]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddPurchase\",[\"get\",[\"model\"]]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"inventory.titles.addPurchase\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger alert-dismissible\"],[\"static-attr\",\"role\",\"alert\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"close\"],[\"static-attr\",\"data-dismiss\",\"alert\"],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"aria-hidden\",\"true\"],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"sr-only\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.close\"],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-warning-sign\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"t\"],[\"inventory.messages.quantity\"],[[\"quantity\",\"locationQuantity\"],[[\"get\",[\"model\",\"quantity\"]],[\"get\",[\"locationQuantityTotal\"]]]]],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.messages.adjust\"],[[\"difference\"],[[\"get\",[\"quantityDifferential\"]]]]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"quantityDiscrepency\"]]],null,23],[\"text\",\"      \"],[\"open-element\",\"h3\",[]],[\"flush-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.purchases\"],null],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddPurchase\"]]],null,22],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.dateReceived\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.purchaseCost\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.costPerUnit\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.originalQuantity\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.currentQuantity\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.gift\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.serialNumber\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.expirationDate\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.vendor\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.invoiceNumber\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"purchases\"]]],null,21],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"h3\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.purchaseInfo\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"partial\",\"inv-purchase\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"partial\",\"inventory-basic\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"model\",\"isNew\"]]],null,25,24],[\"block\",[\"unless\"],[[\"get\",[\"model\",\"isNew\"]]],null,18]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],26]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/inventory/edit/template.hbs" } });
});
define('hospitalrun/inventory/index/controller', ['exports', 'ember', 'hospitalrun/controllers/abstract-paged-controller', 'hospitalrun/mixins/user-session'], function (exports, _ember, _hospitalrunControllersAbstractPagedController, _hospitalrunMixinsUserSession) {
  var computed = _ember['default'].computed;
  exports['default'] = _hospitalrunControllersAbstractPagedController['default'].extend(_hospitalrunMixinsUserSession['default'], {
    startKey: [],
    canAdd: (function () {
      return this.currentUserCan('add_inventory_request');
    }).property(),

    canFulfill: (function () {
      return this.currentUserCan('fulfill_inventory');
    }).property(),

    currentUserName: computed('', function () {
      return this.getUserName();
    })
  });
});
define('hospitalrun/inventory/index/route', ['exports', 'hospitalrun/routes/abstract-index-route', 'hospitalrun/mixins/user-session', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractIndexRoute, _hospitalrunMixinsUserSession, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend(_hospitalrunMixinsUserSession['default'], {
    modelName: 'inv-request',
    newButtonAction: (function () {
      if (this.currentUserCan('add_inventory_request')) {
        return 'newRequest';
      } else {
        return null;
      }
    }).property(),
    newButtonText: (0, _emberI18n.translationMacro)('buttons.newRequestPlus'),
    pageTitle: (0, _emberI18n.translationMacro)('navigation.subnav.requests'),

    _getStartKeyFromItem: function _getStartKeyFromItem(item) {
      var itemId = this._getPouchIdFromItem(item);
      return ['Requested', null, itemId];
    },

    _modelQueryParams: function _modelQueryParams() {
      var maxValue = this.get('maxValue');
      return {
        options: {
          startkey: ['Requested', null, null],
          endkey: ['Requested', maxValue, maxValue]
        },
        mapReduce: 'inventory_request_by_status'
      };
    },

    actions: {
      fulfill: function fulfill(item) {
        item.set('dateCompleted', new Date());
        this.transitionTo('inventory.request', item);
      }
    }
  });
});
define("hospitalrun/inventory/index/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "Dt0Atl/D", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]],6]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newRequest\"]],[\"flush-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"inventory.messages.createRequest\"],null],false],[\"close-element\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-info\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.messages.noRequests\"],null],false],[\"block\",[\"if\"],[[\"get\",[\"canAdd\"]]],null,0],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"deleteItem\",[\"get\",[\"request\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"close-element\"],[\"text\",\" \\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"fulfill\",[\"get\",[\"request\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.fulfill\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"request\",\"inventoryItem\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"request\",\"quantity\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"request\",\"dateRequested\"]]],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"request\",\"requestedBy\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canFulfill\"]]],null,3],[\"block\",[\"if\"],[[\"helper\",[\"or\"],[[\"get\",[\"canFulfill\"]],[\"helper\",[\"and\"],[[\"get\",[\"canAdd\"]],[\"helper\",[\"eq\"],[[\"get\",[\"request\",\"requestedBy\"]],[\"get\",[\"currentUserName\"]]],null]],null]],null]],null,2],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"request\"]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.name\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.quantity\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.requestedOn\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.requestedBy\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\"]]],null,4],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"hasRecords\"]]],null,5,1]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/inventory/index/template.hbs" } });
});
define('hospitalrun/inventory/listing/controller', ['exports', 'hospitalrun/controllers/abstract-paged-controller', 'hospitalrun/mixins/user-session'], function (exports, _hospitalrunControllersAbstractPagedController, _hospitalrunMixinsUserSession) {
  exports['default'] = _hospitalrunControllersAbstractPagedController['default'].extend(_hospitalrunMixinsUserSession['default'], {
    canAddItem: (function () {
      return this.currentUserCan('add_inventory_item');
    }).property(),

    canAddPurchase: (function () {
      return this.currentUserCan('add_inventory_purchase');
    }).property(),

    canDeleteItem: (function () {
      return this.currentUserCan('delete_inventory_item');
    }).property(),

    startKey: []
  });
});
define('hospitalrun/inventory/listing/route', ['exports', 'hospitalrun/routes/abstract-index-route', 'hospitalrun/mixins/user-session', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractIndexRoute, _hospitalrunMixinsUserSession, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend(_hospitalrunMixinsUserSession['default'], {
    modelName: 'inventory',
    newButtonAction: (function () {
      if (this.currentUserCan('add_inventory_item')) {
        return 'newItem';
      } else {
        return null;
      }
    }).property(),
    newButtonText: (0, _emberI18n.translationMacro)('buttons.newItem'),
    pageTitle: (0, _emberI18n.translationMacro)('inventory.labels.items'),

    _modelQueryParams: function _modelQueryParams() {
      return {
        mapReduce: 'inventory_by_name'
      };
    },

    _getStartKeyFromItem: function _getStartKeyFromItem(item) {
      var inventoryId = this._getPouchIdFromItem(item);
      return [item.get('name'), inventoryId];
    }

  });
});
define("hospitalrun/inventory/listing/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "mSwPqfiH", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]],14]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\" \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newItem\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"messages.createNewRecord\"],null],false],[\"close-element\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-info\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"messages.noItemsFound\"],null],false],[\"text\",\" \"],[\"block\",[\"if\"],[[\"get\",[\"canAddItem\"]]],null,0],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"buttons.barcode\"],null],false]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"deleteItem\",[\"get\",[\"inventory\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"inventory\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddPurchase\",[\"get\",[\"inventory\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.add\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"clickable\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"inventory\"]]]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"inventory\",\"friendlyId\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"inventory\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"inventory\",\"inventoryType\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"inventory\",\"quantity\"]],false],[\"text\",\" \"],[\"append\",[\"unknown\",[\"inventory\",\"distributionUnit\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"inventory\",\"displayLocations\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"inventory\",\"crossReference\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddPurchase\"]]],null,5],[\"block\",[\"if\"],[[\"get\",[\"canAddItem\"]]],null,4],[\"block\",[\"if\"],[[\"get\",[\"canDeleteItem\"]]],null,3],[\"text\",\"              \"],[\"block\",[\"link-to\"],[\"inventory.barcode\",[\"get\",[\"inventory\"]]],[[\"class\",\"bubbles\"],[\"btn btn-default neutral\",false]],2],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"unless\"],[[\"get\",[\"inventory\",\"isNew\"]]],null,6]],\"locals\":[\"inventory\"]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.xref\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"labels.quantity\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"labels.type\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"labels.name\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"labels.id\"],null],false]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"friendlyId\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],12],[\"text\",\"\\n        \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"name\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],11],[\"text\",\"\\n        \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"inventoryType\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],10],[\"text\",\"\\n        \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"quantity\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],9],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.location\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"crossReference\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],8],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\"]]],null,7],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"hasRecords\"]]],null,13,1]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/inventory/listing/template.hbs" } });
});
define('hospitalrun/inventory/purchase/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember', 'hospitalrun/mixins/unit-types'], function (exports, _hospitalrunControllersAbstractEditController, _ember, _hospitalrunMixinsUnitTypes) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsUnitTypes['default'], {
    inventoryController: _ember['default'].inject.controller('inventory'),
    cancelAction: 'closeModal',

    canEditQuantity: (function () {
      var originalQuantity = this.get('model.originalQuantity');
      var currentQuantity = this.get('model.currentQuantity');
      if (currentQuantity < originalQuantity) {
        return false;
      }
      return true;
    }).property('model.currentQuantity', 'model.originalQuantity'),

    warehouseList: _ember['default'].computed.alias('inventoryController.warehouseList'),
    aisleLocationList: _ember['default'].computed.alias('inventoryController.aisleLocationList'),
    inventoryUnitList: _ember['default'].computed.alias('inventoryController.inventoryUnitList.value'),
    vendorList: _ember['default'].computed.alias('inventoryController.vendorList'),

    lookupListsToUpdate: [{
      name: 'aisleLocationList', // Name of property containing lookup list
      property: 'model.aisleLocation', // Corresponding property on model that potentially contains a new value to add to the list
      id: 'aisle_location_list' // Id of the lookup list to update
    }, {
      name: 'vendorList', // Name of property containing lookup list
      property: 'model.vendor', // Corresponding property on model that potentially contains a new value to add to the list
      id: 'vendor_list' // Id of the lookup list to update
    }, {
      name: 'warehouseList', // Name of property containing lookup list
      property: 'model.location', // Corresponding property on model that potentially contains a new value to add to the list
      id: 'warehouse_list' // Id of the lookup list to update
    }],

    newPurchase: false,

    updateQuantity: false,

    updateCapability: 'add_inventory_purchase',

    title: (function () {
      var i18n = this.get('i18n');
      var isNew = this.get('model.isNew');
      if (isNew) {
        return i18n.t('inventory.titles.addPurchase');
      }
      return i18n.t('inventory.titles.editPurchase');
    }).property('model.isNew'),

    beforeUpdate: function beforeUpdate() {
      var isNew = this.get('model.isNew');
      var changedAttributes = this.get('model').changedAttributes();
      if (changedAttributes.originalQuantity) {
        this.set('model.currentQuantity', this.get('model.originalQuantity'));
        if (!isNew) {
          this.set('updateQuantity', true);
        }
      }
      if (isNew) {
        this.set('newPurchase', true);
      }
      return _ember['default'].RSVP.Promise.resolve();
    },

    afterUpdate: function afterUpdate(record) {
      if (this.get('newPurchase')) {
        this.send('addPurchase', record);
      } else {
        this.send('updatePurchase', record, true);
      }
    }
  });
});
define("hospitalrun/inventory/purchase/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "FKo9LV39", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"partial\",\"inv-purchase\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/inventory/purchase/edit/template.hbs" } });
});
define("hospitalrun/inventory/purchase/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "OFh+k+hQ", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]],14]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\" \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newItem\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"messages.createNewRecord\"],null],false],[\"close-element\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-info\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"messages.noItemsFound\"],null],false],[\"text\",\" \"],[\"block\",[\"if\"],[[\"get\",[\"canAddItem\"]]],null,0],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"buttons.barcode\"],null],false]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"deleteItem\",[\"get\",[\"inventory\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"inventory\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddPurchase\",[\"get\",[\"inventory\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.add\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"clickable\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"inventory\"]]]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"inventory\",\"friendlyId\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"inventory\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"inventory\",\"inventoryType\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"inventory\",\"quantity\"]],false],[\"text\",\" \"],[\"append\",[\"unknown\",[\"inventory\",\"distributionUnit\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"inventory\",\"displayLocations\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"inventory\",\"crossReference\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddPurchase\"]]],null,5],[\"block\",[\"if\"],[[\"get\",[\"canAddItem\"]]],null,4],[\"block\",[\"if\"],[[\"get\",[\"canDeleteItem\"]]],null,3],[\"text\",\"              \"],[\"block\",[\"link-to\"],[\"inventory.barcode\",[\"get\",[\"inventory\"]]],[[\"class\",\"bubbles\"],[\"btn btn-extra\",false]],2],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"unless\"],[[\"get\",[\"inventory\",\"isNew\"]]],null,6]],\"locals\":[\"inventory\"]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.xref\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"labels.quantity\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"labels.type\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"labels.name\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"labels.id\"],null],false]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"friendlyId\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],12],[\"text\",\"\\n        \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"name\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],11],[\"text\",\"\\n        \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"inventoryType\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],10],[\"text\",\"\\n        \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"quantity\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],9],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.location\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"crossReference\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],8],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\"]]],null,7],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"hasRecords\"]]],null,13,1]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/inventory/purchase/template.hbs" } });
});
define('hospitalrun/inventory/quick-add/controller', ['exports', 'hospitalrun/inventory/edit/controller', 'ember-i18n'], function (exports, _hospitalrunInventoryEditController, _emberI18n) {
  exports['default'] = _hospitalrunInventoryEditController['default'].extend({
    title: (0, _emberI18n.translationMacro)('inventory.titles.inventoryItem'),

    updateCapability: 'add_inventory_item',

    actions: {
      cancel: function cancel() {
        this.send('closeModal');
      }
    },

    beforeUpdate: function beforeUpdate() {
      if (this.get('model.skipSavePurchase')) {
        this.set('model.quantity', null);
      }
      return this._super();
    },

    afterUpdate: function afterUpdate(record) {
      this.send('addedNewInventoryItem', record);
    }
  });
});
define("hospitalrun/inventory/quick-add/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "YzTYgOTa", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"helper\",[\"t\"],[\"inventory.titles.quickAddTitle\"],null],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"partial\",\"inventory-basic\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-warning\"],[\"static-attr\",\"role\",\"alert\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.messages.itemNotFound\"],[[\"item\"],[[\"get\",[\"model\",\"name\"]]]]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/inventory/quick-add/template.hbs" } });
});
define('hospitalrun/inventory/rank-select/component', ['exports', 'ember', 'hospitalrun/utils/select-values', 'ember-computed'], function (exports, _ember, _hospitalrunUtilsSelectValues, _emberComputed) {
  exports['default'] = _ember['default'].Component.extend({
    rankOptions: [],
    prompt: ' ',
    'class': 'col-sm-2 test-inv-rank',

    options: (0, _emberComputed['default'])('rankOptions', function () {
      return _hospitalrunUtilsSelectValues['default'].selectValues(this.get('rankOptions'));
    }),

    init: function init() {
      this._super.apply(this, arguments);

      // set available options
      this.set('rankOptions', _ember['default'].A(['A', 'B', 'C']));
    }
  });
});
define("hospitalrun/inventory/rank-select/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "PkjZPDnL", "block": "{\"statements\":[[\"append\",[\"helper\",[\"em-select\"],null,[[\"label\",\"property\",\"content\",\"class\",\"prompt\"],[[\"helper\",[\"t\"],[\"inventory.labels.rank\"],null],[\"get\",[\"property\"]],[\"get\",[\"options\"]],[\"get\",[\"class\"]],[\"get\",[\"prompt\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/inventory/rank-select/template.hbs" } });
});
define('hospitalrun/inventory/reports/controller', ['exports', 'hospitalrun/controllers/abstract-report-controller', 'ember', 'hospitalrun/mixins/inventory-adjustment-types', 'hospitalrun/mixins/location-name', 'hospitalrun/mixins/modal-helper', 'moment', 'hospitalrun/mixins/number-format', 'hospitalrun/utils/select-values'], function (exports, _hospitalrunControllersAbstractReportController, _ember, _hospitalrunMixinsInventoryAdjustmentTypes, _hospitalrunMixinsLocationName, _hospitalrunMixinsModalHelper, _moment, _hospitalrunMixinsNumberFormat, _hospitalrunUtilsSelectValues) {
  exports['default'] = _hospitalrunControllersAbstractReportController['default'].extend(_hospitalrunMixinsLocationName['default'], _hospitalrunMixinsModalHelper['default'], _hospitalrunMixinsNumberFormat['default'], _hospitalrunMixinsInventoryAdjustmentTypes['default'], {
    inventoryController: _ember['default'].inject.controller('inventory'),
    effectiveDate: null,
    endDate: null,
    expenseCategories: _ember['default'].computed(function () {
      var i18n = this.get('i18n');
      return [i18n.t('inventory.labels.inventoryConsumed'), i18n.t('inventory.labels.giftUsage'), i18n.t('inventory.labels.inventoryObsolence')];
    }),
    expenseMap: null,
    filterLocation: null,
    grandCost: 0,
    grandQuantity: 0,
    locationSummary: null,
    reportType: 'daysLeft',
    startDate: null,

    database: _ember['default'].inject.service(),
    warehouseList: _ember['default'].computed.map('inventoryController.warehouseList.value', _hospitalrunUtilsSelectValues['default'].selectValuesMap),
    reportColumns: _ember['default'].computed(function () {
      var i18n = this.get('i18n');
      return {
        date: {
          label: i18n.t('labels.date'),
          include: true,
          property: 'date'
        },
        id: {
          label: i18n.t('labels.id'),
          include: true,
          property: 'inventoryItem.friendlyId'
        },
        name: {
          label: i18n.t('inventory.labels.name'),
          include: true,
          property: 'inventoryItem.name'
        },
        transactionType: {
          label: i18n.t('inventory.labels.adjustmentType'),
          include: false,
          property: 'transactionType'
        },
        expenseAccount: {
          label: i18n.t('inventory.labels.expense'),
          include: false,
          property: 'expenseAccount'
        },
        description: {
          label: i18n.t('labels.description'),
          include: false,
          property: 'inventoryItem.description'
        },
        type: {
          label: i18n.t('labels.type'),
          include: true,
          property: 'inventoryItem.inventoryType'
        },
        xref: {
          label: i18n.t('inventory.labels.crossReference'),
          include: false,
          property: 'inventoryItem.crossReference'
        },
        reorder: {
          label: i18n.t('inventory.labels.reorderPoint'),
          include: false,
          property: 'inventoryItem.reorderPoint',
          format: '_numberFormat'
        },
        price: {
          label: i18n.t('inventory.labels.salePricePerUnit'),
          include: false,
          property: 'inventoryItem.price',
          format: '_numberFormat'
        },
        quantity: {
          label: i18n.t('labels.quantity'),
          include: true,
          property: 'quantity',
          format: '_numberFormat'
        },
        consumedPerDay: {
          label: i18n.t('inventory.labels.consumptionRate'),
          include: false,
          property: 'consumedPerDay'
        },
        daysLeft: {
          label: i18n.t('inventory.labels.daysLeft'),
          include: false,
          property: 'daysLeft'
        },
        unit: {
          label: i18n.t('inventory.labels.distributionUnit'),
          include: true,
          property: 'inventoryItem.distributionUnit'
        },
        unitcost: {
          label: i18n.t('inventory.labels.unitCost'),
          include: true,
          property: 'unitCost',
          format: '_numberFormat'
        },
        total: {
          label: i18n.t('inventory.labels.totalCost'),
          include: true,
          property: 'totalCost',
          format: '_numberFormat'
        },
        gift: {
          label: i18n.t('inventory.labels.gift'),
          include: true,
          property: 'giftInKind'
        },
        locations: {
          label: i18n.t('inventory.labels.locations'),
          include: true,
          property: 'locations',
          format: '_addLocationColumn'
        },
        aisle: {
          label: i18n.t('inventory.labels.aisle'),
          include: false,
          property: 'locations',
          format: '_addAisleColumn'
        },
        vendor: {
          label: i18n.t('inventory.labels.vendor'),
          include: false,
          property: 'vendors'
        }
      };
    }),
    reportTypes: _ember['default'].computed(function () {
      var i18n = this.get('i18n');
      return [{
        name: i18n.t('inventory.reports.daysSupply'),
        value: 'daysLeft'
      }, {
        name: i18n.t('inventory.reports.adjustment'),
        value: 'detailedAdjustment'
      }, {
        name: i18n.t('inventory.reports.purchaseDetail'),
        value: 'detailedPurchase'
      }, {
        name: i18n.t('inventory.reports.stockUsageDetail'),
        value: 'detailedUsage'
      }, {
        name: i18n.t('inventory.reports.stockTransferDetail'),
        value: 'detailedTransfer'
      }, {
        name: i18n.t('inventory.reports.expenseDetail'),
        value: 'detailedExpense'
      }, {
        name: i18n.t('inventory.reports.expiration'),
        value: 'expiration'
      }, {
        name: i18n.t('inventory.reports.invLocation'),
        value: 'byLocation'
      }, {
        name: i18n.t('inventory.reports.invValuation'),
        value: 'valuation'
      }, {
        name: i18n.t('inventory.reports.expenseSum'),
        value: 'summaryExpense'
      }, {
        name: i18n.t('inventory.reports.purchaseSum'),
        value: 'summaryPurchase'
      }, {
        name: i18n.t('inventory.reports.stockUsageSum'),
        value: 'summaryUsage'
      }, {
        name: i18n.t('inventory.reports.stockTransferSum'),
        value: 'summaryTransfer'
      }, {
        name: i18n.t('inventory.reports.finance'),
        value: 'summaryFinance'
      }];
    }),

    hideLocationFilter: (function () {
      var reportType = this.get('reportType');
      return reportType === 'summaryFinance';
    }).property('reportType'),

    includeDate: (function () {
      var reportType = this.get('reportType');
      if (!_ember['default'].isEmpty(reportType) && reportType.indexOf('detailed') === 0) {
        this.set('reportColumns.date.include', true);
        return true;
      } else {
        this.set('reportColumns.date.include', false);
        return false;
      }
    }).property('reportType'),

    includeDaysLeft: (function () {
      var reportType = this.get('reportType');
      if (reportType === 'daysLeft') {
        this.set('reportColumns.consumedPerDay.include', true);
        this.set('reportColumns.daysLeft.include', true);
        return true;
      } else {
        this.set('reportColumns.consumedPerDay.include', false);
        this.set('reportColumns.daysLeft.include', false);
        return false;
      }
    }).property('reportType'),

    includeCostFields: (function () {
      var reportType = this.get('reportType');
      if (reportType === 'detailedTransfer' || reportType === 'summaryTransfer' || reportType === 'daysLeft') {
        this.set('reportColumns.total.include', false);
        this.set('reportColumns.unitcost.include', false);
        return false;
      } else {
        this.set('reportColumns.total.include', true);
        this.set('reportColumns.unitcost.include', true);
        return true;
      }
    }).property('reportType'),

    includeExpenseAccount: (function () {
      var reportType = this.get('reportType');
      switch (reportType) {
        case 'detailedAdjustment':
        case 'detailedTransfer':
        case 'detailedUsage':
          {
            return true;
          }
        case 'detailedExpense':
          {
            this.set('reportColumns.expenseAccount.include', true);
            return true;
          }
        default:
          {
            this.set('reportColumns.expenseAccount.include', false);
            return false;
          }
      }
    }).property('reportType'),

    includeTransactionType: (function () {
      var reportType = this.get('reportType');
      if (reportType === 'detailedAdjustment') {
        this.set('reportColumns.transactionType.include', true);
        return true;
      } else {
        this.set('reportColumns.transactionType.include', false);
        return false;
      }
    }).property('reportType'),

    showEffectiveDate: (function () {
      var reportType = this.get('reportType');
      if (reportType === 'valuation' || reportType === 'byLocation') {
        this.set('startDate', null);
        if (_ember['default'].isEmpty(this.get('endDate'))) {
          this.set('endDate', new Date());
        }
        return true;
      } else {
        if (_ember['default'].isEmpty(this.get('startDate'))) {
          this.set('startDate', new Date());
        }
        return false;
      }
    }).property('reportType'),

    useFieldPicker: (function () {
      var reportType = this.get('reportType');
      return reportType !== 'expiration' && reportType !== 'summaryFinance';
    }).property('reportType'),

    _addAisleColumn: function _addAisleColumn(locations) {
      if (!_ember['default'].isEmpty(locations)) {
        return locations.map(function (location) {
          if (location.name.indexOf(':') > -1) {
            return location.name.split(':')[1];
          }
        });
      }
    },

    _addLocationColumn: function _addLocationColumn(locations) {
      var _this = this;

      if (!_ember['default'].isEmpty(locations)) {
        var _ret = (function () {
          var returnLocations = [];
          locations.forEach((function (location) {
            var formattedName = undefined;
            if (location.name.indexOf('From:') === 0) {
              formattedName = location.name;
            } else {
              formattedName = this._getWarehouseLocationName(location.name);
            }
            if (!returnLocations.includes(formattedName)) {
              returnLocations.push(formattedName);
            }
          }).bind(_this));
          return {
            v: returnLocations
          };
        })();

        if (typeof _ret === 'object') return _ret.v;
      }
    },

    _addReportRow: function _addReportRow(row, skipNumberFormatting, reportColumns, rowAction) {
      if (_ember['default'].isEmpty(rowAction) && !_ember['default'].isEmpty(row.inventoryItem) && !_ember['default'].isEmpty(row.inventoryItem.id)) {
        rowAction = {
          action: 'viewInventory',
          model: row.inventoryItem.id
        };
      }
      this._super(row, skipNumberFormatting, reportColumns, rowAction);
    },

    _addTotalsRow: function _addTotalsRow(label, summaryCost, summaryQuantity) {
      if (summaryQuantity > 0) {
        this._addReportRow({
          totalCost: label + this._numberFormat(summaryCost),
          quantity: label + this._numberFormat(summaryQuantity),
          unitCost: label + this._numberFormat(summaryCost / summaryQuantity)
        }, true);
      }
    },

    /**
     * Adjust the specified location by the specified quantity
     * @param {array} locations the list of locations to adjust from
     * @param {string} locationName the name of the location to adjust
     * @param {integer} quantity the quantity to adjust.
     * @param {boolean} increment boolean indicating if the adjustment is an increment; or false if decrement.
     */
    _adjustLocation: function _adjustLocation(locations, locationName, quantity, increment) {
      var locationToUpdate = locations.findBy('name', locationName);
      if (_ember['default'].isEmpty(locationToUpdate)) {
        locationToUpdate = {
          name: locationName,
          quantity: 0
        };
        locations.push(locationToUpdate);
      }
      if (increment) {
        locationToUpdate.quantity += quantity;
      } else {
        locationToUpdate.quantity -= quantity;
      }
    },

    /**
     * Adjust the specified purchase by the specified quantity.
     * @param {array} purchases the list of purchases to adjust from.
     * @param {string} purchaseId the id of the purchase to adjust.
     * @param {integer} quantity the quantity to adjust.
     * @param {boolean} increment boolean indicating if the adjustment is an increment; or false if decrement.
     */
    _adjustPurchase: function _adjustPurchase(purchases, purchaseId, quantity, increment) {
      var purchaseToAdjust = purchases.findBy('id', purchaseId);
      if (!_ember['default'].isEmpty(purchaseToAdjust)) {
        var calculatedQuantity = purchaseToAdjust.calculatedQuantity;

        if (increment) {
          calculatedQuantity += quantity;
        } else {
          calculatedQuantity -= quantity;
        }
        purchaseToAdjust.calculatedQuantity = calculatedQuantity;
      }
    },

    _calculateCosts: function _calculateCosts(inventoryPurchases, row) {
      // Calculate quantity and cost per unit for the row
      if (!_ember['default'].isEmpty(inventoryPurchases)) {
        inventoryPurchases.forEach((function (purchase) {
          var costPerUnit = this._calculateCostPerUnit(purchase);
          var quantity = purchase.calculatedQuantity;
          row.quantity += purchase.calculatedQuantity;
          row.totalCost += quantity * costPerUnit;
        }).bind(this));
      }
      if (row.totalCost === 0 || row.quantity === 0) {
        row.unitCost = 0;
      } else {
        row.unitCost = row.totalCost / row.quantity;
      }
      return row;
    },

    _calculateUsage: function _calculateUsage(inventoryPurchases, row) {
      // Calculate quantity and cost per unit for the row
      if (!_ember['default'].isEmpty(inventoryPurchases)) {
        inventoryPurchases.forEach((function (purchase) {
          var costPerUnit = this._calculateCostPerUnit(purchase);
          var quantity = purchase.calculatedQuantity;
          row.quantity -= purchase.calculatedQuantity;
          row.totalCost -= quantity * costPerUnit;
        }).bind(this));
      }
      if (row.totalCost === 0 || row.quantity === 0) {
        row.unitCost = 0;
      } else {
        row.unitCost = row.totalCost / row.quantity;
      }
      return row;
    },

    _calculateCostPerUnit: function _calculateCostPerUnit(purchase) {
      var purchaseCost = purchase.purchaseCost;

      var quantity = parseInt(purchase.originalQuantity);
      if (_ember['default'].isEmpty(purchaseCost) || _ember['default'].isEmpty(quantity)) {
        return 0;
      }
      return Number((purchaseCost / quantity).toFixed(2));
    },

    _findInventoryItems: function _findInventoryItems(queryParams, view, inventoryList, childName) {
      if (_ember['default'].isEmpty(inventoryList)) {
        inventoryList = {};
      }
      var database = this.get('database');
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        database.queryMainDB(queryParams, view).then((function (inventoryChildren) {
          var inventoryKeys = Object.keys(inventoryList);
          var inventoryIds = [];
          if (!_ember['default'].isEmpty(inventoryChildren.rows)) {
            inventoryChildren.rows.forEach(function (child) {
              if (child.doc.inventoryItem && !inventoryKeys.includes(child.doc.inventoryItem)) {
                inventoryIds.push(database.getPouchId(child.doc.inventoryItem, 'inventory'));
                inventoryKeys.push(child.doc.inventoryItem);
              }
            });
          }
          this._getInventoryItems(inventoryIds, inventoryList).then(function (inventoryMap) {
            // Link inventory children to inventory items
            inventoryChildren.rows.forEach(function (child) {
              var childItem = inventoryMap[child.doc.inventoryItem];
              if (!_ember['default'].isEmpty(childItem)) {
                if (childName !== 'purchaseObjects' || childItem.purchases.includes(child.doc.id)) {
                  var itemChildren = childItem[childName];
                  if (_ember['default'].isEmpty(itemChildren)) {
                    itemChildren = [];
                  }
                  itemChildren.push(child.doc);
                  childItem[childName] = itemChildren;
                }
              }
            });
            resolve(inventoryMap);
          }, reject);
        }).bind(this), reject);
      }).bind(this));
    },

    _findInventoryItemsByPurchase: function _findInventoryItemsByPurchase(reportTimes, inventoryMap) {
      return this._findInventoryItems({
        startkey: [reportTimes.startTime, 'invPurchase_'],
        endkey: [reportTimes.endTime, 'invPurchase_'],
        include_docs: true
      }, 'inventory_purchase_by_date_received', inventoryMap, 'purchaseObjects');
    },

    _findInventoryItemsByRequest: function _findInventoryItemsByRequest(reportTimes, inventoryMap) {
      return this._findInventoryItems({
        startkey: ['Completed', reportTimes.startTime, 'invRequest_'],
        endkey: ['Completed', reportTimes.endTime, 'invRequest_'],
        include_docs: true
      }, 'inventory_request_by_status', inventoryMap, 'requestObjects');
    },

    _finishExpenseReport: function _finishExpenseReport(reportType) {
      var expenseCategories = this.get('expenseCategories');
      var expenseMap = this.get('expenseMap');
      var i18n = this.get('i18n');
      expenseCategories.forEach((function (category) {
        var categoryTotal = 0;
        var expenseAccountName = undefined,
            totalLabel = undefined;
        this._addReportRow({
          inventoryItem: {
            name: i18n.t('inventory.reports.rows.expensesFor') + category
          }
        });
        expenseMap[category].expenseAccounts.forEach((function (expenseAccount) {
          if (reportType === 'detailedExpense') {
            expenseAccount.reportRows.forEach((function (row) {
              this._addReportRow(row);
            }).bind(this));
          }
          if (_ember['default'].isEmpty(expenseAccount.name)) {
            expenseAccountName = i18n.t('inventory.reports.rows.noAccount');
          } else {
            expenseAccountName = expenseAccount.name;
          }
          totalLabel = i18n.t('inventory.reports.rows.subtotalFor', { category: category, account: expenseAccountName });
          this._addReportRow({
            totalCost: totalLabel + this._numberFormat(expenseAccount.total)
          }, true);
          categoryTotal += expenseAccount.total;
        }).bind(this));
        totalLabel = i18n.t('inventory.reports.rows.totalFor', { 'var': category });
        this._addReportRow({
          totalCost: totalLabel + this._numberFormat(categoryTotal)
        }, true);
        this.incrementProperty('grandCost', categoryTotal);
      }).bind(this));
      this._addReportRow({
        totalCost: i18n.t('inventory.reports.rows.total') + this._numberFormat(this.get('grandCost'))
      }, true);
    },

    _finishLocationReport: function _finishLocationReport() {
      var currentLocation = '';
      var locationCost = 0;
      var locationSummary = this.get('locationSummary');
      var parentLocation = '';
      var parentCount = 0;
      var i18n = this.get('i18n');
      locationSummary = locationSummary.sortBy('name');
      locationSummary.forEach((function (location) {
        parentLocation = this._getWarehouseLocationName(location.name);
        var label = i18n.t('inventory.reports.rows.totalFor', { 'var': currentLocation });
        if (currentLocation !== parentLocation) {
          this._addTotalsRow(label, locationCost, parentCount);
          parentCount = 0;
          locationCost = 0;
          currentLocation = parentLocation;
        }
        if (this._includeLocation(parentLocation)) {
          for (var id in location.items) {
            if (location.items[id].quantity > 0) {
              this._addReportRow({
                giftInKind: location.items[id].giftInKind,
                inventoryItem: location.items[id].item,
                quantity: location.items[id].quantity,
                locations: [{
                  name: location.name
                }],
                totalCost: location.items[id].totalCost,
                unitCost: location.items[id].unitCost
              });
              parentCount += this._getValidNumber(location.items[id].quantity);
              locationCost += this._getValidNumber(location.items[id].totalCost);
              this.incrementProperty('grandCost', this._getValidNumber(location.items[id].totalCost));
              this.incrementProperty('grandQuantity', this._getValidNumber(location.items[id].quantity));
            }
          }
        }
      }).bind(this));
      if (parentCount > 0) {
        this._addTotalsRow(i18n.t('inventory.reports.rows.totalFor', { 'var': parentLocation }), locationCost, parentCount);
      }
    },

    _generateExpirationReport: function _generateExpirationReport() {
      var grandQuantity = 0;
      var database = this.get('database');
      var reportRows = this.get('reportRows');
      var reportTimes = this._getDateQueryParams();
      database.queryMainDB({
        startkey: [reportTimes.startTime, 'invPurchase_'],
        endkey: [reportTimes.endTime, 'invPurchase_'],
        include_docs: true
      }, 'inventory_purchase_by_expiration_date').then((function (inventoryPurchases) {
        var purchaseDocs = [];
        var inventoryIds = [];

        inventoryPurchases.rows.forEach((function (purchase) {
          if (purchase.doc.currentQuantity > 0 && !_ember['default'].isEmpty(purchase.doc.expirationDate)) {
            purchaseDocs.push(purchase.doc);
            inventoryIds.push(database.getPouchId(purchase.doc.inventoryItem, 'inventory'));
          }
        }).bind(this));
        this._getInventoryItems(inventoryIds).then((function (inventoryMap) {
          var i18n = this.get('i18n');
          purchaseDocs.forEach((function (purchase) {
            var currentQuantity = purchase.currentQuantity;

            var expirationDate = new Date(purchase.expirationDate);
            var inventoryItem = inventoryMap[purchase.inventoryItem];
            if (inventoryItem && this._includeLocation(purchase.location)) {
              reportRows.addObject([inventoryItem.friendlyId, inventoryItem.name, currentQuantity, inventoryItem.distributionUnit, (0, _moment['default'])(expirationDate).format('l'), this.formatLocationName(purchase.location, purchase.aisleLocation)]);
              grandQuantity += currentQuantity;
            }
          }).bind(this));
          reportRows.addObject(['', '', i18n.t('inventory.reports.rows.total') + grandQuantity, '', '']);
          this.set('showReportResults', true);
          this.set('reportHeaders', [i18n.t('labels.id'), i18n.t('labels.name'), i18n.t('inventory.labels.currentQuantity'), i18n.t('inventory.labels.distributionUnit'), i18n.t('inventory.labels.expirationDate'), i18n.t('inventory.labels.location')]);
          this._generateExport();
          this._setReportTitle();
          this.closeProgressModal();
        }).bind(this));
      }).bind(this));
    },

    _generateFinancialSummaryReport: function _generateFinancialSummaryReport() {
      var reportTimes = this._getDateQueryParams();
      /*
      step 1: find the valuation as of start date,
      meaning that we need to exchange the end date to be the start date and then tabulate the value
      */
      this._calculateBeginningBalance(reportTimes).then((function (beginningBalance) {
        this._generateSummaries(reportTimes).then((function (inventoryAdjustment) {
          var i = this._numberFormat(beginningBalance + inventoryAdjustment);
          var i18n = this.get('i18n');
          if (beginningBalance + inventoryAdjustment < 0) {
            this.get('reportRows').addObject([i18n.t('inventory.reports.rows.balanceEnd'), '', '(' + i + ')']);
          } else {
            this.get('reportRows').addObject([i18n.t('inventory.reports.rows.balanceEnd'), '', i]);
          }
          this.set('showReportResults', true);
          this.set('reportHeaders', [i18n.t('inventory.reports.rows.category'), i18n.t('labels.type'), i18n.t('inventory.labels.total')]);
          this._generateExport();
          this._setReportTitle();
          this.closeProgressModal();
        }).bind(this), (function (err) {
          this._notifyReportError(this.get('i18n').t('inventory.reports.rows.errInFinSum') + err);
        }).bind(this));
      }).bind(this));
    },

    _generateSummaries: function _generateSummaries(reportTimes) {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        var adjustedValue = 0;
        var i18n = this.get('i18n');
        /*
        cycle through each purchase and request from the beginning of time until startTime
        to determine the total value of inventory as of that date/time.
        */
        this._findInventoryItemsByRequest(reportTimes, {}).then((function (inventoryMap) {
          this._findInventoryItemsByPurchase(reportTimes, inventoryMap).then((function (inventoryMap) {
            var purchaseSummary = {};
            var consumed = {};
            var gikConsumed = {};
            var adjustments = {};
            this.get('adjustmentTypes').forEach(function (adjustmentType) {
              adjustments[adjustmentType.type] = [];
            });
            Object.keys(inventoryMap).forEach((function (key) {
              if (_ember['default'].isEmpty(key) || _ember['default'].isEmpty(inventoryMap[key])) {
                // If the inventory item has been deleted, ignore it.
                return;
              }
              var item = inventoryMap[key];

              if (!_ember['default'].isEmpty(item.purchaseObjects)) {
                item.purchaseObjects.forEach((function (purchase) {
                  purchaseSummary[item.inventoryType] = this._getValidNumber(purchaseSummary[item.inventoryType]) + this._getValidNumber(purchase.purchaseCost);
                }).bind(this));
              }
              if (!_ember['default'].isEmpty(item.requestObjects)) {
                item.requestObjects.forEach((function (request) {
                  // we have three categories here: consumed, gik consumed, and adjustments
                  if (request.adjustPurchases) {
                    if (request.transactionType === 'Fulfillment') {
                      if (request.giftInKind) {
                        gikConsumed[item.inventoryType] = this._getValidNumber(gikConsumed[item.inventoryType]) + this._getValidNumber(request.quantity * request.costPerUnit);
                      } else {
                        consumed[item.inventoryType] = this._getValidNumber(consumed[item.inventoryType]) + this._getValidNumber(request.quantity * request.costPerUnit);
                      }
                    } else {
                      adjustments[request.transactionType][item.inventoryType] = this._getValidNumber(adjustments[request.transactionType][item.inventoryType]) + this._getValidNumber(request.quantity * request.costPerUnit);
                    }
                  }
                }).bind(this));
              }
            }).bind(this));
            // write the purchase rows
            if (Object.keys(purchaseSummary).length > 0) {
              var purchaseTotal = 0;
              this.get('reportRows').addObject([i18n.t('inventory.labels.purchases'), '', '']);
              Object.keys(purchaseSummary).forEach((function (key) {
                var i = this._getValidNumber(purchaseSummary[key]);
                purchaseTotal += i;
                this.get('reportRows').addObject(['', key, this._numberFormat(i)]);
              }).bind(this));
              this.get('reportRows').addObject([i18n.t('inventory.reports.rows.totalPurchases'), '', this._numberFormat(purchaseTotal)]);
              adjustedValue += purchaseTotal;
            }
            // write the consumed rows
            if (Object.keys(consumed).length > 0 || Object.keys(gikConsumed).length > 0) {
              this.get('reportRows').addObject([i18n.t('inventory.reports.rows.consumed'), '', '']);
              var overallValue = 0;
              if (Object.keys(consumed).length > 0) {
                this.get('reportRows').addObject([i18n.t('inventory.reports.rows.consumedPuchases'), '', '']);
                var consumedTotal = 0;
                Object.keys(consumed).forEach((function (key) {
                  var i = this._getValidNumber(consumed[key]);
                  consumedTotal += i;
                  this.get('reportRows').addObject(['', key, '(' + this._numberFormat(i) + ')']);
                }).bind(this));
                overallValue += consumedTotal;
                this.get('reportRows').addObject([i18n.t('inventory.reports.rows.consumedPurchasesTotal'), '', '(' + this._numberFormat(consumedTotal) + ')']);
              }
              if (Object.keys(gikConsumed).length > 0) {
                this.get('reportRows').addObject([i18n.t('inventory.reports.rows.consumedGik'), '', '']);
                var gikTotal = 0;
                Object.keys(gikConsumed).forEach((function (key) {
                  var i = this._getValidNumber(gikConsumed[key]);
                  gikTotal += i;
                  this.get('reportRows').addObject(['', key, '(' + this._numberFormat(i) + ')']);
                }).bind(this));
                overallValue += gikTotal;
                this.get('reportRows').addObject([i18n.t('inventory.reports.rows.consumedGikTotal'), '', '(' + this._numberFormat(gikTotal) + ')']);
              }
              this.get('reportRows').addObject([i18n.t('inventory.reports.rows.consumedTotal'), '', '(' + this._numberFormat(overallValue) + ')']);
              adjustedValue -= overallValue;
            }
            // write the adjustment rows
            var adjustmentTotal = 0;
            this.get('reportRows').addObject([i18n.t('inventory.reports.rows.adjustments'), '', '']);
            Object.keys(adjustments).forEach((function (adjustmentT) {
              if (Object.keys(adjustments[adjustmentT]).length > 0) {
                this.get('reportRows').addObject([adjustmentT, '', '']);
                Object.keys(adjustments[adjustmentT]).forEach((function (key) {
                  var i = this._getValidNumber(adjustments[adjustmentT][key]);
                  if (adjustmentT === 'Adjustment (Add)' || adjustmentT === 'Return') {
                    adjustmentTotal += i;
                    this.get('reportRows').addObject(['', key, this._numberFormat(i)]);
                  } else {
                    adjustmentTotal -= i;
                    this.get('reportRows').addObject(['', key, '(' + this._numberFormat(i) + ')']);
                  }
                }).bind(this));
              }
            }).bind(this));
            if (adjustmentTotal < 0) {
              this.get('reportRows').addObject([i18n.t('inventory.reports.rows.adjustmentsTotal'), '', '(' + this._numberFormat(adjustmentTotal) + ')']);
            } else {
              this.get('reportRows').addObject([i18n.t('inventory.reports.rows.adjustmentsTotal'), '', this._numberFormat(adjustmentTotal)]);
            }

            adjustedValue += adjustmentTotal;
            resolve(adjustedValue);
          }).bind(this), reject);
        }).bind(this), reject);
      }).bind(this));
    },

    _calculateBeginningBalance: function _calculateBeginningBalance(reportTimes) {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        var startingValueReportTimes = {
          startTime: null,
          endTime: reportTimes.startTime
        };
        var beginningBalance = 0;
        var i18n = this.get('i18n');
        /*
        cycle through each purchase and request from the beginning of time until startTime
        to determine the total value of inventory as of that date/time.
        */
        this._findInventoryItemsByRequest(startingValueReportTimes, {}).then((function (inventoryMap) {
          this._findInventoryItemsByPurchase(startingValueReportTimes, inventoryMap).then((function (inventoryMap) {
            Object.keys(inventoryMap).forEach((function (key) {
              if (_ember['default'].isEmpty(key) || _ember['default'].isEmpty(inventoryMap[key])) {
                // If the inventory item has been deleted, ignore it.
                return;
              }
              var item = inventoryMap[key];
              var inventoryPurchases = item.purchaseObjects;
              var inventoryRequests = item.requestObjects;
              var row = {
                inventoryItem: item,
                quantity: 0,
                unitCost: 0,
                totalCost: 0
              };
              if (!_ember['default'].isEmpty(inventoryPurchases)) {
                // Setup intial locations for an inventory item
                inventoryPurchases.forEach(function (purchase) {
                  var purchaseQuantity = purchase.originalQuantity;
                  purchase.calculatedQuantity = purchaseQuantity;
                });
              }
              if (!_ember['default'].isEmpty(inventoryRequests)) {
                inventoryRequests.forEach((function (request) {
                  var adjustPurchases = request.adjustPurchases;

                  var increment = false;
                  var purchases = request.purchasesAffected;
                  var transactionType = request.transactionType;

                  increment = transactionType === 'Adjustment (Add)' || transactionType === 'Return';
                  if (adjustPurchases) {
                    if (!_ember['default'].isEmpty(purchases) && !_ember['default'].isEmpty(inventoryPurchases)) {
                      // Loop through purchase(s) on request and adjust corresponding inventory purchases
                      purchases.forEach((function (purchaseInfo) {
                        this._adjustPurchase(inventoryPurchases, purchaseInfo.id, purchaseInfo.quantity, increment);
                      }).bind(this));
                    }
                  }
                }).bind(this));
              }
              if (!_ember['default'].isEmpty(inventoryPurchases)) {
                row = this._calculateCosts(inventoryPurchases, row);
                beginningBalance += this._getValidNumber(row.totalCost);
              }
            }).bind(this));
            if (beginningBalance < 0) {
              this.get('reportRows').addObject([i18n.t('inventory.reports.rows.balanceBegin'), '', '(' + this._numberFormat(beginningBalance) + ')']);
            } else {
              this.get('reportRows').addObject([i18n.t('inventory.reports.rows.balanceBegin'), '', this._numberFormat(beginningBalance)]);
            }
            resolve(beginningBalance);
          }).bind(this), reject);
        }).bind(this), reject);
      }).bind(this));
    },

    _generateInventoryReport: function _generateInventoryReport() {
      this.set('grandCost', 0);
      this.set('grandQuantity', 0);
      this.set('locationSummary', []);
      var dateDiff = undefined;
      var locationSummary = this.get('locationSummary');
      var reportType = this.get('reportType');
      var reportTimes = this._getDateQueryParams();
      var i18n = this.get('i18n');
      if (reportType === 'daysLeft') {
        var endDate = this.get('endDate');
        var startDate = this.get('startDate');
        if (_ember['default'].isEmpty(endDate) || _ember['default'].isEmpty(startDate)) {
          this.closeProgressModal();
          return;
        } else {
          dateDiff = (0, _moment['default'])(endDate).diff(startDate, 'days');
        }
      }
      this._findInventoryItemsByRequest(reportTimes, {}).then((function (inventoryMap) {
        this._findInventoryItemsByPurchase(reportTimes, inventoryMap).then((function (inventoryMap) {
          // Loop through each inventory item, looking at the requests and purchases to determine
          // state of inventory at effective date
          Object.keys(inventoryMap).forEach((function (key) {
            if (_ember['default'].isEmpty(inventoryMap[key])) {
              // If the inventory item has been deleted, ignore it.
              return;
            }
            var item = inventoryMap[key];
            var inventoryPurchases = item.purchaseObjects;
            var inventoryRequests = item.requestObjects;
            var row = {
              giftInKind: 'N',
              inventoryItem: item,
              quantity: 0,
              unitCost: 0,
              totalCost: 0,
              locations: [],
              vendors: []
            };
            if (!_ember['default'].isEmpty(inventoryPurchases)) {
              // Setup intial locations for an inventory item
              inventoryPurchases.forEach((function (purchase) {
                var locationName = this.getDisplayLocationName(purchase.location, purchase.aisleLocation);
                var purchaseQuantity = purchase.originalQuantity;
                purchase.calculatedQuantity = purchaseQuantity;
                if (purchase.giftInKind === true) {
                  row.giftInKind = 'Y';
                }
                if (!_ember['default'].isEmpty(purchase.vendor)) {
                  if (!row.vendors.includes(purchase.vendor)) {
                    row.vendors.push(purchase.vendor);
                  }
                }
                this._adjustLocation(row.locations, locationName, purchaseQuantity, true);
              }).bind(this));
            }

            if (!_ember['default'].isEmpty(inventoryRequests)) {
              inventoryRequests.forEach((function (request) {
                var adjustPurchases = request.adjustPurchases;
                var transactionType = request.transactionType;

                var increment = false;
                var locations = request.locationsAffected;
                var purchases = request.purchasesAffected;

                increment = transactionType === 'Adjustment (Add)' || transactionType === 'Return';
                if (adjustPurchases) {
                  if (!_ember['default'].isEmpty(purchases) && !_ember['default'].isEmpty(inventoryPurchases)) {
                    // Loop through purchase(s) on request and adjust corresponding inventory purchases
                    purchases.forEach((function (purchaseInfo) {
                      this._adjustPurchase(inventoryPurchases, purchaseInfo.id, purchaseInfo.quantity, increment);
                    }).bind(this));
                  }
                } else if (transactionType === 'Transfer') {
                  // Increment the delivery location
                  var locationName = this.getDisplayLocationName(request.deliveryLocation, request.deliveryAisle);
                  this._adjustLocation(row.locations, locationName, request.quantity, true);
                }
                // Loop through locations to adjust location quantity
                locations.forEach((function (locationInfo) {
                  this._adjustLocation(row.locations, locationInfo.name, locationInfo.quantity, increment);
                }).bind(this));
              }).bind(this));
            }

            var summaryCost = 0;
            var summaryQuantity = 0;

            switch (reportType) {
              case 'byLocation':
                {
                  row.locations.forEach((function (location) {
                    var locationToUpdate = locationSummary.findBy('name', this._getWarehouseLocationName(location.name));
                    if (_ember['default'].isEmpty(locationToUpdate)) {
                      locationToUpdate = _ember['default'].copy(location);
                      locationToUpdate.items = {};
                      locationSummary.push(locationToUpdate);
                    } else {
                      locationToUpdate.quantity += this._getValidNumber(location.quantity);
                    }
                    var costData = this._calculateCosts(inventoryPurchases, {
                      quantity: 0,
                      totalCost: 0
                    });
                    locationToUpdate.items[item.id] = {
                      item: item,
                      quantity: this._getValidNumber(location.quantity),
                      giftInKind: row.giftInKind,
                      totalCost: this._getValidNumber(costData.unitCost) * this._getValidNumber(location.quantity),
                      unitCost: this._getValidNumber(costData.unitCost)
                    };
                  }).bind(this));
                  break;
                }
              case 'daysLeft':
                {
                  if (!_ember['default'].isEmpty(inventoryRequests) && this._hasIncludedLocation(row.locations)) {
                    var consumedQuantity = inventoryRequests.reduce((function (previousValue, request) {
                      if (request.transactionType === 'Fulfillment') {
                        return previousValue += this._getValidNumber(request.quantity);
                      } else {
                        return previousValue;
                      }
                    }).bind(this), 0);
                    row.quantity = this._getValidNumber(item.quantity);
                    if (consumedQuantity > 0) {
                      row.consumedPerDay = this._numberFormat(consumedQuantity / dateDiff, true);
                      row.daysLeft = this._numberFormat(row.quantity / row.consumedPerDay);
                    } else {
                      if (consumedQuantity === 0) {
                        row.consumedPerDay = '0';
                      } else {
                        row.consumedPerDay = '?' + consumedQuantity;
                      }
                      row.daysLeft = '?';
                    }
                    this._addReportRow(row);
                  }
                  break;
                }
              case 'detailedAdjustment':
              case 'detailedTransfer':
              case 'detailedUsage':
              case 'detailedExpense':
              case 'summaryExpense':
                {
                  if (!_ember['default'].isEmpty(inventoryRequests)) {
                    inventoryRequests.forEach((function (request) {
                      var _this2 = this;

                      if (this._includeTransaction(reportType, request.transactionType) && this._hasIncludedLocation(request.locationsAffected)) {
                        (function () {
                          var deliveryLocation = _this2.getDisplayLocationName(request.deliveryLocation, request.deliveryAisle);
                          var locations = [];
                          var num = _this2._getValidNumber(request.quantity);
                          var totalCost = _this2._getValidNumber(request.quantity) * _this2._getValidNumber(request.costPerUnit);
                          locations = request.locationsAffected.map((function (location) {
                            if (reportType === 'detailedTransfer') {
                              return {
                                name: i18n.t('inventory.reports.rows.transfer2', { source: location.name, target: deliveryLocation }).toString()
                              };
                            } else {
                              return {
                                name: i18n.t('inventory.reports.rows.transfer1', { quantity: num, location: location.name }).toString()
                              };
                            }
                          }).bind(_this2));
                          var reportRow = {
                            date: (0, _moment['default'])(new Date(request.dateCompleted)).format('l'),
                            expenseAccount: request.expenseAccount,
                            giftInKind: row.giftInKind,
                            inventoryItem: row.inventoryItem,
                            quantity: request.quantity,
                            transactionType: request.transactionType,
                            locations: locations,
                            unitCost: request.costPerUnit,
                            totalCost: totalCost
                          };
                          if (reportType === 'detailedExpense' || reportType === 'summaryExpense') {
                            _this2._updateExpenseMap(request, reportRow);
                          } else {
                            _this2._addReportRow(reportRow);
                            summaryQuantity += _this2._getValidNumber(request.quantity);
                            summaryCost += _this2._getValidNumber(totalCost);
                          }
                        })();
                      }
                    }).bind(this));
                    if (reportType !== 'detailedExpense' && reportType !== 'summaryExpense') {
                      this._addTotalsRow(i18n.t('inventory.reports.rows.subtotal'), summaryCost, summaryQuantity);
                      this.incrementProperty('grandCost', summaryCost);
                      this.incrementProperty('grandQuantity', summaryQuantity);
                    }
                  }
                  break;
                }
              case 'summaryTransfer':
              case 'summaryUsage':
                {
                  if (!_ember['default'].isEmpty(inventoryRequests) && this._hasIncludedLocation(row.locations)) {
                    row.quantity = inventoryRequests.reduce((function (previousValue, request) {
                      if (this._includeTransaction(reportType, request.transactionType)) {
                        var totalCost = this._getValidNumber(request.quantity) * this._getValidNumber(request.costPerUnit);
                        summaryCost += totalCost;
                        return previousValue += this._getValidNumber(request.quantity);
                      } else {
                        return previousValue;
                      }
                    }).bind(this), 0);
                    if (row.quantity > 0) {
                      row.totalCost = summaryCost;
                      row.unitCost = summaryCost / row.quantity;
                      this._addReportRow(row);
                      this.incrementProperty('grandCost', summaryCost);
                      this.incrementProperty('grandQuantity', row.quantity);
                    }
                  }
                  break;
                }
              case 'detailedPurchase':
                {
                  if (!_ember['default'].isEmpty(inventoryPurchases)) {
                    inventoryPurchases.forEach((function (purchase) {
                      if (this._includeLocation(purchase.location)) {
                        var giftInKind = 'N';
                        if (purchase.giftInKind === true) {
                          giftInKind = 'Y';
                        }
                        this._addReportRow({
                          date: (0, _moment['default'])(new Date(purchase.dateReceived)).format('l'),
                          giftInKind: giftInKind,
                          inventoryItem: row.inventoryItem,
                          quantity: purchase.originalQuantity,
                          unitCost: purchase.costPerUnit,
                          totalCost: purchase.purchaseCost,
                          locations: [{
                            name: this.getDisplayLocationName(purchase.location, purchase.aisleLocation)
                          }]
                        });
                        summaryCost += this._getValidNumber(purchase.purchaseCost);
                        summaryQuantity += this._getValidNumber(purchase.originalQuantity);
                      }
                    }).bind(this));
                    this._addTotalsRow(i18n.t('inventory.reports.rows.subtotal'), summaryCost, summaryQuantity);
                    this.incrementProperty('grandCost', summaryCost);
                    this.incrementProperty('grandQuantity', summaryQuantity);
                  }
                  break;
                }
              case 'summaryPurchase':
                {
                  if (!_ember['default'].isEmpty(inventoryPurchases)) {
                    row.locations = [];
                    row.quantity = inventoryPurchases.reduce((function (previousValue, purchase) {
                      summaryCost += this._getValidNumber(purchase.purchaseCost);
                      var locationName = this.getDisplayLocationName(purchase.location, purchase.aisleLocation);
                      if (!row.locations.findBy('name', locationName)) {
                        row.locations.push({
                          name: this.getDisplayLocationName(purchase.location, purchase.aisleLocation)
                        });
                      }
                      return previousValue += this._getValidNumber(purchase.originalQuantity);
                    }).bind(this), 0);
                    if (this._hasIncludedLocation(row.locations)) {
                      row.unitCost = summaryCost / row.quantity;
                      row.totalCost = summaryCost;
                      this._addReportRow(row);
                      this.incrementProperty('grandCost', summaryCost);
                      this.incrementProperty('grandQuantity', row.quantity);
                    }
                  }
                  break;
                }
              case 'valuation':
                {
                  if (!_ember['default'].isEmpty(inventoryPurchases) && this._hasIncludedLocation(row.locations)) {
                    this._calculateCosts(inventoryPurchases, row);
                    this.incrementProperty('grandCost', this._getValidNumber(row.totalCost));
                    this.incrementProperty('grandQuantity', this._getValidNumber(row.quantity));
                    this._addReportRow(row);
                  }
                  break;
                }
            }
          }).bind(this));
          switch (reportType) {
            case 'detailedExpense':
            case 'summaryExpense':
              {
                this._finishExpenseReport(reportType);
                break;
              }
            case 'byLocation':
              {
                this._finishLocationReport();
                this._addTotalsRow(i18n.t('inventory.reports.rows.total'), this.get('grandCost'), this.get('grandQuantity'));
                break;
              }
            default:
              {
                this._addTotalsRow(i18n.t('inventory.reports.rows.total'), this.get('grandCost'), this.get('grandQuantity'));
              }
          }
          this._finishReport();
        }).bind(this), (function (err) {
          this._notifyReportError(i18n.t('inventory.reports.rows.errInFindPur') + err);
        }).bind(this));
      }).bind(this), (function (err) {
        this._notifyReportError(i18n.t('inventory.reports.rows.errInFindPur') + err);
      }).bind(this));
    },

    _getDateQueryParams: function _getDateQueryParams() {
      var endDate = this.get('endDate');
      var endTime = this.get('maxValue');
      var startDate = this.get('startDate');
      var startTime = undefined;
      if (!_ember['default'].isEmpty(endDate)) {
        endTime = (0, _moment['default'])(endDate).endOf('day').toDate().getTime();
      }
      if (!_ember['default'].isEmpty(startDate)) {
        startTime = (0, _moment['default'])(startDate).startOf('day').toDate().getTime();
      }
      return {
        endTime: endTime,
        startTime: startTime
      };
    },

    _getInventoryItems: function _getInventoryItems(inventoryIds, inventoryMap) {
      var database = this.get('database');
      return new _ember['default'].RSVP.Promise(function (resolve, reject) {
        if (_ember['default'].isEmpty(inventoryMap)) {
          inventoryMap = {};
        }
        database.queryMainDB({
          keys: inventoryIds,
          include_docs: true
        }).then(function (inventoryItems) {
          inventoryItems.rows.forEach(function (inventoryItem) {
            if (inventoryItem.doc && inventoryItem.doc.archived !== true) {
              inventoryMap[inventoryItem.doc.id] = inventoryItem.doc;
            }
          });
          resolve(inventoryMap);
        }, reject);
      });
    },

    /**
     * Pull the warehouse name out of a formatted location name that (may) include the aisle location
     * @param {string} locationName the formatted location name.
     * @return {string} the warehouse name.
     */
    _getWarehouseLocationName: function _getWarehouseLocationName(locationName) {
      var returnLocation = '';
      if (locationName.indexOf(':') > -1) {
        returnLocation = locationName.split(':')[0].trim();
      } else {
        returnLocation = locationName;
      }
      return returnLocation;
    },

    /**
     * Determines if any of the passed in location objects match the currently filtered location
     * @param {array} locations list of location objects to check.
     * @return {boolean} true if any of the locations match the filter; otherwise false.
     */
    _hasIncludedLocation: function _hasIncludedLocation(locations) {
      var hasIncludedLocation = false;
      locations.forEach((function (location) {
        var locationName = this._getWarehouseLocationName(location.name);
        if (this._includeLocation(locationName)) {
          hasIncludedLocation = true;
        }
      }).bind(this));
      return hasIncludedLocation;
    },

    /**
     * Determine if the specified location should be included in the report
     * @param {string} location the location to check for inclusion
     * @return {boolean} true if the location should be included.
     */
    _includeLocation: function _includeLocation(location) {
      var filterLocation = this.get('filterLocation');
      return _ember['default'].isEmpty(filterLocation) || location === filterLocation;
    },

    /**
     * Given a report type and a transaction type determine if the transaction should
     * be included in the report.
     * @param {string} reportType the report type
     * @param {string} transactionType the transaction type
     * @return {boolean} true if the transaction should be included.
     */
    _includeTransaction: function _includeTransaction(reportType, transactionType) {
      var detailed = reportType.indexOf('detailed') === 0;
      var includeForReportType = undefined;
      if (reportType === 'detailedExpense' || reportType === 'summaryExpense') {
        return true;
      }
      switch (transactionType) {
        case 'Fulfillment':
          {
            if (detailed) {
              includeForReportType = 'detailedUsage';
            } else {
              includeForReportType = 'summaryUsage';
            }
            break;
          }
        case 'Transfer':
          {
            if (detailed) {
              includeForReportType = 'detailedTransfer';
            } else {
              includeForReportType = 'summaryTransfer';
            }
            break;
          }
        default:
          {
            if (detailed) {
              includeForReportType = 'detailedAdjustment';
            } else {
              includeForReportType = 'summaryAdjustment';
            }
          }
      }
      return reportType === includeForReportType;
    },

    _updateExpenseMap: function _updateExpenseMap(request, reportRow) {
      var categoryToUpdate = undefined;
      var expenseMap = this.get('expenseMap');
      var isGiftInKind = reportRow.giftInKind === 'Y';
      var increment = true;

      switch (request.transactionType) {
        case 'Fulfillment':
        case 'Return':
          {
            if (isGiftInKind) {
              categoryToUpdate = expenseMap['Gift In Kind Usage'];
            } else {
              categoryToUpdate = expenseMap['Inventory Consumed'];
            }
            if (request.transactionType === 'Return') {
              increment = false;
            }
            break;
          }
        case 'Adjustment (Add)':
        case 'Adjustment (Remove)':
        case 'Return To Vendor':
        case 'Write Off':
          {
            categoryToUpdate = expenseMap['Inventory Obsolence'];
            if (request.transactionType === 'Adjustment (Add)') {
              increment = false;
            }
            break;
          }
      }
      if (!_ember['default'].isEmpty(categoryToUpdate)) {
        var expenseAccountToUpdate = categoryToUpdate.expenseAccounts.findBy('name', request.expenseAccount);
        if (_ember['default'].isEmpty(expenseAccountToUpdate)) {
          expenseAccountToUpdate = {
            name: request.expenseAccount,
            total: 0,
            reportRows: []
          };
          categoryToUpdate.expenseAccounts.push(expenseAccountToUpdate);
        }
        expenseAccountToUpdate.reportRows.push(reportRow);
        var transactionValue = this._getValidNumber(request.quantity) * this._getValidNumber(request.costPerUnit);
        if (increment) {
          categoryToUpdate.total += transactionValue;
          expenseAccountToUpdate.total += transactionValue;
        } else {
          categoryToUpdate.total = categoryToUpdate.total - transactionValue;
          expenseAccountToUpdate.total = expenseAccountToUpdate.total - transactionValue;
          reportRow.totalCost = reportRow.totalCost * -1;
        }
      }
    },

    actions: {
      generateReport: function generateReport() {
        var _this3 = this;

        var endDate = this.get('endDate');
        var reportRows = this.get('reportRows');
        var reportType = this.get('reportType');
        var startDate = this.get('startDate');
        if (_ember['default'].isEmpty(startDate) && _ember['default'].isEmpty(endDate)) {
          return;
        }
        reportRows.clear();
        this.showProgressModal();
        switch (reportType) {
          case 'expiration':
            {
              this._generateExpirationReport();
              break;
            }
          case 'summaryFinance':
            {
              this._generateFinancialSummaryReport();
              break;
            }
          case 'detailedExpense':
          case 'summaryExpense':
            {
              var _ret3 = (function () {
                var expenseCategories = _this3.get('expenseCategories');
                var expenseMap = {};
                expenseCategories.forEach(function (category) {
                  expenseMap[category] = {
                    total: 0,
                    expenseAccounts: []
                  };
                });
                _this3.set('expenseMap', expenseMap);
                _this3._generateInventoryReport();
                return 'break';
              })();

              if (_ret3 === 'break') break;
            }
          default:
            {
              this._generateInventoryReport();
              break;
            }
        }
      },

      viewInventory: function viewInventory(id) {
        this.store.find('inventory', id).then((function (item) {
          item.set('returnTo', 'inventory.reports');
          this.transitionToRoute('inventory.edit', item);
        }).bind(this));
      }
    }
  });
});
define('hospitalrun/inventory/reports/route', ['exports', 'hospitalrun/routes/abstract-index-route', 'ember', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractIndexRoute, _ember, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend({
    pageTitle: (0, _emberI18n.translationMacro)('inventory.titles.inventoryReport'),

    // No model for reports; data gets retrieved when report is run.
    model: function model() {
      return _ember['default'].RSVP.resolve(_ember['default'].Object.create({}));
    }

  });
});
define("hospitalrun/inventory/reports/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "LmDgYWk0", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[null]],false]],11],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"generateReport\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.reports.generate\"],null],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showReportResults\"]]],null,1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"get\",[\"reportHeader\"]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"reportHeader\"]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"reportTitle\"]],false],[\"append\",[\"helper\",[\"nav-paging\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"reportHeaders\"]]],null,0],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"partial\",\"report-rows\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"a\",[]],[\"dynamic-attr\",\"href\",[\"unknown\",[\"csvExport\"]],null],[\"static-attr\",\"target\",\"_blank\"],[\"dynamic-attr\",\"download\",[\"concat\",[[\"unknown\",[\"reportTitle\"]],\".csv\"]]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.reports.export\"],null],false],[\"close-element\"],[\"text\",\"\\n\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"transactionType\",\"label\"]],\"reportColumns.transactionType.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"expenseAccount\",\"label\"]],\"reportColumns.expenseAccount.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"consumedPerDay\",\"label\"]],\"reportColumns.consumedPerDay.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"daysLeft\",\"label\"]],\"reportColumns.daysLeft.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"total\",\"label\"]],\"reportColumns.total.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"unitcost\",\"label\"]],\"reportColumns.unitcost.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"date\",\"label\"]],\"reportColumns.date.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"h3\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.reports.fields\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"includeDate\"]]],null,6],[\"text\",\"          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"id\",\"label\"]],\"reportColumns.id.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"name\",\"label\"]],\"reportColumns.name.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"description\",\"label\"]],\"reportColumns.description.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"type\",\"label\"]],\"reportColumns.type.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"quantity\",\"label\"]],\"reportColumns.quantity.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"unit\",\"label\"]],\"reportColumns.unit.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"includeCostFields\"]]],null,5],[\"block\",[\"if\"],[[\"get\",[\"includeDaysLeft\"]]],null,4],[\"text\",\"          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"price\",\"label\"]],\"reportColumns.price.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"reorder\",\"label\"]],\"reportColumns.reorder.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"gift\",\"label\"]],\"reportColumns.gift.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"locations\",\"label\"]],\"reportColumns.locations.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"aisle\",\"label\"]],\"reportColumns.aisle.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"xref\",\"label\"]],\"reportColumns.xref.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"vendor\",\"label\"]],\"reportColumns.vendor.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"includeExpenseAccount\"]]],null,3],[\"block\",[\"if\"],[[\"get\",[\"includeTransactionType\"]]],null,2],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"startDate\",[\"helper\",[\"t\"],[\"inventory.labels.dateStart\"],null],\"col-sm-4 test-start-date\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"endDate\",[\"helper\",[\"t\"],[\"inventory.labels.dateEnd\"],null],\"col-sm-4 test-end-date\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"endDate\",[\"helper\",[\"t\"],[\"inventory.labels.dateEffective\"],null],\"col-sm-4\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\",\"prompt\"],[\"col-xs-6\",[\"helper\",[\"t\"],[\"inventory.labels.location\"],null],\"filterLocation\",[\"get\",[\"warehouseList\"]],\" \"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-xs-6\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"static-attr\",\"for\",\"report-type\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.reports.reportType\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"select-list\"],null,[[\"action\",\"class\",\"content\",\"id\",\"optionValuePath\",\"optionLabelPath\",\"value\"],[[\"helper\",[\"action\"],[[\"get\",[null]],[\"helper\",[\"mut\"],[[\"get\",[\"reportType\"]]],null]],null],\"form-control\",[\"get\",[\"reportTypes\"]],\"report-type\",\"value\",\"name\",[\"get\",[\"reportType\"]]]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"unless\"],[[\"get\",[\"hideLocationFilter\"]]],null,10],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showEffectiveDate\"]]],null,9,8],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"useFieldPicker\"]]],null,7],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/inventory/reports/template.hbs" } });
});
define('hospitalrun/inventory/request/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'hospitalrun/mixins/fulfill-request', 'hospitalrun/mixins/inventory-locations', 'ember'], function (exports, _hospitalrunControllersAbstractEditController, _hospitalrunMixinsFulfillRequest, _hospitalrunMixinsInventoryLocations, _ember) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsFulfillRequest['default'], _hospitalrunMixinsInventoryLocations['default'], {
    inventoryController: _ember['default'].inject.controller('inventory'),
    inventoryItems: null,
    cancelAction: 'allRequests',

    warehouseList: _ember['default'].computed.alias('inventoryController.warehouseList'),
    aisleLocationList: _ember['default'].computed.alias('inventoryController.aisleLocationList'),
    expenseAccountList: _ember['default'].computed.alias('inventoryController.expenseAccountList'),

    inventoryList: (function () {
      var inventoryItems = this.get('inventoryItems');
      if (!_ember['default'].isEmpty(inventoryItems)) {
        var mappedItems = inventoryItems.map(function (item) {
          return item.doc;
        });
        return mappedItems;
      }
    }).property('inventoryItems.[]'),

    lookupListsToUpdate: [{
      name: 'expenseAccountList', // Name of property containing lookup list
      property: 'model.expenseAccount', // Corresponding property on model that potentially contains a new value to add to the list
      id: 'expense_account_list' // Id of the lookup list to update
    }, {
      name: 'aisleLocationList', // Name of property containing lookup list
      property: 'model.deliveryAisle', // Corresponding property on model that potentially contains a new value to add to the list
      id: 'aisle_location_list' // Id of the lookup list to update
    }, {
      name: 'warehouseList', // Name of property containing lookup list
      property: 'model.deliveryLocation', // Corresponding property on model that potentially contains a new value to add to the list
      id: 'warehouse_list' // Id of the lookup list to update
    }],

    canFulfill: (function () {
      var requestedItems = this.get('model.requestedItems');
      return _ember['default'].isEmpty(requestedItems) && this.currentUserCan('fulfill_inventory');
    }).property('model.requestedItems.[]'),

    isFulfilling: (function () {
      var canFulfill = this.get('canFulfill');
      var isRequested = this.get('isRequested');
      var fulfillRequest = this.get('model.shouldFulfillRequest');
      var isFulfilling = canFulfill && (isRequested || fulfillRequest);
      if (isFulfilling) {
        if (_ember['default'].isEmpty(this.get('model.dateCompleted'))) {
          this.set('model.dateCompleted', new Date());
        }
      } else {
        this.set('model.dateCompleted');
      }
      return isFulfilling;
    }).property('isRequested', 'model.shouldFulfillRequest'),

    isRequested: (function () {
      var status = this.get('model.status');
      return status === 'Requested';
    }).property('model.status'),

    quantityLabel: (function () {
      var selectedInventoryItem = this.get('selectedInventoryItem');
      if (_ember['default'].isEmpty(selectedInventoryItem)) {
        return this.get('i18n').t('labels.quantity').toString();
      } else {
        return this.get('i18n').t('inventory.labels.quantity', { unit: selectedInventoryItem.distributionUnit }).toString();
      }
    }).property('selectedInventoryItem'),

    showRequestedItems: (function () {
      var requestedItems = this.get('model.requestedItems');
      return !_ember['default'].isEmpty(requestedItems);
    }).property('model.requestedItems.[]'),

    updateViaFulfillRequest: false,

    updateButtonText: (function () {
      if (this.get('isFulfilling')) {
        return this.get('i18n').t('buttons.fulfill');
      }
      return this._super();
    }).property('model.isNew', 'isFulfilling'),

    updateCapability: 'add_inventory_request',

    actions: {
      addInventoryItem: function addInventoryItem() {
        var model = this.get('model');
        var inventoryItem = model.get('inventoryItem');
        var requestedItems = model.get('requestedItems');
        var quantity = model.get('quantity');
        model.validate().then((function () {
          if (model.get('isValid') && !_ember['default'].isEmpty(inventoryItem) && !_ember['default'].isEmpty(quantity)) {
            var requestedItem = _ember['default'].Object.create({
              item: inventoryItem.get('content'),
              quantity: quantity
            });
            requestedItems.addObject(requestedItem);
            model.set('inventoryItem');
            model.set('inventoryItemTypeAhead');
            model.set('quantity');
            this.set('selectedInventoryItem');
          }
        }).bind(this))['catch'](_ember['default'].K);
      },

      allRequests: function allRequests() {
        this.transitionToRoute('inventory.index');
      },

      removeItem: function removeItem(removeInfo) {
        var requestedItems = this.get('model.requestedItems');
        var item = removeInfo.itemToRemove;
        requestedItems.removeObject(item);
        this.send('closeModal');
      },

      showRemoveItem: function showRemoveItem(item) {
        var message = this.get('i18n').t('inventory.messages.removeItemRequest');
        var model = _ember['default'].Object.create({
          itemToRemove: item
        });
        var title = this.get('i18n').t('inventory.titles.removeItem');
        this.displayConfirm(title, message, 'removeItem', model);
      },

      /**
       * Update the model and perform the before update and after update
       * @param skipAfterUpdate boolean (optional) indicating whether or not
       * to skip the afterUpdate call.
       */
      update: function update(skipAfterUpdate) {
        this.beforeUpdate().then((function () {
          var _this = this;

          var updateViaFulfillRequest = this.get('updateViaFulfillRequest');
          if (updateViaFulfillRequest) {
            this.updateLookupLists();
            this.performFulfillRequest(this.get('model'), false, false, true).then(this.afterUpdate.bind(this));
          } else {
            var isNew = this.get('model.isNew');
            var requestedItems = this.get('model.requestedItems');
            if (isNew && !_ember['default'].isEmpty(requestedItems)) {
              (function () {
                var baseModel = _this.get('model');
                var propertiesToCopy = baseModel.getProperties(['dateRequested', 'deliveryAisle', 'deliveryLocation', 'expenseAccount', 'requestedBy', 'status']);
                var inventoryPromises = [];
                var newModels = [];
                var savePromises = [];
                if (!_ember['default'].isEmpty(_this.get('model.inventoryItem')) && !_ember['default'].isEmpty(_this.get('model.quantity'))) {
                  savePromises.push(baseModel.save());
                }
                requestedItems.forEach((function (requestedItem) {
                  propertiesToCopy.inventoryItem = requestedItem.get('item');
                  propertiesToCopy.quantity = requestedItem.get('quantity');
                  var modelToSave = this.get('store').createRecord('inv-request', propertiesToCopy);
                  inventoryPromises.push(modelToSave.get('inventoryItem'));
                  newModels.push(modelToSave);
                }).bind(_this));
                _ember['default'].RSVP.all(inventoryPromises, 'Get inventory items for inventory requests').then((function () {
                  newModels.forEach(function (newModel) {
                    savePromises.push(newModel.save());
                  });
                  _ember['default'].RSVP.all(savePromises, 'Save batch inventory requests').then((function () {
                    this.updateLookupLists();
                    this.afterUpdate();
                  }).bind(this));
                }).bind(_this));
              })();
            } else {
              this.get('model').save().then((function (record) {
                this.updateLookupLists();
                if (!skipAfterUpdate) {
                  this.afterUpdate(record);
                }
              }).bind(this));
            }
          }
        }).bind(this));
      }
    },

    afterUpdate: function afterUpdate() {
      var updateViaFulfillRequest = this.get('updateViaFulfillRequest');
      if (updateViaFulfillRequest) {
        this.displayAlert(this.get('i18n').t('inventory.titles.requestFulfilled'), this.get('i18n').t('inventory.messages.requestFulfilled'), 'allRequests');
      } else {
        this.displayAlert(this.get('i18n').t('inventory.titles.requestUpdated'), this.get('i18n').t('inventory.messages.requestUpdated'));
      }
    },

    beforeUpdate: function beforeUpdate() {
      if (this.get('isFulfilling')) {
        this.set('updateViaFulfillRequest', true);
      } else {
        this.set('updateViaFulfillRequest', false);
      }
      if (this.get('model.isNew')) {
        this.set('model.dateRequested', new Date());
        this.set('model.requestedBy', this.get('model').getUserName());
        if (!this.get('isFulfilling')) {
          this.set('model.status', 'Requested');
        }
      }
      return _ember['default'].RSVP.resolve();
    }
  });
});
// inventory-locations mixin is needed for fulfill-request mixin!
define('hospitalrun/inventory/request/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'ember', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractEditRoute, _ember, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend({
    editTitle: (0, _emberI18n.translationMacro)('inventory.titles.editRequest'),
    modelName: 'inv-request',
    newTitle: (0, _emberI18n.translationMacro)('inventory.titles.addRequest'),
    database: _ember['default'].inject.service(),
    getNewData: function getNewData() {
      return _ember['default'].RSVP.resolve({
        transactionType: 'Request',
        requestedItems: []
      });
    },

    actions: {
      allRequests: function allRequests(model) {
        this.controller.send('allRequests', model);
      },

      removeItem: function removeItem(model) {
        this.controller.send('removeItem', model);
      }
    },

    /**
     * Lazily load inventory items so that it doesn't impact performance.
     */
    setupController: function setupController(controller, model) {
      this._super(controller, model);
      var inventoryQuery = {
        startkey: 'inventory_',
        endkey: 'inventory_',
        include_docs: true
      };
      this.get('database').queryMainDB(inventoryQuery).then(function (result) {
        controller.set('inventoryItems', result.rows);
      });
    }
  });
});
define("hospitalrun/inventory/request/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "qer6XY+A", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],7]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"dateCompleted\",[\"helper\",[\"t\"],[\"labels.dateCompleted\"],null],\"col-sm-4\"]]],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"inventory-location-picker\"],null,[[\"label\",\"quantityRequested\",\"locationList\",\"selectedLocations\",\"class\"],[[\"helper\",[\"t\"],[\"inventory.labels.pullFrom\"],null],[\"get\",[\"model\",\"quantity\"]],[\"get\",[\"model\",\"inventoryItem\",\"availableLocations\"]],[\"get\",[\"model\",\"inventoryLocations\"]],\"inventory-location\"]]],false],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label sr-only\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.consumePurchases\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"inventory.labels.markAsConsumed\"],null],\"markAsConsumed\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label sr-only\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.fulfillRequest\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"inventory.labels.fulfillRequest\"],null],\"shouldFulfillRequest\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"append\",[\"unknown\",[\"requestedItem\",\"item\",\"name\"]],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-2\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"input-group\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"append\",[\"helper\",[\"input\"],null,[[\"class\",\"value\"],[\"form-control\",[\"get\",[\"requestedItem\",\"quantity\"]]]]],false],[\"text\",\"\\n                  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"input-group-addon\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"requestedItem\",\"item\",\"distributionUnit\"]],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showRemoveItem\",[\"get\",[\"requestedItem\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.remove\"],null],false],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"requestedItem\"]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"h3\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.requestedItems\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.name\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.quantity\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.action\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"requestedItems\"]]],null,2],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"inventory-typeahead\"],null,[[\"class\",\"property\",\"label\",\"content\",\"selection\"],[\"col-sm-8 test-inv-item\",\"inventoryItemTypeAhead\",[\"helper\",[\"t\"],[\"inventory.labels.inventoryItem\"],null],[\"get\",[\"inventoryList\"]],[\"get\",[\"selectedInventoryItem\"]]]]],false],[\"text\",\"\\n\\n        \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"property\",\"label\",\"class\"],[\"quantity\",[\"get\",[\"quantityLabel\"]],\"col-sm-3 test-inv-quantity\"]]],false],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-sm-1\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"h4\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-plus\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"addInventoryItem\"]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showRequestedItems\"]]],null,3],[\"block\",[\"if\"],[[\"get\",[\"canFulfill\"]]],null,1]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.item\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"inventoryItem\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.quantityRequested\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"quantity\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.quantityOnHand\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"inventoryItem\",\"quantity\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"isRequested\"]]],null,5,4],[\"text\",\"    \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"class\"],[\"deliveryLocation\",[\"helper\",[\"t\"],[\"inventory.labels.deliveryLocation\"],null],[\"get\",[\"warehouseList\"]],[\"get\",[\"model\",\"deliveryLocation\"]],\"test-delivery-location\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"class\"],[\"deliveryAisle\",[\"helper\",[\"t\"],[\"inventory.labels.deliveryAisle\"],null],[\"get\",[\"aisleLocationList\"]],[\"get\",[\"model\",\"deliveryAisle\"]],\"test-delivery-aisle\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"class\"],[\"expenseAccount\",[\"helper\",[\"t\"],[\"inventory.labels.billTo\"],null],[\"get\",[\"expenseAccountList\"]],[\"get\",[\"model\",\"expenseAccount\"]],\"test-bill-to\"]]],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"isFulfilling\"]]],null,0]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],6]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/inventory/request/template.hbs" } });
});
define('hospitalrun/inventory/route', ['exports', 'hospitalrun/routes/abstract-module-route', 'hospitalrun/mixins/fulfill-request', 'hospitalrun/mixins/inventory-id', 'hospitalrun/mixins/inventory-locations'], function (exports, _hospitalrunRoutesAbstractModuleRoute, _hospitalrunMixinsFulfillRequest, _hospitalrunMixinsInventoryId, _hospitalrunMixinsInventoryLocations) {
  // inventory-locations mixin is needed for fulfill-request mixin!
  exports['default'] = _hospitalrunRoutesAbstractModuleRoute['default'].extend(_hospitalrunMixinsFulfillRequest['default'], _hospitalrunMixinsInventoryId['default'], _hospitalrunMixinsInventoryLocations['default'], {
    addCapability: 'add_inventory_item',
    additionalButtons: (function () {
      if (this.currentUserCan(this.get('addCapability'))) {
        return [{
          buttonAction: 'newInventoryBatch',
          buttonText: '+ inventory received',
          'class': 'btn btn-primary'
        }];
      }
    }).property(),

    additionalModels: [{
      name: 'aisleLocationList',
      findArgs: ['lookup', 'aisle_location_list']
    }, {
      name: 'expenseAccountList',
      findArgs: ['lookup', 'expense_account_list']
    }, {
      name: 'inventoryTypeList',
      findArgs: ['lookup', 'inventory_types']
    }, {
      name: 'inventoryUnitList',
      findArgs: ['lookup', 'unit_types']
    }, {
      name: 'warehouseList',
      findArgs: ['lookup', 'warehouse_list']
    }, {
      name: 'vendorList',
      findArgs: ['lookup', 'vendor_list']
    }],

    currentItem: null,
    moduleName: 'inventory',

    newButtonText: '+ new request',
    sectionTitle: 'Inventory',

    actions: {
      addPurchase: function addPurchase(newPurchase) {
        var currentItem = this.get('currentItem');
        var purchases = currentItem.get('purchases');
        purchases.addObject(newPurchase);
        this.newPurchaseAdded(currentItem, newPurchase).then((function () {
          currentItem.updateQuantity();
          currentItem.save().then((function () {
            this.send('closeModal');
          }).bind(this));
        }).bind(this));
      },

      newInventoryBatch: function newInventoryBatch() {
        if (this.currentUserCan(this.get('addCapability'))) {
          this.transitionTo('inventory.batch', 'new');
        }
      },

      newRequest: function newRequest() {
        this.transitionTo('inventory.request', 'new');
      },

      allItems: function allItems() {
        this.transitionTo('inventory.listing');
      },

      showAddPurchase: function showAddPurchase(inventoryItem) {
        var newPurchase = this.get('store').createRecord('inv-purchase', {
          dateReceived: new Date(),
          distributionUnit: inventoryItem.get('distributionUnit'),
          inventoryItem: inventoryItem.get('id')
        });
        this.set('currentItem', inventoryItem);
        this.send('openModal', 'inventory.purchase.edit', newPurchase);
      }
    }
  });
});
define('hospitalrun/inventory/search/controller', ['exports', 'hospitalrun/inventory/listing/controller'], function (exports, _hospitalrunInventoryListingController) {
  exports['default'] = _hospitalrunInventoryListingController['default'].extend();
});
define('hospitalrun/inventory/search/route', ['exports', 'hospitalrun/routes/abstract-search-route'], function (exports, _hospitalrunRoutesAbstractSearchRoute) {
  exports['default'] = _hospitalrunRoutesAbstractSearchRoute['default'].extend({
    moduleName: 'inventory',
    searchKeys: [{
      name: 'crossReference',
      type: 'contains'
    }, {
      name: 'description',
      type: 'fuzzy'
    }, {
      name: 'friendlyId',
      type: 'contains'
    }, {
      name: 'name',
      type: 'fuzzy'
    }],
    searchModel: 'inventory'
  });
});
define("hospitalrun/inventory/search/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "MRgLDxZL", "block": "{\"statements\":[[\"block\",[\"search-listing\"],null,[[\"newButtonText\",\"allButtonText\"],[[\"helper\",[\"t\"],[\"inventory.labels.newItem\"],null],[\"helper\",[\"t\"],[\"inventory.labels.allInventory\"],null]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"partial\",\"inventory/listing\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/inventory/search/template.hbs" } });
});
define('hospitalrun/inventory/transfer/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember', 'ember-i18n'], function (exports, _hospitalrunControllersAbstractEditController, _ember, _emberI18n) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend({
    inventoryController: _ember['default'].inject.controller('inventory'),

    warehouseList: _ember['default'].computed.alias('inventoryController.warehouseList'),
    aisleLocationList: _ember['default'].computed.alias('inventoryController.aisleLocationList'),

    lookupListsToUpdate: [{
      name: 'aisleLocationList', // Name of property containing lookup list
      property: 'model.transferAisleLocation', // Corresponding property on model that potentially contains a new value to add to the list
      id: 'aisle_location_list' // Id of the lookup list to update
    }, {
      name: 'warehouseList', // Name of property containing lookup list
      property: 'model.transferLocation', // Corresponding property on model that potentially contains a new value to add to the list
      id: 'warehouse_list' // Id of the lookup list to update
    }],

    title: (0, _emberI18n.translationMacro)('inventory.titles.transfer'),
    updateButtonText: (0, _emberI18n.translationMacro)('inventory.labels.transfer'),
    updateButtonAction: 'transfer',
    updateCapability: 'adjust_inventory_location',

    actions: {
      cancel: function cancel() {
        this.send('closeModal');
      },

      transfer: function transfer() {
        this.updateLookupLists();
        this.send('transferItems', this.get('model'), true);
      }
    }
  });
});
define("hospitalrun/inventory/transfer/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "agZXzn11", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.item\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"transferItem\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.transferFrom\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"locationName\"]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.quantityAvailable\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"quantity\"]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"class\",\"property\",\"label\",\"list\",\"selection\"],[\"required\",\"transferLocation\",[\"helper\",[\"t\"],[\"inventory.labels.transferTo\"],null],[\"get\",[\"warehouseList\"]],[\"get\",[\"model\",\"transferLocation\"]]]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\"],[\"transferAisleLocation\",[\"helper\",[\"t\"],[\"inventory.labels.transferToAisle\"],null],[\"get\",[\"aisleLocationList\"]],[\"get\",[\"model\",\"transferAisleLocation\"]]]]],false],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"property\",\"label\",\"class\"],[\"adjustmentQuantity\",[\"helper\",[\"t\"],[\"labels.quantity\"],null],\"col-sm-3 required\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"dateCompleted\",[\"helper\",[\"t\"],[\"inventory.labels.dateTransferred\"],null],\"col-sm-4 required\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/inventory/transfer/template.hbs" } });
});
define('hospitalrun/invoices/add-line-item/controller', ['exports', 'hospitalrun/mixins/billing-categories', 'ember', 'hospitalrun/mixins/is-update-disabled'], function (exports, _hospitalrunMixinsBillingCategories, _ember, _hospitalrunMixinsIsUpdateDisabled) {
  exports['default'] = _ember['default'].Controller.extend(_hospitalrunMixinsBillingCategories['default'], _hospitalrunMixinsIsUpdateDisabled['default'], {
    invoiceController: _ember['default'].inject.controller('invoices'),

    billingCategoryList: _ember['default'].computed.alias('invoiceController.billingCategoryList'),
    editController: _ember['default'].inject.controller('invoices/edit'),
    title: 'Add Line Item',
    updateButtonText: 'Add',
    updateButtonAction: 'add',
    showUpdateButton: true,

    actions: {
      cancel: function cancel() {
        this.send('closeModal');
      },

      add: function add() {
        this.get('model').save().then((function (record) {
          this.get('editController').send('addLineItem', record);
        }).bind(this));
      }
    },

    billingCategories: (function () {
      var defaultBillingCategories = this.get('defaultBillingCategories');
      var billingCategoryList = this.get('billingCategoryList');
      if (_ember['default'].isEmpty(billingCategoryList)) {
        return _ember['default'].Object.create({ value: defaultBillingCategories });
      } else {
        return billingCategoryList;
      }
    }).property('billingCategoryList', 'defaultBillingCategories')

  });
});
define("hospitalrun/invoices/add-line-item/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "n6Aw1U4J", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"name\",[\"helper\",[\"t\"],[\"labels.name\"],null],\"required\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"className\",\"label\",\"list\",\"selection\"],[\"category\",\"required\",[\"helper\",[\"t\"],[\"labels.category\"],null],[\"get\",[\"billingCategories\"]],[\"get\",[\"model\",\"category\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/invoices/add-line-item/template.hbs" } });
});
define('hospitalrun/invoices/delete/controller', ['exports', 'hospitalrun/controllers/abstract-delete-controller'], function (exports, _hospitalrunControllersAbstractDeleteController) {
  exports['default'] = _hospitalrunControllersAbstractDeleteController['default'].extend({
    title: 'Delete Invoice'
  });
});
define("hospitalrun/invoices/delete/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "enLXUZ5e", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-warning-sign\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"t\"],[\"messages.delete\"],[[\"name\"],[[\"get\",[\"model\",\"displayInvoiceNumber\"]]]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/invoices/delete/template.hbs" } });
});
define('hospitalrun/invoices/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember', 'moment', 'hospitalrun/mixins/number-format', 'hospitalrun/mixins/patient-submodule', 'hospitalrun/mixins/publish-statuses', 'hospitalrun/utils/select-values', 'npm:uuid'], function (exports, _hospitalrunControllersAbstractEditController, _ember, _moment, _hospitalrunMixinsNumberFormat, _hospitalrunMixinsPatientSubmodule, _hospitalrunMixinsPublishStatuses, _hospitalrunUtilsSelectValues, _npmUuid) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsNumberFormat['default'], _hospitalrunMixinsPatientSubmodule['default'], _hospitalrunMixinsPublishStatuses['default'], {
    invoiceController: _ember['default'].inject.controller('invoices'),
    expenseAccountList: _ember['default'].computed.alias('invoiceController.expenseAccountList.value'),
    patientList: _ember['default'].computed.alias('invoiceController.patientList'),
    pharmacyCharges: [],
    pricingProfiles: _ember['default'].computed.map('invoiceController.pricingProfiles', _hospitalrunUtilsSelectValues['default'].selectObjectMap),
    supplyCharges: [],
    updateCapability: 'add_invoice',
    wardCharges: [],

    additionalButtons: (function () {
      var buttons = [];
      var isValid = this.get('model.isValid');
      var status = this.get('model.status');
      if (isValid && status === 'Draft') {
        buttons.push({
          'class': 'btn btn-default default',
          buttonAction: 'finalizeInvoice',
          buttonIcon: 'glyphicon glyphicon-ok',
          buttonText: 'Invoice Ready'
        });
      }
      buttons.push({
        'class': 'btn btn-default neutral',
        buttonAction: 'printInvoice',
        buttonIcon: 'glyphicon glyphicon-print',
        buttonText: 'Print'
      });
      return buttons;
    }).property('model.isValid', 'model.status'),

    canAddCharge: (function () {
      return this.currentUserCan('add_charge');
    }).property(),

    canAddPayment: (function () {
      return this.currentUserCan('add_payment');
    }).property(),

    pharmacyExpenseAccount: (function () {
      var expenseAccountList = this.get('expenseAccountList');
      if (!_ember['default'].isEmpty(expenseAccountList)) {
        var account = expenseAccountList.find(function (value) {
          if (value.toLowerCase().indexOf('pharmacy') > -1) {
            return true;
          }
        });
        return account;
      }
    }).property('expenseAccountList.value'),

    actions: {
      addItemCharge: function addItemCharge(lineItem) {
        var details = lineItem.get('details');
        var detail = this.store.createRecord('line-item-detail', {
          id: _npmUuid['default'].v4()
        });
        details.addObject(detail);
      },

      addLineItem: function addLineItem(lineItem) {
        var lineItems = this.get('model.lineItems');
        lineItems.addObject(lineItem);
        this.send('update', true);
        this.send('closeModal');
      },

      deleteCharge: function deleteCharge(deleteInfo) {
        this._deleteObject(deleteInfo.itemToDelete, deleteInfo.deleteFrom);
      },

      deleteLineItem: function deleteLineItem(deleteInfo) {
        this._deleteObject(deleteInfo.itemToDelete, this.get('model.lineItems'));
      },

      finalizeInvoice: function finalizeInvoice() {
        var currentInvoice = this.get('model');
        var invoicePayments = currentInvoice.get('payments');
        var paymentsToSave = [];
        currentInvoice.get('patient.payments').then((function (patientPayments) {
          patientPayments.forEach((function (payment) {
            var invoice = payment.get('invoice');
            if (_ember['default'].isEmpty(invoice)) {
              payment.set('invoice', currentInvoice);
              paymentsToSave.push(payment.save());
              invoicePayments.addObject(payment);
            }
          }).bind(this));
          _ember['default'].RSVP.all(paymentsToSave).then((function () {
            this.set('model.status', 'Billed');
            this.send('update');
          }).bind(this));
        }).bind(this));
      },

      printInvoice: function printInvoice() {
        this.transitionToRoute('print.invoice', this.get('model'));
      },

      removePayment: function removePayment(removeInfo) {
        var payments = this.get('model.payments');
        var payment = removeInfo.itemToRemove;
        payment.set('invoice');
        payments.removeObject(removeInfo.itemToRemove);
        this.send('update', true);
        this.send('closeModal');
      },

      showAddLineItem: function showAddLineItem() {
        var newLineItem = this.store.createRecord('billing-line-item', {
          id: _npmUuid['default'].v4()
        });
        this.send('openModal', 'invoices.add-line-item', newLineItem);
      },

      showDeleteItem: function showDeleteItem(itemToDelete, deleteFrom) {
        this.showDeleteModal(itemToDelete, _ember['default'].Object.create({
          confirmAction: 'deleteCharge',
          deleteFrom: deleteFrom,
          title: 'Delete Charge'
        }));
      },

      showDeleteLineItem: function showDeleteLineItem(item) {
        this.showDeleteModal(item, _ember['default'].Object.create({
          confirmAction: 'deleteLineItem',
          title: 'Delete Line Item'
        }));
      },

      showDeleteModal: function showDeleteModal(item, options) {
        options = _ember['default'].merge(options, _ember['default'].Object.create({
          message: 'Are you sure you want to delete ' + item.get('name') + '?',
          itemToDelete: item,
          updateButtonAction: 'confirm',
          updateButtonText: this.get('i18n').t('buttons.ok')
        }));
        this.send('openModal', 'dialog', options);
      },

      showRemovePayment: function showRemovePayment(payment) {
        var message = 'Are you sure you want to remove this payment from this invoice?';
        var model = _ember['default'].Object.create({
          itemToRemove: payment
        });
        var title = 'Remove Payment';
        this.displayConfirm(title, message, 'removePayment', model);
      },

      toggleDetails: function toggleDetails(item) {
        item.toggleProperty('showDetails');
      }
    },

    changePaymentProfile: (function () {
      var patient = this.get('model.patient');
      var paymentProfile = this.get('model.paymentProfile');
      if (!_ember['default'].isEmpty(patient) && _ember['default'].isEmpty(paymentProfile)) {
        this.set('model.paymentProfile', patient.get('paymentProfile'));
      }
    }).observes('model.patient'),

    paymentProfileChanged: (function () {
      var discountPercentage = this._getValidNumber(this.get('model.paymentProfile.discountPercentage'));
      var originalPaymentProfileId = this.get('model.originalPaymentProfileId');
      var profileId = this.get('model.paymentProfile.id');
      if (profileId !== originalPaymentProfileId) {
        var lineItems = this.get('model.lineItems');
        lineItems.forEach((function (lineItem) {
          var details = lineItem.get('details');
          var lineDiscount = 0;
          details.forEach((function (detail) {
            var pricingOverrides = detail.get('pricingItem.pricingOverrides');
            if (!_ember['default'].isEmpty(pricingOverrides)) {
              var pricingOverride = pricingOverrides.findBy('profile.id', profileId);
              if (!_ember['default'].isEmpty(pricingOverride)) {
                _ember['default'].set(detail, 'price', pricingOverride.get('price'));
              }
            }
          }).bind(this));
          if (discountPercentage > 0) {
            var lineTotal = lineItem.get('total');
            lineDiscount = this._numberFormat(discountPercentage / 100 * lineTotal, true);
            lineItem.set('discount', lineDiscount);
          }
        }).bind(this));
        this.set('model.originalPaymentProfileId', profileId);
      }
    }).observes('model.paymentProfile'),

    visitChanged: (function () {
      var visit = this.get('model.visit');
      var lineItems = this.get('model.lineItems');
      if (!_ember['default'].isEmpty(visit) && _ember['default'].isEmpty(lineItems)) {
        this.set('model.originalPaymentProfileId');
        var promises = this.resolveVisitChildren();
        _ember['default'].RSVP.allSettled(promises, 'Resolved visit children before generating invoice').then((function (results) {
          var _this = this;

          var chargePromises = this._resolveVisitDescendents(results, 'charges');
          if (!_ember['default'].isEmpty(chargePromises)) {
            (function () {
              var promiseLabel = 'Reloaded charges before generating invoice';
              _ember['default'].RSVP.allSettled(chargePromises, promiseLabel).then((function (chargeResults) {
                var pricingPromises = [];
                chargeResults.forEach(function (result) {
                  if (!_ember['default'].isEmpty(result.value)) {
                    var pricingItem = result.value.get('pricingItem');
                    if (!_ember['default'].isEmpty(pricingItem)) {
                      pricingPromises.push(pricingItem.reload());
                    }
                  }
                });
                promiseLabel = 'Reloaded pricing items before generating invoice';
                _ember['default'].RSVP.allSettled(pricingPromises, promiseLabel).then((function () {
                  this._generateLineItems(visit, results);
                  this.paymentProfileChanged();
                }).bind(this));
              }).bind(_this));
            })();
          } else {
            this._generateLineItems(visit, results);
            this.paymentProfileChanged();
          }
        }).bind(this), function (err) {
          console.log('Error resolving visit children', err);
        });
      }
    }).observes('model.visit'),

    _addPharmacyCharge: function _addPharmacyCharge(charge, medicationItemName) {
      var _this2 = this;

      return charge.getMedicationDetails(medicationItemName).then(function (medicationDetails) {
        var quantity = charge.get('quantity');
        var pharmacyCharges = _this2.get('pharmacyCharges');
        var pharmacyExpenseAccount = _this2.get('pharmacyExpenseAccount');
        var pharmacyCharge = _this2.store.createRecord('line-item-detail', {
          id: _npmUuid['default'].v4(),
          name: medicationDetails.name,
          quantity: quantity,
          price: medicationDetails.price,
          department: 'Pharmacy',
          expenseAccount: pharmacyExpenseAccount
        });
        pharmacyCharges.addObject(pharmacyCharge);
      });
    },

    _addSupplyCharge: function _addSupplyCharge(charge, department) {
      var supplyCharges = this.get('supplyCharges');
      var supplyCharge = this._createChargeItem(charge, department);
      supplyCharges.addObject(supplyCharge);
    },

    _createChargeItem: function _createChargeItem(charge, department) {
      var chargeItem = this.store.createRecord('line-item-detail', {
        id: _npmUuid['default'].v4(),
        name: charge.get('pricingItem.name'),
        expenseAccount: charge.get('pricingItem.expenseAccount'),
        quantity: charge.get('quantity'),
        price: charge.get('pricingItem.price'),
        department: department,
        pricingItem: charge.get('pricingItem')
      });
      return chargeItem;
    },

    /**
     * Remove the specified object from the specified list, update the model and close the modal.
     * @param objectToDelete {object} - the object to remove
     * @param deleteFrom {Array} - the array to remove the object from.
     */
    _deleteObject: function _deleteObject(objectToDelete, deleteFrom) {
      deleteFrom.removeObject(objectToDelete);
      if (!objectToDelete.get('isNew')) {
        objectToDelete.destroyRecord();
      }
      this.send('update', true);
      this.send('closeModal');
    },

    _mapWardCharge: function _mapWardCharge(charge) {
      return this._createChargeItem(charge, 'Ward');
    },

    _completeBeforeUpdate: function _completeBeforeUpdate(sequence, resolve, reject) {
      var invoiceId = 'inv';
      var sequenceValue = undefined;
      sequence.incrementProperty('value', 1);
      sequenceValue = sequence.get('value');
      if (sequenceValue < 100000) {
        invoiceId += String('00000' + sequenceValue).slice(-5);
      } else {
        invoiceId += sequenceValue;
      }
      this.set('model.id', invoiceId);
      sequence.save().then(resolve, reject);
    },

    _generateLineItems: function _generateLineItems(visit, visitChildren) {
      var _this3 = this;

      var endDate = visit.get('endDate');
      var imaging = visitChildren[0].value;
      var labs = visitChildren[1].value;
      var lineDetail = undefined,
          lineItem = undefined;
      var lineItems = this.get('model.lineItems');
      var medication = visitChildren[2].value;
      var procedures = visitChildren[3].value;
      var startDate = visit.get('startDate');
      var visitCharges = visit.get('charges');
      this.setProperties({
        pharmacyCharges: [],
        supplyCharges: [],
        wardCharges: []
      });
      if (!_ember['default'].isEmpty(endDate) && !_ember['default'].isEmpty(startDate)) {
        endDate = (0, _moment['default'])(endDate);
        startDate = (0, _moment['default'])(startDate);
        var stayDays = endDate.diff(startDate, 'days');
        if (stayDays > 1) {
          lineDetail = this.store.createRecord('line-item-detail', {
            id: _npmUuid['default'].v4(),
            name: 'Days',
            quantity: stayDays
          });
          lineItem = this.store.createRecord('billing-line-item', {
            id: _npmUuid['default'].v4(),
            category: 'Hospital Charges',
            name: 'Room/Accomodation'
          });
          lineItem.get('details').addObject(lineDetail);
          lineItems.addObject(lineItem);
        }
      }

      var pharmacyChargePromises = [];
      medication.forEach((function (medicationItem) {
        pharmacyChargePromises.push(this._addPharmacyCharge(medicationItem, 'inventoryItem'));
      }).bind(this));

      this.set('wardCharges', visitCharges.map(this._mapWardCharge.bind(this)));

      procedures.forEach((function (procedure) {
        var charges = procedure.get('charges');
        charges.forEach((function (charge) {
          if (charge.get('medicationCharge')) {
            pharmacyChargePromises.push(this._addPharmacyCharge(charge, 'medication'));
          } else {
            this._addSupplyCharge(charge, 'O.R.');
          }
        }).bind(this));
      }).bind(this));

      labs.forEach((function (lab) {
        if (!_ember['default'].isEmpty(lab.get('labType'))) {
          this._addSupplyCharge(_ember['default'].Object.create({
            pricingItem: lab.get('labType'),
            quantity: 1
          }), 'Lab');
        }
        lab.get('charges').forEach((function (charge) {
          this._addSupplyCharge(charge, 'Lab');
        }).bind(this));
      }).bind(this));

      imaging.forEach((function (imaging) {
        if (!_ember['default'].isEmpty(imaging.get('imagingType'))) {
          this._addSupplyCharge(_ember['default'].Object.create({
            pricingItem: imaging.get('imagingType'),
            quantity: 1
          }), 'Imaging');
        }
        imaging.get('charges').forEach((function (charge) {
          this._addSupplyCharge(charge, 'Imaging');
        }).bind(this));
      }).bind(this));

      _ember['default'].RSVP.all(pharmacyChargePromises).then(function () {
        lineItem = _this3.store.createRecord('billing-line-item', {
          id: _npmUuid['default'].v4(),
          name: 'Pharmacy',
          category: 'Hospital Charges'
        });
        lineItem.get('details').addObjects(_this3.get('pharmacyCharges'));
        lineItems.addObject(lineItem);

        lineItem = _this3.store.createRecord('billing-line-item', {
          id: _npmUuid['default'].v4(),
          name: 'X-ray/Lab/Supplies',
          category: 'Hospital Charges'
        });
        lineItem.get('details').addObjects(_this3.get('supplyCharges'));
        lineItems.addObject(lineItem);

        lineItem = _this3.store.createRecord('billing-line-item', {
          id: _npmUuid['default'].v4(),
          name: 'Ward Items',
          category: 'Hospital Charges'
        });
        lineItem.get('details').addObjects(_this3.get('wardCharges'));
        lineItems.addObject(lineItem);

        lineItem = _this3.store.createRecord('billing-line-item', {
          id: _npmUuid['default'].v4(),
          name: 'Physical Therapy',
          category: 'Hospital Charges'
        });
        lineItems.addObject(lineItem);

        lineItem = _this3.store.createRecord('billing-line-item', {
          id: _npmUuid['default'].v4(),
          name: 'Others/Misc',
          category: 'Hospital Charges'
        });
        lineItems.addObject(lineItem);

        _this3.send('update', true);
      });
    },

    _resolveVisitDescendents: function _resolveVisitDescendents(results, childNameToResolve) {
      var promises = [];
      results.forEach(function (result) {
        if (!_ember['default'].isEmpty(result.value)) {
          result.value.forEach(function (record) {
            var children = record.get(childNameToResolve);
            if (!_ember['default'].isEmpty(children)) {
              children.forEach(function (child) {
                // Make sure children are fully resolved
                promises.push(child.reload());
              });
            }
          });
        }
      });
      return promises;
    },

    beforeUpdate: function beforeUpdate() {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        var lineItems = this.get('model.lineItems');
        var savePromises = [];
        lineItems.forEach((function (lineItem) {
          lineItem.get('details').forEach((function (detail) {
            savePromises.push(detail.save());
          }).bind(this));
          savePromises.push(lineItem.save());
        }).bind(this));
        _ember['default'].RSVP.all(savePromises, 'Saved invoice children before saving invoice').then((function () {
          if (this.get('model.isNew')) {
            this.store.find('sequence', 'invoice').then((function (sequence) {
              this._completeBeforeUpdate(sequence, resolve, reject);
            }).bind(this), (function () {
              var store = this.get('store');
              var newSequence = store.push(store.normalize('sequence', {
                id: 'invoice',
                value: 0
              }));
              this._completeBeforeUpdate(newSequence, resolve, reject);
            }).bind(this));
          } else {
            resolve();
          }
        }).bind(this), reject);
      }).bind(this));
    },

    afterUpdate: function afterUpdate() {
      var message = 'The invoice record has been saved.';
      this.displayAlert('Invoice Saved', message);
    }
  });
});
define('hospitalrun/invoices/edit/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'ember'], function (exports, _hospitalrunRoutesAbstractEditRoute, _ember) {
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend({
    editTitle: 'Edit Invoice',
    modelName: 'invoice',
    newTitle: 'New Invoice',

    actions: {
      deleteCharge: function deleteCharge(model) {
        this.controller.send('deleteCharge', model);
      },

      deleteLineItem: function deleteLineItem(model) {
        this.controller.send('deleteLineItem', model);
      },

      removePayment: function removePayment(model) {
        this.controller.send('removePayment', model);
      }
    },

    afterModel: function afterModel(model) {
      return new _ember['default'].RSVP.Promise(function (resolve, reject) {
        var lineItems = model.get('lineItems');
        var promises = [];
        lineItems.forEach(function (lineItem) {
          promises.push(lineItem.reload());
        });
        _ember['default'].RSVP.all(promises, 'Reload billing line items for invoice').then(function (results) {
          var detailPromises = [];
          results.forEach(function (result) {
            result.get('details').forEach(function (detail) {
              detailPromises.push(detail.reload());
            });
          });
          _ember['default'].RSVP.all(detailPromises, 'Reload billing line item details for invoice').then(resolve, reject);
        }, reject);
      });
    },

    getNewData: function getNewData() {
      return _ember['default'].RSVP.resolve({
        billDate: new Date(),
        status: 'Draft'
      });
    },

    setupController: function setupController(controller, model) {
      model.set('originalPaymentProfileId', model.get('paymentProfile.id'));
      this._super(controller, model);
      var lineItems = model.get('lineItems');
      var promises = [];
      lineItems.forEach(function (lineItem) {
        lineItem.get('details').forEach(function (detail) {
          var pricingItem = detail.get('pricingItem');
          if (!_ember['default'].isEmpty(pricingItem)) {
            promises.push(pricingItem.reload());
          }
        });
      });
    }
  });
});
define("hospitalrun/invoices/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "80t+CYHF", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],20]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showRemovePayment\",[\"get\",[\"payment\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.remove\"],null],false],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showEditPayment\",[\"get\",[\"payment\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"payment\",\"canRemovePayment\"]]],null,0],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"tr\",[]],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showEditPayment\",[\"get\",[\"payment\"]]]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"payment\",\"datePaid\"]]],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"payment\",\"amount\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"payment\",\"paymentType\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"payment\",\"notes\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddPayment\"]]],null,1],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"payment\"]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddPayment\",[\"get\",[\"model\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"admin.roles.capability.addPayment\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"colspan\",\"6\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.messages.flatDiscountMsg\"],[[\"currency\",\"discountAmount\"],[[\"helper\",[\"t\"],[\"labels.currencySymbol\"],null],[\"get\",[\"model\",\"paymentProfile\",\"discountAmount\"]]]]],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"colspan\",\"6\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.messages.flatFeeMsg\"],[[\"currency\",\"setFee\"],[[\"helper\",[\"t\"],[\"labels.currencySymbol\"],null],[\"get\",[\"model\",\"paymentProfile\",\"setFee\"]]]]],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"model\",\"paymentProfile\",\"setFee\"]]],null,5],[\"block\",[\"if\"],[[\"get\",[\"model\",\"paymentProfile\",\"discountAmount\"]]],null,4]],\"locals\":[]},{\"statements\":[[\"text\",\"                        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteItem\",[\"get\",[\"detail\"]],[\"get\",[\"item\",\"details\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                          \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"text\",\"\\n                        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"colspan\",\"2\"],[\"static-attr\",\"class\",\"col-xs-6 input-group\"],[\"flush-element\"],[\"text\",\"\\n                      \"],[\"append\",[\"helper\",[\"input\"],null,[[\"class\",\"value\"],[\"form-control\",[\"get\",[\"detail\",\"name\"]]]]],false],[\"text\",\"\\n                    \"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n                        \"],[\"append\",[\"helper\",[\"input\"],null,[[\"class\",\"value\"],[\"form-control\",[\"get\",[\"detail\",\"quantity\"]]]]],false],[\"text\",\"\\n                      \"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n                        \"],[\"append\",[\"helper\",[\"input\"],null,[[\"class\",\"value\"],[\"form-control\",[\"get\",[\"detail\",\"price\"]]]]],false],[\"text\",\"\\n                      \"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n                        \"],[\"append\",[\"helper\",[\"select-list\"],null,[[\"class\",\"content\",\"value\",\"action\"],[\"form-control\",[\"get\",[\"expenseAccountList\"]],[\"get\",[\"detail\",\"expenseAccount\"]],[\"helper\",[\"action\"],[[\"get\",[null]],[\"helper\",[\"mut\"],[[\"get\",[\"detail\",\"expenseAccount\"]]],null]],null]]]],false],[\"text\",\"\\n                      \"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1 text-right\"],[\"flush-element\"],[\"text\",\"\\n                      \"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"detail\",\"amountOwed\"]]],null],false],[\"text\",\"\\n                    \"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-2\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddCharge\"]]],null,7],[\"text\",\"                    \"],[\"close-element\"],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"detail\"]},{\"statements\":[[\"text\",\"                      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"addItemCharge\",[\"get\",[\"item\"]]]],[\"flush-element\"],[\"text\",\"\\n                        \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"admin.roles.capability.addCharge\"],null],false],[\"text\",\"\\n                      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"colspan\",\"2\"],[\"static-attr\",\"class\",\"col-xs-6\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.name\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.quantity\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.price\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.expenseTo\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-1 text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.total\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-2\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddCharge\"]]],null,9],[\"text\",\"                  \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"item\",\"details\"]]],null,8]],\"locals\":[]},{\"statements\":[[\"text\",\"                    \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteLineItem\",[\"get\",[\"item\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"text\",\"\\n                    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-5\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"input-group\"],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"span\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[\"input-group-addon glyphicon\\n                      \",[\"helper\",[\"if\"],[[\"get\",[\"item\",\"showDetails\"]],\"glyphicon-minus\",\"glyphicon-plus\"],null]]]],[\"modifier\",[\"action\"],[[\"get\",[null]],\"toggleDetails\",[\"get\",[\"item\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"input\"],null,[[\"class\",\"value\"],[\"form-control\",[\"get\",[\"item\",\"name\"]]]]],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1 text-right\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"item\",\"total\"]]],null],false],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"append\",[\"helper\",[\"input\"],null,[[\"class\",\"value\"],[\"form-control text-right\",[\"get\",[\"item\",\"discount\"]]]]],false],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"append\",[\"helper\",[\"input\"],null,[[\"class\",\"value\"],[\"form-control text-right\",[\"get\",[\"item\",\"nationalInsurance\"]]]]],false],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"append\",[\"helper\",[\"input\"],null,[[\"class\",\"value\"],[\"form-control text-right\",[\"get\",[\"item\",\"privateInsurance\"]]]]],false],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1 text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"item\",\"amountOwed\"]]],null],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-2\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddCharge\"]]],null,11],[\"text\",\"                \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"item\",\"showDetails\"]]],null,10]],\"locals\":[\"item\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-12\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"categoryGroup\",\"category\"]],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"categoryGroup\",\"items\"]]],null,12],[\"text\",\"            \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.total\"],null],false],[\"text\",\" \"],[\"append\",[\"unknown\",[\"categoryGroup\",\"category\"]],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"categoryGroup\",\"total\"]]],null],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"categoryGroup\",\"discount\"]]],null],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"categoryGroup\",\"nationalInsurance\"]]],null],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"categoryGroup\",\"privateInsurance\"]]],null],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"categoryGroup\",\"amountOwed\"]]],null],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"categoryGroup\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddLineItem\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.addLineItem\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-xs-3\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.visit\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"visit\",\"visitDescription\"]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"patient-typeahead\"],null,[[\"property\",\"label\",\"content\",\"selection\",\"class\"],[\"patientTypeAhead\",[\"helper\",[\"t\"],[\"labels.patient\"],null],[\"get\",[\"patientList\"]],[\"get\",[\"selectedPatient\"]],\"col-xs-4 required invoice-patient\"]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\",\"optionValuePath\",\"optionLabelPath\",\"selected\",\"prompt\"],[\"col-xs-4 required invoice-visit\",[\"helper\",[\"t\"],[\"labels.visit\"],null],\"visit\",[\"get\",[\"patientVisitsForSelect\"]],\"selectObject\",\"selectObject.visitDescription\",[\"get\",[\"model\",\"visit\"]],\"Please select a visit\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-xs-2\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.invoiceId\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"id\"]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"patient-summary\"],null,[[\"patient\",\"returnTo\",\"returnToContext\",\"disablePatientLink\"],[[\"get\",[\"model\",\"patient\"]],\"invoices.edit\",[\"get\",[\"model\",\"id\"]],[\"get\",[\"model\",\"isNew\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"unless\"],[[\"get\",[\"model\",\"isNew\"]]],null,18],[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"unless\"],[[\"get\",[\"model\",\"isNew\"]]],null,17],[\"text\",\"      \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"billDate\",[\"helper\",[\"t\"],[\"labels.billDate\"],null],\"col-xs-2\"]]],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"model\",\"isNew\"]]],null,16,15],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"externalInvoiceNumber\",[\"helper\",[\"t\"],[\"billing.labels.externalInvoiceNumber\"],null],\"col-xs-3 external-invoice-no\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"label\",\"property\",\"content\",\"optionValuePath\",\"optionLabelPath\",\"class\",\"prompt\",\"selected\"],[[\"helper\",[\"t\"],[\"billing.labels.paymentProfile\"],null],\"paymentProfile\",[\"get\",[\"pricingProfiles\"]],\"selectObject\",\"selectObject.name\",\"col-xs-3\",\" \",[\"get\",[\"model\",\"paymentProfile\"]]]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],19],[\"text\",\"  \"],[\"open-element\",\"form\",[]],[\"static-attr\",\"class\",\"form-inline\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel detail-section\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"t\"],[\"labels.lineItems\"],null],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddCharge\"]]],null,14],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-5\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.description\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-1 text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.labels.actualCharges\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-1 text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.discount\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-1 text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.labels.insurance\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-1 text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.labels.hmoCom\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-1 text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.excess\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-2 text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.action\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"lineItemsByCategory\"]]],null,13],[\"text\",\"          \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.total\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"model\",\"total\"]]],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"model\",\"discount\"]]],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"model\",\"nationalInsurance\"]]],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"model\",\"privateInsurance\"]]],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"model\",\"finalPatientResponsibility\"]]],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.labels.paymentsDeposits\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"colspan\",\"4\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"text\",\"-\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"model\",\"paidTotal\"]]],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.grandTotal\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"colspan\",\"4\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"model\",\"remainingBalance\"]]],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"model\",\"paymentProfile\"]]],null,6],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel detail-section\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"t\"],[\"labels.remarks\"],null],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"textarea\"],null,[[\"class\",\"value\"],[\"form-control\",[\"get\",[\"model\",\"remarks\"]]]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel detail-section\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"t\"],[\"labels.payments\"],null],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddPayment\"]]],null,3],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.date\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.amount\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.type\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.notes\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.action\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"payments\"]]],null,2],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/invoices/edit/template.hbs" } });
});
define('hospitalrun/invoices/index/controller', ['exports', 'hospitalrun/controllers/abstract-paged-controller'], function (exports, _hospitalrunControllersAbstractPagedController) {
  exports['default'] = _hospitalrunControllersAbstractPagedController['default'].extend({
    addPermission: 'add_invoice',
    deletePermission: 'delete_invoice',
    canAddPayment: (function () {
      return this.currentUserCan('add_payment');
    }).property(),
    startKey: [],
    queryParams: ['startKey', 'status']
  });
});
define('hospitalrun/invoices/index/route', ['exports', 'hospitalrun/routes/abstract-index-route', 'ember'], function (exports, _hospitalrunRoutesAbstractIndexRoute, _ember) {
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend({
    modelName: 'invoice',
    pageTitle: 'Invoice Listing',

    _getStartKeyFromItem: function _getStartKeyFromItem(item) {
      var billDateAsTime = item.get('billDateAsTime');
      var id = this._getPouchIdFromItem(item);
      var searchStatus = item.get('status');
      return [searchStatus, billDateAsTime, id];
    },

    _modelQueryParams: function _modelQueryParams(params) {
      var queryParams = undefined;
      var maxId = this._getMaxPouchId();
      var maxValue = this.get('maxValue');
      var minId = this._getMinPouchId();
      var searchStatus = params.status;
      if (_ember['default'].isEmpty(searchStatus)) {
        searchStatus = 'Billed';
      }
      this.set('pageTitle', searchStatus + ' Invoices');
      queryParams = {
        options: {
          startkey: [searchStatus, null, minId],
          endkey: [searchStatus, maxValue, maxId]
        },
        mapReduce: 'invoice_by_status'
      };

      if (searchStatus === 'All') {
        delete queryParams.options.startkey;
        delete queryParams.options.endkey;
      }
      return queryParams;
    },

    queryParams: {
      startKey: { refreshModel: true },
      status: { refreshModel: true }
    }
  });
});
define("hospitalrun/invoices/index/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "Hv7m5cqf", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]],9]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-info\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.alerts.noInvoiceFound\"],null],false],[\"text\",\" \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newItem\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.buttons.createInvoice\"],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"deleteItem\",[\"get\",[\"invoice\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"invoice\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary btn-extra\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddPayment\",[\"get\",[\"invoice\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"admin.roles.capability.addPayment\"],null],false],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"canAddPayment\"]]],null,3],[\"block\",[\"if\"],[[\"get\",[\"canAdd\"]]],null,2],[\"block\",[\"if\"],[[\"get\",[\"canDelete\"]]],null,1]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,4]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"clickable\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"invoice\"]]]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"invoice-number\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"invoice\",\"displayInvoiceNumber\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"invoice\",\"billDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"invoice\",\"status\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"invoice\",\"patient\",\"displayName\"]],false],[\"text\",\" - \"],[\"append\",[\"unknown\",[\"invoice\",\"patient\",\"displayPatientId\"]],false],[\"text\",\" \"],[\"open-element\",\"br\",[]],[\"flush-element\"],[\"close-element\"],[\"append\",[\"unknown\",[\"invoice\",\"visit\",\"primaryDiagnoses\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"invoice\",\"total\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"invoice\",\"remainingBalance\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"unless\"],[[\"get\",[\"invoice\",\"paidFlag\"]]],null,5],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"invoice\"]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.number\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.billDate\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.status\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.patient\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.total\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.balanceDue\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,7],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\"]]],null,6],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"hasRecords\"]]],null,8,0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/invoices/index/template.hbs" } });
});
define('hospitalrun/invoices/payment/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember', 'hospitalrun/mixins/patient-submodule'], function (exports, _hospitalrunControllersAbstractEditController, _ember, _hospitalrunMixinsPatientSubmodule) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsPatientSubmodule['default'], {
    cancelAction: 'closeModal',
    findPatientVisits: false,
    invoiceController: _ember['default'].inject.controller('invoices'),
    newPayment: false,

    expenseAccountList: _ember['default'].computed.alias('invoiceController.expenseAccountList'),
    patientList: _ember['default'].computed.alias('invoiceController.patientList'),

    _finishUpdate: function _finishUpdate(message, title) {
      this.send('closeModal');
      this.displayAlert(title, message);
    },

    currentPatient: (function () {
      var type = this.get('model.paymentType');
      if (type === 'Deposit') {
        return this.get('model.patient');
      } else {
        return this.get('model.invoice.patient');
      }
    }).property('model.patient', 'model.paymentType', 'model.invoice.patient'),

    title: (function () {
      var isNew = this.get('model.isNew');
      var type = this.get('model.paymentType');
      if (isNew) {
        return 'Add ' + type;
      } else {
        return 'Edit ' + type;
      }
    }).property('model.isNew', 'model.paymentType'),

    selectPatient: (function () {
      var isNew = this.get('model.isNew');
      var type = this.get('model.paymentType');
      return isNew && type === 'Deposit';
    }).property('model.isNew', 'model.paymentType'),

    beforeUpdate: function beforeUpdate() {
      if (this.get('model.isNew')) {
        this.set('newPayment', true);
      } else {
        this.set('newPayment', false);
      }
      var patient = this.get('currentPatient');
      this.set('model.charityPatient', patient.get('patientType') === 'Charity');
      return _ember['default'].RSVP.resolve();
    },

    afterUpdate: function afterUpdate() {
      this.get('model').save().then((function (record) {
        var _this = this;

        if (this.get('newPayment') === true) {
          (function () {
            var patient = _this.get('currentPatient');
            patient.get('payments').then((function (payments) {
              payments.addObject(record);
              patient.save().then((function () {
                var _this2 = this;

                if (record.get('paymentType') === 'Deposit') {
                  var message = 'A deposit of ' + record.get('amount') + ' was added for patient ' + patient.get('displayName');
                  this._finishUpdate(message, 'Deposit Added');
                } else {
                  (function () {
                    var invoice = _this2.get('model.invoice');
                    invoice.addPayment(record);
                    invoice.save().then((function () {
                      var message = 'A payment of ' + record.get('amount') + ' was added to invoice ' + invoice.get('id');
                      this._finishUpdate(message, 'Payment Added');
                    }).bind(_this2));
                  })();
                }
              }).bind(this));
            }).bind(_this));
          })();
        } else {
          this.send('closeModal');
        }
      }).bind(this));
    }
  });
});
define("hospitalrun/invoices/payment/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "NuZis8Sr", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\",\"updateButtonClass\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]],\"update-payment-btn\"]],4]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.patient\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"invoice\",\"patient\",\"displayName\"]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"patient-typeahead\"],null,[[\"property\",\"label\",\"content\",\"selection\",\"class\"],[\"patientTypeAhead\",[\"helper\",[\"t\"],[\"labels.patient\"],null],[\"get\",[\"patientList\"]],[\"get\",[\"selectedPatient\"]],\"required payment-patient\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"selectPatient\"]]],null,1,0]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"model\",\"isNew\"]]],null,2],[\"text\",\"    \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"property\",\"label\",\"class\"],[\"amount\",[\"helper\",[\"t\"],[\"labels.amount\"],null],\"required payment-amount\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"maxDate\",\"class\"],[\"datePaid\",[\"helper\",[\"t\"],[\"labels.datePaid\"],null],\"now\",\"required\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\"],[\"expenseAccount\",[\"helper\",[\"t\"],[\"labels.creditTo\"],null],[\"get\",[\"expenseAccountList\"]],[\"get\",[\"model\",\"expenseAccount\"]]]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"property\",\"label\"],[\"notes\",[\"helper\",[\"t\"],[\"labels.notes\"],null]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],3]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/invoices/payment/template.hbs" } });
});
define('hospitalrun/invoices/route', ['exports', 'hospitalrun/routes/abstract-module-route', 'hospitalrun/mixins/modal-helper', 'hospitalrun/mixins/patient-list-route'], function (exports, _hospitalrunRoutesAbstractModuleRoute, _hospitalrunMixinsModalHelper, _hospitalrunMixinsPatientListRoute) {
  exports['default'] = _hospitalrunRoutesAbstractModuleRoute['default'].extend(_hospitalrunMixinsModalHelper['default'], _hospitalrunMixinsPatientListRoute['default'], {
    addCapability: 'add_invoice',
    currentScreenTitle: 'Invoices',
    editTitle: 'Edit Invoice',
    newTitle: 'New Invoice',
    moduleName: 'invoices',
    newButtonText: '+ new invoice',
    sectionTitle: 'Invoices',

    additionalButtons: (function () {
      if (this.currentUserCan('add_payment')) {
        return [{
          'class': 'btn btn-default',
          buttonText: '+ add deposit',
          buttonAction: 'showAddDeposit'
        }];
      }
    }).property(),

    additionalModels: [{
      name: 'billingCategoryList',
      findArgs: ['lookup', 'billing_categories']
    }, {
      name: 'expenseAccountList',
      findArgs: ['lookup', 'expense_account_list']
    }, {
      name: 'pricingProfiles',
      findArgs: ['price-profile']
    }],

    actions: {
      showAddDeposit: function showAddDeposit() {
        var payment = this.store.createRecord('payment', {
          paymentType: 'Deposit',
          datePaid: new Date()
        });
        this.send('openModal', 'invoices.payment', payment);
      },

      showAddPayment: function showAddPayment(invoice) {
        var payment = this.store.createRecord('payment', {
          invoice: invoice,
          paymentType: 'Payment',
          datePaid: new Date()
        });
        this.send('openModal', 'invoices.payment', payment);
      },

      showEditPayment: function showEditPayment(payment) {
        if (this.currentUserCan('add_payment')) {
          this.send('openModal', 'invoices.payment', payment);
        }
      }
    },

    subActions: (function () {
      var actions = [{
        text: 'Billed',
        linkTo: 'invoices.index',
        statusQuery: 'Billed'
      }];
      if (this.currentUserCan('add_invoice')) {
        actions.push({
          text: 'Drafts',
          linkTo: 'invoices.index',
          statusQuery: 'Draft'
        });
        actions.push({
          text: 'All Invoices',
          linkTo: 'invoices.index',
          statusQuery: 'All'
        });
      }
      if (this.currentUserCan('list_paid_invoices')) {
        actions.push({
          text: 'Paid',
          linkTo: 'invoices.index',
          statusQuery: 'Paid'
        });
      }
      return actions;
    }).property()

  });
});
define('hospitalrun/invoices/search/route', ['exports', 'hospitalrun/routes/abstract-search-route'], function (exports, _hospitalrunRoutesAbstractSearchRoute) {
  exports['default'] = _hospitalrunRoutesAbstractSearchRoute['default'].extend({
    moduleName: 'invoices',
    searchKeys: [{
      name: 'externalInvoiceNumber',
      type: 'contains'
    }, {
      name: 'patientInfo',
      type: 'contains'
    }],
    searchModel: 'invoice'
  });
});
define("hospitalrun/invoices/search/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "7Stx2dsU", "block": "{\"statements\":[[\"block\",[\"search-listing\"],null,[[\"newButtonText\",\"allButtonText\"],[\"New Invoice\",\"All Invoices\"]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"partial\",\"invoices/index\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/invoices/search/template.hbs" } });
});
define('hospitalrun/labs/charge/controller', ['exports', 'hospitalrun/procedures/charge/controller', 'ember'], function (exports, _hospitalrunProceduresChargeController, _ember) {
  exports['default'] = _hospitalrunProceduresChargeController['default'].extend({
    labsEdit: _ember['default'].inject.controller('labs/edit'),
    cancelAction: 'closeModal',
    newPricingItem: false,
    requestingController: _ember['default'].computed.alias('controllers.labs/edit'),
    pricingList: _ember['default'].computed.alias('controllers.labs/edit.chargesPricingList')
  });
});
define("hospitalrun/labs/charge/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "8qHLvc50", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"partial\",\"procedures/charge\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/labs/charge/template.hbs" } });
});
define('hospitalrun/labs/completed/controller', ['exports', 'hospitalrun/controllers/abstract-paged-controller'], function (exports, _hospitalrunControllersAbstractPagedController) {
  exports['default'] = _hospitalrunControllersAbstractPagedController['default'].extend({
    startKey: [],
    showActions: false
  });
});
define('hospitalrun/labs/completed/labs-completed-list-item/component', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    tagName: 'tr'
  });
});
define("hospitalrun/labs/completed/labs-completed-list-item/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "53/ixka0", "block": "{\"statements\":[[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"requested-date\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"lab\",\"requestedDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"lab-date\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"lab\",\"labDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"patient\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"lab\",\"patient\",\"displayName\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"requested-by\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"lab\",\"requestedBy\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"lab-type\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"lab\",\"labType\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"result\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"lab\",\"result\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"notes\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"lab\",\"notes\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/labs/completed/labs-completed-list-item/template.hbs" } });
});
define('hospitalrun/labs/completed/route', ['exports', 'hospitalrun/labs/index/route', 'ember-i18n'], function (exports, _hospitalrunLabsIndexRoute, _emberI18n) {
  exports['default'] = _hospitalrunLabsIndexRoute['default'].extend({
    pageTitle: (0, _emberI18n.translationMacro)('labs.completedTitle'),
    searchStatus: 'Completed'
  });
});
define("hospitalrun/labs/completed/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "hCs/6AmP", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]],3]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-info\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labs.messages.noCompleted\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"labs/completed/labs-completed-list-item\"],null,[[\"lab\"],[[\"get\",[\"lab\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[\"lab\"]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.dateRequested\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.dateCompleted\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.patient\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.requestedBy\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labs.labels.labType\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.results\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.notes\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\"]]],null,1],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"model\"]]],null,2,0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/labs/completed/template.hbs" } });
});
define('hospitalrun/labs/delete/controller', ['exports', 'hospitalrun/controllers/abstract-delete-controller', 'hospitalrun/mixins/patient-submodule', 'ember-i18n'], function (exports, _hospitalrunControllersAbstractDeleteController, _hospitalrunMixinsPatientSubmodule, _emberI18n) {
  exports['default'] = _hospitalrunControllersAbstractDeleteController['default'].extend(_hospitalrunMixinsPatientSubmodule['default'], {
    title: (0, _emberI18n.translationMacro)('labs.deleteTitle'),

    actions: {
      'delete': function _delete() {
        this.deleteChildFromVisit('labs');
      }
    }
  });
});
define("hospitalrun/labs/delete/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "ZmcYLBi5", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-warning-sign\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"t\"],[\"messages.delete_singular\"],[[\"name\"],[[\"helper\",[\"t\"],[\"models.lab.request.singular\"],null]]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/labs/delete/template.hbs" } });
});
define('hospitalrun/labs/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'hospitalrun/mixins/charge-actions', 'ember', 'hospitalrun/mixins/patient-submodule'], function (exports, _hospitalrunControllersAbstractEditController, _hospitalrunMixinsChargeActions, _ember, _hospitalrunMixinsPatientSubmodule) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsChargeActions['default'], _hospitalrunMixinsPatientSubmodule['default'], {
    labsController: _ember['default'].inject.controller('labs'),
    chargePricingCategory: 'Lab',
    chargeRoute: 'labs.charge',
    selectedLabType: null,

    canComplete: (function () {
      var isNew = this.get('model.isNew');
      var labTypeName = this.get('model.labTypeName');
      var selectedLabType = this.get('selectedLabType');
      if (isNew && (_ember['default'].isEmpty(labTypeName) || _ember['default'].isArray(selectedLabType) && selectedLabType.length > 1)) {
        return false;
      } else {
        return this.currentUserCan('complete_lab');
      }
    }).property('selectedLabType.[]', 'model.labTypeName'),

    actions: {
      completeLab: function completeLab() {
        this.set('model.status', 'Completed');
        this.get('model').validate().then((function () {
          if (this.get('model.isValid')) {
            this.set('model.labDate', new Date());
            this.send('update');
          }
        }).bind(this))['catch'](_ember['default'].K);
      },

      /**
       * Update the model and perform the before update and after update
       */
      update: function update() {
        var _this = this;

        if (this.get('model.isNew')) {
          (function () {
            var newLab = _this.get('model');
            var selectedLabType = _this.get('selectedLabType');
            if (_ember['default'].isEmpty(_this.get('model.status'))) {
              _this.set('model.status', 'Requested');
            }
            _this.set('model.requestedBy', newLab.getUserName());
            _this.set('model.requestedDate', new Date());
            if (_ember['default'].isEmpty(selectedLabType)) {
              _this.saveNewPricing(_this.get('model.labTypeName'), 'Lab', 'model.labType').then((function () {
                this.addChildToVisit(newLab, 'labs', 'Lab').then((function () {
                  this.saveModel();
                }).bind(this));
              }).bind(_this));
            } else {
              _this.getSelectedPricing('selectedLabType').then((function (pricingRecords) {
                if (_ember['default'].isArray(pricingRecords)) {
                  this.createMultipleRequests(pricingRecords, 'labType', 'labs', 'Lab');
                } else {
                  this.set('model.labType', pricingRecords);
                  this.addChildToVisit(newLab, 'labs', 'Lab').then((function () {
                    this.saveModel();
                  }).bind(this));
                }
              }).bind(_this));
            }
          })();
        } else {
          this.saveModel();
        }
      }
    },

    additionalButtons: (function () {
      var canComplete = this.get('canComplete');
      var isValid = this.get('model.isValid');
      var i18n = this.get('i18n');
      if (isValid && canComplete) {
        return [{
          buttonAction: 'completeLab',
          buttonIcon: 'glyphicon glyphicon-ok',
          'class': 'btn btn-primary on-white',
          buttonText: i18n.t('buttons.complete')
        }];
      }
    }).property('canComplete', 'model.isValid'),

    pricingTypeForObjectType: 'Lab Procedure',
    pricingTypes: _ember['default'].computed.alias('labsController.labPricingTypes'),

    pricingList: null, // This gets filled in by the route

    updateCapability: 'add_lab',

    afterUpdate: function afterUpdate(saveResponse, multipleRecords) {
      var i18n = this.get('i18n');
      var afterDialogAction = undefined,
          alertMessage = undefined,
          alertTitle = undefined;
      if (this.get('model.status') === 'Completed') {
        alertTitle = i18n.t('labs.alerts.requestCompletedTitle');
        alertMessage = i18n.t('labs.alerts.requestCompletedMessage');
      } else {
        alertTitle = i18n.t('labs.alerts.requestSavedTitle');
        alertMessage = i18n.t('labs.alerts.requestSavedMessage');
      }
      if (multipleRecords) {
        afterDialogAction = this.get('cancelAction');
      }
      this.saveVisitIfNeeded(alertTitle, alertMessage, afterDialogAction);
      this.set('model.selectPatient', false);
    }

  });
});
define('hospitalrun/labs/edit/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'hospitalrun/mixins/add-to-patient-route', 'hospitalrun/mixins/charge-route', 'ember', 'moment', 'hospitalrun/mixins/patient-list-route', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractEditRoute, _hospitalrunMixinsAddToPatientRoute, _hospitalrunMixinsChargeRoute, _ember, _moment, _hospitalrunMixinsPatientListRoute, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend(_hospitalrunMixinsAddToPatientRoute['default'], _hospitalrunMixinsChargeRoute['default'], _hospitalrunMixinsPatientListRoute['default'], {
    editTitle: (0, _emberI18n.translationMacro)('labs.editTitle'),
    modelName: 'lab',
    newTitle: (0, _emberI18n.translationMacro)('labs.newTitle'),
    pricingCategory: 'Lab',
    customForms: _ember['default'].inject.service(),

    actions: {
      returnToAllItems: function returnToAllItems() {
        this.controller.send('returnToAllItems');
      }
    },

    getNewData: function getNewData() {
      var newLabData = {
        selectPatient: true,
        requestDate: (0, _moment['default'])().startOf('day').toDate(),
        customForms: _ember['default'].Object.create()
      };
      var customForms = this.get('customForms');
      return customForms.setDefaultCustomForms(['lab'], newLabData);
    }
  });
});
define("hospitalrun/labs/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "MQhMGsiN", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],6]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"result\",[\"helper\",[\"t\"],[\"labels.result\"],null],\"test-result-input\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-xs-3\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.visit\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"visit\",\"visitDate\"]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-xs-6\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labs.labels.labType\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"labType\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-xs-9\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.requestedBy\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"requestedBy\"]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\",\"optionValuePath\",\"optionLabelPath\",\"prompt\",\"selected\"],[\"col-xs-3 required test-visit-type\",[\"helper\",[\"t\"],[\"labels.visit\"],null],\"visit\",[\"get\",[\"patientVisitsForSelect\"]],\"selectObject\",\"selectObject.visitDescription\",[\"helper\",[\"t\"],[\"labs.labels.addNewVisit\"],null],[\"get\",[\"model\",\"visit\"]]]]],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"checkbox-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"optionLabelPath\",\"typeAheadType\",\"className\",\"prompt\",\"model\"],[\"labTypeName\",[\"helper\",[\"t\"],[\"labs.labels.labType\"],null],[\"get\",[\"objectTypeList\"]],[\"get\",[\"selectedLabType\"]],\"name\",\"pricing\",\"required test-lab-type\",\" \",[\"get\",[\"model\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"patient-summary\"],null,[[\"patient\",\"returnTo\",\"returnToContext\",\"disablePatientLink\"],[[\"get\",[\"model\",\"patient\"]],\"labs.edit\",[\"get\",[\"model\",\"id\"]],[\"get\",[\"model\",\"isNew\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"patient-typeahead\"],null,[[\"property\",\"label\",\"content\",\"selection\",\"class\"],[\"patientTypeAhead\",[\"helper\",[\"t\"],[\"labels.patient\"],null],[\"get\",[\"patientList\"]],[\"get\",[\"selectedPatient\"]],\"required test-patient-name\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"model\",\"selectPatient\"]]],null,4,3],[\"block\",[\"if\"],[[\"get\",[\"model\",\"isNew\"]]],null,2,1],[\"block\",[\"if\"],[[\"get\",[\"canComplete\"]]],null,0],[\"text\",\"    \"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"property\",\"label\",\"rows\"],[\"notes\",[\"helper\",[\"t\"],[\"labels.notes\"],null],3]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"custom-form-manager\"],null,[[\"model\",\"formType\"],[[\"get\",[\"model\"]],\"lab\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],5]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/labs/edit/template.hbs" } });
});
define('hospitalrun/labs/index/controller', ['exports', 'hospitalrun/controllers/abstract-paged-controller', 'hospitalrun/mixins/user-session'], function (exports, _hospitalrunControllersAbstractPagedController, _hospitalrunMixinsUserSession) {
  exports['default'] = _hospitalrunControllersAbstractPagedController['default'].extend(_hospitalrunMixinsUserSession['default'], {
    startKey: [],
    addPermission: 'add_lab'
  });
});
define('hospitalrun/labs/index/labs-edit-button/component', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    tagName: 'button',
    classNames: ['btn', 'btn-default', 'neutral']
  });
});
define("hospitalrun/labs/index/labs-edit-button/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "D+D+/RzO", "block": "{\"statements\":[[\"block\",[\"link-to\"],[\"labs.edit\",[\"get\",[\"lab\"]]],null,0],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/labs/index/labs-edit-button/template.hbs" } });
});
define('hospitalrun/labs/index/labs-list-item/component', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Component.extend({
    tagName: 'tr',
    classNames: ['clickable'],

    click: function click() {
      this.sendAction('action', this.lab);
    }
  });
});
define("hospitalrun/labs/index/labs-list-item/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "lUoTUBbz", "block": "{\"statements\":[[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"requested-date\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"lab\",\"requestedDate\"]]],[[\"format\"],[\"l h:mm A\"]]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"patient\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"lab\",\"patient\",\"displayName\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"requested-by\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"lab\",\"requestedBy\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"lab-type\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"lab\",\"labType\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"notes\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"lab\",\"notes\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"labs/index/labs-edit-button\"],null,[[\"lab\"],[[\"get\",[\"lab\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canEdit\"]]],null,0],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/labs/index/labs-list-item/template.hbs" } });
});
define('hospitalrun/labs/index/route', ['exports', 'hospitalrun/routes/abstract-index-route', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractIndexRoute, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend({
    modelName: 'lab',
    pageTitle: (0, _emberI18n.translationMacro)('labs.requestsTitle'),
    searchStatus: 'Requested',

    _getStartKeyFromItem: function _getStartKeyFromItem(item) {
      var labDateAsTime = item.get('labDateAsTime');
      var id = this._getPouchIdFromItem(item);
      var requestedDateAsTime = item.get('requestedDateAsTime');
      var searchStatus = this.get('searchStatus');
      return [searchStatus, requestedDateAsTime, labDateAsTime, id];
    },

    _modelQueryParams: function _modelQueryParams() {
      var maxId = this._getMaxPouchId();
      var maxValue = this.get('maxValue');
      var minId = this._getMinPouchId();
      var searchStatus = this.get('searchStatus');
      return {
        options: {
          startkey: [searchStatus, null, null, minId],
          endkey: [searchStatus, maxValue, maxValue, maxId]
        },
        mapReduce: 'lab_by_status'
      };
    }
  });
});
define("hospitalrun/labs/index/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "6Iu3UI4u", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]],5]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newItem\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labs.messages.createNewRecord\"],null],false],[\"close-element\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-info\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labs.messages.noItemsFound\"],null],false],[\"text\",\" \"],[\"block\",[\"if\"],[[\"get\",[\"canAdd\"]]],null,0],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"labs/index/labs-list-item\"],null,[[\"lab\",\"action\",\"showActions\",\"canEdit\"],[[\"get\",[\"lab\"]],\"editItem\",[\"get\",[\"showActions\"]],[\"get\",[\"canEdit\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[\"lab\"]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-2\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-2\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.dateRequested\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-2\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.patient\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-2\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.requestedBy\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-2\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labs.labels.labType\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"col-xs-2\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.notes\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,3],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\"]]],null,2],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"hasRecords\"]]],null,4,1]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/labs/index/template.hbs" } });
});
define('hospitalrun/labs/route', ['exports', 'hospitalrun/routes/abstract-module-route', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractModuleRoute, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractModuleRoute['default'].extend({
    addCapability: 'add_lab',
    additionalModels: [{
      name: 'labPricingTypes',
      findArgs: ['lookup', 'lab_pricing_types']
    }],
    allowSearch: false,
    moduleName: 'labs',
    newButtonText: (0, _emberI18n.translationMacro)('labs.buttons.newButton'),
    sectionTitle: (0, _emberI18n.translationMacro)('labs.sectionTitle')
  });
});
define('hospitalrun/locales/de/translations', ['exports'], function (exports) {
  exports['default'] = {
    admin: {
      address: {
        address1Label: 'Adresse 1 Kennzeichen',
        address2Label: 'Adresse 2 Kennzeichen',
        address3Label: 'Adresse 3 Kennzeichen',
        address4Label: 'Adresse 4 Kennzeichen',
        addressLabel: '',
        editTitle: '',
        include1Label: 'Einbezug 1 Kennzeichen',
        include2Label: 'Einbezug 2 Kennzeichen',
        include3Label: 'Einbezug 3 Kennzeichen',
        include4Label: 'Einbezug 4 Kennzeichen',
        messages: { addressSaved: 'Die Adressoptionen wurden gespeichert' },
        newTitle: '',
        titles: { optionsSaved: 'Optionen gespeichert' }
      },
      addressOptions: 'Adressoptionen',
      customForms: {
        buttons: {
          addField: '',
          moveDown: '',
          moveUp: '',
          newForm: '',
          preview: ''
        },
        labels: {
          alwaysInclude: '',
          checkbox: '',
          colSpan: '',
          columns: '',
          customForm: '',
          dischargeReportFormType: '',
          formName: '',
          formType: '',
          incidentFormType: '',
          includeOtherOption: '',
          labFormType: '',
          label: '',
          newForm: '',
          opdReportFormType: '',
          operativePlanFormType: '',
          otherOptionLabel: '',
          patientFormType: '',
          property: '',
          radio: '',
          select: '',
          socialworkFormType: '',
          text: '',
          textarea: '',
          visitFormType: ''
        },
        messages: { formSaved: '' },
        titles: {
          checkboxValues: '',
          customForms: '',
          deleteForm: '',
          dropDownValues: '',
          editCustomForm: '',
          fields: '',
          formSaved: '',
          newCustomForm: '',
          radioValues: ''
        }
      },
      header: {
        editTitle: '',
        facilityName: '',
        headerLabel: '',
        headerLine1: '',
        headerLine2: '',
        headerLine3: '',
        logoURL: '',
        messages: { headerSaved: '' },
        newTitle: '',
        titles: { optionsSaved: '' }
      },
      loadDb: 'Datenbank laden',
      loaddb: {
        displayAlertMessage: '',
        displayAlertTitle: '',
        editTitle: '',
        errorDisplayAlertMessage: '',
        errorDisplayAlertTitle: '',
        progressMessage: '',
        progressTitle: ''
      },
      lookup: {
        aisleLocationList: 'Gänge-Verzeichnis',
        alertImportListMessage: '',
        alertImportListSaveMessage: '',
        alertImportListSaveTitle: '',
        alertImportListTitle: '',
        alertImportListUpdateMessage: '',
        alertImportListUpdateTitle: '',
        anesthesiaTypes: 'Anästhesiearten',
        anesthesiologists: 'Anästhesiologe',
        billingCategories: 'Abrechnungskategorien',
        clinicList: 'Kliniken',
        countryList: 'Länder',
        cptCodeList: 'CPT Codes',
        diagnosisList: 'Diagnosen',
        edit: { template: {
            addTitle: '',
            editTitle: '',
            labelTitle: '',
            updateButtonTextAdd: '',
            updateButtonTextUpdate: ''
          } },
        expenseAccountList: 'Ausgabekonten',
        imagingPricingTypes: 'Bildgebungs-Preiskategorien',
        incidentDepartments: '',
        inventoryTypes: 'Inventartypen',
        labPricingTypes: 'Labor-Preiskategorien',
        pageTitle: '',
        patientStatusList: 'Patientenstatus',
        physicianList: 'Ärzte',
        procedureList: 'Abläufe',
        procedureLocations: 'Ablaufs-Orte',
        procedurePricingTypes: 'Ablaufs-Preiskategorien',
        radiologists: 'Radiologen',
        titles: { deleteLookupValue: '' },
        unitTypes: 'Einheiten',
        vendorList: 'Anbieter',
        visitLocationList: 'Einsatzorte',
        visitTypes: 'Besuchsarten',
        wardPricingTypes: 'Krankenstations-Preistypen',
        warehouseList: 'Warenhaus'
      },
      lookupLists: 'Nachschlagelisten',
      roles: {
        capability: {
          addAllergy: '',
          addAppointment: '',
          addBillingDiagnosis: '',
          addCharge: '',
          addDiagnosis: '',
          addImaging: '',
          addIncident: '',
          addIncidentCategory: '',
          addInventoryItem: '',
          addInventoryPurchase: '',
          addInventoryRequest: '',
          addInvoice: '',
          addLab: '',
          addMedication: '',
          addNote: '',
          addOperationReport: '',
          addOperativePlan: '',
          addPatient: '',
          addPayment: '',
          addPhoto: '',
          addPricing: '',
          addPricingProfile: '',
          addProcedure: '',
          addSocialwork: '',
          addVisit: '',
          addVitals: '',
          adjustInventoryLocation: '',
          admin: '',
          admitPatient: '',
          appointments: '',
          billing: '',
          completeImaging: '',
          completeLab: '',
          defineUserRoles: '',
          deleteAppointment: '',
          deleteDiagnosis: '',
          deleteImaging: '',
          deleteIncident: '',
          deleteIncidentCategory: '',
          deleteInventoryItem: '',
          deleteInvoice: '',
          deleteLab: '',
          deleteMedication: '',
          deleteNote: '',
          deletePatient: '',
          deletePhoto: '',
          deletePricing: '',
          deletePricingProfile: '',
          deleteProcedure: '',
          deleteSocialwork: '',
          deleteVisit: '',
          deleteVitals: '',
          dischargePatient: '',
          editInvoice: '',
          fulfillInventory: '',
          fulfillMedication: '',
          generateIncidentReport: '',
          imaging: '',
          incident: '',
          inventory: '',
          invoices: '',
          labs: '',
          loadDb: '',
          manageIncidents: '',
          medication: '',
          overrideInvoice: '',
          patientReports: '',
          patients: '',
          pricing: '',
          updateConfig: '',
          visits: ''
        },
        messages: { roleSaved: '' },
        titles: { roleSaved: '' }
      },
      userRoles: '',
      users: 'Benutzer',
      visitForms: {
        labels: {
          followup: '',
          form: '',
          initial: '',
          visitType: ''
        },
        titles: { visitForms: '' }
      },
      workflow: {
        admissionDepositLabel: '',
        clinicPrepaymentLabel: '',
        editTitle: '',
        followupPrepaymentLabel: '',
        messages: { optionsSaved: '' },
        newTitle: '',
        outpatientImagingLabel: '',
        outpatientLabLabel: '',
        outpatientMedicationLabel: '',
        titles: { optionsSaved: '' },
        workflowLabel: ''
      }
    },
    alerts: {
      errorExclamation: '',
      pleaseWait: '',
      reportError: '',
      warningExclamation: ''
    },
    allergies: {
      buttons: { addAllergy: '' },
      labels: {
        allergyName: '',
        patientAllergy: ''
      },
      titles: {
        addAllergy: '',
        editAllergy: ''
      }
    },
    application: {
      messages: { sessionExpired: '' },
      titles: { sessionExpired: '' }
    },
    appointments: {
      buttons: {
        newButton: '',
        scheduleSurgery: ''
      },
      calendarTitle: '',
      currentScreenTitle: '',
      editTitle: '',
      labels: {
        noLocation: '',
        selectedStartingDate: ''
      },
      messages: {
        appointmentSaved: '',
        endTimeLaterThanStart: ''
      },
      missed: '',
      newTitle: '',
      searchTitle: '',
      sectionTitle: '',
      thisWeek: '',
      titles: {
        appointmentSaved: '',
        editSurgicalAppointment: '',
        newSurgicalAppointment: '',
        theaterSchedule: ''
      },
      todayTitle: ''
    },
    billing: {
      alerts: {
        noInvoiceFound: '',
        noPricingItems: '',
        noPricingProfiles: ''
      },
      buttons: {
        addOverride: '',
        createInvoice: ''
      },
      labels: {
        actualCharges: '',
        discountAmount: '',
        discountPercentage: '',
        externalInvoiceNumber: '',
        hmoCom: '',
        insurance: '',
        paymentProfile: '',
        paymentsDeposits: '',
        pricingPanelOverrides: '',
        pricingProfile: ''
      }
    },
    buttons: {
      add: 'Hinzufügen',
      addItem: '',
      addLineItem: '',
      addValue: 'Wert hinzufügen',
      addVisit: '',
      allRequests: '',
      barcode: '',
      cancel: 'Abbrechen',
      clear: '',
      close: '',
      complete: 'Abschließen',
      'delete': 'Entfernen',
      dispense: '',
      edit: '',
      filter: '',
      fulfill: '',
      'import': 'Importieren',
      loadFile: 'Datei laden',
      newItem: '',
      newNote: '',
      newRequest: '',
      newRequestPlus: '',
      newUser: 'Neuer Benutzer',
      ok: 'Okay',
      remove: '',
      returnButton: 'Zurück',
      search: '',
      showAll: '',
      showFewer: '',
      update: 'Aktualisieren'
    },
    components: {
      chargesByTypeTab: { charges: '' },
      customFormManager: { buttons: { addForm: '' } },
      dateTimePicker: {
        amHour: '',
        midnight: '',
        noon: '',
        pmHour: ''
      },
      imageUpload: { messages: { selectValidImageFile: '' } },
      operativeProcedures: {
        buttons: { addProcedure: '' },
        labels: { procedure: '' },
        titles: { procedures: '' }
      },
      patientOrders: {
        buttons: {
          newImaging: '',
          newLab: '',
          newMedication: ''
        },
        labels: {
          imagingOrderType: '',
          labOrderType: '',
          medicationOrderType: '',
          orderType: ''
        }
      },
      priceList: { charges: '' },
      quantityCalc: { result: '' },
      quantityConv: {
        conversion: '',
        unit: ''
      },
      sortableColumn: { labels: { selectAll: '' } },
      takePhoto: {
        camera: '',
        how: '',
        labels: {
          takeAPicture: '',
          uploadAFile: ''
        },
        photo: '',
        preview: '',
        takePhoto: '',
        uploadFile: ''
      },
      upcomingAppointments: {
        labels: {
          date: '',
          location: '',
          type: '',
          'with': ''
        },
        titles: { upcomingAppointments: '' }
      }
    },
    customForms: {
      buttons: { addForm: '' },
      labels: { formToAdd: '' },
      titles: { addCustomForm: '' }
    },
    dashboard: {
      setup: '',
      title: 'Was möchten Sie tun?'
    },
    dates: {
      'long': '',
      longOmitDays: '',
      longOmitDaysPlural: '',
      longOmitDaysYears: '',
      longOmitYears: '',
      longPlural: '',
      'short': '',
      shortOmitYears: ''
    },
    diagnosis: {
      labels: {
        activeDiagnosis: '',
        date: '',
        diagnosis: '',
        secondaryDiagnosis: ''
      },
      titles: {
        addDiagnosis: '',
        editDiagnosis: ''
      }
    },
    errors: {
      accepted: '',
      blank: '',
      confirmation: '',
      empty: '',
      equalTo: '',
      even: '',
      exclusion: '',
      greaterThan: '',
      greaterThanOrEqualTo: '',
      inclusion: '',
      invalid: '',
      invalidNumber: '',
      lessThan: '',
      lessThanOrEqualTo: '',
      notANumber: '',
      notAnInteger: '',
      odd: '',
      otherThan: '',
      present: '',
      result: '',
      tooLong: '',
      tooShort: '',
      wrongLength: ''
    },
    headings: { chargedItems: '' },
    imaging: {
      alerts: {
        completedMessage: 'Die Anfrage zur Bildgebung wurde abgeschlossen.',
        completedTitle: 'Bildgebungs-Anfrage gestellt',
        savedMessage: 'Die Anfrage zur Bildgebung wurde gespeichert.',
        savedTitle: 'Bildgebungs-Anfrage gespeichert'
      },
      buttons: { newButton: '+ Neue Bildgebung' },
      labels: {
        addNewVisit: '--Neuen Besuch hinzufügen--',
        radiologist: 'Radiologe'
      },
      messages: { noCompleted: 'Keine erledigten Einträge gefunden.' },
      pageTitle: 'Anfrage zur Bildgebung',
      sectionTitle: 'Bildgebung',
      titles: {
        completedImaging: 'Erledigte Bildgebung',
        editTitle: 'Bildgebungs-Anfrage bearbeiten',
        newTitle: 'Neue Bildgebungs-Anfrage'
      }
    },
    incident: {
      buttons: {
        add: '',
        addForm: '',
        addItem: '',
        cancel: '',
        'delete': '',
        download: '',
        edit: '',
        'export': '',
        generateRep: '',
        newAttachment: '',
        newCategory: '',
        newIncident: '',
        newNote: ''
      },
      labels: {
        actions: '',
        addedBy: '',
        category: '',
        categoryItem: '',
        date: '',
        dateRecorded: '',
        department: '',
        description: '',
        endDate: '',
        givenBy: '',
        howToAddAttachment: '',
        incidentDate: '',
        incidentId: '',
        item: '',
        lastUpdated: '',
        note: '',
        patientId: '',
        patientImpacted: '',
        reportType: '',
        reportedBy: '',
        reportedDate: '',
        reportedTo: '',
        sentinelEvent: '',
        startDate: '',
        status: '',
        statusActive: '',
        statusClosed: '',
        statusFollowup: '',
        statusReported: '',
        title: '',
        total: '',
        updatedBy: ''
      },
      messages: {
        attachmentFileRequired: '',
        createNew: '',
        createNewIncidentCategory: '',
        fillIn: '',
        incidentCategorySaved: '',
        noClosedIncidents: '',
        noIncidentCategoriesFound: '',
        noIncidents: '',
        saved: '',
        selectExistingPatient: ''
      },
      titles: {
        addAttachment: '',
        addCategoryItem: '',
        addNote: '',
        attachments: '',
        closed: '',
        current: '',
        deleteAttachment: '',
        deleteIncident: '',
        deleteIncidentCategory: '',
        deleteItem: '',
        deleteNote: '',
        editAttachment: '',
        editIncident: '',
        editIncidentCategory: '',
        editNote: '',
        general: '',
        history: '',
        incidentCategories: '',
        incidentCategoryItem: '',
        incidentCategoryName: '',
        incidentCategorySaved: '',
        incidentSaved: '',
        incidents: '',
        incidentsByCategory: '',
        incidentsByDepartment: '',
        newIncident: '',
        newIncidentCategory: '',
        notes: '',
        reports: ''
      }
    },
    inventory: {
      edit: {
        cost: '',
        delivered: '',
        location: '',
        prescription: '',
        pulled: '',
        quantity: '',
        reason: '',
        returned: '',
        transferredFrom: '',
        transferredTo: ''
      },
      labels: {
        action: '',
        add: '',
        addAdjustmentType: '',
        adjust: '',
        adjustmentDate: '',
        adjustmentFor: '',
        adjustmentType: '',
        aisle: '',
        aisleLocation: '',
        allInventory: '',
        allItems: '',
        availableQuantity: '',
        billTo: '',
        consumePurchases: '',
        consumptionRate: '',
        cost: '',
        costPerUnit: '',
        crossReference: '',
        currentQuantity: '',
        dateCompleted: '',
        dateEffective: '',
        dateEnd: '',
        dateReceived: '',
        dateStart: '',
        dateTransferred: '',
        daysLeft: '',
        deleteItem: '',
        deliveryAisle: '',
        deliveryLocation: '',
        details: '',
        distributionUnit: '',
        editItem: '',
        expense: '',
        expirationDate: '',
        fulfillRequest: '',
        fulfillRequestNow: '',
        gift: '',
        giftInKindNo: '',
        giftInKindYes: '',
        giftUsage: '',
        inventoryConsumed: '',
        inventoryItem: '',
        inventoryObsolence: '',
        invoiceItems: '',
        invoiceLineItem: '',
        invoiceNumber: '',
        item: '',
        itemNumber: '',
        items: '',
        location: '',
        locations: '',
        markAsConsumed: '',
        name: '',
        newItem: '',
        originalQuantity: '',
        print: '',
        printBarcode: '',
        printer: '',
        pullFrom: '',
        purchaseCost: '',
        purchaseInfo: '',
        purchases: '',
        quantity: '',
        quantityAvailable: '',
        quantityOnHand: '',
        quantityRequested: '',
        rank: '',
        reason: '',
        remove: '',
        removeAdjustmentType: '',
        reorderPoint: '',
        requestedItems: '',
        returnAdjustmentType: '',
        returnToVendorAdjustmentType: '',
        salePricePerUnit: '',
        save: '',
        serialNumber: '',
        total: '',
        totalCost: '',
        totalReceived: '',
        transaction: '',
        transactions: '',
        transfer: '',
        transferFrom: '',
        transferTo: '',
        transferToAisle: '',
        unit: '',
        unitCost: '',
        vendor: '',
        vendorItemNumber: '',
        writeOffAdjustmentType: '',
        xref: ''
      },
      messages: {
        adjust: '',
        createRequest: 'Neue Anfrage erstellen?',
        itemNotFound: '',
        loading: '',
        noItems: '',
        noRequests: 'Keine Anfragen gefunden.',
        purchaseSaved: '',
        quantity: '',
        removeItem: '',
        removeItemRequest: '',
        requestFulfilled: '',
        requestUpdated: '',
        warning: ''
      },
      reports: {
        adjustment: '',
        daysSupply: '',
        expenseDetail: '',
        expenseSum: '',
        expiration: '',
        'export': '',
        fields: '',
        finance: '',
        generate: '',
        invLocation: '',
        invValuation: '',
        purchaseDetail: '',
        purchaseSum: '',
        reportType: '',
        rows: {
          adjustments: '',
          adjustmentsTotal: '',
          balanceBegin: '',
          balanceEnd: '',
          category: '',
          consumed: '',
          consumedGik: '',
          consumedGikTotal: '',
          consumedPuchases: '',
          consumedPurchasesTotal: '',
          consumedTotal: '',
          errInFinSum: '',
          errInFindPur: '',
          errInFindReq: '',
          expensesFor: '',
          noAccount: '',
          subtotal: '',
          subtotalFor: '',
          total: '',
          totalFor: '',
          totalPurchases: '',
          transfer1: '',
          trasnfer2: ''
        },
        stockTransferDetail: '',
        stockTransferSum: '',
        stockUsageDetail: '',
        stockUsageSum: '',
        titleDateRange: '',
        titleSingleDate: ''
      },
      titles: {
        addPurchase: '',
        addRequest: '',
        adjustment: '',
        editPurchase: '',
        editRequest: '',
        inventoryItem: '',
        inventoryReport: '',
        purchaseSaved: '',
        quickAddTitle: '',
        removeItem: '',
        requestFulfilled: '',
        requestUpdated: '',
        transfer: '',
        warning: ''
      }
    },
    labels: {
      action: 'Aktion',
      actions: 'Aktionen',
      addNewOutpatientVisit: '',
      address: '',
      age: 'Alter',
      allDay: '',
      amount: '',
      anesthesia: '',
      assisting: '',
      balanceDue: '',
      billDate: '',
      billTo: '',
      category: '',
      completed: 'Erledigt',
      country: '',
      cptcode: '',
      creditTo: '',
      date: '',
      dateCompleted: 'Abschlussdatum',
      dateOfBirth: '',
      dateOfBirthShort: '',
      datePaid: '',
      dateRequested: 'Anfragedatum',
      'delete': 'Entfernen',
      deleteRequest: '',
      deleteUser: 'Benutzer löschen',
      department: '',
      description: '',
      discount: '',
      displayName: 'Angezeigter Name',
      docRead: 'Dokument gelesen',
      docWritten: 'Dokument geschrieben',
      edit: 'Bearbeiten',
      editUser: 'Benutzer bearbeiten',
      email: 'E-Mail',
      endDate: '',
      endTime: 'Endzeit',
      excess: '',
      expenseTo: '',
      fileLoadSuccessful: 'Datei erfolgreich geladen',
      fileName: '',
      fileToLoad: 'Datei laden',
      fulfill: 'Ausführen',
      fulfillRequest: '',
      fulfillRequestNow: '',
      fulfilled: '',
      grandTotal: '',
      id: 'Id-Nr',
      imageOrders: '',
      imagingType: 'Bildgebungsart',
      importFile: 'Datei importieren',
      invoiceId: '',
      labOrders: '',
      lineItems: '',
      loading: '',
      location: '',
      lookupType: 'Nachschlagebereich',
      medication: '',
      name: 'Name',
      newUser: 'Neuer Benutzer',
      note: '',
      notes: 'Notizen',
      number: '',
      on: '',
      password: 'Passwort',
      patient: 'Patient',
      payments: '',
      physician: '',
      prescriber: '',
      prescription: '',
      prescriptionDate: '',
      price: '',
      print: '',
      procedures: '',
      provider: '',
      pullFrom: '',
      quantity: 'Anzahl',
      remarks: '',
      requestedBy: 'Angefragt von',
      requestedOn: 'Angefragt am',
      requests: 'Anfragen',
      result: 'Ergebnis',
      results: 'Ergebnisse',
      role: 'Rolle',
      search: '',
      sex: 'Geschlecht',
      startDate: '',
      startTime: 'Startzeit',
      status: '',
      takenBy: '',
      total: '',
      type: '',
      userCanAddNewValue: 'Benutzer kann neue Werte hinzufügen',
      username: 'Username',
      value: 'Wert',
      view: '',
      visit: 'Besuch',
      'with': ''
    },
    labs: {
      alerts: {
        requestCompletedMessage: '',
        requestCompletedTitle: '',
        requestSavedMessage: '',
        requestSavedTitle: ''
      },
      buttons: { newButton: '' },
      completedTitle: '',
      deleteTitle: '',
      editTitle: '',
      labels: {
        addNewVisit: '',
        labType: ''
      },
      messages: {
        createNewRecord: '',
        noCompleted: '',
        noItemsFound: ''
      },
      newTitle: '',
      requestsTitle: '',
      sectionTitle: ''
    },
    loading: {
      messages: {
        '0': '',
        '1': '',
        '2': '',
        '3': '',
        '4': '',
        '5': '',
        '6': '',
        '7': '',
        '8': '',
        '9': '',
        '10': '',
        '11': ''
      },
      progressBar: { progress: '' }
    },
    login: {
      labels: {
        password: 'Passwort',
        signIn: 'Anmelden',
        username: 'Benutzername'
      },
      messages: {
        error: 'Benutzername oder Passwort falsch.',
        signIn: 'Bitte anmelden'
      }
    },
    medication: {
      alerts: {
        fulfilledTitle: '',
        returnedMessage: '',
        returnedTitle: '',
        savedMessage: '',
        savedTitle: ''
      },
      buttons: {
        dispenseMedication: '',
        newButton: '',
        returnMedication: ''
      },
      labels: {
        adjustmentDate: '',
        creditToAccount: '',
        quantityDispensed: '',
        quantityDistributed: '',
        quantityRequested: '',
        quantityToReturn: '',
        refills: '',
        returnAisle: '',
        returnLocation: '',
        returnReason: ''
      },
      messages: { createNew: '' },
      pageTitle: '',
      returnMedication: '',
      sectionTitle: '',
      titles: {
        completedMedication: '',
        editMedicationRequest: '',
        newMedicationRequest: ''
      }
    },
    messages: {
      createNewRecord: 'Neuen Eintrag erstellen?',
      createNewUser: 'Neuen Benutzer hinzufügen?',
      'delete': '',
      delete_plural: '',
      delete_singular: '',
      forAuthorizedPersons: 'Dieser Bericht ist nur für autorisierte Personen.',
      newPatientHasToBeCreated: '',
      noHistoryAvailable: '',
      noItemsFound: 'Keine Einträge gefunden.',
      noNotesAvailable: '',
      noUsersFound: 'Keine Benutzer gefunden.',
      onBehalfOf: '',
      reportError: '',
      requiredFieldsCorrectErrors: '',
      saveActionException: '',
      sorry: '',
      userHasBeenSaved: 'Der Benutzer wurde gespeichert.',
      userSaved: 'Benutzer gespeichert'
    },
    models: {
      appointment: {
        labels: {
          allDay: '',
          appointmentDate: '',
          appointmentType: '',
          endDate: '',
          location: '',
          notes: '',
          patient: '',
          provider: '',
          startDate: '',
          status: '',
          type: ''
        },
        names: {
          plural: '',
          singular: ''
        }
      },
      attachment: { names: {
          plural: '',
          singular: ''
        } },
      form: { names: {
          plural: '',
          singular: ''
        } },
      imaging: {
        names: '',
        request: {
          plural: '',
          singular: ''
        }
      },
      incident: { names: {
          plural: '',
          singular: ''
        } },
      item: { names: {
          plural: '',
          singular: ''
        } },
      lab: {
        names: {
          plural: '',
          singular: ''
        },
        request: {
          plural: '',
          singular: ''
        }
      },
      medication: {
        names: {
          plural: '',
          singular: ''
        },
        request: {
          plural: '',
          singular: ''
        }
      },
      note: { names: {
          plural: '',
          singular: ''
        } },
      patient: {
        labels: { name: '' },
        names: { singular: '' }
      },
      procedure: { names: {
          plural: '',
          singular: ''
        } },
      user: { names: {
          plural: '',
          singular: ''
        } },
      visit: { names: {
          plural: '',
          singular: ''
        } },
      vital: { names: {
          plural: '',
          singular: ''
        } }
    },
    navigation: {
      about: 'Über HospitalRun',
      actions: {
        login: 'Anmelden',
        logout: 'Abmelden'
      },
      administration: 'Administration',
      billing: 'Abrechnung',
      imaging: 'Bildgebung',
      incident: '',
      inventory: 'Inventar',
      labs: 'Labore',
      medication: 'Medikation',
      patients: 'Patienten',
      scheduling: '',
      subnav: {
        actions: '',
        addAppointment: 'Termin eintragen',
        addressFields: 'Adressfelder',
        admittedPatients: '',
        appointmentSearch: '',
        appointmentsCalendar: '',
        appointmentsThisWeek: '',
        completed: 'Erledigt',
        currentIncidents: '',
        customForms: '',
        dispense: 'Verabreichen',
        history: '',
        incidentCategories: '',
        inventoryReceived: 'Eingeganges Inventar',
        invoices: 'Rechnungen',
        items: 'Einheiten',
        loadDB: '',
        lookupLists: 'Nachschlagelisten',
        missedAppointments: '',
        newIncident: '',
        newInvoice: 'Neue Rechnung',
        newPatient: 'Neuer Patient',
        newRequest: 'Neue Anfrage',
        newUser: 'Neuer Benutzer',
        outpatient: '',
        patientListing: 'Patietenliste',
        priceProfiles: 'Preisprofile',
        prices: 'Kosten',
        printHeader: '',
        reports: 'Berichte',
        requests: 'Anfragen',
        returnMedication: 'Medikamente zurückgeben',
        scheduleSurgery: '',
        theaterSchedule: '',
        "today'sAppointments": '',
        userRoles: '',
        users: 'Benutzer',
        workflow: ''
      }
    },
    operationReport: {
      labels: {
        additionalNotes: '',
        assistant: '',
        caseComplexity: '',
        operationDescription: '',
        preOpPrimaryDiagnosis: '',
        preOpSecondaryDiagnosis: '',
        surgeon: '',
        surgeryDate: ''
      },
      messages: { reportSaved: '' },
      titles: {
        editTitle: '',
        newTitle: '',
        reportSaved: ''
      }
    },
    operativePlan: {
      buttons: { completePlan: '' },
      labels: {
        additionalNotes: '',
        admissionInstructions: '',
        caseComplexity: '',
        completedStatus: '',
        droppedStatus: '',
        operationDescription: '',
        plannedStatus: '',
        status: '',
        surgeon: ''
      },
      messages: {
        planCompleted: '',
        planSaved: ''
      },
      titles: {
        editTitle: '',
        newTitle: '',
        planCompleted: '',
        planSaved: ''
      }
    },
    patients: {
      buttons: {
        addContact: '',
        addExpense: '',
        addFamilyMember: '',
        addOperativePlan: '',
        backToPatients: '',
        download: '',
        editOperativePlan: '',
        newAppointment: '',
        newImaging: '',
        newLab: '',
        newMedication: '',
        newPatient: '',
        newPhoto: '',
        newVisit: '',
        patientCheckIn: '',
        scheduleSurgery: ''
      },
      labels: {
        admissionDate: '',
        admit: '',
        bloodType: '',
        caption: '',
        civilStatus: '',
        clinic: '',
        contacts: '',
        cost: '',
        dateOfBirth: '',
        dateProcessed: '',
        dischargeDate: '',
        dob: '',
        education: '',
        email: '',
        externalPatientId: '',
        firstName: '',
        income: '',
        insurance: '',
        lastName: '',
        middleName: '',
        monthlyCost: '',
        occupation: '',
        operativePlan: '',
        parent: '',
        patientDays: '',
        patientType: '',
        patientTypeCharity: '',
        patientTypePrivate: '',
        phone: '',
        placeOfBirth: '',
        primaryDiagnosis: '',
        referredBy: '',
        referredDate: '',
        relationship: '',
        relationships: '',
        religion: '',
        secondaryDiagnosis: '',
        sex: '',
        sexNotEntered: '',
        sources: '',
        status: '',
        totalMontlyExpense: ''
      },
      messages: {
        areYouSureDelete: '',
        createNewPatient: '',
        deletingPatient: '',
        noPatientsFound: '',
        notFoundQuickAdd: '',
        photoFileRequired: '',
        savedPatient: ''
      },
      navigation: {
        appointments: '',
        general: '',
        history: '',
        imaging: '',
        labs: '',
        medication: '',
        photos: '',
        socialWork: '',
        visits: ''
      },
      notes: {
        newNote: '',
        onBehalfOfCopy: '',
        onBehalfOfLabel: '',
        pleaseSelectAVisit: '',
        updateNote: ''
      },
      titles: {
        addContact: '',
        addPhoto: '',
        additionalContacts: '',
        admissionsDetail: '',
        admissionsSummary: '',
        admittedPatients: '',
        'delete': '',
        deleteContact: '',
        deleteExpense: '',
        deleteFamilyMember: '',
        deletePatientRecord: '',
        deletePhoto: '',
        diagnosticTesting: '',
        dischargesDetail: '',
        dischargesSummary: '',
        edit: '',
        editPhoto: '',
        expenses: '',
        familyInfo: '',
        familyInformation: '',
        'new': '',
        outpatientsForDate: '',
        patient: '',
        patientListing: '',
        patientReport: '',
        patientStatus: '',
        proceduresDetail: '',
        proceduresSummary: '',
        savedPatient: '',
        socialWork: '',
        todaysOutpatients: '',
        totalPatientDays: '',
        totalPatientDaysDetailed: '',
        visit: ''
      }
    },
    print: { invoice: {
        labels: {
          billedBy: '',
          billedDate: '',
          dateAdmitted: '',
          dateDischarged: '',
          dischargeNotes: '',
          patientAddress: '',
          patientAge: '',
          patientId: '',
          patientName: '',
          remarks: '',
          spacer: ''
        },
        messages: { whereConducted: '' },
        titles: {
          billingStatement: '',
          patientMember: '',
          patients: '',
          relContact: ''
        }
      } },
    procedures: {
      buttons: { addMedication: '' },
      labels: { medicationUsed: '' },
      messages: { saved: '' },
      titles: {
        addChargeItem: '',
        addMedicationUsed: '',
        deleteChargeItem: '',
        deleteMedicationUsed: '',
        edit: '',
        editChargeItem: '',
        editMedicationUsed: '',
        medicationUsed: '',
        'new': '',
        saved: ''
      }
    },
    reports: {
      labels: {
        admissionDate: '',
        allProcedures: '',
        completedBy: '',
        dischargeDate: '',
        examiner: '',
        images: '',
        labs: '',
        location: '',
        medications: '',
        nextAppointment: '',
        nextAppointments: '',
        notes: {
          author: '',
          date: '',
          title: ''
        },
        operativePlan: {
          description: '',
          instructions: '',
          procedures: '',
          title: ''
        },
        primaryDiagnosis: '',
        procedures: '',
        secondaryDiagnosis: '',
        visitDate: '',
        visitType: ''
      },
      messages: {
        'delete': '',
        saved: ''
      },
      titles: {
        dischargeReport: '',
        newDischargeReport: '',
        newOPDReport: '',
        opdReport: '',
        saved: ''
      }
    },
    user: {
      plusNewUser: '+ Neuer Benutzer',
      usersPageTile: 'Benutzerliste'
    },
    visits: {
      buttons: {
        addDiagnosis: '',
        checkIn: '',
        checkOut: '',
        discharge: '',
        newAppointment: '',
        newDischargeReport: '',
        newOPDReport: '',
        newProcedure: '',
        newVitals: ''
      },
      labels: {
        appointment: '',
        authoredBy: '',
        checkInTime: '',
        checkOutTime: '',
        createNewPatient: '',
        diagnosis: '',
        examiner: '',
        finalDiagnosis: '',
        haveAppointment: '',
        haveDoneOrders: '',
        noAppointment: '',
        ordersDone: '',
        ordersNotDone: '',
        patientToCheckIn: '',
        procedure: '',
        procedureDate: '',
        reasonForVisit: '',
        reportType: '',
        status: '',
        statusAdmitted: '',
        statusCheckedIn: '',
        statusCheckedOut: '',
        statusDischarged: '',
        visitDate: '',
        visitInformation: '',
        visitType: ''
      },
      messages: {
        checkOut: '',
        checkedOut: '',
        discharged: '',
        patientCheckedIn: '',
        patientCreatedAndCheckedIn: '',
        visitAndPatientSaved: '',
        visitSaved: ''
      },
      navigation: {
        charges: '',
        notes: '',
        orders: '',
        procedures: '',
        reports: '',
        vitals: ''
      },
      titles: {
        additionalDiagnoses: '',
        checkOut: '',
        checkedIn: '',
        checkedOut: '',
        discharged: '',
        editVisit: '',
        newVisit: '',
        patientCheckIn: '',
        visitSaved: ''
      }
    },
    vitals: { labels: {
        dateRecorded: '',
        dbp: '',
        heartRate: '',
        height: '',
        respiratoryRate: '',
        sbp: '',
        temperature: '',
        weight: ''
      } }
  };
});
define("hospitalrun/locales/en/config", ["exports"], function (exports) {
  // Ember-I18n includes configuration for common locales. Most users
  // can safely delete this file. Use it if you need to override behavior
  // for a locale or define behavior for a locale that Ember-I18n
  // doesn't know about.
  exports["default"] = {
    // rtl: [true|FALSE],
    //
    // pluralForm: function(count) {
    //   if (count === 0) { return 'zero'; }
    //   if (count === 1) { return 'one'; }
    //   if (count === 2) { return 'two'; }
    //   if (count < 5) { return 'few'; }
    //   if (count >= 5) { return 'many'; }
    //   return 'other';
    // }
  };
});
define('hospitalrun/locales/en/translations', ['exports'], function (exports) {
  exports['default'] = {
    admin: {
      address: {
        address1Label: 'Address 1 Label',
        address2Label: 'Address 2 Label',
        address3Label: 'Address 3 Label',
        address4Label: 'Address 4 Label',
        addressLabel: 'Address',
        editTitle: 'Address Options',
        include1Label: 'Include 1 Label',
        include2Label: 'Include 2 Label',
        include3Label: 'Include 3 Label',
        include4Label: 'Include 4 Label',
        messages: { addressSaved: 'The address options have been saved' },
        newTitle: 'Address Options',
        titles: { optionsSaved: 'Options Saved' }
      },
      addressOptions: 'Address Options',
      customForms: {
        buttons: {
          addField: 'Add Field',
          moveDown: 'Move Down',
          moveUp: 'Move Up',
          newForm: '+ new form',
          preview: 'Preview'
        },
        labels: {
          alwaysInclude: 'Always Include',
          checkbox: 'Checkbox',
          colSpan: 'Number of Columns To Span',
          columns: 'Columns',
          customForm: 'Custom Form',
          dischargeReportFormType: 'Discharge Report',
          expenseTo: 'Expense To',
          formName: 'Form Name',
          formType: 'Form Type',
          incidentFormType: 'Incident',
          includeOtherOption: 'Include Other Option',
          labFormType: 'Lab',
          label: 'Label',
          newForm: 'New Form',
          opdReportFormType: 'Outpatient Report',
          operativePlanFormType: 'Operative Plan and Report',
          otherOptionLabel: 'Other Option Label',
          patientFormType: 'Patient',
          property: 'Property',
          radio: 'Radio',
          select: 'Dropdown',
          socialworkFormType: 'Social Work',
          text: 'Text',
          textarea: 'Large Text',
          visitFormType: 'Visit'
        },
        messages: { formSaved: 'The {{name}} form has been saved.' },
        titles: {
          checkboxValues: 'Checkbox Values',
          customForms: 'Custom Forms',
          deleteForm: 'Delete Custom Form',
          dropDownValues: 'Dropdown Values',
          editCustomForm: 'Edit Custom Form',
          fields: 'Fields',
          formSaved: 'Form Saved',
          newCustomForm: 'New Custom Form',
          radioValues: 'Radio Values'
        }
      },
      header: {
        editTitle: 'Header Options',
        facilityName: 'Facility Name',
        headerLabel: 'Header',
        headerLine1: 'Header Line 1',
        headerLine2: 'Header Line 2',
        headerLine3: 'Header Line 3',
        logoURL: 'Logo URL',
        messages: { headerSaved: 'The header options have been saved' },
        newTitle: 'Header Options',
        titles: { optionsSaved: 'Options Saved' }
      },
      loadDb: 'Load DB',
      loaddb: {
        displayAlertMessage: 'Please select file to load.',
        displayAlertTitle: 'Select File To Load',
        editTitle: 'Load DB',
        errorDisplayAlertMessage: 'The database could not be imported. The error was: {{error}}',
        errorDisplayAlertTitle: 'Error Loading',
        progressMessage: 'Please wait while your database is loaded.',
        progressTitle: 'Loading Database'
      },
      lookup: {
        aisleLocationList: 'Inventory Aisle Locations',
        alertImportListMessage: 'Please select file to import.',
        alertImportListSaveMessage: 'The lookup list has been imported.',
        alertImportListSaveTitle: 'List Imported',
        alertImportListTitle: 'Select File To Import',
        alertImportListUpdateMessage: 'The lookup list has been saved.',
        alertImportListUpdateTitle: 'List Saved',
        anesthesiaTypes: 'Anesthesia Types',
        anesthesiologists: 'Anesthesiologists',
        billingCategories: 'Billing Categories',
        clinicList: 'Clinic Locations',
        countryList: 'Countries',
        cptCodeList: 'CPT Codes',
        diagnosisList: 'Diagnoses',
        edit: { template: {
            addTitle: 'Add Value',
            editTitle: 'Edit Value',
            labelTitle: 'Value',
            updateButtonTextAdd: 'Add',
            updateButtonTextUpdate: 'Update'
          } },
        expenseAccountList: 'Expense Accounts',
        imagingPricingTypes: 'Imaging Pricing Types',
        incidentDepartments: 'Incident Departments',
        inventoryTypes: 'Inventory Types',
        labPricingTypes: 'Lab Pricing Types',
        pageTitle: 'Lookup Lists',
        patientStatusList: 'Patient Status List',
        physicianList: 'Physicians',
        procedureList: 'Procedures',
        procedureLocations: 'Procedures Locations',
        procedurePricingTypes: 'Procedure Pricing Types',
        radiologists: 'Radiologists',
        titles: { deleteLookupValue: 'Delete Value' },
        unitTypes: 'Unit Types',
        vendorList: 'Vendor',
        visitLocationList: 'Visit Locations',
        visitTypes: 'Visit Types',
        wardPricingTypes: 'Ward Pricing Types',
        warehouseList: 'Inventory Locations'
      },
      lookupLists: 'Lookup Lists',
      roles: {
        capability: {
          addAllergy: 'Add Allergy',
          addAppointment: 'Add Appointment',
          addBillingDiagnosis: 'Add Billing Diagnosis',
          addCharge: 'Add Charge',
          addDiagnosis: 'Add Diagnosis',
          addImaging: 'Add Imaging',
          addIncident: 'Add Incident',
          addIncidentCategory: 'Add Incident Category',
          addInventoryItem: 'Add Inventory Item',
          addInventoryPurchase: 'Add Inventory Purchase',
          addInventoryRequest: 'Add Inventory Request',
          addInvoice: 'Add Invoice',
          addLab: 'Add Lab',
          addMedication: 'Add Medication',
          addNote: 'Add Note',
          addOperationReport: 'Add Operation Report',
          addOperativePlan: 'Add Operative Plan',
          addPatient: 'Add Patient',
          addPayment: 'Add Payment',
          addPhoto: 'Add Photo',
          addPricing: 'Add Pricing',
          addPricingProfile: 'Add Pricing Profile',
          addProcedure: 'Add Procedure',
          addSocialwork: 'Add Social Work',
          addVisit: 'Add Visit',
          addVitals: 'Add Vitals',
          adjustInventoryLocation: 'Adjust Inventory Location',
          admin: 'Administration',
          admitPatient: 'Admit Patient',
          appointments: 'Appointments',
          billing: 'Billing',
          cashier: 'Cashier',
          completeImaging: 'Complete Imaging',
          completeLab: 'Complete Lab',
          defineUserRoles: 'Define User Roles',
          deleteAppointment: 'Delete Appointment',
          deleteDiagnosis: 'Delete Diagnosis',
          deleteImaging: 'Delete Imaging',
          deleteIncident: 'Delete Incident',
          deleteIncidentCategory: 'Delete Incident Category',
          deleteInventoryItem: 'Delete Inventory Item',
          deleteInvoice: 'Delete Invoice',
          deleteLab: 'Delete Lab',
          deleteMedication: 'Delete Medication',
          deleteNote: 'Delete Note',
          deletePatient: 'Delete Patient',
          deletePhoto: 'Delete Photo',
          deletePricing: 'Delete Pricing',
          deletePricingProfile: 'Delete Pricing Profile',
          deleteProcedure: 'Delete Procedure',
          deleteSocialwork: 'Delete Social Work',
          deleteVisit: 'Delete Visit',
          deleteVitals: 'Delete Vitals',
          dischargePatient: 'Discharge Patient',
          editInvoice: 'Edit Invoice',
          fulfillInventory: 'Fulfill Inventory',
          fulfillMedication: 'Fulfill Medication',
          generateIncidentReport: 'Generate Incident Report',
          imaging: 'Imaging',
          incident: 'Incident',
          inventory: 'Inventory',
          invoices: 'Invoices',
          labs: 'Labs',
          listPaidInvoices: 'List Paid Invoices',
          loadDb: 'Load Database',
          manageIncidents: 'Manage Incidents',
          medication: 'Medication',
          overrideInvoice: 'Override Invoice',
          patientReports: 'Patient Reports',
          patients: 'Patients',
          pricing: 'Pricing',
          updateConfig: 'Update Configurations',
          visits: 'Visits'
        },
        messages: { roleSaved: 'The {{roleName}} role has been saved.' },
        titles: { roleSaved: 'Role Saved' }
      },
      textReplacements: {
        createNew: 'Create a new shortcode',
        existingRepl: 'Existing Shortcodes',
        replDesc: 'When entering text, these shortcuts allow you to replace a short sequence of characters with a longer phrase.',
        pageTitle: 'Shortcodes',
        toReplace: 'Text to replace',
        replaceWith: 'Replace with',
        performExpand: "Press Enter to replace #{{from}} with '{{to}}'",
        possibleExpansions: 'Possible replacements: {{possible}}',
        noMatches: "No replacements match '{{term}}'"
      },
      userRoles: 'User Roles',
      users: 'Users',
      visitForms: {
        labels: {
          followup: 'Followup',
          form: 'Form',
          initial: 'Initial',
          visitType: 'Visit Type'
        },
        titles: { visitForms: 'Visit Forms' }
      },
      workflow: {
        admissionDepositLabel: 'Admission deposit required',
        clinicPrepaymentLabel: 'Clinic prepayment required',
        editTitle: 'Workflow Options',
        followupPrepaymentLabel: 'Followup prepayment required',
        messages: { optionsSaved: 'The workflow options have been saved' },
        newTitle: 'Workflow Options',
        outpatientImagingLabel: 'Outpatient Imaging prepayment required',
        outpatientLabLabel: 'Outpatient Lab prepayment required',
        outpatientMedicationLabel: 'Outpatient Medication prepayment required',
        titles: { optionsSaved: 'Options Saved' },
        workflowLabel: 'Workflow'
      }
    },
    alerts: {
      errorExclamation: 'Error!!!!',
      pleaseWait: 'Please Wait',
      reportError: 'Error Generating Report',
      warningExclamation: 'Warning!!!!'
    },
    allergies: {
      buttons: { addAllergy: 'Add Allergy' },
      labels: {
        allergyName: 'Name',
        patientAllergy: 'Patient Allergies'
      },
      titles: {
        addAllergy: 'Add Allergy',
        editAllergy: 'Edit Allergy'
      }
    },
    application: {
      messages: { sessionExpired: 'Your session has expired.  Please login to continue.' },
      titles: { sessionExpired: 'Session Expired' }
    },
    appointments: {
      buttons: {
        newButton: '+ new appointment',
        scheduleSurgery: '+ schedule surgery'
      },
      calendarTitle: 'Appointments Calendar',
      currentScreenTitle: 'Appointment List',
      editTitle: 'Edit Appointment',
      labels: {
        noLocation: 'No Location',
        selectedStartingDate: 'Show Appointments On Or After'
      },
      messages: {
        appointmentSaved: 'The appointment for {{patient}} has been saved.',
        endTimeLaterThanStart: 'Please select an end time later than the start time.'
      },
      missed: 'Missed Appointments',
      newTitle: 'New Appointment',
      searchTitle: 'Search Appointments',
      sectionTitle: 'Appointments',
      thisWeek: 'Appointments This Week',
      titles: {
        appointmentSaved: 'Appointment Saved',
        editSurgicalAppointment: 'Edit Surgical Appointment',
        newSurgicalAppointment: 'New Surgical Appointment',
        theaterSchedule: 'Theater Schedule'
      },
      todayTitle: "Today's Appointments"
    },
    billing: {
      alerts: {
        noInvoiceFound: 'No invoices found',
        noPricingItems: 'No pricing items found.',
        noPricingProfiles: 'No pricing profiles found.'
      },
      buttons: {
        addOverride: 'Add Override',
        createInvoice: 'Create an invoice?'
      },
      labels: {
        actualCharges: 'Actual Charges',
        discountAmount: 'Discount Amount',
        discountPercentage: 'Discount Percentage',
        externalInvoiceNumber: 'External Invoice #',
        hmoCom: 'HMO/COM',
        insurance: 'National Insurance',
        paymentProfile: 'Payment Profile',
        paymentsDeposits: 'Payments/Deposits',
        pricingPanelOverrides: 'Pricing profile overrides',
        pricingProfile: 'Pricing Profile',
        setFee: 'Set Fee'
      },
      messages: {
        flatFeeMsg: 'There is a flat fee for patient financial responsibility of {{currency}}{{setFee}}.',
        flatDiscountMsg: 'There is a flat discount amount applied to the patient financial responsibility of {{currency}}{{discountAmount}}.'
      }
    },
    buttons: {
      add: 'Add',
      addItem: 'Add Item',
      addLineItem: 'Add Line Item',
      addValue: 'Add Value',
      addVisit: 'Add Visit',
      allRequests: 'All Requests',
      barcode: 'Barcode',
      cancel: 'Cancel',
      clear: 'Clear',
      close: 'Close',
      complete: 'Complete',
      'delete': 'Delete',
      dispense: 'Dispense',
      edit: 'Edit',
      filter: 'Filter',
      fulfill: 'Fulfill',
      'import': 'Import',
      loadFile: 'Load File',
      newItem: '+ new item',
      newNote: 'New Note',
      newRequest: 'New Request',
      newRequestPlus: '+ new request',
      newUser: 'New User',
      ok: 'Ok',
      remove: 'Remove',
      returnButton: 'Return',
      search: 'Search',
      showAll: 'Show All',
      showFewer: 'Show Fewer',
      update: 'Update'
    },
    components: {
      chargesByTypeTab: { charges: 'charges' },
      customFormManager: { buttons: { addForm: 'Add Form' } },
      dateTimePicker: {
        amHour: '{{hour}} AM',
        midnight: 'Midnight',
        noon: 'Noon',
        pmHour: '{{hour}} PM'
      },
      imageUpload: { messages: { selectValidImageFile: 'Please select a valid image file.' } },
      operativeProcedures: {
        buttons: { addProcedure: 'Add Procedure' },
        labels: { procedure: 'Procedure' },
        titles: { procedures: 'Procedures' }
      },
      patientOrders: {
        buttons: {
          newImaging: 'New Imaging',
          newLab: 'New Lab',
          newMedication: 'New Medication'
        },
        labels: {
          imagingOrderType: 'Imaging',
          labOrderType: 'Lab',
          medicationOrderType: 'Medication',
          orderType: 'Order Type'
        }
      },
      priceList: { charges: '{{pricingType}} charges' },
      quantityCalc: { result: '{{targetUnit}} total: {{calculated}}' },
      quantityConv: {
        conversion: 'What does 1 {{name}} contain?',
        unit: 'Unit'
      },
      sortableColumn: { labels: { selectAll: '(Select All)' } },
      takePhoto: {
        camera: 'Camera',
        how: 'How Do You Want To Add A Photo?',
        labels: {
          takeAPicture: 'Take a Picture',
          uploadAFile: 'Upload a File'
        },
        photo: 'photo',
        preview: 'preview',
        takePhoto: 'Take photo',
        uploadFile: 'Upload File'
      },
      upcomingAppointments: {
        labels: {
          date: 'Date',
          location: 'Location',
          type: 'Type',
          'with': 'With'
        },
        titles: { upcomingAppointments: 'Upcoming Appointments' }
      }
    },
    customForms: {
      buttons: { addForm: 'Add Form' },
      labels: { formToAdd: 'Form To Add' },
      titles: { addCustomForm: 'Add Custom Form' }
    },
    dashboard: {
      needs_user_setup: 'We recommend that you setup a User account.',
      standalone_welcome: '<h4>Thanks for downloading HospitalRun</h4><p>You are running HospitalRun in stand alone mode. This mode allows you to support multiple users on a single, desktop/laptop instance of HospitalRun. This is ideal for:</p><ul><li>Evaluating HospitalRun for an eventual server deployment.</li><li>Using the platform to support a clinic / facility where a single instance is sufficient.</li></ul><p>If you\'re considering a multi-device deployment of HospitalRun, we\'re <a href="https://github.com/HospitalRun/hospitalrun-frontend/issues/1048" target="_blank">working on features</a> that will allow you to "graduate" from this single instance into a traditional cloud / server-based deployment.</p>',
      title: 'Welcome to HospitalRun!'
    },
    dates: {
      'long': '{{years}} year {{months}} months {{days}} days',
      longOmitDays: '{{years}} year {{months}} months',
      longOmitDaysPlural: '{{years}} years {{months}} months',
      longOmitDaysYears: '{{months}} months',
      longOmitYears: '{{months}} months {{days}} days',
      longPlural: '{{years}} years {{months}} months {{days}} days',
      'short': '{{years}}y {{months}}m {{days}}d',
      shortOmitYears: '{{months}}m {{days}}d'
    },
    diagnosis: {
      labels: {
        activeDiagnosis: 'Active Diagnosis',
        date: 'Date',
        diagnosis: 'Diagnosis',
        secondaryDiagnosis: 'Secondary Diagnosis'
      },
      titles: {
        addDiagnosis: 'Add Diagnosis',
        editDiagnosis: 'Edit Diagnosis'
      }
    },
    errors: {
      accepted: 'must be accepted',
      blank: "can't be blank",
      confirmation: "doesn't match {{attribute}}",
      empty: "can't be empty",
      equalTo: 'must be equal to {{count}}',
      even: 'must be even',
      exclusion: 'is reserved',
      greaterThan: 'must be greater than {{count}}',
      greaterThanOrEqualTo: 'must be greater than or equal to {{count}}',
      inclusion: 'is not included in the list',
      invalid: 'is invalid',
      invalidNumber: 'not a valid number',
      lessThan: 'must be less than {{count}}',
      lessThanOrEqualTo: 'must be less than or equal to {{count}}',
      notANumber: 'is not a number',
      notAnInteger: 'must be an integer',
      odd: 'must be odd',
      otherThan: 'must be other than {{count}}',
      present: 'must be blank',
      result: 'Please enter a result before completing',
      tooLong: 'is too long (maximum is {{count}} characters)',
      tooShort: 'is too short (minimum is {{count}} characters)',
      wrongLength: 'is the wrong length (should be {{count}} characters)'
    },
    headings: { chargedItems: 'Charged Items' },
    imaging: {
      alerts: {
        completedMessage: 'The imaging request has been completed.',
        completedTitle: 'Imaging Request Completed',
        savedMessage: 'The imaging request has been saved.',
        savedTitle: 'Imaging Request Saved'
      },
      buttons: { newButton: '+ new imaging' },
      labels: {
        addNewVisit: '--Add New Visit--',
        radiologist: 'Radiologist'
      },
      messages: { noCompleted: 'No completed items found.' },
      pageTitle: 'Imaging Requests',
      sectionTitle: 'Imaging',
      titles: {
        completedImaging: 'Completed Imaging',
        editTitle: 'Edit Imaging Request',
        newTitle: 'New Imaging Request'
      }
    },
    incident: {
      buttons: {
        add: 'Add',
        addForm: '+ Add Form',
        addItem: 'Add Item',
        cancel: 'Cancel',
        'delete': 'Delete',
        download: 'Download',
        edit: 'Edit',
        'export': 'Export Report',
        generateRep: 'Generate Report',
        newAttachment: '+ New Attachment',
        newCategory: '+ new category',
        newIncident: '+ new incident',
        newNote: '+ New Note'
      },
      labels: {
        actions: 'Actions',
        addedBy: 'Added By',
        category: 'Category',
        categoryItem: 'Category Item',
        date: 'Date',
        dateRecorded: 'Date Recorded',
        department: 'Department',
        description: 'Incident Description',
        endDate: 'End Date',
        givenBy: 'Given By',
        howToAddAttachment: 'How Do You Want To Add An Attachment?',
        incidentDate: 'Date of Incident',
        incidentId: 'Incident ID',
        item: 'Item',
        lastUpdated: 'Last Updated',
        note: 'Note',
        patientId: 'Patient Id',
        patientImpacted: 'Patient Impacted',
        reportType: 'Report Type',
        reportedBy: 'Reported By',
        reportedDate: 'Reported Date',
        reportedTo: 'Incident Reported to (Full Name)',
        sentinelEvent: 'Sentinel Event',
        startDate: 'Start Date',
        status: 'Status',
        statusActive: 'Active',
        statusClosed: 'Closed',
        statusFollowup: 'Follow-up',
        statusReported: 'Reported',
        title: 'Title',
        total: 'Total',
        updatedBy: 'Updated By'
      },
      messages: {
        attachmentFileRequired: 'Please upload a file or take a picture or before saving this attachment.',
        createNew: 'Create a new incident?',
        createNewIncidentCategory: 'Create a new Incident Category?',
        fillIn: 'Fill in the above options to calculate score',
        incidentCategorySaved: 'The {{name}} category has been saved.',
        noClosedIncidents: 'No closed incidents found.',
        noIncidentCategoriesFound: 'No Incident Categories found.',
        noIncidents: 'No incidents found.',
        saved: 'The incident report has been saved.',
        selectExistingPatient: 'Please select an existing patient or leave this field blank.'
      },
      titles: {
        addAttachment: 'Add Attachment',
        addCategoryItem: 'Add Category Item',
        addNote: 'Add Note',
        attachments: 'Attachments',
        closed: 'Closed Incidents',
        current: 'Current',
        deleteAttachment: 'Delete Attachment',
        deleteIncident: 'Delete Incident',
        deleteIncidentCategory: 'Delete Incident Category',
        deleteItem: 'Delete Item',
        deleteNote: 'Delete Note',
        editAttachment: 'Edit Attachment',
        editIncident: 'Edit Incident',
        editIncidentCategory: 'Edit Incident Category',
        editNote: 'Edit Note',
        general: 'General Information',
        history: 'History',
        incidentCategories: 'Incident Categories',
        incidentCategoryItem: 'Incident Category Item',
        incidentCategoryName: 'Incident Category Name',
        incidentCategorySaved: 'Incident Category Saved',
        incidentSaved: 'Incident Saved',
        incidents: 'Incidents',
        incidentsByCategory: 'Incidents By Category',
        incidentsByDepartment: 'Incidents By Department',
        newIncident: 'New Incident',
        newIncidentCategory: 'New Incident Category',
        notes: 'Notes',
        reports: 'Reports'
      }
    },
    inventory: {
      edit: {
        cost: 'Cost Per Unit:',
        delivered: 'Delievered To:',
        location: 'Location Adjusted:',
        prescription: 'Prescription For:',
        pulled: 'Pulled From:',
        quantity: 'Quantity at Completion:',
        reason: 'Reason:',
        returned: 'Returned from Patient:',
        transferredFrom: 'Transferred From:',
        transferredTo: 'Transferred To:'
      },
      labels: {
        action: 'Action',
        add: 'Add',
        addAdjustmentType: 'Add',
        adjust: 'Adjust',
        adjustmentDate: 'Adjustment Date',
        adjustmentFor: 'Adjustment For',
        adjustmentType: 'Adjustment Type',
        aisle: 'Aisle',
        aisleLocation: 'Aisle Location',
        allInventory: 'All Inventory',
        allItems: 'All Items',
        availableQuantity: '{{quantity}} available',
        billTo: 'Bill To',
        consumePurchases: 'Consume Purchases',
        consumptionRate: 'Consumption Rate',
        cost: 'Cost',
        costPerUnit: 'Cost per Unit',
        crossReference: 'Cross Reference',
        currentQuantity: 'Current Quantity',
        dateCompleted: 'Date Completed',
        dateEffective: 'Effective Date',
        dateEnd: 'End Date',
        dateReceived: 'Date Received',
        dateStart: 'Start Date',
        dateTransferred: 'Date Transferred',
        daysLeft: 'Days Left',
        deleteItem: 'Delete Item',
        deliveryAisle: 'Delivery Aisle',
        deliveryLocation: 'Delivery Location',
        details: 'Details',
        distributionUnit: 'Distribution Unit',
        editItem: 'Edit Item',
        expense: 'Expense To',
        expirationDate: 'Expiration Date',
        fulfillRequest: 'Fulfill Request',
        fulfillRequestNow: 'Fulfill Request Now',
        gift: 'Gift in Kind',
        giftInKindNo: 'N',
        giftInKindYes: 'Y',
        giftUsage: 'Gift in Kind Usage',
        inventoryConsumed: 'Inventory Consumed',
        inventoryItem: 'Inventory Item',
        inventoryObsolence: 'Inventory Obsolence',
        invoiceItems: 'Invoice Items',
        invoiceLineItem: 'Invoice Line Item',
        invoiceNumber: 'Invoice Number',
        item: 'Item',
        itemNumber: 'Item Number',
        items: 'Items',
        location: 'Location',
        locations: 'Locations',
        markAsConsumed: 'Mark as Consumed',
        name: 'Name',
        newItem: 'New Item',
        originalQuantity: 'Original Quantity',
        print: 'Print',
        printBarcode: 'Print Barcode',
        printer: 'Printer',
        pullFrom: 'Pull From',
        purchaseCost: 'Purchase Cost',
        purchaseInfo: 'Purchase Information',
        purchases: 'Purchases',
        quantity: 'Quantity ({{unit}})',
        quantityAvailable: 'Quantity Available',
        quantityOnHand: 'Quantity on Hand',
        quantityRequested: 'Quantity Requested',
        rank: 'Rank',
        reason: 'Reason',
        remove: 'Remove',
        removeAdjustmentType: 'Remove',
        reorderPoint: 'Reorder Point',
        requestedItems: 'Requested Items',
        returnAdjustmentType: 'Return',
        returnToVendorAdjustmentType: 'Return To Vendor',
        salePricePerUnit: 'Sale Price per Unit',
        save: 'Save',
        serialNumber: 'Serial/Lot Number',
        total: 'Total',
        totalCost: 'Total Cost',
        totalReceived: 'Total Received: {{total}}',
        transaction: 'Transaction',
        transactions: 'Transactions',
        transfer: 'Transfer',
        transferFrom: 'Transfer From',
        transferTo: 'Transfer To Location',
        transferToAisle: 'Transfer to Aisle Location',
        unit: 'Unit',
        unitCost: 'Unit Cost',
        vendor: 'Vendor',
        vendorItemNumber: 'Vendor Item Number',
        writeOffAdjustmentType: 'Write Off',
        xref: 'XRef'
      },
      messages: {
        adjust: 'Please adjust the quantities on the appropriate location(s) to account for the difference of {{difference}}.',
        createRequest: 'Create a new request?',
        itemNotFound: 'The inventory item <strong>{{item}}</strong> could not be found.<br>If you would like to create a new inventory item, fill in the information below.<br>Otherwise, press the Cancel button to return.',
        loading: 'Loading transactions ...',
        noItems: 'No items found.',
        noRequests: 'No requests found.',
        purchaseSaved: 'The inventory purchases have been successfully saved.',
        quantity: 'The total quantity of <strong>({{quantity}})</strong> does not match the total quantity in the locations <strong>({{locationQuantity}})</strong>.',
        removeItem: 'Are you sure you want to remove this item from this invoice?',
        removeItemRequest: 'Are you sure you want to remove this item from this request?',
        requestFulfilled: 'The inventory request has been fulfilled.',
        requestUpdated: 'The inventory request has been updated.',
        warning: 'Please fill in required fields (marked with *) and correct the errors before adding.'
      },
      reports: {
        adjustment: 'Detailed Adjustment',
        daysSupply: 'Days Supply Left In Stock',
        expenseDetail: 'Detailed Expenses',
        expenseSum: 'Summary Expenses',
        expiration: 'Expiration Date',
        'export': 'Export Report',
        fields: 'Fields to Include',
        finance: 'Finance Summary',
        generate: 'Generate Report',
        invLocation: 'Inventory By Location',
        invValuation: 'Inventory Valuation',
        purchaseDetail: 'Detailed Purchase',
        purchaseSum: 'Summary Purchase',
        reportType: 'Report Type',
        rows: {
          adjustments: 'Adjustments',
          adjustmentsTotal: 'Total Adjustments',
          balanceBegin: 'Beginning Balance',
          balanceEnd: 'Ending Balance',
          category: 'Category',
          consumed: 'Consumed',
          consumedGik: 'GiK Consumed',
          consumedGikTotal: 'Total GiK Consumed',
          consumedPuchases: 'Purchases Consumed',
          consumedPurchasesTotal: 'Total Purchases Consumed',
          consumedTotal: 'Total Consumed',
          errInFinSum: 'Error in _generateFinancialSummaryReport: ',
          errInFindPur: 'Error in _findInventoryItemsByPurchase: ',
          errInFindReq: 'Error in _findInventoryItemsByRequest: ',
          expensesFor: 'Expenses For: ',
          noAccount: '(No Account)',
          subtotal: 'Subtotal: ',
          subtotalFor: 'Subtotal for {{category}} - {{account}}: ',
          total: 'Total: ',
          totalFor: 'Total for {{var}}: ',
          totalPurchases: 'Total Purchases',
          transfer1: '{{quantity}} from {{location}}',
          trasnfer2: 'From: {{source}} To: {{target}}'
        },
        stockTransferDetail: 'Detailed Stock Transfer',
        stockTransferSum: 'Summary Stock Transfer',
        stockUsageDetail: 'Detailed Stock Usage',
        stockUsageSum: 'Summary Stock Usage',
        titleDateRange: '{{name}} Report {{startDate}} - {{endDate}}',
        titleSingleDate: '{{name}} Report {{date}}'
      },
      titles: {
        addPurchase: 'Add Purchase',
        addRequest: 'New Request',
        adjustment: 'Adjustment',
        editPurchase: 'Edit Purchase',
        editRequest: 'Edit Request',
        inventoryItem: 'New Inventory Item',
        inventoryReport: 'Inventory Report',
        purchaseSaved: 'Inventory Purchases Saved',
        quickAddTitle: 'New Inventory Item',
        removeItem: 'Remove Item',
        requestFulfilled: 'Request Fulfilled',
        requestUpdated: 'Request Updated',
        transfer: 'Transfer Items',
        warning: 'Warning!!!!!'
      }
    },
    labels: {
      action: 'Action',
      actions: 'Actions',
      addNewOutpatientVisit: '--Add New Outpatient Visit--',
      address: 'Address',
      age: 'Age',
      allDay: 'All Day',
      amount: 'Amount',
      anesthesia: 'Anesthesia',
      assisting: 'Assisting',
      balanceDue: 'Balance Due',
      billDate: 'Bill Date',
      billTo: 'Bill To',
      category: 'Category',
      completed: 'Completed',
      country: 'Country',
      cptcode: 'CPT Code',
      creditTo: 'Credit To',
      currencySymbol: '$',
      date: 'Date',
      dateCompleted: 'Date Completed',
      dateOfBirth: 'Date of Birth',
      dateOfBirthShort: 'DoB',
      datePaid: 'Date Paid',
      dateRequested: 'Date Requested',
      'delete': 'Delete',
      deleteRequest: 'Delete Request',
      deleteUser: 'Delete User',
      department: 'Department',
      description: 'Description',
      discount: 'Discount',
      displayName: 'Display Name',
      docRead: 'Docs Read',
      docWritten: 'Docs Written',
      edit: 'Edit',
      editUser: 'Edit User',
      email: 'Email',
      endDate: 'End Date',
      endTime: 'End Time',
      excess: 'Excess',
      expenseTo: 'Expense To',
      fileLoadSuccessful: 'File To Load Successful',
      fileName: 'File Name',
      fileToLoad: 'File Load',
      from: 'From',
      fulfill: 'Fulfill',
      fulfillRequest: 'Fulfill Request',
      fulfillRequestNow: 'Fulfill Request Now',
      fulfilled: 'Fulfilled',
      grandTotal: 'Grand Total',
      id: 'Id',
      imageOrders: 'Image Orders',
      imagingType: 'Imaging Type',
      importFile: 'Import File',
      invoiceId: 'Invoice ID',
      labOrders: 'Lab Orders',
      lineItems: 'Line Items',
      loading: 'Loading',
      location: 'Location',
      lookupType: 'Lookup Type',
      medication: 'Medication',
      name: 'Name',
      newUser: 'New User',
      note: 'Note',
      notes: 'Notes',
      number: 'Number',
      on: 'on',
      password: 'Password',
      patient: 'Patient',
      payments: 'Payments',
      physician: 'Physician',
      prescriber: 'Prescriber',
      prescription: 'Prescription',
      prescriptionDate: 'Prescription Date',
      price: 'Price',
      print: 'Print',
      procedures: 'Procedures',
      provider: 'Provider',
      pullFrom: 'Pull From',
      quantity: 'Quantity',
      remarks: 'Remarks',
      requestedBy: 'Requested By',
      requestedOn: 'Requested On',
      requests: 'Requests',
      result: 'Result',
      results: 'Results',
      role: 'Role',
      search: 'Search',
      sex: 'Sex',
      startDate: 'Start Date',
      startTime: 'Start Time',
      status: 'Status',
      takenBy: 'Taken By',
      to: 'To',
      total: 'Total',
      type: 'Type',
      userCanAddNewValue: 'User Can Add New Values',
      username: 'Username',
      value: 'Value',
      view: 'View',
      visit: 'Visit',
      'with': 'With'
    },
    labs: {
      alerts: {
        requestCompletedMessage: 'The lab request has been completed.',
        requestCompletedTitle: 'Lab Request Completed',
        requestSavedMessage: 'The lab request has been saved.',
        requestSavedTitle: 'Lab Request Saved'
      },
      buttons: { newButton: '+ new lab' },
      completedTitle: 'Completed Labs',
      deleteTitle: 'Delete Request',
      editTitle: 'Edit Lab Request',
      labels: {
        addNewVisit: '--Add New Visit--',
        labType: 'Lab Type'
      },
      messages: {
        createNewRecord: 'Create a new record?',
        noCompleted: 'No completed items found.',
        noItemsFound: 'No labs found.'
      },
      newTitle: 'New Lab Request',
      requestsTitle: 'Lab Requests',
      sectionTitle: 'Labs'
    },
    loading: {
      messages: {
        '0': 'The top butterfly flight speed is 12 miles per hour. Some moths can fly 25 miles per hour!',
        '1': 'Owls are the only birds that can see the color blue.',
        '2': 'Cats have over 100 vocal sounds; dogs only have 10.',
        '3': 'Humans use a total of 72 different muscles in speech.',
        '4': 'More than 1,000 different languages are spoken on the continent of Africa.',
        '5': 'An erythrophobe is someone who blushes easily.',
        '6': 'The most common phobia in the world is odynophobia which is the fear of pain.',
        '7': 'Your body uses 300 muscles to balance itself when you are standing still.',
        '8': 'Certain frogs can be frozen solid then thawed, and continue living.',
        '9': 'Our eyes are always the same size from birth, but our nose and ears never stop growing.',
        '10': 'Your tongue is the only muscle in your body that is attached at only one end.',
        '11': 'Camels have three eyelids to protect themselves from blowing sand.'
      },
      progressBar: { progress: '{{progressBarValue}}% Complete' }
    },
    login: {
      labels: {
        password: 'Password',
        signIn: 'Sign in',
        username: 'Username'
      },
      messages: {
        error: 'Username or password is incorrect.',
        offlineError: 'Cannot login while offline.  Please establish a network connection and retry login.',
        signIn: 'please sign in'
      }
    },
    medication: {
      alerts: {
        fulfilledTitle: 'Medication Request Fulfilled',
        returnedMessage: 'The medication has been marked as returned.',
        returnedTitle: 'Medication Returned',
        savedMessage: 'The medication record has been saved.',
        savedTitle: 'Medication Request Saved'
      },
      buttons: {
        dispenseMedication: 'dispense medication',
        newButton: '+ new request',
        returnMedication: 'return medication'
      },
      labels: {
        adjustmentDate: 'Adjustment Date',
        creditToAccount: 'Credit To Account',
        quantityDispensed: 'Quantity Dispensed',
        quantityDistributed: 'Quantity Distributed',
        quantityRequested: 'Quantity Requested',
        quantityToReturn: 'Quantity To Return',
        refills: 'Refills',
        returnAisle: 'Return Aisle',
        returnLocation: 'Return Location',
        returnReason: 'Return Reason/Notes'
      },
      messages: { createNew: 'Create a new medication request?' },
      pageTitle: 'Medication Requests',
      returnMedication: 'Return Medication',
      sectionTitle: 'Medication',
      titles: {
        completedMedication: 'Completed Medication',
        editMedicationRequest: 'Edit Medication Request',
        newMedicationRequest: 'New Medication Request'
      }
    },
    messages: {
      createNewRecord: 'Create a new record?',
      createNewUser: 'Create a new user?',
      'delete': 'Are you sure you wish to delete {{name}}?',
      delete_plural: 'Are you sure you wish to delete these {{name}}?',
      delete_singular: 'Are you sure you wish to delete this {{name}}?',
      forAuthorizedPersons: 'This report is for authorized persons only.',
      newPatientHasToBeCreated: 'A new patient needs to be created...Please wait..',
      noHistoryAvailable: 'No history available.',
      noItemsFound: 'No items found.',
      noNotesAvailable: 'No additional clinical notes are available for this visit.',
      noUsersFound: 'No users found.',
      onBehalfOf: 'on behalf of',
      reportError: 'An error was encountered while generating the requested report.  Please let your system administrator know that you have encountered an error.',
      requiredFieldsCorrectErrors: 'Please fill in required fields (marked with *) and correct the errors before saving.',
      saveActionException: 'An error occurred while attempting to save: {{message}}',
      sorry: 'Sorry, something went wrong...',
      userHasBeenSaved: 'The user has been saved.',
      userSaved: 'User Saved'
    },
    models: {
      appointment: {
        labels: {
          allDay: 'All Day',
          appointmentDate: 'Date',
          appointmentType: 'Type',
          endDate: 'End Date',
          location: 'Location',
          notes: 'Notes',
          patient: 'Patient',
          provider: 'With',
          startDate: 'Start Date',
          status: 'Status',
          type: 'Type'
        },
        names: {
          plural: 'appointments',
          singular: 'appointment'
        }
      },
      attachment: { names: {
          plural: 'attachments',
          singular: 'attachment'
        } },
      form: { names: {
          plural: 'forms',
          singular: 'form'
        } },
      imaging: {
        names: 'imaging',
        request: {
          plural: 'imaging requests',
          singular: 'imaging request'
        }
      },
      incident: { names: {
          plural: 'incidents',
          singular: 'incident'
        } },
      item: { names: {
          plural: 'items',
          singular: 'item'
        } },
      lab: {
        names: {
          plural: 'labs',
          singular: 'lab'
        },
        request: {
          plural: 'lab requests',
          singular: 'lab request'
        }
      },
      medication: {
        names: {
          plural: 'medications',
          singular: 'medication'
        },
        request: {
          plural: 'medication requests',
          singular: 'medication request'
        }
      },
      note: { names: {
          plural: 'notes',
          singular: 'note'
        } },
      patient: {
        labels: { name: 'Name' },
        names: { singular: 'Patient' }
      },
      procedure: { names: {
          plural: 'procedures',
          singular: 'procedure'
        } },
      user: { names: {
          plural: 'users',
          singular: 'user'
        } },
      visit: { names: {
          plural: 'visits',
          singular: 'visit'
        } },
      vital: { names: {
          plural: 'vitals',
          singular: 'vital'
        } }
    },
    navigation: {
      about: 'About HospitalRun',
      actions: {
        login: 'Login',
        logout: 'Logout'
      },
      administration: 'Administration',
      billing: 'Billing',
      imaging: 'Imaging',
      incident: 'Incident',
      inventory: 'Inventory',
      labs: 'Labs',
      medication: 'Medication',
      messages: {
        logoutFailed: 'Could not logout at this time.  Logout is not available while offline.'
      },
      patients: 'Patients',
      scheduling: 'Scheduling',
      subnav: {
        actions: 'Actions',
        addAppointment: 'Add Appointment',
        addressFields: 'Address Fields',
        admittedPatients: 'Admitted Patients',
        appointmentSearch: 'Appointment Search',
        appointmentsCalendar: 'Appointments Calendar',
        appointmentsThisWeek: 'Appointments This Week',
        cashier: 'Cashier',
        completed: 'Completed',
        currentIncidents: 'Current Incidents',
        customForms: 'Custom Forms',
        dispense: 'Dispense',
        history: 'History',
        incidentCategories: 'Incident Categories',
        inventoryReceived: 'Inventory Received',
        invoices: 'Invoices',
        items: 'Items',
        loadDB: 'Load DB',
        lookupLists: 'Lookup Lists',
        newIncident: 'New Incident',
        newInvoice: 'New Invoice',
        newPatient: 'New Patient',
        newRequest: 'New Request',
        newUser: 'New User',
        outpatient: 'Outpatient',
        patientListing: 'Patient Listing',
        priceProfiles: 'Price Profiles',
        prices: 'Prices',
        printHeader: 'Print Header',
        reports: 'Reports',
        requests: 'Requests',
        returnMedication: 'Return Medication',
        scheduleSurgery: 'Schedule Surgery',
        textReplacements: 'Shortcodes',
        theaterSchedule: 'Theater Schedule',
        "today'sAppointments": "Today's Appointments",
        userRoles: 'User Roles',
        users: 'Users',
        workflow: 'Workflow'
      },
      titles: {
        logoutFailed: 'Logout Failed'
      }
    },
    operationReport: {
      labels: {
        additionalNotes: 'Additional Notes',
        assistant: 'Assistant',
        caseComplexity: 'Case Complexity',
        operationDescription: 'Operation Description',
        preOpPrimaryDiagnosis: 'Pre-op Primary Diagnosis',
        preOpSecondaryDiagnosis: 'Pre-op Secondary Diagnosis',
        surgeon: 'Surgeon',
        surgeryDate: 'Surgery Date'
      },
      messages: { reportSaved: 'The operation report has been saved.' },
      titles: {
        editTitle: 'Edit Operation Report',
        newTitle: 'New Operation Report',
        reportSaved: 'Report Saved'
      }
    },
    operativePlan: {
      buttons: { completePlan: 'Complete Plan' },
      labels: {
        additionalNotes: 'Additional Notes',
        admissionInstructions: 'Instructions Upon Admission',
        caseComplexity: 'Case Complexity',
        completedStatus: 'Completed',
        droppedStatus: 'Dropped',
        operationDescription: 'Operation Description',
        plannedStatus: 'Planned',
        status: 'Status',
        surgeon: 'Surgeon'
      },
      messages: {
        planCompleted: 'The operative plan has been completed.  You will now be directed to the operation report.',
        planSaved: 'The operative plan has been saved.'
      },
      titles: {
        editTitle: 'Edit Operative Plan',
        newTitle: 'New Operative Plan',
        planCompleted: 'Plan Completed',
        planSaved: 'Plan Saved'
      }
    },
    patients: {
      buttons: {
        addContact: 'Add Contact',
        addExpense: 'Add Expense',
        addFamilyMember: 'Add Family Member',
        addOperativePlan: 'Add Operative Plan',
        backToPatients: 'Back to Patient List',
        download: 'Download',
        editOperativePlan: 'Current Operative Plan',
        newAppointment: 'New Appointment',
        newImaging: 'New Imaging',
        newLab: 'New Lab',
        newMedication: 'New Medication',
        newPatient: '+ new patient',
        newPhoto: 'New Photo',
        newVisit: 'New Visit',
        patientCheckIn: 'Patient Check In',
        scheduleSurgery: 'Schedule Surgery'
      },
      labels: {
        admissionDate: 'Admission Date',
        admit: 'Admit',
        bloodType: 'Blood Type',
        caption: 'Caption',
        civilStatus: 'Civil Status',
        clinic: 'Clinic Site',
        contacts: 'Contacts',
        cost: 'Cost',
        dateOfBirth: 'Date Of Birth',
        dateProcessed: 'Date Processed',
        dischargeDate: 'Discharge Date',
        dob: 'DOB',
        education: 'Education',
        email: 'Email',
        externalPatientId: 'External Patient Id',
        firstName: 'First Name',
        income: 'Income',
        insurance: 'Insurance',
        lastName: 'Last Name',
        middleName: 'Middle Name',
        monthlyCost: 'Monthly Cost',
        occupation: 'Occupation',
        operativePlan: 'Operative Plan',
        parent: 'Parent/Guardian',
        patientDays: 'Patient Days',
        patientType: 'Patient Type',
        patientTypeCharity: 'Charity',
        patientTypePrivate: 'Private',
        phone: 'Phone',
        placeOfBirth: 'Place Of Birth',
        primaryDiagnosis: 'Primary Diagnoses',
        referredBy: 'Referred By',
        referredDate: 'Referred Date',
        relationship: 'Relationship To Patient',
        relationships: 'Relationships',
        religion: 'Religion',
        secondaryDiagnosis: 'Secondary Diagnoses',
        sex: 'Sex',
        sexNotEntered: 'Sex Not Entered',
        sources: 'Sources',
        status: 'Patient Status',
        totalMontlyExpense: 'Total Monthly Expenses'
      },
      messages: {
        areYouSureDelete: 'Are you sure you want to delete this {{object}}?',
        createNewPatient: 'Create a new patient record?',
        deletingPatient: 'Deleting patient and all associated records',
        noPatientsFound: 'No patients found.',
        notFoundQuickAdd: 'The patient <strong>{{patientFullName}}</strong> could not be found.  If you would like to create a new patient, fill in the information below.  Otherwise press the Cancel button to return.',
        photoFileRequired: 'Please take a picture or upload a file before saving this photo.',
        savedPatient: 'The patient record for {{displayName}} has been saved.'
      },
      navigation: {
        appointments: 'Appointments',
        general: 'General',
        history: 'History',
        imaging: 'Imaging',
        labs: 'Labs',
        medication: 'Medication',
        photos: 'Photos',
        socialWork: 'Social Work',
        visits: 'Visits'
      },
      notes: {
        newNote: 'New Note for',
        onBehalfOfCopy: 'on behalf of',
        onBehalfOfLabel: 'On Behalf Of',
        pleaseSelectAVisit: 'Please select a visit',
        updateNote: 'Updating Note from'
      },
      titles: {
        addContact: 'Add Contact',
        addPhoto: 'Add Photo',
        additionalContacts: 'Additional Contacts',
        admissionsDetail: 'Admissions Detail',
        admissionsSummary: 'Admissions Summary',
        admittedPatients: 'Admitted Patients',
        'delete': 'Delete Patient',
        deleteContact: 'Delete Contact',
        deleteExpense: 'Delete Expense',
        deleteFamilyMember: 'Delete Family Member',
        deletePatientRecord: 'Delete Patient Record',
        deletePhoto: 'Delete Photo',
        diagnosticTesting: 'Diagnostic Testing',
        dischargesDetail: 'Discharges Detail',
        dischargesSummary: 'Discharges Summary',
        edit: 'Edit Patient',
        editPhoto: 'Edit Photo',
        expenses: 'Expenses',
        familyInfo: 'Family Info',
        familyInformation: 'Family Information',
        'new': 'New Patient',
        outpatientsForDate: 'Outpatients for {{visitDate}}',
        patient: 'Patient Report',
        patientListing: 'Patient Listing',
        patientReport: 'Patient Report',
        patientStatus: 'Patient Status',
        proceduresDetail: 'Procedures Detail',
        proceduresSummary: 'Procedures Summary',
        savedPatient: 'Patient Saved',
        socialWork: 'Expense',
        todaysOutpatients: "Today's Outpatients",
        totalPatientDays: 'Total Patient Days',
        totalPatientDaysDetailed: 'Total Patient Days (Detailed)',
        visit: 'Visit'
      }
    },
    pricing: {
      labels: {
        discountAmount: 'Discount Amount',
        discountPercentage: 'Discount Percentage',
        setFee: 'Set Fee'
      }
    },
    print: { invoice: {
        labels: {
          billedBy: 'Billed by:',
          billedDate: 'Bill Date:',
          dateAdmitted: 'ADMITTED:',
          dateDischarged: 'DISCHARGE:',
          dischargeNotes: 'Discharge Notes:',
          patientAddress: 'ADDRESS:',
          patientAge: 'AGE:',
          patientId: 'PATIENT #:',
          patientName: 'NAME OF PATIENT:',
          remarks: 'Remarks:',
          spacer: '__________________________________________'
        },
        messages: { whereConducted: 'were deducted during my confinement' },
        titles: {
          billingStatement: 'BILLING STATEMENT',
          patientMember: 'Patient-Member',
          patients: "PATIENT'S",
          relContact: 'Relationship/Contact no.'
        }
      } },
    procedures: {
      buttons: { addMedication: 'Add Medication' },
      labels: { medicationUsed: 'Medication Used' },
      messages: { saved: 'The procedure record has been saved.' },
      titles: {
        addChargeItem: 'Add Charge Item',
        addMedicationUsed: 'Add Medication Used',
        deleteChargeItem: 'Delete Charge Item',
        deleteMedicationUsed: 'Delete Medication Used',
        edit: 'Edit Procedure',
        editChargeItem: 'Edit Charge Item',
        editMedicationUsed: 'Edit Medication Used',
        medicationUsed: 'Medication Used',
        'new': 'New Procedure',
        saved: 'Procedure Saved'
      }
    },
    reports: {
      labels: {
        admissionDate: 'Admission Date',
        allProcedures: 'All Procedures Performed',
        completedBy: 'Completed By',
        dischargeDate: 'Discharge Date',
        examiner: 'Examiner',
        images: 'Images',
        labs: 'Labs',
        location: 'Visit Location',
        medications: 'Medications',
        nextAppointment: 'Next Appointment',
        nextAppointments: 'Next Appointments',
        notes: {
          author: 'Author',
          date: 'Date',
          title: 'Notes'
        },
        operativePlan: {
          description: 'Operation Description',
          instructions: 'Instructions upon Admission',
          procedures: 'Planned Procedures',
          title: 'Operative Plan'
        },
        primaryDiagnosis: 'Primary Diagnosis',
        procedures: 'Procedures',
        secondaryDiagnosis: 'Secondary Diagnosis',
        visitDate: 'Date of Visit',
        visitType: 'Visit Type'
      },
      messages: {
        'delete': 'Are you sure you wish to delete this report?',
        saved: 'The report has been saved.'
      },
      titles: {
        dischargeReport: 'Discharge Report',
        newDischargeReport: 'New Discharge Report',
        newOPDReport: 'New OPD Report',
        opdReport: 'OPD Report',
        saved: 'Report saved'
      }
    },
    user: {
      plusNewUser: '+ new user',
      usersPageTile: 'User Listing'
    },
    visits: {
      buttons: {
        addDiagnosis: 'Add Diagnosis',
        checkIn: 'Check In',
        checkOut: 'Check Out',
        discharge: 'Discharge',
        newAppointment: 'New Appointment',
        newDischargeReport: 'New Discharge Report',
        newOPDReport: 'New OPD Report',
        newProcedure: 'New Procedure',
        newVitals: 'New Vitals'
      },
      labels: {
        appointment: 'Appointment',
        authoredBy: 'Authored By',
        checkInTime: 'Check In',
        checkOutTime: 'Check Out',
        createNewPatient: 'Create New Patient',
        diagnosis: 'Diagnosis',
        examiner: 'Examiner',
        finalDiagnosis: 'Final/Billing Diagnosis',
        haveAppointment: 'Y',
        haveDoneOrders: 'Y',
        noAppointment: 'N',
        ordersDone: 'Orders Done',
        ordersNotDone: 'N',
        patientToCheckIn: 'Patient To Check In',
        procedure: 'Procedure',
        procedureDate: 'Procedure Date',
        reasonForVisit: 'Reason For Visit',
        reportType: 'Report type',
        status: 'Visit Status',
        statusAdmitted: 'Admitted',
        statusCheckedIn: 'Checked In',
        statusCheckedOut: 'Checked Out',
        statusDischarged: 'Discharged',
        visitDate: 'Visit Date',
        visitInformation: 'Visit Information',
        visitType: 'Visit Type'
      },
      messages: {
        checkOut: 'Are you sure you wish to check out {{patientName}}?',
        checkedOut: '{{patientName}} has been checked out.',
        discharged: '{{patientName}} has been discharged.',
        patientCheckedIn: '{{patientName}} has been checked in.',
        patientCreatedAndCheckedIn: '{{patientName}} has been created and checked in.',
        visitAndPatientSaved: 'The visit and patient records have been saved.',
        visitSaved: 'The visit record has been saved.'
      },
      navigation: {
        charges: 'Charges',
        notes: 'Notes',
        orders: 'Orders',
        procedures: 'Procedures',
        reports: 'Reports',
        vitals: 'Vitals'
      },
      titles: {
        additionalDiagnoses: 'Additional Diagnoses',
        checkOut: 'Patient Check Out',
        checkedIn: 'Patient Checked In',
        checkedOut: 'Patient Checked Out',
        discharged: 'Patient Discharged',
        editVisit: 'Edit Visit',
        newVisit: 'New Visit',
        patientCheckIn: 'Patient Check In',
        visitSaved: 'Visit Saved'
      }
    },
    vitals: {
      labels: {
        dateRecorded: 'Date Recorded',
        dbp: 'DBP',
        heartRate: 'Heart Rate',
        height: 'Height',
        respiratoryRate: 'Respiratory Rate',
        sbp: 'SBP',
        temperature: 'Temperature',
        weight: 'Weight'
      }
    }
  };
});
define('hospitalrun/locales/es-CO/translations', ['exports'], function (exports) {
  exports['default'] = {
    admin: {
      address: {
        address1Label: 'Texto direccion 1',
        address2Label: 'Texto direccion 2',
        address3Label: 'Texto direccion 3',
        address4Label: 'Texto direccion 4',
        addressLabel: 'Direcciones',
        editTitle: 'Opciones de dirección',
        include1Label: 'Incluir 1',
        include2Label: 'Incluir 2',
        include3Label: 'Incluir 3',
        include4Label: 'Incluir 4',
        messages: { addressSaved: 'las opciones de dirección han sido guardadas' },
        newTitle: 'Opciones de dirección',
        titles: { optionsSaved: 'Opciones guardadas' }
      },
      addressOptions: 'Opciones de direcciones',
      customForms: {
        buttons: {
          addField: '',
          moveDown: '',
          moveUp: '',
          newForm: '',
          preview: ''
        },
        labels: {
          alwaysInclude: '',
          checkbox: '',
          colSpan: '',
          columns: '',
          customForm: '',
          dischargeReportFormType: '',
          formName: '',
          formType: '',
          incidentFormType: '',
          includeOtherOption: '',
          labFormType: '',
          label: '',
          newForm: '',
          opdReportFormType: '',
          operativePlanFormType: '',
          otherOptionLabel: '',
          patientFormType: '',
          property: '',
          radio: '',
          select: '',
          socialworkFormType: '',
          text: '',
          textarea: '',
          visitFormType: ''
        },
        messages: { formSaved: '' },
        titles: {
          checkboxValues: '',
          customForms: '',
          deleteForm: '',
          dropDownValues: '',
          editCustomForm: '',
          fields: '',
          formSaved: '',
          newCustomForm: '',
          radioValues: ''
        }
      },
      header: {
        editTitle: '',
        facilityName: '',
        headerLabel: '',
        headerLine1: '',
        headerLine2: '',
        headerLine3: '',
        logoURL: '',
        messages: { headerSaved: '' },
        newTitle: '',
        titles: { optionsSaved: '' }
      },
      loadDb: 'Cargar Base de datos',
      loaddb: {
        displayAlertMessage: 'Por favor seleccione un archivo para ser cargado.',
        displayAlertTitle: 'Seleccione un archivo para cargar',
        editTitle: 'Cargar bd',
        errorDisplayAlertMessage: 'La base de datos no fue cargada el error fue: {{error}}',
        errorDisplayAlertTitle: 'Error cargando',
        progressMessage: 'Por favor espere mientras la base de datos es cargada.',
        progressTitle: 'Cargando ase de datos'
      },
      lookup: {
        aisleLocationList: 'Ubicacion de inventario de pasillo',
        alertImportListMessage: 'Por favor seleccione un archivo para importar.',
        alertImportListSaveMessage: 'Lista de busqueda importada.',
        alertImportListSaveTitle: 'Lista importada',
        alertImportListTitle: 'Seleccione un archivo para importar',
        alertImportListUpdateMessage: 'La lista de busqueda ha sido salvada.',
        alertImportListUpdateTitle: 'Lista salvada',
        anesthesiaTypes: 'Tipos de anestesia',
        anesthesiologists: 'Anestesiologo',
        billingCategories: 'Categorias de facturacion',
        clinicList: 'Ubicacion de las clinicas',
        countryList: 'Paises',
        cptCodeList: 'Codigos CPT',
        diagnosisList: 'Diagnosticos',
        edit: { template: {
            addTitle: 'Adicionar valor',
            editTitle: 'Editar valor',
            labelTitle: 'Valor',
            updateButtonTextAdd: 'Adicionar',
            updateButtonTextUpdate: 'Actualizar'
          } },
        expenseAccountList: 'Cuentas de gastos',
        imagingPricingTypes: 'Tipos de precios de radiografias',
        incidentDepartments: '',
        inventoryTypes: 'Tipos de inventarios',
        labPricingTypes: 'Precios de laboratorio',
        pageTitle: 'Listas de busqueda',
        patientStatusList: 'Lista de estado de pacientes',
        physicianList: 'Medicos',
        procedureList: 'Procedimientos',
        procedureLocations: 'Ubicacion de los procedimientos',
        procedurePricingTypes: 'Tipos de procedimientos y precios',
        radiologists: 'Radiologo',
        titles: { deleteLookupValue: '' },
        unitTypes: 'Tipos de unidad',
        vendorList: 'Proveedor',
        visitLocationList: 'Lugares de visista',
        visitTypes: 'Tipos de visita',
        wardPricingTypes: 'Tipos de las tarifas',
        warehouseList: 'Ubicacciones de inventarios'
      },
      lookupLists: 'Lista de busqueda',
      roles: {
        capability: {
          addAllergy: '',
          addAppointment: 'Adicionar cita',
          addBillingDiagnosis: '',
          addCharge: 'Adicionar cargo (valor)',
          addDiagnosis: 'Adicionar diagnostico',
          addImaging: 'Adicionar radiografia',
          addIncident: '',
          addIncidentCategory: '',
          addInventoryItem: 'Adicionar elemento al inventario',
          addInventoryPurchase: 'Adicionar compra',
          addInventoryRequest: 'Pedido de inventario',
          addInvoice: 'Adicionar factura',
          addLab: 'Adicionar laboratorio',
          addMedication: 'Adicionar medicación',
          addNote: '',
          addOperationReport: '',
          addOperativePlan: '',
          addPatient: 'Adicionar paciente',
          addPayment: 'Adicionar pago',
          addPhoto: 'Adicionar foto',
          addPricing: 'Adicionar precio',
          addPricingProfile: 'Adicionar perfil de precios',
          addProcedure: '',
          addSocialwork: '',
          addVisit: 'Adicionar visita',
          addVitals: 'Adicionar partes vitales',
          adjustInventoryLocation: 'Ajustar lugar elemento en el inventario',
          admin: 'Administracion',
          admitPatient: 'Admitir paciente',
          appointments: 'Citas',
          billing: 'Facturacion',
          completeImaging: 'Completar radiografia',
          completeLab: 'Completar laboratorio',
          defineUserRoles: 'Roles de usuario',
          deleteAppointment: 'Eliminar cita',
          deleteDiagnosis: 'Eliminar diagnostico',
          deleteImaging: 'Eliminar radiografia',
          deleteIncident: '',
          deleteIncidentCategory: '',
          deleteInventoryItem: 'Eliminar elemento del inventario',
          deleteInvoice: 'Eliminar factura',
          deleteLab: 'Eliminar laboratorio',
          deleteMedication: 'Eliminar medicación',
          deleteNote: '',
          deletePatient: 'Eliminar paciente',
          deletePhoto: 'Eliminar foto',
          deletePricing: 'Eliminar precio',
          deletePricingProfile: 'Eliminar perfil de precio',
          deleteProcedure: 'Eliminar procedimiento',
          deleteSocialwork: 'Eliminar trabajo social',
          deleteVisit: 'Eliminar visita',
          deleteVitals: 'Eliminar organo vital',
          dischargePatient: 'Descartar paciente',
          editInvoice: 'Editar factura',
          fulfillInventory: 'Cumplimiento de inventario',
          fulfillMedication: 'Cumplir la medicación',
          generateIncidentReport: '',
          imaging: 'Radiografia',
          incident: '',
          inventory: 'Inventario',
          invoices: 'Facturas',
          labs: 'Laboratorios',
          loadDb: 'Cargar base de datos',
          manageIncidents: '',
          medication: 'Medicación',
          overrideInvoice: 'Sobreescribir factura',
          patientReports: 'Reportes por paciente',
          patients: 'Pacientes',
          pricing: 'Precio',
          updateConfig: 'Actualizar configuracion',
          visits: 'Visitas'
        },
        messages: { roleSaved: 'El {{roleName}} rol ha sido salvado.' },
        titles: { roleSaved: 'Role salvado' }
      },
      userRoles: 'Roles',
      users: 'Usuarios',
      visitForms: {
        labels: {
          followup: '',
          form: '',
          initial: '',
          visitType: ''
        },
        titles: { visitForms: '' }
      },
      workflow: {
        admissionDepositLabel: '',
        clinicPrepaymentLabel: '',
        editTitle: '',
        followupPrepaymentLabel: '',
        messages: { optionsSaved: '' },
        newTitle: '',
        outpatientImagingLabel: '',
        outpatientLabLabel: '',
        outpatientMedicationLabel: '',
        titles: { optionsSaved: '' },
        workflowLabel: ''
      }
    },
    alerts: {
      errorExclamation: '',
      pleaseWait: 'Por favor espere',
      reportError: '',
      warningExclamation: ''
    },
    allergies: {
      buttons: { addAllergy: '' },
      labels: {
        allergyName: '',
        patientAllergy: ''
      },
      titles: {
        addAllergy: '',
        editAllergy: ''
      }
    },
    application: {
      messages: { sessionExpired: '' },
      titles: { sessionExpired: '' }
    },
    appointments: {
      buttons: {
        newButton: '+ nueva cita',
        scheduleSurgery: ''
      },
      calendarTitle: '',
      currentScreenTitle: 'Listado de citas',
      editTitle: 'Editar cita',
      labels: {
        noLocation: '',
        selectedStartingDate: ''
      },
      messages: {
        appointmentSaved: '',
        endTimeLaterThanStart: 'Seleccione una hora de finalizacion despues de la de inicio.'
      },
      missed: 'Citas perdidas',
      newTitle: 'Nueva cita',
      searchTitle: 'Buscar citas',
      sectionTitle: 'Citas',
      thisWeek: 'Citas esta semana',
      titles: {
        appointmentSaved: '',
        editSurgicalAppointment: '',
        newSurgicalAppointment: '',
        theaterSchedule: ''
      },
      todayTitle: 'Citas para hoy'
    },
    billing: {
      alerts: {
        noInvoiceFound: '',
        noPricingItems: '',
        noPricingProfiles: ''
      },
      buttons: {
        addOverride: '',
        createInvoice: ''
      },
      labels: {
        actualCharges: '',
        discountAmount: '',
        discountPercentage: '',
        externalInvoiceNumber: '',
        hmoCom: '',
        insurance: '',
        paymentProfile: '',
        paymentsDeposits: '',
        pricingPanelOverrides: '',
        pricingProfile: ''
      }
    },
    buttons: {
      add: 'Adicionar',
      addItem: '',
      addLineItem: '',
      addValue: 'Adicionar valor',
      addVisit: 'Adicionar visita',
      allRequests: 'Todas las solicitudes',
      barcode: 'Codigo de barras',
      cancel: 'Cancelar',
      clear: '',
      close: 'Cerrar',
      complete: 'Completado',
      'delete': 'Eliminar',
      dispense: 'Repartir',
      edit: '',
      filter: '',
      fulfill: 'Cumplimiento',
      'import': 'Importar',
      loadFile: 'Cargar archivo',
      newItem: '+ nuevo elemento',
      newNote: 'Nueva nota',
      newRequest: 'Nueva solicitud',
      newRequestPlus: '+ nuevo pedido',
      newUser: 'Nuevo usuario',
      ok: 'Ok',
      remove: 'Remover',
      returnButton: 'Regresar',
      search: 'Buscar',
      showAll: '',
      showFewer: '',
      update: 'Actualizar'
    },
    components: {
      chargesByTypeTab: { charges: '' },
      customFormManager: { buttons: { addForm: '' } },
      dateTimePicker: {
        amHour: '',
        midnight: '',
        noon: '',
        pmHour: ''
      },
      imageUpload: { messages: { selectValidImageFile: '' } },
      operativeProcedures: {
        buttons: { addProcedure: '' },
        labels: { procedure: '' },
        titles: { procedures: '' }
      },
      patientOrders: {
        buttons: {
          newImaging: '',
          newLab: '',
          newMedication: ''
        },
        labels: {
          imagingOrderType: '',
          labOrderType: '',
          medicationOrderType: '',
          orderType: ''
        }
      },
      priceList: { charges: '' },
      quantityCalc: { result: '' },
      quantityConv: {
        conversion: '',
        unit: ''
      },
      sortableColumn: { labels: { selectAll: '' } },
      takePhoto: {
        camera: '',
        how: '',
        labels: {
          takeAPicture: '',
          uploadAFile: ''
        },
        photo: '',
        preview: '',
        takePhoto: '',
        uploadFile: ''
      },
      upcomingAppointments: {
        labels: {
          date: '',
          location: '',
          type: '',
          'with': ''
        },
        titles: { upcomingAppointments: '' }
      }
    },
    customForms: {
      buttons: { addForm: '' },
      labels: { formToAdd: '' },
      titles: { addCustomForm: '' }
    },
    dashboard: {
      setup: '',
      title: 'Que deseas hacer?'
    },
    dates: {
      'long': '',
      longOmitDays: '',
      longOmitDaysPlural: '',
      longOmitDaysYears: '',
      longOmitYears: '',
      longPlural: '',
      'short': '',
      shortOmitYears: ''
    },
    diagnosis: {
      labels: {
        activeDiagnosis: '',
        date: '',
        diagnosis: '',
        secondaryDiagnosis: ''
      },
      titles: {
        addDiagnosis: '',
        editDiagnosis: ''
      }
    },
    errors: {
      accepted: '',
      blank: '',
      confirmation: '',
      empty: '',
      equalTo: '',
      even: '',
      exclusion: '',
      greaterThan: '',
      greaterThanOrEqualTo: '',
      inclusion: '',
      invalid: '',
      invalidNumber: '',
      lessThan: '',
      lessThanOrEqualTo: '',
      notANumber: '',
      notAnInteger: '',
      odd: '',
      otherThan: '',
      present: '',
      result: '',
      tooLong: '',
      tooShort: '',
      wrongLength: ''
    },
    headings: { chargedItems: '' },
    imaging: {
      alerts: {
        completedMessage: 'El pedido de radiografia ha sido completado.',
        completedTitle: 'Pedido de radiografia completado',
        savedMessage: 'El pedido de radiografia ha sido guardado.',
        savedTitle: 'Pedido de radiografia salvado'
      },
      buttons: { newButton: '+ new radiografia' },
      labels: {
        addNewVisit: '--Adicionar nueva visita--',
        radiologist: 'Radiologo'
      },
      messages: { noCompleted: 'No de items encontrados.' },
      pageTitle: 'Pedido de radriografia',
      sectionTitle: 'Radiografias',
      titles: {
        completedImaging: 'Radiografia completada',
        editTitle: 'Pedido de edicion de radiografia',
        newTitle: 'Nuevo pedido de radiografia'
      }
    },
    incident: {
      buttons: {
        add: '',
        addForm: '',
        addItem: '',
        cancel: '',
        'delete': '',
        download: '',
        edit: '',
        'export': '',
        generateRep: '',
        newAttachment: '',
        newCategory: '',
        newIncident: '',
        newNote: ''
      },
      labels: {
        actions: '',
        addedBy: '',
        category: '',
        categoryItem: '',
        date: '',
        dateRecorded: '',
        department: '',
        description: '',
        endDate: '',
        givenBy: '',
        howToAddAttachment: '',
        incidentDate: '',
        incidentId: '',
        item: '',
        lastUpdated: '',
        note: '',
        patientId: '',
        patientImpacted: '',
        reportType: '',
        reportedBy: '',
        reportedDate: '',
        reportedTo: '',
        sentinelEvent: '',
        startDate: '',
        status: '',
        statusActive: '',
        statusClosed: '',
        statusFollowup: '',
        statusReported: '',
        title: '',
        total: '',
        updatedBy: ''
      },
      messages: {
        attachmentFileRequired: '',
        createNew: '',
        createNewIncidentCategory: '',
        fillIn: '',
        incidentCategorySaved: '',
        noClosedIncidents: '',
        noIncidentCategoriesFound: '',
        noIncidents: '',
        saved: '',
        selectExistingPatient: ''
      },
      titles: {
        addAttachment: '',
        addCategoryItem: '',
        addNote: '',
        attachments: '',
        closed: '',
        current: '',
        deleteAttachment: '',
        deleteIncident: '',
        deleteIncidentCategory: '',
        deleteItem: '',
        deleteNote: '',
        editAttachment: '',
        editIncident: '',
        editIncidentCategory: '',
        editNote: '',
        general: '',
        history: '',
        incidentCategories: '',
        incidentCategoryItem: '',
        incidentCategoryName: '',
        incidentCategorySaved: '',
        incidentSaved: '',
        incidents: '',
        incidentsByCategory: '',
        incidentsByDepartment: '',
        newIncident: '',
        newIncidentCategory: '',
        notes: '',
        reports: ''
      }
    },
    inventory: {
      edit: {
        cost: 'Costo por unidad:',
        delivered: 'Enviado A:',
        location: 'Cambio de ubicación:',
        prescription: 'Recetado por:',
        pulled: 'Pulled From:',
        quantity: 'Quantity at Completion:',
        reason: 'Razón:',
        returned: 'Regresado al paciente:',
        transferredFrom: 'Transferido a:',
        transferredTo: 'Transferido a:'
      },
      labels: {
        action: 'Acción',
        add: 'Adicionar',
        addAdjustmentType: '',
        adjust: 'Adjustar',
        adjustmentDate: 'Fecha de ajuste',
        adjustmentFor: 'Ajustado para',
        adjustmentType: 'Tipo de ajuste',
        aisle: 'Pasillo',
        aisleLocation: 'Ubicación pasillo',
        allInventory: 'Todo el inventario',
        allItems: '',
        availableQuantity: '',
        billTo: 'Facturao a',
        consumePurchases: 'Consume Purchases',
        consumptionRate: 'Tasa de consumo',
        cost: 'Costo',
        costPerUnit: 'Costo por Unidad',
        crossReference: 'Referencia cruzada',
        currentQuantity: 'Cantidad actual',
        dateCompleted: 'Fecha completado',
        dateEffective: 'Gecha efectiva',
        dateEnd: 'Fecha final',
        dateReceived: 'Fecha recibido',
        dateStart: 'Fecha inicial',
        dateTransferred: 'Fecha transferencia',
        daysLeft: 'Dias restantes',
        deleteItem: 'Eliminar elemento',
        deliveryAisle: 'Enviado a pasillo',
        deliveryLocation: 'Ubicación del envio',
        details: 'Detalles',
        distributionUnit: 'Unidad de distribución',
        editItem: 'Editar elemento',
        expense: 'Gastos a',
        expirationDate: 'Fecha de vencimiento',
        fulfillRequest: 'Pedido de cumplimiento',
        fulfillRequestNow: 'Pedido de incumplimiento para hoy',
        gift: 'Regalo en especie',
        giftInKindNo: 'N',
        giftInKindYes: 'Y',
        giftUsage: 'Uso del regalo en especie',
        inventoryConsumed: 'Inventario consumido',
        inventoryItem: 'Elemento del inventario',
        inventoryObsolence: 'Obsolescencia de inventario',
        invoiceItems: 'Articulos de factura',
        invoiceLineItem: 'Elemento de la factura linea',
        invoiceNumber: 'Factura numero',
        item: 'Elemento',
        itemNumber: 'Numero de elemento',
        items: 'Elementos',
        location: 'Ubicación',
        locations: 'Ubicaciones',
        markAsConsumed: 'Marcar como consumido',
        name: 'Nombre',
        newItem: 'Nuevo elemento',
        originalQuantity: 'Cantidad original',
        print: 'Imprimir',
        printBarcode: 'Imprimir codigo de  barras',
        printer: 'Impresora',
        pullFrom: 'Traido de',
        purchaseCost: 'Costo de compra',
        purchaseInfo: 'Informacion de la compra',
        purchases: 'Compras',
        quantity: 'Cantidad ({{unit}})',
        quantityAvailable: 'Cantidad disponible',
        quantityOnHand: 'Cantidad a la mano',
        quantityRequested: 'Cantidad pedida',
        rank: 'Ranking',
        reason: 'Razón',
        remove: 'Remover',
        removeAdjustmentType: '',
        reorderPoint: 'Reordenar punto',
        requestedItems: 'Elementos solicitados',
        returnAdjustmentType: '',
        returnToVendorAdjustmentType: '',
        salePricePerUnit: 'Costo de venta por unidad',
        save: 'Guardar',
        serialNumber: 'Serial/Numero de lote',
        total: 'Total',
        totalCost: 'Costo total',
        totalReceived: 'Total Recivido: {{total}}',
        transaction: 'Transaccion',
        transactions: 'Transacciones',
        transfer: 'Translados',
        transferFrom: 'Translado desde',
        transferTo: 'Translado a ubicación',
        transferToAisle: 'Translado a pasillo',
        unit: 'Unidad',
        unitCost: 'Unidad Costo',
        vendor: 'Proveedor',
        vendorItemNumber: 'Proveedor numero de elemento',
        writeOffAdjustmentType: '',
        xref: 'XRef'
      },
      messages: {
        adjust: 'Por favor ajust las cantidades en la ubicación adecuada(s) la diferencia de la cuenta es {{difference}}.',
        createRequest: 'Crear un nuevo pedido?',
        itemNotFound: 'El elemento del inventario <strong>{{item}}</strong> no se pudo encontrar.<br>Si desea crear un nuevo elemento, Ingrese la información abajo.<br>De lo contrario opria cancelar para volver.',
        loading: 'Cargando transacciones ...',
        noItems: 'No se encontraron elementos.',
        noRequests: 'No se encontraron pedidos.',
        purchaseSaved: 'La compra de inventario ha sido salvada.',
        quantity: 'La cantidad total <strong>({{quantity}})</strong> no encaja con la cantidad total en las ubicaciones <strong>({{locationQuantity}})</strong>.',
        removeItem: 'Esta seguro de eliminar este elemento de la factura?',
        removeItemRequest: 'Seguro que quiere eliminar este elemento del pedido?',
        requestFulfilled: 'El pedido de inventario ha sido procesado.',
        requestUpdated: 'El pedido de inventario ha sido actualizado.',
        warning: 'Valide los campos requeridos (marcados con *) corrija los errores antes de adicionar.'
      },
      reports: {
        adjustment: 'Ajuste detallado',
        daysSupply: 'Dias de inventario restante',
        expenseDetail: 'Gastos detallados',
        expenseSum: 'Resumen de gastos',
        expiration: 'Fecha de expiracion',
        'export': 'Exportar reporte',
        fields: 'Campos a incluir',
        finance: 'Resumen de finanzas',
        generate: 'Generar reporte',
        invLocation: 'Inventario por ubicacion',
        invValuation: 'Inventario por valoracion',
        purchaseDetail: 'Compras detalladas',
        purchaseSum: 'Resumen de compras',
        reportType: 'Tipo de reporte',
        rows: {
          adjustments: 'Ajustes',
          adjustmentsTotal: 'Ajustes totales',
          balanceBegin: 'Balance inicial',
          balanceEnd: 'Balance Final',
          category: 'Categoria',
          consumed: 'Consumado',
          consumedGik: 'GiK Consumido',
          consumedGikTotal: 'Total GiK Consumido',
          consumedPuchases: 'Total de lo comprado consumido',
          consumedPurchasesTotal: 'Total de lo comprado consumido',
          consumedTotal: 'Total consumido',
          errInFinSum: 'Error en _generateFinancialSummaryReport: ',
          errInFindPur: 'Error en _findInventoryItemsByPurchase: ',
          errInFindReq: 'Error en _findInventoryItemsByRequest: ',
          expensesFor: 'Gatos para: ',
          noAccount: '(No Cuenta)',
          subtotal: 'Subtotal: ',
          subtotalFor: 'Subtotal para {{category}} - {{account}}: ',
          total: 'Total: ',
          totalFor: 'Total para {{var}}: ',
          totalPurchases: 'Compras Totales',
          transfer1: '{{quantity}} de {{location}}',
          trasnfer2: 'De: {{source}} A: {{target}}'
        },
        stockTransferDetail: 'Detalle de traslado de stock',
        stockTransferSum: 'Resumen traslado de stock',
        stockUsageDetail: 'Detalle de uso de stock',
        stockUsageSum: 'Resumen uso de stock',
        titleDateRange: '',
        titleSingleDate: ''
      },
      titles: {
        addPurchase: 'Adicionar compra',
        addRequest: 'Nuevo pedido',
        adjustment: 'Ajuste',
        editPurchase: 'Editar compra',
        editRequest: 'Editar pedido',
        inventoryItem: 'Nuevo elemento de inventario',
        inventoryReport: 'Reporte de inventario',
        purchaseSaved: 'Compras de inventario guardadas',
        quickAddTitle: 'Nuevo elemento de inventario',
        removeItem: 'Remover elemento',
        requestFulfilled: 'Pedido cumplido',
        requestUpdated: 'Pedido actualizado',
        transfer: 'Trasladar elementos',
        warning: 'Peligro!!!!!'
      }
    },
    labels: {
      action: 'Accion',
      actions: 'Acciones',
      addNewOutpatientVisit: '--Nueva visita a paciente externo--',
      address: '',
      age: 'Edad',
      allDay: 'Todo el dia',
      amount: '',
      anesthesia: 'Anestesia',
      assisting: 'Asistencia',
      balanceDue: '',
      billDate: '',
      billTo: 'Facturar a',
      category: '',
      completed: 'Completado',
      country: '',
      cptcode: 'Codigo CPT',
      creditTo: '',
      date: 'Fecha',
      dateCompleted: 'Fecha completada',
      dateOfBirth: 'Fecha de nacimiento',
      dateOfBirthShort: 'FDN',
      datePaid: '',
      dateRequested: 'Fecha de pedido',
      'delete': 'Eliminar',
      deleteRequest: 'Eliminar pedido',
      deleteUser: 'Eliminar usuario',
      department: '',
      description: 'Descripción',
      discount: '',
      displayName: 'Nombre para mostrar',
      docRead: 'Leer documento',
      docWritten: 'Documento escrito',
      edit: 'Editar',
      editUser: 'Editar usuario',
      email: 'Email',
      endDate: 'Fecha final',
      endTime: 'Hora de finalización',
      excess: '',
      expenseTo: '',
      fileLoadSuccessful: 'Archivo cargado exitosamente',
      fileName: '',
      fileToLoad: 'Archivo cargado',
      fulfill: 'Cumplomiento',
      fulfillRequest: 'Pedido de cumplimiento',
      fulfillRequestNow: 'Pedido de cumplimiento ahora',
      fulfilled: 'Cumplido',
      grandTotal: '',
      id: 'Id',
      imageOrders: 'Ordenes de radiografias',
      imagingType: 'Tipo de radiografia',
      importFile: 'Importar archivo',
      invoiceId: '',
      labOrders: 'Ordenes de laboratorio',
      lineItems: '',
      loading: 'Cargando',
      location: 'Ubicacion',
      lookupType: 'Tipo de busqueda',
      medication: 'Medicación',
      name: 'Nombre',
      newUser: 'Nuevo usuario',
      note: '',
      notes: 'Notas',
      number: '',
      on: 'on',
      password: 'Contraseña',
      patient: 'Paciente',
      payments: '',
      physician: 'Médico',
      prescriber: '',
      prescription: 'Receta medica',
      prescriptionDate: 'Fecha de la receta medica',
      price: '',
      print: '',
      procedures: 'Procedimiento',
      provider: 'Proveedor',
      pullFrom: 'Traer de',
      quantity: 'Cantidada',
      remarks: '',
      requestedBy: 'Pedido por|',
      requestedOn: 'Pedido On',
      requests: 'Pedido',
      result: 'Resultado',
      results: 'Resultados',
      role: 'Rol',
      search: '',
      sex: 'Genero',
      startDate: 'Fecha de inicio',
      startTime: 'Hora de inicio',
      status: 'Estado',
      takenBy: '',
      total: '',
      type: 'Tipo',
      userCanAddNewValue: 'Los usuarios pueden agregar nuevos valores',
      username: 'Nombre de usuario',
      value: 'Valor',
      view: '',
      visit: 'Visita',
      'with': 'con'
    },
    labs: {
      alerts: {
        requestCompletedMessage: 'El pedido de laboratorio ha sido completado.',
        requestCompletedTitle: 'Pedido de laboratorio competado',
        requestSavedMessage: 'El pedido de laboratorio ha sido guardado.',
        requestSavedTitle: 'Silicitud de laboratorio guardado'
      },
      buttons: { newButton: '+ nuevo laboratorio' },
      completedTitle: 'Completar laboratorio',
      deleteTitle: 'Eliminar pedido',
      editTitle: 'Editar pedido de laboratorio',
      labels: {
        addNewVisit: '--Adicionar nueva visita--',
        labType: 'Tipo de laboratorio'
      },
      messages: {
        createNewRecord: 'Crear un registro?',
        noCompleted: 'No elementos completados encontrados.',
        noItemsFound: 'No boratorios encontrados.'
      },
      newTitle: 'Nuevo pedido de laboratorio',
      requestsTitle: 'Pedido de laboratorio',
      sectionTitle: 'Laboratorios'
    },
    loading: {
      messages: {
        '0': '',
        '1': '',
        '2': '',
        '3': '',
        '4': '',
        '5': '',
        '6': '',
        '7': '',
        '8': '',
        '9': '',
        '10': '',
        '11': ''
      },
      progressBar: { progress: '' }
    },
    login: {
      labels: {
        password: 'Clave',
        signIn: 'Ingresar',
        username: 'Nombre de usuario'
      },
      messages: {
        error: 'Nombre de usuario o clave incorrectos.',
        signIn: 'por favor ingrese'
      }
    },
    medication: {
      alerts: {
        fulfilledTitle: 'Pedido de medicación cumplido',
        returnedMessage: 'La medicacion ha sido marcada para devolver.',
        returnedTitle: 'Medicacion devuelta',
        savedMessage: 'La elemento de medicación ha sido guardado.',
        savedTitle: 'Pedido de medicacion guardado'
      },
      buttons: {
        dispenseMedication: 'dispensar medicación',
        newButton: '+ nuevo pedido',
        returnMedication: 'debolver medicacion'
      },
      labels: {
        adjustmentDate: 'Fecha de ajuste',
        creditToAccount: 'Credito a cuenta',
        quantityDispensed: 'Cantidad dispensada',
        quantityDistributed: 'Cantidad distribuida',
        quantityRequested: 'Cantidad solicitada',
        quantityToReturn: 'Cantidad a devolver',
        refills: 'Recargas',
        returnAisle: 'Devolve a pasillo',
        returnLocation: 'Retornar a ubicación',
        returnReason: 'Razon por la que se devuelve/Nota'
      },
      messages: { createNew: 'Crear un nuevo pedido de medicacion?' },
      pageTitle: 'Pedido de medicación',
      returnMedication: 'Retorno de medicación',
      sectionTitle: 'Medication',
      titles: {
        completedMedication: 'Medicacion completada',
        editMedicationRequest: 'Editar pedido de medicacion',
        newMedicationRequest: 'Nuevo pedido de medicacion'
      }
    },
    messages: {
      createNewRecord: 'Crear un nuevo registro?',
      createNewUser: 'Crear un nuevo usuario?',
      'delete': '',
      delete_plural: '',
      delete_singular: '',
      forAuthorizedPersons: 'Este informe es sólo para personas autorizadas.',
      newPatientHasToBeCreated: 'Un nuevo paciente debe ser creado...Por favor espere..',
      noHistoryAvailable: 'Historia no disponible.',
      noItemsFound: 'Elementos no encontrados.',
      noNotesAvailable: 'No hay notas clínicas adicionales están disponibles para esta visita.',
      noUsersFound: 'Ningun usuario encontrado.',
      onBehalfOf: 'a nombre de',
      reportError: '',
      requiredFieldsCorrectErrors: '',
      saveActionException: '',
      sorry: 'Lo sentimos, un error ha ocurrido...',
      userHasBeenSaved: 'El usuario ha sido salvado.',
      userSaved: 'Usuario salvado'
    },
    models: {
      appointment: {
        labels: {
          allDay: '',
          appointmentDate: '',
          appointmentType: '',
          endDate: '',
          location: '',
          notes: '',
          patient: '',
          provider: '',
          startDate: '',
          status: '',
          type: ''
        },
        names: {
          plural: '',
          singular: ''
        }
      },
      attachment: { names: {
          plural: '',
          singular: ''
        } },
      form: { names: {
          plural: '',
          singular: ''
        } },
      imaging: {
        names: '',
        request: {
          plural: '',
          singular: ''
        }
      },
      incident: { names: {
          plural: '',
          singular: ''
        } },
      item: { names: {
          plural: '',
          singular: ''
        } },
      lab: {
        names: {
          plural: '',
          singular: ''
        },
        request: {
          plural: '',
          singular: ''
        }
      },
      medication: {
        names: {
          plural: '',
          singular: ''
        },
        request: {
          plural: '',
          singular: ''
        }
      },
      note: { names: {
          plural: '',
          singular: ''
        } },
      patient: {
        labels: { name: '' },
        names: { singular: '' }
      },
      procedure: { names: {
          plural: '',
          singular: ''
        } },
      user: { names: {
          plural: '',
          singular: ''
        } },
      visit: { names: {
          plural: '',
          singular: ''
        } },
      vital: { names: {
          plural: '',
          singular: ''
        } }
    },
    navigation: {
      about: 'Información de HospitalRun',
      actions: {
        login: 'Ingresar',
        logout: 'Salir'
      },
      administration: 'Administracion',
      billing: 'Facturas',
      imaging: 'Radiografia',
      incident: '',
      inventory: 'Inventario',
      labs: 'Laboratorio',
      medication: 'Recetas medicas',
      patients: 'Pacientes',
      scheduling: '',
      subnav: {
        actions: '',
        addAppointment: 'Nueva cita',
        addressFields: 'Campos de dirección',
        admittedPatients: '',
        appointmentSearch: '',
        appointmentsCalendar: '',
        appointmentsThisWeek: '',
        completed: 'Completado',
        currentIncidents: '',
        customForms: '',
        dispense: 'Dispense',
        history: '',
        incidentCategories: '',
        inventoryReceived: 'Inventario recibido',
        invoices: 'Facturas',
        items: 'Items',
        loadDB: '',
        lookupLists: 'Lista de busuedas',
        missedAppointments: '',
        newIncident: '',
        newInvoice: 'Nueva factura',
        newPatient: 'Nuevo paciente',
        newRequest: 'New pedido',
        newUser: 'Nuevo usuario',
        outpatient: '',
        patientListing: 'Lista de pacientes',
        priceProfiles: 'Perfil de precios',
        prices: 'Precios',
        printHeader: '',
        reports: 'Reportes',
        requests: 'Pedidos',
        returnMedication: 'Devolver medicamento',
        scheduleSurgery: '',
        theaterSchedule: '',
        "today'sAppointments": '',
        userRoles: 'Roles',
        users: 'Usuarios',
        workflow: ''
      }
    },
    operationReport: {
      labels: {
        additionalNotes: '',
        assistant: '',
        caseComplexity: '',
        operationDescription: '',
        preOpPrimaryDiagnosis: '',
        preOpSecondaryDiagnosis: '',
        surgeon: '',
        surgeryDate: ''
      },
      messages: { reportSaved: '' },
      titles: {
        editTitle: '',
        newTitle: '',
        reportSaved: ''
      }
    },
    operativePlan: {
      buttons: { completePlan: '' },
      labels: {
        additionalNotes: '',
        admissionInstructions: '',
        caseComplexity: '',
        completedStatus: '',
        droppedStatus: '',
        operationDescription: '',
        plannedStatus: '',
        status: '',
        surgeon: ''
      },
      messages: {
        planCompleted: '',
        planSaved: ''
      },
      titles: {
        editTitle: '',
        newTitle: '',
        planCompleted: '',
        planSaved: ''
      }
    },
    patients: {
      buttons: {
        addContact: '',
        addExpense: '',
        addFamilyMember: '',
        addOperativePlan: '',
        backToPatients: '',
        download: '',
        editOperativePlan: '',
        newAppointment: '',
        newImaging: '',
        newLab: '',
        newMedication: '',
        newPatient: '',
        newPhoto: '',
        newVisit: '',
        patientCheckIn: '',
        scheduleSurgery: ''
      },
      labels: {
        admissionDate: '',
        admit: '',
        bloodType: '',
        caption: '',
        civilStatus: '',
        clinic: '',
        contacts: '',
        cost: '',
        dateOfBirth: '',
        dateProcessed: '',
        dischargeDate: '',
        dob: '',
        education: '',
        email: '',
        externalPatientId: '',
        firstName: '',
        income: '',
        insurance: '',
        lastName: '',
        middleName: '',
        monthlyCost: '',
        occupation: '',
        operativePlan: '',
        parent: '',
        patientDays: '',
        patientType: '',
        patientTypeCharity: '',
        patientTypePrivate: '',
        phone: '',
        placeOfBirth: '',
        primaryDiagnosis: '',
        referredBy: '',
        referredDate: '',
        relationship: '',
        relationships: '',
        religion: '',
        secondaryDiagnosis: '',
        sex: '',
        sexNotEntered: '',
        sources: '',
        status: '',
        totalMontlyExpense: ''
      },
      messages: {
        areYouSureDelete: '',
        createNewPatient: '',
        deletingPatient: '',
        noPatientsFound: '',
        notFoundQuickAdd: '',
        photoFileRequired: '',
        savedPatient: ''
      },
      navigation: {
        appointments: '',
        general: '',
        history: '',
        imaging: '',
        labs: '',
        medication: '',
        photos: '',
        socialWork: '',
        visits: ''
      },
      notes: {
        newNote: '',
        onBehalfOfCopy: 'a nombre de',
        onBehalfOfLabel: 'A nombre de',
        pleaseSelectAVisit: 'Por favor seleccione una visista',
        updateNote: ''
      },
      titles: {
        addContact: '',
        addPhoto: '',
        additionalContacts: '',
        admissionsDetail: '',
        admissionsSummary: '',
        admittedPatients: '',
        'delete': '',
        deleteContact: '',
        deleteExpense: '',
        deleteFamilyMember: '',
        deletePatientRecord: '',
        deletePhoto: '',
        diagnosticTesting: '',
        dischargesDetail: '',
        dischargesSummary: '',
        edit: '',
        editPhoto: '',
        expenses: '',
        familyInfo: '',
        familyInformation: '',
        'new': '',
        outpatientsForDate: '',
        patient: '',
        patientListing: '',
        patientReport: '',
        patientStatus: '',
        proceduresDetail: '',
        proceduresSummary: '',
        savedPatient: '',
        socialWork: '',
        todaysOutpatients: '',
        totalPatientDays: '',
        totalPatientDaysDetailed: '',
        visit: ''
      }
    },
    print: { invoice: {
        labels: {
          billedBy: '',
          billedDate: '',
          dateAdmitted: '',
          dateDischarged: '',
          dischargeNotes: '',
          patientAddress: '',
          patientAge: '',
          patientId: '',
          patientName: '',
          remarks: '',
          spacer: ''
        },
        messages: { whereConducted: '' },
        titles: {
          billingStatement: '',
          patientMember: '',
          patients: '',
          relContact: ''
        }
      } },
    procedures: {
      buttons: { addMedication: '' },
      labels: { medicationUsed: '' },
      messages: { saved: '' },
      titles: {
        addChargeItem: '',
        addMedicationUsed: '',
        deleteChargeItem: '',
        deleteMedicationUsed: '',
        edit: '',
        editChargeItem: '',
        editMedicationUsed: '',
        medicationUsed: '',
        'new': '',
        saved: ''
      }
    },
    reports: {
      labels: {
        admissionDate: '',
        allProcedures: '',
        completedBy: '',
        dischargeDate: '',
        examiner: '',
        images: '',
        labs: '',
        location: '',
        medications: '',
        nextAppointment: '',
        nextAppointments: '',
        notes: {
          author: '',
          date: '',
          title: ''
        },
        operativePlan: {
          description: '',
          instructions: '',
          procedures: '',
          title: ''
        },
        primaryDiagnosis: '',
        procedures: '',
        secondaryDiagnosis: '',
        visitDate: '',
        visitType: ''
      },
      messages: {
        'delete': '',
        saved: ''
      },
      titles: {
        dischargeReport: '',
        newDischargeReport: '',
        newOPDReport: '',
        opdReport: '',
        saved: ''
      }
    },
    user: {
      plusNewUser: '+ nuevo usuario',
      usersPageTile: 'Listado de usuarios'
    },
    visits: {
      buttons: {
        addDiagnosis: '',
        checkIn: '',
        checkOut: '',
        discharge: '',
        newAppointment: '',
        newDischargeReport: '',
        newOPDReport: '',
        newProcedure: '',
        newVitals: ''
      },
      labels: {
        appointment: '',
        authoredBy: '',
        checkInTime: '',
        checkOutTime: '',
        createNewPatient: '',
        diagnosis: '',
        examiner: '',
        finalDiagnosis: '',
        haveAppointment: '',
        haveDoneOrders: '',
        noAppointment: '',
        ordersDone: '',
        ordersNotDone: '',
        patientToCheckIn: '',
        procedure: '',
        procedureDate: '',
        reasonForVisit: '',
        reportType: '',
        status: '',
        statusAdmitted: '',
        statusCheckedIn: '',
        statusCheckedOut: '',
        statusDischarged: '',
        visitDate: '',
        visitInformation: '',
        visitType: ''
      },
      messages: {
        checkOut: '',
        checkedOut: '',
        discharged: '',
        patientCheckedIn: '',
        patientCreatedAndCheckedIn: '',
        visitAndPatientSaved: '',
        visitSaved: ''
      },
      navigation: {
        charges: '',
        notes: '',
        orders: '',
        procedures: '',
        reports: '',
        vitals: ''
      },
      titles: {
        additionalDiagnoses: '',
        checkOut: '',
        checkedIn: '',
        checkedOut: '',
        discharged: '',
        editVisit: '',
        newVisit: '',
        patientCheckIn: '',
        visitSaved: ''
      }
    },
    vitals: { labels: {
        dateRecorded: '',
        dbp: '',
        heartRate: '',
        height: '',
        respiratoryRate: '',
        sbp: '',
        temperature: '',
        weight: ''
      } }
  };
});
define('hospitalrun/locales/es/translations', ['exports'], function (exports) {
  exports['default'] = {
    admin: {
      address: {
        address1Label: 'Texto direccion 1',
        address2Label: 'Texto direccion 2',
        address3Label: 'Texto direccion 3',
        address4Label: 'Texto direccion 4',
        addressLabel: 'Direcciones',
        editTitle: 'Opciones de dirección',
        include1Label: 'Incluir 1',
        include2Label: 'Incluir 2',
        include3Label: 'Incluir 3',
        include4Label: 'Incluir 4',
        messages: { addressSaved: 'las opciones de dirección han sido guardadas' },
        newTitle: 'Opciones de dirección',
        titles: { optionsSaved: 'Opciones guardadas' }
      },
      addressOptions: 'Opciones de direcciones',
      customForms: {
        buttons: {
          addField: '',
          moveDown: '',
          moveUp: '',
          newForm: '',
          preview: ''
        },
        labels: {
          alwaysInclude: '',
          checkbox: '',
          colSpan: '',
          columns: '',
          customForm: '',
          dischargeReportFormType: '',
          formName: '',
          formType: '',
          incidentFormType: '',
          includeOtherOption: '',
          labFormType: '',
          label: '',
          newForm: '',
          opdReportFormType: '',
          operativePlanFormType: '',
          otherOptionLabel: '',
          patientFormType: '',
          property: '',
          radio: '',
          select: '',
          socialworkFormType: '',
          text: '',
          textarea: '',
          visitFormType: ''
        },
        messages: { formSaved: '' },
        titles: {
          checkboxValues: '',
          customForms: '',
          deleteForm: '',
          dropDownValues: '',
          editCustomForm: '',
          fields: '',
          formSaved: '',
          newCustomForm: '',
          radioValues: ''
        }
      },
      header: {
        editTitle: '',
        facilityName: '',
        headerLabel: '',
        headerLine1: '',
        headerLine2: '',
        headerLine3: '',
        logoURL: '',
        messages: { headerSaved: '' },
        newTitle: '',
        titles: { optionsSaved: '' }
      },
      loadDb: 'Cargar Base de datos',
      loaddb: {
        displayAlertMessage: 'Por favor seleccione un archivo para ser cargado.',
        displayAlertTitle: 'Seleccione un archivo para cargar',
        editTitle: 'Cargar bd',
        errorDisplayAlertMessage: 'La base de datos no fue cargada el error fue: {{error}}',
        errorDisplayAlertTitle: 'Error cargando',
        progressMessage: 'Por favor espere mientras la base de datos es cargada.',
        progressTitle: 'Cargando ase de datos'
      },
      lookup: {
        aisleLocationList: 'Ubicacion de inventario de pasillo',
        alertImportListMessage: 'Por favor seleccione un archivo para importar.',
        alertImportListSaveMessage: 'Lista de busqueda importada.',
        alertImportListSaveTitle: 'Lista importada',
        alertImportListTitle: 'Seleccione un archivo para importar',
        alertImportListUpdateMessage: 'La lista de busqueda ha sido salvada.',
        alertImportListUpdateTitle: 'Lista salvada',
        anesthesiaTypes: 'Tipos de anestesia',
        anesthesiologists: 'Anestesiologo',
        billingCategories: 'Categorias de facturacion',
        clinicList: 'Ubicacion de las clinicas',
        countryList: 'Paises',
        cptCodeList: 'Codigos CPT',
        diagnosisList: 'Diagnosticos',
        edit: { template: {
            addTitle: 'Adicionar valor',
            editTitle: 'Editar valor',
            labelTitle: 'Valor',
            updateButtonTextAdd: 'Adicionar',
            updateButtonTextUpdate: 'Actualizar'
          } },
        expenseAccountList: 'Cuentas de gastos',
        imagingPricingTypes: 'Tipos de precios de radiografias',
        incidentDepartments: '',
        inventoryTypes: 'Tipos de inventarios',
        labPricingTypes: 'Precios de laboratorio',
        pageTitle: 'Listas de busqueda',
        patientStatusList: 'Lista de estado de pacientes',
        physicianList: 'Medicos',
        procedureList: 'Procedimientos',
        procedureLocations: 'Ubicacion de los procedimientos',
        procedurePricingTypes: 'Tipos de procedimientos y precios',
        radiologists: 'Radiologo',
        titles: { deleteLookupValue: '' },
        unitTypes: 'Tipos de unidad',
        vendorList: 'Proveedor',
        visitLocationList: 'Lugares de visista',
        visitTypes: 'Tipos de visita',
        wardPricingTypes: 'Tipos de las tarifas',
        warehouseList: 'Ubicacciones de inventarios'
      },
      lookupLists: 'Lista de busqueda',
      roles: {
        capability: {
          addAllergy: '',
          addAppointment: 'Adicionar cita',
          addBillingDiagnosis: '',
          addCharge: 'Adicionar cargo (valor)',
          addDiagnosis: 'Adicionar diagnostico',
          addImaging: 'Adicionar radiografia',
          addIncident: '',
          addIncidentCategory: '',
          addInventoryItem: 'Adicionar elemento al inventario',
          addInventoryPurchase: 'Adicionar compra',
          addInventoryRequest: 'Pedido de inventario',
          addInvoice: 'Adicionar factura',
          addLab: 'Adicionar laboratorio',
          addMedication: 'Adicionar medicación',
          addNote: '',
          addOperationReport: '',
          addOperativePlan: '',
          addPatient: 'Adicionar paciente',
          addPayment: 'Adicionar pago',
          addPhoto: 'Adicionar foto',
          addPricing: 'Adicionar precio',
          addPricingProfile: 'Adicionar perfil de precios',
          addProcedure: '',
          addSocialwork: '',
          addVisit: 'Adicionar visita',
          addVitals: 'Adicionar partes vitales',
          adjustInventoryLocation: 'Ajustar lugar elemento en el inventario',
          admin: 'Administracion',
          admitPatient: 'Admitir paciente',
          appointments: 'Citas',
          billing: 'Facturacion',
          completeImaging: 'Completar radiografia',
          completeLab: 'Completar laboratorio',
          defineUserRoles: 'Roles de usuario',
          deleteAppointment: 'Eliminar cita',
          deleteDiagnosis: 'Eliminar diagnostico',
          deleteImaging: 'Eliminar radiografia',
          deleteIncident: '',
          deleteIncidentCategory: '',
          deleteInventoryItem: 'Eliminar elemento del inventario',
          deleteInvoice: 'Eliminar factura',
          deleteLab: 'Eliminar laboratorio',
          deleteMedication: 'Eliminar medicación',
          deleteNote: '',
          deletePatient: 'Eliminar paciente',
          deletePhoto: 'Eliminar foto',
          deletePricing: 'Eliminar precio',
          deletePricingProfile: 'Eliminar perfil de precio',
          deleteProcedure: 'Eliminar procedimiento',
          deleteSocialwork: 'Eliminar trabajo social',
          deleteVisit: 'Eliminar visita',
          deleteVitals: 'Eliminar organo vital',
          dischargePatient: 'Descartar paciente',
          editInvoice: 'Editar factura',
          fulfillInventory: 'Cumplimiento de inventario',
          fulfillMedication: 'Cumplir la medicación',
          generateIncidentReport: '',
          imaging: 'Radiografia',
          incident: '',
          inventory: 'Inventario',
          invoices: 'Facturas',
          labs: 'Laboratorios',
          loadDb: 'Cargar base de datos',
          manageIncidents: '',
          medication: 'Medicación',
          overrideInvoice: 'Sobreescribir factura',
          patientReports: 'Reportes por paciente',
          patients: 'Pacientes',
          pricing: 'Precio',
          updateConfig: 'Actualizar configuracion',
          visits: 'Visitas'
        },
        messages: { roleSaved: 'El {{roleName}} rol ha sido salvado.' },
        titles: { roleSaved: 'Role salvado' }
      },
      userRoles: 'Roles',
      users: 'Usuarios',
      visitForms: {
        labels: {
          followup: '',
          form: '',
          initial: '',
          visitType: ''
        },
        titles: { visitForms: '' }
      },
      workflow: {
        admissionDepositLabel: '',
        clinicPrepaymentLabel: '',
        editTitle: '',
        followupPrepaymentLabel: '',
        messages: { optionsSaved: '' },
        newTitle: '',
        outpatientImagingLabel: '',
        outpatientLabLabel: '',
        outpatientMedicationLabel: '',
        titles: { optionsSaved: '' },
        workflowLabel: ''
      }
    },
    alerts: {
      errorExclamation: '',
      pleaseWait: 'Por favor espere',
      reportError: '',
      warningExclamation: ''
    },
    allergies: {
      buttons: { addAllergy: '' },
      labels: {
        allergyName: '',
        patientAllergy: ''
      },
      titles: {
        addAllergy: '',
        editAllergy: ''
      }
    },
    application: {
      messages: { sessionExpired: '' },
      titles: { sessionExpired: '' }
    },
    appointments: {
      buttons: {
        newButton: '+ nueva cita',
        scheduleSurgery: ''
      },
      calendarTitle: '',
      currentScreenTitle: 'Listado de citas',
      editTitle: 'Editar cita',
      labels: {
        noLocation: '',
        selectedStartingDate: ''
      },
      messages: {
        appointmentSaved: '',
        endTimeLaterThanStart: 'Seleccione una hora de finalizacion despues de la de inicio.'
      },
      missed: 'Citas perdidas',
      newTitle: 'Nueva cita',
      searchTitle: 'Buscar citas',
      sectionTitle: 'Citas',
      thisWeek: 'Citas esta semana',
      titles: {
        appointmentSaved: '',
        editSurgicalAppointment: '',
        newSurgicalAppointment: '',
        theaterSchedule: ''
      },
      todayTitle: 'Citas para hoy'
    },
    billing: {
      alerts: {
        noInvoiceFound: '',
        noPricingItems: '',
        noPricingProfiles: ''
      },
      buttons: {
        addOverride: '',
        createInvoice: ''
      },
      labels: {
        actualCharges: '',
        discountAmount: '',
        discountPercentage: '',
        externalInvoiceNumber: '',
        hmoCom: '',
        insurance: '',
        paymentProfile: '',
        paymentsDeposits: '',
        pricingPanelOverrides: '',
        pricingProfile: ''
      }
    },
    buttons: {
      add: 'Adicionar',
      addItem: '',
      addLineItem: '',
      addValue: 'Adicionar valor',
      addVisit: 'Adicionar visita',
      allRequests: 'Todas las solicitudes',
      barcode: 'Codigo de barras',
      cancel: 'Cancelar',
      clear: '',
      close: 'Cerrar',
      complete: 'Completado',
      'delete': 'Eliminar',
      dispense: 'Repartir',
      edit: '',
      filter: '',
      fulfill: 'Cumplimiento',
      'import': 'Importar',
      loadFile: 'Cargar archivo',
      newItem: '+ nuevo elemento',
      newNote: 'Nueva nota',
      newRequest: 'Nueva solicitud',
      newRequestPlus: '+ nuevo pedido',
      newUser: 'Nuevo usuario',
      ok: 'Ok',
      remove: 'Remover',
      returnButton: 'Regresar',
      search: 'Buscar',
      showAll: '',
      showFewer: '',
      update: 'Actualizar'
    },
    components: {
      chargesByTypeTab: { charges: '' },
      customFormManager: { buttons: { addForm: '' } },
      dateTimePicker: {
        amHour: '',
        midnight: '',
        noon: '',
        pmHour: ''
      },
      imageUpload: { messages: { selectValidImageFile: '' } },
      operativeProcedures: {
        buttons: { addProcedure: '' },
        labels: { procedure: '' },
        titles: { procedures: '' }
      },
      patientOrders: {
        buttons: {
          newImaging: '',
          newLab: '',
          newMedication: ''
        },
        labels: {
          imagingOrderType: '',
          labOrderType: '',
          medicationOrderType: '',
          orderType: ''
        }
      },
      priceList: { charges: '' },
      quantityCalc: { result: '' },
      quantityConv: {
        conversion: '',
        unit: ''
      },
      sortableColumn: { labels: { selectAll: '' } },
      takePhoto: {
        camera: '',
        how: '',
        labels: {
          takeAPicture: '',
          uploadAFile: ''
        },
        photo: '',
        preview: '',
        takePhoto: '',
        uploadFile: ''
      },
      upcomingAppointments: {
        labels: {
          date: '',
          location: '',
          type: '',
          'with': ''
        },
        titles: { upcomingAppointments: '' }
      }
    },
    customForms: {
      buttons: { addForm: '' },
      labels: { formToAdd: '' },
      titles: { addCustomForm: '' }
    },
    dashboard: {
      setup: '',
      title: 'Que deseas hacer?'
    },
    dates: {
      'long': '',
      longOmitDays: '',
      longOmitDaysPlural: '',
      longOmitDaysYears: '',
      longOmitYears: '',
      longPlural: '',
      'short': '',
      shortOmitYears: ''
    },
    diagnosis: {
      labels: {
        activeDiagnosis: '',
        date: '',
        diagnosis: '',
        secondaryDiagnosis: ''
      },
      titles: {
        addDiagnosis: '',
        editDiagnosis: ''
      }
    },
    errors: {
      accepted: '',
      blank: '',
      confirmation: '',
      empty: '',
      equalTo: '',
      even: '',
      exclusion: '',
      greaterThan: '',
      greaterThanOrEqualTo: '',
      inclusion: '',
      invalid: '',
      invalidNumber: '',
      lessThan: '',
      lessThanOrEqualTo: '',
      notANumber: '',
      notAnInteger: '',
      odd: '',
      otherThan: '',
      present: '',
      result: '',
      tooLong: '',
      tooShort: '',
      wrongLength: ''
    },
    headings: { chargedItems: '' },
    imaging: {
      alerts: {
        completedMessage: 'El pedido de radiografia ha sido completado.',
        completedTitle: 'Pedido de radiografia completado',
        savedMessage: 'El pedido de radiografia ha sido guardado.',
        savedTitle: 'Pedido de radiografia salvado'
      },
      buttons: { newButton: '+ new radiografia' },
      labels: {
        addNewVisit: '--Adicionar nueva visita--',
        radiologist: 'Radiologo'
      },
      messages: { noCompleted: 'No de items encontrados.' },
      pageTitle: 'Pedido de radriografia',
      sectionTitle: 'Radiografias',
      titles: {
        completedImaging: 'Radiografia completada',
        editTitle: 'Pedido de edicion de radiografia',
        newTitle: 'Nuevo pedido de radiografia'
      }
    },
    incident: {
      buttons: {
        add: '',
        addForm: '',
        addItem: '',
        cancel: '',
        'delete': '',
        download: '',
        edit: '',
        'export': '',
        generateRep: '',
        newAttachment: '',
        newCategory: '',
        newIncident: '',
        newNote: ''
      },
      labels: {
        actions: '',
        addedBy: '',
        category: '',
        categoryItem: '',
        date: '',
        dateRecorded: '',
        department: '',
        description: '',
        endDate: '',
        givenBy: '',
        howToAddAttachment: '',
        incidentDate: '',
        incidentId: '',
        item: '',
        lastUpdated: '',
        note: '',
        patientId: '',
        patientImpacted: '',
        reportType: '',
        reportedBy: '',
        reportedDate: '',
        reportedTo: '',
        sentinelEvent: '',
        startDate: '',
        status: '',
        statusActive: '',
        statusClosed: '',
        statusFollowup: '',
        statusReported: '',
        title: '',
        total: '',
        updatedBy: ''
      },
      messages: {
        attachmentFileRequired: '',
        createNew: '',
        createNewIncidentCategory: '',
        fillIn: '',
        incidentCategorySaved: '',
        noClosedIncidents: '',
        noIncidentCategoriesFound: '',
        noIncidents: '',
        saved: '',
        selectExistingPatient: ''
      },
      titles: {
        addAttachment: '',
        addCategoryItem: '',
        addNote: '',
        attachments: '',
        closed: '',
        current: '',
        deleteAttachment: '',
        deleteIncident: '',
        deleteIncidentCategory: '',
        deleteItem: '',
        deleteNote: '',
        editAttachment: '',
        editIncident: '',
        editIncidentCategory: '',
        editNote: '',
        general: '',
        history: '',
        incidentCategories: '',
        incidentCategoryItem: '',
        incidentCategoryName: '',
        incidentCategorySaved: '',
        incidentSaved: '',
        incidents: '',
        incidentsByCategory: '',
        incidentsByDepartment: '',
        newIncident: '',
        newIncidentCategory: '',
        notes: '',
        reports: ''
      }
    },
    inventory: {
      edit: {
        cost: 'Costo por unidad:',
        delivered: 'Enviado A:',
        location: 'Cambio de ubicación:',
        prescription: 'Recetado por:',
        pulled: 'Pulled From:',
        quantity: 'Quantity at Completion:',
        reason: 'Razón:',
        returned: 'Regresado al paciente:',
        transferredFrom: 'Transferido a:',
        transferredTo: 'Transferido a:'
      },
      labels: {
        action: 'Acción',
        add: 'Adicionar',
        addAdjustmentType: '',
        adjust: 'Adjustar',
        adjustmentDate: 'Fecha de ajuste',
        adjustmentFor: 'Ajustado para',
        adjustmentType: 'Tipo de ajuste',
        aisle: 'Pasillo',
        aisleLocation: 'Ubicación pasillo',
        allInventory: 'Todo el inventario',
        allItems: '',
        availableQuantity: '',
        billTo: 'Facturao a',
        consumePurchases: 'Consume Purchases',
        consumptionRate: 'Tasa de consumo',
        cost: 'Costo',
        costPerUnit: 'Costo por Unidad',
        crossReference: 'Referencia cruzada',
        currentQuantity: 'Cantidad actual',
        dateCompleted: 'Fecha completado',
        dateEffective: 'Gecha efectiva',
        dateEnd: 'Fecha final',
        dateReceived: 'Fecha recibido',
        dateStart: 'Fecha inicial',
        dateTransferred: '',
        daysLeft: 'Dias restantes',
        deleteItem: 'Eliminar elemento',
        deliveryAisle: 'Enviado a pasillo',
        deliveryLocation: 'Ubicación del envio',
        details: 'Detalles',
        distributionUnit: 'Unidad de distribución',
        editItem: 'Editar elemento',
        expense: 'Gastos a',
        expirationDate: 'Fecha de vencimiento',
        fulfillRequest: 'Pedido de cumplimiento',
        fulfillRequestNow: 'Pedido de incumplimiento para hoy',
        gift: 'Regalo en especie',
        giftInKindNo: 'N',
        giftInKindYes: 'Y',
        giftUsage: 'Uso del regalo en especie',
        inventoryConsumed: 'Inventario consumido',
        inventoryItem: 'Elemento del inventario',
        inventoryObsolence: 'Obsolescencia de inventario',
        invoiceItems: 'Articulos de factura',
        invoiceLineItem: 'Elemento de la factura linea',
        invoiceNumber: 'Factura numero',
        item: 'Elemento',
        itemNumber: 'Numero de elemento',
        items: 'Elementos',
        location: 'Ubicación',
        locations: 'Ubicaciones',
        markAsConsumed: 'Marcar como consumido',
        name: 'Nombre',
        newItem: 'Nuevo elemento',
        originalQuantity: 'Cantidad original',
        print: 'Imprimir',
        printBarcode: 'Imprimir codigo de  barras',
        printer: 'Impresora',
        pullFrom: 'Traido de',
        purchaseCost: 'Costo de compra',
        purchaseInfo: 'Informacion de la compra',
        purchases: 'Compras',
        quantity: 'Cantidad ({{unit}})',
        quantityAvailable: 'Cantidad disponible',
        quantityOnHand: 'Cantidad a la mano',
        quantityRequested: 'Cantidad pedida',
        rank: 'Ranking',
        reason: 'Razón',
        remove: 'Remover',
        removeAdjustmentType: '',
        reorderPoint: 'Reordenar punto',
        requestedItems: 'Elementos solicitados',
        returnAdjustmentType: '',
        returnToVendorAdjustmentType: '',
        salePricePerUnit: 'Costo de venta por unidad',
        save: 'Guardar',
        serialNumber: 'Serial/Numero de lote',
        total: 'Total',
        totalCost: 'Costo total',
        totalReceived: 'Total Recivido: {{total}}',
        transaction: 'Transaccion',
        transactions: 'Transacciones',
        transfer: 'Translados',
        transferFrom: 'Translado desde',
        transferTo: 'Translado a ubicación',
        transferToAisle: 'Translado a pasillo',
        unit: 'Unidad',
        unitCost: 'Unidad Costo',
        vendor: 'Proveedor',
        vendorItemNumber: 'Proveedor numero de elemento',
        writeOffAdjustmentType: '',
        xref: 'XRef'
      },
      messages: {
        adjust: 'Por favor ajust las cantidades en la ubicación adecuada(s) la diferencia de la cuenta es {{difference}}.',
        createRequest: 'Crear un nuevo pedido?',
        itemNotFound: 'El elemento del inventario <strong>{{item}}</strong> no se pudo encontrar.<br>Si desea crear un nuevo elemento, Ingrese la información abajo.<br>De lo contrario opria cancelar para volver.',
        loading: 'Cargando transacciones ...',
        noItems: 'No se encontraron elementos.',
        noRequests: 'No se encontraron pedidos.',
        purchaseSaved: 'La compra de inventario ha sido salvada.',
        quantity: 'La cantidad total <strong>({{quantity}})</strong> no encaja con la cantidad total en las ubicaciones <strong>({{locationQuantity}})</strong>.',
        removeItem: 'Esta seguro de eliminar este elemento de la factura?',
        removeItemRequest: 'Seguro que quiere eliminar este elemento del pedido?',
        requestFulfilled: 'El pedido de inventario ha sido procesado.',
        requestUpdated: 'El pedido de inventario ha sido actualizado.',
        warning: 'Valide los campos requeridos (marcados con *) corrija los errores antes de adicionar.'
      },
      reports: {
        adjustment: 'Ajuste detallado',
        daysSupply: 'Dias de inventario restante',
        expenseDetail: 'Gastos detallados',
        expenseSum: 'Resumen de gastos',
        expiration: 'Fecha de expiracion',
        'export': 'Exportar reporte',
        fields: 'Campos a incluir',
        finance: 'Resumen de finanzas',
        generate: 'Generar reporte',
        invLocation: 'Inventario por ubicacion',
        invValuation: 'Inventario por valoracion',
        purchaseDetail: 'Compras detalladas',
        purchaseSum: 'Resumen de compras',
        reportType: 'Tipo de reporte',
        rows: {
          adjustments: 'Ajustes',
          adjustmentsTotal: 'Ajustes totales',
          balanceBegin: 'Balance inicial',
          balanceEnd: 'Balance Final',
          category: 'Categoria',
          consumed: 'Consumado',
          consumedGik: 'GiK Consumido',
          consumedGikTotal: 'Total GiK Consumido',
          consumedPuchases: 'Total de lo comprado consumido',
          consumedPurchasesTotal: 'Total de lo comprado consumido',
          consumedTotal: 'Total consumido',
          errInFinSum: 'Error en _generateFinancialSummaryReport: ',
          errInFindPur: 'Error en _findInventoryItemsByPurchase: ',
          errInFindReq: 'Error en _findInventoryItemsByRequest: ',
          expensesFor: 'Gatos para: ',
          noAccount: '(No Cuenta)',
          subtotal: 'Subtotal: ',
          subtotalFor: 'Subtotal para {{category}} - {{account}}: ',
          total: 'Total: ',
          totalFor: 'Total para {{var}}: ',
          totalPurchases: 'Compras Totales',
          transfer1: '{{quantity}} de {{location}}',
          trasnfer2: 'De: {{source}} A: {{target}}'
        },
        stockTransferDetail: 'Detalle de traslado de stock',
        stockTransferSum: 'Resumen traslado de stock',
        stockUsageDetail: 'Detalle de uso de stock',
        stockUsageSum: 'Resumen uso de stock',
        titleDateRange: '',
        titleSingleDate: ''
      },
      titles: {
        addPurchase: 'Adicionar compra',
        addRequest: 'Nuevo pedido',
        adjustment: 'Ajuste',
        editPurchase: 'Editar compra',
        editRequest: 'Editar pedido',
        inventoryItem: 'Nuevo elemento de inventario',
        inventoryReport: 'Reporte de inventario',
        purchaseSaved: 'Compras de inventario guardadas',
        quickAddTitle: 'Nuevo elemento de inventario',
        removeItem: 'Remover elemento',
        requestFulfilled: 'Pedido cumplido',
        requestUpdated: 'Pedido actualizado',
        transfer: 'Trasladar elementos',
        warning: 'Peligro!!!!!'
      }
    },
    labels: {
      action: 'Accion',
      actions: 'Acciones',
      addNewOutpatientVisit: '--Nueva visita a paciente externo--',
      address: '',
      age: 'Edad',
      allDay: 'Todo el dia',
      amount: '',
      anesthesia: 'Anestesia',
      assisting: 'Asistencia',
      balanceDue: '',
      billDate: '',
      billTo: 'Facturar a',
      category: '',
      completed: 'Completado',
      country: '',
      cptcode: 'Codigo CPT',
      creditTo: '',
      date: 'Fecha',
      dateCompleted: 'Fecha completada',
      dateOfBirth: 'Fecha de nacimiento',
      dateOfBirthShort: 'FDN',
      datePaid: '',
      dateRequested: 'Fecha de pedido',
      'delete': 'Eliminar',
      deleteRequest: 'Eliminar pedido',
      deleteUser: 'Eliminar usuario',
      department: '',
      description: 'Descripción',
      discount: '',
      displayName: 'Nombre para mostrar',
      docRead: 'Leer documento',
      docWritten: 'Documento escrito',
      edit: 'Editar',
      editUser: 'Editar usuario',
      email: 'Email',
      endDate: 'Fecha final',
      endTime: 'Hora de finalización',
      excess: '',
      expenseTo: '',
      fileLoadSuccessful: 'Archivo cargado exitosamente',
      fileName: '',
      fileToLoad: 'Archivo cargado',
      fulfill: 'Cumplomiento',
      fulfillRequest: 'Pedido de cumplimiento',
      fulfillRequestNow: 'Pedido de cumplimiento ahora',
      fulfilled: 'Cumplido',
      grandTotal: '',
      id: 'Id',
      imageOrders: 'Ordenes de radiografias',
      imagingType: 'Tipo de radiografia',
      importFile: 'Importar archivo',
      invoiceId: '',
      labOrders: 'Ordenes de laboratorio',
      lineItems: '',
      loading: 'Cargando',
      location: 'Ubicacion',
      lookupType: 'Tipo de busqueda',
      medication: 'Medicación',
      name: 'Nombre',
      newUser: 'Nuevo usuario',
      note: '',
      notes: 'Notas',
      number: '',
      on: 'on',
      password: 'Contraseña',
      patient: 'Paciente',
      payments: '',
      physician: 'Médico',
      prescriber: '',
      prescription: 'Receta medica',
      prescriptionDate: 'Fecha de la receta medica',
      price: '',
      print: '',
      procedures: 'Procedimiento',
      provider: 'Proveedor',
      pullFrom: 'Traer de',
      quantity: 'Cantidada',
      remarks: '',
      requestedBy: 'Pedido por|',
      requestedOn: 'Pedido On',
      requests: 'Pedido',
      result: 'Resultado',
      results: 'Resultados',
      role: 'Rol',
      search: '',
      sex: 'Genero',
      startDate: 'Fecha de inicio',
      startTime: 'Hora de inicio',
      status: 'Estado',
      takenBy: '',
      total: '',
      type: 'Tipo',
      userCanAddNewValue: 'Los usuarios pueden agregar nuevos valores',
      username: 'Nombre de usuario',
      value: 'Valor',
      view: '',
      visit: 'Visita',
      'with': 'con'
    },
    labs: {
      alerts: {
        requestCompletedMessage: 'El pedido de laboratorio ha sido completado.',
        requestCompletedTitle: 'Pedido de laboratorio competado',
        requestSavedMessage: 'El pedido de laboratorio ha sido guardado.',
        requestSavedTitle: 'Silicitud de laboratorio guardado'
      },
      buttons: { newButton: '+ nuevo laboratorio' },
      completedTitle: 'Completar laboratorio',
      deleteTitle: 'Eliminar pedido',
      editTitle: 'Editar pedido de laboratorio',
      labels: {
        addNewVisit: '--Adicionar nueva visita--',
        labType: 'Tipo de laboratorio'
      },
      messages: {
        createNewRecord: 'Crear un registro?',
        noCompleted: 'No elementos completados encontrados.',
        noItemsFound: 'No boratorios encontrados.'
      },
      newTitle: 'Nuevo pedido de laboratorio',
      requestsTitle: 'Pedido de laboratorio',
      sectionTitle: 'Laboratorios'
    },
    loading: {
      messages: {
        '0': '',
        '1': '',
        '2': '',
        '3': '',
        '4': '',
        '5': '',
        '6': '',
        '7': '',
        '8': '',
        '9': '',
        '10': '',
        '11': ''
      },
      progressBar: { progress: '' }
    },
    login: {
      labels: {
        password: 'Clave',
        signIn: 'Ingresar',
        username: 'Nombre de usuario'
      },
      messages: {
        error: 'Nombre de usuario o clave incorrectos.',
        signIn: 'por favor ingrese'
      }
    },
    medication: {
      alerts: {
        fulfilledTitle: 'Pedido de medicación cumplido',
        returnedMessage: 'La medicacion ha sido marcada para devolver.',
        returnedTitle: 'Medicacion devuelta',
        savedMessage: 'La elemento de medicación ha sido guardado.',
        savedTitle: 'Pedido de medicacion guardado'
      },
      buttons: {
        dispenseMedication: 'dispensar medicación',
        newButton: '+ nuevo pedido',
        returnMedication: 'debolver medicacion'
      },
      labels: {
        adjustmentDate: 'Fecha de ajuste',
        creditToAccount: 'Credito a cuenta',
        quantityDispensed: 'Cantidad dispensada',
        quantityDistributed: 'Cantidad distribuida',
        quantityRequested: 'Cantidad solicitada',
        quantityToReturn: 'Cantidad a devolver',
        refills: 'Recargas',
        returnAisle: 'Devolve a pasillo',
        returnLocation: 'Retornar a ubicación',
        returnReason: 'Razon por la que se devuelve/Nota'
      },
      messages: { createNew: 'Crear un nuevo pedido de medicacion?' },
      pageTitle: 'Pedido de medicación',
      returnMedication: 'Retorno de medicación',
      sectionTitle: 'Medication',
      titles: {
        completedMedication: 'Medicacion completada',
        editMedicationRequest: 'Editar pedido de medicacion',
        newMedicationRequest: 'Nuevo pedido de medicacion'
      }
    },
    messages: {
      createNewRecord: 'Crear un nuevo registro?',
      createNewUser: 'Crear un nuevo usuario?',
      'delete': '',
      delete_plural: '',
      delete_singular: '',
      forAuthorizedPersons: 'Este informe es sólo para personas autorizadas.',
      newPatientHasToBeCreated: 'Un nuevo paciente debe ser creado...Por favor espere..',
      noHistoryAvailable: 'Historia no disponible.',
      noItemsFound: 'Elementos no encontrados.',
      noNotesAvailable: 'No hay notas clínicas adicionales están disponibles para esta visita.',
      noUsersFound: 'Ningun usuario encontrado.',
      onBehalfOf: 'a nombre de',
      reportError: '',
      requiredFieldsCorrectErrors: '',
      saveActionException: '',
      sorry: 'Lo sentimos, un error ha ocurrido...',
      userHasBeenSaved: 'El usuario ha sido salvado.',
      userSaved: 'Usuario salvado'
    },
    models: {
      appointment: {
        labels: {
          allDay: '',
          appointmentDate: '',
          appointmentType: '',
          endDate: '',
          location: '',
          notes: '',
          patient: '',
          provider: '',
          startDate: '',
          status: '',
          type: ''
        },
        names: {
          plural: '',
          singular: ''
        }
      },
      attachment: { names: {
          plural: '',
          singular: ''
        } },
      form: { names: {
          plural: '',
          singular: ''
        } },
      imaging: {
        names: '',
        request: {
          plural: '',
          singular: ''
        }
      },
      incident: { names: {
          plural: '',
          singular: ''
        } },
      item: { names: {
          plural: '',
          singular: ''
        } },
      lab: {
        names: {
          plural: '',
          singular: ''
        },
        request: {
          plural: '',
          singular: ''
        }
      },
      medication: {
        names: {
          plural: '',
          singular: ''
        },
        request: {
          plural: '',
          singular: ''
        }
      },
      note: { names: {
          plural: '',
          singular: ''
        } },
      patient: {
        labels: { name: '' },
        names: { singular: '' }
      },
      procedure: { names: {
          plural: '',
          singular: ''
        } },
      user: { names: {
          plural: '',
          singular: ''
        } },
      visit: { names: {
          plural: '',
          singular: ''
        } },
      vital: { names: {
          plural: '',
          singular: ''
        } }
    },
    navigation: {
      about: 'Información de HospitalRun',
      actions: {
        login: 'Ingresar',
        logout: 'Salir'
      },
      administration: 'Administracion',
      billing: 'Facturas',
      imaging: 'Radiografia',
      incident: '',
      inventory: 'Inventario',
      labs: 'Laboratorio',
      medication: 'Recetas medicas',
      patients: 'Pacientes',
      scheduling: '',
      subnav: {
        actions: '',
        addAppointment: 'Nueva cita',
        addressFields: 'Campos de dirección',
        admittedPatients: '',
        appointmentSearch: '',
        appointmentsCalendar: '',
        appointmentsThisWeek: '',
        completed: 'Completado',
        currentIncidents: '',
        customForms: '',
        dispense: 'Dispense',
        history: '',
        incidentCategories: '',
        inventoryReceived: 'Inventario recibido',
        invoices: 'Facturas',
        items: 'Items',
        loadDB: '',
        lookupLists: 'Lista de busuedas',
        missedAppointments: '',
        newIncident: '',
        newInvoice: 'Nueva factura',
        newPatient: 'Nuevo paciente',
        newRequest: 'New pedido',
        newUser: 'Nuevo usuario',
        outpatient: '',
        patientListing: 'Lista de pacientes',
        priceProfiles: 'Perfil de precios',
        prices: 'Precios',
        printHeader: '',
        reports: 'Reportes',
        requests: 'Pedidos',
        returnMedication: 'Devolver medicamento',
        scheduleSurgery: '',
        theaterSchedule: '',
        "today'sAppointments": '',
        userRoles: 'Roles',
        users: 'Usuarios',
        workflow: ''
      }
    },
    operationReport: {
      labels: {
        additionalNotes: '',
        assistant: '',
        caseComplexity: '',
        operationDescription: '',
        preOpPrimaryDiagnosis: '',
        preOpSecondaryDiagnosis: '',
        surgeon: '',
        surgeryDate: ''
      },
      messages: { reportSaved: '' },
      titles: {
        editTitle: '',
        newTitle: '',
        reportSaved: ''
      }
    },
    operativePlan: {
      buttons: { completePlan: '' },
      labels: {
        additionalNotes: '',
        admissionInstructions: '',
        caseComplexity: '',
        completedStatus: '',
        droppedStatus: '',
        operationDescription: '',
        plannedStatus: '',
        status: '',
        surgeon: ''
      },
      messages: {
        planCompleted: '',
        planSaved: ''
      },
      titles: {
        editTitle: '',
        newTitle: '',
        planCompleted: '',
        planSaved: ''
      }
    },
    patients: {
      buttons: {
        addContact: '',
        addExpense: '',
        addFamilyMember: '',
        addOperativePlan: '',
        backToPatients: '',
        download: '',
        editOperativePlan: '',
        newAppointment: '',
        newImaging: '',
        newLab: '',
        newMedication: '',
        newPatient: '',
        newPhoto: '',
        newVisit: '',
        patientCheckIn: '',
        scheduleSurgery: ''
      },
      labels: {
        admissionDate: '',
        admit: '',
        bloodType: '',
        caption: '',
        civilStatus: '',
        clinic: '',
        contacts: '',
        cost: '',
        dateOfBirth: '',
        dateProcessed: '',
        dischargeDate: '',
        dob: '',
        education: '',
        email: '',
        externalPatientId: '',
        firstName: '',
        income: '',
        insurance: '',
        lastName: '',
        middleName: '',
        monthlyCost: '',
        occupation: '',
        operativePlan: '',
        parent: '',
        patientDays: '',
        patientType: '',
        patientTypeCharity: '',
        patientTypePrivate: '',
        phone: '',
        placeOfBirth: '',
        primaryDiagnosis: '',
        referredBy: '',
        referredDate: '',
        relationship: '',
        relationships: '',
        religion: '',
        secondaryDiagnosis: '',
        sex: '',
        sexNotEntered: '',
        sources: '',
        status: '',
        totalMontlyExpense: ''
      },
      messages: {
        areYouSureDelete: '',
        createNewPatient: '',
        deletingPatient: '',
        noPatientsFound: '',
        notFoundQuickAdd: '',
        photoFileRequired: '',
        savedPatient: ''
      },
      navigation: {
        appointments: '',
        general: '',
        history: '',
        imaging: '',
        labs: '',
        medication: '',
        photos: '',
        socialWork: '',
        visits: ''
      },
      notes: {
        newNote: '',
        onBehalfOfCopy: 'a nombre de',
        onBehalfOfLabel: 'A nombre de',
        pleaseSelectAVisit: 'Por favor seleccione una visista',
        updateNote: ''
      },
      titles: {
        addContact: '',
        addPhoto: '',
        additionalContacts: '',
        admissionsDetail: '',
        admissionsSummary: '',
        admittedPatients: '',
        'delete': '',
        deleteContact: '',
        deleteExpense: '',
        deleteFamilyMember: '',
        deletePatientRecord: '',
        deletePhoto: '',
        diagnosticTesting: '',
        dischargesDetail: '',
        dischargesSummary: '',
        edit: '',
        editPhoto: '',
        expenses: '',
        familyInfo: '',
        familyInformation: '',
        'new': '',
        outpatientsForDate: '',
        patient: '',
        patientListing: '',
        patientReport: '',
        patientStatus: '',
        proceduresDetail: '',
        proceduresSummary: '',
        savedPatient: '',
        socialWork: '',
        todaysOutpatients: '',
        totalPatientDays: '',
        totalPatientDaysDetailed: '',
        visit: ''
      }
    },
    print: { invoice: {
        labels: {
          billedBy: '',
          billedDate: '',
          dateAdmitted: '',
          dateDischarged: '',
          dischargeNotes: '',
          patientAddress: '',
          patientAge: '',
          patientId: '',
          patientName: '',
          remarks: '',
          spacer: ''
        },
        messages: { whereConducted: '' },
        titles: {
          billingStatement: '',
          patientMember: '',
          patients: '',
          relContact: ''
        }
      } },
    procedures: {
      buttons: { addMedication: '' },
      labels: { medicationUsed: '' },
      messages: { saved: '' },
      titles: {
        addChargeItem: '',
        addMedicationUsed: '',
        deleteChargeItem: '',
        deleteMedicationUsed: '',
        edit: '',
        editChargeItem: '',
        editMedicationUsed: '',
        medicationUsed: '',
        'new': '',
        saved: ''
      }
    },
    reports: {
      labels: {
        admissionDate: '',
        allProcedures: '',
        completedBy: '',
        dischargeDate: '',
        examiner: '',
        images: '',
        labs: '',
        location: '',
        medications: '',
        nextAppointment: '',
        nextAppointments: '',
        notes: {
          author: '',
          date: '',
          title: ''
        },
        operativePlan: {
          description: '',
          instructions: '',
          procedures: '',
          title: ''
        },
        primaryDiagnosis: '',
        procedures: '',
        secondaryDiagnosis: '',
        visitDate: '',
        visitType: ''
      },
      messages: {
        'delete': '',
        saved: ''
      },
      titles: {
        dischargeReport: '',
        newDischargeReport: '',
        newOPDReport: '',
        opdReport: '',
        saved: ''
      }
    },
    user: {
      plusNewUser: '+ nuevo usuario',
      usersPageTile: 'Listado de usuarios'
    },
    visits: {
      buttons: {
        addDiagnosis: '',
        checkIn: '',
        checkOut: '',
        discharge: '',
        newAppointment: '',
        newDischargeReport: '',
        newOPDReport: '',
        newProcedure: '',
        newVitals: ''
      },
      labels: {
        appointment: '',
        authoredBy: '',
        checkInTime: '',
        checkOutTime: '',
        createNewPatient: '',
        diagnosis: '',
        examiner: '',
        finalDiagnosis: '',
        haveAppointment: '',
        haveDoneOrders: '',
        noAppointment: '',
        ordersDone: '',
        ordersNotDone: '',
        patientToCheckIn: '',
        procedure: '',
        procedureDate: '',
        reasonForVisit: '',
        reportType: '',
        status: '',
        statusAdmitted: '',
        statusCheckedIn: '',
        statusCheckedOut: '',
        statusDischarged: '',
        visitDate: '',
        visitInformation: '',
        visitType: ''
      },
      messages: {
        checkOut: '',
        checkedOut: '',
        discharged: '',
        patientCheckedIn: '',
        patientCreatedAndCheckedIn: '',
        visitAndPatientSaved: '',
        visitSaved: ''
      },
      navigation: {
        charges: '',
        notes: '',
        orders: '',
        procedures: '',
        reports: '',
        vitals: ''
      },
      titles: {
        additionalDiagnoses: '',
        checkOut: '',
        checkedIn: '',
        checkedOut: '',
        discharged: '',
        editVisit: '',
        newVisit: '',
        patientCheckIn: '',
        visitSaved: ''
      }
    },
    vitals: { labels: {
        dateRecorded: '',
        dbp: '',
        heartRate: '',
        height: '',
        respiratoryRate: '',
        sbp: '',
        temperature: '',
        weight: ''
      } }
  };
});
define("hospitalrun/locales/fr/translations", ["exports"], function (exports) {
  exports["default"] = {
    admin: {
      address: {
        address1Label: "Label de l'adresse 1",
        address2Label: "Label de l'adresse 2",
        address3Label: "Label de l'adresse 3",
        address4Label: "Label de l'adresse 4",
        addressLabel: 'Adresse',
        editTitle: "Options d'adresse",
        include1Label: "Label de l'include 1",
        include2Label: "Label de l'include 2",
        include3Label: "Label de l'include 3",
        include4Label: "Label de l'include 4",
        messages: { addressSaved: "Les options d'adresse ont été enregistrées" },
        newTitle: "Options d'adresse",
        titles: { optionsSaved: 'Options enregistrées' }
      },
      addressOptions: "Options d'adresse",
      customForms: {
        buttons: {
          addField: '',
          moveDown: '',
          moveUp: '',
          newForm: '',
          preview: ''
        },
        labels: {
          alwaysInclude: '',
          checkbox: '',
          colSpan: '',
          columns: '',
          customForm: '',
          dischargeReportFormType: '',
          formName: '',
          formType: '',
          incidentFormType: '',
          includeOtherOption: '',
          labFormType: '',
          label: '',
          newForm: '',
          opdReportFormType: '',
          operativePlanFormType: '',
          otherOptionLabel: '',
          patientFormType: '',
          property: '',
          radio: '',
          select: '',
          socialworkFormType: '',
          text: '',
          textarea: '',
          visitFormType: ''
        },
        messages: { formSaved: '' },
        titles: {
          checkboxValues: '',
          customForms: '',
          deleteForm: '',
          dropDownValues: '',
          editCustomForm: '',
          fields: '',
          formSaved: '',
          newCustomForm: '',
          radioValues: ''
        }
      },
      header: {
        editTitle: '',
        facilityName: '',
        headerLabel: '',
        headerLine1: '',
        headerLine2: '',
        headerLine3: '',
        logoURL: '',
        messages: { headerSaved: '' },
        newTitle: '',
        titles: { optionsSaved: '' }
      },
      loadDb: 'Importer une BD',
      loaddb: {
        displayAlertMessage: 'Veuillez sélectionner le fichier à télécharger.',
        displayAlertTitle: 'Sélectionner le fichier à télécharger.',
        editTitle: 'Importer une BD',
        errorDisplayAlertMessage: "La base de données ne pouvait pas être importée. L'erreur etait: {{error}}",
        errorDisplayAlertTitle: 'Erreur de chargement',
        progressMessage: 'Veuillez patienter durant le chargement de la base de données.',
        progressTitle: 'Chargement de la base de données en cours'
      },
      lookup: {
        aisleLocationList: "Emplacements de rayon d'inventaire",
        alertImportListMessage: 'Veuillez sélectionner le fichier à importer.',
        alertImportListSaveMessage: 'La liste de référence a été importée.',
        alertImportListSaveTitle: 'Liste importée',
        alertImportListTitle: 'Sélectionner le fichier à importer',
        alertImportListUpdateMessage: 'La liste de référence a été enregistrée.',
        alertImportListUpdateTitle: 'Liste enregistrée',
        anesthesiaTypes: "Types d'Anesthésie",
        anesthesiologists: 'Anesthésiologistes',
        billingCategories: 'Catégories de facturation',
        clinicList: 'Emplacements de la clinique',
        countryList: 'Pays',
        cptCodeList: 'Codes CPT',
        diagnosisList: 'Diagnostics',
        edit: { template: {
            addTitle: 'Ajouter une valeur',
            editTitle: 'Modifier la valeur',
            labelTitle: 'Valeur',
            updateButtonTextAdd: 'Ajouter',
            updateButtonTextUpdate: 'Mettre à jour'
          } },
        expenseAccountList: 'Comptes de dépense',
        imagingPricingTypes: "Types de prix d'imagerie",
        incidentDepartments: '',
        inventoryTypes: "Types d'inventaire",
        labPricingTypes: 'Types de prix de labo',
        pageTitle: 'Listes de référence',
        patientStatusList: 'Liste de statut de patient',
        physicianList: 'Médécins',
        procedureList: 'Procédures',
        procedureLocations: 'Emplacements des procédures',
        procedurePricingTypes: 'Types de prix de procédure',
        radiologists: 'Radiologistes',
        titles: { deleteLookupValue: '' },
        unitTypes: "Types d'unité",
        vendorList: 'Fournisseur',
        visitLocationList: 'Emplacements de visite',
        visitTypes: 'Types de visite',
        wardPricingTypes: 'Types de prix de service',
        warehouseList: "Emplacements d'inventaire"
      },
      lookupLists: 'Listes de référence',
      roles: {
        capability: {
          addAllergy: '',
          addAppointment: 'Ajouter un Rendez-vous',
          addBillingDiagnosis: '',
          addCharge: 'Ajouter une charge',
          addDiagnosis: 'Ajouter un diagnostic',
          addImaging: 'Ajouter une imagerie',
          addIncident: '',
          addIncidentCategory: '',
          addInventoryItem: "Ajouter un article d'inventaire",
          addInventoryPurchase: "Ajouter un achat d'inventaire",
          addInventoryRequest: "Ajouter une demande d'inventaire",
          addInvoice: 'Ajouter une facture',
          addLab: 'Ajouter un test labo',
          addMedication: 'Ajouter un médicament',
          addNote: '',
          addOperationReport: '',
          addOperativePlan: '',
          addPatient: 'Ajouter un patient',
          addPayment: 'Ajouter un paiement',
          addPhoto: 'Ajouter une photo',
          addPricing: 'Ajouter un Prix',
          addPricingProfile: 'Ajouter le profil de prix',
          addProcedure: '',
          addSocialwork: '',
          addVisit: 'Ajouter une visite',
          addVitals: 'Ajouter les signes vitaux',
          adjustInventoryLocation: "Ajuster la localisation de l'inventaire",
          admin: 'Administration',
          admitPatient: 'Admettre un patient',
          appointments: 'Rendez-vous',
          billing: 'Facturation',
          completeImaging: 'Completer une imagerie',
          completeLab: 'Completer un test labo',
          defineUserRoles: "Rôles d'utilisateur",
          deleteAppointment: 'Supprimer un rendez-vous',
          deleteDiagnosis: 'Supprimer un diagnostic',
          deleteImaging: 'Supprimer une Imagerie',
          deleteIncident: '',
          deleteIncidentCategory: '',
          deleteInventoryItem: "Supprimer un article d'inventaire",
          deleteInvoice: 'Supprimer une facture',
          deleteLab: 'Supprimer un test labo',
          deleteMedication: 'Supprimer un médicament',
          deleteNote: '',
          deletePatient: 'Supprimer un patient',
          deletePhoto: 'Supprimer une photo',
          deletePricing: 'Supprimer un Prix',
          deletePricingProfile: 'Supprimer le profil de prix',
          deleteProcedure: 'Supprimer une procédure',
          deleteSocialwork: 'Supprimer un travail social',
          deleteVisit: 'Supprimer une Visite',
          deleteVitals: 'Supprimer des signes vitaux',
          dischargePatient: 'Liberer un patient',
          editInvoice: 'Modifier la facture',
          fulfillInventory: "Traiter l'inventaire",
          fulfillMedication: 'Traiter une demande de médicaments',
          generateIncidentReport: '',
          imaging: 'Imagerie',
          incident: '',
          inventory: 'Inventaire',
          invoices: 'Factures',
          labs: 'Test Labo',
          loadDb: 'Charger la Base de données',
          manageIncidents: '',
          medication: 'Médicament',
          overrideInvoice: 'Remplacer la facture',
          patientReports: 'Rapports des patients',
          patients: 'Patients',
          pricing: 'Tarification',
          updateConfig: 'Mettre à jour les Configurations',
          visits: 'Visites'
        },
        messages: { roleSaved: 'Le rôle {{roleName}}  a été enregistré.' },
        titles: { roleSaved: 'Rôle enregistré' }
      },
      userRoles: '',
      users: 'Utilisateurs',
      visitForms: {
        labels: {
          followup: '',
          form: '',
          initial: '',
          visitType: ''
        },
        titles: { visitForms: '' }
      },
      workflow: {
        admissionDepositLabel: '',
        clinicPrepaymentLabel: '',
        editTitle: '',
        followupPrepaymentLabel: '',
        messages: { optionsSaved: '' },
        newTitle: '',
        outpatientImagingLabel: '',
        outpatientLabLabel: '',
        outpatientMedicationLabel: '',
        titles: { optionsSaved: '' },
        workflowLabel: ''
      }
    },
    alerts: {
      errorExclamation: '',
      pleaseWait: 'Veuillez attendre',
      reportError: '',
      warningExclamation: ''
    },
    allergies: {
      buttons: { addAllergy: '' },
      labels: {
        allergyName: '',
        patientAllergy: ''
      },
      titles: {
        addAllergy: '',
        editAllergy: ''
      }
    },
    application: {
      messages: { sessionExpired: '' },
      titles: { sessionExpired: '' }
    },
    appointments: {
      buttons: {
        newButton: '+ nouveau rendez-vous',
        scheduleSurgery: ''
      },
      calendarTitle: '',
      currentScreenTitle: 'Liste des rendez-vous',
      editTitle: 'Modifier le rendez-vous',
      labels: {
        noLocation: '',
        selectedStartingDate: ''
      },
      messages: {
        appointmentSaved: '',
        endTimeLaterThanStart: "Veuillez sélectionnez une heure de fin plus tard que l'heure de début."
      },
      missed: 'Rendez-vous manqués',
      newTitle: 'Nouveau rendez-vous',
      searchTitle: 'Rechercher les rendez-vous',
      sectionTitle: 'Rendez-vous',
      thisWeek: 'Rendez-vous de la semaine',
      titles: {
        appointmentSaved: '',
        editSurgicalAppointment: '',
        newSurgicalAppointment: '',
        theaterSchedule: ''
      },
      todayTitle: "Rendez-vous d'aujourd'hui"
    },
    billing: {
      alerts: {
        noInvoiceFound: '',
        noPricingItems: '',
        noPricingProfiles: ''
      },
      buttons: {
        addOverride: '',
        createInvoice: ''
      },
      labels: {
        actualCharges: '',
        discountAmount: '',
        discountPercentage: '',
        externalInvoiceNumber: '',
        hmoCom: '',
        insurance: '',
        paymentProfile: '',
        paymentsDeposits: '',
        pricingPanelOverrides: '',
        pricingProfile: ''
      }
    },
    buttons: {
      add: 'Ajouter',
      addItem: '',
      addLineItem: '',
      addValue: 'Ajouter une valeur',
      addVisit: 'Ajouter une visite',
      allRequests: 'Toutes les demandes',
      barcode: 'Code barre',
      cancel: 'Annuler',
      clear: '',
      close: 'Fermer',
      complete: 'Traiter',
      'delete': 'Supprimer',
      dispense: 'Dispenser',
      edit: '',
      filter: '',
      fulfill: 'Traiter',
      'import': 'Importer',
      loadFile: 'Télécharger le fichier',
      newItem: '+ nouvel article',
      newNote: 'Nouvelle note',
      newRequest: 'Nouvelle demande',
      newRequestPlus: '+ nouvelle demande',
      newUser: 'Nouvel utilisateur',
      ok: 'Ok',
      remove: 'Retirer',
      returnButton: 'Retourner',
      search: 'Rechercher',
      showAll: '',
      showFewer: '',
      update: 'Mettre à jour'
    },
    components: {
      chargesByTypeTab: { charges: '' },
      customFormManager: { buttons: { addForm: '' } },
      dateTimePicker: {
        amHour: '',
        midnight: '',
        noon: '',
        pmHour: ''
      },
      imageUpload: { messages: { selectValidImageFile: '' } },
      operativeProcedures: {
        buttons: { addProcedure: '' },
        labels: { procedure: '' },
        titles: { procedures: '' }
      },
      patientOrders: {
        buttons: {
          newImaging: '',
          newLab: '',
          newMedication: ''
        },
        labels: {
          imagingOrderType: '',
          labOrderType: '',
          medicationOrderType: '',
          orderType: ''
        }
      },
      priceList: { charges: '' },
      quantityCalc: { result: '' },
      quantityConv: {
        conversion: '',
        unit: ''
      },
      sortableColumn: { labels: { selectAll: '' } },
      takePhoto: {
        camera: '',
        how: '',
        labels: {
          takeAPicture: '',
          uploadAFile: ''
        },
        photo: '',
        preview: '',
        takePhoto: '',
        uploadFile: ''
      },
      upcomingAppointments: {
        labels: {
          date: '',
          location: '',
          type: '',
          'with': ''
        },
        titles: { upcomingAppointments: '' }
      }
    },
    customForms: {
      buttons: { addForm: '' },
      labels: { formToAdd: '' },
      titles: { addCustomForm: '' }
    },
    dashboard: {
      setup: '',
      title: 'Que voulez-vous faire?'
    },
    dates: {
      'long': '',
      longOmitDays: '',
      longOmitDaysPlural: '',
      longOmitDaysYears: '',
      longOmitYears: '',
      longPlural: '',
      'short': '',
      shortOmitYears: ''
    },
    diagnosis: {
      labels: {
        activeDiagnosis: '',
        date: '',
        diagnosis: '',
        secondaryDiagnosis: ''
      },
      titles: {
        addDiagnosis: '',
        editDiagnosis: ''
      }
    },
    errors: {
      accepted: '',
      blank: '',
      confirmation: '',
      empty: '',
      equalTo: '',
      even: '',
      exclusion: '',
      greaterThan: '',
      greaterThanOrEqualTo: '',
      inclusion: '',
      invalid: '',
      invalidNumber: '',
      lessThan: '',
      lessThanOrEqualTo: '',
      notANumber: '',
      notAnInteger: '',
      odd: '',
      otherThan: '',
      present: '',
      result: '',
      tooLong: '',
      tooShort: '',
      wrongLength: ''
    },
    headings: { chargedItems: '' },
    imaging: {
      alerts: {
        completedMessage: "La demande d'imagerie a été traitée.",
        completedTitle: "Demande d'imagerie traitée",
        savedMessage: "La demande d'imagerie a été enregistrée.",
        savedTitle: "Demande d'imagerie enregistrée"
      },
      buttons: { newButton: '+ nouvelle imagerie' },
      labels: {
        addNewVisit: '--Ajouter une nouvelle visite--',
        radiologist: 'Radiologiste'
      },
      messages: { noCompleted: 'Aucun article traité retrouvé.' },
      pageTitle: "Demandes d'imagerie",
      sectionTitle: 'Imagerie',
      titles: {
        completedImaging: 'Imagerie traitée',
        editTitle: "Modifier la demande d'imagerie",
        newTitle: "Nouvelle demande d'imagerie"
      }
    },
    incident: {
      buttons: {
        add: '',
        addForm: '',
        addItem: '',
        cancel: '',
        'delete': '',
        download: '',
        edit: '',
        'export': '',
        generateRep: '',
        newAttachment: '',
        newCategory: '',
        newIncident: '',
        newNote: ''
      },
      labels: {
        actions: '',
        addedBy: '',
        category: '',
        categoryItem: '',
        date: '',
        dateRecorded: '',
        department: '',
        description: '',
        endDate: '',
        givenBy: '',
        howToAddAttachment: '',
        incidentDate: '',
        incidentId: '',
        item: '',
        lastUpdated: '',
        note: '',
        patientId: '',
        patientImpacted: '',
        reportType: '',
        reportedBy: '',
        reportedDate: '',
        reportedTo: '',
        sentinelEvent: '',
        startDate: '',
        status: '',
        statusActive: '',
        statusClosed: '',
        statusFollowup: '',
        statusReported: '',
        title: '',
        total: '',
        updatedBy: ''
      },
      messages: {
        attachmentFileRequired: '',
        createNew: '',
        createNewIncidentCategory: '',
        fillIn: '',
        incidentCategorySaved: '',
        noClosedIncidents: '',
        noIncidentCategoriesFound: '',
        noIncidents: '',
        saved: '',
        selectExistingPatient: ''
      },
      titles: {
        addAttachment: '',
        addCategoryItem: '',
        addNote: '',
        attachments: '',
        closed: '',
        current: '',
        deleteAttachment: '',
        deleteIncident: '',
        deleteIncidentCategory: '',
        deleteItem: '',
        deleteNote: '',
        editAttachment: '',
        editIncident: '',
        editIncidentCategory: '',
        editNote: '',
        general: '',
        history: '',
        incidentCategories: '',
        incidentCategoryItem: '',
        incidentCategoryName: '',
        incidentCategorySaved: '',
        incidentSaved: '',
        incidents: '',
        incidentsByCategory: '',
        incidentsByDepartment: '',
        newIncident: '',
        newIncidentCategory: '',
        notes: '',
        reports: ''
      }
    },
    inventory: {
      edit: {
        cost: 'Coût par unité:',
        delivered: 'Livré à:',
        location: 'Emplacement ajusté:',
        prescription: 'Ordonnance pour:',
        pulled: 'Tiré de:',
        quantity: 'Quantité après traitement:',
        reason: 'Motif:',
        returned: 'Retourné par le patient:',
        transferredFrom: 'Transféré de:',
        transferredTo: 'Transféré à:'
      },
      labels: {
        action: 'Action',
        add: 'Ajouter',
        addAdjustmentType: '',
        adjust: 'Ajuster',
        adjustmentDate: "Date d'ajustement",
        adjustmentFor: 'Ajustement pour',
        adjustmentType: "Type d'ajustement",
        aisle: 'Rayon',
        aisleLocation: 'Emplacement du rayon',
        allInventory: "Toute l'inventaire",
        allItems: '',
        availableQuantity: '',
        billTo: 'Facturer à',
        consumePurchases: 'Utiliser les achats',
        consumptionRate: "Taux d'utilisation",
        cost: 'Coût',
        costPerUnit: 'Coût par unité',
        crossReference: 'Reference',
        currentQuantity: 'Quantité actuelle',
        dateCompleted: 'Date de traitement',
        dateEffective: "Date d'effet",
        dateEnd: 'Date de fin',
        dateReceived: 'Date de réception',
        dateStart: 'Date de debut',
        dateTransferred: 'Date  de transfert',
        daysLeft: 'Nombre de jours restant',
        deleteItem: "Supprimer l'article",
        deliveryAisle: 'Rayon de livraison',
        deliveryLocation: 'Emplacement de livraison',
        details: 'Détails',
        distributionUnit: 'Unité de distribution',
        editItem: "Modifier l'article",
        expense: 'Dépenses pour',
        expirationDate: "Date d'expiration",
        fulfillRequest: 'Traiter la demande',
        fulfillRequestNow: 'Traiter la demande maintenant',
        gift: 'Don en nature',
        giftInKindNo: 'N',
        giftInKindYes: 'O',
        giftUsage: 'Utilisation de don en nature',
        inventoryConsumed: 'Inventaire utilisé',
        inventoryItem: 'Article à inventorier',
        inventoryObsolence: 'Inventory Obsolence',
        invoiceItems: 'Articles de facture',
        invoiceLineItem: 'Article de facture',
        invoiceNumber: 'Numero de facture',
        item: 'Article',
        itemNumber: "Numero d'article",
        items: 'Articles',
        location: 'Emplacement',
        locations: 'Emplacements',
        markAsConsumed: 'Marqué comme utilisé',
        name: 'Nom',
        newItem: 'Nouvel article',
        originalQuantity: 'Quantité originale',
        print: 'Imprimer',
        printBarcode: 'Imprimer le code barre',
        printer: 'Imprimante',
        pullFrom: 'Tirer de',
        purchaseCost: "Coût d'achat",
        purchaseInfo: "Détails de l'achat",
        purchases: 'Achats',
        quantity: 'Quantité ({{unit}})',
        quantityAvailable: 'Quantité disponible',
        quantityOnHand: 'Quantité en main',
        quantityRequested: 'Quantité demandée',
        rank: 'Rang',
        reason: 'Motif',
        remove: 'Retirer',
        removeAdjustmentType: '',
        reorderPoint: 'Point de commande',
        requestedItems: 'Articles demandés',
        returnAdjustmentType: '',
        returnToVendorAdjustmentType: '',
        salePricePerUnit: 'Prix de vente unitaire',
        save: 'Enregistrer',
        serialNumber: 'Numéro de série / lot',
        total: 'Total',
        totalCost: 'Coût total',
        totalReceived: 'Total reçu: {{total}}',
        transaction: 'Transaction',
        transactions: 'Transactions',
        transfer: 'Transférer',
        transferFrom: 'Transféré de',
        transferTo: "Transférer à l'emplacement",
        transferToAisle: "Transférer à l'emplacement du rayon",
        unit: 'Unité',
        unitCost: 'Coût unitaire',
        vendor: 'Fournisseur',
        vendorItemNumber: "Numéro d'article fournisseur",
        writeOffAdjustmentType: '',
        xref: 'XRef'
      },
      messages: {
        adjust: 'Veuillez ajuster les quantités sur le ou les emplacement(s) appropriée(s) pour tenir compte de la différence de {{difference}}.',
        createRequest: 'Créer une nouvelle demande?',
        itemNotFound: "L'article d'inventaire <strong>{{item}}</strong> ne pouvait pas être retrouvé.<br>Si vous voulez créer un nouvel article d'inventaire, veuillez saisir les informations ci-dessous. <br>Sinon, appuyez sur le bouton Annuler pour retourner.",
        loading: 'Chargement des transactions en cours…',
        noItems: 'Aucun article retrouvé.',
        noRequests: 'Aucune demande retrouvée.',
        purchaseSaved: "Les achats d'inventaire ont été enregistrés avec succès.",
        quantity: 'La quantité totale de <strong>({{quantity}})</strong> ne correspond pas à la quantité totale dans les emplacements <strong>({{locationQuantity}})</strong>.',
        removeItem: 'Etes-vous sûr de vouloir retirer cet article de cette facture?',
        removeItemRequest: 'Etes-vous sûr de vouloir supprimer cet article de cette demande?',
        requestFulfilled: "La demande d'inventaire a été traitée.",
        requestUpdated: "La demande d'inventaire a été mis à jour.",
        warning: "Veuillez remplir les champs obligatoires (marqués d'un *) et corriger les erreurs avant d'ajouter."
      },
      reports: {
        adjustment: 'Ajustement détaillée',
        daysSupply: 'Stock restant (en nombre de jours)',
        expenseDetail: 'Détails des dépenses',
        expenseSum: 'Résumé des dépenses',
        expiration: "Date d'expiration",
        'export': 'Exporter un rapport',
        fields: 'Champs à inclure',
        finance: 'Résumé des finances',
        generate: 'Créer un rapport',
        invLocation: 'Inventaire par emplacement',
        invValuation: "Valorisation de l'inventaire",
        purchaseDetail: "Détails de l'achat",
        purchaseSum: "Résumé de l'achat",
        reportType: 'Type de rapport',
        rows: {
          adjustments: 'Ajustements',
          adjustmentsTotal: 'Ajustements totaux',
          balanceBegin: "Solde d'ouverture",
          balanceEnd: 'Solde de clôture',
          category: 'Catégorie',
          consumed: 'Utilisé',
          consumedGik: 'GiK utilisé',
          consumedGikTotal: 'GiK total utilisé',
          consumedPuchases: 'Achats utilisés',
          consumedPurchasesTotal: 'Achats totaux utilisés',
          consumedTotal: 'Total utilisé',
          errInFinSum: 'Erreur dans _generateFinancialSummaryReport: ',
          errInFindPur: 'Erreur dans _findInventoryItemsByPurchase: ',
          errInFindReq: 'Erreur dans _findInventoryItemsByRequest: ',
          expensesFor: 'Dépenses pour: ',
          noAccount: '(Pas de compte)',
          subtotal: 'Sous-total: ',
          subtotalFor: 'Sous-total pour {{category}} - {{account}}: ',
          total: 'Total: ',
          totalFor: 'Total pour {{var}}: ',
          totalPurchases: 'Achats totaux',
          transfer1: '{{quantity}} de {{location}}',
          trasnfer2: 'De: {{source}} A: {{target}}'
        },
        stockTransferDetail: 'Transfert détaillé du stock',
        stockTransferSum: 'Résumé du transfert du stock',
        stockUsageDetail: 'Utilisation détaillée du stock',
        stockUsageSum: "Résumé de l'utilisation du stock",
        titleDateRange: '',
        titleSingleDate: ''
      },
      titles: {
        addPurchase: 'Ajouter un achat',
        addRequest: 'Nouvelle demande',
        adjustment: 'Ajustement',
        editPurchase: "Modifier l'achat",
        editRequest: 'Modifier la demande',
        inventoryItem: "Nouvel article d'inventaire",
        inventoryReport: "Rapport d'inventaire",
        purchaseSaved: "Achats d'inventaire enregistrés",
        quickAddTitle: "Nouvel article d'inventaire",
        removeItem: "Retirer l'article",
        requestFulfilled: 'Demande traitée',
        requestUpdated: 'Demande mis à jour',
        transfer: 'Transférer les articles',
        warning: 'Attention!!!!!'
      }
    },
    labels: {
      action: 'Action',
      actions: 'Actions',
      addNewOutpatientVisit: '--Ajouter une nouvelle consultation externe--',
      address: '',
      age: 'Age',
      allDay: 'Toute la journée',
      amount: '',
      anesthesia: 'Anesthésie',
      assisting: 'Assistant',
      balanceDue: '',
      billDate: '',
      billTo: 'Facturer à',
      category: '',
      completed: 'Traité',
      country: '',
      cptcode: 'Code CPT',
      creditTo: '',
      date: 'Date',
      dateCompleted: 'Date de traitement',
      dateOfBirth: 'Date de naissance',
      dateOfBirthShort: 'DdN',
      datePaid: '',
      dateRequested: 'Date de demande',
      'delete': 'Supprimer',
      deleteRequest: 'Supprimer la demande',
      deleteUser: 'Supprimer un utilisateur',
      department: '',
      description: 'Description',
      discount: '',
      displayName: 'Nom à afficher',
      docRead: 'Documents lus',
      docWritten: 'Documents écrits',
      edit: 'Modifier',
      editUser: 'Modifier un utilisateur',
      email: 'Email',
      endDate: 'Date de fin',
      endTime: 'Heure de fin',
      excess: '',
      expenseTo: '',
      fileLoadSuccessful: 'Téléchargement reussi',
      fileName: '',
      fileToLoad: 'Téléchargement de fichier',
      fulfill: 'Traiter',
      fulfillRequest: 'Traiter la demande',
      fulfillRequestNow: 'Traiter la demande maintenant',
      fulfilled: 'Traité',
      grandTotal: '',
      id: 'Id',
      imageOrders: "Demandes d'imagerie",
      imagingType: "Type d'imagerie",
      importFile: 'Importer un fichier',
      invoiceId: '',
      labOrders: 'Demandes de labo',
      lineItems: '',
      loading: 'Chargement',
      location: 'Emplacement',
      lookupType: 'Type de référence',
      medication: 'Médicament',
      name: 'Nom',
      newUser: 'Nouvel utilisateur',
      note: '',
      notes: 'Notes',
      number: '',
      on: 'sur',
      password: 'Mot de passe',
      patient: 'Patient',
      payments: '',
      physician: 'Médecin',
      prescriber: 'prescripteur',
      prescription: 'Ordonnance',
      prescriptionDate: 'Date de prescription',
      price: '',
      print: '',
      procedures: 'Procédures',
      provider: 'Fournisseur',
      pullFrom: 'Tirer de',
      quantity: 'Quantité',
      remarks: '',
      requestedBy: 'Demandé par',
      requestedOn: 'Demandé le',
      requests: 'Demandes',
      result: 'Resultat',
      results: 'Resultats',
      role: 'Rôle',
      search: '',
      sex: 'Sexe',
      startDate: 'Date de debut',
      startTime: 'Heure de debut',
      status: 'Statut',
      takenBy: '',
      total: '',
      type: 'Type',
      userCanAddNewValue: 'Utilisateur peut ajouter de nouvelles valeurs',
      username: "Nom d'utilisateur",
      value: 'Valeur',
      view: '',
      visit: 'Visite',
      'with': 'Avec'
    },
    labs: {
      alerts: {
        requestCompletedMessage: 'La demande de labo a été traitée.',
        requestCompletedTitle: 'Demande de labo traitée',
        requestSavedMessage: 'La demande de labo a été enregistrée.',
        requestSavedTitle: 'Demande de labo enregistrée'
      },
      buttons: { newButton: '+ nouveau labo' },
      completedTitle: 'Labos traités',
      deleteTitle: 'Supprimer la demande',
      editTitle: 'Modifier la demande de labo',
      labels: {
        addNewVisit: '--Ajouter une nouvelle visite--',
        labType: 'Type de labo'
      },
      messages: {
        createNewRecord: 'Créer un nouveau dossier?',
        noCompleted: 'Aucun article traité retrouvé.',
        noItemsFound: 'Aucun labo retrouvé.'
      },
      newTitle: 'Nouvelle demande de labo',
      requestsTitle: 'Demandes de labo',
      sectionTitle: 'Labos'
    },
    loading: {
      messages: {
        '0': '',
        '1': '',
        '2': '',
        '3': '',
        '4': '',
        '5': '',
        '6': '',
        '7': '',
        '8': '',
        '9': '',
        '10': '',
        '11': ''
      },
      progressBar: { progress: '' }
    },
    login: {
      labels: {
        password: 'Mot de passe',
        signIn: 'Connexion',
        username: "Nom d'utilisateur"
      },
      messages: {
        error: "Nom d'utilisateur ou mot de passe est incorrect.",
        signIn: 'veuillez-vous connecter'
      }
    },
    medication: {
      alerts: {
        fulfilledTitle: 'Demande de médicament traitée',
        returnedMessage: 'Le médicament a été marqué comme retourné.',
        returnedTitle: 'Médicament retourné',
        savedMessage: 'Le dossier de médicament a été enregistré.',
        savedTitle: 'Demande de médicament enregistrée'
      },
      buttons: {
        dispenseMedication: 'dispenser un médicament',
        newButton: '+ nouvelle demande',
        returnMedication: 'retourner un médicament'
      },
      labels: {
        adjustmentDate: "Date d'ajustement",
        creditToAccount: 'Créditer le compte',
        quantityDispensed: 'Quantité dispensé',
        quantityDistributed: 'Quantité distribué',
        quantityRequested: 'Quantité demandé',
        quantityToReturn: 'Quantité à retourner',
        refills: 'Renouvellements',
        returnAisle: 'Rayon de retour',
        returnLocation: 'Emplacement de retour',
        returnReason: 'Motif/notes du retour'
      },
      messages: { createNew: 'Créer une nouvelle demande de médicament?' },
      pageTitle: 'Demandes de médicament',
      returnMedication: 'Retourner un médicament',
      sectionTitle: 'Médicament',
      titles: {
        completedMedication: 'Médicament traitée',
        editMedicationRequest: 'Modifier une demande de médicament',
        newMedicationRequest: 'Nouvelle demande de médicament'
      }
    },
    messages: {
      createNewRecord: 'Créer un nouveau dossier?',
      createNewUser: 'Créer un nouvel utilisateur?',
      'delete': '',
      delete_plural: '',
      delete_singular: '',
      forAuthorizedPersons: 'Ce rapport est destiné uniquement aux personnes autorisées.',
      newPatientHasToBeCreated: 'Un nouveau patient doit être crée...Veuillez attendre...',
      noHistoryAvailable: 'Aucune historique disponible.',
      noItemsFound: 'Aucun article retrouvé.',
      noNotesAvailable: 'Aucune note clinique supplémentaire disponible pour cette visite.',
      noUsersFound: 'Aucun utilisateur retrouvé.',
      onBehalfOf: 'de la part de',
      reportError: '',
      requiredFieldsCorrectErrors: '',
      saveActionException: '',
      sorry: 'Désolé, quelque chose a mal tourné ...',
      userHasBeenSaved: "L'utilisateur a été enregistré.",
      userSaved: 'Utilisateur enregistré'
    },
    models: {
      appointment: {
        labels: {
          allDay: '',
          appointmentDate: '',
          appointmentType: '',
          endDate: '',
          location: '',
          notes: '',
          patient: '',
          provider: '',
          startDate: '',
          status: '',
          type: ''
        },
        names: {
          plural: '',
          singular: ''
        }
      },
      attachment: { names: {
          plural: '',
          singular: ''
        } },
      form: { names: {
          plural: '',
          singular: ''
        } },
      imaging: {
        names: '',
        request: {
          plural: '',
          singular: ''
        }
      },
      incident: { names: {
          plural: '',
          singular: ''
        } },
      item: { names: {
          plural: '',
          singular: ''
        } },
      lab: {
        names: {
          plural: '',
          singular: ''
        },
        request: {
          plural: '',
          singular: ''
        }
      },
      medication: {
        names: {
          plural: '',
          singular: ''
        },
        request: {
          plural: '',
          singular: ''
        }
      },
      note: { names: {
          plural: '',
          singular: ''
        } },
      patient: {
        labels: { name: '' },
        names: { singular: '' }
      },
      procedure: { names: {
          plural: '',
          singular: ''
        } },
      user: { names: {
          plural: '',
          singular: ''
        } },
      visit: { names: {
          plural: '',
          singular: ''
        } },
      vital: { names: {
          plural: '',
          singular: ''
        } }
    },
    navigation: {
      about: 'À propos de HospitalRun',
      actions: {
        login: 'Connexion',
        logout: 'Deconnexion'
      },
      administration: 'Administration',
      billing: 'Facturation',
      imaging: 'Imagerie',
      incident: '',
      inventory: 'Inventaire',
      labs: 'Labos',
      medication: 'Médicament',
      patients: 'Patients',
      scheduling: '',
      subnav: {
        actions: '',
        addAppointment: 'Ajouter un rendez-vous',
        addressFields: "Champs d'adresse",
        admittedPatients: 'patients admis',
        appointmentSearch: '',
        appointmentsCalendar: '',
        appointmentsThisWeek: '',
        completed: 'Traité',
        currentIncidents: '',
        customForms: '',
        dispense: 'Dispenser',
        history: '',
        incidentCategories: '',
        inventoryReceived: 'Inventaire reçu',
        invoices: 'Factures',
        items: 'Articles',
        loadDB: '',
        lookupLists: 'Listes de référence',
        missedAppointments: '',
        newIncident: '',
        newInvoice: 'Nouvelle facture',
        newPatient: 'Nouveau patient',
        newRequest: 'Nouvelle demande',
        newUser: 'Nouvel utilisateur',
        outpatient: '',
        patientListing: 'Liste des patients',
        priceProfiles: 'Profils de prix',
        prices: 'Prix',
        printHeader: '',
        reports: 'Rapports',
        requests: 'Demandes',
        returnMedication: 'Retourner un Médicament',
        scheduleSurgery: '',
        theaterSchedule: '',
        "today'sAppointments": '',
        userRoles: "Rôles de l'utilisateur",
        users: 'Utilisateurs',
        workflow: ''
      }
    },
    operationReport: {
      labels: {
        additionalNotes: '',
        assistant: '',
        caseComplexity: '',
        operationDescription: '',
        preOpPrimaryDiagnosis: '',
        preOpSecondaryDiagnosis: '',
        surgeon: '',
        surgeryDate: ''
      },
      messages: { reportSaved: '' },
      titles: {
        editTitle: '',
        newTitle: '',
        reportSaved: ''
      }
    },
    operativePlan: {
      buttons: { completePlan: '' },
      labels: {
        additionalNotes: '',
        admissionInstructions: '',
        caseComplexity: '',
        completedStatus: '',
        droppedStatus: '',
        operationDescription: '',
        plannedStatus: '',
        status: '',
        surgeon: ''
      },
      messages: {
        planCompleted: '',
        planSaved: ''
      },
      titles: {
        editTitle: '',
        newTitle: '',
        planCompleted: '',
        planSaved: ''
      }
    },
    patients: {
      buttons: {
        addContact: '',
        addExpense: '',
        addFamilyMember: '',
        addOperativePlan: '',
        backToPatients: '',
        download: '',
        editOperativePlan: '',
        newAppointment: '',
        newImaging: '',
        newLab: '',
        newMedication: '',
        newPatient: '',
        newPhoto: '',
        newVisit: '',
        patientCheckIn: '',
        scheduleSurgery: ''
      },
      labels: {
        admissionDate: '',
        admit: '',
        bloodType: '',
        caption: '',
        civilStatus: '',
        clinic: '',
        contacts: '',
        cost: '',
        dateOfBirth: '',
        dateProcessed: '',
        dischargeDate: '',
        dob: '',
        education: '',
        email: '',
        externalPatientId: '',
        firstName: '',
        income: '',
        insurance: '',
        lastName: '',
        middleName: '',
        monthlyCost: '',
        occupation: '',
        operativePlan: '',
        parent: '',
        patientDays: '',
        patientType: '',
        patientTypeCharity: '',
        patientTypePrivate: '',
        phone: '',
        placeOfBirth: '',
        primaryDiagnosis: '',
        referredBy: '',
        referredDate: '',
        relationship: '',
        relationships: '',
        religion: '',
        secondaryDiagnosis: '',
        sex: '',
        sexNotEntered: '',
        sources: '',
        status: '',
        totalMontlyExpense: ''
      },
      messages: {
        areYouSureDelete: '',
        createNewPatient: '',
        deletingPatient: '',
        noPatientsFound: '',
        notFoundQuickAdd: '',
        photoFileRequired: '',
        savedPatient: ''
      },
      navigation: {
        appointments: '',
        general: '',
        history: '',
        imaging: '',
        labs: '',
        medication: '',
        photos: '',
        socialWork: '',
        visits: ''
      },
      notes: {
        newNote: '',
        onBehalfOfCopy: 'de la part de',
        onBehalfOfLabel: 'De la part de',
        pleaseSelectAVisit: 'Veuillez sélectionner une visite',
        updateNote: ''
      },
      titles: {
        addContact: '',
        addPhoto: '',
        additionalContacts: '',
        admissionsDetail: '',
        admissionsSummary: '',
        admittedPatients: '',
        'delete': '',
        deleteContact: '',
        deleteExpense: '',
        deleteFamilyMember: '',
        deletePatientRecord: '',
        deletePhoto: '',
        diagnosticTesting: '',
        dischargesDetail: '',
        dischargesSummary: '',
        edit: '',
        editPhoto: '',
        expenses: '',
        familyInfo: '',
        familyInformation: '',
        'new': '',
        outpatientsForDate: '',
        patient: '',
        patientListing: '',
        patientReport: '',
        patientStatus: '',
        proceduresDetail: '',
        proceduresSummary: '',
        savedPatient: '',
        socialWork: '',
        todaysOutpatients: '',
        totalPatientDays: '',
        totalPatientDaysDetailed: '',
        visit: ''
      }
    },
    print: { invoice: {
        labels: {
          billedBy: '',
          billedDate: '',
          dateAdmitted: '',
          dateDischarged: '',
          dischargeNotes: '',
          patientAddress: '',
          patientAge: '',
          patientId: '',
          patientName: '',
          remarks: '',
          spacer: ''
        },
        messages: { whereConducted: '' },
        titles: {
          billingStatement: '',
          patientMember: '',
          patients: '',
          relContact: ''
        }
      } },
    procedures: {
      buttons: { addMedication: '' },
      labels: { medicationUsed: '' },
      messages: { saved: '' },
      titles: {
        addChargeItem: '',
        addMedicationUsed: '',
        deleteChargeItem: '',
        deleteMedicationUsed: '',
        edit: '',
        editChargeItem: '',
        editMedicationUsed: '',
        medicationUsed: '',
        'new': '',
        saved: ''
      }
    },
    reports: {
      labels: {
        admissionDate: '',
        allProcedures: '',
        completedBy: '',
        dischargeDate: '',
        examiner: '',
        images: '',
        labs: '',
        location: '',
        medications: '',
        nextAppointment: '',
        nextAppointments: '',
        notes: {
          author: '',
          date: '',
          title: ''
        },
        operativePlan: {
          description: '',
          instructions: '',
          procedures: '',
          title: ''
        },
        primaryDiagnosis: '',
        procedures: '',
        secondaryDiagnosis: '',
        visitDate: '',
        visitType: ''
      },
      messages: {
        'delete': '',
        saved: ''
      },
      titles: {
        dischargeReport: '',
        newDischargeReport: '',
        newOPDReport: '',
        opdReport: '',
        saved: ''
      }
    },
    user: {
      plusNewUser: '+ nouvel utilisateur',
      usersPageTile: 'Liste des Utilisateurs'
    },
    visits: {
      buttons: {
        addDiagnosis: '',
        checkIn: '',
        checkOut: '',
        discharge: '',
        newAppointment: '',
        newDischargeReport: '',
        newOPDReport: '',
        newProcedure: '',
        newVitals: ''
      },
      labels: {
        appointment: '',
        authoredBy: '',
        checkInTime: '',
        checkOutTime: '',
        createNewPatient: '',
        diagnosis: '',
        examiner: '',
        finalDiagnosis: '',
        haveAppointment: '',
        haveDoneOrders: '',
        noAppointment: '',
        ordersDone: '',
        ordersNotDone: '',
        patientToCheckIn: '',
        procedure: '',
        procedureDate: '',
        reasonForVisit: '',
        reportType: '',
        status: '',
        statusAdmitted: '',
        statusCheckedIn: '',
        statusCheckedOut: '',
        statusDischarged: '',
        visitDate: '',
        visitInformation: '',
        visitType: ''
      },
      messages: {
        checkOut: '',
        checkedOut: '',
        discharged: '',
        patientCheckedIn: '',
        patientCreatedAndCheckedIn: '',
        visitAndPatientSaved: '',
        visitSaved: ''
      },
      navigation: {
        charges: '',
        notes: '',
        orders: '',
        procedures: '',
        reports: '',
        vitals: ''
      },
      titles: {
        additionalDiagnoses: '',
        checkOut: '',
        checkedIn: '',
        checkedOut: '',
        discharged: '',
        editVisit: '',
        newVisit: '',
        patientCheckIn: '',
        visitSaved: ''
      }
    },
    vitals: { labels: {
        dateRecorded: '',
        dbp: '',
        heartRate: '',
        height: '',
        respiratoryRate: '',
        sbp: '',
        temperature: '',
        weight: ''
      } }
  };
});
define('hospitalrun/locales/pt-BR/translations', ['exports'], function (exports) {
  exports['default'] = {
    admin: {
      address: {
        address1Label: 'Rótulo Endereço 1',
        address2Label: 'Rótulo Endereço 2',
        address3Label: 'Rótulo Endereço 3',
        address4Label: 'Rótulo Endereço 4',
        addressLabel: 'Endereço',
        editTitle: 'Opções de Endereço',
        include1Label: 'Rótulo Include 1',
        include2Label: 'Rótulo Include 2',
        include3Label: 'Rótulo Include 3',
        include4Label: 'Rótulo Include 4',
        messages: { addressSaved: 'As opções de endereço foram salvas' },
        newTitle: 'Opções de Endereço',
        titles: { optionsSaved: 'Opções Salvas' }
      },
      addressOptions: 'Opções de Endereço',
      customForms: {
        buttons: {
          addField: '',
          moveDown: '',
          moveUp: '',
          newForm: '',
          preview: ''
        },
        labels: {
          alwaysInclude: '',
          checkbox: '',
          colSpan: '',
          columns: '',
          customForm: '',
          dischargeReportFormType: '',
          formName: '',
          formType: '',
          incidentFormType: '',
          includeOtherOption: '',
          labFormType: '',
          label: '',
          newForm: '',
          opdReportFormType: '',
          operativePlanFormType: '',
          otherOptionLabel: '',
          patientFormType: '',
          property: '',
          radio: '',
          select: '',
          socialworkFormType: '',
          text: '',
          textarea: '',
          visitFormType: ''
        },
        messages: { formSaved: '' },
        titles: {
          checkboxValues: '',
          customForms: '',
          deleteForm: '',
          dropDownValues: '',
          editCustomForm: '',
          fields: '',
          formSaved: '',
          newCustomForm: '',
          radioValues: ''
        }
      },
      header: {
        editTitle: '',
        facilityName: '',
        headerLabel: '',
        headerLine1: '',
        headerLine2: '',
        headerLine3: '',
        logoURL: '',
        messages: { headerSaved: '' },
        newTitle: '',
        titles: { optionsSaved: '' }
      },
      loadDb: 'Carregar DB',
      loaddb: {
        displayAlertMessage: 'Por favor Selecione o Arquivo para Carregar.',
        displayAlertTitle: 'Selecione o Arquivo para Carregar',
        editTitle: 'Carregando BD',
        errorDisplayAlertMessage: 'O banco de dados não foi carregado. O erro foi: {{error}}',
        errorDisplayAlertTitle: 'Erro ao carregar',
        progressMessage: 'Por favor aguarde enquanto o seu banco de dados é carregado.',
        progressTitle: 'Carregando Banco de Dados'
      },
      lookup: {
        aisleLocationList: 'Localização de Corredores no Inventário',
        alertImportListMessage: 'Por favor Selecione o arquivo para importação.',
        alertImportListSaveMessage: 'A lista de pesquisa foi importada.',
        alertImportListSaveTitle: 'Lista Importdada',
        alertImportListTitle: 'Selecione o arquivo para importação',
        alertImportListUpdateMessage: 'A lista de pesquisa foi salva.',
        alertImportListUpdateTitle: 'Lista Salva',
        anesthesiaTypes: 'Tipos de Anestesia',
        anesthesiologists: 'Anestesiologista',
        billingCategories: 'Categorias de Faturamento',
        clinicList: 'Localização de Clínicas',
        countryList: 'Países',
        cptCodeList: 'Códigos CPT',
        diagnosisList: 'Diagnósticos',
        edit: { template: {
            addTitle: 'Adicionar Valor',
            editTitle: 'Editar Valor',
            labelTitle: 'Valor',
            updateButtonTextAdd: 'Adicionar',
            updateButtonTextUpdate: 'Atualizar'
          } },
        expenseAccountList: 'Contas de Despesas',
        imagingPricingTypes: 'Tipos de Preço Imagem',
        incidentDepartments: '',
        inventoryTypes: 'Tipos de Inventário',
        labPricingTypes: 'Tipos de Preço Laboratório',
        pageTitle: 'Listas de Pesquisa',
        patientStatusList: 'Lista de Situação do Paciente',
        physicianList: 'Médicos',
        procedureList: 'Procedimentos',
        procedureLocations: 'Localização de Procedimentos',
        procedurePricingTypes: 'Tipos de Preço Procedimento',
        radiologists: 'Radiologista',
        titles: { deleteLookupValue: '' },
        unitTypes: 'Tipos de Unidade',
        vendorList: 'Fornecedor',
        visitLocationList: 'Localização dos Visitantes',
        visitTypes: 'Tipos de Visita',
        wardPricingTypes: 'Tipos de Preços Enfermaria',
        warehouseList: 'Locais de Inventário'
      },
      lookupLists: 'Lista de Pesquisas',
      roles: {
        capability: {
          addAllergy: '',
          addAppointment: 'Adicionar Compromissos',
          addBillingDiagnosis: '',
          addCharge: 'Adicionar Cobrança',
          addDiagnosis: 'Adicionar Diagnóstico',
          addImaging: 'Adicionar Imagem',
          addIncident: '',
          addIncidentCategory: '',
          addInventoryItem: 'Adicionar Item de Inventário',
          addInventoryPurchase: 'Adicionar Compra de Inventário',
          addInventoryRequest: 'Adicionar Requisição de Inventário',
          addInvoice: 'Adicionar Fatura',
          addLab: 'Adicionar Laboratório',
          addMedication: 'Adicionar Medicação',
          addNote: '',
          addOperationReport: '',
          addOperativePlan: '',
          addPatient: 'Adicionar Paciente',
          addPayment: 'Adicionar Pagamentos',
          addPhoto: 'Adicionar Foto',
          addPricing: 'Adicionar Preço',
          addPricingProfile: 'Adicionar Perfil de Preço',
          addProcedure: 'Adicionar Procedimento',
          addSocialwork: '',
          addVisit: 'Adicionar Visita',
          addVitals: 'Adicionar Sinais Vitais',
          adjustInventoryLocation: 'Ajustar Localização de Inventário',
          admin: 'Administração',
          admitPatient: 'Admitir Paciente',
          appointments: 'Compromissos',
          billing: 'Faturamentos',
          completeImaging: 'Imagem Concluída',
          completeLab: 'Laboratório Concluído',
          defineUserRoles: 'Perfis de Usuários',
          deleteAppointment: 'Excluir Compromisso',
          deleteDiagnosis: 'Excluir Diagnóstico',
          deleteImaging: 'Excluir Imagem',
          deleteIncident: '',
          deleteIncidentCategory: '',
          deleteInventoryItem: 'Excluir Item de Inventário',
          deleteInvoice: 'Excluir Fatura',
          deleteLab: 'Excluir Laboratório',
          deleteMedication: 'Excluir Medicação',
          deleteNote: '',
          deletePatient: 'Excluir Paciente',
          deletePhoto: 'Excluir Paciente',
          deletePricing: 'Excluir Preço',
          deletePricingProfile: 'Excluir Perfil de Preço',
          deleteProcedure: 'Excluir Procedimento',
          deleteSocialwork: 'Excluir Trabalho Social',
          deleteVisit: 'Excluir Visita',
          deleteVitals: 'Excluir Sinais Vitais',
          dischargePatient: 'Alta do Paciente',
          editInvoice: 'Editar Fatura',
          fulfillInventory: 'Preencher Inventário',
          fulfillMedication: 'Preencher Medicação',
          generateIncidentReport: '',
          imaging: 'Imagem',
          incident: '',
          inventory: 'Inventário',
          invoices: 'Faturas',
          labs: 'Laboratório',
          loadDb: 'Carregar Banco de Dados',
          manageIncidents: '',
          medication: 'Medicação',
          overrideInvoice: 'Substituir Fatura',
          patientReports: 'Relatório do Paciente',
          patients: 'Pacientes',
          pricing: 'Preço',
          updateConfig: 'Atualizar Configurações',
          visits: 'Visita'
        },
        messages: { roleSaved: 'O perfil {{roleName}} foi salvo.' },
        titles: { roleSaved: 'Perfil Salvo' }
      },
      userRoles: 'Perfis de Usuários',
      users: 'Usuários',
      visitForms: {
        labels: {
          followup: '',
          form: '',
          initial: '',
          visitType: ''
        },
        titles: { visitForms: '' }
      },
      workflow: {
        admissionDepositLabel: 'Depósito de Admissão é exigido',
        clinicPrepaymentLabel: 'Pagamento Antecipado da Clínica é exigido',
        editTitle: 'Opções de Workflow',
        followupPrepaymentLabel: 'Pagamento Antecipado do Acompanhamento é exigido',
        messages: { optionsSaved: 'As opções de WorkFlow foram salvas' },
        newTitle: 'Opções de Workflow',
        outpatientImagingLabel: 'Pagamento Antecipado do Ambulatorio de Imagem é exigido',
        outpatientLabLabel: 'Pagamento Antecipado do Laboratório Ambulatorial é exigido',
        outpatientMedicationLabel: 'Pagamento Antecipado do Ambulatorio de Medicação é exigido',
        titles: { optionsSaved: 'Opções Salvas' },
        workflowLabel: 'Workflow'
      }
    },
    alerts: {
      errorExclamation: '',
      pleaseWait: 'Por Favor Aguarde',
      reportError: '',
      warningExclamation: ''
    },
    allergies: {
      buttons: { addAllergy: 'Adicionar alergia' },
      labels: {
        allergyName: 'Nome',
        patientAllergy: 'Alergias do paciente'
      },
      titles: {
        addAllergy: 'Adicionar alergia',
        editAllergy: 'Editar alergia'
      }
    },
    application: {
      messages: { sessionExpired: 'Sua sessaão expirou. Faça login para continuar.' },
      titles: { sessionExpired: 'Sessaão expirada' }
    },
    appointments: {
      buttons: {
        newButton: '+ novo compromisso',
        scheduleSurgery: '+ nova cirurgia'
      },
      calendarTitle: 'Compromissos',
      currentScreenTitle: 'Lista de Compromisso',
      editTitle: 'Editar Compromisso',
      labels: {
        noLocation: 'Sem Localização',
        selectedStartingDate: 'Mostrar Compromisso em ou após'
      },
      messages: {
        appointmentSaved: '',
        endTimeLaterThanStart: 'Por favor, selecione um horário de término mais tarde do que a hora de início.'
      },
      missed: 'Compromissos Esquecidos',
      newTitle: 'Novo Compromisso',
      searchTitle: 'Pesquisar Compromissos',
      sectionTitle: 'Compromissos',
      thisWeek: 'Compromissos dessa Semana',
      titles: {
        appointmentSaved: 'Compromisso Salvo',
        editSurgicalAppointment: 'Editar cirurgia',
        newSurgicalAppointment: 'Nova cirurgia',
        theaterSchedule: 'Cirurgias'
      },
      todayTitle: 'Compromissos de Hoje'
    },
    billing: {
      alerts: {
        noInvoiceFound: 'Nenhuma fatura encontrada',
        noPricingItems: 'Nenhum item de preço encontrado.',
        noPricingProfiles: 'Nenhum perfil de preço encontrado.'
      },
      buttons: {
        addOverride: 'Adicionar Substituir',
        createInvoice: 'Criar nova fatura?'
      },
      labels: {
        actualCharges: 'Cobranças Atuais',
        discountAmount: 'Quantidade de Desconto',
        discountPercentage: 'Porcentagem de Desconto',
        externalInvoiceNumber: 'Fatura Externa #',
        hmoCom: 'HMO/COM',
        insurance: 'Seguro Nacional',
        paymentProfile: 'Perfil de Pagamento',
        paymentsDeposits: 'Pagamentos/Depositos',
        pricingPanelOverrides: 'Substituição e Perfil de Preços',
        pricingProfile: 'Perfil de Preços'
      }
    },
    buttons: {
      add: 'Adicionar',
      addItem: 'Adicionar Item',
      addLineItem: 'Adicionar Item de Linha',
      addValue: 'Adicionar Valor',
      addVisit: 'Adicionar Visita',
      allRequests: 'Todas as Requisições',
      barcode: 'Código de Barras',
      cancel: 'Cancelar',
      clear: 'Limpar',
      close: 'Fechar',
      complete: 'Completo',
      'delete': 'Excluir',
      dispense: 'Dispensar',
      edit: 'Editar',
      filter: 'Filtrar',
      fulfill: 'Preencher',
      'import': 'Importar',
      loadFile: 'Carregar Arquivo',
      newItem: '+ novo item',
      newNote: 'Nova Nota',
      newRequest: 'Nova Requisição',
      newRequestPlus: '+ nova requisição',
      newUser: 'Novo Usuário',
      ok: 'Ok',
      remove: 'Remover',
      returnButton: 'Retornar',
      search: 'Pesquisa',
      showAll: '',
      showFewer: '',
      update: 'Atualizar'
    },
    components: {
      chargesByTypeTab: { charges: 'cobranças' },
      customFormManager: { buttons: { addForm: '' } },
      dateTimePicker: {
        amHour: '{{hour}} AM',
        midnight: 'Meia-noite',
        noon: 'Meio-dia',
        pmHour: '{{hour}} PM'
      },
      imageUpload: { messages: { selectValidImageFile: '' } },
      operativeProcedures: {
        buttons: { addProcedure: '' },
        labels: { procedure: '' },
        titles: { procedures: '' }
      },
      patientOrders: {
        buttons: {
          newImaging: '',
          newLab: '',
          newMedication: ''
        },
        labels: {
          imagingOrderType: '',
          labOrderType: '',
          medicationOrderType: '',
          orderType: ''
        }
      },
      priceList: { charges: 'cobranças de {{pricingType}}' },
      quantityCalc: { result: '{{targetUnit}} total: {{calculated}}' },
      quantityConv: {
        conversion: 'O que significa contém 1 {{name}}?',
        unit: 'Unidade'
      },
      sortableColumn: { labels: { selectAll: '' } },
      takePhoto: {
        camera: 'Câmera',
        how: 'Como você quer adicionar um Foto?',
        labels: {
          takeAPicture: '',
          uploadAFile: ''
        },
        photo: 'foto',
        preview: 'pré visualização',
        takePhoto: 'Tirar um Foto',
        uploadFile: 'Upload de Arquivo'
      },
      upcomingAppointments: {
        labels: {
          date: '',
          location: '',
          type: '',
          'with': ''
        },
        titles: { upcomingAppointments: '' }
      }
    },
    customForms: {
      buttons: { addForm: 'Adicionar formulário' },
      labels: { formToAdd: 'Formulário para adicionar' },
      titles: { addCustomForm: 'Adicionar formulário customisado' }
    },
    dashboard: {
      setup: '',
      title: 'O que você gostaria de fazer?'
    },
    dates: {
      'long': '{{years}} ano {{months}} meses {{days}} dias',
      longOmitDays: '{{years}} ano {{months}} meses',
      longOmitDaysPlural: '{{years}} anos {{months}} meses',
      longOmitDaysYears: '{{months}} meses',
      longOmitYears: '{{months}} meses {{days}} dias',
      longPlural: '{{years}} anos {{months}} meses {{days}} dias',
      'short': '{{years}}y {{months}}m {{days}}d',
      shortOmitYears: '{{months}}m {{days}}d'
    },
    diagnosis: {
      labels: {
        activeDiagnosis: 'Diagnóstico ativo',
        date: 'Data',
        diagnosis: 'Diagnóstico',
        secondaryDiagnosis: 'Diagnóstico secundário'
      },
      titles: {
        addDiagnosis: 'Adicionar diagnóstico',
        editDiagnosis: 'Editar diagnóstico'
      }
    },
    errors: {
      accepted: 'deve ser aceito',
      blank: 'não pode ser branco',
      confirmation: '{{attribute}} não corresponde',
      empty: 'não pode ser vazio',
      equalTo: 'deve ser igual à {{count}}',
      even: 'deve ser até',
      exclusion: 'é reservado',
      greaterThan: 'deve ser maior do que {{count}}',
      greaterThanOrEqualTo: 'deve ser maior ou igual à {{count}}',
      inclusion: 'não está na lista',
      invalid: 'é inválido',
      invalidNumber: 'número não é valido',
      lessThan: 'deve ser menor do que {{count}}',
      lessThanOrEqualTo: 'deve ser menor ou igual à {{count}}',
      notANumber: 'não é um número',
      notAnInteger: 'deve ser um número inteiro',
      odd: 'deve ser ímpar',
      otherThan: 'deve ser diferente de {{count}}',
      present: 'pode ser branco',
      result: 'Informe um resultado antes de concluir',
      tooLong: 'é muito longo (quantidade máxima de caracteres é {{count}} )',
      tooShort: 'é muito curta (quantidade mínima de caracteres é {{count}})',
      wrongLength: 'o tamanho está errado (são esperados {{count}} caracteres)'
    },
    headings: { chargedItems: 'Itens Carregados' },
    imaging: {
      alerts: {
        completedMessage: 'A requisição de imagem esta completa.',
        completedTitle: 'Requisição de Imagem Completa',
        savedMessage: 'A requisição de imagem foi salva.',
        savedTitle: 'Requisição de imagem salva'
      },
      buttons: { newButton: '+ nova imagem' },
      labels: {
        addNewVisit: '--Adicionar novo visitante--',
        radiologist: 'Radiologista'
      },
      messages: { noCompleted: 'Nenhum item completo encontrado.' },
      pageTitle: 'Requisição de imagens',
      sectionTitle: 'Imagem',
      titles: {
        completedImaging: 'Imagem completa',
        editTitle: 'Requisição de edição de imagem',
        newTitle: 'Nova requisição de imagem'
      }
    },
    incident: {
      buttons: {
        add: '',
        addForm: '',
        addItem: '',
        cancel: '',
        'delete': '',
        download: '',
        edit: '',
        'export': '',
        generateRep: '',
        newAttachment: '',
        newCategory: '',
        newIncident: '',
        newNote: ''
      },
      labels: {
        actions: '',
        addedBy: '',
        category: '',
        categoryItem: '',
        date: '',
        dateRecorded: '',
        department: '',
        description: '',
        endDate: '',
        givenBy: '',
        howToAddAttachment: '',
        incidentDate: '',
        incidentId: '',
        item: '',
        lastUpdated: '',
        note: '',
        patientId: '',
        patientImpacted: '',
        reportType: '',
        reportedBy: '',
        reportedDate: '',
        reportedTo: '',
        sentinelEvent: '',
        startDate: '',
        status: '',
        statusActive: '',
        statusClosed: '',
        statusFollowup: '',
        statusReported: '',
        title: '',
        total: '',
        updatedBy: ''
      },
      messages: {
        attachmentFileRequired: '',
        createNew: '',
        createNewIncidentCategory: '',
        fillIn: '',
        incidentCategorySaved: '',
        noClosedIncidents: '',
        noIncidentCategoriesFound: '',
        noIncidents: '',
        saved: '',
        selectExistingPatient: ''
      },
      titles: {
        addAttachment: '',
        addCategoryItem: '',
        addNote: '',
        attachments: '',
        closed: '',
        current: '',
        deleteAttachment: '',
        deleteIncident: '',
        deleteIncidentCategory: '',
        deleteItem: '',
        deleteNote: '',
        editAttachment: '',
        editIncident: '',
        editIncidentCategory: '',
        editNote: '',
        general: '',
        history: '',
        incidentCategories: '',
        incidentCategoryItem: '',
        incidentCategoryName: '',
        incidentCategorySaved: '',
        incidentSaved: '',
        incidents: '',
        incidentsByCategory: '',
        incidentsByDepartment: '',
        newIncident: '',
        newIncidentCategory: '',
        notes: '',
        reports: ''
      }
    },
    inventory: {
      edit: {
        cost: 'Preço por Unidade:',
        delivered: 'Entregue a:',
        location: 'Localização Ajustada:',
        prescription: 'Prescrição para:',
        pulled: 'Retirado de:',
        quantity: 'Quantidade na Conclusão:',
        reason: 'Motivo:',
        returned: 'Devolvido do Paciente:',
        transferredFrom: 'Transferido de:',
        transferredTo: 'Transferido para:'
      },
      labels: {
        action: 'Ação',
        add: 'Adicionar',
        addAdjustmentType: '',
        adjust: 'Ajustar',
        adjustmentDate: 'Data de Ajuste',
        adjustmentFor: 'Ajuste Para',
        adjustmentType: 'Tipo de Ajuste',
        aisle: 'Corredor',
        aisleLocation: 'Localização do Corredor',
        allInventory: 'Todo Inventário',
        allItems: 'Todos os Itens',
        availableQuantity: '',
        billTo: 'Conta Para',
        consumePurchases: 'Compras para Consumo',
        consumptionRate: 'Taxa de Consumo',
        cost: 'Preço',
        costPerUnit: 'Preço por Unidade',
        crossReference: 'Referência Cruzada',
        currentQuantity: 'Quantidade Atual',
        dateCompleted: 'Data de Conclusao',
        dateEffective: 'Data Efetiva',
        dateEnd: 'Data de Término',
        dateReceived: 'Data Recebida',
        dateStart: 'Data de Início',
        dateTransferred: 'Data Transferida',
        daysLeft: 'Dias Restantes',
        deleteItem: 'Deletar Item',
        deliveryAisle: 'Corredor de Entrega',
        deliveryLocation: 'Local de Entrega',
        details: 'Detalhes',
        distributionUnit: 'Centro de Distribuição',
        editItem: 'Editar Item',
        expense: 'Despesa para',
        expirationDate: 'Data de Expiração',
        fulfillRequest: 'Preencher Requisição',
        fulfillRequestNow: 'Preencher Requisição Agora',
        gift: 'Doação em Espécie',
        giftInKindNo: 'N',
        giftInKindYes: 'S',
        giftUsage: 'Uso de Doação em Espécie',
        inventoryConsumed: 'Inventário Consumido',
        inventoryItem: 'Item de Inventário',
        inventoryObsolence: 'Obsolescência de Inventário',
        invoiceItems: 'Itens da Fatura',
        invoiceLineItem: 'Item de Linha da Fatura',
        invoiceNumber: 'Número da Fatura',
        item: 'Item',
        itemNumber: 'Número de Item',
        items: 'Itens',
        location: 'Localização',
        locations: 'Localizações',
        markAsConsumed: 'Marcar como Consumido',
        name: 'Nome',
        newItem: 'Novo Item',
        originalQuantity: 'Quantidade Original',
        print: 'Imprimir',
        printBarcode: 'Imprimir Código Barras',
        printer: 'Impressora',
        pullFrom: 'Retirar de',
        purchaseCost: 'Custo da Compra',
        purchaseInfo: 'Informações da Compra',
        purchases: 'Compras',
        quantity: 'Quantity ({{unit}})',
        quantityAvailable: 'Quantity Available',
        quantityOnHand: 'Quantidade on Hand',
        quantityRequested: 'Quantidade Solicitada',
        rank: 'Classificação',
        reason: 'Motivo',
        remove: 'Remover',
        removeAdjustmentType: '',
        reorderPoint: 'Ponto de Reabastecimento',
        requestedItems: 'Itens Solicitados',
        returnAdjustmentType: '',
        returnToVendorAdjustmentType: '',
        salePricePerUnit: 'Preço de Venda por Unidade',
        save: 'Salvar',
        serialNumber: 'Lote/Número de Série',
        total: 'Total',
        totalCost: 'Preço Total',
        totalReceived: 'Total Recebido: {{total}}',
        transaction: 'Transação',
        transactions: 'Transações',
        transfer: 'Transferir',
        transferFrom: 'Transferir de',
        transferTo: 'Transferir para Localização',
        transferToAisle: 'Transferir para Localização de Corredor',
        unit: 'Unidade',
        unitCost: 'Preço Unitário',
        vendor: 'Fornecedor',
        vendorItemNumber: 'Número de Item do Fornecedor',
        writeOffAdjustmentType: '',
        xref: 'RefX'
      },
      messages: {
        adjust: 'Por favor ajustar as quantidades no(s) local(is) apropriado(s) da conta para a diferença de {{difference}}.',
        createRequest: 'Criar uma nova requisição?',
        itemNotFound: 'O item de inventário <strong>{{item}}</strong> não pode ser encontrado.<br>Se você quiser criar um novo item de inventário, preencha as informações abaixo.<br>Caso o contrário, pressione o botão Cancelar para voltar.',
        loading: 'Carregando transações ...',
        noItems: 'Nenhum item encontrado.',
        noRequests: 'Nenhuma requisição encontrada.',
        purchaseSaved: 'As compras de inventário foram salvas com sucesso.',
        quantity: 'A quantidade total de <strong>({{quantity}})</strong> não corresponde com a quantidade total nas localizações<strong>({{locationQuantity}})</strong>.',
        removeItem: 'Você tem certeza de que deseja remover este item desta fatura?',
        removeItemRequest: 'Você tem certeza de que deseja remover este item desta requisição?',
        requestFulfilled: 'A requisição de invenário foi preenchida.',
        requestUpdated: 'A requisição de invenário foi atualizada.',
        warning: 'Por favor preencher campos obrigatório (marcado(s) com *) e corrija os erros antes de adicionar.'
      },
      reports: {
        adjustment: 'Ajuste Detalhado',
        daysSupply: 'Dias de Abastecimento Deixado no Estoque',
        expenseDetail: 'Despesas Detalhadas',
        expenseSum: 'Sumário de Despesas',
        expiration: 'Data de Expiração',
        'export': 'Exportar Relatório',
        fields: 'Campos para Incluir',
        finance: 'Sumário Financeiro',
        generate: 'Gerar Relatório',
        invLocation: 'Inventário por Localização',
        invValuation: 'Valorização do Inventário',
        purchaseDetail: 'Compras Detalhadas',
        purchaseSum: 'Sumário de Compras',
        reportType: 'Tipo de Relatório',
        rows: {
          adjustments: 'Ajustes',
          adjustmentsTotal: 'Total dos Ajustes',
          balanceBegin: 'Balanço Inicial',
          balanceEnd: 'Balanço Final',
          category: 'Categoria',
          consumed: 'Consumidos',
          consumedGik: 'Doações Consumidas',
          consumedGikTotal: 'Total Doações Consumidas',
          consumedPuchases: 'Compras Consumidas',
          consumedPurchasesTotal: 'Total Compras Consumidas',
          consumedTotal: 'Total Consumido',
          errInFinSum: 'Erro em _generateFinancialSummaryReport: ',
          errInFindPur: 'Erro em _findInventoryItemsByPurchase: ',
          errInFindReq: 'Erro em _findInventoryItemsByRequest: ',
          expensesFor: 'Despesas para: ',
          noAccount: '(Sem Conta)',
          subtotal: 'Subtotal: ',
          subtotalFor: 'Subtotal para {{category}} - {{account}}: ',
          total: 'Total: ',
          totalFor: 'Total para {{var}}: ',
          totalPurchases: 'Total de Compras',
          transfer1: '{{quantity}} de {{location}}',
          trasnfer2: 'De: {{source}} Para: {{target}}'
        },
        stockTransferDetail: 'Tranferências de Estoque Detalhadas',
        stockTransferSum: 'Sumário de Tranferências de Estoque',
        stockUsageDetail: 'Uso de Estoque Detalhado',
        stockUsageSum: 'Sumário de Uso de Estoque',
        titleDateRange: '',
        titleSingleDate: ''
      },
      titles: {
        addPurchase: 'Adicionar Compra',
        addRequest: 'Nova Requisição',
        adjustment: 'Ajuste',
        editPurchase: 'Editar Compra',
        editRequest: 'Editar Requisição',
        inventoryItem: 'Novo Item de Inventário',
        inventoryReport: 'Relatório de Inventário',
        purchaseSaved: 'Compras de Invenários Salvas',
        quickAddTitle: 'Novo Item de Inventário',
        removeItem: 'Remover Item',
        requestFulfilled: 'Requisição Preenchida',
        requestUpdated: 'Requisição Atualizada',
        transfer: 'Itens de Transferência',
        warning: 'Atenção!!!!!'
      }
    },
    labels: {
      action: 'Ação',
      actions: 'Ações',
      addNewOutpatientVisit: '--Adicionar Nova Visita Ambulatorial--',
      address: 'Endereço',
      age: 'Idade',
      allDay: 'Todo Dia',
      amount: 'Quantidade',
      anesthesia: 'Anestesia',
      assisting: 'Ajudante',
      balanceDue: 'Saldo Devedor',
      billDate: 'Data da Conta',
      billTo: 'Conta Para',
      category: 'Categoria',
      completed: 'Completo',
      country: 'País',
      cptcode: 'Código CPT*',
      creditTo: 'Crédito Para',
      date: 'Data',
      dateCompleted: 'Data da Conclusão',
      dateOfBirth: 'Data de Nascimento',
      dateOfBirthShort: 'DtNasc',
      datePaid: 'Data de Pagamento',
      dateRequested: 'Data da Requisição',
      'delete': 'Excluir',
      deleteRequest: 'Excluir Requisição',
      deleteUser: 'Excluir Usuário',
      department: 'Departamento',
      description: 'Descrição',
      discount: 'Desconto',
      displayName: 'Nome de Exibição',
      docRead: 'Documentos Lidos',
      docWritten: 'Documentos Escritos',
      edit: 'Editar',
      editUser: 'Editar Usuário',
      email: 'Email',
      endDate: 'Data de Término',
      endTime: 'Hora de Término',
      excess: 'Excesso',
      expenseTo: 'Despesa Para',
      fileLoadSuccessful: 'Arquivo Carregado com Sucesso',
      fileName: '',
      fileToLoad: 'Carregar Arquivo',
      fulfill: 'Preencha',
      fulfillRequest: 'Preencha a Requisição',
      fulfillRequestNow: 'Preencha a Requisição Agora',
      fulfilled: 'Preenchido',
      grandTotal: 'Total Geral',
      id: 'Id',
      imageOrders: 'Pedido de Imagem',
      imagingType: 'Tipo de Imagem',
      importFile: 'Importar Arquivo',
      invoiceId: 'ID da Fatura',
      labOrders: 'Pedidos de Laboratório',
      lineItems: 'Itens de Linha',
      loading: 'Carregando',
      location: 'Localização',
      lookupType: 'Tipo de Pesquisa',
      medication: 'Medicação',
      name: 'Nome',
      newUser: 'Novo Usuário',
      note: 'Note',
      notes: 'Notas',
      number: 'Número',
      on: 'ligado',
      password: 'Senha',
      patient: 'Paciente',
      payments: 'Pagamentos',
      physician: 'Médico',
      prescriber: 'Médico Responsável pela Prescrição',
      prescription: 'Prescrição',
      prescriptionDate: 'Data da Prescrição',
      price: 'Preço',
      print: '',
      procedures: 'Procedimentos',
      provider: 'Fornecedor',
      pullFrom: 'Puxar De',
      quantity: 'Quantidade',
      remarks: 'Observações',
      requestedBy: 'Requisitado por',
      requestedOn: 'Solicitado em',
      requests: 'Requisições',
      result: 'Resultado',
      results: 'Resultados',
      role: 'Papel',
      search: 'Pesquisa',
      sex: 'Sexo',
      startDate: 'Data de Início',
      startTime: 'Hora Início',
      status: 'Situação',
      takenBy: '',
      total: 'Total',
      type: 'Tipo',
      userCanAddNewValue: 'O usuário pode adicionar novos valores',
      username: 'Usuário',
      value: 'Valor',
      view: '',
      visit: 'Visita',
      'with': 'Com'
    },
    labs: {
      alerts: {
        requestCompletedMessage: 'Requisição de laboratório foi concluída.',
        requestCompletedTitle: 'Requisições de Laboratório Concluída',
        requestSavedMessage: 'A requisição de laboratório foi salva.',
        requestSavedTitle: 'Requisição de Laboratório Salva'
      },
      buttons: { newButton: '+ novo laboratório' },
      completedTitle: 'Laboratórios Concluídos',
      deleteTitle: 'Excluir Requisição',
      editTitle: 'Editar Requisição de Laboratório',
      labels: {
        addNewVisit: '--Adicionar Nova Visita--',
        labType: 'Tipo de Laboratório'
      },
      messages: {
        createNewRecord: 'Criar novo registro?',
        noCompleted: 'Items concluídos não econtrados.',
        noItemsFound: 'Nenhum laboratório encontrado.'
      },
      newTitle: 'Nova Requisição de Laboratório',
      requestsTitle: 'Requisições de Laboratório',
      sectionTitle: 'Laboratório'
    },
    loading: {
      messages: {
        '0': 'A velocidade de vôo borboleta superior é de 12 milhas por hora. Alguns meses pode voar 25 milhas por hora!',
        '1': 'As corujas são os únicos pássaros que podem ver a cor azul.',
        '2': 'Os gatos têm mais de 100 sons vocais; cachorros têm apenas 10.',
        '3': 'Os Humanos usam um total de 72 músculos diferentes na fala.',
        '4': 'Mais de 1.000 idiomas diferentes são falados no continente africano',
        '5': 'Uma eritrofobo é alguém que fica vermelho facilmente.',
        '6': 'A fobia mais comum do mundo é a Odinofobia que é o medo da dor.',
        '7': 'Seu corpo utiliza 300 músculo para manter o equilíbrio quando você está parado.',
        '8': 'Alguns sapos podem ser congelados e depois de serem descongelados continuarem a viver.',
        '9': 'Nossos olhos estão sempre do mesmo tamanho de quando nascemos, mas nossas orelhas e nariz nunca param de crescer.',
        '10': 'Sua língua é o único músculo em seu corpo qu está ligado apenas em uma extremidade.',
        '11': 'Camelos tem três pálpebras para se protegerem das tempestades de areia.'
      },
      progressBar: { progress: '{{progressBarValue}}% concluído' }
    },
    login: {
      labels: {
        password: 'Senha',
        signIn: 'Entrar',
        username: 'Usuário'
      },
      messages: {
        error: 'Nome de usuário ou senha está incorreta.',
        signIn: 'Entrar'
      }
    },
    medication: {
      alerts: {
        fulfilledTitle: 'Requisição de Medicação Preenchido',
        returnedMessage: 'A medicação foi marcada como retornada.',
        returnedTitle: 'Medicação Retornada',
        savedMessage: 'O registro de medicação foi salvo.',
        savedTitle: 'Requisição de Medicação foi Salva'
      },
      buttons: {
        dispenseMedication: 'dispensar medicação',
        newButton: '+ nova requisição',
        returnMedication: 'retorno de medicação'
      },
      labels: {
        adjustmentDate: 'Data de Ajuste',
        creditToAccount: 'Crédito na Conta',
        quantityDispensed: 'Quantidade Dispensada',
        quantityDistributed: 'Quantidade Distribuída',
        quantityRequested: 'Quantidade Requisitada',
        quantityToReturn: 'Quantidade Retornada',
        refills: 'Recargas',
        returnAisle: 'Corredor de Retorno',
        returnLocation: 'Localização de Retorno',
        returnReason: 'Razão/Notas de Retorno'
      },
      messages: { createNew: 'Criar uma nova requisição de medicação?' },
      pageTitle: 'Requisição de Medicação',
      returnMedication: 'Retorno de Medicação',
      sectionTitle: 'Medicação',
      titles: {
        completedMedication: 'Medicação Concluída',
        editMedicationRequest: 'Editar Requisição de Medicação',
        newMedicationRequest: 'Nova Requisição de Medicação'
      }
    },
    messages: {
      createNewRecord: 'Criar uma nova gravação?',
      createNewUser: 'Criar um novo usuário?',
      'delete': '',
      delete_plural: '',
      delete_singular: '',
      forAuthorizedPersons: 'Este relatório é somente para pessoas autorizadas.',
      newPatientHasToBeCreated: 'Um novo paciente precisa ser criado... Por favor aguarde...',
      noHistoryAvailable: 'Histórico não disponível.',
      noItemsFound: 'Nenhum item encontrado',
      noNotesAvailable: 'Nenhuma nota clinica adicional está diponível para essa visita.',
      noUsersFound: 'Nenhum usuário encontrado.',
      onBehalfOf: 'em nome de',
      reportError: '',
      requiredFieldsCorrectErrors: '',
      saveActionException: '',
      sorry: 'Desculpe, algo deu errado...',
      userHasBeenSaved: 'O usuário foi salvo.',
      userSaved: 'Usuário Salvo'
    },
    models: {
      appointment: {
        labels: {
          allDay: '',
          appointmentDate: '',
          appointmentType: '',
          endDate: '',
          location: '',
          notes: '',
          patient: '',
          provider: '',
          startDate: '',
          status: '',
          type: ''
        },
        names: {
          plural: '',
          singular: ''
        }
      },
      attachment: { names: {
          plural: '',
          singular: ''
        } },
      form: { names: {
          plural: '',
          singular: ''
        } },
      imaging: {
        names: '',
        request: {
          plural: '',
          singular: ''
        }
      },
      incident: { names: {
          plural: '',
          singular: ''
        } },
      item: { names: {
          plural: '',
          singular: ''
        } },
      lab: {
        names: {
          plural: '',
          singular: ''
        },
        request: {
          plural: '',
          singular: ''
        }
      },
      medication: {
        names: {
          plural: '',
          singular: ''
        },
        request: {
          plural: '',
          singular: ''
        }
      },
      note: { names: {
          plural: '',
          singular: ''
        } },
      patient: {
        labels: { name: '' },
        names: { singular: '' }
      },
      procedure: { names: {
          plural: '',
          singular: ''
        } },
      user: { names: {
          plural: '',
          singular: ''
        } },
      visit: { names: {
          plural: '',
          singular: ''
        } },
      vital: { names: {
          plural: '',
          singular: ''
        } }
    },
    navigation: {
      about: 'Sobre HospitalRun',
      actions: {
        login: 'Entrar',
        logout: 'Sair'
      },
      administration: 'Administração',
      billing: 'Faturamento',
      imaging: 'Imagem',
      incident: '',
      inventory: 'Inventário',
      labs: 'Laboratórios',
      medication: 'Medicação',
      patients: 'Pacientes',
      scheduling: 'Agenda',
      subnav: {
        actions: 'Ações',
        addAppointment: 'Adicionar Compromisso',
        addressFields: 'Campos de Endereço',
        admittedPatients: 'Pacientes Admitidos',
        appointmentSearch: 'Pesquisar compromissos',
        appointmentsCalendar: 'Compromissos',
        appointmentsThisWeek: 'Compromissos dessa Semana',
        completed: 'Concluídos',
        currentIncidents: '',
        customForms: 'Formulários customisados',
        dispense: 'Dispensar',
        history: '',
        incidentCategories: '',
        inventoryReceived: 'Inventário Recebido',
        invoices: 'Faturas',
        items: 'Itens',
        loadDB: 'Carregar BD',
        lookupLists: 'Listas de Pesquisa',
        missedAppointments: 'Compromissos Esquecidos',
        newIncident: '',
        newInvoice: 'Nova Fatura',
        newPatient: 'Novo Paciente',
        newRequest: 'Nova Requisição',
        newUser: 'Novo Usuário',
        outpatient: 'Ambulatório',
        patientListing: 'Lista de Pacientes',
        priceProfiles: 'Perfis de Preços',
        prices: 'Preços',
        printHeader: '',
        reports: 'Relatórios',
        requests: 'Requisições',
        returnMedication: 'Retorno de Medicação',
        scheduleSurgery: 'Agendar Cirurgia',
        theaterSchedule: 'Agenda de Cirurgias',
        "today'sAppointments": 'Compromissos de Hoje',
        userRoles: 'Perfis de Usuário',
        users: 'Usuários',
        workflow: 'Workflow'
      }
    },
    operationReport: {
      labels: {
        additionalNotes: 'Notas adicionais',
        assistant: 'Assistente',
        caseComplexity: 'Complexidade do caso',
        operationDescription: 'Descriçaão da operaçaão',
        preOpPrimaryDiagnosis: 'Pre-op diagnóstico primário',
        preOpSecondaryDiagnosis: 'Pre-op diagnóstico secundário',
        surgeon: 'Cirurgião',
        surgeryDate: 'Data da cirurgia'
      },
      messages: { reportSaved: 'O relatório da operação foi salvo.' },
      titles: {
        editTitle: 'Editar relatório de operação',
        newTitle: 'Novo relatório da operação',
        reportSaved: 'Relatório salvo'
      }
    },
    operativePlan: {
      buttons: { completePlan: 'Plano completo' },
      labels: {
        additionalNotes: 'Notas adicionais',
        admissionInstructions: 'Instruções após admissaão',
        caseComplexity: 'Complexidade do caso',
        completedStatus: 'Completo',
        droppedStatus: 'Desistiu',
        operationDescription: 'Descriçaão da operação',
        plannedStatus: 'Planejado',
        status: 'Estado',
        surgeon: 'Cirurgião'
      },
      messages: {
        planCompleted: 'O plano de operação foi concluído. Agora você será direcionado para o relatório de operação.',
        planSaved: 'O plano de operação foi salvo.'
      },
      titles: {
        editTitle: 'Editar plano de operação',
        newTitle: 'Novo plano de operação',
        planCompleted: 'Plano completo',
        planSaved: 'Plano salvo'
      }
    },
    patients: {
      buttons: {
        addContact: 'Adicionar Contato',
        addExpense: 'Adicionar Despesa',
        addFamilyMember: 'Adicionar Membro Familiar',
        addOperativePlan: '',
        backToPatients: 'Voltar para Lista de Pacientes',
        download: '',
        editOperativePlan: '',
        newAppointment: 'Novo Compromisso',
        newImaging: 'Nova Imagem',
        newLab: 'Novo Laboratório',
        newMedication: 'Nova Medicação',
        newPatient: '+ novo paciente',
        newPhoto: 'Nova Foto',
        newVisit: 'Nova Visita',
        patientCheckIn: '',
        scheduleSurgery: ''
      },
      labels: {
        admissionDate: 'Data de Admissão',
        admit: 'Admitir',
        bloodType: 'Tipo Sanguíneo',
        caption: '',
        civilStatus: 'Estado Civil',
        clinic: 'Site(Filial) da Clínica',
        contacts: '',
        cost: 'Custo',
        dateOfBirth: 'Data de Nascimento',
        dateProcessed: 'Data de Processamento',
        dischargeDate: 'Data de Pagamento',
        dob: 'DatNasc',
        education: 'Educação',
        email: 'Email',
        externalPatientId: 'ID de Paciente Externo',
        firstName: 'Primeiro Nome',
        income: 'Renda',
        insurance: 'Seguro',
        lastName: 'Último Nome',
        middleName: 'Nome do meio',
        monthlyCost: 'Custo Mensal',
        occupation: 'Ocupação',
        operativePlan: '',
        parent: 'Responsável Legal',
        patientDays: 'Dias do Paciente',
        patientType: 'Tipo de Paciente',
        patientTypeCharity: 'Caridade',
        patientTypePrivate: 'Privado',
        phone: 'Telefone',
        placeOfBirth: 'Local de Nascimento',
        primaryDiagnosis: 'Diagnósticos Primários',
        referredBy: 'Indicado Por',
        referredDate: 'Data de Indicação',
        relationship: 'Relação com Paciente',
        relationships: 'Relação',
        religion: 'Religião',
        secondaryDiagnosis: 'Diagnósticos Secundários',
        sex: 'Sexo',
        sexNotEntered: '',
        sources: 'Fontes',
        status: 'Situação do Paciente',
        totalMontlyExpense: 'Total de Despesas Mensais'
      },
      messages: {
        areYouSureDelete: 'Você tem certeza que deseja excluir este(a) {{object}}?',
        createNewPatient: 'Criar novos registro de paciente?',
        deletingPatient: '',
        noPatientsFound: 'Nenhum paciente encontrado.',
        notFoundQuickAdd: 'O paciente <strong>{{patientFullName}}</strong> não pode ser encontrato.  Se você deseja cadastras um novo paciente, preencha as informações abaixo.  Caso contrário clique em Cancelar para voltar.',
        photoFileRequired: '',
        savedPatient: 'O registro de paciente para {{displayName}} foi salvo.'
      },
      navigation: {
        appointments: 'Compromissos',
        general: 'Geral',
        history: 'Histórico',
        imaging: 'Imagem',
        labs: 'Laboratórios',
        medication: 'Medicação',
        photos: 'Fotos',
        socialWork: 'Assitência Social',
        visits: 'Visitas'
      },
      notes: {
        newNote: 'Nova Nota para',
        onBehalfOfCopy: 'em nome de',
        onBehalfOfLabel: 'Em Nome de',
        pleaseSelectAVisit: 'Por favor selecione uma visita',
        updateNote: 'Atualizando Nota de'
      },
      titles: {
        addContact: '',
        addPhoto: 'Adicionar Foto',
        additionalContacts: 'Contatos Adicionais',
        admissionsDetail: '',
        admissionsSummary: '',
        admittedPatients: '',
        'delete': 'Excluir Paciente',
        deleteContact: 'Excluir Contato',
        deleteExpense: 'Excluir Despesa',
        deleteFamilyMember: 'Excluir Membro Familiar',
        deletePatientRecord: '',
        deletePhoto: 'Excluir Foto',
        diagnosticTesting: '',
        dischargesDetail: '',
        dischargesSummary: '',
        edit: 'Editar Paciente',
        editPhoto: 'Editar Foto',
        expenses: 'Despesas',
        familyInfo: 'Informação Familiar',
        familyInformation: 'Informação Familiar',
        'new': 'Novo Paciente',
        outpatientsForDate: '',
        patient: 'Relatório de Paciente',
        patientListing: 'Lista de Pacientes',
        patientReport: '',
        patientStatus: '',
        proceduresDetail: '',
        proceduresSummary: '',
        savedPatient: 'Paciente Salvo',
        socialWork: 'Despesa',
        todaysOutpatients: '',
        totalPatientDays: '',
        totalPatientDaysDetailed: '',
        visit: ''
      }
    },
    print: { invoice: {
        labels: {
          billedBy: 'Faturado por:',
          billedDate: 'Data de Faturamento:',
          dateAdmitted: 'ADMITIDO:',
          dateDischarged: 'PAGAMENTO:',
          dischargeNotes: 'Notas de Pagamento:',
          patientAddress: 'ENDEREÇO:',
          patientAge: 'IDADE:',
          patientId: 'PACIENTE #:',
          patientName: 'NOME DO PACIENTE:',
          remarks: 'Observações:',
          spacer: '__________________________________________'
        },
        messages: { whereConducted: 'foram deduzidos durante minha internação' },
        titles: {
          billingStatement: 'DECLARAÇÃO DO FATURAMENTO',
          patientMember: 'Paciente-Membro',
          patients: 'DO PACIENTE',
          relContact: 'Relações/Contato'
        }
      } },
    procedures: {
      buttons: { addMedication: 'Adicionar Medicação' },
      labels: { medicationUsed: 'Medicação Usada' },
      messages: { saved: 'O registro de procedimento foi salvo.' },
      titles: {
        addChargeItem: 'Adicionar Item de Cobrança',
        addMedicationUsed: 'Adicionar Medicação Usada',
        deleteChargeItem: 'Excluir Item de Cobrança',
        deleteMedicationUsed: 'Excluir Medicação Usada',
        edit: 'Editar Procedimento',
        editChargeItem: 'Editar Item de Cobrança',
        editMedicationUsed: 'Editar Medicação Usada',
        medicationUsed: 'Medicação Usada',
        'new': 'Novo Procedimento',
        saved: 'Procedimento Salvo'
      }
    },
    reports: {
      labels: {
        admissionDate: '',
        allProcedures: '',
        completedBy: '',
        dischargeDate: '',
        examiner: '',
        images: '',
        labs: '',
        location: '',
        medications: '',
        nextAppointment: '',
        nextAppointments: '',
        notes: {
          author: '',
          date: '',
          title: ''
        },
        operativePlan: {
          description: '',
          instructions: '',
          procedures: '',
          title: ''
        },
        primaryDiagnosis: '',
        procedures: '',
        secondaryDiagnosis: '',
        visitDate: '',
        visitType: ''
      },
      messages: {
        'delete': '',
        saved: ''
      },
      titles: {
        dischargeReport: '',
        newDischargeReport: '',
        newOPDReport: '',
        opdReport: '',
        saved: ''
      }
    },
    user: {
      plusNewUser: '+ novo usuário',
      usersPageTile: 'Lista de Usuários'
    },
    visits: {
      buttons: {
        addDiagnosis: 'Adicionar Diagnóstico',
        checkIn: 'Entrada',
        checkOut: '',
        discharge: '',
        newAppointment: 'Novo Compromisso',
        newDischargeReport: '',
        newOPDReport: '',
        newProcedure: 'Novo Procedimento',
        newVitals: 'Novos Sinais Vitais'
      },
      labels: {
        appointment: '',
        authoredBy: 'Autorizado Por',
        checkInTime: '',
        checkOutTime: '',
        createNewPatient: '',
        diagnosis: 'Diagnósticos',
        examiner: 'Examinador',
        finalDiagnosis: 'Diagnósticos de Finais/Faturamento',
        haveAppointment: '',
        haveDoneOrders: '',
        noAppointment: '',
        ordersDone: '',
        ordersNotDone: '',
        patientToCheckIn: '',
        procedure: 'Procedimentos',
        procedureDate: '',
        reasonForVisit: '',
        reportType: '',
        status: 'Situação de Visita',
        statusAdmitted: '',
        statusCheckedIn: '',
        statusCheckedOut: '',
        statusDischarged: '',
        visitDate: '',
        visitInformation: 'Imformação de Visita',
        visitType: 'Tipo de Visita'
      },
      messages: {
        checkOut: '',
        checkedOut: '',
        discharged: '',
        patientCheckedIn: '',
        patientCreatedAndCheckedIn: '',
        visitAndPatientSaved: '',
        visitSaved: ''
      },
      navigation: {
        charges: '',
        notes: '',
        orders: '',
        procedures: '',
        reports: '',
        vitals: ''
      },
      titles: {
        additionalDiagnoses: 'Diagnósticos Adicionais',
        checkOut: '',
        checkedIn: '',
        checkedOut: '',
        discharged: '',
        editVisit: '',
        newVisit: '',
        patientCheckIn: '',
        visitSaved: ''
      }
    },
    vitals: { labels: {
        dateRecorded: 'Data de Gravação',
        dbp: 'PAD',
        heartRate: 'Frequência Cardíaca',
        height: 'Altura',
        respiratoryRate: 'Frequência Respiratória',
        sbp: 'PAS',
        temperature: 'Temperatura',
        weight: 'Peso'
      } }
  };
});
define('hospitalrun/locales/ru/translations', ['exports'], function (exports) {
  exports['default'] = {
    admin: {
      address: {
        address1Label: '',
        address2Label: '',
        address3Label: '',
        address4Label: '',
        addressLabel: '',
        editTitle: '',
        include1Label: '',
        include2Label: '',
        include3Label: '',
        include4Label: '',
        messages: { addressSaved: '' },
        newTitle: '',
        titles: { optionsSaved: '' }
      },
      addressOptions: '',
      customForms: {
        buttons: {
          addField: '',
          moveDown: '',
          moveUp: '',
          newForm: '',
          preview: ''
        },
        labels: {
          alwaysInclude: '',
          checkbox: '',
          colSpan: '',
          columns: '',
          customForm: '',
          dischargeReportFormType: '',
          formName: '',
          formType: '',
          incidentFormType: '',
          includeOtherOption: '',
          labFormType: '',
          label: '',
          newForm: '',
          opdReportFormType: '',
          operativePlanFormType: '',
          otherOptionLabel: '',
          patientFormType: '',
          property: '',
          radio: '',
          select: '',
          socialworkFormType: '',
          text: '',
          textarea: '',
          visitFormType: ''
        },
        messages: { formSaved: '' },
        titles: {
          checkboxValues: '',
          customForms: '',
          deleteForm: '',
          dropDownValues: '',
          editCustomForm: '',
          fields: '',
          formSaved: '',
          newCustomForm: '',
          radioValues: ''
        }
      },
      header: {
        editTitle: '',
        facilityName: '',
        headerLabel: '',
        headerLine1: '',
        headerLine2: '',
        headerLine3: '',
        logoURL: '',
        messages: { headerSaved: '' },
        newTitle: '',
        titles: { optionsSaved: '' }
      },
      loadDb: '',
      loaddb: {
        displayAlertMessage: '',
        displayAlertTitle: '',
        editTitle: '',
        errorDisplayAlertMessage: '',
        errorDisplayAlertTitle: '',
        progressMessage: '',
        progressTitle: ''
      },
      lookup: {
        aisleLocationList: '',
        alertImportListMessage: '',
        alertImportListSaveMessage: '',
        alertImportListSaveTitle: '',
        alertImportListTitle: '',
        alertImportListUpdateMessage: '',
        alertImportListUpdateTitle: '',
        anesthesiaTypes: '',
        anesthesiologists: '',
        billingCategories: '',
        clinicList: '',
        countryList: '',
        cptCodeList: '',
        diagnosisList: '',
        edit: { template: {
            addTitle: '',
            editTitle: '',
            labelTitle: '',
            updateButtonTextAdd: '',
            updateButtonTextUpdate: ''
          } },
        expenseAccountList: '',
        imagingPricingTypes: '',
        incidentDepartments: '',
        inventoryTypes: '',
        labPricingTypes: '',
        pageTitle: '',
        patientStatusList: '',
        physicianList: '',
        procedureList: '',
        procedureLocations: '',
        procedurePricingTypes: '',
        radiologists: '',
        titles: { deleteLookupValue: '' },
        unitTypes: '',
        vendorList: '',
        visitLocationList: '',
        visitTypes: '',
        wardPricingTypes: '',
        warehouseList: ''
      },
      lookupLists: '',
      roles: {
        capability: {
          addAllergy: '',
          addAppointment: '',
          addBillingDiagnosis: '',
          addCharge: '',
          addDiagnosis: '',
          addImaging: '',
          addIncident: '',
          addIncidentCategory: '',
          addInventoryItem: '',
          addInventoryPurchase: '',
          addInventoryRequest: '',
          addInvoice: '',
          addLab: '',
          addMedication: '',
          addNote: '',
          addOperationReport: '',
          addOperativePlan: '',
          addPatient: '',
          addPayment: '',
          addPhoto: '',
          addPricing: '',
          addPricingProfile: '',
          addProcedure: '',
          addSocialwork: '',
          addVisit: '',
          addVitals: '',
          adjustInventoryLocation: '',
          admin: '',
          admitPatient: '',
          appointments: '',
          billing: '',
          completeImaging: '',
          completeLab: '',
          defineUserRoles: '',
          deleteAppointment: '',
          deleteDiagnosis: '',
          deleteImaging: '',
          deleteIncident: '',
          deleteIncidentCategory: '',
          deleteInventoryItem: '',
          deleteInvoice: '',
          deleteLab: '',
          deleteMedication: '',
          deleteNote: '',
          deletePatient: '',
          deletePhoto: '',
          deletePricing: '',
          deletePricingProfile: '',
          deleteProcedure: '',
          deleteSocialwork: '',
          deleteVisit: '',
          deleteVitals: '',
          dischargePatient: '',
          editInvoice: '',
          fulfillInventory: '',
          fulfillMedication: '',
          generateIncidentReport: '',
          imaging: '',
          incident: '',
          inventory: '',
          invoices: '',
          labs: '',
          loadDb: '',
          manageIncidents: '',
          medication: '',
          overrideInvoice: '',
          patientReports: '',
          patients: '',
          pricing: '',
          updateConfig: '',
          visits: ''
        },
        messages: { roleSaved: '' },
        titles: { roleSaved: '' }
      },
      userRoles: '',
      users: '',
      visitForms: {
        labels: {
          followup: '',
          form: '',
          initial: '',
          visitType: ''
        },
        titles: { visitForms: '' }
      },
      workflow: {
        admissionDepositLabel: '',
        clinicPrepaymentLabel: '',
        editTitle: '',
        followupPrepaymentLabel: '',
        messages: { optionsSaved: '' },
        newTitle: '',
        outpatientImagingLabel: '',
        outpatientLabLabel: '',
        outpatientMedicationLabel: '',
        titles: { optionsSaved: '' },
        workflowLabel: ''
      }
    },
    alerts: {
      errorExclamation: '',
      pleaseWait: '',
      reportError: '',
      warningExclamation: ''
    },
    allergies: {
      buttons: { addAllergy: '' },
      labels: {
        allergyName: '',
        patientAllergy: ''
      },
      titles: {
        addAllergy: '',
        editAllergy: ''
      }
    },
    application: {
      messages: { sessionExpired: '' },
      titles: { sessionExpired: '' }
    },
    appointments: {
      buttons: {
        newButton: '',
        scheduleSurgery: ''
      },
      calendarTitle: '',
      currentScreenTitle: '',
      editTitle: '',
      labels: {
        noLocation: '',
        selectedStartingDate: ''
      },
      messages: {
        appointmentSaved: '',
        endTimeLaterThanStart: ''
      },
      missed: '',
      newTitle: '',
      searchTitle: '',
      sectionTitle: '',
      thisWeek: '',
      titles: {
        appointmentSaved: '',
        editSurgicalAppointment: '',
        newSurgicalAppointment: '',
        theaterSchedule: ''
      },
      todayTitle: ''
    },
    billing: {
      alerts: {
        noInvoiceFound: '',
        noPricingItems: '',
        noPricingProfiles: ''
      },
      buttons: {
        addOverride: '',
        createInvoice: ''
      },
      labels: {
        actualCharges: '',
        discountAmount: '',
        discountPercentage: '',
        externalInvoiceNumber: '',
        hmoCom: '',
        insurance: '',
        paymentProfile: '',
        paymentsDeposits: '',
        pricingPanelOverrides: '',
        pricingProfile: ''
      }
    },
    buttons: {
      add: 'Добавить',
      addItem: '',
      addLineItem: '',
      addValue: '',
      addVisit: '',
      allRequests: '',
      barcode: '',
      cancel: 'Отметить',
      clear: '',
      close: '',
      complete: 'Готово',
      'delete': '',
      dispense: '',
      edit: '',
      filter: '',
      fulfill: '',
      'import': '',
      loadFile: '',
      newItem: '',
      newNote: '',
      newRequest: '',
      newRequestPlus: '',
      newUser: '',
      ok: 'Ок',
      remove: '',
      returnButton: 'Вернутся',
      search: '',
      showAll: '',
      showFewer: '',
      update: 'Обновить'
    },
    components: {
      chargesByTypeTab: { charges: '' },
      customFormManager: { buttons: { addForm: '' } },
      dateTimePicker: {
        amHour: '',
        midnight: '',
        noon: '',
        pmHour: ''
      },
      imageUpload: { messages: { selectValidImageFile: '' } },
      operativeProcedures: {
        buttons: { addProcedure: '' },
        labels: { procedure: '' },
        titles: { procedures: '' }
      },
      patientOrders: {
        buttons: {
          newImaging: '',
          newLab: '',
          newMedication: ''
        },
        labels: {
          imagingOrderType: '',
          labOrderType: '',
          medicationOrderType: '',
          orderType: ''
        }
      },
      priceList: { charges: '' },
      quantityCalc: { result: '' },
      quantityConv: {
        conversion: '',
        unit: ''
      },
      sortableColumn: { labels: { selectAll: '' } },
      takePhoto: {
        camera: '',
        how: '',
        labels: {
          takeAPicture: '',
          uploadAFile: ''
        },
        photo: '',
        preview: '',
        takePhoto: '',
        uploadFile: ''
      },
      upcomingAppointments: {
        labels: {
          date: '',
          location: '',
          type: '',
          'with': ''
        },
        titles: { upcomingAppointments: '' }
      }
    },
    customForms: {
      buttons: { addForm: '' },
      labels: { formToAdd: '' },
      titles: { addCustomForm: '' }
    },
    dashboard: {
      setup: '',
      title: 'Что вы хотите сделать?'
    },
    dates: {
      'long': '',
      longOmitDays: '',
      longOmitDaysPlural: '',
      longOmitDaysYears: '',
      longOmitYears: '',
      longPlural: '',
      'short': '',
      shortOmitYears: ''
    },
    diagnosis: {
      labels: {
        activeDiagnosis: '',
        date: '',
        diagnosis: '',
        secondaryDiagnosis: ''
      },
      titles: {
        addDiagnosis: '',
        editDiagnosis: ''
      }
    },
    errors: {
      accepted: '',
      blank: '',
      confirmation: '',
      empty: '',
      equalTo: '',
      even: '',
      exclusion: '',
      greaterThan: '',
      greaterThanOrEqualTo: '',
      inclusion: '',
      invalid: '',
      invalidNumber: '',
      lessThan: '',
      lessThanOrEqualTo: '',
      notANumber: '',
      notAnInteger: '',
      odd: '',
      otherThan: '',
      present: '',
      result: '',
      tooLong: '',
      tooShort: '',
      wrongLength: ''
    },
    headings: { chargedItems: '' },
    imaging: {
      alerts: {
        completedMessage: 'Запрос на визуализацию удовлетворён.',
        completedTitle: 'Визуализация выполнена',
        savedMessage: 'Запрос на визуализацию сохранён.',
        savedTitle: 'Запрос сохранён'
      },
      buttons: { newButton: '+ новый запрос' },
      labels: {
        addNewVisit: '--Добавить новый тип осмотра--',
        radiologist: 'Радиолог'
      },
      messages: { noCompleted: 'Не найдено выполненых запросов.' },
      pageTitle: 'Запросы на визуализацию',
      sectionTitle: 'Визуализация',
      titles: {
        completedImaging: 'Выполненые запросы',
        editTitle: 'Редактировать запрос на визуализацию',
        newTitle: 'Новый запрос на визуализацию'
      }
    },
    incident: {
      buttons: {
        add: '',
        addForm: '',
        addItem: '',
        cancel: '',
        'delete': '',
        download: '',
        edit: '',
        'export': '',
        generateRep: '',
        newAttachment: '',
        newCategory: '',
        newIncident: '',
        newNote: ''
      },
      labels: {
        actions: '',
        addedBy: '',
        category: '',
        categoryItem: '',
        date: '',
        dateRecorded: '',
        department: '',
        description: '',
        endDate: '',
        givenBy: '',
        howToAddAttachment: '',
        incidentDate: '',
        incidentId: '',
        item: '',
        lastUpdated: '',
        note: '',
        patientId: '',
        patientImpacted: '',
        reportType: '',
        reportedBy: '',
        reportedDate: '',
        reportedTo: '',
        sentinelEvent: '',
        startDate: '',
        status: '',
        statusActive: '',
        statusClosed: '',
        statusFollowup: '',
        statusReported: '',
        title: '',
        total: '',
        updatedBy: ''
      },
      messages: {
        attachmentFileRequired: '',
        createNew: '',
        createNewIncidentCategory: '',
        fillIn: '',
        incidentCategorySaved: '',
        noClosedIncidents: '',
        noIncidentCategoriesFound: '',
        noIncidents: '',
        saved: '',
        selectExistingPatient: ''
      },
      titles: {
        addAttachment: '',
        addCategoryItem: '',
        addNote: '',
        attachments: '',
        closed: '',
        current: '',
        deleteAttachment: '',
        deleteIncident: '',
        deleteIncidentCategory: '',
        deleteItem: '',
        deleteNote: '',
        editAttachment: '',
        editIncident: '',
        editIncidentCategory: '',
        editNote: '',
        general: '',
        history: '',
        incidentCategories: '',
        incidentCategoryItem: '',
        incidentCategoryName: '',
        incidentCategorySaved: '',
        incidentSaved: '',
        incidents: '',
        incidentsByCategory: '',
        incidentsByDepartment: '',
        newIncident: '',
        newIncidentCategory: '',
        notes: '',
        reports: ''
      }
    },
    inventory: {
      edit: {
        cost: '',
        delivered: '',
        location: '',
        prescription: '',
        pulled: '',
        quantity: '',
        reason: '',
        returned: '',
        transferredFrom: '',
        transferredTo: ''
      },
      labels: {
        action: '',
        add: '',
        addAdjustmentType: '',
        adjust: '',
        adjustmentDate: '',
        adjustmentFor: '',
        adjustmentType: '',
        aisle: '',
        aisleLocation: '',
        allInventory: '',
        allItems: '',
        availableQuantity: '',
        billTo: '',
        consumePurchases: '',
        consumptionRate: '',
        cost: '',
        costPerUnit: '',
        crossReference: '',
        currentQuantity: '',
        dateCompleted: '',
        dateEffective: '',
        dateEnd: '',
        dateReceived: '',
        dateStart: '',
        dateTransferred: '',
        daysLeft: '',
        deleteItem: '',
        deliveryAisle: '',
        deliveryLocation: '',
        details: '',
        distributionUnit: '',
        editItem: '',
        expense: '',
        expirationDate: '',
        fulfillRequest: '',
        fulfillRequestNow: '',
        gift: '',
        giftInKindNo: '',
        giftInKindYes: '',
        giftUsage: '',
        inventoryConsumed: '',
        inventoryItem: '',
        inventoryObsolence: '',
        invoiceItems: '',
        invoiceLineItem: '',
        invoiceNumber: '',
        item: '',
        itemNumber: '',
        items: '',
        location: '',
        locations: '',
        markAsConsumed: '',
        name: '',
        newItem: '',
        originalQuantity: '',
        print: '',
        printBarcode: '',
        printer: '',
        pullFrom: '',
        purchaseCost: '',
        purchaseInfo: '',
        purchases: '',
        quantity: '',
        quantityAvailable: '',
        quantityOnHand: '',
        quantityRequested: '',
        rank: '',
        reason: '',
        remove: '',
        removeAdjustmentType: '',
        reorderPoint: '',
        requestedItems: '',
        returnAdjustmentType: '',
        returnToVendorAdjustmentType: '',
        salePricePerUnit: '',
        save: '',
        serialNumber: '',
        total: '',
        totalCost: '',
        totalReceived: '',
        transaction: '',
        transactions: '',
        transfer: '',
        transferFrom: '',
        transferTo: '',
        transferToAisle: '',
        unit: '',
        unitCost: '',
        vendor: '',
        vendorItemNumber: '',
        writeOffAdjustmentType: '',
        xref: ''
      },
      messages: {
        adjust: '',
        createRequest: 'Создать новый запрос?',
        itemNotFound: '',
        loading: '',
        noItems: '',
        noRequests: 'Запросов не найдено.',
        purchaseSaved: '',
        quantity: '',
        removeItem: '',
        removeItemRequest: '',
        requestFulfilled: '',
        requestUpdated: '',
        warning: ''
      },
      reports: {
        adjustment: '',
        daysSupply: '',
        expenseDetail: '',
        expenseSum: '',
        expiration: '',
        'export': '',
        fields: '',
        finance: '',
        generate: '',
        invLocation: '',
        invValuation: '',
        purchaseDetail: '',
        purchaseSum: '',
        reportType: '',
        rows: {
          adjustments: '',
          adjustmentsTotal: '',
          balanceBegin: '',
          balanceEnd: '',
          category: '',
          consumed: '',
          consumedGik: '',
          consumedGikTotal: '',
          consumedPuchases: '',
          consumedPurchasesTotal: '',
          consumedTotal: '',
          errInFinSum: '',
          errInFindPur: '',
          errInFindReq: '',
          expensesFor: '',
          noAccount: '',
          subtotal: '',
          subtotalFor: '',
          total: '',
          totalFor: '',
          totalPurchases: '',
          transfer1: '',
          trasnfer2: ''
        },
        stockTransferDetail: '',
        stockTransferSum: '',
        stockUsageDetail: '',
        stockUsageSum: '',
        titleDateRange: '',
        titleSingleDate: ''
      },
      titles: {
        addPurchase: '',
        addRequest: '',
        adjustment: '',
        editPurchase: '',
        editRequest: '',
        inventoryItem: '',
        inventoryReport: '',
        purchaseSaved: '',
        quickAddTitle: '',
        removeItem: '',
        requestFulfilled: '',
        requestUpdated: '',
        transfer: '',
        warning: ''
      }
    },
    labels: {
      action: 'Действие',
      actions: 'Действия',
      addNewOutpatientVisit: '',
      address: '',
      age: 'Возраст',
      allDay: '',
      amount: '',
      anesthesia: '',
      assisting: '',
      balanceDue: '',
      billDate: '',
      billTo: '',
      category: '',
      completed: 'Выполненые',
      country: '',
      cptcode: '',
      creditTo: '',
      date: '',
      dateCompleted: 'Дата Выполнения',
      dateOfBirth: '',
      dateOfBirthShort: '',
      datePaid: '',
      dateRequested: 'Дата Запроса',
      'delete': '',
      deleteRequest: '',
      deleteUser: '',
      department: '',
      description: '',
      discount: '',
      displayName: '',
      docRead: '',
      docWritten: '',
      edit: 'Редактировать',
      editUser: '',
      email: '',
      endDate: '',
      endTime: '',
      excess: '',
      expenseTo: '',
      fileLoadSuccessful: '',
      fileName: '',
      fileToLoad: '',
      fulfill: 'Отправить',
      fulfillRequest: '',
      fulfillRequestNow: '',
      fulfilled: '',
      grandTotal: '',
      id: 'Номер',
      imageOrders: '',
      imagingType: 'Тип визуализации',
      importFile: '',
      invoiceId: '',
      labOrders: '',
      lineItems: '',
      loading: '',
      location: '',
      lookupType: '',
      medication: '',
      name: 'Имя',
      newUser: '',
      note: '',
      notes: 'Заметки',
      number: '',
      on: '',
      password: '',
      patient: 'Пациент',
      payments: '',
      physician: '',
      prescriber: '',
      prescription: '',
      prescriptionDate: '',
      price: '',
      print: '',
      procedures: '',
      provider: '',
      pullFrom: '',
      quantity: 'Количество',
      remarks: '',
      requestedBy: 'Запрошен',
      requestedOn: 'Запрошен',
      requests: 'Ожидающие',
      result: 'Результат',
      results: 'Результаты',
      role: '',
      search: '',
      sex: 'Пол',
      startDate: '',
      startTime: '',
      status: '',
      takenBy: '',
      total: '',
      type: '',
      userCanAddNewValue: '',
      username: '',
      value: '',
      view: '',
      visit: 'Осмотр',
      'with': ''
    },
    labs: {
      alerts: {
        requestCompletedMessage: '',
        requestCompletedTitle: '',
        requestSavedMessage: '',
        requestSavedTitle: ''
      },
      buttons: { newButton: '' },
      completedTitle: '',
      deleteTitle: '',
      editTitle: '',
      labels: {
        addNewVisit: '',
        labType: ''
      },
      messages: {
        createNewRecord: '',
        noCompleted: '',
        noItemsFound: ''
      },
      newTitle: '',
      requestsTitle: '',
      sectionTitle: ''
    },
    loading: {
      messages: {
        '0': '',
        '1': '',
        '2': '',
        '3': '',
        '4': '',
        '5': '',
        '6': '',
        '7': '',
        '8': '',
        '9': '',
        '10': '',
        '11': ''
      },
      progressBar: { progress: '' }
    },
    login: {
      labels: {
        password: 'Пароль',
        signIn: 'Войти',
        username: 'Имя пользователя'
      },
      messages: {
        error: 'Неверное имя пользователя или пароль.',
        signIn: 'войдите в систему'
      }
    },
    medication: {
      alerts: {
        fulfilledTitle: '',
        returnedMessage: '',
        returnedTitle: '',
        savedMessage: '',
        savedTitle: ''
      },
      buttons: {
        dispenseMedication: '',
        newButton: '',
        returnMedication: ''
      },
      labels: {
        adjustmentDate: '',
        creditToAccount: '',
        quantityDispensed: '',
        quantityDistributed: '',
        quantityRequested: '',
        quantityToReturn: '',
        refills: '',
        returnAisle: '',
        returnLocation: '',
        returnReason: ''
      },
      messages: { createNew: '' },
      pageTitle: '',
      returnMedication: '',
      sectionTitle: '',
      titles: {
        completedMedication: '',
        editMedicationRequest: '',
        newMedicationRequest: ''
      }
    },
    messages: {
      createNewRecord: 'Создать новую запись?',
      createNewUser: '',
      'delete': '',
      delete_plural: '',
      delete_singular: '',
      forAuthorizedPersons: 'Этот отчет предназначен только для уполномоченных лиц.',
      newPatientHasToBeCreated: '',
      noHistoryAvailable: '',
      noItemsFound: 'Ничего не найдено.',
      noNotesAvailable: '',
      noUsersFound: '',
      onBehalfOf: '',
      reportError: '',
      requiredFieldsCorrectErrors: '',
      saveActionException: '',
      sorry: '',
      userHasBeenSaved: '',
      userSaved: ''
    },
    models: {
      appointment: {
        labels: {
          allDay: '',
          appointmentDate: '',
          appointmentType: '',
          endDate: '',
          location: '',
          notes: '',
          patient: '',
          provider: '',
          startDate: '',
          status: '',
          type: ''
        },
        names: {
          plural: '',
          singular: ''
        }
      },
      attachment: { names: {
          plural: '',
          singular: ''
        } },
      form: { names: {
          plural: '',
          singular: ''
        } },
      imaging: {
        names: '',
        request: {
          plural: '',
          singular: ''
        }
      },
      incident: { names: {
          plural: '',
          singular: ''
        } },
      item: { names: {
          plural: '',
          singular: ''
        } },
      lab: {
        names: {
          plural: '',
          singular: ''
        },
        request: {
          plural: '',
          singular: ''
        }
      },
      medication: {
        names: {
          plural: '',
          singular: ''
        },
        request: {
          plural: '',
          singular: ''
        }
      },
      note: { names: {
          plural: '',
          singular: ''
        } },
      patient: {
        labels: { name: '' },
        names: { singular: '' }
      },
      procedure: { names: {
          plural: '',
          singular: ''
        } },
      user: { names: {
          plural: '',
          singular: ''
        } },
      visit: { names: {
          plural: '',
          singular: ''
        } },
      vital: { names: {
          plural: '',
          singular: ''
        } }
    },
    navigation: {
      about: '',
      actions: {
        login: '',
        logout: ''
      },
      administration: '',
      billing: '',
      imaging: '',
      incident: '',
      inventory: '',
      labs: '',
      medication: '',
      patients: '',
      scheduling: '',
      subnav: {
        actions: '',
        addAppointment: '',
        addressFields: '',
        admittedPatients: '',
        appointmentSearch: '',
        appointmentsCalendar: '',
        appointmentsThisWeek: '',
        completed: '',
        currentIncidents: '',
        customForms: '',
        dispense: '',
        history: '',
        incidentCategories: '',
        inventoryReceived: '',
        invoices: '',
        items: '',
        loadDB: '',
        lookupLists: '',
        missedAppointments: '',
        newIncident: '',
        newInvoice: '',
        newPatient: '',
        newRequest: '',
        newUser: '',
        outpatient: '',
        patientListing: '',
        priceProfiles: '',
        prices: '',
        printHeader: '',
        reports: '',
        requests: '',
        returnMedication: '',
        scheduleSurgery: '',
        theaterSchedule: '',
        "today'sAppointments": '',
        userRoles: '',
        users: '',
        workflow: ''
      }
    },
    operationReport: {
      labels: {
        additionalNotes: '',
        assistant: '',
        caseComplexity: '',
        operationDescription: '',
        preOpPrimaryDiagnosis: '',
        preOpSecondaryDiagnosis: '',
        surgeon: '',
        surgeryDate: ''
      },
      messages: { reportSaved: '' },
      titles: {
        editTitle: '',
        newTitle: '',
        reportSaved: ''
      }
    },
    operativePlan: {
      buttons: { completePlan: '' },
      labels: {
        additionalNotes: '',
        admissionInstructions: '',
        caseComplexity: '',
        completedStatus: '',
        droppedStatus: '',
        operationDescription: '',
        plannedStatus: '',
        status: '',
        surgeon: ''
      },
      messages: {
        planCompleted: '',
        planSaved: ''
      },
      titles: {
        editTitle: '',
        newTitle: '',
        planCompleted: '',
        planSaved: ''
      }
    },
    patients: {
      buttons: {
        addContact: '',
        addExpense: '',
        addFamilyMember: '',
        addOperativePlan: '',
        backToPatients: '',
        download: '',
        editOperativePlan: '',
        newAppointment: '',
        newImaging: '',
        newLab: '',
        newMedication: '',
        newPatient: '',
        newPhoto: '',
        newVisit: '',
        patientCheckIn: '',
        scheduleSurgery: ''
      },
      labels: {
        admissionDate: '',
        admit: '',
        bloodType: '',
        caption: '',
        civilStatus: '',
        clinic: '',
        contacts: '',
        cost: '',
        dateOfBirth: '',
        dateProcessed: '',
        dischargeDate: '',
        dob: '',
        education: '',
        email: '',
        externalPatientId: '',
        firstName: '',
        income: '',
        insurance: '',
        lastName: '',
        middleName: '',
        monthlyCost: '',
        occupation: '',
        operativePlan: '',
        parent: '',
        patientDays: '',
        patientType: '',
        patientTypeCharity: '',
        patientTypePrivate: '',
        phone: '',
        placeOfBirth: '',
        primaryDiagnosis: '',
        referredBy: '',
        referredDate: '',
        relationship: '',
        relationships: '',
        religion: '',
        secondaryDiagnosis: '',
        sex: '',
        sexNotEntered: '',
        sources: '',
        status: '',
        totalMontlyExpense: ''
      },
      messages: {
        areYouSureDelete: '',
        createNewPatient: '',
        deletingPatient: '',
        noPatientsFound: '',
        notFoundQuickAdd: '',
        photoFileRequired: '',
        savedPatient: ''
      },
      navigation: {
        appointments: '',
        general: '',
        history: '',
        imaging: '',
        labs: '',
        medication: '',
        photos: '',
        socialWork: '',
        visits: ''
      },
      notes: {
        newNote: '',
        onBehalfOfCopy: '',
        onBehalfOfLabel: '',
        pleaseSelectAVisit: '',
        updateNote: ''
      },
      titles: {
        addContact: '',
        addPhoto: '',
        additionalContacts: '',
        admissionsDetail: '',
        admissionsSummary: '',
        admittedPatients: '',
        'delete': '',
        deleteContact: '',
        deleteExpense: '',
        deleteFamilyMember: '',
        deletePatientRecord: '',
        deletePhoto: '',
        diagnosticTesting: '',
        dischargesDetail: '',
        dischargesSummary: '',
        edit: '',
        editPhoto: '',
        expenses: '',
        familyInfo: '',
        familyInformation: '',
        'new': '',
        outpatientsForDate: '',
        patient: '',
        patientListing: '',
        patientReport: '',
        patientStatus: '',
        proceduresDetail: '',
        proceduresSummary: '',
        savedPatient: '',
        socialWork: '',
        todaysOutpatients: '',
        totalPatientDays: '',
        totalPatientDaysDetailed: '',
        visit: ''
      }
    },
    print: { invoice: {
        labels: {
          billedBy: '',
          billedDate: '',
          dateAdmitted: '',
          dateDischarged: '',
          dischargeNotes: '',
          patientAddress: '',
          patientAge: '',
          patientId: '',
          patientName: '',
          remarks: '',
          spacer: ''
        },
        messages: { whereConducted: '' },
        titles: {
          billingStatement: '',
          patientMember: '',
          patients: '',
          relContact: ''
        }
      } },
    procedures: {
      buttons: { addMedication: '' },
      labels: { medicationUsed: '' },
      messages: { saved: '' },
      titles: {
        addChargeItem: '',
        addMedicationUsed: '',
        deleteChargeItem: '',
        deleteMedicationUsed: '',
        edit: '',
        editChargeItem: '',
        editMedicationUsed: '',
        medicationUsed: '',
        'new': '',
        saved: ''
      }
    },
    reports: {
      labels: {
        admissionDate: '',
        allProcedures: '',
        completedBy: '',
        dischargeDate: '',
        examiner: '',
        images: '',
        labs: '',
        location: '',
        medications: '',
        nextAppointment: '',
        nextAppointments: '',
        notes: {
          author: '',
          date: '',
          title: ''
        },
        operativePlan: {
          description: '',
          instructions: '',
          procedures: '',
          title: ''
        },
        primaryDiagnosis: '',
        procedures: '',
        secondaryDiagnosis: '',
        visitDate: '',
        visitType: ''
      },
      messages: {
        'delete': '',
        saved: ''
      },
      titles: {
        dischargeReport: '',
        newDischargeReport: '',
        newOPDReport: '',
        opdReport: '',
        saved: ''
      }
    },
    user: {
      plusNewUser: '',
      usersPageTile: ''
    },
    visits: {
      buttons: {
        addDiagnosis: '',
        checkIn: '',
        checkOut: '',
        discharge: '',
        newAppointment: '',
        newDischargeReport: '',
        newOPDReport: '',
        newProcedure: '',
        newVitals: ''
      },
      labels: {
        appointment: '',
        authoredBy: '',
        checkInTime: '',
        checkOutTime: '',
        createNewPatient: '',
        diagnosis: '',
        examiner: '',
        finalDiagnosis: '',
        haveAppointment: '',
        haveDoneOrders: '',
        noAppointment: '',
        ordersDone: '',
        ordersNotDone: '',
        patientToCheckIn: '',
        procedure: '',
        procedureDate: '',
        reasonForVisit: '',
        reportType: '',
        status: '',
        statusAdmitted: '',
        statusCheckedIn: '',
        statusCheckedOut: '',
        statusDischarged: '',
        visitDate: '',
        visitInformation: '',
        visitType: ''
      },
      messages: {
        checkOut: '',
        checkedOut: '',
        discharged: '',
        patientCheckedIn: '',
        patientCreatedAndCheckedIn: '',
        visitAndPatientSaved: '',
        visitSaved: ''
      },
      navigation: {
        charges: '',
        notes: '',
        orders: '',
        procedures: '',
        reports: '',
        vitals: ''
      },
      titles: {
        additionalDiagnoses: '',
        checkOut: '',
        checkedIn: '',
        checkedOut: '',
        discharged: '',
        editVisit: '',
        newVisit: '',
        patientCheckIn: '',
        visitSaved: ''
      }
    },
    vitals: { labels: {
        dateRecorded: '',
        dbp: '',
        heartRate: '',
        height: '',
        respiratoryRate: '',
        sbp: '',
        temperature: '',
        weight: ''
      } }
  };
});
define('hospitalrun/locales/tr/translations', ['exports'], function (exports) {
  exports['default'] = {
    admin: {
      address: {
        address1Label: '',
        address2Label: '',
        address3Label: '',
        address4Label: '',
        addressLabel: '',
        editTitle: '',
        include1Label: '',
        include2Label: '',
        include3Label: '',
        include4Label: '',
        messages: { addressSaved: '' },
        newTitle: '',
        titles: { optionsSaved: '' }
      },
      addressOptions: '',
      customForms: {
        buttons: {
          addField: '',
          moveDown: '',
          moveUp: '',
          newForm: '',
          preview: ''
        },
        labels: {
          alwaysInclude: '',
          checkbox: '',
          colSpan: '',
          columns: '',
          customForm: '',
          dischargeReportFormType: '',
          formName: '',
          formType: '',
          incidentFormType: '',
          includeOtherOption: '',
          labFormType: '',
          label: '',
          newForm: '',
          opdReportFormType: '',
          operativePlanFormType: '',
          otherOptionLabel: '',
          patientFormType: '',
          property: '',
          radio: '',
          select: '',
          socialworkFormType: '',
          text: '',
          textarea: '',
          visitFormType: ''
        },
        messages: { formSaved: '' },
        titles: {
          checkboxValues: '',
          customForms: '',
          deleteForm: '',
          dropDownValues: '',
          editCustomForm: '',
          fields: '',
          formSaved: '',
          newCustomForm: '',
          radioValues: ''
        }
      },
      header: {
        editTitle: '',
        facilityName: '',
        headerLabel: '',
        headerLine1: '',
        headerLine2: '',
        headerLine3: '',
        logoURL: '',
        messages: { headerSaved: '' },
        newTitle: '',
        titles: { optionsSaved: '' }
      },
      loadDb: '',
      loaddb: {
        displayAlertMessage: '',
        displayAlertTitle: '',
        editTitle: '',
        errorDisplayAlertMessage: '',
        errorDisplayAlertTitle: '',
        progressMessage: '',
        progressTitle: ''
      },
      lookup: {
        aisleLocationList: '',
        alertImportListMessage: '',
        alertImportListSaveMessage: '',
        alertImportListSaveTitle: '',
        alertImportListTitle: '',
        alertImportListUpdateMessage: '',
        alertImportListUpdateTitle: '',
        anesthesiaTypes: '',
        anesthesiologists: '',
        billingCategories: '',
        clinicList: '',
        countryList: '',
        cptCodeList: '',
        diagnosisList: '',
        edit: { template: {
            addTitle: '',
            editTitle: '',
            labelTitle: '',
            updateButtonTextAdd: '',
            updateButtonTextUpdate: ''
          } },
        expenseAccountList: '',
        imagingPricingTypes: '',
        incidentDepartments: '',
        inventoryTypes: '',
        labPricingTypes: '',
        pageTitle: '',
        patientStatusList: '',
        physicianList: '',
        procedureList: '',
        procedureLocations: '',
        procedurePricingTypes: '',
        radiologists: '',
        titles: { deleteLookupValue: '' },
        unitTypes: '',
        vendorList: '',
        visitLocationList: '',
        visitTypes: '',
        wardPricingTypes: '',
        warehouseList: ''
      },
      lookupLists: '',
      roles: {
        capability: {
          addAllergy: '',
          addAppointment: '',
          addBillingDiagnosis: '',
          addCharge: '',
          addDiagnosis: '',
          addImaging: '',
          addIncident: '',
          addIncidentCategory: '',
          addInventoryItem: '',
          addInventoryPurchase: '',
          addInventoryRequest: '',
          addInvoice: '',
          addLab: '',
          addMedication: '',
          addNote: '',
          addOperationReport: '',
          addOperativePlan: '',
          addPatient: '',
          addPayment: '',
          addPhoto: '',
          addPricing: '',
          addPricingProfile: '',
          addProcedure: '',
          addSocialwork: '',
          addVisit: '',
          addVitals: '',
          adjustInventoryLocation: '',
          admin: '',
          admitPatient: '',
          appointments: '',
          billing: '',
          completeImaging: '',
          completeLab: '',
          defineUserRoles: '',
          deleteAppointment: '',
          deleteDiagnosis: '',
          deleteImaging: '',
          deleteIncident: '',
          deleteIncidentCategory: '',
          deleteInventoryItem: '',
          deleteInvoice: '',
          deleteLab: '',
          deleteMedication: '',
          deleteNote: '',
          deletePatient: '',
          deletePhoto: '',
          deletePricing: '',
          deletePricingProfile: '',
          deleteProcedure: '',
          deleteSocialwork: '',
          deleteVisit: '',
          deleteVitals: '',
          dischargePatient: '',
          editInvoice: '',
          fulfillInventory: '',
          fulfillMedication: '',
          generateIncidentReport: '',
          imaging: '',
          incident: '',
          inventory: '',
          invoices: '',
          labs: '',
          loadDb: '',
          manageIncidents: '',
          medication: '',
          overrideInvoice: '',
          patientReports: '',
          patients: '',
          pricing: '',
          updateConfig: '',
          visits: ''
        },
        messages: { roleSaved: '' },
        titles: { roleSaved: '' }
      },
      userRoles: '',
      users: '',
      visitForms: {
        labels: {
          followup: '',
          form: '',
          initial: '',
          visitType: ''
        },
        titles: { visitForms: '' }
      },
      workflow: {
        admissionDepositLabel: '',
        clinicPrepaymentLabel: '',
        editTitle: '',
        followupPrepaymentLabel: '',
        messages: { optionsSaved: '' },
        newTitle: '',
        outpatientImagingLabel: '',
        outpatientLabLabel: '',
        outpatientMedicationLabel: '',
        titles: { optionsSaved: '' },
        workflowLabel: ''
      }
    },
    alerts: {
      errorExclamation: '',
      pleaseWait: '',
      reportError: '',
      warningExclamation: ''
    },
    allergies: {
      buttons: { addAllergy: '' },
      labels: {
        allergyName: '',
        patientAllergy: ''
      },
      titles: {
        addAllergy: '',
        editAllergy: ''
      }
    },
    application: {
      messages: { sessionExpired: '' },
      titles: { sessionExpired: '' }
    },
    appointments: {
      buttons: {
        newButton: '',
        scheduleSurgery: ''
      },
      calendarTitle: '',
      currentScreenTitle: '',
      editTitle: '',
      labels: {
        noLocation: '',
        selectedStartingDate: ''
      },
      messages: {
        appointmentSaved: '',
        endTimeLaterThanStart: ''
      },
      missed: '',
      newTitle: '',
      searchTitle: '',
      sectionTitle: '',
      thisWeek: '',
      titles: {
        appointmentSaved: '',
        editSurgicalAppointment: '',
        newSurgicalAppointment: '',
        theaterSchedule: ''
      },
      todayTitle: ''
    },
    billing: {
      alerts: {
        noInvoiceFound: '',
        noPricingItems: '',
        noPricingProfiles: ''
      },
      buttons: {
        addOverride: '',
        createInvoice: ''
      },
      labels: {
        actualCharges: '',
        discountAmount: '',
        discountPercentage: '',
        externalInvoiceNumber: '',
        hmoCom: '',
        insurance: '',
        paymentProfile: '',
        paymentsDeposits: '',
        pricingPanelOverrides: '',
        pricingProfile: ''
      }
    },
    buttons: {
      add: 'Ekle',
      addItem: '',
      addLineItem: '',
      addValue: '',
      addVisit: '',
      allRequests: '',
      barcode: '',
      cancel: 'Vazgeç',
      clear: '',
      close: '',
      complete: 'Bitir',
      'delete': '',
      dispense: '',
      edit: '',
      filter: '',
      fulfill: '',
      'import': '',
      loadFile: '',
      newItem: '',
      newNote: '',
      newRequest: '',
      newRequestPlus: '',
      newUser: '',
      ok: 'Tamam',
      remove: '',
      returnButton: 'Geri Dön',
      search: '',
      showAll: '',
      showFewer: '',
      update: 'Güncelle'
    },
    components: {
      chargesByTypeTab: { charges: '' },
      customFormManager: { buttons: { addForm: '' } },
      dateTimePicker: {
        amHour: '',
        midnight: '',
        noon: '',
        pmHour: ''
      },
      imageUpload: { messages: { selectValidImageFile: '' } },
      operativeProcedures: {
        buttons: { addProcedure: '' },
        labels: { procedure: '' },
        titles: { procedures: '' }
      },
      patientOrders: {
        buttons: {
          newImaging: '',
          newLab: '',
          newMedication: ''
        },
        labels: {
          imagingOrderType: '',
          labOrderType: '',
          medicationOrderType: '',
          orderType: ''
        }
      },
      priceList: { charges: '' },
      quantityCalc: { result: '' },
      quantityConv: {
        conversion: '',
        unit: ''
      },
      sortableColumn: { labels: { selectAll: '' } },
      takePhoto: {
        camera: '',
        how: '',
        labels: {
          takeAPicture: '',
          uploadAFile: ''
        },
        photo: '',
        preview: '',
        takePhoto: '',
        uploadFile: ''
      },
      upcomingAppointments: {
        labels: {
          date: '',
          location: '',
          type: '',
          'with': ''
        },
        titles: { upcomingAppointments: '' }
      }
    },
    customForms: {
      buttons: { addForm: '' },
      labels: { formToAdd: '' },
      titles: { addCustomForm: '' }
    },
    dashboard: {
      setup: '',
      title: 'Ne yapmak istersiniz?'
    },
    dates: {
      'long': '',
      longOmitDays: '',
      longOmitDaysPlural: '',
      longOmitDaysYears: '',
      longOmitYears: '',
      longPlural: '',
      'short': '',
      shortOmitYears: ''
    },
    diagnosis: {
      labels: {
        activeDiagnosis: '',
        date: '',
        diagnosis: '',
        secondaryDiagnosis: ''
      },
      titles: {
        addDiagnosis: '',
        editDiagnosis: ''
      }
    },
    errors: {
      accepted: '',
      blank: '',
      confirmation: '',
      empty: '',
      equalTo: '',
      even: '',
      exclusion: '',
      greaterThan: '',
      greaterThanOrEqualTo: '',
      inclusion: '',
      invalid: '',
      invalidNumber: '',
      lessThan: '',
      lessThanOrEqualTo: '',
      notANumber: '',
      notAnInteger: '',
      odd: '',
      otherThan: '',
      present: '',
      result: '',
      tooLong: '',
      tooShort: '',
      wrongLength: ''
    },
    headings: { chargedItems: '' },
    imaging: {
      alerts: {
        completedMessage: 'Görüntüleme talebi başarıyla tamamlandı.',
        completedTitle: 'Görüntüleme Talebi Tamamlandı',
        savedMessage: 'Görüntüleme Talebi başarıyla kaydedildi.',
        savedTitle: 'Görüntüleme Talebi Kaydedildi'
      },
      buttons: { newButton: '+ yeni görüntüleme' },
      labels: {
        addNewVisit: '--Yeni Ziyaret Ekle--',
        radiologist: 'Radyolog'
      },
      messages: { noCompleted: 'Tamamlanmayan öğe bulunamadı.' },
      pageTitle: 'Görüntüleme talepleri',
      sectionTitle: 'Görüntüleme',
      titles: {
        completedImaging: 'Görüntüleme Tamamlandı',
        editTitle: 'Görüntüleme Talebini Düzenle',
        newTitle: 'Yeni Görüntüleme Talebi'
      }
    },
    incident: {
      buttons: {
        add: '',
        addForm: '',
        addItem: '',
        cancel: '',
        'delete': '',
        download: '',
        edit: '',
        'export': '',
        generateRep: '',
        newAttachment: '',
        newCategory: '',
        newIncident: '',
        newNote: ''
      },
      labels: {
        actions: '',
        addedBy: '',
        category: '',
        categoryItem: '',
        date: '',
        dateRecorded: '',
        department: '',
        description: '',
        endDate: '',
        givenBy: '',
        howToAddAttachment: '',
        incidentDate: '',
        incidentId: '',
        item: '',
        lastUpdated: '',
        note: '',
        patientId: '',
        patientImpacted: '',
        reportType: '',
        reportedBy: '',
        reportedDate: '',
        reportedTo: '',
        sentinelEvent: '',
        startDate: '',
        status: '',
        statusActive: '',
        statusClosed: '',
        statusFollowup: '',
        statusReported: '',
        title: '',
        total: '',
        updatedBy: ''
      },
      messages: {
        attachmentFileRequired: '',
        createNew: '',
        createNewIncidentCategory: '',
        fillIn: '',
        incidentCategorySaved: '',
        noClosedIncidents: '',
        noIncidentCategoriesFound: '',
        noIncidents: '',
        saved: '',
        selectExistingPatient: ''
      },
      titles: {
        addAttachment: '',
        addCategoryItem: '',
        addNote: '',
        attachments: '',
        closed: '',
        current: '',
        deleteAttachment: '',
        deleteIncident: '',
        deleteIncidentCategory: '',
        deleteItem: '',
        deleteNote: '',
        editAttachment: '',
        editIncident: '',
        editIncidentCategory: '',
        editNote: '',
        general: '',
        history: '',
        incidentCategories: '',
        incidentCategoryItem: '',
        incidentCategoryName: '',
        incidentCategorySaved: '',
        incidentSaved: '',
        incidents: '',
        incidentsByCategory: '',
        incidentsByDepartment: '',
        newIncident: '',
        newIncidentCategory: '',
        notes: '',
        reports: ''
      }
    },
    inventory: {
      edit: {
        cost: '',
        delivered: '',
        location: '',
        prescription: '',
        pulled: '',
        quantity: '',
        reason: '',
        returned: '',
        transferredFrom: '',
        transferredTo: ''
      },
      labels: {
        action: '',
        add: '',
        addAdjustmentType: '',
        adjust: '',
        adjustmentDate: '',
        adjustmentFor: '',
        adjustmentType: '',
        aisle: '',
        aisleLocation: '',
        allInventory: '',
        allItems: '',
        availableQuantity: '',
        billTo: '',
        consumePurchases: '',
        consumptionRate: '',
        cost: '',
        costPerUnit: '',
        crossReference: '',
        currentQuantity: '',
        dateCompleted: '',
        dateEffective: '',
        dateEnd: '',
        dateReceived: '',
        dateStart: '',
        dateTransferred: '',
        daysLeft: '',
        deleteItem: '',
        deliveryAisle: '',
        deliveryLocation: '',
        details: '',
        distributionUnit: '',
        editItem: '',
        expense: '',
        expirationDate: '',
        fulfillRequest: '',
        fulfillRequestNow: '',
        gift: '',
        giftInKindNo: '',
        giftInKindYes: '',
        giftUsage: '',
        inventoryConsumed: '',
        inventoryItem: '',
        inventoryObsolence: '',
        invoiceItems: '',
        invoiceLineItem: '',
        invoiceNumber: '',
        item: '',
        itemNumber: '',
        items: '',
        location: '',
        locations: '',
        markAsConsumed: '',
        name: '',
        newItem: '',
        originalQuantity: '',
        print: '',
        printBarcode: '',
        printer: '',
        pullFrom: '',
        purchaseCost: '',
        purchaseInfo: '',
        purchases: '',
        quantity: '',
        quantityAvailable: '',
        quantityOnHand: '',
        quantityRequested: '',
        rank: '',
        reason: '',
        remove: '',
        removeAdjustmentType: '',
        reorderPoint: '',
        requestedItems: '',
        returnAdjustmentType: '',
        returnToVendorAdjustmentType: '',
        salePricePerUnit: '',
        save: '',
        serialNumber: '',
        total: '',
        totalCost: '',
        totalReceived: '',
        transaction: '',
        transactions: '',
        transfer: '',
        transferFrom: '',
        transferTo: '',
        transferToAisle: '',
        unit: '',
        unitCost: '',
        vendor: '',
        vendorItemNumber: '',
        writeOffAdjustmentType: '',
        xref: ''
      },
      messages: {
        adjust: '',
        createRequest: 'Yeni talep oluştur?',
        itemNotFound: '',
        loading: '',
        noItems: '',
        noRequests: 'Talep bulunamadı',
        purchaseSaved: '',
        quantity: '',
        removeItem: '',
        removeItemRequest: '',
        requestFulfilled: '',
        requestUpdated: '',
        warning: ''
      },
      reports: {
        adjustment: '',
        daysSupply: '',
        expenseDetail: '',
        expenseSum: '',
        expiration: '',
        'export': '',
        fields: '',
        finance: '',
        generate: '',
        invLocation: '',
        invValuation: '',
        purchaseDetail: '',
        purchaseSum: '',
        reportType: '',
        rows: {
          adjustments: '',
          adjustmentsTotal: '',
          balanceBegin: '',
          balanceEnd: '',
          category: '',
          consumed: '',
          consumedGik: '',
          consumedGikTotal: '',
          consumedPuchases: '',
          consumedPurchasesTotal: '',
          consumedTotal: '',
          errInFinSum: '',
          errInFindPur: '',
          errInFindReq: '',
          expensesFor: '',
          noAccount: '',
          subtotal: '',
          subtotalFor: '',
          total: '',
          totalFor: '',
          totalPurchases: '',
          transfer1: '',
          trasnfer2: ''
        },
        stockTransferDetail: '',
        stockTransferSum: '',
        stockUsageDetail: '',
        stockUsageSum: '',
        titleDateRange: '',
        titleSingleDate: ''
      },
      titles: {
        addPurchase: '',
        addRequest: '',
        adjustment: '',
        editPurchase: '',
        editRequest: '',
        inventoryItem: '',
        inventoryReport: '',
        purchaseSaved: '',
        quickAddTitle: '',
        removeItem: '',
        requestFulfilled: '',
        requestUpdated: '',
        transfer: '',
        warning: ''
      }
    },
    labels: {
      action: 'İşlem',
      actions: 'İşlemler',
      addNewOutpatientVisit: '',
      address: '',
      age: 'Yaş',
      allDay: '',
      amount: '',
      anesthesia: '',
      assisting: '',
      balanceDue: '',
      billDate: '',
      billTo: '',
      category: '',
      completed: 'Tamamlandı',
      country: '',
      cptcode: '',
      creditTo: '',
      date: '',
      dateCompleted: 'Bitiş tarihi',
      dateOfBirth: '',
      dateOfBirthShort: '',
      datePaid: '',
      dateRequested: 'Talep Tarihi',
      'delete': '',
      deleteRequest: '',
      deleteUser: '',
      department: '',
      description: '',
      discount: '',
      displayName: '',
      docRead: '',
      docWritten: '',
      edit: 'Düzenle',
      editUser: '',
      email: '',
      endDate: '',
      endTime: '',
      excess: '',
      expenseTo: '',
      fileLoadSuccessful: '',
      fileName: '',
      fileToLoad: '',
      fulfill: 'Fulfill',
      fulfillRequest: '',
      fulfillRequestNow: '',
      fulfilled: '',
      grandTotal: '',
      id: 'Id',
      imageOrders: '',
      imagingType: 'Görüntüleme Tipi',
      importFile: '',
      invoiceId: '',
      labOrders: '',
      lineItems: '',
      loading: '',
      location: '',
      lookupType: '',
      medication: '',
      name: 'Ad',
      newUser: '',
      note: '',
      notes: 'Notlar',
      number: '',
      on: '',
      password: '',
      patient: 'Hasta',
      payments: '',
      physician: '',
      prescriber: '',
      prescription: '',
      prescriptionDate: '',
      price: '',
      print: '',
      procedures: '',
      provider: '',
      pullFrom: '',
      quantity: 'Miktar',
      remarks: '',
      requestedBy: 'Talep sahibi',
      requestedOn: 'Açık Talep',
      requests: 'Talepler',
      result: 'Sonuç',
      results: 'Sonuçlar',
      role: '',
      search: '',
      sex: 'Cinsiyet',
      startDate: '',
      startTime: '',
      status: '',
      takenBy: '',
      total: '',
      type: '',
      userCanAddNewValue: '',
      username: '',
      value: '',
      view: '',
      visit: 'Ziyaret',
      'with': ''
    },
    labs: {
      alerts: {
        requestCompletedMessage: '',
        requestCompletedTitle: '',
        requestSavedMessage: '',
        requestSavedTitle: ''
      },
      buttons: { newButton: '' },
      completedTitle: '',
      deleteTitle: '',
      editTitle: '',
      labels: {
        addNewVisit: '',
        labType: ''
      },
      messages: {
        createNewRecord: '',
        noCompleted: '',
        noItemsFound: ''
      },
      newTitle: '',
      requestsTitle: '',
      sectionTitle: ''
    },
    loading: {
      messages: {
        '0': '',
        '1': '',
        '2': '',
        '3': '',
        '4': '',
        '5': '',
        '6': '',
        '7': '',
        '8': '',
        '9': '',
        '10': '',
        '11': ''
      },
      progressBar: { progress: '' }
    },
    login: {
      labels: {
        password: 'Parola',
        signIn: 'Giriş yap',
        username: 'Kullanıcı Adı'
      },
      messages: {
        error: 'Kullanıcı adı veya parola hatalı.',
        signIn: 'GİRİŞ YAPIN'
      }
    },
    medication: {
      alerts: {
        fulfilledTitle: '',
        returnedMessage: '',
        returnedTitle: '',
        savedMessage: '',
        savedTitle: ''
      },
      buttons: {
        dispenseMedication: '',
        newButton: '',
        returnMedication: ''
      },
      labels: {
        adjustmentDate: '',
        creditToAccount: '',
        quantityDispensed: '',
        quantityDistributed: '',
        quantityRequested: '',
        quantityToReturn: '',
        refills: '',
        returnAisle: '',
        returnLocation: '',
        returnReason: ''
      },
      messages: { createNew: '' },
      pageTitle: '',
      returnMedication: '',
      sectionTitle: '',
      titles: {
        completedMedication: '',
        editMedicationRequest: '',
        newMedicationRequest: ''
      }
    },
    messages: {
      createNewRecord: 'Yeni bir kayıt oluştur?',
      createNewUser: '',
      'delete': '',
      delete_plural: '',
      delete_singular: '',
      forAuthorizedPersons: 'Bu rapor yetkili kişiler içindir.',
      newPatientHasToBeCreated: '',
      noHistoryAvailable: '',
      noItemsFound: 'Hiçbir öğe bulunamadı.',
      noNotesAvailable: '',
      noUsersFound: '',
      onBehalfOf: '',
      reportError: '',
      requiredFieldsCorrectErrors: '',
      saveActionException: '',
      sorry: '',
      userHasBeenSaved: '',
      userSaved: ''
    },
    models: {
      appointment: {
        labels: {
          allDay: '',
          appointmentDate: '',
          appointmentType: '',
          endDate: '',
          location: '',
          notes: '',
          patient: '',
          provider: '',
          startDate: '',
          status: '',
          type: ''
        },
        names: {
          plural: '',
          singular: ''
        }
      },
      attachment: { names: {
          plural: '',
          singular: ''
        } },
      form: { names: {
          plural: '',
          singular: ''
        } },
      imaging: {
        names: '',
        request: {
          plural: '',
          singular: ''
        }
      },
      incident: { names: {
          plural: '',
          singular: ''
        } },
      item: { names: {
          plural: '',
          singular: ''
        } },
      lab: {
        names: {
          plural: '',
          singular: ''
        },
        request: {
          plural: '',
          singular: ''
        }
      },
      medication: {
        names: {
          plural: '',
          singular: ''
        },
        request: {
          plural: '',
          singular: ''
        }
      },
      note: { names: {
          plural: '',
          singular: ''
        } },
      patient: {
        labels: { name: '' },
        names: { singular: '' }
      },
      procedure: { names: {
          plural: '',
          singular: ''
        } },
      user: { names: {
          plural: '',
          singular: ''
        } },
      visit: { names: {
          plural: '',
          singular: ''
        } },
      vital: { names: {
          plural: '',
          singular: ''
        } }
    },
    navigation: {
      about: '',
      actions: {
        login: '',
        logout: ''
      },
      administration: '',
      billing: '',
      imaging: '',
      incident: '',
      inventory: '',
      labs: '',
      medication: '',
      patients: '',
      scheduling: '',
      subnav: {
        actions: '',
        addAppointment: '',
        addressFields: '',
        admittedPatients: '',
        appointmentSearch: '',
        appointmentsCalendar: '',
        appointmentsThisWeek: '',
        completed: '',
        currentIncidents: '',
        customForms: '',
        dispense: '',
        history: '',
        incidentCategories: '',
        inventoryReceived: '',
        invoices: '',
        items: '',
        loadDB: '',
        lookupLists: '',
        missedAppointments: '',
        newIncident: '',
        newInvoice: '',
        newPatient: '',
        newRequest: '',
        newUser: '',
        outpatient: '',
        patientListing: '',
        priceProfiles: '',
        prices: '',
        printHeader: '',
        reports: '',
        requests: '',
        returnMedication: '',
        scheduleSurgery: '',
        theaterSchedule: '',
        "today'sAppointments": '',
        userRoles: '',
        users: '',
        workflow: ''
      }
    },
    operationReport: {
      labels: {
        additionalNotes: '',
        assistant: '',
        caseComplexity: '',
        operationDescription: '',
        preOpPrimaryDiagnosis: '',
        preOpSecondaryDiagnosis: '',
        surgeon: '',
        surgeryDate: ''
      },
      messages: { reportSaved: '' },
      titles: {
        editTitle: '',
        newTitle: '',
        reportSaved: ''
      }
    },
    operativePlan: {
      buttons: { completePlan: '' },
      labels: {
        additionalNotes: '',
        admissionInstructions: '',
        caseComplexity: '',
        completedStatus: '',
        droppedStatus: '',
        operationDescription: '',
        plannedStatus: '',
        status: '',
        surgeon: ''
      },
      messages: {
        planCompleted: '',
        planSaved: ''
      },
      titles: {
        editTitle: '',
        newTitle: '',
        planCompleted: '',
        planSaved: ''
      }
    },
    patients: {
      buttons: {
        addContact: '',
        addExpense: '',
        addFamilyMember: '',
        addOperativePlan: '',
        backToPatients: '',
        download: '',
        editOperativePlan: '',
        newAppointment: '',
        newImaging: '',
        newLab: '',
        newMedication: '',
        newPatient: '',
        newPhoto: '',
        newVisit: '',
        patientCheckIn: '',
        scheduleSurgery: ''
      },
      labels: {
        admissionDate: '',
        admit: '',
        bloodType: '',
        caption: '',
        civilStatus: '',
        clinic: '',
        contacts: '',
        cost: '',
        dateOfBirth: '',
        dateProcessed: '',
        dischargeDate: '',
        dob: '',
        education: '',
        email: '',
        externalPatientId: '',
        firstName: '',
        income: '',
        insurance: '',
        lastName: '',
        middleName: '',
        monthlyCost: '',
        occupation: '',
        operativePlan: '',
        parent: '',
        patientDays: '',
        patientType: '',
        patientTypeCharity: '',
        patientTypePrivate: '',
        phone: '',
        placeOfBirth: '',
        primaryDiagnosis: '',
        referredBy: '',
        referredDate: '',
        relationship: '',
        relationships: '',
        religion: '',
        secondaryDiagnosis: '',
        sex: '',
        sexNotEntered: '',
        sources: '',
        status: '',
        totalMontlyExpense: ''
      },
      messages: {
        areYouSureDelete: '',
        createNewPatient: '',
        deletingPatient: '',
        noPatientsFound: '',
        notFoundQuickAdd: '',
        photoFileRequired: '',
        savedPatient: ''
      },
      navigation: {
        appointments: '',
        general: '',
        history: '',
        imaging: '',
        labs: '',
        medication: '',
        photos: '',
        socialWork: '',
        visits: ''
      },
      notes: {
        newNote: '',
        onBehalfOfCopy: '',
        onBehalfOfLabel: '',
        pleaseSelectAVisit: '',
        updateNote: ''
      },
      titles: {
        addContact: '',
        addPhoto: '',
        additionalContacts: '',
        admissionsDetail: '',
        admissionsSummary: '',
        admittedPatients: '',
        'delete': '',
        deleteContact: '',
        deleteExpense: '',
        deleteFamilyMember: '',
        deletePatientRecord: '',
        deletePhoto: '',
        diagnosticTesting: '',
        dischargesDetail: '',
        dischargesSummary: '',
        edit: '',
        editPhoto: '',
        expenses: '',
        familyInfo: '',
        familyInformation: '',
        'new': '',
        outpatientsForDate: '',
        patient: '',
        patientListing: '',
        patientReport: '',
        patientStatus: '',
        proceduresDetail: '',
        proceduresSummary: '',
        savedPatient: '',
        socialWork: '',
        todaysOutpatients: '',
        totalPatientDays: '',
        totalPatientDaysDetailed: '',
        visit: ''
      }
    },
    print: { invoice: {
        labels: {
          billedBy: '',
          billedDate: '',
          dateAdmitted: '',
          dateDischarged: '',
          dischargeNotes: '',
          patientAddress: '',
          patientAge: '',
          patientId: '',
          patientName: '',
          remarks: '',
          spacer: ''
        },
        messages: { whereConducted: '' },
        titles: {
          billingStatement: '',
          patientMember: '',
          patients: '',
          relContact: ''
        }
      } },
    procedures: {
      buttons: { addMedication: '' },
      labels: { medicationUsed: '' },
      messages: { saved: '' },
      titles: {
        addChargeItem: '',
        addMedicationUsed: '',
        deleteChargeItem: '',
        deleteMedicationUsed: '',
        edit: '',
        editChargeItem: '',
        editMedicationUsed: '',
        medicationUsed: '',
        'new': '',
        saved: ''
      }
    },
    reports: {
      labels: {
        admissionDate: '',
        allProcedures: '',
        completedBy: '',
        dischargeDate: '',
        examiner: '',
        images: '',
        labs: '',
        location: '',
        medications: '',
        nextAppointment: '',
        nextAppointments: '',
        notes: {
          author: '',
          date: '',
          title: ''
        },
        operativePlan: {
          description: '',
          instructions: '',
          procedures: '',
          title: ''
        },
        primaryDiagnosis: '',
        procedures: '',
        secondaryDiagnosis: '',
        visitDate: '',
        visitType: ''
      },
      messages: {
        'delete': '',
        saved: ''
      },
      titles: {
        dischargeReport: '',
        newDischargeReport: '',
        newOPDReport: '',
        opdReport: '',
        saved: ''
      }
    },
    user: {
      plusNewUser: '',
      usersPageTile: ''
    },
    visits: {
      buttons: {
        addDiagnosis: '',
        checkIn: '',
        checkOut: '',
        discharge: '',
        newAppointment: '',
        newDischargeReport: '',
        newOPDReport: '',
        newProcedure: '',
        newVitals: ''
      },
      labels: {
        appointment: '',
        authoredBy: '',
        checkInTime: '',
        checkOutTime: '',
        createNewPatient: '',
        diagnosis: '',
        examiner: '',
        finalDiagnosis: '',
        haveAppointment: '',
        haveDoneOrders: '',
        noAppointment: '',
        ordersDone: '',
        ordersNotDone: '',
        patientToCheckIn: '',
        procedure: '',
        procedureDate: '',
        reasonForVisit: '',
        reportType: '',
        status: '',
        statusAdmitted: '',
        statusCheckedIn: '',
        statusCheckedOut: '',
        statusDischarged: '',
        visitDate: '',
        visitInformation: '',
        visitType: ''
      },
      messages: {
        checkOut: '',
        checkedOut: '',
        discharged: '',
        patientCheckedIn: '',
        patientCreatedAndCheckedIn: '',
        visitAndPatientSaved: '',
        visitSaved: ''
      },
      navigation: {
        charges: '',
        notes: '',
        orders: '',
        procedures: '',
        reports: '',
        vitals: ''
      },
      titles: {
        additionalDiagnoses: '',
        checkOut: '',
        checkedIn: '',
        checkedOut: '',
        discharged: '',
        editVisit: '',
        newVisit: '',
        patientCheckIn: '',
        visitSaved: ''
      }
    },
    vitals: { labels: {
        dateRecorded: '',
        dbp: '',
        heartRate: '',
        height: '',
        respiratoryRate: '',
        sbp: '',
        temperature: '',
        weight: ''
      } }
  };
});
define('hospitalrun/locales/ur/translations', ['exports'], function (exports) {
  exports['default'] = {
    admin: {
      address: {
        address1Label: 'ایڈریس 1 لیبل',
        address2Label: 'ایڈریس 2 لیبل',
        address3Label: 'ایڈریس 3 لیبل',
        address4Label: 'ایڈریس 4 لیبل',
        addressLabel: 'ایڈریس',
        editTitle: 'ایڈریس آپشنز',
        include1Label: '1 لیبل شامل کریں',
        include2Label: '2 لیبل شامل کریں',
        include3Label: '3 لیبل شامل کریں',
        include4Label: '4 لیبل شامل کریں',
        messages: { addressSaved: 'ایڈریس آپشنز محفوظ کرلیے گۓ ہیں' },
        newTitle: 'ایڈریس آپشنز',
        titles: { optionsSaved: 'آپشنز محفوظ ہوگۓ' }
      },
      addressOptions: 'ایڈرس آپشنز',
      customForms: {
        buttons: {
          addField: 'فیلڈ کا اضافہ کریں',
          moveDown: 'نیچے منتقل کریں',
          moveUp: 'اوپر منتقل کریں',
          newForm: '+ نیا فام',
          preview: 'مشاہدہ کریں'
        },
        labels: {
          alwaysInclude: 'ہمیشہ شامل',
          checkbox: 'چیک باکس',
          colSpan: 'پھیلاؤ کے کالموں کی تعداد',
          columns: 'کالم',
          customForm: 'کسٹم فام',
          dischargeReportFormType: '',
          formName: 'فارم کا نام',
          formType: 'فارم کی قسم',
          incidentFormType: '',
          includeOtherOption: 'دیگر آپشن شامل کریں',
          labFormType: '',
          label: 'لیبل',
          newForm: 'نیا فارم',
          opdReportFormType: '',
          operativePlanFormType: 'آپریٹو پلان اور رپورٹ',
          otherOptionLabel: 'دیگر آپشن لیبل',
          patientFormType: 'مریض',
          property: 'خصوصیت',
          radio: 'ریڈیو',
          select: 'ڈراپ ڈاؤن',
          socialworkFormType: 'سماجی کام',
          text: 'عبارت',
          textarea: 'بڑی عبارت',
          visitFormType: 'دورہ'
        },
        messages: { formSaved: 'فارم محفوظ ہوگیا ہے {{name}} ' },
        titles: {
          checkboxValues: 'چیک باکس میں قیمتیں',
          customForms: 'کسٹم فارمز',
          deleteForm: 'کسٹم فارم حذف کریں',
          dropDownValues: 'ڈراپ ڈاؤن فہرست',
          editCustomForm: 'کسٹم فارم میں ترمیم کریں',
          fields: 'قطعات',
          formSaved: 'فارم محفوظ ہوگیا',
          newCustomForm: 'نئے کسٹم فارم',
          radioValues: 'ریڈیو میں قیمتیں'
        }
      },
      header: {
        editTitle: '',
        facilityName: '',
        headerLabel: '',
        headerLine1: '',
        headerLine2: '',
        headerLine3: '',
        logoURL: '',
        messages: { headerSaved: '' },
        newTitle: '',
        titles: { optionsSaved: '' }
      },
      loadDb: 'DB لوڈ کریں',
      loaddb: {
        displayAlertMessage: 'لوڈ کرنے کے لئے فائل کو منتخب کیجیے.',
        displayAlertTitle: 'لوڈ کرنے کے لئے فائل کو منتخب کریں',
        editTitle: 'DB لوڈ کریں',
        errorDisplayAlertMessage: 'ڈیٹا بیس امپورٹ نہیں ہوسکتی. یہ خامی  ہے {{error}}',
        errorDisplayAlertTitle: 'لوڈ کرنے میں خامی',
        progressMessage: 'آپ کا ڈیٹابیس لوڈ کیا جا رہا ہے، براۂ مہربانی انتظار کریں.',
        progressTitle: 'ڈیٹابیس لوڈ ہو رہا ہے'
      },
      lookup: {
        aisleLocationList: 'انوینٹری راہداری مقامات',
        alertImportListMessage: 'امپورٹ کرنے کے لئے فائل کو منتخب کیجیے',
        alertImportListSaveMessage: 'تلاش فہرست امپورٹ ہو گئی ہے.',
        alertImportListSaveTitle: 'لسٹ امپورٹ ہوگئ',
        alertImportListTitle: 'امپورٹ کرنے کے لئے فائل کو منتخب کریں',
        alertImportListUpdateMessage: 'تلاش فہرست محفوظ ہو گئی ہے.',
        alertImportListUpdateTitle: 'فہرست محفوظ',
        anesthesiaTypes: 'اینستھیزیا کی اقسام',
        anesthesiologists: 'اینستھیسیالوجسٹس',
        billingCategories: 'بلنگ کی اقسام',
        clinicList: 'کلینک مقامات',
        countryList: 'ممالک',
        cptCodeList: 'CPT کوڈز',
        diagnosisList: 'تشخیص',
        edit: { template: {
            addTitle: 'قیمت شامل کریں',
            editTitle: 'قیمت ترمیم کریں',
            labelTitle: 'قدر',
            updateButtonTextAdd: 'شامل کریں',
            updateButtonTextUpdate: 'اپ ڈیٹ'
          } },
        expenseAccountList: 'اخراجات اکاؤنٹس',
        imagingPricingTypes: 'امیجنگ قیمتوں کا تعین کی اقسام',
        incidentDepartments: '',
        inventoryTypes: 'انوینٹری کی اقسا م',
        labPricingTypes: 'لیب کی قیمتوں کا تعین کی اقسام',
        pageTitle: 'تلاش فہرستیں',
        patientStatusList: 'مریض سٹیٹس کی فہرست',
        physicianList: 'ڈاکٹر',
        procedureList: 'طریقہ کار',
        procedureLocations: 'طریقہ کار مقامات',
        procedurePricingTypes: 'ضابطے کی قیمتوں کا تعین کی اقسام',
        radiologists: 'ریڈیولوجسٹ',
        titles: { deleteLookupValue: 'قدر حذف کریں' },
        unitTypes: 'یونٹ کی اقسام',
        vendorList: 'وینڈر',
        visitLocationList: 'دورہ مقامات',
        visitTypes: 'دورہ کی اقسا م',
        wardPricingTypes: 'وارڈ کی قیمتوں کا تعین کی اقسام',
        warehouseList: 'انوینٹری مقامات'
      },
      lookupLists: 'تلاش فہرستیں',
      roles: {
        capability: {
          addAllergy: 'الرجی کا اضافہ کریں',
          addAppointment: 'ملاقات اضافہ',
          addBillingDiagnosis: 'بلنگ تشخیص شامل کریں',
          addCharge: 'چارج شامل کریں',
          addDiagnosis: 'تشخیص کے لئے شامل کریں',
          addImaging: 'امیجنگ کا اضافہ کریں',
          addIncident: '',
          addIncidentCategory: '',
          addInventoryItem: 'انوینٹری آئٹم شامل کریں',
          addInventoryPurchase: 'انوینٹری کی خریداری شامل کریں',
          addInventoryRequest: 'انوینٹری کی درخواست شامل کریں',
          addInvoice: 'رسید شامل کریں',
          addLab: 'لیب شامل کریں',
          addMedication: 'ادویات شامل',
          addNote: 'نوٹ شامل',
          addOperationReport: 'آپریشن رپورٹ شامل کریں',
          addOperativePlan: 'آپریٹو پلان شامل کریں',
          addPatient: 'مریض شامل کریں',
          addPayment: 'ادائیگی شامل کریں',
          addPhoto: 'تصویر کا اضافہ کریں',
          addPricing: 'قیمتوں کا تعین شامل کریں',
          addPricingProfile: 'قیمتوں کا تعین پروفائل شامل کریں',
          addProcedure: 'ضابطے شامل کریں',
          addSocialwork: 'سوشل ورک شامل',
          addVisit: 'دورہ شامل کریں',
          addVitals: 'vitals شامل کریں',
          adjustInventoryLocation: 'انوینٹری مقام کو درست کریں',
          admin: 'انتظامیہ',
          admitPatient: 'مریض جمع کریں',
          appointments: 'ملاقاتیں',
          billing: 'بلنگ',
          completeImaging: 'مکمل امیجنگ',
          completeLab: 'مکمل لیب',
          defineUserRoles: 'صارف کے کردار کی وضاحت کریں',
          deleteAppointment: 'ملاقات حذف کریں',
          deleteDiagnosis: 'تشخیس حذف کریں',
          deleteImaging: 'امیجنگ حذف کریں',
          deleteIncident: '',
          deleteIncidentCategory: '',
          deleteInventoryItem: 'حذف انوینٹری آئٹم',
          deleteInvoice: 'رسید کو حذف کریں',
          deleteLab: 'لیب حذف کریں',
          deleteMedication: 'ادویات حذف کریں',
          deleteNote: 'نوٹ حذف کریں',
          deletePatient: 'مریض کو حذف کریں',
          deletePhoto: 'تصویر حذف',
          deletePricing: 'قیمتوں کا تعین حذف کریں',
          deletePricingProfile: 'قیمتوں کا تعین پروفائل حذف کریں',
          deleteProcedure: 'ضابطہ حذف کریں',
          deleteSocialwork: 'سماجی کام حذف کریں',
          deleteVisit: ' دورہ حذف کریں',
          deleteVitals: ' vitals حذف کریں',
          dischargePatient: 'تخریج مریض',
          editInvoice: 'رسید میں ترمیم کریں',
          fulfillInventory: 'انوینٹری پورا کریں',
          fulfillMedication: 'ادویات پورا کریں',
          generateIncidentReport: '',
          imaging: 'امیجنگ',
          incident: '',
          inventory: 'انوینٹری',
          invoices: 'رسیدیں',
          labs: 'لیبز',
          loadDb: 'لوڈ کریں ڈیٹا بیس',
          manageIncidents: '',
          medication: 'ادویات',
          overrideInvoice: 'رسید کو منسوخ کردے',
          patientReports: 'مریض کی رپورٹیں',
          patients: 'مریض',
          pricing: 'قیمتوں کا تعین',
          updateConfig: 'اپ ڈیٹ کی ترتیب',
          visits: 'دورے'
        },
        messages: { roleSaved: '{{roleName}} کردار محفوظ ہوگیا ہے.' },
        titles: { roleSaved: 'کردار محفوظ ہوگیا ہے' }
      },
      userRoles: 'صارف کے کردار',
      users: 'صارفین',
      visitForms: {
        labels: {
          followup: 'فالواپ',
          form: 'فارم',
          initial: 'ابتدائی',
          visitType: 'دورہ کی قسم'
        },
        titles: { visitForms: 'دورہ فارم' }
      },
      workflow: {
        admissionDepositLabel: 'داخلہ جمع کی ضرورت',
        clinicPrepaymentLabel: 'کلینک قبل از استعمال ادائیگی کی ضرورت',
        editTitle: 'ورک فلو آپشنز',
        followupPrepaymentLabel: 'تعاقب قبل از استعمال ادائیگی کی ضرورت',
        messages: { optionsSaved: 'ورک فلو آپشنز محفوظ ہوگۓ ہیں' },
        newTitle: 'ورک فلو آپشنز',
        outpatientImagingLabel: 'بیرونی مریض کی امیجنگ قبل از استعمال ادائیگی کی ضرورت',
        outpatientLabLabel: 'بیرونی مریضوں کی لیب قبل از استعمال ادائیگی کی ضرورت',
        outpatientMedicationLabel: 'بیرونی مریضوں کی ادویات قبل از استعمال ادائیگی کی ضرورت',
        titles: { optionsSaved: 'آپشنز محفوظ ہوگۓ' },
        workflowLabel: 'فلو آپشنز'
      }
    },
    alerts: {
      errorExclamation: 'خرابی !!!!',
      pleaseWait: 'برائے مہربانی انتظار کریں',
      reportError: ' رپورٹ کی تیاری میں خرابی',
      warningExclamation: 'انتباہ !!!!'
    },
    allergies: {
      buttons: { addAllergy: 'الرجی شامل کریں' },
      labels: {
        allergyName: 'نام',
        patientAllergy: 'مریض کی الرجی'
      },
      titles: {
        addAllergy: 'الرجی شامل کریں',
        editAllergy: 'الرجی میں ترمیم کریں'
      }
    },
    application: {
      messages: { sessionExpired: 'آپ کا سیشن متروک ہو گیا ہے۔ کاروائی جاری رکھنے کے لاگ ان کریں' },
      titles: { sessionExpired: 'سیشن کی مدت ختم ہوگئی' }
    },
    appointments: {
      buttons: {
        newButton: '+ نئی ملاقات',
        scheduleSurgery: ' + سرجری کا وقت مقرر کریں'
      },
      calendarTitle: ' ملاقات کا کیلنڈر',
      currentScreenTitle: 'ملاقات کی فہرست',
      editTitle: 'ملاقات میں ترمیم کریں',
      labels: {
        noLocation: 'کوئی مقام نہیں',
        selectedStartingDate: 'اس تاریخ پر یا اس کے بعد کی ملاقاتیں دیکھیں'
      },
      messages: {
        appointmentSaved: '  - مریض کے  ساتھ ملاقات محفوظ کر لی گئی ہے {{patient}}',
        endTimeLaterThanStart: 'براہ مہربانی وقت آغاز کے بعد کا ختم وقت منتخب کریں۔'
      },
      missed: 'چوک جانے والی ملاقاتیں',
      newTitle: 'نئی ملاقات',
      searchTitle: 'ملاقاتیں تلاش کریں',
      sectionTitle: 'ملاقاتیں',
      thisWeek: 'اس ہفتہ کی ملاقاتیں',
      titles: {
        appointmentSaved: 'ملاقات محفوظ کر لی گئی',
        editSurgicalAppointment: 'سرجری کی ملاقات میں ترمیم کریں',
        newSurgicalAppointment: 'نئی سرجری کی ملاقات',
        theaterSchedule: 'تھیٹر اوقات نامہ'
      },
      todayTitle: 'آج کی ملاقاتیں'
    },
    billing: {
      alerts: {
        noInvoiceFound: 'کوئی رسید نہیں ملی',
        noPricingItems: 'کوئی قیمتوں کے تعیں والی اشیاء نہیں ملی',
        noPricingProfiles: 'کوئی قیمتوں کے تعیں والی پروفائل نہیں ملی'
      },
      buttons: {
        addOverride: 'منسوخ شامل کریں',
        createInvoice: 'ایک رسید بنائیں؟'
      },
      labels: {
        actualCharges: 'اصل قیمت',
        discountAmount: 'ڈسکاؤنٹ رقم',
        discountPercentage: 'رعایت فی صد',
        externalInvoiceNumber: 'بیرونی رسید #',
        hmoCom: 'HMO / COM',
        insurance: 'قومی بیمہ',
        paymentProfile: 'ادائیگی پروفائل',
        paymentsDeposits: 'ادائیگی / جمع کھاتہ',
        pricingPanelOverrides: 'قیمتوں کا تعین پروفائل کی منسوخی',
        pricingProfile: 'قیمتوں کا تعین پروفائل'
      }
    },
    buttons: {
      add: 'شامل کریں',
      addItem: 'آئٹم شامل کریں',
      addLineItem: 'لائن آئٹم شامل کریں',
      addValue: 'قیمت جمع کریں',
      addVisit: 'دورہ میں شامل کریں',
      allRequests: 'تمام درخواستیں',
      barcode: 'بارکوڈ',
      cancel: 'منسوخ کریں',
      clear: 'صاف',
      close: 'بند کریں',
      complete: 'مکمل',
      'delete': 'حذف کریں',
      dispense: 'تقسیم',
      edit: 'تصیح',
      filter: 'فلٹر',
      fulfill: 'پورا کریں',
      'import': ' امپورٹ کریں',
      loadFile: 'فائل لوڈ کریں',
      newItem: '+ نیا آئٹم',
      newNote: 'نیا نوٹ',
      newRequest: 'نئی درخواست',
      newRequestPlus: '+ نئی درخواست',
      newUser: 'نیا صارف',
      ok: 'ٹھیک ہے',
      remove: 'دور کریں',
      returnButton: 'واپسی',
      search: 'تلاش کریں',
      showAll: 'سارے دکھائیں',
      showFewer: 'کم دکھائیں',
      update: 'اپ ڈیٹ'
    },
    components: {
      chargesByTypeTab: { charges: 'چارجز' },
      customFormManager: { buttons: { addForm: 'فارم کا اضافہ کریں' } },
      dateTimePicker: {
        amHour: '{{hour}} AM',
        midnight: 'آدھی رات',
        noon: 'دوپہر',
        pmHour: '{{hour}} PM'
      },
      imageUpload: { messages: { selectValidImageFile: '' } },
      operativeProcedures: {
        buttons: { addProcedure: 'ضابطے شامل کریں' },
        labels: { procedure: 'طریقہ کار' },
        titles: { procedures: 'طریقہ کار/ ضابطے' }
      },
      patientOrders: {
        buttons: {
          newImaging: 'نئی امیجنگ',
          newLab: 'نئی لیب',
          newMedication: 'نئی ادویات'
        },
        labels: {
          imagingOrderType: 'امیجنگ',
          labOrderType: 'لیب',
          medicationOrderType: 'ادویات',
          orderType: 'آرڈر کی قسم'
        }
      },
      priceList: { charges: '{{pricingType}} چارجز' },
      quantityCalc: { result: '{{targetUnit}} کل: {{calculated}}' },
      quantityConv: {
        conversion: ' میں کیا شامل ہے؟ {{name}} 1',
        unit: 'اکائی'
      },
      sortableColumn: { labels: { selectAll: '(تمام منتخب کریں)' } },
      takePhoto: {
        camera: 'کیمرہ',
        how: 'آپ ایک تصویر کو کس طرح شامل کرنا چاہتے ہیں؟',
        labels: {
          takeAPicture: '',
          uploadAFile: ''
        },
        photo: 'تصویر',
        preview: 'پیش نظارہ',
        takePhoto: 'تصویر کھینچیں',
        uploadFile: 'فائل اپ لوڈ کریں'
      },
      upcomingAppointments: {
        labels: {
          date: 'تاریخ',
          location: 'مقام',
          type: 'قسم',
          'with': 'کے ساتھ'
        },
        titles: { upcomingAppointments: 'عنقریب آنے والی ملاقاتیں' }
      }
    },
    customForms: {
      buttons: { addForm: 'فارم شامل کریں' },
      labels: { formToAdd: 'شامل کرنے کے لئے فارم' },
      titles: { addCustomForm: 'کسٹم فارم شامل کریں' }
    },
    dashboard: {
      setup: '',
      title: 'آپ کیا کرنا چاہیں گے؟'
    },
    dates: {
      'long': 'دن {{days}} مہینے {{months}} سال {{years}}',
      longOmitDays: 'مہینے {{months}} سال {{years}}',
      longOmitDaysPlural: 'مہینے {{months}} سال {{years}}',
      longOmitDaysYears: 'مہینے {{months}}',
      longOmitYears: 'دن {{days}} مہینے {{months}}',
      longPlural: 'دن {{days}} مہینے {{months}} سال {{years}}',
      'short': 'د{{days} م{{months}} س{{years}}',
      shortOmitYears: 'د{{days} م{{months}}'
    },
    diagnosis: {
      labels: {
        activeDiagnosis: 'فعال تشخیص',
        date: 'تاریخ',
        diagnosis: 'تشخیص',
        secondaryDiagnosis: 'ثانوی تشخیص'
      },
      titles: {
        addDiagnosis: 'تشخیص کے لئے شامل کریں',
        editDiagnosis: 'تشخیص میں ترمیم کریں'
      }
    },
    errors: {
      accepted: 'قبول کرنا ضروری',
      blank: 'خالی نہیں رہ سکتی',
      confirmation: 'کے مماثل نہیں ہے {{attribute}}',
      empty: 'خالی نہیں ہو سکتا',
      equalTo: 'کے برابر ہونا چاہیے {{count}}',
      even: 'جفت ہونا ضروری ہے',
      exclusion: 'مخصوص ہے',
      greaterThan: 'سے زیادہ ہونا چاہیے {{count}}',
      greaterThanOrEqualTo: 'سے زیادہ یا برابر ہونا چاہیے {{count}}',
      inclusion: 'فہرست میں شامل نہیں ہے',
      invalid: 'غلط ہے',
      invalidNumber: 'درست نمبر نہیں',
      lessThan: 'سے کم ہونا چاہیے {{count}}',
      lessThanOrEqualTo: 'سے کم یا برابر ہونا چاہیے {{count}}',
      notANumber: 'ایک نمبر نہیں ہے',
      notAnInteger: 'ایک عددی ہونا لازمی ہے',
      odd: 'طاق ہونا ضروری ہے',
      otherThan: 'سے مختلف ہونا چاہیے {{count}}',
      present: 'خالی ہونا ضروری ہے',
      result: 'براے مہربانی مکمل کرنے سے پہلے نتیجہ درج کریں',
      tooLong: 'حروف {{count}}بہت طویل ہے، زیادہ سے زیادہ ',
      tooShort: 'حروف{{count}}بہت مختصر ہے کم از کم ',
      wrongLength: 'حروف ہونے چاہئے{{count}}غلط لمبائی ہے '
    },
    headings: { chargedItems: 'چارج اشیا' },
    imaging: {
      alerts: {
        completedMessage: 'امیجنگ درخواست کو مکمل کیا گیا ہے',
        completedTitle: 'امیجنگ درخواست مکمل',
        savedMessage: 'امیجنگ درخواست کو محفوظ کر لیا گیا ہے۔',
        savedTitle: 'امیجنگ گذارش بچا لیا'
      },
      buttons: { newButton: '+ نئے امیجنگ' },
      labels: {
        addNewVisit: '--- نیا دورہ شامل کریں ---',
        radiologist: 'ریڈیولوجسٹ'
      },
      messages: { noCompleted: 'کوئی مکمل اشیاء نہیں موجود۔' },
      pageTitle: 'امیجنگ درخواستیں',
      sectionTitle: 'امیجنگ',
      titles: {
        completedImaging: 'امیجنگ مکمل',
        editTitle: 'امیجنگ ترمیم کی گذارش',
        newTitle: 'نئے امیجنگ گذارش'
      }
    },
    incident: {
      buttons: {
        add: '',
        addForm: '',
        addItem: '',
        cancel: '',
        'delete': '',
        download: '',
        edit: '',
        'export': '',
        generateRep: '',
        newAttachment: '',
        newCategory: '',
        newIncident: '',
        newNote: ''
      },
      labels: {
        actions: '',
        addedBy: '',
        category: '',
        categoryItem: '',
        date: '',
        dateRecorded: '',
        department: '',
        description: '',
        endDate: '',
        givenBy: '',
        howToAddAttachment: '',
        incidentDate: '',
        incidentId: '',
        item: '',
        lastUpdated: '',
        note: '',
        patientId: '',
        patientImpacted: '',
        reportType: '',
        reportedBy: '',
        reportedDate: '',
        reportedTo: '',
        sentinelEvent: '',
        startDate: '',
        status: '',
        statusActive: '',
        statusClosed: '',
        statusFollowup: '',
        statusReported: '',
        title: '',
        total: '',
        updatedBy: ''
      },
      messages: {
        attachmentFileRequired: '',
        createNew: '',
        createNewIncidentCategory: '',
        fillIn: '',
        incidentCategorySaved: '',
        noClosedIncidents: '',
        noIncidentCategoriesFound: '',
        noIncidents: '',
        saved: '',
        selectExistingPatient: ''
      },
      titles: {
        addAttachment: '',
        addCategoryItem: '',
        addNote: '',
        attachments: '',
        closed: '',
        current: '',
        deleteAttachment: '',
        deleteIncident: '',
        deleteIncidentCategory: '',
        deleteItem: '',
        deleteNote: '',
        editAttachment: '',
        editIncident: '',
        editIncidentCategory: '',
        editNote: '',
        general: '',
        history: '',
        incidentCategories: '',
        incidentCategoryItem: '',
        incidentCategoryName: '',
        incidentCategorySaved: '',
        incidentSaved: '',
        incidents: '',
        incidentsByCategory: '',
        incidentsByDepartment: '',
        newIncident: '',
        newIncidentCategory: '',
        notes: '',
        reports: ''
      }
    },
    inventory: {
      edit: {
        cost: 'فی یونٹ لاگت:',
        delivered: 'وصول کنندہ:',
        location: 'مقام کی درستگی:',
        prescription: 'نسخہ براۓ:',
        pulled: 'سے نکالا:',
        quantity: 'تکمیل پر مقدار:',
        reason: 'وجہ:',
        returned: 'مریض سے واپس',
        transferredFrom: 'سے منتقل:',
        transferredTo: 'میں منتقل کر دیا:'
      },
      labels: {
        action: 'عمل',
        add: 'شامل کریں',
        addAdjustmentType: '',
        adjust: 'درست کریں',
        adjustmentDate: 'درستگی کی تاریخ',
        adjustmentFor: 'درستگی براۓ',
        adjustmentType: 'درستگی کی قسم',
        aisle: 'راہداری',
        aisleLocation: 'راہداری مقام',
        allInventory: 'تمام انوینٹری',
        allItems: 'تمام چیزیں',
        availableQuantity: '{{quantity}} دستیاب',
        billTo: 'کا بل',
        consumePurchases: 'کھپت خریداریاں',
        consumptionRate: 'کھپت کی شرح',
        cost: 'لاگت',
        costPerUnit: 'فی یونٹ لاگت',
        crossReference: 'دوطرفی حوالہ',
        currentQuantity: 'موجودہ مقدار',
        dateCompleted: 'تاریخ مکمل',
        dateEffective: 'تاریخ نافذ',
        dateEnd: 'آخری تاریخ',
        dateReceived: 'تاریخ موصولی',
        dateStart: 'شروع کرنے کی تاریخ',
        dateTransferred: 'تاریخ منتقل',
        daysLeft: 'دن باقی',
        deleteItem: 'آٹم حذف کریں',
        deliveryAisle: 'ڈلیوری راہداری',
        deliveryLocation: 'ترسیل کے محل وقوع',
        details: 'تفصیلات دیکھیں',
        distributionUnit: 'تقسیم کا یونٹ',
        editItem: 'آٹم میں ترمیم',
        expense: 'کرنے کے اخراجات',
        expirationDate: 'میعاد ختم ہونے کی تاریخ',
        fulfillRequest: 'درخواست کو پورا کریں',
        fulfillRequestNow: 'ابھی درخواست کو پورا کریں',
        gift: 'خیراتی تحفہ',
        giftInKindNo: 'نہیں',
        giftInKindYes: 'ہاں',
        giftUsage: 'خیراتی تحفہ کا استعمال',
        inventoryConsumed: 'انوینٹری کھپت',
        inventoryItem: 'انوینٹری آئٹم',
        inventoryObsolence: 'متروک انوینٹری',
        invoiceItems: 'رسید اشیاء',
        invoiceLineItem: 'رسید لائن آئٹم',
        invoiceNumber: 'رسید نمبر',
        item: 'آئٹم',
        itemNumber: 'آئٹم نمبر',
        items: 'اشیاء',
        location: 'مقام',
        locations: 'مقامات',
        markAsConsumed: 'خرچ شدہ کے طور پر درج کریں',
        name: 'نام',
        newItem: 'نئی آٹم',
        originalQuantity: 'اصل مقدار',
        print: 'پرنٹ',
        printBarcode: 'پرنٹ بارکوڈ',
        printer: 'پرنٹر',
        pullFrom: 'سے ھیںچو',
        purchaseCost: 'خریداری کی لاگت',
        purchaseInfo: 'خریداری کی معلومات',
        purchases: 'خریداری',
        quantity: 'مقدار ({{unit}})',
        quantityAvailable: 'دستیاب مقدار',
        quantityOnHand: 'موجودہ مقدار',
        quantityRequested: ' درخواست کی گئی مقدار',
        rank: 'درجہ',
        reason: 'وجہ',
        remove: 'دور کریں',
        removeAdjustmentType: '',
        reorderPoint: ' پوائنٹ پھر ترتیب کریں',
        requestedItems: 'درخواست کی گئی اشیاء',
        returnAdjustmentType: '',
        returnToVendorAdjustmentType: '',
        salePricePerUnit: 'فی یونٹ فروخت کی قیمت',
        save: 'محفوظ کریں',
        serialNumber: 'سیریل / لوٹ نمبر',
        total: 'کل',
        totalCost: 'کل لاگت',
        totalReceived: 'کل موصول: {{total}}',
        transaction: 'ٹرانزیکشن',
        transactions: 'ٹرانزیکشنز',
        transfer: 'منتقلی',
        transferFrom: 'سے منتقلی',
        transferTo: 'مقام پر منتقلی',
        transferToAisle: 'مقام راہداری پر منتقلی',
        unit: 'یونٹ',
        unitCost: 'یونٹ کی لاگت',
        vendor: 'وینڈر',
        vendorItemNumber: 'وینڈر آئٹم نمبر',
        writeOffAdjustmentType: '',
        xref: 'XRef'
      },
      messages: {
        adjust: ' فرق کے تخمینہ کے لئے مناسب جگہ (جگہوں) پر مقدار کو ٹھیک کریں {{difference }}.',
        createRequest: 'ایک نئی درخواست بنائیں؟',
        itemNotFound: '<br> ورنہ واپس جانے کے لیے منسوخ کا بٹن دبائیں  <br> اگر آپ ایک نیا انونٹری آئٹم تخلیق کرنا چاہتے ہیں تو ذیل میں معلومات درج کریں۔  <strong>{{item}}</strong>انونٹری آئٹم نہیں ملا۔ ',
        loading: 'ٹراسیکشنر لوڈ ہو رہی ہے۔۔۔',
        noItems: 'کوئی آئٹم نہیں ملا۔',
        noRequests: 'کوئی درخواستیں نہیں ملی۔',
        purchaseSaved: 'انونٹری کی خریداری کو کامیابی سے محفوظ کر لیا گیا ہے۔',
        quantity: ' کے مقامات میں کل مقدار سے مماثل نہیں ہے <strong>({{locationQuantity}})</strong>کی کل مقدار <strong>({{quantity}})</strong>',
        removeItem: ' آپ کو یقین ہے کہ آپ اس آٹم کو رسید سے ہٹانا چاہتے ہیں؟',
        removeItemRequest: ' آپ کو یقین ہے کہ آپ اس آٹم کو درخواست سے ہٹانا چاہتے ہیں؟',
        requestFulfilled: 'انونٹری کی درخواست پوری ہو گئی.',
        requestUpdated: 'انونٹری درخواست کو اپ ڈیٹ کر دیا گیا ہے.',
        warning: 'ضروری ہے (* کے نشان والے) قطعات میں بھرنا اور شامل کرنے سے پہلے غلطیوں کو درست کریں۔'
      },
      reports: {
        adjustment: 'تفصیلی درستگی',
        daysSupply: 'اسٹاک میں دنوں کی فراہمی',
        expenseDetail: 'تفصیلی اخراجات',
        expenseSum: 'خلاصہ اخراجات',
        expiration: 'میعاد ختم ہونے کی تاریخ',
        'export': 'ایکسپورٹ رپورٹ',
        fields: ' شامل کرنے کے قطعات',
        finance: 'مالیات کا خلاصہ',
        generate: 'رپورٹ بنائیں',
        invLocation: 'محل وقوع کے اعتبار انوینٹری',
        invValuation: 'انوینٹری کی مالیت',
        purchaseDetail: 'تفصیلی خرید',
        purchaseSum: 'خلاصہ خرید',
        reportType: 'رپورٹ کی قسم',
        rows: {
          adjustments: 'درستگیاں',
          adjustmentsTotal: 'کل درستگیاں',
          balanceBegin: 'ابتدائی بقایا رقم',
          balanceEnd: 'اختمام پر بقایا رقم',
          category: 'قسم',
          consumed: 'کھپت',
          consumedGik: 'کی کھپت GiK',
          consumedGikTotal: 'کی کھپت GiK کل',
          consumedPuchases: 'خریداری کی کھپت',
          consumedPurchasesTotal: 'کل خریداری کی کھپت',
          consumedTotal: 'کل کھپت',
          errInFinSum: '_generateFinancialSummaryReport میں خرابی: ',
          errInFindPur: '_findInventoryItemsByPurchase میں خرابی: ',
          errInFindReq: '_findInventoryItemsByRequest میں خرابی: ',
          expensesFor: 'کے لئے اخراجات: ',
          noAccount: '(کوئی اکاؤنٹ نہیں)',
          subtotal: 'ذیلی کل: ',
          subtotalFor: '{{account}} - {{category}}ذیلی کل ',
          total: 'کل: ',
          totalFor: ' کل براۓ {{var}}: ',
          totalPurchases: 'کل خریداری',
          transfer1: '{{quantity }} سے {{location }}',
          trasnfer2: '{{target}} :براۓ{{source}} :منجانب'
        },
        stockTransferDetail: 'تفصیلی اسٹاک کی منتقلی',
        stockTransferSum: 'خلاصہ اسٹاک کی منتقلی',
        stockUsageDetail: 'تفصیلی اسٹاک استعمال',
        stockUsageSum: 'خلاصہ اسٹاک استعمال',
        titleDateRange: '{{startDate}} - {{endDate}} رپورٹ {{name}}',
        titleSingleDate: '{{date}} رپورٹ {{name}}'
      },
      titles: {
        addPurchase: 'خریداری شامل کریں',
        addRequest: 'نئی درخواست',
        adjustment: 'درستگی',
        editPurchase: 'خریداری میں ترمیم کریں',
        editRequest: 'تصیح کی گذارش',
        inventoryItem: 'نئے انوینٹری آئٹم',
        inventoryReport: 'انوینٹری کی رپورٹ',
        purchaseSaved: 'انوینٹری خریداریاں محفوظ کرلی',
        quickAddTitle: 'نئے انوینٹری آئٹم',
        removeItem: 'آئٹم ہٹائیں',
        requestFulfilled: 'درخواست پوری',
        requestUpdated: 'درخواست اپ ڈیٹ ہوگئی',
        transfer: ' اشیا منتقل کریں',
        warning: 'انتباہ!!!'
      }
    },
    labels: {
      action: 'عمل',
      actions: 'عوامل',
      addNewOutpatientVisit: 'نۓ بیرنی مریض کے لیے دورہ کا اضافہ کریں',
      address: 'ایڈریس',
      age: 'عمر',
      allDay: 'تمام دن',
      amount: 'رقم',
      anesthesia: 'اینستھیزیا',
      assisting: 'مدد',
      balanceDue: 'واجب الادا',
      billDate: 'بل تاریخ',
      billTo: 'کا بل',
      category: 'قسم',
      completed: 'مکمل',
      country: 'ملک',
      cptcode: 'CPT کوڈ',
      creditTo: 'کرنے کے لئے کریڈٹ',
      date: 'تاریخ',
      dateCompleted: 'تاریخ مکمل',
      dateOfBirth: 'پیدائش کی تاریخ',
      dateOfBirthShort: 'DOB',
      datePaid: 'تاریخ ادا',
      dateRequested: 'درخواست کی تاریخ',
      'delete': 'حذف کریں',
      deleteRequest: 'درخواست حذف کریں',
      deleteUser: 'صارف حذف کریں',
      department: 'محکمہ',
      description: 'تفصیل',
      discount: 'رعایت',
      displayName: 'دکھانے کے لیے نام',
      docRead: 'دستاویزات پڑھیں',
      docWritten: 'ڈاکس سے تحریری',
      edit: 'تصیح',
      editUser: 'صارف میں ترمیم کریں',
      email: 'ای میل',
      endDate: 'تاریخ اختتام',
      endTime: 'آخر وقت',
      excess: 'اضافی',
      expenseTo: 'کرنے کے اخراجات',
      fileLoadSuccessful: ' فائل لوڈ کامیابی سے ہو گئ',
      fileName: 'فائل کا نام',
      fileToLoad: ' لوڈ کے لیے فائل',
      fulfill: 'پورا کریں',
      fulfillRequest: 'درخواست کو پورا کریں',
      fulfillRequestNow: 'ابھی درخواست کو پورا کریں',
      fulfilled: 'پوری کر دی گئ',
      grandTotal: 'مجموعی عدد',
      id: 'آئی ڈی',
      imageOrders: 'امیج آرڈرز',
      imagingType: 'امیجنگ قسم',
      importFile: 'امپورٹ فائل',
      invoiceId: 'رسید کی آئی ڈی',
      labOrders: 'لیب آرڈرز',
      lineItems: 'لائن آئٹمز',
      loading: 'لوڈ کر رہا ہے',
      location: 'مقام',
      lookupType: 'تلاش قسم',
      medication: 'ادویات',
      name: 'نام',
      newUser: 'نیا صارف',
      note: 'نوٹ',
      notes: 'نوٹس',
      number: 'نمبر',
      on: 'پر',
      password: 'پاس ورڈ',
      patient: 'مریض',
      payments: 'ادائیگیاں',
      physician: 'فزیشن',
      prescriber: 'تجویز کنندہ',
      prescription: 'نسخے',
      prescriptionDate: 'نسخے تاریخ',
      price: 'قیمت',
      print: '',
      procedures: 'طریقہ کار',
      provider: 'مھیا کرنے والا',
      pullFrom: 'سے کھیںچو',
      quantity: 'تعداد',
      remarks: 'تبصرہ',
      requestedBy: 'کی طرف سے درخواست',
      requestedOn: 'پر درخواست',
      requests: 'درخواستیں',
      result: 'نتیجہ',
      results: 'نتائج',
      role: 'کردار',
      search: 'تلاش کریں',
      sex: 'جنس',
      startDate: 'شروع کرنے کی تاریخ',
      startTime: 'وقت آغاز',
      status: 'صورتحال',
      takenBy: '',
      total: 'کل',
      type: 'قسم',
      userCanAddNewValue: 'صارف نئی اقدار کا اضافہ کر سکتے ہیں',
      username: 'یوزر نیم',
      value: 'قدر',
      view: '',
      visit: 'دورہ',
      'with': 'ساتھ'
    },
    labs: {
      alerts: {
        requestCompletedMessage: 'لیب کی درخواست مکمل ہو گئی ہے',
        requestCompletedTitle: 'لیب درخواست مکمل',
        requestSavedMessage: 'لیب کی درخواست محفوظ ہو گئی ہے۔',
        requestSavedTitle: 'لیب کی درخواست محفوظ'
      },
      buttons: { newButton: '+ نئی لیب' },
      completedTitle: 'مکمل لیبز',
      deleteTitle: 'درخواست حذف کریں',
      editTitle: 'لیب میں ترمیم کی درخواست',
      labels: {
        addNewVisit: '۔۔ نیا دورہ شامل کریں ۔۔',
        labType: 'لیب کی قسم'
      },
      messages: {
        createNewRecord: 'ایک نیا ریکارڈ بنائیں؟',
        noCompleted: 'کوئی مکمل آئٹم موجود نہیں',
        noItemsFound: 'کوئی لیب موجود نہیں'
      },
      newTitle: 'نئے لیب کی گذارش',
      requestsTitle: 'لیب درخواستیں',
      sectionTitle: 'لیبز'
    },
    loading: {
      messages: {
        '0': 'سب سے تیز تیتلی پرواز کی رفتار فی گھنٹہ 12 میل ہے. کچھ کیڑے 25 میل فی گھنٹہ کی رفتار سے پرواز کر سکتے ہیں',
        '1': ' پرندے میں صرف اللو ہیں جو نیلا رنگ دیکھ سکتے ہیں',
        '2': 'بلی کی 100 مختلف آوازیں ہیں؛ کتے کی صرف 10 ہیں',
        '3': 'انسان تقریر میں 72 مختلف پٹھوں کی کل استعمال کرتے ہیں',
        '4': ' افریقہ کے براعظم میں 1،000 سے زائد مختلف زبانیں بولی جاتی ہیں',
        '5': ' اراۓتھروفوب وہ ہے جو آسانی سے شرما جاۓ ',
        '6': 'دنیا میں سب سے زیادہ عام فوبیا درد کا خوف ہے جو اوڈاۓنوفوبیا ہے',
        '7': ' آپ جب بھی کھڑے ہوتے ہیں آپ کا جسم خود کو متوازن کرنے کے لیے 300 پٹھوں کا استعمال کرتا',
        '8': 'بعض میںڈک منجمد ٹھوس ہوسکتے ہیں پھر پگھل  جائیں تو بھی جی سکتے ہیں',
        '9': 'ہماری آنکھیں پیدائش سے ہی اسی ہجم کی ہیں، لیکن ہماری ناک اور کان کبھی بڑھنا نہیں رکتی',
        '10': 'آپ کی زبان آپ کے جسم میں واحد پٹھہ ہے جو صرف ایک طرف سے منسلک ہے',
        '11': 'اونٹ کی تین پلکیں ہوتی ہیں جو اڑتی ریت سے بچانے کے لئے ہیں۔'
      },
      progressBar: { progress: '{{progressBarValue}}٪ مکمل' }
    },
    login: {
      labels: {
        password: 'پاس ورڈ',
        signIn: 'سائن ان ',
        username: 'یوزر نیم'
      },
      messages: {
        error: 'یوزر نیم یا پاس ورڈ غلط ہے.',
        signIn: 'سائن ان کریں'
      }
    },
    medication: {
      alerts: {
        fulfilledTitle: 'ادویات درخواست پوری',
        returnedMessage: 'ادویات پر واپس کر دی گئی کا نشان لگا دیا گیا ہے۔',
        returnedTitle: 'واپس کی گئی ادویات',
        savedMessage: 'ادویات کا ریکارڈ محفوظ ہوگیا ہے۔',
        savedTitle: 'ادویات کی درخواست محفوظ کر لی گئی'
      },
      buttons: {
        dispenseMedication: 'ادویات تقسیم',
        newButton: '+ نئی درخواست',
        returnMedication: 'واپسی دوا'
      },
      labels: {
        adjustmentDate: 'تاریخ درستگی',
        creditToAccount: 'اکاؤنٹ کو کریڈٹ',
        quantityDispensed: 'تقسیم یا استعمال کی گئی مقدار',
        quantityDistributed: 'تقسیم کی گئی مقدار',
        quantityRequested: ' درخواست کی گئی مقدار',
        quantityToReturn: 'مقدار براۓ واپسی',
        refills: 'دوبارہ بھریں',
        returnAisle: 'واپسی راہداری',
        returnLocation: ' مقام واپسی',
        returnReason: 'واپسی کی وجہ / نوٹس'
      },
      messages: { createNew: 'ایک نئی دوا کی درخواست بنائیں؟' },
      pageTitle: 'ادویات کی درخواستیں',
      returnMedication: 'واپس دوا',
      sectionTitle: 'ادویات',
      titles: {
        completedMedication: 'مکمل دوا',
        editMedicationRequest: 'ادویات میں ترمیم کی درخواست',
        newMedicationRequest: 'نئی دوا کی گذارش'
      }
    },
    messages: {
      createNewRecord: 'ایک نیا ریکارڈ بنائیں؟',
      createNewUser: 'ایک نیا صارف بنائیں؟',
      'delete': '',
      delete_plural: '',
      delete_singular: '',
      forAuthorizedPersons: 'یہ رپورٹ صرف مجاز افراد کے لئے ہے.',
      newPatientHasToBeCreated: 'ایک نیا مریض بنایا جانا ضروری ہے ... براہ کرم انتظار کریں ...',
      noHistoryAvailable: 'کوئی سرگزشت دستیاب نہیں',
      noItemsFound: 'کوئی آئٹم نہیں ملا.',
      noNotesAvailable: 'کوئی اضافی کلینکل نوٹ اس دورے کے لئے دستیاب نہیں.',
      noUsersFound: 'کوئی صارف دستیاب نہیں',
      onBehalfOf: 'کی جانب سے',
      reportError: 'درخواست کی رپورٹ کو پیدا کرتے وقت ایک خرابی کا سامنا ہوا۔ براہ مہربانی اپنے سسٹم ایڈمنسٹریٹر کے علم میں لائیں کہ آپ کو خرابی کا سامنا ہوا',
      requiredFieldsCorrectErrors: 'ضرورت ہے کہ خالی قطعات (* کے نشان) میں بھریں اور محفوظ کرنے سے پہلے غلطیوں کو درست کریں.',
      saveActionException: 'محفوظ کرنے کی کوشش کرتے ہوئے ایک خرابی واقع ہوئی ہے: {{message}}',
      sorry: 'معاف کرنا، کچھ غلط ہوگیا...',
      userHasBeenSaved: 'صارف محفوظ ہوگیا ہے.',
      userSaved: ' صارف محفوظ'
    },
    models: {
      appointment: {
        labels: {
          allDay: '',
          appointmentDate: '',
          appointmentType: '',
          endDate: '',
          location: '',
          notes: '',
          patient: '',
          provider: '',
          startDate: '',
          status: '',
          type: ''
        },
        names: {
          plural: '',
          singular: ''
        }
      },
      attachment: { names: {
          plural: '',
          singular: ''
        } },
      form: { names: {
          plural: '',
          singular: ''
        } },
      imaging: {
        names: '',
        request: {
          plural: '',
          singular: ''
        }
      },
      incident: { names: {
          plural: '',
          singular: ''
        } },
      item: { names: {
          plural: '',
          singular: ''
        } },
      lab: {
        names: {
          plural: '',
          singular: ''
        },
        request: {
          plural: '',
          singular: ''
        }
      },
      medication: {
        names: {
          plural: '',
          singular: ''
        },
        request: {
          plural: '',
          singular: ''
        }
      },
      note: { names: {
          plural: '',
          singular: ''
        } },
      patient: {
        labels: { name: '' },
        names: { singular: '' }
      },
      procedure: { names: {
          plural: '',
          singular: ''
        } },
      user: { names: {
          plural: '',
          singular: ''
        } },
      visit: { names: {
          plural: '',
          singular: ''
        } },
      vital: { names: {
          plural: '',
          singular: ''
        } }
    },
    navigation: {
      about: 'HospitalRun  کے بارے',
      actions: {
        login: 'لاگ ان',
        logout: 'لاگ آوٹ'
      },
      administration: 'انتظامیہ',
      billing: 'بلنگ',
      imaging: 'امیجنگ',
      incident: '',
      inventory: 'انوینٹری',
      labs: 'لیبز',
      medication: 'ادویات',
      patients: 'مریض',
      scheduling: 'اوقات نامہ',
      subnav: {
        actions: 'عوامل',
        addAppointment: 'ملاقات اضافہ',
        addressFields: 'ایڈریس قطعات',
        admittedPatients: 'جمع شدہ مریض',
        appointmentSearch: ' ملاقاتیں تلاش کریں',
        appointmentsCalendar: 'ملاقاتوں کا کیلنڈر',
        appointmentsThisWeek: 'اس ہفتے کی ملاقاتیں',
        completed: 'مکمل',
        currentIncidents: '',
        customForms: 'کسٹم فام',
        dispense: 'تقسیم',
        history: '',
        incidentCategories: '',
        inventoryReceived: 'انوینٹری موصول',
        invoices: 'رسیدیں',
        items: 'اشیاء',
        loadDB: 'DB لوڈ کریں',
        lookupLists: 'تلاش فہرستیں',
        missedAppointments: 'ضائع شدہ',
        newIncident: '',
        newInvoice: 'نئے رسید',
        newPatient: 'نئے مریض',
        newRequest: 'نئی درخواست',
        newUser: 'نیا صارف',
        outpatient: 'آؤٹ پیشنٹ',
        patientListing: 'مریض کی فہرست سازی',
        priceProfiles: 'قیمت پروفائلز',
        prices: 'قیمتیں',
        printHeader: '',
        reports: 'رپورٹس',
        requests: 'درخواستیں',
        returnMedication: 'واپس دوا',
        scheduleSurgery: 'سرجری اوقات نامہ',
        theaterSchedule: 'تھیٹر اوقات نامہ',
        "today'sAppointments": '',
        userRoles: 'صارف کے کردار',
        users: 'صارفین',
        workflow: 'ورک فلو'
      }
    },
    operationReport: {
      labels: {
        additionalNotes: 'اضافی نوٹس',
        assistant: 'مددگار',
        caseComplexity: 'کیس پیچیدگی',
        operationDescription: 'آپریشن کی تفصیل',
        preOpPrimaryDiagnosis: 'آپریشن سے پہلے بنیادی تشخیص',
        preOpSecondaryDiagnosis: 'آپریشن سے پہلے ثانوی تشخیص',
        surgeon: 'سرجن',
        surgeryDate: 'سرجری تاریخ'
      },
      messages: { reportSaved: 'آپریشن رپورٹ محفوظ ہوگئی ہے۔' },
      titles: {
        editTitle: 'آپریشن رپورٹ میں ترمیم کریں',
        newTitle: 'نئے آپریشن کی رپورٹ',
        reportSaved: 'رپورٹ محفوظ ہوگئی'
      }
    },
    operativePlan: {
      buttons: { completePlan: 'مکمل حکمت عمل' },
      labels: {
        additionalNotes: 'اضافی نوٹس',
        admissionInstructions: 'داخلے کی ہدایات',
        caseComplexity: 'کیس پیچیدگی',
        completedStatus: 'مکمل',
        droppedStatus: 'گرا دیا',
        operationDescription: 'آپریشن کی تفصیل',
        plannedStatus: 'منصوبہ بندی کر لی گئی',
        status: 'صورتحال',
        surgeon: 'سرجن'
      },
      messages: {
        planCompleted: 'آپریٹو پلان مکمل ہو چکا ہے۔ اب آپریشن رپورٹ کی طرف آپ کی رہنمائی کی جائے گی۔',
        planSaved: 'آپریٹو پلان محفوظ ہوگیا ہے۔'
      },
      titles: {
        editTitle: 'آپریٹو پلان میں ترمیم کریں',
        newTitle: 'نیا آپریٹو پلان',
        planCompleted: 'پلان مکمل',
        planSaved: 'پلان محفوظ'
      }
    },
    patients: {
      buttons: {
        addContact: 'رابطہ شامل کریں',
        addExpense: 'اخراجات میں شامل کریں',
        addFamilyMember: 'خاندان کا فرد شامل کریں',
        addOperativePlan: 'آپریٹو پلان میں شامل کریں',
        backToPatients: 'مریض کی فہرست پر واپس جائیں',
        download: '',
        editOperativePlan: 'موجودہ آپریٹو پلان',
        newAppointment: 'نئی ملاقات',
        newImaging: 'نئی امیجنگ',
        newLab: 'نئی لیب',
        newMedication: 'نئی دوا',
        newPatient: '+ نیا مریض',
        newPhoto: 'نئی تصویر',
        newVisit: 'نیا دورہ',
        patientCheckIn: 'مریض کا چیک ان',
        scheduleSurgery: 'سرجری کا وقت مقرر کریں'
      },
      labels: {
        admissionDate: 'داخلے کی تاریخ',
        admit: 'داخل کریں',
        bloodType: 'خون کی قسم',
        caption: '',
        civilStatus: 'سول حیثیت',
        clinic: 'کلینک کی جگہ',
        contacts: 'رابطے',
        cost: 'لاگت',
        dateOfBirth: 'پیدائش کی تاریخ',
        dateProcessed: 'عمل درآمد کی تاریخ',
        dischargeDate: 'فارغ کرنے کی تاریخ',
        dob: 'DOB',
        education: 'تعلیم',
        email: 'ای میل',
        externalPatientId: 'بیرونی مریض کی شناخت',
        firstName: 'نام کا پہلا حصہ',
        income: 'آمدن',
        insurance: 'بیمہ',
        lastName: 'نام کا آخری حصہ',
        middleName: 'نام کا درمیانی حصہ',
        monthlyCost: 'ماہانہ اخراجات',
        occupation: 'پیشہ',
        operativePlan: 'آپریٹو پلان',
        parent: 'والدین / سرپرست',
        patientDays: 'مریض کے دن',
        patientType: 'مریضوں کی اقسام',
        patientTypeCharity: '',
        patientTypePrivate: '',
        phone: 'فون',
        placeOfBirth: 'جائے پیدائش',
        primaryDiagnosis: 'بنیادی تشخیص',
        referredBy: 'کی طرف سے بھیجا گیا',
        referredDate: 'حوالہ دینے کی تاریخ',
        relationship: 'مریض سے تعلق',
        relationships: 'تعلقات',
        religion: 'مذہب',
        secondaryDiagnosis: 'ثانوی تشخیص',
        sex: 'جنس',
        sexNotEntered: 'جنس داخل نہیں کیا گیا',
        sources: 'ذرائع',
        status: 'مریض کی صورتحال',
        totalMontlyExpense: 'مجموعی ماہانہ اخراجات'
      },
      messages: {
        areYouSureDelete: ' کو حذف کرنا چاہتے ہیں؟ {{object}} آپ کو یقین ہے کہ آپ اس ',
        createNewPatient: 'ایک نیا مریض ریکارڈ بنائیں؟',
        deletingPatient: 'مریض اور سارے متعلقہ ریکارڈز حذف کیا جا رہا ہے',
        noPatientsFound: 'کوئی مریض نہیں ملا۔',
        notFoundQuickAdd: ' مریض نہیں مل سکا۔ اگر آپ کو ایک نیا مریض بنانا چاہتے ہیں تو ذیل میں معلومات درج کیجے۔ ورنہ واپس جانے کے کیے منسوخ کا بٹن دبائیں۔ <strong>{{patientFullName}}</strong> ',
        photoFileRequired: '',
        savedPatient: ' کے لئے مریض کا ریکارڈ محفوظ ہوگیا ہے۔ {{displayName}} '
      },
      navigation: {
        appointments: 'ملاقاتیں',
        general: 'عمومی',
        history: 'سرگزشت',
        imaging: 'امیجنگ',
        labs: 'لیبز',
        medication: 'ادویات',
        photos: 'تصاویر',
        socialWork: 'سماجی کام',
        visits: 'دورے'
      },
      notes: {
        newNote: 'نیا نوٹ برائے',
        onBehalfOfCopy: 'کی جانب سے',
        onBehalfOfLabel: 'کی جانب سے',
        pleaseSelectAVisit: 'ایک دورے براہ مہربانی منتخب کریں',
        updateNote: 'کی صرف سے نوٹ اپ ڈیٹ ہورہے ہیں'
      },
      titles: {
        addContact: 'رابطہ شامل کریں',
        addPhoto: 'تصویر کا اضافہ کریں',
        additionalContacts: 'اضافی رابطے',
        admissionsDetail: 'داخلوں کی تفصیل',
        admissionsSummary: 'داخلوں کا خلاصہ',
        admittedPatients: 'داخل کیے گئے مریض',
        'delete': 'مریض کو حذف کریں',
        deleteContact: 'رابطہ کریں حذف کریں',
        deleteExpense: 'خرچہ حذف کریں',
        deleteFamilyMember: 'خاندان کے فرد کو حذف کریں',
        deletePatientRecord: 'مریض ریکارڈ حذف کریں',
        deletePhoto: 'تصویر حذف کریں',
        diagnosticTesting: 'تشخیصی جانچ',
        dischargesDetail: 'فارغ کرنے کی تفصیل',
        dischargesSummary: 'فارغ کرنے کا خلاصہ',
        edit: 'مریض میں ترمیم کریں',
        editPhoto: 'تصویر میں ترمیم کریں',
        expenses: 'اخراجات',
        familyInfo: 'خاندانی معلومات',
        familyInformation: 'خاندان کی معلومات',
        'new': 'نئے مریض',
        outpatientsForDate: '{{visitDate}} بیرونی مریض برائے ',
        patient: 'مریض رپورٹ',
        patientListing: 'مریض کی فہرست سازی',
        patientReport: 'مریض رپورٹ',
        patientStatus: 'مریض کی صورتحال',
        proceduresDetail: 'طریقہ کار کی تفصیل',
        proceduresSummary: 'طریقہ کار کا خلاصہ',
        savedPatient: 'مریض محفوظ ہو گیا',
        socialWork: 'خرچہ',
        todaysOutpatients: 'آج کے بیرونی مریضوں',
        totalPatientDays: 'مریض کے کل دن',
        totalPatientDaysDetailed: 'مریض کے کل دن(تفصیلی) ۔',
        visit: 'دورہ'
      }
    },
    print: { invoice: {
        labels: {
          billedBy: 'بل منجانب:',
          billedDate: 'بل کی تاریخ:',
          dateAdmitted: 'داخلہ کی تاریخ:',
          dateDischarged: 'فارغ کرنے کی تاریخ:',
          dischargeNotes: 'فارغ کرنے کے نوٹس:',
          patientAddress: 'پتہ:',
          patientAge: 'عمر:',
          patientId: 'مریض #:',
          patientName: 'مریض کا نام:',
          remarks: 'خیالات:',
          spacer: '__________________________________________'
        },
        messages: { whereConducted: 'میری محدودیت کے دوران کاٹ لیے گئے تھے' },
        titles: {
          billingStatement: 'بلنگ کی عبارت',
          patientMember: 'مریض رکن',
          patients: 'مریض کا',
          relContact: 'تعلق / رابطہ نمبر'
        }
      } },
    procedures: {
      buttons: { addMedication: 'ادویات شامل کریں' },
      labels: { medicationUsed: 'استعمال کی گئی ادویات' },
      messages: { saved: ' آپ کو یقین ہے کہ آپ اس طریقہ کار کو حذف کرنا چاہتے ہیں؟' },
      titles: {
        addChargeItem: 'چارج آئٹم شامل کریں',
        addMedicationUsed: 'استعمال کی گئی ادویات شامل کریں',
        deleteChargeItem: 'چارج آئٹم حذف کریں',
        deleteMedicationUsed: 'استعمال کی گئی ادویات حذف کریں',
        edit: 'ضابطے میں ترمیم کریں',
        editChargeItem: 'چارج آئٹم میں ترمیم کریں',
        editMedicationUsed: 'استعمال کی گئی ادویات میں ترمیم کریں',
        medicationUsed: 'استعمال کی گئی ادویات',
        'new': 'نیا طریقہ کار',
        saved: 'ضابطے محفوظ'
      }
    },
    reports: {
      labels: {
        admissionDate: '',
        allProcedures: '',
        completedBy: '',
        dischargeDate: '',
        examiner: '',
        images: '',
        labs: '',
        location: '',
        medications: '',
        nextAppointment: '',
        nextAppointments: '',
        notes: {
          author: '',
          date: '',
          title: ''
        },
        operativePlan: {
          description: '',
          instructions: '',
          procedures: '',
          title: ''
        },
        primaryDiagnosis: '',
        procedures: '',
        secondaryDiagnosis: '',
        visitDate: '',
        visitType: ''
      },
      messages: {
        'delete': '',
        saved: ''
      },
      titles: {
        dischargeReport: '',
        newDischargeReport: '',
        newOPDReport: '',
        opdReport: '',
        saved: ''
      }
    },
    user: {
      plusNewUser: '+ نیا صارف',
      usersPageTile: 'صارفین کی فہرست سازی'
    },
    visits: {
      buttons: {
        addDiagnosis: 'تشخیص کے لئے شامل کریں',
        checkIn: 'چیک ان',
        checkOut: 'چیک آٹ',
        discharge: 'فارغ کر دیں',
        newAppointment: 'نئی ملاقات',
        newDischargeReport: '',
        newOPDReport: '',
        newProcedure: 'نئے طریقہ کار',
        newVitals: 'نئے vitals'
      },
      labels: {
        appointment: 'ملاقات',
        authoredBy: 'کی طرف سے تحریر',
        checkInTime: 'چیک ان',
        checkOutTime: 'چیک آٹ',
        createNewPatient: 'نیا مریض بنائیں',
        diagnosis: 'تشخیص',
        examiner: 'معائنہ کار',
        finalDiagnosis: 'حتمی / بلنگ تشخیص',
        haveAppointment: 'ہاں',
        haveDoneOrders: 'ہاں',
        noAppointment: 'نہیں',
        ordersDone: 'آرڈرز مکمل کر دیے گئے',
        ordersNotDone: 'نہیں',
        patientToCheckIn: 'مریض کا چیک ان کرنا',
        procedure: 'ضابطے',
        procedureDate: 'ضابطے کی تاریخ',
        reasonForVisit: 'دورے کی وجہ',
        reportType: '',
        status: 'دورہ کی صورتحال',
        statusAdmitted: 'داخل کر دیا گیا',
        statusCheckedIn: 'چیک ان کر دیا گیا',
        statusCheckedOut: 'چیک آٹ کر دیا گیا',
        statusDischarged: 'فارغ کر دیا گیا',
        visitDate: 'دورہ کی تاریخ',
        visitInformation: 'دورہ معلومات',
        visitType: 'دورہ کی قسم'
      },
      messages: {
        checkOut: 'کو چیک آٹ کرنا چاہتے ہیں؟ {{patientName}} آپ کو یقین ہے کہ آپ ',
        checkedOut: 'چیک آٹ کر دیا گیا ہے {{patientName}} ',
        discharged: ' کو فارغ کر دیا گیا ہے  {{patientName}} ',
        patientCheckedIn: 'چیک ان کر دیا گیا ہے {{patientName}} ',
        patientCreatedAndCheckedIn: ' ۔  (مریض) بنا دیا گیا ہے اور چیک ان کر دیا گیا ہے {{patientName}} ',
        visitAndPatientSaved: 'دورے اور مریض ریکارڈ محفوظ کیا گیا ہے۔',
        visitSaved: 'دورہ کا ریکارڈ کو محفوظ کیا گیا ہے۔'
      },
      navigation: {
        charges: 'چارجز',
        notes: 'نوٹس',
        orders: 'آرڈرز',
        procedures: 'طریقہ کار',
        reports: '',
        vitals: 'Vitals'
      },
      titles: {
        additionalDiagnoses: 'اضافی تشخیص',
        checkOut: 'مریض چیک آٹ',
        checkedIn: 'مریض چیک ان مکمل',
        checkedOut: 'مریض چیک آٹ مکمل',
        discharged: 'مریض فارغ کر دیا گیا',
        editVisit: 'دورہ ترمیم کریں',
        newVisit: 'نیا دورہ',
        patientCheckIn: 'مریض چیک ان',
        visitSaved: 'دورہ محفوظ'
      }
    },
    vitals: { labels: {
        dateRecorded: 'تاریخ اندراج',
        dbp: 'DBP',
        heartRate: 'دل کی دھڑکن کی شرح',
        height: 'اونچائی',
        respiratoryRate: 'سانس کی شرح',
        sbp: 'SBP',
        temperature: 'درجہ حرارت',
        weight: 'وزن'
      } }
  };
});
define('hospitalrun/medication/completed/controller', ['exports', 'hospitalrun/controllers/abstract-paged-controller'], function (exports, _hospitalrunControllersAbstractPagedController) {
  exports['default'] = _hospitalrunControllersAbstractPagedController['default'].extend({
    showActions: false,
    startKey: []
  });
});
define('hospitalrun/medication/completed/route', ['exports', 'ember-i18n', 'hospitalrun/medication/index/route'], function (exports, _emberI18n, _hospitalrunMedicationIndexRoute) {
  exports['default'] = _hospitalrunMedicationIndexRoute['default'].extend({
    modelName: 'medication',
    pageTitle: (0, _emberI18n.translationMacro)('medication.titles.completedMedication'),
    searchStatus: 'Fulfilled'
  });
});
define("hospitalrun/medication/completed/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "wgSAKpsG", "block": "{\"statements\":[[\"partial\",\"medication/index\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/medication/completed/template.hbs" } });
});
define('hospitalrun/medication/delete/controller', ['exports', 'ember-i18n', 'hospitalrun/controllers/abstract-delete-controller', 'hospitalrun/mixins/patient-submodule'], function (exports, _emberI18n, _hospitalrunControllersAbstractDeleteController, _hospitalrunMixinsPatientSubmodule) {
  exports['default'] = _hospitalrunControllersAbstractDeleteController['default'].extend(_hospitalrunMixinsPatientSubmodule['default'], {
    title: (0, _emberI18n.translationMacro)('labels.delete_request'),

    actions: {
      'delete': function _delete() {
        this.deleteChildFromVisit('medication');
      }
    }
  });
});
define("hospitalrun/medication/delete/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "s2Qwj1O9", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-warning-sign\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"t\"],[\"messages.delete_singular\"],[[\"name\"],[[\"helper\",[\"t\"],[\"models.medication.request.singular\"],null]]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/medication/delete/template.hbs" } });
});
define('hospitalrun/medication/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'hospitalrun/mixins/add-new-patient', 'ember', 'hospitalrun/mixins/fulfill-request', 'hospitalrun/mixins/inventory-locations', 'hospitalrun/mixins/patient-submodule', 'hospitalrun/mixins/user-session'], function (exports, _hospitalrunControllersAbstractEditController, _hospitalrunMixinsAddNewPatient, _ember, _hospitalrunMixinsFulfillRequest, _hospitalrunMixinsInventoryLocations, _hospitalrunMixinsPatientSubmodule, _hospitalrunMixinsUserSession) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsAddNewPatient['default'], _hospitalrunMixinsFulfillRequest['default'], _hospitalrunMixinsInventoryLocations['default'], _hospitalrunMixinsPatientSubmodule['default'], _hospitalrunMixinsUserSession['default'], {
    medicationController: _ember['default'].inject.controller('medication'),
    expenseAccountList: _ember['default'].computed.alias('medicationController.expenseAccountList'),

    canFulfill: (function () {
      return this.currentUserCan('fulfill_medication');
    }).property(),

    isFulfilled: (function () {
      var status = this.get('model.status');
      return status === 'Fulfilled';
    }).property('model.status'),

    isFulfilling: (function () {
      var canFulfill = this.get('canFulfill');
      var isRequested = this.get('model.isRequested');
      var fulfillRequest = this.get('model.shouldFulfillRequest');
      var isFulfilling = canFulfill && (isRequested || fulfillRequest);
      this.get('model').set('isFulfilling', isFulfilling);
      return isFulfilling;
    }).property('canFulfill', 'model.isRequested', 'model.shouldFulfillRequest'),

    isFulfilledOrRequested: (function () {
      return this.get('isFulfilled') || this.get('model.isRequested');
    }).property('isFulfilled', 'model.isRequested'),

    prescriptionClass: (function () {
      var quantity = this.get('model.quantity');
      if (_ember['default'].isEmpty(quantity)) {
        return 'required test-medication-prescription';
      }
    }).property('model.quantity'),

    quantityClass: (function () {
      var prescription = this.get('model.prescription');
      var returnClass = 'col-xs-3';
      var isFulfilling = this.get('isFulfilling');
      if (isFulfilling || _ember['default'].isEmpty(prescription)) {
        returnClass += ' required';
      }
      return returnClass + ' test-quantity-input';
    }).property('isFulfilling', 'model.prescription'),

    quantityLabel: (function () {
      var i18n = this.get('i18n');
      var returnLabel = i18n.t('medication.labels.quantityRequested');
      var isFulfilled = this.get('isFulfilled');
      var isFulfilling = this.get('isFulfilling');
      if (isFulfilling) {
        returnLabel = i18n.t('medication.labels.quantityDispensed');
      } else if (isFulfilled) {
        returnLabel = i18n.t('medication.labels.quantityDistributed');
      }
      return returnLabel;
    }).property('isFulfilled'),

    medicationList: [],
    updateCapability: 'add_medication',

    afterUpdate: function afterUpdate() {
      var i18n = this.get('i18n');
      var alertTitle = undefined,
          alertMessage = undefined;
      var isFulfilled = this.get('isFulfilled');
      if (isFulfilled) {
        alertTitle = i18n.t('medication.alerts.fulfilledTitle');
        alertMessage = 'The medication request has been fulfilled.';
        this.set('model.selectPatient', false);
      } else {
        alertTitle = i18n.t('medication.alerts.savedTitle');
        alertMessage = i18n.t('medication.alerts.savedMessage');
      }
      this.saveVisitIfNeeded(alertTitle, alertMessage);
    },

    beforeUpdate: function beforeUpdate() {
      var isFulfilling = this.get('isFulfilling');
      var isNew = this.get('model.isNew');
      if (isNew || isFulfilling) {
        return new _ember['default'].RSVP.Promise((function (resolve, reject) {
          var newMedication = this.get('model');
          newMedication.validate().then((function () {
            if (newMedication.get('isValid')) {
              if (isNew) {
                if (_ember['default'].isEmpty(newMedication.get('patient'))) {
                  this.addNewPatient();
                  reject({
                    ignore: true,
                    message: 'creating new patient first'
                  });
                } else {
                  newMedication.set('medicationTitle', newMedication.get('inventoryItem.name'));
                  newMedication.set('priceOfMedication', newMedication.get('inventoryItem.price'));
                  newMedication.set('status', 'Requested');
                  newMedication.set('requestedBy', newMedication.getUserName());
                  newMedication.set('requestedDate', new Date());
                  this.addChildToVisit(newMedication, 'medication', 'Pharmacy').then((function () {
                    this.finishBeforeUpdate(isFulfilling, resolve);
                  }).bind(this), reject);
                }
              } else {
                this.finishBeforeUpdate(isFulfilling, resolve);
              }
            } else {
              this.send('showDisabledDialog');
              reject('invalid model');
            }
          }).bind(this))['catch']((function () {
            this.send('showDisabledDialog');
            reject('invalid model');
          }).bind(this));
        }).bind(this));
      } else {
        return _ember['default'].RSVP.resolve();
      }
    },

    finishBeforeUpdate: function finishBeforeUpdate(isFulfilling, resolve) {
      if (isFulfilling) {
        var inventoryLocations = this.get('model.inventoryLocations');
        var inventoryRequest = this.get('store').createRecord('inv-request', {
          expenseAccount: this.get('model.expenseAccount'),
          dateCompleted: new Date(),
          inventoryItem: this.get('model.inventoryItem'),
          inventoryLocations: inventoryLocations,
          quantity: this.get('model.quantity'),
          transactionType: 'Fulfillment',
          patient: this.get('model.patient'),
          markAsConsumed: true
        });
        this.performFulfillRequest(inventoryRequest, false, false, true).then((function () {
          this.set('model.status', 'Fulfilled');
          resolve();
        }).bind(this));
      } else {
        resolve();
      }
    },

    showUpdateButton: (function () {
      var isFulfilled = this.get('isFulfilled');
      if (isFulfilled) {
        return false;
      } else {
        return this._super();
      }
    }).property('updateCapability', 'isFulfilled'),

    updateButtonText: (function () {
      var i18n = this.get('i18n');
      if (this.get('model.hideFulfillRequest')) {
        return i18n.t('buttons.dispense');
      } else if (this.get('isFulfilling')) {
        return i18n.t('labels.fulfill');
      }
      return this._super();
    }).property('model.isNew', 'isFulfilling', 'model.hideFulfillRequest')

  });
});
// inventory-locations mixin is needed for fulfill-request mixin!
define('hospitalrun/medication/edit/route', ['exports', 'ember-i18n', 'hospitalrun/routes/abstract-edit-route', 'hospitalrun/mixins/add-to-patient-route', 'ember', 'hospitalrun/mixins/fulfill-request', 'hospitalrun/mixins/inventory-locations', 'moment', 'hospitalrun/mixins/patient-list-route', 'npm:uuid'], function (exports, _emberI18n, _hospitalrunRoutesAbstractEditRoute, _hospitalrunMixinsAddToPatientRoute, _ember, _hospitalrunMixinsFulfillRequest, _hospitalrunMixinsInventoryLocations, _moment, _hospitalrunMixinsPatientListRoute, _npmUuid) {
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend(_hospitalrunMixinsAddToPatientRoute['default'], _hospitalrunMixinsFulfillRequest['default'], _hospitalrunMixinsInventoryLocations['default'], _hospitalrunMixinsPatientListRoute['default'], {
    editTitle: (0, _emberI18n.translationMacro)('medication.titles.editMedicationRequest'),
    modelName: 'medication',
    newTitle: (0, _emberI18n.translationMacro)('medication.titles.newMedicationRequest'),
    database: _ember['default'].inject.service(),
    getNewData: function getNewData(params) {
      var idParam = this.get('idParam');
      var newData = {
        selectPatient: true,
        prescriptionDate: (0, _moment['default'])().startOf('day').toDate()
      };
      if (params[idParam] === 'dispense') {
        newData.shouldFulfillRequest = true;
        newData.hideFulfillRequest = true;
      }
      newData.id = _npmUuid['default'].v4();
      return _ember['default'].RSVP.resolve(newData);
    },

    model: function model(params) {
      var idParam = this.get('idParam');
      var modelPromise = this._super(params);
      if (!_ember['default'].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);
        }
      } else {
        return this._super(params);
      }
    },

    setupController: function setupController(controller, model) {
      this._super(controller, model);
      var inventoryQuery = {
        key: 'Medication',
        include_docs: true
      };
      var inventoryItemId = model.get('inventoryItem.id');
      var patient = model.get('patient');
      if (_ember['default'].isEmpty(inventoryItemId)) {
        this.get('database').queryMainDB(inventoryQuery, 'inventory_by_type').then(function (result) {
          var medicationList = result.rows.map(function (medication) {
            return medication.doc;
          });
          controller.set('medicationList', medicationList);
        });
      }
      if (_ember['default'].isEmpty(patient)) {
        this._fetchPatientList(controller);
      }
    }
  });
});
// inventory-locations mixin is needed for fulfill-request mixin!
define("hospitalrun/medication/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "F0Zrsz5k", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],15]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\"],[\"expenseAccount\",[\"helper\",[\"t\"],[\"labels.billTo\"],null],[\"get\",[\"expenseAccountList\"]],[\"get\",[\"model\",\"expenseAccount\"]]]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"inventory-location-picker\"],null,[[\"label\",\"quantityRequested\",\"locationList\",\"selectedLocations\",\"class\"],[[\"helper\",[\"t\"],[\"labels.pullFrom\"],null],[\"get\",[\"model\",\"quantity\"]],[\"get\",[\"model\",\"inventoryItem\",\"availableLocations\"]],[\"get\",[\"model\",\"inventoryLocations\"]],\"inventory-location\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.fulfillRequest\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"labels.fulfillRequestNow\"],null],\"shouldFulfillRequest\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"canFulfill\"]]],null,1]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"model\",\"isNew\"]]],null,2]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"property\",\"label\",\"rows\",\"class\"],[\"prescription\",[\"helper\",[\"t\"],[\"labels.prescription\"],null],\"3\",[\"get\",[\"prescriptionClass\"]]]]],false],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"prescriptionDate\",[\"helper\",[\"t\"],[\"labels.prescriptionDate\"],null],\"col-sm-4\"]]],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"property\",\"label\",\"class\"],[\"quantity\",[\"get\",[\"quantityLabel\"]],[\"get\",[\"quantityClass\"]]]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"refills\",[\"helper\",[\"t\"],[\"medication.labels.refills\"],null],\"col-xs-3\"]]],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"unless\"],[[\"get\",[\"model\",\"hideFulfillRequest\"]]],null,3],[\"block\",[\"if\"],[[\"get\",[\"isFulfilling\"]]],null,0]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"model\",\"prescriptionDate\"]]],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"static-text\"],null,[[\"label\",\"value\"],[[\"helper\",[\"t\"],[\"labels.prescription\"],null],[\"get\",[\"model\",\"prescription\"]]]]],false],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"static-text\"],null,[[\"label\",\"class\"],[[\"helper\",[\"t\"],[\"labels.prescriptionDate\"],null],\"col-xs-4\"]],5],[\"text\",\"        \"],[\"append\",[\"helper\",[\"static-text\"],null,[[\"label\",\"class\",\"value\"],[[\"get\",[\"quantityLabel\"]],\"col-xs-3\",[\"get\",[\"model\",\"quantity\"]]]]],false],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"static-text\"],null,[[\"label\",\"class\",\"value\"],[[\"helper\",[\"t\"],[\"medication.labels.refills\"],null],\"col-xs-3\",[\"get\",[\"model\",\"refills\"]]]]],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.prescriber\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"requestedBy\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"inventory-typeahead\"],null,[[\"property\",\"label\",\"content\",\"selection\",\"class\"],[\"inventoryItemTypeAhead\",[\"helper\",[\"t\"],[\"labels.medication\"],null],[\"get\",[\"medicationList\"]],[\"get\",[\"selectedInventoryItem\"]],\"required test-medication-input\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.medication\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"medicationName\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-xs-3\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.visit\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"visit\",\"visitDescription\"]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\",\"optionValuePath\",\"optionLabelPath\",\"prompt\",\"selected\"],[\"col-xs-4 required test-add-visit\",[\"helper\",[\"t\"],[\"labels.visit\"],null],\"visit\",[\"get\",[\"patientVisitsForSelect\"]],\"selectObject\",\"selectObject.visitDescription\",[\"helper\",[\"t\"],[\"labels.addNewOutpatientVisit\"],null],[\"get\",[\"model\",\"visit\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"patient-typeahead\"],null,[[\"property\",\"label\",\"content\",\"selection\",\"class\"],[\"patientTypeAhead\",[\"helper\",[\"t\"],[\"labels.patient\"],null],[\"get\",[\"patientList\"]],[\"get\",[\"selectedPatient\"]],\"col-xs-6 required test-patient-input\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"patient-summary\"],null,[[\"patient\",\"returnTo\",\"returnToContext\",\"disablePatientLink\"],[[\"get\",[\"model\",\"patient\"]],\"medication.edit\",[\"get\",[\"model\",\"id\"]],[\"get\",[\"model\",\"isNew\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"unless\"],[[\"get\",[\"model\",\"selectPatient\"]]],null,13],[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"model\",\"selectPatient\"]]],null,12],[\"block\",[\"if\"],[[\"get\",[\"model\",\"isNew\"]]],null,11,10],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"isFulfilledOrRequested\"]]],null,9,8],[\"block\",[\"if\"],[[\"get\",[\"isFulfilledOrRequested\"]]],null,7],[\"block\",[\"if\"],[[\"get\",[\"isFulfilled\"]]],null,6,4]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],14]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/medication/edit/template.hbs" } });
});
define('hospitalrun/medication/index/controller', ['exports', 'hospitalrun/controllers/abstract-paged-controller', 'hospitalrun/mixins/user-session'], function (exports, _hospitalrunControllersAbstractPagedController, _hospitalrunMixinsUserSession) {
  exports['default'] = _hospitalrunControllersAbstractPagedController['default'].extend(_hospitalrunMixinsUserSession['default'], {
    startKey: [],
    canAdd: (function () {
      return this.currentUserCan('add_medication');
    }).property(),

    showActions: (function () {
      return this.currentUserCan('fulfill_medication');
    }).property()
  });
});
define('hospitalrun/medication/index/route', ['exports', 'ember-i18n', 'hospitalrun/routes/abstract-index-route'], function (exports, _emberI18n, _hospitalrunRoutesAbstractIndexRoute) {
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend({
    modelName: 'medication',
    pageTitle: (0, _emberI18n.translationMacro)('medication.pageTitle'),
    searchStatus: 'Requested',

    _getStartKeyFromItem: function _getStartKeyFromItem(item) {
      var prescriptionDateAsTime = item.get('prescriptionDateAsTime');
      var id = this._getPouchIdFromItem(item);
      var requestedDateAsTime = item.get('requestedDateAsTime');
      var searchStatus = this.get('searchStatus');
      return [searchStatus, requestedDateAsTime, prescriptionDateAsTime, id];
    },

    _modelQueryParams: function _modelQueryParams() {
      var maxId = this._getMaxPouchId();
      var maxValue = this.get('maxValue');
      var minId = this._getMinPouchId();
      var searchStatus = this.get('searchStatus');
      return {
        options: {
          startkey: [searchStatus, null, null, minId],
          endkey: [searchStatus, maxValue, maxValue, maxId]
        },
        mapReduce: 'medication_by_status'
      };
    }
  });
});
define("hospitalrun/medication/index/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "oPegl48n", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]],6]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newItem\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"medication.messages.createNew\"],null],false],[\"close-element\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-info\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"messages.noItemsFound\"],null],false],[\"text\",\" \"],[\"block\",[\"if\"],[[\"get\",[\"canAdd\"]]],null,0],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"medicationRequest\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.fulfill\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"clickable\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"medicationRequest\"]]]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"medicationRequest\",\"prescriptionDate\"]]],[[\"format\"],[\"l h:mm A\"]]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"medicationRequest\",\"patient\",\"displayName\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"medicationRequest\",\"requestedBy\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"medicationRequest\",\"medicationName\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"medicationRequest\",\"quantity\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"medicationRequest\",\"status\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,2],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"medicationRequest\"]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.date\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.patient\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.prescriber\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.medication\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.quantity\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.status\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,4],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\"]]],null,3],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"model\"]]],null,5,1]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/medication/index/template.hbs" } });
});
define('hospitalrun/medication/return/controller', ['exports', 'ember-i18n', 'hospitalrun/controllers/abstract-edit-controller', 'ember', 'hospitalrun/mixins/fulfill-request', 'hospitalrun/mixins/inventory-locations', 'hospitalrun/mixins/patient-submodule', 'hospitalrun/utils/select-values'], function (exports, _emberI18n, _hospitalrunControllersAbstractEditController, _ember, _hospitalrunMixinsFulfillRequest, _hospitalrunMixinsInventoryLocations, _hospitalrunMixinsPatientSubmodule, _hospitalrunUtilsSelectValues) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsFulfillRequest['default'], _hospitalrunMixinsInventoryLocations['default'], _hospitalrunMixinsPatientSubmodule['default'], {
    medicationController: _ember['default'].inject.controller('medication'),
    medicationList: [],

    lookupListsToUpdate: [{
      name: 'aisleLocationList', // Name of property containing lookup list
      property: 'model.aisleLocation', // Corresponding property on model that potentially contains a new value to add to the list
      id: 'aisle_location_list' // Id of the lookup list to update
    }, {
      name: 'expenseAccountList', // Name of property containing lookup list
      property: 'model.expenseAccount', // Corresponding property on model that potentially contains a new value to add to the list
      id: 'expense_account_list' // Id of the lookup list to update
    }, {
      name: 'warehouseList', // Name of property containing lookup list
      property: 'model.location', // Corresponding property on model that potentially contains a new value to add to the list
      id: 'warehouse_list' // Id of the lookup list to update
    }],

    patientMedicationList: [],
    setNewMedicationList: false,

    aisleLocationList: _ember['default'].computed.alias('medicationController.aisleLocationList'),
    expenseAccountList: _ember['default'].computed.alias('medicationController.expenseAccountList'),
    warehouseList: _ember['default'].computed.alias('medicationController.warehouseList'),
    updateCapability: 'add_medication',

    medicationChanged: (function () {
      var medication = this.get('model.medication');
      if (!_ember['default'].isEmpty(medication)) {
        var inventoryItem = medication.get('inventoryItem');
        this.set('model.inventoryItemTypeAhead', inventoryItem.get('name') + ' - ' + inventoryItem.get('friendlyId'));
        this.set('model.inventoryItem', inventoryItem);
      } else {
        this.set('model.inventoryItem');
      }
      _ember['default'].run.later((function () {
        this.get('model').validate()['catch'](_ember['default'].K);
      }).bind(this));
    }).observes('model.medication'),

    patientVisitsChanged: (function () {
      var patientVisits = this.get('patientVisits');
      if (!_ember['default'].isEmpty(patientVisits)) {
        this.set('model.visit', patientVisits.get('firstObject'));
      }
    }).observes('patientVisits'),

    showPatientMedicationList: (function () {
      var patientMedicationList = this.get('patientMedicationList');
      this.get('patientMedication'); // Request patient medication be updated
      return !_ember['default'].isEmpty(patientMedicationList);
    }).property('patientMedicationList', 'model.patient', 'model.visit'),

    patientMedication: (function () {
      var setNewMedicationList = this.get('setNewMedicationList');
      var visit = this.get('model.visit');
      if (setNewMedicationList) {
        this.set('setNewMedicationList', false);
      } else if (!_ember['default'].isEmpty(visit)) {
        visit.get('medication').then((function (medication) {
          medication = medication.filterBy('status', 'Fulfilled');
          this.set('model.medication', medication.get('firstObject'));
          this.set('patientMedicationList', medication.map(_hospitalrunUtilsSelectValues['default'].selectObjectMap));
          this.set('setNewMedicationList', true);
        }).bind(this));
      }
      return this.get('patientMedicationList');
    }).property('setNewMedicationList', 'model.patient', 'model.visit'),

    _finishUpdate: function _finishUpdate() {
      var aisle = this.get('model.deliveryAisle');
      var location = this.get('model.deliveryLocation');
      var inventoryItem = this.get('model.inventoryItem');

      // find location on inventoryItem
      this._findOrCreateLocation(inventoryItem, location, aisle).then((function (inventoryLocation) {
        this.set('model.adjustPurchases', true);
        this.set('model.inventoryLocations', [inventoryLocation]);
        this.set('model.markAsConsumed', true);
        // Make sure inventory item is resolved first.
        this.get('model.inventoryItem').then((function () {
          this.send('fulfillRequest', this.get('model'), false, true, true);
        }).bind(this));
      }).bind(this));
    },

    actions: {
      doneFulfillRequest: function doneFulfillRequest() {
        var i18n = this.get('i18n');
        this.updateLookupLists();
        this.displayAlert(i18n.t('medication.alerts.returnedTitle'), i18n.t('medication.alerts.returnedMessage'), 'allItems');
      },
      update: function update() {
        var medication = this.get('model.medication');
        var quantity = this.get('model.quantity');
        if (!_ember['default'].isEmpty(medication)) {
          medication.reload().then((function () {
            medication.decrementProperty('quantity', quantity);
            if (medication.get('quantity') < 0) {
              medication.set('quantity', 0);
            }
            medication.save().then(this._finishUpdate.bind(this));
          }).bind(this));
        } else {
          this._finishUpdate();
        }
      }
    },

    updateButtonText: (0, _emberI18n.translationMacro)('medication.returnMedication')
  });
});
// inventory-locations mixin is needed for fulfill-request mixin!
define('hospitalrun/medication/return/route', ['exports', 'ember-i18n', 'hospitalrun/medication/edit/route', 'ember'], function (exports, _emberI18n, _hospitalrunMedicationEditRoute, _ember) {
  exports['default'] = _hospitalrunMedicationEditRoute['default'].extend({
    editTitle: (0, _emberI18n.translationMacro)('medication.returnMedication'),
    modelName: 'inv-request',
    newTitle: (0, _emberI18n.translationMacro)('medication.returnMedication'),
    getNewData: function getNewData() {
      return _ember['default'].RSVP.resolve({
        dateCompleted: new Date(),
        selectPatient: true,
        transactionType: 'Return'
      });
    }
  });
});
define("hospitalrun/medication/return/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "1pVA07AY", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],3]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"inventory-typeahead\"],null,[[\"property\",\"label\",\"content\",\"selection\",\"class\",\"showQuantity\"],[\"inventoryItemTypeAhead\",[\"helper\",[\"t\"],[\"labels.medication\"],null],[\"get\",[\"medicationList\"]],[\"get\",[\"selectedInventoryItem\"]],\"required test-medication-input\",false]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\",\"optionValuePath\",\"optionLabelPath\",\"selected\"],[\"required\",[\"helper\",[\"t\"],[\"labels.medication\"],null],\"medication\",[\"get\",[\"patientMedication\"]],\"selectObject\",\"selectObject.inventoryItem.name\",[\"get\",[\"model\",\"medication\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"showPatientMedicationList\"]]],null,1,0],[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"patient-typeahead\"],null,[[\"property\",\"label\",\"content\",\"selection\",\"class\"],[\"patientTypeAhead\",[\"helper\",[\"t\"],[\"labels.patient\"],null],[\"get\",[\"patientList\"]],[\"get\",[\"selectedPatient\"]],\"col-xs-6\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\",\"optionValuePath\",\"optionLabelPath\",\"selected\"],[\"col-xs-6\",[\"helper\",[\"t\"],[\"labels.visit\"],null],\"visit\",[\"get\",[\"patientVisitsForSelect\"]],\"selectObject\",\"selectObject.visitDescription\",[\"get\",[\"model\",\"visit\"]]]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"property\",\"label\",\"class\"],[\"quantity\",[\"helper\",[\"t\"],[\"medication.labels.quantityToReturn\"],null],\"col-xs-3 required test-medication-quantity\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"className\"],[\"deliveryLocation\",[\"helper\",[\"t\"],[\"medication.labels.returnLocation\"],null],[\"get\",[\"warehouseList\"]],[\"get\",[\"model\",\"location\"]],\"col-xs-4\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"className\"],[\"deliveryAisle\",[\"helper\",[\"t\"],[\"medication.labels.returnAisle\"],null],[\"get\",[\"aisleLocationList\"]],[\"get\",[\"model\",\"aisleLocation\"]],\"col-xs-4\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"property\",\"label\",\"rows\"],[\"reason\",[\"helper\",[\"t\"],[\"medication.labels.returnReason\"],null],\"3\"]]],false],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"dateCompleted\",[\"helper\",[\"t\"],[\"medication.labels.adjustmentDate\"],null],\"col-sm-4\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"className\"],[\"expenseAccount\",[\"helper\",[\"t\"],[\"medication.labels.creditToAccount\"],null],[\"get\",[\"expenseAccountList\"]],[\"get\",[\"model\",\"expenseAccount\"]],\"col-sm-8\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],2]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/medication/return/template.hbs" } });
});
define('hospitalrun/medication/route', ['exports', 'ember-i18n', 'hospitalrun/routes/abstract-module-route', 'ember'], function (exports, _emberI18n, _hospitalrunRoutesAbstractModuleRoute, _ember) {
  exports['default'] = _hospitalrunRoutesAbstractModuleRoute['default'].extend({
    addCapability: 'add_medication',
    moduleName: 'medication',
    newButtonText: (0, _emberI18n.translationMacro)('medication.buttons.newButton'),
    sectionTitle: (0, _emberI18n.translationMacro)('medication.sectionTitle'),

    additionalButtons: (function () {
      var i18n = this.get('i18n');
      var additionalButtons = [];
      if (this.currentUserCan('fulfill_medication')) {
        additionalButtons.push({
          buttonIcon: 'octicon octicon-checklist',
          buttonAction: 'dispenseMedication',
          buttonText: i18n.t('medication.buttons.dispenseMedication'),
          'class': 'btn btn-primary'
        });
      }
      if (this.currentUserCan(this.get('addCapability'))) {
        additionalButtons.push({
          buttonIcon: 'octicon octicon-mail-reply',
          buttonAction: 'returnMedication',
          buttonText: i18n.t('medication.buttons.returnMedication'),
          'class': 'btn btn-primary'
        });
      }
      if (!_ember['default'].isEmpty(additionalButtons)) {
        return additionalButtons;
      }
    }).property(),

    additionalModels: [{
      name: 'aisleLocationList',
      findArgs: ['lookup', 'aisle_location_list']
    }, {
      name: 'expenseAccountList',
      findArgs: ['lookup', 'expense_account_list']
    }, {
      name: 'sexList',
      findArgs: ['lookup', 'sex']
    }, {
      name: 'warehouseList',
      findArgs: ['lookup', 'warehouse_list']
    }],

    actions: {
      dispenseMedication: function dispenseMedication() {
        if (this.currentUserCan('fulfill_medication')) {
          this.transitionTo('medication.edit', 'dispense');
        }
      },

      returnMedication: function returnMedication() {
        if (this.currentUserCan(this.get('addCapability'))) {
          this.transitionTo('medication.return', 'new');
        }
      }
    }
  });
});
define('hospitalrun/medication/search/route', ['exports', 'hospitalrun/routes/abstract-search-route'], function (exports, _hospitalrunRoutesAbstractSearchRoute) {
  exports['default'] = _hospitalrunRoutesAbstractSearchRoute['default'].extend({
    moduleName: 'medication',
    searchKeys: [{
      name: 'prescription',
      type: 'contains'
    }],
    searchModel: 'medication'
  });
});
define("hospitalrun/medication/search/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "T9jkbT1t", "block": "{\"statements\":[[\"block\",[\"search-listing\"],null,[[\"newButtonText\",\"allButtonText\"],[[\"helper\",[\"t\"],[\"buttons.newRequest\"],null],[\"helper\",[\"t\"],[\"buttons.allRequests\"],null]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"partial\",\"medication/index\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/medication/search/template.hbs" } });
});
define('hospitalrun/mixins/active-link', ['exports', 'ember-cli-active-link-wrapper/mixins/active-link'], function (exports, _emberCliActiveLinkWrapperMixinsActiveLink) {
  exports['default'] = _emberCliActiveLinkWrapperMixinsActiveLink['default'];
});
define('hospitalrun/mixins/add-new-patient', ['exports', 'ember', 'hospitalrun/mixins/patient-id'], function (exports, _ember, _hospitalrunMixinsPatientId) {
  exports['default'] = _ember['default'].Mixin.create(_hospitalrunMixinsPatientId['default'], {
    customForms: _ember['default'].inject.service(),
    addedNewPatient: false,
    newPatientId: null,

    actions: {
      addedNewPatient: function addedNewPatient(record) {
        this.send('closeModal');
        this.set('addedNewPatient', true);
        this.set('model.patient', record);
        this.set('newPatientId');
        this.send('update');
      }
    },

    addNewPatient: function addNewPatient() {
      var _this = this;

      var i18n = this.get('i18n');
      this.displayAlert(i18n.t('alerts.pleaseWait'), i18n.t('messages.newPatientHasToBeCreated'));
      this._getNewPatientId().then(function (friendlyId) {
        var patientTypeAhead = _this.get('model.patientTypeAhead');
        var nameParts = patientTypeAhead.split(' ');
        var patientDetails = {
          customForms: _ember['default'].Object.create(),
          friendlyId: friendlyId,
          patientFullName: patientTypeAhead,
          requestingController: _this
        };
        var customForms = _this.get('customForms');
        return customForms.setDefaultCustomForms(['patient', 'socialwork'], patientDetails).then(function () {
          var patient = undefined;
          if (nameParts.length >= 3) {
            patientDetails.firstName = nameParts[0];
            patientDetails.middleName = nameParts[1];
            patientDetails.lastName = nameParts.splice(2, nameParts.length).join(' ');
          } else if (nameParts.length === 2) {
            patientDetails.firstName = nameParts[0];
            patientDetails.lastName = nameParts[1];
          } else {
            patientDetails.firstName = patientTypeAhead;
          }
          patient = _this.store.createRecord('patient', patientDetails);
          _this.send('openModal', 'patients.quick-add', patient);
        });
      });
    },

    _getNewPatientId: function _getNewPatientId() {
      var newPatientId = this.get('newPatientId');
      if (_ember['default'].isEmpty(newPatientId)) {
        return new _ember['default'].RSVP.Promise((function (resolve, reject) {
          this.generateFriendlyId('patient').then((function (friendlyId) {
            this.set('newPatientId', friendlyId);
            resolve(friendlyId);
          }).bind(this), reject);
        }).bind(this));
      } else {
        return _ember['default'].RSVP.resolve(newPatientId);
      }
    }
  });
});
define('hospitalrun/mixins/add-to-patient-route', ['exports', 'ember'], function (exports, _ember) {
  var get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;
  var Mixin = _ember['default'].Mixin;
  exports['default'] = Mixin.create({
    queryParams: {
      forPatientId: {
        refreshModel: false
      },
      forVisitId: {
        refreshModel: false
      }
    },

    model: function model(params) {
      var idParam = get(this, 'idParam');
      var modelPromise = this._super(params);
      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;
      }
    },

    /**
     * Resolves the model promise and then sets the patient information on the model.
     */
    _setPatientOnModel: function _setPatientOnModel(modelPromise, patientId) {
      var store = get(this, 'store');
      return modelPromise.then(function (model) {
        return store.find('patient', patientId).then(function (patient) {
          model.set('patient', patient);
          model.set('returnToPatient', patientId);
          model.set('selectPatient', false);
          return model;
        });
      });
    },

    /**
     * Resolves the model promise and then sets the visit information on the model.
     */
    _setVisitOnModel: function _setVisitOnModel(modelPromise, visitId) {
      var store = get(this, 'store');
      return modelPromise.then(function (model) {
        return store.find('visit', visitId).then(function (visit) {
          model.set('visit', visit);
          model.set('returnToVisit', visitId);
          model.set('selectPatient', false);
          model.set('patient', visit.get('patient'));
          return model;
        });
      });
    }
  });
});
define('hospitalrun/mixins/allergy-actions', ['exports', 'ember'], function (exports, _ember) {
  var get = _ember['default'].get;
  var set = _ember['default'].set;
  exports['default'] = _ember['default'].Mixin.create({
    openAllergyModal: function openAllergyModal(allergy) {
      set(allergy, 'editController', this);
      this.send('openModal', 'allergy.edit', allergy);
    },

    savePatientAllergy: function savePatientAllergy(patient, allergy) {
      var _this = this;

      get(patient, 'allergies').pushObject(allergy);
      patient.save().then(function () {
        _this.silentUpdate('closeModal');
      });
    },

    deletePatientAllergy: function deletePatientAllergy(patient, allergy) {
      var _this2 = this;

      var patientAllergies = get(patient, 'allergies');
      allergy.destroyRecord().then(function () {
        patientAllergies.removeObject(allergy);
        patient.save().then(function () {
          _this2.send('closeModal');
        });
      });
    },

    actions: {
      editAllergy: function editAllergy(allergy) {
        this.openAllergyModal(allergy);
      },

      showAddAllergy: function showAddAllergy() {
        var newAllergy = get(this, 'store').createRecord('allergy');
        this.openAllergyModal(newAllergy);
      }
    }
  });
});
define('hospitalrun/mixins/appointment-statuses', ['exports', 'ember', 'hospitalrun/utils/select-values'], function (exports, _ember, _hospitalrunUtilsSelectValues) {
  exports['default'] = _ember['default'].Mixin.create({
    appointmentStatusList: ['Attended', 'Scheduled', 'Canceled', 'Missed'],
    appointmentStatuses: _ember['default'].computed.map('appointmentStatusList', _hospitalrunUtilsSelectValues['default'].selectValuesMap),

    appointmentStatusesWithEmpty: (function () {
      return _hospitalrunUtilsSelectValues['default'].selectValues(this.get('appointmentStatusList'), true);
    }).property()
  });
});
define('hospitalrun/mixins/billing-categories', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    defaultBillingCategories: ['Hospital Charges']
  });
});
define('hospitalrun/mixins/blood-types', ['exports', 'ember', 'hospitalrun/utils/select-values'], function (exports, _ember, _hospitalrunUtilsSelectValues) {
  exports['default'] = _ember['default'].Mixin.create({
    bloodTypes: ['A+', 'A-', 'AB-', 'AB+', 'B+', 'B-', 'O+', 'O-'].map(_hospitalrunUtilsSelectValues['default'].selectValuesMap)
  });
});
define('hospitalrun/mixins/can-edit-requested', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    canEdit: (function () {
      var status = this.get('status');
      return status === 'Requested';
    }).property('status')
  });
});
define('hospitalrun/mixins/charge-actions', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    chargePricingCategory: null,
    pricingList: null,
    pricingTypeForObjectType: null,
    pricingTypes: null,
    _createNewChargeRecord: function _createNewChargeRecord(quantityCharged, pricingId) {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        this.store.find('pricing', pricingId).then((function (item) {
          var newCharge = this.store.createRecord('proc-charge', {
            dateCharged: new Date(),
            quantity: quantityCharged,
            pricingItem: item
          });
          newCharge.save().then((function (chargeRecord) {
            var charges = this.get('model.charges');
            charges.addObject(chargeRecord);
            resolve();
          }).bind(this), reject);
        }).bind(this), reject);
      }).bind(this), '_createNewChargeRecord with pricingId:' + pricingId);
    },

    actions: {
      addCharge: function addCharge(charge) {
        var charges = this.get('model.charges');
        charges.addObject(charge);
        var from = 'addCharge_' + charge.get('id');
        if (charge.get('medicationCharge')) {
          from = 'addMedication_' + charge.get('id');
        }
        this.silentUpdate('closeModal', from);
      },

      deleteCharge: function deleteCharge(model) {
        var _this = this;

        var chargeToDelete = model.get('chargeToDelete');
        var charges = this.get('model.charges');
        charges.removeObject(chargeToDelete);
        chargeToDelete.destroyRecord().then(function () {
          _this.silentUpdate('closeModal', 'deleteCharge');
        });
      },

      showAddCharge: function showAddCharge() {
        var newCharge = this.get('store').createRecord('proc-charge', {
          dateCharged: new Date(),
          quantity: 1,
          pricingCategory: this.get('chargePricingCategory')
        });
        this.send('openModal', this.get('chargeRoute'), newCharge);
      },

      showEditCharge: function showEditCharge(charge) {
        charge.set('itemName', charge.get('pricingItem.name'));
        charge.set('pricingCategory', this.get('chargePricingCategory'));
        this.send('openModal', this.get('chargeRoute'), charge);
      },

      showDeleteCharge: function showDeleteCharge(charge) {
        this.send('openModal', 'dialog', _ember['default'].Object.create({
          closeModalOnConfirm: false,
          confirmAction: 'deleteCharge',
          title: 'Delete Charge Item',
          message: 'Are you sure you want to delete this charged item?',
          chargeToDelete: charge,
          updateButtonAction: 'confirm',
          updateButtonText: this.get('i18n').t('buttons.ok')
        }));
      },

      setChargeQuantity: function setChargeQuantity(id, quantity) {
        var model = this.get('model');
        model.set(id, quantity);
      }
    },

    canAddCharge: (function () {
      return this.currentUserCan('add_charge');
    }).property(),

    /**
     * Returns pricing list without object types
     * Used for labs and imaging where the labs and imaging types are
     * directly in the price list.
     */
    chargesPricingList: (function () {
      var pricingList = this.get('pricingList');
      var pricingTypeForObjectType = this.get('pricingTypeForObjectType');
      return pricingList.filter(function (item) {
        return item.type !== pricingTypeForObjectType;
      });
    }).property('pricingList', 'pricingTypeForObjectType'),

    chargeRoute: null,

    findChargeForPricingItem: function findChargeForPricingItem(pricingItem, charges) {
      var chargeForItem = charges.find(function (charge) {
        var chargePricingItemId = charge.get('pricingItem.id');
        return pricingItem.id === chargePricingItemId;
      });
      return chargeForItem;
    },
    /**
     * Returns object types out of the pricing list.
     * Used for labs and imaging where the labs and imaging types are
     * directly in the price list.
     */
    objectTypeList: (function () {
      var pricingList = this.get('pricingList');
      var pricingTypeForObjectType = this.get('pricingTypeForObjectType');
      var userCanAddPricingTypes = this.get('userCanAddPricingTypes');
      var returnList = _ember['default'].Object.create({
        value: [],
        userCanAdd: userCanAddPricingTypes
      });
      if (!_ember['default'].isEmpty(pricingList)) {
        returnList.set('value', pricingList.filterBy('pricingType', pricingTypeForObjectType));
      }
      return returnList;
    }).property('pricingList', 'pricingTypeForObjectType', 'pricingTypeValues'),

    organizeByType: _ember['default'].computed.alias('pricingTypes.organizeByType'),

    pricingTypeList: (function () {
      var pricingList = this.get('pricingList');
      var pricingTypeValues = this.get('pricingTypeValues');
      var pricingTypeForObjectType = this.get('pricingTypeForObjectType');
      if (!_ember['default'].isEmpty(pricingTypeValues)) {
        pricingTypeValues = pricingTypeValues.filter(function (pricingType) {
          var havePricing = false;
          if (!_ember['default'].isEmpty(pricingList)) {
            havePricing = !_ember['default'].isEmpty(pricingList.findBy('pricingType', pricingType));
          }
          return havePricing && pricingType !== pricingTypeForObjectType;
        });
        pricingTypeValues = pricingTypeValues.sortBy('name');
        return pricingTypeValues;
      }
    }).property('pricingTypeValues', 'pricingTypeForObjectType', 'pricingList'),

    pricingTypeValues: _ember['default'].computed.alias('pricingTypes.value'),

    /**
     * Create multiple new request records from the pricing records passed in.  This function
     * will also add those new records to the specified visit.
     * @param {array} pricingRecords the list of pricing records to use to create request records from.
     * @param {string} pricingField the name of the field on the request record to set the pricing record on.
     * @param {string} visitChildName the name of the child object on the visit to add to.
     * @param {string} newVisitType if a new visit needs to be created, what type of visit
     * should be created.
     */
    createMultipleRequests: function createMultipleRequests(pricingRecords, pricingField, visitChildName, newVisitType) {
      var firstRecord = pricingRecords.get('firstObject');
      var modelToSave = this.get('model');
      modelToSave.set(pricingField, firstRecord);
      this.addChildToVisit(modelToSave, visitChildName, newVisitType).then((function (visit) {
        modelToSave.save().then((function () {
          this._finishCreateMultipleRequests(pricingRecords, pricingField, visitChildName, newVisitType, visit);
        }).bind(this));
      }).bind(this));
    },

    _finishCreateMultipleRequests: function _finishCreateMultipleRequests(pricingRecords, pricingField, visitChildName, newVisitType, visit) {
      var attributesToSave = {};
      var baseModel = this.get('model');
      var modelToSave = undefined;
      var modelsToAdd = [];
      var patient = this.get('model.patient');
      var savePromises = [];

      baseModel.eachAttribute(function (name) {
        attributesToSave[name] = baseModel.get(name);
      });

      pricingRecords.forEach((function (pricingRecord, index) {
        if (index > 0) {
          modelToSave = this.store.createRecord(newVisitType.toLowerCase(), attributesToSave);
          modelToSave.set(pricingField, pricingRecord);
          modelToSave.set('patient', patient);
          modelToSave.set('visit', visit);
          modelsToAdd.push(modelToSave);
          savePromises.push(modelToSave.save());
        }
      }).bind(this));

      _ember['default'].RSVP.all(savePromises).then((function () {
        var addPromises = [];
        modelsToAdd.forEach((function (modelToSave) {
          addPromises.push(this.addChildToVisit(modelToSave, visitChildName, newVisitType));
        }).bind(this));
        _ember['default'].RSVP.all(addPromises).then((function (addResults) {
          this.afterUpdate(addResults, true);
        }).bind(this));
      }).bind(this));
    },

    saveNewPricing: function saveNewPricing(pricingName, pricingCategory, priceObjectToSet) {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        var newPricing = undefined;
        var pricingTypeForObjectType = this.get('pricingTypeForObjectType');
        newPricing = this.store.createRecord('pricing', {
          name: pricingName,
          category: pricingCategory,
          pricingType: pricingTypeForObjectType
        });
        newPricing.save().then((function (savedNewPricing) {
          this.get('pricingList').addObject({
            id: savedNewPricing.get('id'),
            name: newPricing.get('name')
          });
          this.set(priceObjectToSet, newPricing);
          resolve();
        }).bind(this), reject);
      }).bind(this), 'saveNewPricing for: ' + pricingName);
    },

    getSelectedPricing: function getSelectedPricing(selectedField) {
      var selectedItem = this.get(selectedField);
      if (!_ember['default'].isEmpty(selectedItem)) {
        return new _ember['default'].RSVP.Promise((function (resolve, reject) {
          if (_ember['default'].isArray(selectedItem)) {
            this.store.findByIds('pricing', selectedItem).then(resolve, reject);
          } else {
            this.store.find('pricing', selectedItem.id).then(resolve, reject);
          }
        }).bind(this));
      } else {
        return _ember['default'].RSVP.resolve();
      }
    },

    showAddCharge: (function () {
      var canAddCharge = this.get('canAddCharge');
      var organizeByType = this.get('organizeByType');
      if (canAddCharge) {
        return !organizeByType;
      } else {
        return false;
      }
    }).property('canAddCharge', 'organizeByType'),

    showEditCharges: (function () {
      var canAddCharge = this.get('canAddCharge');
      var organizeByType = this.get('organizeByType');
      if (canAddCharge) {
        return organizeByType;
      } else {
        return false;
      }
    }).property('canAddCharge', 'organizeByType'),

    showPricingTypeTabs: (function () {
      var pricingTypeList = this.get('pricingTypeList');
      return !_ember['default'].isEmpty(pricingTypeList) && pricingTypeList.get('length') > 1;
    }).property('pricingTypeList'),

    userCanAddPricingTypes: (function () {
      var pricingTypes = this.get('pricingTypes');
      if (_ember['default'].isEmpty(pricingTypes)) {
        return true;
      } else {
        return pricingTypes.get('userCanAdd');
      }
    }).property('pricingTypes'),

    /**
     * When using organizeByType charges need to be mapped over from the price lists
     */
    updateCharges: function updateCharges() {
      var organizeByType = this.get('organizeByType');
      if (!organizeByType) {
        return _ember['default'].RSVP.resolve();
      }
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        var charges = this.get('model.charges');
        var chargePromises = [];
        var model = this.get('model');
        var pricingList = this.get('pricingList');
        pricingList.forEach((function (pricingItem) {
          var currentCharge = this.findChargeForPricingItem(pricingItem, model.get('charges'));
          var quantityCharged = model.get(pricingItem.id);
          if (_ember['default'].isEmpty(quantityCharged)) {
            if (currentCharge) {
              // Remove existing charge because quantity is blank
              charges.removeObject(currentCharge);
              chargePromises.push(currentCharge.destroyRecord());
            }
          } else {
            if (currentCharge) {
              if (currentCharge.get('quantity') !== quantityCharged) {
                currentCharge.set('quantity', quantityCharged);
                chargePromises.push(currentCharge.save());
              }
            } else {
              chargePromises.push(this._createNewChargeRecord(quantityCharged, pricingItem.id));
            }
          }
        }).bind(this));
        _ember['default'].RSVP.all(chargePromises, 'Charges updated for current record: ' + this.get('model.id')).then(resolve, reject);
      }).bind(this), 'updateCharges for current record: ' + this.get('model.id'));
    }
  });
});
define('hospitalrun/mixins/charge-route', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    database: _ember['default'].inject.service(),
    actions: {
      deleteCharge: function deleteCharge(model) {
        this.controller.send('deleteCharge', model);
      }
    },
    pricingList: null,

    afterModel: function afterModel() {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        var database = this.get('database');
        var maxId = database.getMaxPouchId('pricing');
        var minId = database.getMinPouchId('pricing');
        var pricingCategory = this.get('pricingCategory');
        var pricingQuery = {
          startkey: [pricingCategory, null, null, minId],
          endkey: [pricingCategory, {}, {}, maxId],
          include_docs: true
        };
        database.queryMainDB(pricingQuery, 'pricing_by_category').then((function (result) {
          var pricingList = result.rows.map(function (item) {
            return item.doc;
          });
          this.set('pricingList', pricingList);
          resolve();
        }).bind(this))['catch'](reject);
      }).bind(this));
    },

    setupController: function setupController(controller, model) {
      this._super(controller, model);
      controller.set('pricingList', this.get('pricingList'));
    }
  });
});
define('hospitalrun/mixins/check-for-errors', ['exports', 'ember'], function (exports, _ember) {
  var get = _ember['default'].get;
  var Mixin = _ember['default'].Mixin;
  var RSVP = _ember['default'].RSVP;
  exports['default'] = Mixin.create({
    _checkForErrors: function _checkForErrors(callPromise) {
      var _this = this;

      return new RSVP.Promise(function (resolve, reject) {
        callPromise.then(resolve, function (err) {
          var database = get(_this, 'database');
          reject(database.handleErrorResponse(err));
        });
      });
    }
  });
});
define('hospitalrun/mixins/custom-field-types', ['exports', 'ember'], function (exports, _ember) {
  var computed = _ember['default'].computed;
  exports['default'] = _ember['default'].Mixin.create({

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

    fieldTypes: computed(function () {
      var i18n = this.get('i18n');
      var fieldTypeValues = this.get('fieldTypeValues');
      return fieldTypeValues.map(function (fieldTypeId) {
        return {
          id: fieldTypeId,
          value: i18n.t('admin.customForms.labels.' + fieldTypeId)
        };
      }).sort(function (a, b) {
        return _ember['default'].compare(a.value.toString(), b.value.toString());
      });
    })
  });
});
define('hospitalrun/mixins/date-format', ['exports', 'ember', 'moment'], function (exports, _ember, _moment) {
  exports['default'] = _ember['default'].Mixin.create({
    _dateFormat: function _dateFormat(value, dateFormat) {
      if (_ember['default'].isEmpty(dateFormat)) {
        dateFormat = 'l';
      }
      if (!_ember['default'].isEmpty(value)) {
        return (0, _moment['default'])(value).format(dateFormat);
      }
    },

    dateToTime: function dateToTime(date) {
      if (!_ember['default'].isEmpty(date) && date.getTime) {
        return date.getTime();
      }
    }
  });
});
define('hospitalrun/mixins/diagnosis-actions', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    editDiagnosis: function editDiagnosis(diagnosis) {
      diagnosis.set('editController', this);
      this.send('openModal', 'diagnosis.edit', diagnosis);
    },

    actions: {
      deleteDiagnosis: function deleteDiagnosis(diagnosis) {
        var _this = this;

        var diagnoses = this.get('model.diagnoses');
        diagnoses.removeObject(diagnosis);
        diagnosis.set('archived', true);
        diagnosis.save().then(function () {
          _this.silentUpdate('closeModal');
        });
      },

      editDiagnosis: function editDiagnosis(diagnosis) {
        this.editDiagnosis(diagnosis);
      },

      showAddDiagnosis: function showAddDiagnosis() {
        var newDiagnosis = this.get('store').createRecord('diagnosis', {
          date: new Date()
        });
        this.editDiagnosis(newDiagnosis);
      }
    }

  });
});
define('hospitalrun/mixins/dob-days', ['exports', 'ember', 'moment'], function (exports, _ember, _moment) {
  exports['default'] = _ember['default'].Mixin.create({
    convertDOBToText: function convertDOBToText(birthDate, shortFormat, omitDays) {
      var today = new Date();
      var years = 0;
      var months = 0;
      var days = 0;

      if (birthDate) {
        if (birthDate.getFullYear === undefined) {
          birthDate = (0, _moment['default'])(birthDate, 'l').toDate();
        }
        if (birthDate.getFullYear !== undefined) {
          years = today.getFullYear() - birthDate.getFullYear();
          if (today.getMonth() < birthDate.getMonth() || today.getMonth() === birthDate.getMonth() && today.getDate() < birthDate.getDate()) {
            years--;
          }
        }

        if (birthDate.getMonth) {
          months = today.getMonth() - birthDate.getMonth();
          days = today.getDate() - birthDate.getDate();
          if (months <= 0) {
            if (days < 0) {
              months += 11;
            } else if (months < 0) {
              months += 12;
            }
          } else {
            if (days < 0) {
              months = months - 1;
            }
          }
        }

        if (birthDate.getDate) {
          days = today.getDate() - birthDate.getDate();
          if (days < 0) {
            days += 30;
          }
        }
      }

      var formatString = '';
      var options = {
        years: years,
        days: days,
        months: months
      };
      var i18n = this.get('i18n');
      if (shortFormat) {
        if (years > 0) {
          formatString = i18n.t('dates.short', options);
        } else {
          formatString = i18n.t('dates.shortOmitYears', options);
        }
      } else if (omitDays) {
        if (years > 1) {
          formatString = i18n.t('dates.longOmitDaysPlural', options);
        } else if (years === 1) {
          formatString = i18n.t('dates.longOmitDays', options);
        } else {
          formatString = i18n.t('dates.longOmitDaysYears', options);
        }
      } else {
        if (years > 1) {
          formatString = i18n.t('dates.longPlural', options);
        } else if (years === 1) {
          formatString = i18n.t('dates.long', options);
        } else {
          formatString = i18n.t('dates.longOmitYears', options);
        }
      }
      return formatString;
    }
  });
});
define('hospitalrun/mixins/edit-panel-props', ['exports', 'ember'], function (exports, _ember) {
  var computed = _ember['default'].computed;
  var isEmpty = _ember['default'].isEmpty;

  var ALL_PROPS = ['actionForUpdateButton', 'additionalButtons', 'cancelButtonText', 'disabledAction', 'hideCancelButton', 'showUpdateButton', 'updateButtonAction', 'updateButtonIcon', 'updateButtonText'];

  exports['default'] = _ember['default'].Mixin.create({

    additionalButtons: null,
    cancelButtonText: null,
    disabledAction: null,
    hideCancelButton: null,
    showUpdateButton: null,
    updateButtonAction: null,
    updateButtonIcon: null,
    updateButtonText: null,

    actionForUpdateButton: computed('disabledAction', function () {
      var disabledAction = this.get('disabledAction');
      if (isEmpty(disabledAction) || disabledAction === false) {
        return 'updateButtonAction';
      } else {
        return 'disabledAction';
      }
    }),

    editPanelProps: computed.apply(undefined, ALL_PROPS.concat([function () {
      return this.getProperties(ALL_PROPS);
    }]))

  });
});
define('hospitalrun/mixins/filter-list', ['exports', 'ember'], function (exports, _ember) {
  function _instanceof(left, right) { if (right != null && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } }

  var compare = _ember['default'].compare;
  var get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;
  var isHTMLSafe = _ember['default'].String.isHTMLSafe;
  var set = _ember['default'].set;
  exports['default'] = _ember['default'].Mixin.create({
    filterBy: null,
    filterValue: null,
    filteredBy: new _ember['default'].Map(),
    sortByDesc: null,
    sortByKey: null,

    filterList: function filterList(list, filterBy, filterValue) {
      var filteredBy = get(this, 'filteredBy');
      if (isEmpty(filterBy) && isEmpty(filteredBy)) {
        return list;
      }
      if (!isEmpty(filterBy)) {
        filteredBy.set(filterBy, filterValue);
      }
      this.set('filteredBy', filteredBy);
      var filteredList = list.filter(function (listItem) {
        var includeRecord = true;
        filteredBy.forEach(function (filterValue, filterBy) {
          var itemValue = listItem.get(filterBy);
          if (!isEmpty(filterValue)) {
            if (isHTMLSafe(filterValue)) {
              filterValue = filterValue.toString();
            } else if (_instanceof(filterValue, Date)) {
              filterValue = filterValue.getTime();
            }
            if (isHTMLSafe(itemValue)) {
              itemValue = itemValue.toString();
            } else if (_instanceof(itemValue, Date)) {
              itemValue = itemValue.getTime();
            }
            if (itemValue !== filterValue) {
              includeRecord = false;
            }
          }
        });
        return includeRecord;
      });
      return filteredList;
    },

    sortFilteredList: function sortFilteredList(filteredList) {
      var sortDesc = get(this, 'sortByDesc');
      var sortBy = get(this, 'sortByKey');
      if (isEmpty(filteredList) || isEmpty(sortBy)) {
        return filteredList;
      }
      filteredList = filteredList.toArray().sort(function (a, b) {
        var compareA = a.get(sortBy);
        var compareB = b.get(sortBy);
        if (sortBy === 'orderType') {
          compareA = compareA.toString();
          compareB = compareB.toString();
        }
        if (sortDesc) {
          return compare(compareB, compareA);
        } else {
          return compare(compareA, compareB);
        }
      });
      return filteredList;
    },

    actions: {
      filter: function filter(filterBy, filterValue) {
        set(this, 'filterBy', filterBy);
        set(this, 'filterValue', filterValue);
      },

      sortByKey: function sortByKey(sortKey, sortDesc) {
        this.setProperties({
          sortByDesc: sortDesc,
          sortByKey: sortKey
        });
      }
    }
  });
});
define('hospitalrun/mixins/friendly-id', ['exports', 'ember'], function (exports, _ember) {
  exports.sequenceId = sequenceId;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _ember['default'].Mixin.create({
    database: inject.service(),
    sequenceName: null,
    sequenceView: null,

    /**
    * Override this function to generate an id for a new record
    * @return a generated id;default is null which means that an
    * id will be automatically generated via Ember data.
    */
    generateFriendlyId: function generateFriendlyId(modelName) {
      var _this = this;

      var sequenceName = get(this, 'sequenceName');
      return this.sequencePrefix().then(function (prefix) {
        return _this.store.find('sequence', sequenceName).then(function (sequence) {
          return _this._findUnusedId(sequence, prefix, modelName);
        })['catch'](function () {
          var store = _this.get('store');
          var sequence = store.push(store.normalize('sequence', {
            id: sequenceName,
            value: 1,
            prefix: prefix
          }));
          return sequence.save().then(function (sequence) {
            return _this._findUnusedId(sequence, prefix, modelName);
          });
        });
      });
    },

    sequencePrefix: function sequencePrefix() {
      var _this2 = this;

      var sequenceName = get(this, 'sequenceName');
      return this.store.find('sequence', sequenceName).then(function (sequence) {
        return get(sequence, 'prefix');
      })['catch'](function () {
        var type = sequenceName;
        if (type.indexOf('_') > -1) {
          type = type.substr(type.indexOf('_') + 1);
        }
        return _this2._findNextPrefix(type, 0);
      });
    },

    _findNextPrefix: function _findNextPrefix(type, prefixChars) {
      var _this3 = this;

      prefixChars++;
      return this._findSequenceByPrefix(type, prefixChars).then(function (records) {
        if (_ember['default'].isEmpty(records.rows)) {
          return type.toLowerCase().substr(0, prefixChars);
        } else {
          return _this3._findNextSequence(type, prefixChars);
        }
      })['catch'](function () {
        return prefixChars;
      });
    },

    _findSequenceByPrefix: function _findSequenceByPrefix(type, prefixChars) {
      var database = this.get('database');
      var sequenceQuery = {
        key: type.toLowerCase().substr(0, prefixChars)
      };
      return database.queryMainDB(sequenceQuery, 'sequence_by_prefix');
    },

    _findUnusedId: function _findUnusedId(sequence, prefix, modelName) {
      var _this4 = this;

      var database = get(this, 'database');
      var maxValue = database.getMaxPouchId(modelName);
      var current = undefined,
          id = undefined;
      var sequenceView = get(this, 'sequenceView');
      current = sequence.get('value');
      id = sequenceId(prefix, current);
      var query = {
        startkey: [id, null],
        endkey: [id, maxValue]
      };
      return database.queryMainDB(query, sequenceView).then(function (found) {
        if (!isEmpty(found.rows)) {
          sequence.incrementProperty('value');
          return _this4._findUnusedId(sequence, prefix, modelName);
        }
        if (sequence.get('hasDirtyAttributes')) {
          return sequence.save().then(function () {
            return id;
          });
        }
        return id;
      });
    }
  });

  function sequenceId(prefix, sequence) {
    if (sequence < 100000) {
      sequence = ('00000' + sequence).slice(-5);
    }
    return '' + prefix + sequence;
  }
});
define('hospitalrun/mixins/fulfill-request', ['exports', 'ember'], function (exports, _ember) {
  // NOTE!!! inventory-locations mixin is needed for fulfill-request mixin!
  exports['default'] = _ember['default'].Mixin.create({
    actions: {
      doneFulfillRequest: function doneFulfillRequest() {
        // Placeholder function; override if you need to know when fulfillrequest is complete.
      },

      fulfillRequest: function fulfillRequest(request, closeModal, increment, skipTransition) {
        this.performFulfillRequest(request, closeModal, increment, skipTransition);
      }
    },

    performFulfillRequest: function performFulfillRequest(request, closeModal, increment, skipTransition) {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        var markAsConsumed = request.get('markAsConsumed');
        var transactionType = request.get('transactionType');
        if (transactionType === 'Request') {
          transactionType = null; // reset the transaction type so that it gets set below.
        }
        request.get('inventoryItem').then((function (inventoryItem) {
          if (markAsConsumed) {
            request.set('adjustPurchases', true);
            if (_ember['default'].isEmpty(transactionType)) {
              request.set('transactionType', 'Fulfillment');
            }
            this._performFulfillment(request, inventoryItem, increment).then((function () {
              this._finishFulfillRequest(request, inventoryItem, closeModal, increment, skipTransition);
              resolve();
            }).bind(this), reject);
          } else {
            request.set('adjustPurchases', false);
            if (_ember['default'].isEmpty(transactionType)) {
              request.set('transactionType', 'Transfer');
            }
            this._finishFulfillRequest(request, inventoryItem, closeModal, increment, skipTransition);
            resolve();
          }
        }).bind(this), reject);
      }).bind(this));
    },

    /**
     * @private
     */
    _findQuantity: function _findQuantity(request, purchases, item, increment) {
      var costPerUnit = undefined;
      var requestPurchases = [];
      var quantityOnHand = item.get('quantity');
      var quantityRequested = parseInt(request.get('quantity'));
      var quantityNeeded = quantityRequested;
      var purchaseInfo = [];
      var totalCost = 0;
      if (increment) {
        var purchase = purchases.get('lastObject');
        costPerUnit = purchase.get('costPerUnit');
        purchase.incrementProperty('currentQuantity', quantityRequested);
        totalCost += costPerUnit * quantityNeeded;
        purchaseInfo.push({
          id: purchase.get('id'),
          quantity: quantityRequested
        });
        requestPurchases.addObject(purchase);
      } else {
        var foundQuantity = purchases.any(function (purchase) {
          var currentQuantity = purchase.get('currentQuantity');
          if (purchase.get('expired') || currentQuantity <= 0) {
            return false;
          }
          costPerUnit = purchase.get('costPerUnit');
          if (increment) {

            return true;
          } else {
            if (quantityNeeded > currentQuantity) {
              totalCost += costPerUnit * currentQuantity;
              quantityNeeded = quantityNeeded - currentQuantity;
              purchaseInfo.push({
                id: purchase.get('id'),
                quantity: parseInt(currentQuantity)
              });
              currentQuantity = 0;
            } else {
              totalCost += costPerUnit * quantityNeeded;
              currentQuantity = currentQuantity - quantityNeeded;
              purchaseInfo.push({
                id: purchase.get('id'),
                quantity: parseInt(quantityNeeded)
              });
              quantityNeeded = 0;
            }
            purchase.set('currentQuantity', currentQuantity);
            requestPurchases.addObject(purchase);
            return quantityNeeded === 0;
          }
        });
        if (!foundQuantity) {
          return 'Could not find any purchases that had the required quantity: ' + quantityRequested;
        }
      }
      request.set('costPerUnit', (totalCost / quantityRequested).toFixed(2));
      request.set('quantityAtCompletion', quantityOnHand);
      request.set('purchasesAffected', purchaseInfo);
      request.set('purchases', requestPurchases); // Not saved permanently, just set here so that purchases get saved later.
      item.updateQuantity();
      return true;
    },

    /**
     * @private
     * Finish the fulfillment request.
     * @param {object} request the request to fulfill.
     * @param {object} inventoryItem the inventoryItem that should be used for fulfillment.
     * @param {boolean} closeModal if the modal should be closed.
     * @param {boolean} increment if the request should increment, not decrement
     * @param {boolean} skipTransition if the transition should not run after fulfillment.
     */
    _finishFulfillRequest: function _finishFulfillRequest(request, inventoryItem, closeModal, increment, skipTransition) {
      var inventoryLocations = request.get('inventoryLocations');
      var locationsAffected = [];
      var markAsConsumed = request.get('markAsConsumed');
      var promises = [];
      var quantity = parseInt(request.get('quantity'));
      var requestPurchases = request.get('purchases');
      if (increment) {
        var locationToIncrement = inventoryLocations.get('firstObject');
        locationToIncrement.incrementProperty('quantity', quantity);
        promises.push(locationToIncrement.save());
        locationsAffected.push({
          name: locationToIncrement.get('locationName'),
          quantity: quantity
        });
      } else {
        inventoryLocations.reduce((function (quantityNeeded, location) {
          var deliveryLocation = request.get('deliveryLocation');
          var deliveryAisle = request.get('deliveryAisle');
          var locationQuantity = parseInt(location.get('quantity'));
          if (quantityNeeded > 0) {
            if (!markAsConsumed) {
              location.set('transferAisleLocation', deliveryAisle);
              location.set('transferLocation', deliveryLocation);
            }
            if (locationQuantity >= quantityNeeded) {
              if (markAsConsumed) {
                location.decrementProperty('quantity', quantityNeeded);
                promises.push(location.save());
              } else {
                location.set('adjustmentQuantity', quantityNeeded);
                promises.push(this.transferToLocation(inventoryItem, location));
              }
              locationsAffected.push({
                name: location.get('locationName'),
                quantity: quantityNeeded
              });
              return 0;
            } else {
              if (markAsConsumed) {
                location.decrementProperty('quantity', locationQuantity);
                promises.push(location.save());
              } else {
                location.set('adjustmentQuantity', locationQuantity);
                promises.push(this.transferToLocation(inventoryItem, location));
              }
              locationsAffected.push({
                name: location.get('locationName'),
                quantity: locationQuantity
              });
              return quantityNeeded - locationQuantity;
            }
          }
        }).bind(this), quantity);
      }
      request.set('locationsAffected', locationsAffected);
      if (markAsConsumed) {
        requestPurchases.forEach(function (purchase) {
          promises.push(purchase.save());
        });
      }
      _ember['default'].RSVP.all(promises, 'Preliminary saving done for inventory fulfillment').then((function () {
        var savePromises = [];
        savePromises.push(inventoryItem.save());
        request.set('status', 'Completed');
        request.set('completedBy', request.getUserName());
        savePromises.push(request.save());
        _ember['default'].RSVP.all(savePromises, 'All saving done for inventory fulfillment').then((function () {
          this.send('doneFulfillRequest');
          if (closeModal) {
            this.send('closeModal');
          }
          if (!skipTransition) {
            this.transitionTo('inventory.index');
          }
        }).bind(this));
      }).bind(this));
    },

    /**
     * @private
     * Fulfill the request, decrementing from the purchases available on the inventory item
     * This function doesn't save anything, it just updates the objects in memory, so
     * a route will need to ensure that the models affected here get updated.
     * @param {object} request the request to fulfill.
     * @param {object} inventoryItem the inventoryItem that should be used for fulfillment.
     * @param {boolean} increment if the request should increment, not decrement
     * @returns true if the request is fulfilled; false if it cannot be fulfilled due to a lack
     * of stock.
     */
    _performFulfillment: function _performFulfillment(request, inventoryItem, increment) {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        var purchases = inventoryItem.get('purchases');
        var quantityOnHand = inventoryItem.get('quantity');
        var quantityRequested = request.get('quantity');
        if (increment || quantityOnHand >= quantityRequested) {
          var findResult = this._findQuantity(request, purchases, inventoryItem, increment);
          if (findResult === true) {
            resolve();
          } else {
            reject(findResult);
          }
        } else {
          reject('The quantity on hand, ' + quantityOnHand + ' is less than the requested quantity of ' + quantityRequested + '.');
        }
      }).bind(this));
    }

  });
});
define('hospitalrun/mixins/hospitalrun-version', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    version: '1.0.0-beta'
  });
});
define('hospitalrun/mixins/incident-statuses', ['exports', 'ember'], function (exports, _ember) {
  var get = _ember['default'].get;
  var ACTIVE = 'Active';
  exports.ACTIVE = ACTIVE;
  var CLOSED = 'Closed';
  exports.CLOSED = CLOSED;
  var FOLLOW_UP = 'Followup';
  exports.FOLLOW_UP = FOLLOW_UP;
  var REPORTED = 'Reported';

  exports.REPORTED = REPORTED;
  exports['default'] = _ember['default'].Mixin.create({
    statusList: [ACTIVE, CLOSED, FOLLOW_UP, REPORTED],
    getLocalizedStatus: function getLocalizedStatus(status) {
      var i18n = get(this, 'i18n');
      return i18n.t('incident.labels.status' + status);
    }
  });
});
define('hospitalrun/mixins/inventory-adjustment-types', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    adjustmentTypes: (function () {
      var i18n = this.get('i18n');
      return [{
        name: i18n.t('inventory.labels.addAdjustmentType').toString(),
        type: 'Adjustment (Add)'
      }, {
        name: i18n.t('inventory.labels.removeAdjustmentType').toString(),
        type: 'Adjustment (Remove)'
      }, {
        name: i18n.t('inventory.labels.returnToVendorAdjustmentType').toString(),
        type: 'Return To Vendor'
      }, {
        name: i18n.t('inventory.labels.returnAdjustmentType').toString(),
        type: 'Return'
      }, {
        name: i18n.t('inventory.labels.writeOffAdjustmentType').toString(),
        type: 'Write Off'
      }];
    }).property()
  });
});
define('hospitalrun/mixins/inventory-id', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    /**
     * Calculate a new id based on time stamp and randomized number
     * @return a generated id in base 36 so that its a shorter barcode.
     */
    generateId: function generateId() {
      var min = 1;
      var max = 999;
      var part1 = new Date().getTime();
      var part2 = Math.floor(Math.random() * (max - min + 1)) + min;
      return _ember['default'].RSVP.resolve(part1.toString(36) + '_' + part2.toString(36));
    }
  });
});
define('hospitalrun/mixins/inventory-locations', ['exports', 'ember', 'npm:uuid'], function (exports, _ember, _npmUuid) {
  exports['default'] = _ember['default'].Mixin.create({
    aisleToFind: null,
    locationToFind: null,

    _addQuantityToLocation: function _addQuantityToLocation(inventoryItem, quantity, location, aisle) {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        this._findOrCreateLocation(inventoryItem, location, aisle).then(function (foundLocation) {
          foundLocation.incrementProperty('quantity', quantity);
          foundLocation.save().then(resolve, reject);
        });
      }).bind(this));
    },

    _findOrCreateLocation: function _findOrCreateLocation(inventoryItem, location, aisle) {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        var _this = this;

        var foundLocation = false;
        var locations = inventoryItem.get('locations');
        this.set('aisleToFind', aisle);
        this.set('locationToFind', location);

        foundLocation = locations.find(this.findLocation, this);
        if (foundLocation) {
          resolve(foundLocation);
        } else {
          (function () {
            var locationRecord = _this.get('store').createRecord('inv-location', {
              id: _npmUuid['default'].v4(),
              aisleLocation: aisle,
              location: location,
              quantity: 0
            });
            locations.addObject(locationRecord);
            locationRecord.save().then(function () {
              resolve(locationRecord);
            }, reject);
          })();
        }
      }).bind(this));
    },

    findLocation: function findLocation(inventoryLocation) {
      var aisleLocation = inventoryLocation.get('aisleLocation');
      var aisleToFind = this.get('aisleToFind');
      var itemLocation = inventoryLocation.get('location');
      var locationToFind = this.get('locationToFind');
      if ((_ember['default'].isEmpty(aisleLocation) && _ember['default'].isEmpty(aisleToFind) || aisleLocation === aisleToFind) && (_ember['default'].isEmpty(itemLocation) && _ember['default'].isEmpty(locationToFind) || itemLocation === locationToFind)) {
        return true;
      }
    },

    /**
     * Process a new purchase, updating the corresponding location
     * with the number of items available.
     * @returns {Promise} a promise that fulfills once location has been updated.
     */
    newPurchaseAdded: function newPurchaseAdded(inventoryItem, newPurchase) {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        var aisle = newPurchase.get('aisleLocation');
        var location = newPurchase.get('location');
        var quantity = parseInt(newPurchase.get('originalQuantity'));
        this._addQuantityToLocation(inventoryItem, quantity, location, aisle).then(resolve, reject);
      }).bind(this));
    },

    /**
     * Save the location if the quantity is greater than zero, otherwise remove the empty location.
     * @param {Object} location the location to update or remove.
     * @param {Object} inventoryItem the inventory item the location belongs to.
     * @return {Promise} promise for save or remove
     */
    saveLocation: function saveLocation(location, inventoryItem) {
      if (location.get('quantity') === 0) {
        var locations = inventoryItem.get('locations');
        locations.removeObject(location);
        return location.destroyRecord();
      } else {
        return location.save();
      }
    },

    /**
     * Transfer items from the current location to the specified location.
     * @param {Object} inventoryItem the inventory item that items are being transferred from
     * @param {Object} transferLocation the inventory location to transfer from (also includes
     * attributes about where to transfer to.
     * @returns {Promise} a promise that fulfills once the transfer to location has been saved.
     */
    transferToLocation: function transferToLocation(inventoryItem, transferLocation) {
      var aisle = transferLocation.get('transferAisleLocation');
      var location = transferLocation.get('transferLocation');
      var quantity = parseInt(transferLocation.get('adjustmentQuantity'));
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        this._addQuantityToLocation(inventoryItem, quantity, location, aisle).then(function () {
          transferLocation.decrementProperty('quantity', quantity);
          transferLocation.save().then(resolve, reject);
        }, reject);
      }).bind(this));
    }
  });
});
define('hospitalrun/mixins/inventory-type-list', ['exports', 'ember', 'hospitalrun/utils/select-values'], function (exports, _ember, _hospitalrunUtilsSelectValues) {
  exports['default'] = _ember['default'].Mixin.create({
    defaultInventoryTypes: ['Medication', 'Supply'],

    inventoryTypes: (function () {
      var defaultInventoryTypes = this.get('defaultInventoryTypes');
      var inventoryTypeList = this.get('inventoryTypeList');
      var typeList = undefined;
      if (_ember['default'].isEmpty(inventoryTypeList)) {
        typeList = defaultInventoryTypes;
      } else {
        typeList = inventoryTypeList;
      }
      typeList = _hospitalrunUtilsSelectValues['default'].selectValues(typeList);
      return typeList;
    }).property('inventoryTypeList', 'defaultInventoryTypes')
  });
});
define('hospitalrun/mixins/is-update-disabled', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    isUpdateDisabled: (function () {
      if (!_ember['default'].isNone(this.get('model.isValid'))) {
        return !this.get('model.isValid');
      } else {
        return false;
      }
    }).property('model.isValid')
  });
});
define('hospitalrun/mixins/location-name', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    getDisplayLocationName: function getDisplayLocationName(location, aisleLocation) {
      var locationName = this.formatLocationName(location, aisleLocation);
      if (_ember['default'].isEmpty(locationName)) {
        locationName = 'No Location';
      }
      return locationName;
    },

    formatLocationName: function formatLocationName(location, aisleLocation) {
      var locationName = '';
      if (!_ember['default'].isEmpty(location)) {
        locationName += location;
        if (!_ember['default'].isEmpty(aisleLocation)) {
          locationName += ' : ';
        }
      }
      if (!_ember['default'].isEmpty(aisleLocation)) {
        locationName += aisleLocation;
      }
      return locationName;
    },

    locationName: (function () {
      var aisleLocation = this.get('aisleLocation');
      var location = this.get('location');
      return this.getDisplayLocationName(location, aisleLocation);
    }).property('location', 'aisleLocation')
  });
});
define('hospitalrun/mixins/map-oauth-params', ['exports', 'ember'], function (exports, _ember) {
  var Mixin = _ember['default'].Mixin;
  exports['default'] = Mixin.create({
    mapOauthParams: function mapOauthParams(params) {
      return {
        config_consumer_key: params.k,
        config_consumer_secret: params.s1,
        config_oauth_token: params.t,
        config_token_secret: params.s2
      };
    }
  });
});
define('hospitalrun/mixins/medication-details', ['exports', 'ember', 'ember-data'], function (exports, _ember, _emberData) {
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _ember['default'].Mixin.create({
    // Denormalized medication details so that inventory records do not need to be retrieved

    /**
     * Does not return name on first call if medicationName is
     * not set and name is obtained via inventoryAttribute
     * Additional calls will return the name as medicationName
     * will then be set
     */
    getMedicationName: function getMedicationName(inventoryAttribute) {
      var _this = this;

      var medicationTitle = this.get('medicationTitle');
      if (!_ember['default'].isEmpty(medicationTitle)) {
        return medicationTitle;
      } else {
        var inventoryObject = this.get(inventoryAttribute);
        if (inventoryObject.then) {
          inventoryObject.then(function (inventoryItem) {
            if (!isEmpty(inventoryItem)) {
              _this.set('medicationTitle', inventoryItem.get('name'));
            }
          })['catch'](function (err) {
            console.log('error getting inventory item for medication name:', err);
          });
        } else {
          this.set('medicationTitle', inventoryObject.get('name'));
        }
      }
    },

    /**
     * Does not return name on first call if priceOfMedication is
     * not set and price is obtained via inventoryAttribute
     * Additional calls will return the price as priceOfMedication
     * will then be set
     */
    getMedicationPrice: function getMedicationPrice(inventoryAttribute) {
      var _this2 = this;

      var priceOfMedication = this.get('priceOfMedication');
      if (!_ember['default'].isEmpty(priceOfMedication)) {
        return priceOfMedication;
      } else {
        var inventoryObject = this.get(inventoryAttribute);
        if (inventoryObject.then) {
          inventoryObject.then(function (inventoryItem) {
            _this2.set('priceOfMedication', inventoryItem.get('price'));
          });
        } else {
          this.set('priceOfMedication', inventoryObject.get('price'));
        }
      }
    },

    getMedicationDetails: function getMedicationDetails(inventoryAttribute) {
      var _this3 = this;

      return new _ember['default'].RSVP.Promise(function (resolve) {
        var medicationTitle = _this3.get('medicationTitle');
        var priceOfMedication = _this3.get('priceOfMedication');
        if (!_ember['default'].isEmpty(medicationTitle) && !_ember['default'].isEmpty(priceOfMedication)) {
          resolve({
            name: medicationTitle,
            price: priceOfMedication
          });
        } else {
          var objectInventoryItem = _this3.get(inventoryAttribute);
          if (objectInventoryItem.then) {
            objectInventoryItem.then(function (inventoryItem) {
              resolve({
                name: inventoryItem.get('name'),
                price: inventoryItem.get('price')
              });
            });
          } else {
            resolve({
              name: objectInventoryItem.get('name'),
              price: objectInventoryItem.get('price')
            });
          }
        }
      });
    },

    medicationTitle: _emberData['default'].attr('string'),
    priceOfMedication: _emberData['default'].attr('number'),
    rxNormIdentifier: _emberData['default'].attr('string')
  });
});
define('hospitalrun/mixins/modal-helper', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    /**
     * Display a message in a closable modal.
     * @param title string containing the title to display.
     * @param message string containing the message to display.
     * @param okAction string containing the optional action to fire when the ok button is clicked.
     * @param okContext object containing the context to pass to the okAction.
     * @param cancelAction string containing the optional action to fire when the cancel button is clicked or the escape button is pressed.
     */
    displayAlert: function displayAlert(title, message, okAction, okContext, cancelAction) {
      var i18n = this.get('i18n');
      var modalOptions = _ember['default'].Object.extend({
        updateButtonText: i18n.t('buttons.ok')
      });
      this.send('openModal', 'dialog', modalOptions.create({
        cancelAction: cancelAction,
        hideCancelButton: true,
        message: message,
        okAction: okAction,
        okContext: okContext,
        title: title,
        updateButtonAction: 'ok'
      }));
    },

    displayConfirm: function displayConfirm(title, message, confirmAction, model) {
      var i18n = this.get('i18n');
      if (_ember['default'].isEmpty(model)) {
        model = _ember['default'].Object.create();
      }
      model.set('confirmAction', confirmAction);
      model.set('title', title);
      model.set('message', message);
      model.set('updateButtonAction', 'confirm');
      model.set('updateButtonText', i18n.t('buttons.ok'));
      this.send('openModal', 'dialog', model);
    }
  });
});
define('hospitalrun/mixins/navigation', ['exports', 'ember'], function (exports, _ember) {
  var camelize = _ember['default'].String.camelize;
  var get = _ember['default'].get;
  var isEqual = _ember['default'].isEqual;
  var set = _ember['default'].set;
  exports['default'] = _ember['default'].Mixin.create({
    navItems: [{
      title: 'Inventory',
      iconClass: 'octicon-package',
      route: 'inventory.index',
      capability: 'inventory',
      subnav: [{
        title: 'Requests',
        iconClass: 'octicon-chevron-right',
        route: 'inventory.index',
        capability: 'add_inventory_request'
      }, {
        title: 'Items',
        iconClass: 'octicon-chevron-right',
        route: 'inventory.listing',
        capability: 'inventory'
      }, {
        title: 'Inventory Received',
        iconClass: 'octicon-plus',
        route: 'inventory.batch',
        subroute: 'new',
        capability: 'add_inventory_item'
      }, {
        title: 'Reports',
        iconClass: 'octicon-chevron-right',
        route: 'inventory.reports',
        capability: 'inventory'
      }]
    }, {
      title: 'Patients',
      iconClass: 'octicon-organization',
      route: 'patients.index',
      capability: 'patients',
      subnav: [{
        title: 'Patient Listing',
        iconClass: 'octicon-chevron-right',
        route: 'patients.index',
        capability: 'patients'
      }, {
        title: 'Admitted Patients',
        iconClass: 'octicon-chevron-right',
        route: 'patients.admitted',
        capability: 'patients'
      }, {
        title: 'Outpatient',
        iconClass: 'octicon-chevron-right',
        route: 'patients.outpatient',
        capability: 'patients'
      }, {
        title: 'New Patient',
        iconClass: 'octicon-plus',
        route: 'patients.edit',
        subroute: 'new',
        capability: 'add_patient'
      }, {
        title: 'Reports',
        iconClass: 'octicon-chevron-right',
        route: 'patients.reports',
        capability: 'patients'
      }]
    }, {
      title: 'Scheduling',
      iconClass: 'octicon-calendar',
      route: 'appointments.index',
      capability: 'appointments',
      subnav: [{
        title: 'Appointments This Week',
        iconClass: 'octicon-chevron-right',
        route: 'appointments.index',
        capability: 'appointments'
      }, {
        title: 'Today\'s Appointments',
        iconClass: 'octicon-chevron-right',
        route: 'appointments.today',
        capability: 'appointments'
      }, {
        title: 'Appointment Search',
        iconClass: 'octicon-search',
        route: 'appointments.search',
        capability: 'appointments'
      }, {
        title: 'Appointments Calendar',
        iconClass: 'octicon-calendar',
        route: 'appointments.calendar',
        capability: 'appointments'
      }, {
        title: 'Add Appointment',
        iconClass: 'octicon-plus',
        route: 'appointments.edit',
        subroute: 'new',
        capability: 'add_appointment'
      }, {
        title: 'Theater Schedule',
        iconClass: 'octicon-calendar',
        route: 'appointments.theater',
        capability: 'appointments'
      }, {
        title: 'Schedule Surgery',
        iconClass: 'octicon-plus',
        route: 'appointments.edit',
        subroute: 'newsurgery',
        capability: 'add_appointment'
      }]
    }, {
      title: 'Imaging',
      iconClass: 'octicon-device-camera',
      route: 'imaging.index',
      capability: 'imaging',
      subnav: [{
        title: 'Requests',
        iconClass: 'octicon-chevron-right',
        route: 'imaging.index',
        capability: 'imaging'
      }, {
        title: 'Completed',
        iconClass: 'octicon-chevron-right',
        route: 'imaging.completed',
        capability: 'imaging'
      }, {
        title: 'New Request',
        iconClass: 'octicon-plus',
        route: 'imaging.edit',
        subroute: 'new',
        capability: 'add_imaging'
      }]
    }, {
      title: 'Medication',
      iconClass: 'octicon-file-text',
      route: 'medication.index',
      capability: 'medication',
      subnav: [{
        title: 'Requests',
        iconClass: 'octicon-chevron-right',
        route: 'medication.index',
        capability: 'medication'
      }, {
        title: 'Completed',
        iconClass: 'octicon-chevron-right',
        route: 'medication.completed',
        capability: 'medication'
      }, {
        title: 'New Request',
        iconClass: 'octicon-plus',
        route: 'medication.edit',
        subroute: 'new',
        capability: 'add_medication'
      }, {
        title: 'Dispense',
        iconClass: 'octicon-checklist',
        route: 'medication.edit',
        subroute: 'dispense',
        capability: 'fulfill_medication'
      }, {
        title: 'Return Medication',
        iconClass: 'octicon-mail-reply',
        route: 'medication.return',
        subroute: 'new',
        capability: 'add_medication'
      }]
    }, {
      title: 'Labs',
      iconClass: 'octicon-microscope',
      route: 'labs.index',
      capability: 'labs',
      subnav: [{
        title: 'Requests',
        iconClass: 'octicon-chevron-right',
        route: 'labs.index',
        capability: 'labs'
      }, {
        title: 'Completed',
        iconClass: 'octicon-chevron-right',
        route: 'labs.completed',
        capability: 'labs'
      }, {
        title: 'New Request',
        iconClass: 'octicon-plus',
        route: 'labs.edit',
        subroute: 'new',
        capability: 'add_lab'
      }]
    }, {
      title: 'Billing',
      iconClass: 'octicon-credit-card',
      route: 'invoices.index',
      capability: 'invoices',
      subnav: [{
        title: 'Invoices',
        iconClass: 'octicon-chevron-right',
        route: 'invoices.index',
        capability: 'invoices'
      }, {
        title: 'New Invoice',
        iconClass: 'octicon-plus',
        route: 'invoices.edit',
        subroute: 'new',
        capability: 'invoices'
      }, {
        title: 'Prices',
        iconClass: 'octicon-chevron-right',
        route: 'pricing.index',
        capability: 'pricing'
      }, {
        title: 'Price Profiles',
        iconClass: 'octicon-chevron-right',
        route: 'pricing.profiles',
        capability: 'pricing'
      }, {
        title: 'Cashier',
        iconClass: 'octicon-chevron-right',
        route: 'invoices.cashier',
        capability: 'invoices'
      }]
    }, {
      title: 'Incident',
      iconClass: 'octicon-package',
      route: 'incident',
      capability: 'incident',
      subnav: [{
        title: 'Current Incidents',
        iconClass: 'octicon-chevron-right',
        route: 'incident.index',
        capability: 'add_incident'
      }, {
        title: 'New Incident',
        iconClass: 'octicon-plus',
        route: 'incident.edit',
        subroute: 'new',
        capability: 'add_incident'
      }, {
        title: 'History',
        iconClass: 'octicon-chevron-right',
        route: 'incident.completed',
        capability: 'add_incident'
      }, {
        title: 'Reports',
        iconClass: 'octicon-chevron-right',
        route: 'incident.reports',
        capability: 'generate_incident_report'
      }]
    }, {
      title: 'Administration',
      iconClass: 'octicon-person',
      route: 'admin.lookup',
      capability: 'admin',
      subnav: [{
        title: 'Address Fields',
        iconClass: 'octicon-chevron-right',
        route: 'admin.address',
        capability: 'update_config'
      }, {
        title: 'Custom Forms',
        iconClass: 'octicon-chevron-right',
        route: 'admin.custom-forms',
        capability: 'update_config'
      }, {
        title: 'Incident Categories',
        iconClass: 'octicon-chevron-right',
        route: 'inc-category',
        capability: 'add_incident_category'
      }, {
        title: 'Load DB',
        iconClass: 'octicon-plus',
        route: 'admin.loaddb',
        capability: 'load_db'
      }, {
        title: 'Lookup Lists',
        iconClass: 'octicon-chevron-right',
        route: 'admin.lookup',
        capability: 'update_config'
      }, {
        title: 'Text Replacements',
        iconClass: 'octicon-plus',
        route: 'admin.textreplace',
        capability: 'update_config'
      }, {
        title: 'Print Header',
        iconClass: 'octicon-chevron-right',
        route: 'admin.print-header',
        capability: 'update_config'
      }, {
        title: 'Users',
        iconClass: 'octicon-chevron-right',
        route: 'users',
        capability: 'users'
      }, {
        title: 'New User',
        iconClass: 'octicon-plus',
        route: 'users.edit',
        subroute: 'new',
        capability: 'add_user'
      }, {
        title: 'User Roles',
        iconClass: 'octicon-chevron-right',
        route: 'admin.roles',
        capability: 'define_user_roles'
      }]
    }],

    // Navigation items get mapped localizations
    localizedNavItems: _ember['default'].computed('navItems.[]', function () {
      var localizationPrefix = 'navigation.';
      // Supports unlocalized keys for now, otherwise we would get:
      // "Missing translation: key.etc.path"
      var translationOrOriginal = function translationOrOriginal(translation, original) {
        // Check for typeof string, because if it's found in localization,
        // i18n will return a SafeString object, not a string
        return typeof translation === 'string' ? original : translation;
      };
      var i18n = get(this, 'i18n');
      var navItems = get(this, 'navItems');
      return navItems.map(function (nav) {
        var sectionKey = localizationPrefix + camelize(nav.title).toLowerCase();
        var navTranslated = i18n.t(sectionKey);

        set(nav, 'localizedTitle', translationOrOriginal(navTranslated, nav.title));
        // Map all of the sub navs, too
        set(nav, 'subnav', nav.subnav.map(function (sub) {
          var subItemKey = localizationPrefix + 'subnav.' + camelize(sub.title);
          var subTranslated = i18n.t(subItemKey);
          set(sub, 'localizedTitle', translationOrOriginal(subTranslated, sub.title));
          return sub;
        }));

        return nav;
      });
    }),

    findNavItemByRoute: function findNavItemByRoute(route) {
      for (var i = 0; i < this.navItems.length; i++) {
        if (isEqual(this.navItems[i].route, route)) {
          return this.navItems[i];
        } else {
          for (var j = 0; j < this.navItems[i].subnav.length; j++) {
            if (isEqual(this.navItems[i].subnav[j].route, route)) {
              return this.navItems[i].subnav[j];
            }
          }
        }
      }
      return null;
    }
  });
});
define('hospitalrun/mixins/number-format', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    /**
     * Given an array and property, total all of the property values in the array and return the value.
     * @param array Array|String either the actual array or the property name of the array on this object.
     * @param propertyName String the property name in the array values to total.
     * @param number that contains at most two decimal places.
     */
    _calculateTotal: function _calculateTotal(array, propertyName) {
      var arrayItems = undefined;
      var total = 0;
      if (_ember['default'].isArray(array)) {
        arrayItems = array;
      } else {
        arrayItems = this.get(array);
      }
      total = arrayItems.reduce((function (previousValue, lineItem) {
        return previousValue += this._getValidNumber(_ember['default'].get(lineItem, propertyName));
      }).bind(this), 0);
      return this._numberFormat(total, true);
    },

    /**
     * Determine if number passed in is actually a number.  If it is, return the number; otherwise return 0.
     * @param number the number to valdiate.
     * @returns number a valid number.
     */
    _getValidNumber: function _getValidNumber(number) {
      if (_ember['default'].isEmpty(number) || isNaN(number)) {
        return 0;
      } else {
        return Number(number);
      }
    },

    /**
     * Return a formatted number with a maximum of two digits
     * @param value number to format
     * @param returnAsNumber boolean to denote if formatted number should be returned
     * as a number instead of a string
     * @returns String|Number a formatted String or number containing the formatted number.
     */
    _numberFormat: function _numberFormat(value, returnAsNumber) {
      var returnValue = undefined;
      if (!_ember['default'].isEmpty(value)) {
        if (isNaN(value)) {
          return;
        }
        if (Math.round(value) === value) {
          returnValue = Number(value).toString();
        } else {
          returnValue = this._round100(value).toFixed(2);
        }
        if (returnAsNumber) {
          return Number(returnValue);
        } else {
          return returnValue.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
        }
      }
    },

    _validNumber: function _validNumber(number) {
      return !_ember['default'].isEmpty(number) && !isNaN(number) && number > 0;
    },

    _round100: function _round100(number) {
      var tempNumber = 100 * number;
      return Math.round(tempNumber) / 100;
    }

  });
});
define('hospitalrun/mixins/oauth-headers', ['exports', 'ember'], function (exports, _ember) {
  var Mixin = _ember['default'].Mixin;
  exports['default'] = Mixin.create({
    getOAuthHeaders: function getOAuthHeaders(configs) {
      return {
        'x-oauth-consumer-secret': configs.config_consumer_secret,
        'x-oauth-consumer-key': configs.config_consumer_key,
        'x-oauth-token-secret': configs.config_token_secret,
        'x-oauth-token': configs.config_oauth_token
      };
    }
  });
});
define('hospitalrun/mixins/operative-plan-statuses', ['exports', 'ember'], function (exports, _ember) {
  var computed = _ember['default'].computed;
  var COMPLETED_STATUS = 'completed';
  exports.COMPLETED_STATUS = COMPLETED_STATUS;
  var DROPPED_STATUS = 'dropped';
  exports.DROPPED_STATUS = DROPPED_STATUS;
  var PLANNED_STATUS = 'planned';

  exports.PLANNED_STATUS = PLANNED_STATUS;
  var STATUS_VALUES = [COMPLETED_STATUS, DROPPED_STATUS, PLANNED_STATUS];

  exports['default'] = _ember['default'].Mixin.create({
    planStatuses: computed(function () {
      var i18n = this.get('i18n');

      return STATUS_VALUES.map(function (status) {
        return {
          id: status,
          value: i18n.t('operativePlan.labels.' + status + 'Status')
        };
      }).sort(function (a, b) {
        return _ember['default'].compare(a.value.toString(), b.value.toString());
      });
    })
  });
});
define('hospitalrun/mixins/pagination-props', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    paginationProps: (function () {
      var paginationProperties = ['disableNextPage', 'disablePreviousPage', 'showFirstPageButton', 'showLastPageButton', 'showPagination'];
      return this.getProperties(paginationProperties);
    }).property('disableNextPage', 'disablePreviousPage', 'showFirstPageButton', 'showLastPageButton', 'showPagination')
  });
});
define('hospitalrun/mixins/paging-actions', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    firstPage: 'firstPage',
    lastPage: 'lastPage',
    nextPage: 'nextPage',
    previousPage: 'previousPage',
    actions: {
      firstPage: function firstPage() {
        this.sendAction('firstPage');
      },
      lastPage: function lastPage() {
        this.sendAction('lastPage');
      },
      nextPage: function nextPage() {
        this.sendAction('nextPage');
      },
      previousPage: function previousPage() {
        this.sendAction('previousPage');
      }
    }
  });
});
define('hospitalrun/mixins/patient-appointments', ['exports', 'ember', 'hospitalrun/mixins/pouchdb'], function (exports, _ember, _hospitalrunMixinsPouchdb) {
  exports['default'] = _ember['default'].Mixin.create(_hospitalrunMixinsPouchdb['default'], {
    getPatientAppointments: function getPatientAppointments(patient) {
      var patientId = patient.get('id');
      var maxValue = this.get('maxValue');
      return this.store.query('appointment', {
        options: {
          startkey: [patientId, null, null, 'appointment_'],
          endkey: [patientId, maxValue, maxValue, maxValue]
        },
        mapReduce: 'appointments_by_patient'
      });
    }
  });
});
define('hospitalrun/mixins/patient-diagnosis', ['exports', 'ember'], function (exports, _ember) {
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _ember['default'].Mixin.create({
    _addDiagnosisToList: function _addDiagnosisToList(diagnosis, diagnosesList) {
      if (!_ember['default'].isEmpty(diagnosis)) {
        if (_ember['default'].isEmpty(diagnosesList.findBy('description', diagnosis))) {
          diagnosesList.addObject(diagnosis);
        }
      }
    },

    getDiagnoses: function getDiagnoses(diagnosisContainer, hideInActiveDiagnoses, secondaryDiagnoses) {
      var _this = this;

      var diagnosisProperty = arguments.length <= 3 || arguments[3] === undefined ? 'diagnoses' : arguments[3];

      var diagnosesList = [];
      if (!isEmpty(diagnosisContainer)) {
        var diagnoses = diagnosisContainer.get(diagnosisProperty);
        diagnoses = diagnoses.filterBy('archived', false);
        if (hideInActiveDiagnoses) {
          diagnoses = diagnoses.filterBy('active', true);
        }
        if (!secondaryDiagnoses) {
          secondaryDiagnoses = false;
        }
        diagnoses = diagnoses.filterBy('secondaryDiagnosis', secondaryDiagnoses);
        diagnoses.forEach(function (diagnosis) {
          _this._addDiagnosisToList(diagnosis, diagnosesList);
        });
        return diagnosesList;
      }
    }
  });
});
define('hospitalrun/mixins/patient-id', ['exports', 'ember', 'hospitalrun/mixins/friendly-id'], function (exports, _ember, _hospitalrunMixinsFriendlyId) {
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  exports['default'] = _ember['default'].Mixin.create(_hospitalrunMixinsFriendlyId['default'], {
    config: inject.service(),
    sequenceName: 'patient',
    sequenceView: 'patient_by_display_id',

    sequencePrefix: function sequencePrefix() {
      var config = get(this, 'config');
      return config.getPatientPrefix();
    }
  });
});
define('hospitalrun/mixins/patient-invoices', ['exports', 'ember', 'hospitalrun/mixins/pouchdb'], function (exports, _ember, _hospitalrunMixinsPouchdb) {
  exports['default'] = _ember['default'].Mixin.create(_hospitalrunMixinsPouchdb['default'], {
    getPatientInvoices: function getPatientInvoices(patient) {
      var patientId = patient.get('id');
      return this.store.query('invoice', {
        options: {
          key: patientId
        },
        mapReduce: 'invoice_by_patient'
      });
    }
  });
});
define('hospitalrun/mixins/patient-list-route', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    database: _ember['default'].inject.service(),

    /**
     * Lazily load patient list so that it doesn't impact performance.
     */
    _fetchPatientList: function _fetchPatientList(controller) {
      var patientQuery = {
        startkey: 'patient_',
        endkey: 'patient_',
        include_docs: true
      };
      var database = this.get('database');
      database.queryMainDB(patientQuery).then(function (result) {
        if (result.rows) {
          var list = result.rows.map(function (row) {
            return row.doc;
          });
          controller.set('patientList', list);
        }
      });
    },

    actions: {
      returnToPatient: function returnToPatient() {
        this.controller.send('returnToPatient');
        this.controller.send('closeModal');
      },

      returnToVisit: function returnToVisit() {
        this.controller.send('returnToVisit');
      }
    },

    setupController: function setupController(controller, model) {
      this._super(controller, model);
      this._fetchPatientList(controller);
    }
  });
});
define('hospitalrun/mixins/patient-name', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    getPatientDisplayId: function getPatientDisplayId(patient) {
      var externalPatientId = _ember['default'].get(patient, 'externalPatientId');
      var friendlyId = _ember['default'].get(patient, 'friendlyId');
      var id = _ember['default'].get(patient, 'id');
      if (!_ember['default'].isEmpty(friendlyId)) {
        return friendlyId;
      } else if (!_ember['default'].isEmpty(externalPatientId)) {
        return externalPatientId;
      } else {
        return id;
      }
    },

    getPatientDisplayName: function getPatientDisplayName(patient, shortName) {
      var firstName = _ember['default'].get(patient, 'firstName');
      var lastName = _ember['default'].get(patient, 'lastName');
      var middleName = _ember['default'].get(patient, 'middleName');
      var nameArray = [];
      if (!_ember['default'].isEmpty(firstName)) {
        nameArray.push(firstName);
      }
      if (!_ember['default'].isEmpty(middleName) && !shortName) {
        nameArray.push(middleName);
      }
      if (!_ember['default'].isEmpty(lastName)) {
        nameArray.push(lastName);
      }
      return nameArray.join(' ');
    }
  });
});
define('hospitalrun/mixins/patient-notes', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({

    canAddNote: function canAddNote() {
      return this.currentUserCan('add_note') && (!_ember['default'].isEmpty(this.get('visits')) || !_ember['default'].isEmpty(this.get('model.visits')));
    },

    canDeleteNote: function canDeleteNote() {
      return this.currentUserCan('delete_note');
    },

    _computeNoteType: function _computeNoteType(visit) {
      switch (visit.get('visitType')) {
        case 'Admission':
          if (_ember['default'].isEmpty(visit.get('procedures'))) {
            return 'Pre-op';
          } else {
            return 'Post-op';
          }
        case 'Clinic':
        case 'Followup':
          return 'General';
        default:
          return visit.get('visitType');
      }
    },

    _setNoteType: function _setNoteType() {
      var model = this.get('model');
      if (model.get('noteType') == null) {
        model.set('noteType', this._computeNoteType(model.get('visit')));
      }
    }
  });
});
define('hospitalrun/mixins/patient-submodule', ['exports', 'ember-data', 'ember', 'hospitalrun/mixins/patient-visits', 'hospitalrun/utils/select-values'], function (exports, _emberData, _ember, _hospitalrunMixinsPatientVisits, _hospitalrunUtilsSelectValues) {
  var get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _ember['default'].Mixin.create(_hospitalrunMixinsPatientVisits['default'], {
    findPatientVisits: true, // Override to false if visits shouldn't be set when patient is selected.
    needToUpdateVisit: false,
    patientList: null,
    selectedPatient: null,
    newVisitAdded: null,

    actions: {
      showPatient: function showPatient(patient) {
        this.transitionToRoute('patients.edit', patient);
      },

      returnToAllItems: function returnToAllItems() {
        this._cancelUpdate();
        this.send('allItems');
      },
      returnToPatient: function returnToPatient() {
        this._cancelUpdate();
        this.transitionToRoute('patients.edit', this.get('model.returnToPatient'));
      },
      returnToVisit: function returnToVisit() {
        this._cancelUpdate();
        this.transitionToRoute('visits.edit', this.get('model.returnToVisit'));
      },

      selectedPatientChanged: function selectedPatientChanged(selectedPatient) {
        var _this = this;

        if (!_ember['default'].isEmpty(selectedPatient)) {
          this.store.find('patient', selectedPatient.id).then(function (item) {
            _this.set('model.patient', item);
            _this.patientSelected(item);
            _ember['default'].run.once(_this, function () {
              this.get('model').validate()['catch'](_ember['default'].K);
            });
          });
        } else {
          this.set('model.patient', null);
          this.patientSelected();
        }
      }
    },

    /**
     * Add the specified child to the current visit and then save the visit.  If a visit
     * has not been selected, create a new visit and add it to the selected patient.
     * @param {Object} objectToAdd the object to add.
     * @param {string} childName the name of the child object on the visit to add to.
     * @param {string} newVisitType if a new visit needs to be created, what type of visit
     * should be created.
     * @returns {Promise} promise that will resolve or reject depending on whether or
     * not the add and subsequent saves were successful.
     */
    addChildToVisit: function addChildToVisit(objectToAdd, childName, newVisitType) {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        var visit = this.get('model.visit');
        if (_ember['default'].isEmpty(visit)) {
          visit = this.createNewVisit(newVisitType).then((function (savedVisit) {
            this._finishAddChildToVisit(objectToAdd, childName, savedVisit, resolve, reject);
          }).bind(this), reject);
        } else {
          this._finishAddChildToVisit(objectToAdd, childName, visit, resolve, reject);
        }
      }).bind(this));
    },

    addDiagnosisToModelAndPatient: function addDiagnosisToModelAndPatient(newDiagnosis) {
      var _this2 = this;

      var diagnoses = this.get('model.diagnoses');
      diagnoses.addObject(newDiagnosis);
      var patientDiagnoses = this.get('model.patient.diagnoses');
      var diagnosisExists = patientDiagnoses.any(function (diagnosis) {
        return diagnosis.get('active') === true && diagnosis.get('diagnosis') === newDiagnosis.get('diagnosis') && diagnosis.get('secondaryDiagnosis') === newDiagnosis.get('secondaryDiagnosis');
      });
      if (!diagnosisExists) {
        (function () {
          var newPatientDiagnosis = _this2._copyDiagnosis(newDiagnosis);
          newPatientDiagnosis.save().then(function () {
            patientDiagnoses.addObject(newPatientDiagnosis);
            var patient = _this2.get('model.patient');
            patient.save().then(function () {
              _this2.silentUpdate('closeModal');
            });
          });
        })();
      } else {
        this.silentUpdate('closeModal');
      }
    },

    _finishAddChildToVisit: function _finishAddChildToVisit(objectToAdd, childName, visit, resolve, reject) {
      visit.get(childName).then((function (visitChildren) {
        visitChildren.addObject(objectToAdd);
        this.set('needToUpdateVisit', true);
        resolve(visit);
      }).bind(this), reject);
    },

    cancelAction: (function () {
      var returnToPatient = this.get('model.returnToPatient');
      var returnToVisit = this.get('model.returnToVisit');
      if (!isEmpty(returnToVisit)) {
        return 'returnToVisit';
      } else if (!isEmpty(returnToPatient)) {
        return 'returnToPatient';
      } else {
        return 'returnToAllItems';
      }
    }).property('model.returnToPatient', 'model.returnToVisit'),

    createNewVisit: function createNewVisit(newVisitType) {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        var model = this.get('model');
        var patient = model.get('patient');
        var visit = this.get('store').createRecord('visit', {
          startDate: new Date(),
          endDate: new Date(),
          outPatient: true,
          patient: patient,
          visitType: newVisitType
        });
        model.set('visit', visit);
        visit.save().then((function () {
          visit.reload().then((function (updatedVisit) {
            this.set('newVisitAdded', updatedVisit);
            model.set('visit', updatedVisit);
            resolve(updatedVisit);
          }).bind(this), reject);
        }).bind(this), reject)['catch']((function (err) {
          console.log('Error creating new visit');
          reject(err);
        }).bind(this));
      }).bind(this));
    },

    deleteChildFromVisit: function deleteChildFromVisit(childName) {
      var _this3 = this;

      var recordToDelete = this.get('model');
      recordToDelete.set('archived', true);
      this.removeChildFromVisit(recordToDelete, childName).then(function () {
        recordToDelete.save().then(function () {
          recordToDelete.unloadRecord();
          _this3.send('closeModal');
        });
      });
    },

    getPatientDiagnoses: function getPatientDiagnoses(patient, model) {
      var _this4 = this;

      var diagnoses = patient.get('diagnoses');
      var activeDiagnoses = undefined;
      if (!isEmpty(diagnoses)) {
        activeDiagnoses = diagnoses.filterBy('active', true).map(function (diagnosis) {
          return _this4._copyDiagnosis(diagnosis);
        });
      }
      var currentDiagnoses = get(model, 'diagnoses');
      currentDiagnoses.clear();
      if (!isEmpty(activeDiagnoses)) {
        currentDiagnoses.addObjects(activeDiagnoses);
      }
    },

    patientId: _ember['default'].computed.alias('model.patient.id'),

    patientSelected: function patientSelected() /* patient */{},

    patientVisits: (function () {
      var patient = this.get('model.patient');
      var visitPromise = undefined;

      if (!_ember['default'].isEmpty(patient) && this.get('findPatientVisits')) {
        visitPromise = this.getPatientVisits(patient);
      } else {
        visitPromise = _ember['default'].RSVP.resolve([]);
      }
      return _emberData['default'].PromiseArray.create({
        promise: visitPromise
      });
    }).property('model.patient.id', 'newVisitAdded'),

    patientProcedures: _ember['default'].computed('patientVisits.[]', function () {
      var _this5 = this;

      var patient = get(this, 'model.patient');
      return _emberData['default'].PromiseArray.create({
        promise: get(this, 'patientVisits').then(function (patientVisits) {
          return get(patient, 'operationReports').then(function (operationReports) {
            return _this5._getPatientProcedures(operationReports, patientVisits);
          });
        })
      });
    }),

    patientVisitsForSelect: (function () {
      return _emberData['default'].PromiseArray.create({
        promise: this.get('patientVisits').then(function (patientVisits) {
          return patientVisits.map(_hospitalrunUtilsSelectValues['default'].selectObjectMap);
        })
      });
    }).property('patientVisits.[]'),

    /**
     * Removes the specified child from the current visit object and then saves the visit.
     * @param {Object} objectToRemove the object to remove.
     * @param {string} childName the name of the child object on the visit to remove from.
     * @returns {Promise} promise that will resolve or reject depending on whether or
     * not the remove and subsequent save were successful.
     */
    removeChildFromVisit: function removeChildFromVisit(objectToRemove, childName) {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        var childPromises = [];
        var visit = this.get('model.visit');
        childPromises.addObjects(this.resolveVisitChildren());
        _ember['default'].RSVP.all(childPromises, 'Resolved visit children before removing ' + childName).then((function () {
          visit.get(childName).then((function (visitChildren) {
            visitChildren.removeObject(objectToRemove);
            visit.save().then(resolve, reject);
          }).bind(this), reject);
        }).bind(this), reject);
      }).bind(this));
    },

    /**
     * Observer on visits to make sure async relationships are resolved.
     * @returns {array} of promises which can be used to ensure
     * all relationships have resolved.
     */
    resolveVisitChildren: function resolveVisitChildren() {
      var promises = [];
      var visit = this.get('model.visit');
      if (!_ember['default'].isEmpty(visit)) {
        // Make sure all the async relationships are resolved
        promises.push(visit.get('imaging'));
        promises.push(visit.get('labs'));
        promises.push(visit.get('medication'));
        promises.push(visit.get('procedures'));
        promises.push(visit.get('vitals'));
        promises.push(visit.get('reports'));
      }
      return promises;
    },

    saveNewDiagnoses: function saveNewDiagnoses() {
      var diagnoses = this.get('model.diagnoses');
      diagnoses = diagnoses.filterBy('isNew', true);
      if (!isEmpty(diagnoses)) {
        var savePromises = diagnoses.map(function (diagnoses) {
          return diagnoses.save();
        });
        return _ember['default'].RSVP.all(savePromises);
      } else {
        return _ember['default'].RSVP.resolve();
      }
    },

    /**
     * If visit needs to saved, save it and then display an alert message; otherwise
     * just display the alert message.
     * @param alertTitle String the title to use on the alert.
     * @param alertMessage String the message to display in the alert.
     */
    saveVisitIfNeeded: function saveVisitIfNeeded(alertTitle, alertMessage, alertAction) {
      if (this.get('needToUpdateVisit')) {
        this.get('model.visit').save().then((function () {
          this.set('needToUpdateVisit', false);
          this.displayAlert(alertTitle, alertMessage, alertAction);
        }).bind(this));
      } else {
        this.displayAlert(alertTitle, alertMessage, alertAction);
      }
    },

    visitId: _ember['default'].computed.alias('model.visit.id'),
    visitsController: _ember['default'].computed.alias('controllers.visits'),

    _copyDiagnosis: function _copyDiagnosis(diagnosisToCopy) {
      var attributesToCopy = ['date', 'diagnosis', 'secondaryDiagnosis'];
      return this.store.createRecord('diagnosis', diagnosisToCopy.getProperties(attributesToCopy));
    }
  });
});
define('hospitalrun/mixins/patient-visits', ['exports', 'ember', 'hospitalrun/mixins/pouchdb', 'hospitalrun/utils/visit-statuses', 'ember-data', 'moment'], function (exports, _ember, _hospitalrunMixinsPouchdb, _hospitalrunUtilsVisitStatuses, _emberData, _moment) {
  var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();

  var isEmpty = _ember['default'].isEmpty;
  var get = _ember['default'].get;
  exports['default'] = _ember['default'].Mixin.create(_hospitalrunMixinsPouchdb['default'], {
    getPatientVisits: function getPatientVisits(patient) {
      var maxValue = this.get('maxValue');
      var patientId = patient.get('id');
      return this.store.query('visit', {
        options: {
          startkey: [patientId, null, null, null, 'visit_'],
          endkey: [patientId, maxValue, maxValue, maxValue, maxValue]
        },
        mapReduce: 'visit_by_patient',
        debug: true
      });
    },

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

          var appointment = _futureAppointments[0];

          return appointment;
        } else {
          return futureAppointments.slice(0, 3);
        }
      });
      return outPatient ? _emberData['default'].PromiseArray.create({ promise: promise }) : _emberData['default'].PromiseObject.create({ promise: promise });
    },

    _getVisitCollection: function _getVisitCollection(visits, name) {
      var returnList = [];
      if (!_ember['default'].isEmpty(visits)) {
        visits.forEach(function (visit) {
          get(visit, name).then(function (items) {
            returnList.addObjects(items);
          });
        });
      }
      return returnList;
    },

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

    checkoutVisit: function checkoutVisit(visit, status) {
      var _this = this;

      visit.set('status', status);
      visit.set('endDate', new Date());
      return visit.save().then(function (savedVisit) {
        return _this.updatePatientVisitFlags(savedVisit).then(function () {
          var i18n = _this.get('i18n');
          var patientDetails = { patientName: visit.get('patient.displayName') };
          var message = undefined,
              title = undefined;
          if (status === _hospitalrunUtilsVisitStatuses['default'].CHECKED_OUT) {
            message = i18n.t('visits.messages.checkedOut', patientDetails);
            title = i18n.t('visits.titles.checkedOut');
          } else {
            message = i18n.t('visits.messages.discharged', patientDetails);
            title = i18n.t('visits.titles.discharged');
          }
          _this.displayAlert(title, message);
        });
      });
    },

    updatePatientVisitFlags: function updatePatientVisitFlags(visit) {
      var patient = visit.get('patient');
      var patientAdmitted = patient.get('admitted');
      var patientCheckedIn = patient.get('checkedIn');
      var status = this.get('model.status');
      if (status === _hospitalrunUtilsVisitStatuses['default'].ADMITTED && !patientAdmitted) {
        patient.set('admitted', true);
        return patient.save();
      } else if (status === _hospitalrunUtilsVisitStatuses['default'].CHECKED_IN && !patientCheckedIn) {
        patient.set('checkedIn', true);
        return patient.save();
      } else if (status === _hospitalrunUtilsVisitStatuses['default'].CHECKED_OUT && patientCheckedIn) {
        return this._updateUnlessVisitStatusExists(patient, _hospitalrunUtilsVisitStatuses['default'].CHECKED_IN, 'checkedIn');
      } else if (status === _hospitalrunUtilsVisitStatuses['default'].DISCHARGED && patientAdmitted) {
        return this._updateUnlessVisitStatusExists(patient, _hospitalrunUtilsVisitStatuses['default'].ADMITTED, 'admitted');
      } else {
        return _ember['default'].RSVP.resolve();
      }
    },

    _updateUnlessVisitStatusExists: function _updateUnlessVisitStatusExists(patient, statusToLookFor, patientStatusToSet) {
      return this.getPatientVisits(patient).then(function (visits) {
        if (isEmpty(visits.findBy('status', statusToLookFor))) {
          patient.set(patientStatusToSet, false);
          return patient.save();
        }
      });
    }

  });
});
define('hospitalrun/mixins/payment-profiles', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    paymentProfiles: ['Private', 'Discounted', 'Free']
  });
});
define('hospitalrun/mixins/pikaday-component', ['exports', 'ember'], function (exports, _ember) {
  var get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;
  var set = _ember['default'].set;
  exports['default'] = _ember['default'].Mixin.create({
    _picker: null,
    currentDate: null,
    dateSetAction: null, // Specify an action to fire when a date is selected
    format: 'l',
    maxDate: null,
    minDate: null,
    originalPropery: null,
    showTime: false,
    yearRange: 10,

    // Override with logic to fire when date is set
    dateSet: function dateSet() {
      var picker = get(this, '_picker');
      var newDate = picker.getDate();
      var dateSetAction = get(this, 'dateSetAction');
      set(this, 'currentDate', newDate);
      if (!isEmpty(dateSetAction)) {
        this.sendAction('dateSetAction', newDate);
      }
    },

    didInsertElement: function didInsertElement() {
      var _this = this;

      var currentDate = get(this, 'currentDate');
      var $input = this.$('input');
      $input.on('input', function () {
        if (isEmpty($input.val())) {
          set(_this, 'currentDate', null);
        }
      });
      var picker = null;
      var props = this.getProperties('format', 'yearRange', 'showTime');

      props.onSelect = this.dateSet.bind(this);

      if (!isEmpty(get(this, 'minDate'))) {
        props.minDate = get(this, 'minDate');
        if (props.minDate === 'now') {
          props.minDate = new Date();
        }
      }
      if (!isEmpty(get(this, 'maxDate'))) {
        props.maxDate = get(this, 'maxDate');
        if (props.maxDate === 'now') {
          props.maxDate = new Date();
        }
      }
      props.field = $input[0];
      picker = new Pikaday(props);
      _ember['default'].run.next(this, function () {
        picker.setDate(currentDate);
      });
      set(this, '_picker', picker);
    },

    willDestroyElement: function willDestroyElement() {
      var picker = get(this, '_picker');
      if (picker) {
        picker.destroy();
      }
      set(this, '_picker', null);
    }

  });
});
define('hospitalrun/mixins/pouch-find-indexes', ['exports', 'ember'], function (exports, _ember) {
  var Mixin = _ember['default'].Mixin;
  exports['default'] = Mixin.create({
    buildPouchFindIndexes: function buildPouchFindIndexes(db) {
      var indexesToBuild = [{
        name: 'inventory',
        fields: ['data.crossReference', 'data.description', 'data.friendlyId', 'data.name']
      }, {
        name: 'invoices',
        fields: ['data.externalInvoiceNumber', 'data.patientInfo']
      }, {
        name: 'patient',
        fields: ['data.externalPatientId', 'data.firstName', 'data.friendlyId', 'data.lastName', 'data.phone']
      }, {
        name: 'medication',
        fields: ['data.prescription']
      }, {
        name: 'pricing',
        fields: ['data.name']
      }];
      indexesToBuild.forEach(function (index) {
        db.createIndex({
          index: {
            fields: index.fields,
            name: index.name
          }
        });
      });
    }
  });
});
define('hospitalrun/mixins/pouchdb', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    maxValue: ''
  });
});
define('hospitalrun/mixins/progress-dialog', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    progressDialog: null,
    progressDialogDefaults: {
      showProgress: true,
      hideCancelButton: true,
      hideUpdateButton: true,
      progressBarValue: 0,
      progressBarStyle: 'width: 0%;'
    },
    progressInterval: 500,
    progressMessage: null,
    progressTimer: null,
    progressTitle: null,

    scheduleProgress: function scheduleProgress(f) {
      return _ember['default'].run.later(this, function () {
        f.apply(this);
        this.set('progressTimer', this.scheduleProgress(f));
      }, this.get('progressInterval'));
    },

    updateProgressBar: function updateProgressBar() {
      var progressDialog = this.get('progressDialog');
      var progressBarValue = progressDialog.get('progressBarValue');
      progressBarValue += 10;
      if (progressBarValue > 100) {
        progressBarValue = 0;
      }
      progressDialog.set('progressBarValue', progressBarValue);
      var progressBarStyle = _ember['default'].String.htmlSafe('width: ' + progressBarValue + '%');
      progressDialog.set('progressBarStyle', progressBarStyle);
    },

    closeProgressModal: function closeProgressModal() {
      _ember['default'].run.cancel(this.get('progressTimer'));
      this.send('closeModal');
    },

    showProgressModal: function showProgressModal() {
      var progressDialog = _ember['default'].Object.create(this.get('progressDialogDefaults'));
      progressDialog.progressBarStyle = _ember['default'].String.htmlSafe(progressDialog.progressBarStyle);
      progressDialog.set('title', this.get('progressTitle'));
      progressDialog.set('message', this.get('progressMessage'));
      this.set('progressDialog', progressDialog);
      this.set('progressTimer', this.scheduleProgress(this.get('updateProgressBar')));
      this.send('openModal', 'dialog', progressDialog);
    }
  });
});
define('hospitalrun/mixins/publish-statuses', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    publishStatuses: ['Draft', 'Published', 'Private', 'Archived']
  });
});
define('hospitalrun/mixins/result-validation', ['exports', 'ember', 'ember-i18n'], function (exports, _ember, _emberI18n) {
  exports['default'] = _ember['default'].Mixin.create({
    validations: {
      result: {
        acceptance: {
          accept: true,
          'if': function _if(object) {
            if (!object.get('hasDirtyAttributes')) {
              return false;
            }
            var status = object.get('status');
            var result = object.get('result');
            if (status === 'Completed' && _ember['default'].isEmpty(result)) {
              // force validation to fail
              return true;
            }
            return false;
          },
          message: (0, _emberI18n.translationMacro)('errors.result')
        }
      }
    }
  });
});
define('hospitalrun/mixins/return-to', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    cancelAction: (function () {
      var returnTo = this.get('model.returnTo');
      if (_ember['default'].isEmpty(returnTo)) {
        return 'allItems';
      } else {
        return 'returnTo';
      }
    }).property('returnTo')
  });
});
define('hospitalrun/mixins/setup-user-role', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    setupUserRole: function setupUserRole() {
      var session = this.get('session');
      var userRole = session.get('data.authenticated.role');
      return this.get('store').find('user-role', userRole.dasherize()).then(function (userCaps) {
        session.set('data.authenticated.userCaps', userCaps.get('capabilities'));
        var sessionStore = session.get('store');
        var sessionData = session.get('data');
        sessionStore.persist(sessionData);
        return true;
      })['catch'](_ember['default'].K);
    }
  });
});
define('hospitalrun/mixins/typeahead', ['exports', 'ember-data', 'ember'], function (exports, _emberData, _ember) {
  function _instanceof(left, right) { if (right != null && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } }

  var computed = _ember['default'].computed;
  var observer = _ember['default'].observer;
  exports['default'] = _ember['default'].Mixin.create({
    _mapContentItems: function _mapContentItems() {
      var _this = this;

      var content = this.get('content');
      if (content) {
        var mapped = content.filter(function (item) {
          return !_ember['default'].isEmpty(item);
        });
        if (_instanceof(content, _emberData['default'].RecordArray)) {
          mapped = mapped.map(function (item) {
            var returnObj = item.getProperties(_this.get('displayKey'));
            returnObj[_this.get('selectionKey')] = item;
            return returnObj;
          });
        } else {
          mapped = mapped.map(function (item) {
            var returnObj = {};
            returnObj[_this.get('displayKey')] = item;
            return returnObj;
          });
        }
        return mapped;
      } else {
        return [];
      }
    },

    mappedContent: computed('content', function () {
      return this._mapContentItems();
    }),

    contentChanged: observer('content.[]', function () {
      var bloodhound = this.get('bloodhound');
      if (bloodhound) {
        bloodhound.clear();
        bloodhound.add(this._mapContentItems());
      }
    }),

    bloodhound: null,
    displayKey: 'value',
    selectionKey: 'value',
    hint: true,
    highlight: true,
    lastHint: null,
    limit: 500,
    minlength: 1,
    selectedItem: false,
    inputElement: null,
    typeAhead: null,
    setOnBlur: true,
    templates: null,
    selectedAction: null,

    _getSource: function _getSource() {
      var typeAheadBloodhound = new Bloodhound({
        datumTokenizer: Bloodhound.tokenizers.obj.whitespace(this.get('displayKey')),
        queryTokenizer: Bloodhound.tokenizers.whitespace,
        local: this.get('mappedContent')
      });
      typeAheadBloodhound.initialize();
      this.set('bloodhound', typeAheadBloodhound);
      return typeAheadBloodhound.ttAdapter();
    },

    didInsertElement: function didInsertElement() {
      var _this2 = this;

      var $input = this.$('input');
      this.set('inputElement', $input);
      var $typeahead = $input.typeahead({
        autoselect: true,
        hint: this.get('hint'),
        highlight: this.get('highlight'),
        minLength: this.get('minlength')
      }, {
        displayKey: this.get('displayKey'),
        limit: this.get('limit'),
        source: this._getSource(),
        templates: this.get('templates')
      });
      this.set('typeAhead', $typeahead);

      $typeahead.on('typeahead:selected', function (event, item) {
        _this2.itemSelected(item[_this2.get('selectionKey')]);
      });

      $typeahead.on('typeahead:autocompleted', function (event, item) {
        _this2.itemSelected(item[_this2.get('selectionKey')]);
      });

      if (this.get('setOnBlur')) {
        $input.on('keyup', function () {
          var $hint = _this2.$('.tt-hint');
          var hintValue = $hint.val();
          _this2.set('lastHint', hintValue);
          _this2.set('selectedItem', false);
        });

        $input.on('blur', function (event) {
          var selection = _this2.get('selection');
          var targetValue = event.target.value.trim();
          if (!_ember['default'].isEmpty(selection)) {
            if (selection.trim) {
              selection = selection.trim();
            }
            _this2.set('selection', selection);
          }
          if (!_this2.get('selectedItem')) {
            (function () {
              var lastHint = _this2.get('lastHint');
              var exactMatch = false;
              if (_ember['default'].isEmpty(lastHint)) {
                lastHint = targetValue;
                exactMatch = true;
              }
              if (!_ember['default'].isEmpty(targetValue) && !_ember['default'].isEmpty(lastHint)) {
                _this2.get('bloodhound').search(lastHint, function (suggestions) {
                  if (suggestions.length > 0) {
                    if (!exactMatch || lastHint.toLowerCase() === suggestions[0][_this2.get('displayKey')].toLowerCase()) {
                      _this2.itemSelected(suggestions[0][_this2.get('selectionKey')]);
                      event.target.value = suggestions[0][_this2.get('displayKey')];
                      _this2.get('model').set(_this2.get('propertyName'), event.target.value);
                    }
                  } else if (targetValue !== selection) {
                    _this2.itemSelected();
                  }
                });
              } else if (_ember['default'].isEmpty(targetValue)) {
                _this2.itemSelected();
              }
            })();
          }
        });
      }
    },

    itemSelected: function itemSelected(itemSelection) {
      this.set('selection', itemSelection);
      this.set('selectedItem', true);
      var selectedAction = this.get('selectedAction');
      if (!_ember['default'].isEmpty(selectedAction)) {
        this.sendAction('selectedAction', itemSelection);
      }
    },

    willDestroyElement: function willDestroyElement() {
      this.get('inputElement').typeahead('destroy');
    }

  });
});
define('hospitalrun/mixins/unit-types', ['exports', 'ember', 'hospitalrun/utils/select-values'], function (exports, _ember, _hospitalrunUtilsSelectValues) {
  exports['default'] = _ember['default'].Mixin.create({
    defaultUnitList: ['ampoule', 'bag', 'bottle', 'box', 'bundle', 'capsule', 'case', 'container', 'cream', 'each', 'gel', 'nebule', 'ointment', 'pack', 'pair', 'pallet', 'patch', 'pcs', 'pill', 'plastic', 'polyamp', 'roll', 'spray', 'suppository', 'suspension', 'set', 'syrup', 'tablet', 'tray', 'tube', 'vial'],

    unitList: (function () {
      var defaultUnitList = this.get('defaultUnitList');
      var inventoryUnitList = this.get('inventoryUnitList');
      if (_ember['default'].isEmpty(inventoryUnitList)) {
        return defaultUnitList;
      } else {
        return inventoryUnitList;
      }
    }).property('inventoryUnitList', 'defaultUnitList'),

    unitListForSelect: _ember['default'].computed.map('unitList', _hospitalrunUtilsSelectValues['default'].selectValuesMap)
  });
});
define('hospitalrun/mixins/user-roles', ['exports', 'ember'], function (exports, _ember) {
  var PREDEFINED_USER_ROLES = [{ name: 'Data Entry', roles: ['Data Entry', 'user'], defaultRoute: 'patients.index' }, { name: 'Doctor', roles: ['Doctor', 'user'], defaultRoute: 'patients.index' }, { name: 'Finance', roles: ['Finance', 'user'], defaultRoute: 'invoices.index' }, { name: 'Finance Manager', roles: ['Finance Manager', 'user'], defaultRoute: 'invoices.index' }, { name: 'Hospital Administrator', roles: ['Hospital Administrator', 'user'], defaultRoute: 'invoices.index' }, { name: 'Inventory Manager', roles: ['Inventory Manager', 'user'], defaultRoute: 'inventory.index' }, { name: 'Imaging Technician', roles: ['Imaging Technician', 'user'], defaultRoute: 'imaging.index' }, { name: 'Lab Technician', roles: ['Lab Technician', 'user'], defaultRoute: 'labs.index' }, { name: 'Medical Records Officer', roles: ['Medical Records Officer', 'user'], defaultRoute: 'patients.index' }, { name: 'Nurse', roles: ['Nurse', 'user'], defaultRoute: 'patients.index' }, { name: 'Nurse Manager', roles: ['Nurse Manager', 'user'], defaultRoute: 'patients.index' }, { name: 'Patient Administration', roles: ['Patient Administration', 'user'], defaultRoute: 'patients.index' }, { name: 'Pharmacist', roles: ['Pharmacist', 'user'], defaultRoute: 'medication.index' }, { name: 'Social Worker', roles: ['Social Worker', 'user'], defaultRoute: 'patients.index' }, { name: 'System Administrator', roles: ['System Administrator', 'admin', 'user'] }, { name: 'User Administrator', roles: ['User Administrator', 'admin', 'user'], defaultRoute: 'users' }, { name: 'Cashier', roles: ['Cashier', 'user'], defaultRoute: 'invoices.index' }];

  exports.PREDEFINED_USER_ROLES = PREDEFINED_USER_ROLES;
  exports['default'] = _ember['default'].Mixin.create({
    userRoles: PREDEFINED_USER_ROLES,

    findUserRole: function findUserRole(name) {
      return this.userRoles.findBy('name', name);
    }
  });
});
define('hospitalrun/mixins/user-session', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Mixin.create({
    session: _ember['default'].inject.service(),
    defaultCapabilities: {
      admin: ['User Administrator', 'System Administrator', 'Quality'],
      add_allergy: ['Data Entry', 'Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Patient Administration', 'System Administrator'],
      appointments: ['Data Entry', 'Finance', 'Hospital Administrator', 'Medical Records Officer', 'Patient Administration', 'Social Worker', 'System Administrator', 'Cashier'],
      add_appointment: ['Data Entry', 'Finance', 'Hospital Administrator', 'Medical Records Officer', 'Patient Administration', 'Social Worker', 'System Administrator', 'Cashier'],
      add_charge: ['Data Entry', 'Hospital Administrator', 'Medical Records Officer', 'System Administrator'],
      add_billing_diagnosis: ['Data Entry', 'Hospital Administrator', 'Medical Records Officer', 'System Administrator'],
      add_diagnosis: ['Data Entry', 'Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Patient Administration', 'System Administrator'],
      add_medication: ['Data Entry', 'Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Pharmacist', 'System Administrator'],
      add_operative_plan: ['Data Entry', 'Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Patient Administration', 'System Administrator'],
      add_operation_report: ['Data Entry', 'Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Patient Administration', 'System Administrator'],
      add_photo: ['Data Entry', 'Hospital Administrator', 'Medical Records Officer', 'Patient Administration', 'Social Worker', 'System Administrator'],
      add_patient: ['Data Entry', 'Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Patient Administration', 'Social Worker', 'System Administrator'],
      add_pricing: ['Data Entry', 'Finance', 'Hospital Administrator', 'Medical Records Officer', 'System Administrator'],
      add_pricing_profile: ['Data Entry', 'Finance', 'Hospital Administrator', 'Medical Records Officer', 'System Administrator'],
      add_lab: ['Data Entry', 'Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Lab Technician', 'System Administrator'],
      add_imaging: ['Data Entry', 'Doctor', 'Hospital Administrator', 'Imaging Technician', 'Medical Records Officer', 'System Administrator'],
      add_inventory_request: ['Data Entry', 'Hospital Administrator', 'Inventory Manager', 'Medical Records Officer', 'Nurse Manager', 'Pharmacist', 'System Administrator'],
      add_inventory_item: ['Data Entry', 'Hospital Administrator', 'Inventory Manager', 'Medical Records Officer', 'System Administrator'],
      add_inventory_purchase: ['Data Entry', 'Hospital Administrator', 'Inventory Manager', 'Medical Records Officer', 'System Administrator'],
      add_invoice: ['Data Entry', 'Hospital Administrator', 'Medical Records Officer', 'System Administrator', 'Cashier'],
      add_payment: ['Hospital Administrator', 'Medical Records Officer', 'System Administrator', 'Cashier'],
      add_procedure: ['Data Entry', 'Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Nurse', 'Nurse Manager', 'Patient Administration', 'System Administrator'],
      add_socialwork: ['Hospital Administrator', 'Medical Records Officer', 'Social Worker', 'System Administrator'],
      add_user: ['User Administrator', 'System Administrator'],
      add_visit: ['Data Entry', 'Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Nurse', 'Nurse Manager', 'Patient Administration', 'Social Worker', 'System Administrator'],
      add_vitals: ['Data Entry', 'Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Nurse', 'Nurse Manager', 'System Administrator'],
      add_report: ['Data Entry', 'Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Nurse', 'Nurse Manager', 'System Administrator'],
      admit_patient: ['Data Entry', 'Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Nurse', 'Nurse Manager', 'Patient Administration', 'Social Worker', 'System Administrator'],
      adjust_inventory_location: ['Hospital Administrator', 'Inventory Manager', 'Medical Records Officer', 'System Administrator'],
      billing: ['Hospital Administrator', 'Finance', 'Finance Manager', 'System Administrator', 'Cashier'],
      cashier: ['Cashier', 'System Administrator'],
      complete_imaging: ['Imaging Technician', 'Medical Records Officer', 'System Administrator'],
      complete_lab: ['Lab Technician', 'Medical Records Officer', 'System Administrator'],
      delete_appointment: ['Hospital Administrator', 'Medical Records Officer', 'Patient Administration', 'Social Worker', 'System Administrator'],
      delete_diagnosis: ['Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Patient Administration', 'System Administrator'],
      delete_inventory_item: ['Hospital Administrator', 'Inventory Manager', 'Medical Records Officer', 'System Administrator'],
      delete_imaging: ['Doctor', 'Hospital Administrator', 'Medical Records Officer', 'System Administrator'],
      delete_invoice: ['Hospital Administrator', 'System Administrator'],
      delete_lab: ['Doctor', 'Hospital Administrator', 'Medical Records Officer', 'System Administrator'],
      delete_medication: ['Doctor', 'Hospital Administrator', 'Medical Records Officer', 'System Administrator'],
      delete_photo: ['Data Entry', 'Hospital Administrator', 'Medical Records Officer', 'Patient Administration', 'Social Worker', 'System Administrator'],
      delete_patient: ['Hospital Administrator', 'Medical Records Officer', 'Patient Administration', 'System Administrator'],
      delete_pricing: ['Finance', 'Data Entry', 'Hospital Administrator', 'Medical Records Officer', 'System Administrator'],
      delete_pricing_profile: ['Finance', 'Data Entry', 'Hospital Administrator', 'Medical Records Officer', 'System Administrator'],
      delete_procedure: ['Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Nurse', 'Nurse Manager', 'Patient Administration', 'System Administrator'],
      delete_socialwork: ['Hospital Administrator', 'Medical Records Officer', 'Social Worker', 'System Administrator'],
      delete_vitals: ['Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Nurse', 'Nurse Manager', 'System Administrator'],
      delete_report: ['Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Nurse', 'Nurse Manager', 'System Administrator'],
      delete_visit: ['Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Nurse', 'Nurse Manager', 'Patient Administration', 'Social Worker', 'System Administrator'],
      delete_user: ['User Administrator', 'System Administrator'],
      discharge_patient: ['Data Entry', 'Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Nurse', 'Nurse Manager', 'Patient Administration', 'Social Worker', 'System Administrator'],
      edit_invoice: ['Data Entry', 'Hospital Administrator', 'Medical Records Officer', 'System Administrator'],
      fulfill_inventory: ['Hospital Administrator', 'Inventory Manager', 'Medical Records Officer', 'Pharmacist', 'System Administrator'],
      fulfill_medication: ['Medical Records Officer', 'Pharmacist', 'System Administrator'],
      imaging: ['Data Entry', 'Doctor', 'Hospital Administrator', 'Imaging Technician', 'Medical Records Officer', 'System Administrator'],
      invoices: ['Hospital Administrator', 'Finance', 'Finance Manager', 'System Administrator', 'Cashier'],
      labs: ['Data Entry', 'Doctor', 'Hospital Administrator', 'Lab Technician', 'Medical Records Officer', 'System Administrator'],
      list_paid_invoices: ['Data Entry', 'Hospital Administrator', 'Medical Records Officer', 'System Administrator'],
      medication: ['Data Entry', 'Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Pharmacist', 'System Administrator'],
      inventory: ['Data Entry', 'Hospital Administrator', 'Inventory Manager', 'Medical Records Officer', 'Nurse Manager', 'Pharmacist', 'System Administrator'],
      load_db: ['System Administrator'],
      override_invoice: ['Hospital Administrator', 'System Administrator', 'Cashier'],
      query_db: ['System Administrator'],
      patients: ['Data Entry', 'Doctor', 'Finance', 'Finance Manager', 'Hospital Administrator', 'Imaging Technician', 'Lab Technician', 'Medical Records Officer', 'Nurse', 'Nurse Manager', 'Patient Administration', 'Social Worker', 'System Administrator'],

      patient_reports: ['Hospital Administrator', 'Patient Administration', 'System Administrator'],

      pricing: ['Data Entry', 'Finance', 'Hospital Administrator', 'Medical Records Officer', 'System Administrator'],
      visits: ['Data Entry', 'Doctor', 'Hospital Administrator', 'Medical Records Officer', 'Nurse Manager', 'Nurse', 'Patient Administration', 'Social Worker', 'System Administrator'],
      incident: ['Hospital Staff', 'User Administrator', 'Quality', 'System Administrator'],
      add_incident: ['Hospital Staff', 'User Administrator', 'Quality', 'System Administrator'],
      delete_incident: ['Quality', 'System Administrator'],
      generate_incident_report: ['User Administrator', 'Quality', 'System Administrator'],
      add_incident_category: ['User Administrator', 'Quality', 'System Administrator'],
      delete_incident_category: ['Quality', 'System Administrator'],
      manage_incidents: ['Quality', 'System Administrator'],
      update_config: ['System Administrator'],
      users: ['User Administrator', 'System Administrator', 'Quality'],
      add_note: ['Doctor', 'Medical Records Officer', 'Nurse', 'Nurse Manager', 'Patient Administration', 'System Administrator'],
      delete_note: ['Medical Records Officer', 'Nurse Manager', 'Patient Administration', 'System Administrator'],
      'define_user_roles': ['System Administrator']
    },

    _getUserSessionVars: function _getUserSessionVars() {
      var session = this.get('session');
      if (!_ember['default'].isEmpty(session) && session.get('isAuthenticated')) {
        return session.get('data.authenticated');
      }
    },

    currentUserCan: function currentUserCan(capability) {
      var sessionVars = this._getUserSessionVars();
      if (!_ember['default'].isEmpty(sessionVars) && !_ember['default'].isEmpty(sessionVars.role)) {
        var userCaps = this.get('session').get('data.authenticated.userCaps');
        if (_ember['default'].isEmpty(userCaps)) {
          var capabilities = this.get('defaultCapabilities');
          var supportedRoles = capabilities[capability];
          if (!_ember['default'].isEmpty(supportedRoles)) {
            return supportedRoles.includes(sessionVars.role);
          }
        } else {
          return userCaps.includes(capability.camelize()); // User defined capabilities are camelcased.
        }
      }
      return false;
    },

    /**
     * Returns the display name of the user or the username if
     * the display name is not set or if the username is explictly requested.
     * @param {boolean} returnUserName if true, always return the username instead
     * of the display name even if the display name is set.
     */
    getUserName: function getUserName(returnUserName) {
      var returnName = undefined;
      var sessionVars = this._getUserSessionVars();
      if (!_ember['default'].isEmpty(sessionVars)) {
        if (returnUserName) {
          returnName = sessionVars.name;
        } else if (!_ember['default'].isEmpty(sessionVars.displayName)) {
          returnName = sessionVars.displayName;
        } else if (!_ember['default'].isEmpty(sessionVars.name)) {
          returnName = sessionVars.name;
        }
      }
      return returnName;
    }
  });
});
define('hospitalrun/mixins/visit-types', ['exports', 'ember', 'hospitalrun/utils/select-values'], function (exports, _ember, _hospitalrunUtilsSelectValues) {
  exports['default'] = _ember['default'].Mixin.create({
    defaultVisitTypes: ['Admission', 'Clinic', 'Followup', 'Imaging', 'Lab', 'Pharmacy'],

    _getVisitTypes: function _getVisitTypes(includeEmpty) {
      var defaultVisitTypes = this.get('defaultVisitTypes');
      var visitTypesList = this.get('visitTypesList');
      var visitList = undefined;
      if (_ember['default'].isEmpty(visitTypesList)) {
        visitList = defaultVisitTypes;
      } else {
        visitList = visitTypesList.get('value');
      }
      visitList = _hospitalrunUtilsSelectValues['default'].selectValues(visitList, includeEmpty);
      return visitList;
    },

    visitTypes: (function () {
      return this._getVisitTypes();
    }).property('visitTypesList', 'defaultVisitTypes').volatile(),

    visitTypesWithEmpty: (function () {
      return this._getVisitTypes(true);
    }).property('visitTypesList', 'defaultVisitTypes').volatile()
  });
});
define('hospitalrun/models/abstract', ['exports', 'ember-data', 'ember', 'ember-validations', 'ember-pouch', 'hospitalrun/mixins/user-session'], function (exports, _emberData, _ember, _emberValidations, _emberPouch, _hospitalrunMixinsUserSession) {
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _emberPouch.Model.extend(_hospitalrunMixinsUserSession['default'], _emberValidations['default'], {
    session: inject.service(),
    archived: _emberData['default'].attr('boolean', { defaultValue: false }),
    lastModified: _emberData['default'].attr('date'),
    modifiedBy: _emberData['default'].attr(),
    modifiedFields: _emberData['default'].attr(),

    loadedCustomForms: null,

    didLoad: function didLoad() {
      var loadedCustomForms = this.get('customForms');
      if (!isEmpty(loadedCustomForms)) {
        loadedCustomForms = JSON.parse(JSON.stringify(loadedCustomForms));
      }
      this.set('loadedCustomForms', loadedCustomForms);
    },

    changedAttributes: function changedAttributes() {
      var changedAttributes = this._super();
      var currentCustomForms = this.get('customForms');
      var loadedCustomForms = this.get('loadedCustomForms');
      if (!isEmpty(currentCustomForms)) {
        if (isEmpty(loadedCustomForms)) {
          loadedCustomForms = {};
        }
        var newKeys = Object.keys(currentCustomForms);
        newKeys.forEach(function (customFormId) {
          var oldCustomForm = loadedCustomForms[customFormId];
          var customFormPrefix = 'customForms.' + customFormId;
          if (isEmpty(oldCustomForm)) {
            oldCustomForm = {};
          }
          var newForm = get(currentCustomForms, customFormId);
          var newFormKeys = Object.keys(newForm);
          newFormKeys.forEach(function (newFormProperty) {
            var oldValue = get(oldCustomForm, newFormProperty);
            var newValue = get(newForm, newFormProperty);
            if (oldValue != newValue) {
              changedAttributes[customFormPrefix + '.' + newFormProperty] = [oldValue, newValue];
            }
          });
        });
      }
      return changedAttributes;
    },

    /**
    * Before saving the record, update the modifiedFields attribute to denote what fields were changed when.
    * Also, if the save failed because of a conflict, reload the record and reapply the changed attributes and
    * attempt to save again.
    */
    save: function save(options) {
      var attribute = undefined;
      var changedAttributes = this.changedAttributes();
      var modifiedDate = new Date();
      var modifiedFields = this.get('modifiedFields');
      var session = this.get('session');

      if (!session || !session.get('isAuthenticated')) {
        return new _ember['default'].RSVP.Promise(function (resolve, reject) {
          _ember['default'].run(null, reject, 'ERROR you must be logged in to save');
        });
      }

      if (this.get('hasDirtyAttributes') && !this.get('isDeleted')) {
        if (isEmpty(modifiedFields)) {
          modifiedFields = {};
        }
        this.set('lastModified', modifiedDate);
        for (attribute in changedAttributes) {
          modifiedFields[attribute] = modifiedDate;
        }
        this.set('modifiedFields', modifiedFields);
        this.set('modifiedBy', this.getUserName());
      }
      return this._super(options)['catch']((function (error) {
        if (!isEmpty(options) && options.retry) {
          throw error;
        } else {
          if (error.name && error.name.indexOf && error.name.indexOf('conflict') > -1) {
            // Conflict encountered, so rollback, reload and then save the record with the changed attributes.
            this.rollbackAttributes();
            return this.reload().then(function (record) {
              for (var _attribute in changedAttributes) {
                record.set(_attribute, changedAttributes[_attribute][1]);
              }
              if (_ember['default'].isEmpty(options)) {
                options = {};
              }
              options.retry = true;
              return record.save(options);
            });
          } else {
            throw error;
          }
        }
      }).bind(this));
    }
  });
});
define('hospitalrun/models/add-diagnosis', ['exports', 'ember-data', 'ember-validations', 'ember-pouch'], function (exports, _emberData, _emberValidations, _emberPouch) {
  exports['default'] = _emberPouch.Model.extend(_emberValidations['default'], {
    diagnosis: _emberData['default'].attr('string'),
    validations: {
      diagnosis: {
        presence: true
      }
    }
  });
});
/**
 * Stub model for adding new patient diagnoses; needed for validation.
 */
define('hospitalrun/models/allergy', ['exports', 'hospitalrun/models/abstract', 'ember-data'], function (exports, _hospitalrunModelsAbstract, _emberData) {
  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    // Attributes
    name: _emberData['default'].attr('string'),
    icd9CMCode: _emberData['default'].attr('string'),
    icd10Code: _emberData['default'].attr('string'),
    // Associations
    patient: _emberData['default'].belongsTo('patient'),

    validations: {
      name: {
        presence: true
      }
    }
  });
});
define('hospitalrun/models/appointment', ['exports', 'hospitalrun/models/abstract', 'ember-data', 'ember', 'moment', 'hospitalrun/utils/patient-validation'], function (exports, _hospitalrunModelsAbstract, _emberData, _ember, _moment, _hospitalrunUtilsPatientValidation) {
  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    // Attributes
    allDay: _emberData['default'].attr(),
    provider: _emberData['default'].attr('string'),
    location: _emberData['default'].attr('string'),
    appointmentType: _emberData['default'].attr('string'),
    startDate: _emberData['default'].attr('date'),
    endDate: _emberData['default'].attr('date'),
    notes: _emberData['default'].attr('string'),
    status: _emberData['default'].attr('string', { defaultValue: 'Scheduled' }),

    // Associations
    patient: _emberData['default'].belongsTo('patient', { async: false }),
    visits: _emberData['default'].hasMany('visit'),

    // Formats
    longDateFormat: 'l h:mm A',
    shortDateFormat: 'l',
    timeFormat: 'h:mm A',

    _getDateSpan: function _getDateSpan(startDate, endDate, format) {
      var formattedStart = startDate.format(format);
      var formattedEnd = endDate.format(format);
      return formattedStart + ' - ' + formattedEnd;
    },

    appointmentDate: (function () {
      var startDate = this.get('startDate');
      return startDate;
    }).property('startDate'),

    displayStatus: (function () {
      var status = this.get('status');
      if (_ember['default'].isEmpty(status)) {
        status = 'Scheduled';
      }
      return status;
    }).property('status'),

    formattedAppointmentDate: (function () {
      var allDay = this.get('allDay');
      var endDate = (0, _moment['default'])(this.get('endDate'));
      var dateFormat = '';
      var formattedDate = '';
      var startDate = (0, _moment['default'])(this.get('startDate'));

      if (startDate.isSame(endDate, 'day')) {
        formattedDate = startDate.format(this.get('shortDateFormat'));
        if (!allDay) {
          formattedDate += ' ';
          formattedDate += this._getDateSpan(startDate, endDate, this.get('timeFormat'));
        }
      } else {
        if (allDay) {
          dateFormat = this.get('shortDateFormat');
        } else {
          dateFormat = this.get('longDateFormat');
        }
        formattedDate = this._getDateSpan(startDate, endDate, dateFormat);
      }
      return formattedDate;
    }).property('startDate', 'endDate'),

    validations: {
      appointmentDate: {
        presence: {
          'if': function _if(object) {
            var appointmentType = object.get('appointmentType');
            return appointmentType !== 'Admission';
          }
        }
      },

      patientTypeAhead: _hospitalrunUtilsPatientValidation['default'].patientTypeAhead,

      patient: {
        presence: true
      },
      appointmentType: {
        presence: true
      },
      startDate: {
        presence: true
      },
      endDate: {
        acceptance: {
          accept: true,
          'if': function _if(object) {
            if (!object.get('hasDirtyAttributes')) {
              return false;
            }
            var allDay = object.get('allDay');
            var startDate = object.get('startDate');
            var endDate = object.get('endDate');
            if (_ember['default'].isEmpty(endDate) || _ember['default'].isEmpty(startDate)) {
              // force validation to fail
              return true;
            } else {
              if (allDay) {
                if (endDate.getTime() < startDate.getTime()) {
                  return true;
                }
              } else {
                if (endDate.getTime() <= startDate.getTime()) {
                  return true;
                }
              }
            }
            // patient is properly selected; don't do any further validation
            return false;
          },
          message: 'Please select an end date later than the start date'
        }
      }
    }
  });
});
define('hospitalrun/models/attachment', ['exports', 'hospitalrun/models/photo', 'ember-data'], function (exports, _hospitalrunModelsPhoto, _emberData) {
  var attr = _emberData['default'].attr;
  exports['default'] = _hospitalrunModelsPhoto['default'].extend({
    addedBy: attr('string'),
    addedByDisplayName: attr('string'),
    dateAdded: attr('date'),
    title: attr('string')
  });
});
define('hospitalrun/models/billing-line-item', ['exports', 'hospitalrun/models/abstract', 'ember-data', 'ember', 'hospitalrun/mixins/number-format'], function (exports, _hospitalrunModelsAbstract, _emberData, _ember, _hospitalrunMixinsNumberFormat) {
  exports['default'] = _hospitalrunModelsAbstract['default'].extend(_hospitalrunMixinsNumberFormat['default'], {
    // Attributes
    amountOwed: _emberData['default'].attr('number'),
    category: _emberData['default'].attr('string'),
    description: _emberData['default'].attr('string'),
    discount: _emberData['default'].attr('number'),
    name: _emberData['default'].attr('string'),
    nationalInsurance: _emberData['default'].attr('number'),
    privateInsurance: _emberData['default'].attr('number'),
    // Associations
    /* The individual objects that make up this line item. */
    details: _emberData['default'].hasMany('line-item-detail', { async: false }),

    amountOwedChanged: (function () {
      _ember['default'].run.debounce(this, function () {
        var discount = this._getValidNumber(this.get('discount'));
        var nationalInsurance = this._getValidNumber(this.get('nationalInsurance'));
        var privateInsurance = this._getValidNumber(this.get('privateInsurance'));
        var amountOwed = this._getValidNumber(this.get('total'));
        amountOwed = amountOwed - discount - nationalInsurance - privateInsurance;
        if (amountOwed < 0) {
          amountOwed = 0;
        }
        if (!this.get('isDestroyed')) {
          this.set('amountOwed', this._numberFormat(amountOwed, true));
        }
      }, 500);
    }).observes('discount', 'nationalInsurance', 'privateInsurance', 'total'),

    detailTotals: _ember['default'].computed.mapBy('details', 'amountOwed'),
    total: _ember['default'].computed.sum('detailTotals'),

    validations: {
      category: {
        presence: true
      },
      discount: {
        numericality: {
          allowBlank: true
        }
      },
      nationalInsurance: {
        numericality: {
          allowBlank: true
        }
      },
      name: {
        presence: true
      },
      privateInsurance: {
        numericality: {
          allowBlank: true
        }
      },
      total: {
        numericality: {
          allowBlank: true
        }
      }
    }
  });
});
define('hospitalrun/models/custom-field', ['exports', 'ember-validations', 'ember-data'], function (exports, _emberValidations, _emberData) {
  exports['default'] = _emberData['default'].Model.extend(_emberValidations['default'], {
    checkboxes: _emberData['default'].attr(),
    classNames: _emberData['default'].attr('string'),
    colSpan: _emberData['default'].attr('number'),
    includeOtherOption: _emberData['default'].attr('boolean'),
    label: _emberData['default'].attr('string'),
    otherOptionLabel: _emberData['default'].attr('string'),
    prompt: _emberData['default'].attr('string'),
    property: _emberData['default'].attr('string'),
    type: _emberData['default'].attr('string'),
    values: _emberData['default'].attr('string'),
    validations: {
      colSpan: {
        numericality: {
          allowBlank: true,
          onlyInteger: true
        }
      },
      label: {
        presence: true
      },
      type: {
        presence: true
      }
    }
  });
});
define('hospitalrun/models/custom-form', ['exports', 'hospitalrun/models/abstract', 'ember-data'], function (exports, _hospitalrunModelsAbstract, _emberData) {

  function defaultFields() {
    return [];
  }

  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    alwaysInclude: _emberData['default'].attr('boolean'),
    columns: _emberData['default'].attr('number', { defaultValue: 1 }),
    fields: _emberData['default'].attr('custom-fields', { defaultValue: defaultFields }),
    formType: _emberData['default'].attr('string'),
    name: _emberData['default'].attr('string'),

    validations: {
      formType: {
        presence: true
      },
      name: {
        presence: true
      },
      columns: {
        numericality: {
          allowBlank: true,
          onlyInteger: true,
          lessThanOrEqualTo: 12
        }
      }
    }
  });
});
define('hospitalrun/models/diagnosis', ['exports', 'hospitalrun/models/abstract', 'ember-data'], function (exports, _hospitalrunModelsAbstract, _emberData) {
  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    // Attributes
    active: _emberData['default'].attr('boolean', { defaultValue: true }),
    date: _emberData['default'].attr('date'),
    diagnosis: _emberData['default'].attr('string'),
    secondaryDiagnosis: _emberData['default'].attr('boolean', { defaultValue: false }),

    validations: {
      date: {
        presence: true
      },
      diagnosis: {
        presence: true
      }
    }
  });
});
define('hospitalrun/models/family-info', ['exports', 'ember-data', 'ember-validations', 'ember-pouch'], function (exports, _emberData, _emberValidations, _emberPouch) {
  exports['default'] = _emberPouch.Model.extend(_emberValidations['default'], {
    age: _emberData['default'].attr('number'),
    civilStatus: _emberData['default'].attr('string'),
    education: _emberData['default'].attr('string'),
    income: _emberData['default'].attr('string'),
    insurance: _emberData['default'].attr('string'),
    name: _emberData['default'].attr('string'),
    occupation: _emberData['default'].attr('string'),
    relationship: _emberData['default'].attr('string'),
    validations: {
      age: {
        numericality: {
          allowBlank: true
        }
      },
      name: {
        presence: true
      }
    }
  });
});
/**
 * Model for social worker family info
 */
define('hospitalrun/models/imaging', ['exports', 'hospitalrun/models/abstract', 'hospitalrun/mixins/can-edit-requested', 'hospitalrun/mixins/date-format', 'ember-data', 'ember', 'hospitalrun/utils/patient-validation', 'hospitalrun/mixins/result-validation'], function (exports, _hospitalrunModelsAbstract, _hospitalrunMixinsCanEditRequested, _hospitalrunMixinsDateFormat, _emberData, _ember, _hospitalrunUtilsPatientValidation, _hospitalrunMixinsResultValidation) {
  var computed = _ember['default'].computed;
  exports['default'] = _hospitalrunModelsAbstract['default'].extend(_hospitalrunMixinsCanEditRequested['default'], _hospitalrunMixinsDateFormat['default'], _hospitalrunMixinsResultValidation['default'], {
    // Attributes
    imagingDate: _emberData['default'].attr('date'),
    notes: _emberData['default'].attr('string'),
    radiologist: _emberData['default'].attr('string'),
    requestedBy: _emberData['default'].attr('string'),
    requestedDate: _emberData['default'].attr('date'),
    result: _emberData['default'].attr('string'),
    status: _emberData['default'].attr('string'),

    // Associations
    charges: _emberData['default'].hasMany('proc-charge', { async: false }),
    imagingType: _emberData['default'].belongsTo('pricing', { async: false }),
    patient: _emberData['default'].belongsTo('patient', { async: false }),
    visit: _emberData['default'].belongsTo('visit', { async: false }),

    imagingDateAsTime: computed('imagingDate', function () {
      return this.dateToTime(this.get('imagingDate'));
    }),

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

    validations: {
      imagingTypeName: {
        presence: {
          'if': function _if(object) {
            if (object.get('isNew')) {
              return true;
            }
          },
          message: 'Please select an imaging type'
        }
      },
      patientTypeAhead: _hospitalrunUtilsPatientValidation['default'].patientTypeAhead,
      patient: {
        presence: true
      }
    }
  });
});
define('hospitalrun/models/inc-category', ['exports', 'hospitalrun/models/abstract', 'ember-data'], function (exports, _hospitalrunModelsAbstract, _emberData) {
  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    incidentCategoryName: _emberData['default'].attr('string'),
    incidentCategoryItems: _emberData['default'].attr()

  });
});
define('hospitalrun/models/incident-note', ['exports', 'hospitalrun/models/abstract', 'ember-data'], function (exports, _hospitalrunModelsAbstract, _emberData) {
  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    givenBy: _emberData['default'].attr('string'),
    givenByDisplayName: _emberData['default'].attr('string'),
    description: _emberData['default'].attr('string'),
    dateRecorded: _emberData['default'].attr('date')
  });
});
define('hospitalrun/models/incident', ['exports', 'hospitalrun/models/abstract', 'ember-data', 'ember', 'hospitalrun/mixins/incident-statuses', 'moment', 'ember-validations'], function (exports, _hospitalrunModelsAbstract, _emberData, _ember, _hospitalrunMixinsIncidentStatuses, _moment, _emberValidations) {
  var attr = _emberData['default'].attr;
  var belongsTo = _emberData['default'].belongsTo;
  var hasMany = _emberData['default'].hasMany;
  var computed = _ember['default'].computed;
  var _get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;
  var _set = _ember['default'].set;
  exports['default'] = _hospitalrunModelsAbstract['default'].extend(_hospitalrunMixinsIncidentStatuses['default'], {
    categoryItem: attr('string'),
    categoryName: attr('string'),
    customForms: _emberData['default'].attr('custom-forms'),
    dateOfIncident: attr('date'),
    department: attr('string'),
    description: attr('string'),
    friendlyId: attr('string'),
    modifiedByDisplayName: _emberData['default'].attr('string'),
    notificationSend: attr('boolean', { defaultValue: false }),
    reportedBy: attr('string'),
    reportedByDisplayName: attr('string'),
    reportedDate: attr('date'),
    reportedTo: attr('string'),
    sentinelEvent: attr('boolean'),
    status: attr('string', { defaultValue: _hospitalrunMixinsIncidentStatuses.REPORTED }),

    incidentAttachments: hasMany('attachment', { async: true }),
    notes: hasMany('incident-note', { async: true }),
    patient: belongsTo('patient', { async: false }),

    dateForFilter: computed('dateOfIncident', function () {
      var dateOfIncident = _get(this, 'dateOfIncident');
      return (0, _moment['default'])(dateOfIncident).startOf('day').toDate();
    }),

    localizedStatus: computed('status', function () {
      var status = _get(this, 'status');
      return this.getLocalizedStatus(status);
    }),

    patientTypeAhead: computed('patient', {
      get: function get() {
        var patient = _get(this, 'patient');
        if (!isEmpty(patient)) {
          return _get(patient, 'displayName') + ' - ' + _get(patient, 'displayPatientId');
        } else {
          return _get(this, 'typeAheadPatientName');
        }
      },
      set: function set(key, value) {
        _set(this, 'typeAheadPatientName', value);
        return value;
      }

    }),

    validations: {
      categoryName: {
        presence: true
      },
      dateOfIncident: {
        presence: true
      },
      department: {
        presence: true
      },
      description: {
        presence: true
      },
      patientTypeAhead: {
        inline: (0, _emberValidations.validator)(function () {
          var patientTypeAhead = _get(this, 'patientTypeAhead');
          var isValid = true;
          if (isEmpty(patientTypeAhead)) {
            return;
          }
          var patientName = _get(this, 'patient.displayName');
          if (isEmpty(patientName)) {
            isValid = false;
          } else {
            var typeAheadName = patientTypeAhead.substr(0, patientName.length).toLowerCase();
            if (patientName.toLowerCase().indexOf(typeAheadName) !== 0) {
              isValid = false;
            }
          }
          if (!isValid) {
            var i18n = _get(this, 'i18n');
            return i18n.t('incident.messages.selectExistingPatient').toString();
          }
        })
      }
    }
  });
});
define('hospitalrun/models/inv-location', ['exports', 'hospitalrun/models/abstract', 'ember-data', 'ember', 'hospitalrun/mixins/location-name'], function (exports, _hospitalrunModelsAbstract, _emberData, _ember, _hospitalrunMixinsLocationName) {
  /**
   * Model to represent the location(s) of inventory items.
   * File/model name is inv-location because using inv-location will cause location
   * items to be shown as inventory items since the pouchdb adapter does a
   * retrieve for keys starting with 'inventory' to fetch inventory items.
   */
  var InventoryLocation = _hospitalrunModelsAbstract['default'].extend(_hospitalrunMixinsLocationName['default'], {
    quantity: _emberData['default'].attr('number'),
    location: _emberData['default'].attr('string'),
    aisleLocation: _emberData['default'].attr('string'),
    i18n: _ember['default'].inject.service(),

    locationNameWithQuantity: (function () {
      var quantity = this.get('quantity');
      var locationName = this.get('locationName');
      return locationName + ' (' + this.get('i18n').t('inventory.labels.availableQuantity', { quantity: quantity }) + ')';
    }).property('locationName', 'quantity'),

    validations: {
      adjustmentQuantity: {
        numericality: {
          greaterThan: 0,
          messages: {
            greaterThan: 'must be greater than 0'
          }
        },
        acceptance: {
          /**
           * Validate that the adjustment quantity is a number and that if a deduction there are enough items to deduct
           */
          accept: true,
          'if': function _if(object) {
            var adjustmentQuantity = object.get('adjustmentQuantity');
            var transactionType = object.get('transactionType');
            var locationQuantity = object.get('quantity');
            if (_ember['default'].isEmpty(adjustmentQuantity) || isNaN(adjustmentQuantity)) {
              return true;
            }
            if (transactionType !== 'Adjustment (Add)' && adjustmentQuantity > locationQuantity) {
              return true;
            }
            return false;
          },
          message: 'Invalid quantity'
        }
      },

      dateCompleted: {
        presence: {
          message: 'Please provide a date'
        }
      },

      transferLocation: {
        acceptance: {
          accept: true,
          'if': function _if(object) {
            var transferLocation = object.get('transferLocation');
            var transferItem = object.get('transferItem');
            // If we don't have a transfer item, then a transfer is not occurring.
            if (!_ember['default'].isEmpty(transferItem) && _ember['default'].isEmpty(transferLocation)) {
              return true;
            }
            return false;
          },
          message: 'Please select a location to transfer to'
        }
      }
    }
  });

  exports['default'] = InventoryLocation;
});
define('hospitalrun/models/inv-purchase', ['exports', 'hospitalrun/models/abstract', 'ember-data', 'ember', 'hospitalrun/mixins/location-name', 'hospitalrun/mixins/number-format'], function (exports, _hospitalrunModelsAbstract, _emberData, _ember, _hospitalrunMixinsLocationName, _hospitalrunMixinsNumberFormat) {

  function defaultQuantityGroups() {
    return [];
  }

  /**
   * Model to represent a purchase within an inventory item.
   * File/model name is inv-purchase because using inventory-purchase will cause purchase
   * items to be shown as inventory items since the pouchdb adapter does a
   * retrieve for keys starting with 'inventory' to fetch inventory items.
   */
  var InventoryPurchaseItem = _hospitalrunModelsAbstract['default'].extend(_hospitalrunMixinsLocationName['default'], _hospitalrunMixinsNumberFormat['default'], {
    purchaseCost: _emberData['default'].attr('number'),
    lotNumber: _emberData['default'].attr('string'),
    dateReceived: _emberData['default'].attr('date'),
    costPerUnit: (function () {
      var purchaseCost = this.get('purchaseCost');
      var quantity = parseInt(this.get('originalQuantity'));
      if (_ember['default'].isEmpty(purchaseCost) || _ember['default'].isEmpty(quantity) || purchaseCost === 0 || quantity === 0) {
        return 0;
      }
      return this._numberFormat(purchaseCost / quantity, true);
    }).property('purchaseCost', 'originalQuantity'),
    originalQuantity: _emberData['default'].attr('number'),
    currentQuantity: _emberData['default'].attr('number'),
    expirationDate: _emberData['default'].attr('date'),
    expired: _emberData['default'].attr('boolean'),
    location: _emberData['default'].attr('string'),
    aisleLocation: _emberData['default'].attr('string'),
    giftInKind: _emberData['default'].attr('boolean'),
    inventoryItem: _emberData['default'].attr('string'), // Currently just storing id instead of DS.belongsTo('inventory', { async: true }),
    vendor: _emberData['default'].attr('string'),
    vendorItemNo: _emberData['default'].attr('string'),
    distributionUnit: _emberData['default'].attr('string'),
    invoiceNo: _emberData['default'].attr('string'),
    quantityGroups: _emberData['default'].attr({ defaultValue: defaultQuantityGroups }),
    validations: {
      purchaseCost: {
        numericality: true
      },
      originalQuantity: {
        numericality: {
          greaterThanOrEqualTo: 0
        }
      },
      vendor: {
        presence: true
      }
    }
  });

  exports['default'] = InventoryPurchaseItem;
});
define('hospitalrun/models/inv-request', ['exports', 'hospitalrun/models/abstract', 'hospitalrun/mixins/inventory-adjustment-types', 'ember-data', 'ember', 'hospitalrun/mixins/location-name'], function (exports, _hospitalrunModelsAbstract, _hospitalrunMixinsInventoryAdjustmentTypes, _emberData, _ember, _hospitalrunMixinsLocationName) {
  /**
   * Model to represent a request for inventory items.
   */
  var InventoryRequest = _hospitalrunModelsAbstract['default'].extend(_hospitalrunMixinsInventoryAdjustmentTypes['default'], _hospitalrunMixinsLocationName['default'], {
    adjustPurchases: _emberData['default'].attr('boolean'),
    completedBy: _emberData['default'].attr('string'),
    costPerUnit: _emberData['default'].attr('number'),
    dateCompleted: _emberData['default'].attr('date'),
    dateRequested: _emberData['default'].attr('date'),
    deliveryAisle: _emberData['default'].attr('string'),
    deliveryLocation: _emberData['default'].attr('string'),
    expenseAccount: _emberData['default'].attr('string'),
    inventoryItem: _emberData['default'].belongsTo('inventory', { async: true }),
    locationsAffected: _emberData['default'].attr(),
    markAsConsumed: _emberData['default'].attr('boolean', { defaultValue: true }),
    patient: _emberData['default'].belongsTo('patient', {
      async: false
    }),
    purchasesAffected: _emberData['default'].attr(),
    quantity: _emberData['default'].attr('number'),
    quantityAtCompletion: _emberData['default'].attr('number'),
    reason: _emberData['default'].attr('string'),
    requestedBy: _emberData['default'].attr('string'),
    status: _emberData['default'].attr('string'),
    transactionType: _emberData['default'].attr('string'),
    visit: _emberData['default'].belongsTo('visit', {
      async: false
    }),

    deliveryLocationName: (function () {
      var aisle = this.get('deliveryAisle');
      var location = this.get('deliveryLocation');
      return this.formatLocationName(location, aisle);
    }).property('deliveryAisle', 'deliveryLocation'),

    deliveryDetails: (function () {
      var locationName = this.get('deliveryLocationName');
      var patient = this.get('patient');
      if (_ember['default'].isEmpty(patient)) {
        return locationName;
      } else {
        return patient.get('displayName');
      }
    }).property('deliveryAisle', 'deliveryLocation', 'patient'),

    haveReason: (function () {
      return !_ember['default'].isEmpty(this.get('reason'));
    }).property('reason'),

    isAdjustment: (function () {
      var adjustmentTypes = this.get('adjustmentTypes');
      var transactionType = this.get('transactionType');
      var adjustmentType = adjustmentTypes.findBy('type', transactionType);
      return !_ember['default'].isEmpty(adjustmentType);
    }).property('transactionType'),

    isFulfillment: (function () {
      return this.get('transactionType') === 'Fulfillment';
    }).property('transactionType'),

    isTransfer: (function () {
      return this.get('transactionType') === 'Transfer';
    }).property('transactionType'),

    validations: {
      inventoryItemTypeAhead: {
        acceptance: {
          accept: true,
          'if': function _if(object) {
            if (!object.get('hasDirtyAttributes')) {
              return false;
            }
            var itemName = object.get('inventoryItem.name');
            var itemTypeAhead = object.get('inventoryItemTypeAhead');
            var requestedItems = object.get('requestedItems');
            var status = object.get('status');
            if (status === 'Requested') {
              // Requested items don't show the type ahead and therefore don't need validation.
              return false;
            }
            if (_ember['default'].isEmpty(itemName) || _ember['default'].isEmpty(itemTypeAhead)) {
              // force validation to fail if fields are empty and requested items are empty
              return _ember['default'].isEmpty(requestedItems);
            } else {
              var typeAheadName = itemTypeAhead.substr(0, itemName.length);
              if (itemName !== typeAheadName) {
                return true;
              }
            }
            // Inventory item is properly selected; don't do any further validation
            return false;
          },
          message: 'Please select a valid inventory item'
        }
      },
      quantity: {
        numericality: {
          greaterThan: 0,
          messages: {
            greaterThan: 'must be greater than 0'
          },
          'if': function _if(object) {
            var requestedItems = object.get('requestedItems');
            return _ember['default'].isEmpty(requestedItems);
          }
        },
        acceptance: {
          accept: true,
          'if': function _if(object) {
            var isNew = object.get('isNew');
            var requestQuantity = parseInt(object.get('quantity'));
            var transactionType = object.get('transactionType');
            var quantityToCompare = null;
            if (transactionType === 'Return') {
              // no validation needed for returns
              return false;
            } else if (isNew && transactionType === 'Request') {
              quantityToCompare = object.get('inventoryItem.quantity');
            } else {
              quantityToCompare = object.get('inventoryLocation.quantity');
            }
            if (requestQuantity > quantityToCompare) {
              // force validation to fail
              return true;
            } else {
              // Diagnosis is properly set; don't do any further validation
              return false;
            }
          },
          message: 'The quantity must be less than or equal to the number of available items.'
        }
      }
    }
  });

  exports['default'] = InventoryRequest;
});
define('hospitalrun/models/inventory-batch', ['exports', 'hospitalrun/models/abstract', 'ember'], function (exports, _hospitalrunModelsAbstract, _ember) {

  /**
   * Model to represent a request for inventory items.
   */
  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    haveInvoiceItems: function haveInvoiceItems() {
      var invoiceItems = this.get('invoiceItems');
      return !_ember['default'].isEmpty(invoiceItems);
    },

    validations: {
      dateReceived: {
        presence: true
      },
      inventoryItemTypeAhead: {
        presence: {
          unless: function unless(object) {
            return object.haveInvoiceItems();
          }
        }
      },
      purchaseCost: {
        numericality: {
          greaterThan: 0,
          messages: {
            greaterThan: 'must be greater than 0'
          },
          unless: function unless(object) {
            return object.haveInvoiceItems();
          }
        }
      },
      quantity: {
        numericality: {
          greaterThan: 0,
          messages: {
            greaterThan: 'must be greater than 0'
          },
          unless: function unless(object) {
            return object.haveInvoiceItems();
          }
        }
      },
      vendor: {
        presence: true
      }
    }
  });
});
define('hospitalrun/models/inventory', ['exports', 'hospitalrun/models/abstract', 'ember-data', 'ember', 'ember-computed', 'hospitalrun/mixins/location-name', 'hospitalrun/utils/item-condition'], function (exports, _hospitalrunModelsAbstract, _emberData, _ember, _emberComputed, _hospitalrunMixinsLocationName, _hospitalrunUtilsItemCondition) {
  var get = _ember['default'].get;
  var set = _ember['default'].set;

  var validateIfNewItem = {
    'if': function validateNewItem(object) {
      var skipSavePurchase = get(object, 'skipSavePurchase');
      // Only validate on new items and only if we are saving a purchase.
      return !skipSavePurchase && get(object, 'isNew');
    }
  };

  exports['default'] = _hospitalrunModelsAbstract['default'].extend(_hospitalrunMixinsLocationName['default'], {
    // Attributes
    crossReference: _emberData['default'].attr('string'),
    description: _emberData['default'].attr('string'),
    distributionUnit: _emberData['default'].attr('string'),
    friendlyId: _emberData['default'].attr('string'),
    inventoryType: _emberData['default'].attr('string'),
    keywords: _emberData['default'].attr(),
    name: _emberData['default'].attr('string'),
    price: _emberData['default'].attr('number'),
    quantity: _emberData['default'].attr('number'),
    rank: _emberData['default'].attr('string'),
    reorderPoint: _emberData['default'].attr('number'),

    // Associations
    locations: _emberData['default'].hasMany('inv-location', { async: false }),
    purchases: _emberData['default'].hasMany('inv-purchase', { async: false }),

    // TODO: this value should be server calcuated property on model!
    estimatedDaysOfStock: 14,

    availableLocations: (0, _emberComputed['default'])('locations.@each.quantity', function () {
      var locations = get(this, 'locations').filter(function (location) {
        return get(location, 'quantity') > 0;
      });
      return locations;
    }),

    displayLocations: (0, _emberComputed['default'])('availableLocations', function () {
      var _this = this;

      var locations = get(this, 'availableLocations');
      var returnLocations = [];
      locations.forEach(function (currentLocation) {
        var aisleLocationName = get(currentLocation, 'aisleLocation');
        var locationName = get(currentLocation, 'location');
        var displayLocationName = _this.formatLocationName(locationName, aisleLocationName);
        if (!_ember['default'].isEmpty(displayLocationName)) {
          returnLocations.push(displayLocationName);
        }
      });
      return returnLocations.toString();
    }),

    condition: (0, _emberComputed['default'])('rank', 'estimatedDaysOfStock', function () {
      var estimatedDaysOfStock = get(this, 'estimatedDaysOfStock');
      var multiplier = (0, _hospitalrunUtilsItemCondition.rankToMultiplier)(get(this, 'rank'));

      return (0, _hospitalrunUtilsItemCondition.getCondition)(estimatedDaysOfStock, multiplier);
    }),

    validations: {
      distributionUnit: {
        presence: true
      },
      purchaseCost: {
        numericality: validateIfNewItem
      },
      name: {
        presence: true
      },
      quantity: {
        numericality: {
          validateIfNewItem: validateIfNewItem,
          greaterThanOrEqualTo: 0
        }
      },
      price: {
        numericality: {
          allowBlank: true
        }
      },
      originalQuantity: {
        presence: validateIfNewItem
      },
      reorderPoint: {
        numericality: {
          allowBlank: true
        }
      },
      inventoryType: {
        presence: true
      },
      vendor: {
        presence: validateIfNewItem
      }
    },

    updateQuantity: function updateQuantity() {
      var purchases = get(this, 'purchases');
      var newQuantity = purchases.reduce(function (previousItem, currentItem) {
        var currentQuantity = 0;
        if (!currentItem.get('expired')) {
          currentQuantity = currentItem.get('currentQuantity');
        }
        return previousItem + currentQuantity;
      }, 0);
      set(this, 'quantity', newQuantity);
    }
  });
});
define('hospitalrun/models/invoice', ['exports', 'hospitalrun/models/abstract', 'hospitalrun/mixins/date-format', 'ember-data', 'ember', 'hospitalrun/mixins/number-format', 'hospitalrun/utils/patient-validation'], function (exports, _hospitalrunModelsAbstract, _hospitalrunMixinsDateFormat, _emberData, _ember, _hospitalrunMixinsNumberFormat, _hospitalrunUtilsPatientValidation) {
  var computed = _ember['default'].computed;
  var get = _ember['default'].get;
  var set = _ember['default'].set;
  exports['default'] = _hospitalrunModelsAbstract['default'].extend(_hospitalrunMixinsDateFormat['default'], _hospitalrunMixinsNumberFormat['default'], {
    // Attributes
    billDate: _emberData['default'].attr('date'),
    externalInvoiceNumber: _emberData['default'].attr('string'),
    paidTotal: _emberData['default'].attr('number'),
    patientInfo: _emberData['default'].attr('string'), // Needed for searching
    remarks: _emberData['default'].attr('string'),
    status: _emberData['default'].attr('string'),

    // Associations
    /* the individual line items of the invoice */
    lineItems: _emberData['default'].hasMany('billing-line-item', { async: false }),
    patient: _emberData['default'].belongsTo('patient', { async: false }),
    paymentProfile: _emberData['default'].belongsTo('price-profile', { async: false }),
    /* payments track the number of payment events attached to an invoice. */
    payments: _emberData['default'].hasMany('payment', { async: false }),
    visit: _emberData['default'].belongsTo('visit', { async: false }),

    addPayment: function addPayment(payment) {
      var payments = get(this, 'payments');
      payments.addObject(payment);
      this.paymentAmountChanged();
    },

    billDateAsTime: computed('billDate', function () {
      return this.dateToTime(get(this, 'billDate'));
    }),

    discountTotals: _ember['default'].computed.mapBy('lineItemsByCategory', 'discount'),
    discount: _ember['default'].computed.sum('discountTotals'),

    nationalInsuranceTotals: _ember['default'].computed.mapBy('lineItemsByCategory', 'nationalInsurance'),
    nationalInsurance: _ember['default'].computed.sum('nationalInsuranceTotals'),

    paidFlag: computed('status', function () {
      return get(this, 'status') === 'Paid';
    }),

    remainingBalance: computed('finalPatientResponsibility', 'paidTotal', function () {
      var patientResponsibility = get(this, 'finalPatientResponsibility');
      var paidTotal = get(this, 'paidTotal');
      return this._numberFormat(patientResponsibility - paidTotal, true);
    }),

    privateInsuranceTotals: _ember['default'].computed.mapBy('lineItemsByCategory', 'privateInsurance'),
    privateInsurance: _ember['default'].computed.sum('privateInsuranceTotals'),

    lineTotals: _ember['default'].computed.mapBy('lineItems', 'total'),
    total: _ember['default'].computed.sum('lineTotals'),

    displayInvoiceNumber: computed('externalInvoiceNumber', 'id', function () {
      var externalInvoiceNumber = get(this, 'externalInvoiceNumber');
      var id = get(this, 'id');
      return _ember['default'].isEmpty(externalInvoiceNumber) ? id : externalInvoiceNumber;
    }),

    lineItemsByCategory: computed('lineItems.@each.amountOwed', function () {
      var lineItems = get(this, 'lineItems');
      var byCategory = [];
      lineItems.forEach((function (lineItem) {
        var category = get(lineItem, 'category');
        var categoryList = byCategory.findBy('category', category);
        if (_ember['default'].isEmpty(categoryList)) {
          categoryList = {
            category: category,
            items: []
          };
          byCategory.push(categoryList);
        }
        categoryList.items.push(lineItem);
      }).bind(this));
      byCategory.forEach((function (categoryList) {
        categoryList.amountOwed = this._calculateTotal(categoryList.items, 'amountOwed');
        categoryList.discount = this._calculateTotal(categoryList.items, 'discount');
        categoryList.nationalInsurance = this._calculateTotal(categoryList.items, 'nationalInsurance');
        categoryList.privateInsurance = this._calculateTotal(categoryList.items, 'privateInsurance');
        categoryList.total = this._calculateTotal(categoryList.items, 'total');
      }).bind(this));
      return byCategory;
    }),

    patientIdChanged: (function () {
      if (!_ember['default'].isEmpty(get(this, 'patient'))) {
        var patientDisplayName = get(this, 'patient.displayName');
        var patientDisplayId = get(this, 'patient.displayPatientId');
        set(this, 'patientInfo', patientDisplayName + ' - ' + patientDisplayId);
      }
    }).observes('patient.displayName', 'patient.id', 'patient.displayPatientId'),

    patientResponsibilityTotals: _ember['default'].computed.mapBy('lineItems', 'amountOwed'),
    patientResponsibility: _ember['default'].computed.sum('patientResponsibilityTotals'),
    finalPatientResponsibility: computed('patientResponsibility', 'paymentProfile', function () {
      var setFee = this._getValidNumber(this.get('paymentProfile.setFee'));
      var discountAmount = this._getValidNumber(this.get('paymentProfile.discountAmount'));
      var patientResponsibility = this._getValidNumber(this.get('patientResponsibility'));
      if (setFee > 0) {
        if (setFee < patientResponsibility) {
          return setFee;
        } else {
          return patientResponsibility;
        }
      } else if (discountAmount > 0) {
        if (patientResponsibility - discountAmount > 0) {
          return patientResponsibility - discountAmount;
        } else {
          return 0;
        }
      } else {
        return patientResponsibility;
      }
    }),

    paymentAmountChanged: (function () {
      var payments = get(this, 'payments').filter(function (payment) {
        return !get(payment, 'isNew');
      });
      if (payments.length === 0) {
        return;
      }
      var paidTotal = payments.reduce((function (previousValue, payment) {
        return previousValue += this._getValidNumber(payment.get('amount'));
      }).bind(this), 0);
      set(this, 'paidTotal', this._numberFormat(paidTotal, true));
      var remainingBalance = get(this, 'remainingBalance');
      if (remainingBalance <= 0) {
        set(this, 'status', 'Paid');
      }
    }).observes('payments.[]', 'payments.@each.amount'),

    validations: {
      patientTypeAhead: _hospitalrunUtilsPatientValidation['default'].patientTypeAhead,
      patient: {
        presence: true
      },
      visit: {
        presence: true
      }
    }
  });
});
define('hospitalrun/models/lab', ['exports', 'hospitalrun/models/abstract', 'hospitalrun/mixins/can-edit-requested', 'hospitalrun/mixins/date-format', 'ember-data', 'ember', 'hospitalrun/utils/patient-validation', 'hospitalrun/mixins/result-validation'], function (exports, _hospitalrunModelsAbstract, _hospitalrunMixinsCanEditRequested, _hospitalrunMixinsDateFormat, _emberData, _ember, _hospitalrunUtilsPatientValidation, _hospitalrunMixinsResultValidation) {
  var computed = _ember['default'].computed;
  var get = _ember['default'].get;
  exports['default'] = _hospitalrunModelsAbstract['default'].extend(_hospitalrunMixinsCanEditRequested['default'], _hospitalrunMixinsDateFormat['default'], _hospitalrunMixinsResultValidation['default'], {
    // Attributes
    labDate: _emberData['default'].attr('date'),
    notes: _emberData['default'].attr('string'),
    requestedBy: _emberData['default'].attr('string'),
    requestedDate: _emberData['default'].attr('date'),
    result: _emberData['default'].attr('string'),
    status: _emberData['default'].attr('string'),

    // Associations
    charges: _emberData['default'].hasMany('proc-charge', { async: false }),
    labType: _emberData['default'].belongsTo('pricing', { async: false }),
    patient: _emberData['default'].belongsTo('patient', { async: false }),
    visit: _emberData['default'].belongsTo('visit', { async: false }),

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

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

    validations: {
      labTypeName: {
        presence: {
          'if': function _if(object) {
            if (object.get('isNew')) {
              return true;
            }
          },
          message: 'Please select a lab type'
        }
      },
      patientTypeAhead: _hospitalrunUtilsPatientValidation['default'].patientTypeAhead,
      patient: {
        presence: true
      }
    }
  });
});
define('hospitalrun/models/line-item-detail', ['exports', 'hospitalrun/models/abstract', 'ember-data', 'ember', 'hospitalrun/mixins/number-format'], function (exports, _hospitalrunModelsAbstract, _emberData, _ember, _hospitalrunMixinsNumberFormat) {
  var computed = _ember['default'].computed;
  var get = _ember['default'].get;
  exports['default'] = _hospitalrunModelsAbstract['default'].extend(_hospitalrunMixinsNumberFormat['default'], {
    // Attributes
    department: _emberData['default'].attr('string'),
    expenseAccount: _emberData['default'].attr('string'),
    name: _emberData['default'].attr('string'),
    price: _emberData['default'].attr('number'),
    quantity: _emberData['default'].attr('number'),
    total: _emberData['default'].attr('number'),

    // Associations
    pricingItem: _emberData['default'].belongsTo('pricing', { async: false }),

    amountOwed: computed('price', 'quantity', function () {
      var price = get(this, 'price');
      var quantity = get(this, 'quantity');
      var total = 0;
      if (this._validNumber(price) && this._validNumber(quantity)) {
        total = this._numberFormat(price * quantity, true);
      }
      return total;
    })
  });
});
define('hospitalrun/models/lookup', ['exports', 'ember-pouch', 'ember-data'], function (exports, _emberPouch, _emberData) {
  var attr = _emberData['default'].attr;
  exports['default'] = _emberPouch.Model.extend({
    organizeByType: attr('boolean'),
    userCanAdd: attr('boolean'),
    value: attr('')
  });
});
define('hospitalrun/models/medication', ['exports', 'hospitalrun/models/abstract', 'hospitalrun/mixins/can-edit-requested', 'ember-data', 'hospitalrun/mixins/date-format', 'ember', 'hospitalrun/mixins/medication-details'], function (exports, _hospitalrunModelsAbstract, _hospitalrunMixinsCanEditRequested, _emberData, _hospitalrunMixinsDateFormat, _ember, _hospitalrunMixinsMedicationDetails) {
  var computed = _ember['default'].computed;
  var get = _ember['default'].get;
  exports['default'] = _hospitalrunModelsAbstract['default'].extend(_hospitalrunMixinsCanEditRequested['default'], _hospitalrunMixinsDateFormat['default'], _hospitalrunMixinsMedicationDetails['default'], {
    // Attributes
    notes: _emberData['default'].attr('string'),
    prescription: _emberData['default'].attr('string'),
    prescriptionDate: _emberData['default'].attr('date'),
    quantity: _emberData['default'].attr('number'),
    refills: _emberData['default'].attr('number'),
    requestedDate: _emberData['default'].attr('date'),
    requestedBy: _emberData['default'].attr('string'),
    status: _emberData['default'].attr('string'),

    // Associations
    inventoryItem: _emberData['default'].belongsTo('inventory', { async: true }),
    patient: _emberData['default'].belongsTo('patient', { async: false }),
    visit: _emberData['default'].belongsTo('visit', { async: false }),

    isRequested: computed('status', function () {
      return get(this, 'status') === 'Requested';
    }),

    medicationName: computed('medicationTitle', 'inventoryItem', function () {
      return this.getMedicationName('inventoryItem');
    }),

    medicationPrice: computed('priceOfMedication', 'inventoryItem', function () {
      return this.getMedicationPrice('inventoryItem');
    }),

    prescriptionDateAsTime: computed('prescriptionDate', function () {
      return this.dateToTime(get(this, 'prescriptionDate'));
    }),

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

    validations: {
      prescription: {
        acceptance: {
          accept: true,
          'if': function _if(object) {
            if (!get(object, 'hasDirtyAttributes') || get(object, 'isFulfilling')) {
              return false;
            }
            var prescription = get(object, 'prescription');
            var quantity = get(object, 'quantity');
            return _ember['default'].isEmpty(prescription) && _ember['default'].isEmpty(quantity);
          },
          message: 'Please enter a prescription or a quantity'
        }
      },

      inventoryItemTypeAhead: {
        acceptance: {
          accept: true,
          'if': function _if(object) {
            if (!get(object, 'hasDirtyAttributes') || !get(object, 'isNew')) {
              return false;
            }
            var itemName = get(object, 'inventoryItem.name');
            var itemTypeAhead = get(object, 'inventoryItemTypeAhead');
            if (_ember['default'].isEmpty(itemName) || _ember['default'].isEmpty(itemTypeAhead)) {
              // force validation to fail
              return true;
            } else {
              var typeAheadName = itemTypeAhead.substr(0, itemName.length);
              if (itemName !== typeAheadName) {
                return true;
              }
            }
            // Inventory item is properly selected; don't do any further validation
            return false;
          },
          message: 'Please select a valid medication'
        }
      },

      patientTypeAhead: {
        presence: {
          'if': function _if(object) {
            return get(object, 'selectPatient');
          }
        }
      },

      quantity: {
        numericality: {
          allowBlank: true,
          greaterThan: 0,
          messages: {
            greaterThan: 'must be greater than 0'
          }
        },
        presence: {
          'if': function _if(object) {
            return get(object, 'isFulfilling');
          }
        },
        acceptance: {
          accept: true,
          'if': function _if(object) {
            var isFulfilling = get(object, 'isFulfilling');
            var requestQuantity = parseInt(get(object, 'quantity'));
            var quantityToCompare = null;

            if (!isFulfilling) {
              // no validation needed when not fulfilling
              return false;
            } else {
              quantityToCompare = object.get('inventoryItem.quantity');
            }

            if (requestQuantity > quantityToCompare) {
              // force validation to fail
              return true;
            } else {
              // There is enough quantity on hand
              return false;
            }
          },
          message: 'The quantity must be less than or equal to the number of available medication.'
        }
      },

      refills: {
        numericality: {
          allowBlank: true
        }
      }
    }
  });
});
define('hospitalrun/models/operation-report', ['exports', 'hospitalrun/models/abstract', 'ember-data', 'ember'], function (exports, _hospitalrunModelsAbstract, _emberData, _ember) {
  var get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;

  function defaultProcedures() {
    return [];
  }

  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    // Attributes
    additionalNotes: _emberData['default'].attr('string'),
    caseComplexity: _emberData['default'].attr('number'),
    customForms: _emberData['default'].attr('custom-forms'),
    procedures: _emberData['default'].attr('operative-procedures', { defaultValue: defaultProcedures }),
    operationDescription: _emberData['default'].attr('string'),
    surgeon: _emberData['default'].attr('string'),
    surgeryDate: _emberData['default'].attr('date'),

    // Associations
    preOpDiagnoses: _emberData['default'].hasMany('diagnosis'),
    diagnoses: _emberData['default'].hasMany('diagnosis'), // Post op diagnosis
    operativePlan: _emberData['default'].belongsTo('operative-plan', { async: true }),
    patient: _emberData['default'].belongsTo('patient', { async: false }),

    validations: {
      caseComplexity: {
        numericality: {
          allowBlank: true,
          onlyInteger: true
        }
      },
      procedureDescription: {
        presence: {
          'if': function _if(object) {
            return isEmpty(get(object, 'procedures'));
          }
        }
      }
    }
  });
});
define('hospitalrun/models/operative-plan', ['exports', 'hospitalrun/models/abstract', 'ember-data', 'ember', 'hospitalrun/mixins/operative-plan-statuses'], function (exports, _hospitalrunModelsAbstract, _emberData, _ember, _hospitalrunMixinsOperativePlanStatuses) {
  var computed = _ember['default'].computed;
  var _get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;

  function defaultProcedures() {
    return [];
  }

  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    // Attributes
    additionalNotes: _emberData['default'].attr('string'),
    admissionInstructions: _emberData['default'].attr('string'),
    caseComplexity: _emberData['default'].attr('number'),
    customForms: _emberData['default'].attr('custom-forms'),
    operationDescription: _emberData['default'].attr('string'),
    procedures: _emberData['default'].attr('operative-procedures', { defaultValue: defaultProcedures }),
    status: _emberData['default'].attr('string', { defaultValue: _hospitalrunMixinsOperativePlanStatuses.PLANNED_STATUS }),
    surgeon: _emberData['default'].attr('string'),

    // Associations
    diagnoses: _emberData['default'].hasMany('diagnosis'),
    patient: _emberData['default'].belongsTo('patient', { async: false }),

    isPlanned: computed('status', {
      get: function get() {
        var status = _get(this, 'status');
        return status === _hospitalrunMixinsOperativePlanStatuses.PLANNED_STATUS;
      }
    }),

    validations: {
      caseComplexity: {
        numericality: {
          allowBlank: true,
          onlyInteger: true
        }
      },

      procedureDescription: {
        presence: {
          'if': function _if(object) {
            return isEmpty(_get(object, 'procedures'));
          }
        }
      }
    }
  });
});
define('hospitalrun/models/option', ['exports', 'ember-pouch', 'ember-data'], function (exports, _emberPouch, _emberData) {
  exports['default'] = _emberPouch.Model.extend({
    value: _emberData['default'].attr('')
  });
});
define('hospitalrun/models/override-price', ['exports', 'hospitalrun/models/abstract', 'ember-data'], function (exports, _hospitalrunModelsAbstract, _emberData) {
  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    // Attributes
    price: _emberData['default'].attr('number'),

    // Associations
    profile: _emberData['default'].belongsTo('price-profile', { async: false }),

    validations: {
      profile: {
        presence: true
      },
      price: {
        numericality: true
      }
    }
  });
});
define('hospitalrun/models/patient-note', ['exports', 'hospitalrun/models/abstract', 'ember', 'ember-data'], function (exports, _hospitalrunModelsAbstract, _ember, _emberData) {
  var computed = _ember['default'].computed;
  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    // Attributes
    /*
     * if the note was written by one person but dictated or
     * given on behalf of another, otherwise, this and createdBy are the same.
     */
    attribution: _emberData['default'].attr('string'),

    content: _emberData['default'].attr('string'),
    createdBy: _emberData['default'].attr('string'),
    date: _emberData['default'].attr('date'),
    /* custom list of noteTypes of mixins/patient-note-types */
    noteType: _emberData['default'].attr(),
    /* who is this note about? */
    patient: _emberData['default'].belongsTo('patient', { async: false }),
    /* if this note is related to a visit, make sure it's noted. */
    visit: _emberData['default'].belongsTo('visit', { async: false }),

    authoredBy: computed('attribution', 'createdBy', function () {
      if (!_ember['default'].isEmpty(this.get('attribution'))) {
        var i18n = this.get('i18n');
        return this.get('createdBy') + ' ' + i18n.t('patients.notes.onBehalfOfCopy') + ' ' + this.get('attribution');
      } else {
        return this.get('createdBy');
      }
    }),

    validations: {
      patient: {
        presence: true
      },
      visit: {
        presence: true
      },
      content: {
        presence: true
      }
    }
  });
});
define('hospitalrun/models/patient', ['exports', 'hospitalrun/models/abstract', 'hospitalrun/mixins/dob-days', 'hospitalrun/utils/email-validation', 'ember', 'ember-data', 'hospitalrun/mixins/patient-name'], function (exports, _hospitalrunModelsAbstract, _hospitalrunMixinsDobDays, _hospitalrunUtilsEmailValidation, _ember, _emberData, _hospitalrunMixinsPatientName) {
  var computed = _ember['default'].computed;
  var get = _ember['default'].get;
  exports['default'] = _hospitalrunModelsAbstract['default'].extend(_hospitalrunMixinsDobDays['default'], _hospitalrunMixinsPatientName['default'], {
    // Attributes
    admitted: _emberData['default'].attr('boolean', { defaultValue: false }),
    additionalContacts: _emberData['default'].attr(),
    address: _emberData['default'].attr('string'),
    address2: _emberData['default'].attr('string'),
    address3: _emberData['default'].attr('string'),
    address4: _emberData['default'].attr('string'),
    bloodType: _emberData['default'].attr('string'),
    clinic: _emberData['default'].attr('string'),
    country: _emberData['default'].attr('string'),
    checkedIn: _emberData['default'].attr('boolean', { defaultValue: false }),
    customForms: _emberData['default'].attr('custom-forms'),
    dateOfBirth: _emberData['default'].attr('date'),
    economicClassification: _emberData['default'].attr('string'),
    email: _emberData['default'].attr('string'),
    expenses: _emberData['default'].attr(),
    externalPatientId: _emberData['default'].attr('string'),
    familySupport1: _emberData['default'].attr('string'),
    familySupport2: _emberData['default'].attr('string'),
    familySupport3: _emberData['default'].attr('string'),
    familySupport4: _emberData['default'].attr('string'),
    familySupport5: _emberData['default'].attr('string'),
    friendlyId: _emberData['default'].attr('string'),
    familyInfo: _emberData['default'].attr(),
    firstName: _emberData['default'].attr('string'),
    sex: _emberData['default'].attr('string'),
    occupation: _emberData['default'].attr('string'),
    history: _emberData['default'].attr('string'), // No longer used
    insurance: _emberData['default'].attr('string'),
    lastName: _emberData['default'].attr('string'),
    livingArrangement: _emberData['default'].attr('string'),
    middleName: _emberData['default'].attr('string'),
    notes: _emberData['default'].attr('string'),
    otherIncome: _emberData['default'].attr('string'),
    patientType: _emberData['default'].attr('string'),
    parent: _emberData['default'].attr('string'),
    phone: _emberData['default'].attr('string'),
    placeOfBirth: _emberData['default'].attr('string'),
    referredDate: _emberData['default'].attr('date'),
    referredBy: _emberData['default'].attr('string'),
    religion: _emberData['default'].attr('string'),
    socialActionTaken: _emberData['default'].attr('string'),
    socialRecommendation: _emberData['default'].attr('string'),
    status: _emberData['default'].attr('string'),
    // Associations
    allergies: _emberData['default'].hasMany('allergy', { async: true }),
    diagnoses: _emberData['default'].hasMany('diagnosis', { async: false }),
    operationReports: _emberData['default'].hasMany('operation-report', { async: true }),
    operativePlans: _emberData['default'].hasMany('operative-plan', { async: true }),
    payments: _emberData['default'].hasMany('payment', { async: true }),
    paymentProfile: _emberData['default'].belongsTo('price-profile', { async: false }),

    age: computed('dateOfBirth', function () {
      var dob = get(this, 'dateOfBirth');
      return this.convertDOBToText(dob);
    }),

    displayAddress: computed('address', 'address2', 'address3', 'address4', function () {
      var addressFields = this.getProperties('address', 'address2', 'address3', 'address4');
      var displayAddress = '';
      for (var prop in addressFields) {
        if (!_ember['default'].isEmpty(addressFields[prop])) {
          if (!_ember['default'].isEmpty(displayAddress)) {
            displayAddress += ', ';
          }
          displayAddress += addressFields[prop];
        }
      }
      return displayAddress;
    }),

    displayName: computed('firstName', 'lastName', 'middleName', function () {
      return this.getPatientDisplayName(this);
    }),

    displayPatientId: computed('id', 'externalPatientId', 'friendlyId', function () {
      return this.getPatientDisplayId(this);
    }),

    shortAge: computed('dateOfBirth', function () {
      var dob = get(this, 'dateOfBirth');
      return this.convertDOBToText(dob, true);
    }),

    shortDisplayName: computed('firstName', 'lastName', function () {
      return this.getPatientDisplayName(this, true);
    }),

    validations: {
      email: {
        format: {
          'with': _hospitalrunUtilsEmailValidation['default'].emailRegex,
          allowBlank: true,
          message: 'please enter a valid email address'
        }
      },
      firstName: {
        presence: true
      },
      lastName: {
        presence: true
      }
    }
  });
});
define('hospitalrun/models/payment', ['exports', 'hospitalrun/models/abstract', 'ember-data', 'ember'], function (exports, _hospitalrunModelsAbstract, _emberData, _ember) {
  var computed = _ember['default'].computed;
  var get = _ember['default'].get;
  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    // Attributes
    amount: _emberData['default'].attr('number'),
    /* Is patient a charity case */
    charityPatient: _emberData['default'].attr('boolean'),
    datePaid: _emberData['default'].attr('date'),
    expenseAccount: _emberData['default'].attr('string'),
    notes: _emberData['default'].attr('string'),
    paymentType: _emberData['default'].attr('string'),

    // Associations
    invoice: _emberData['default'].belongsTo('invoice', { async: false }),

    canRemovePayment: computed('paymentType', function () {
      return get(this, 'paymentType') === 'Deposit';
    }),

    validations: {
      amount: {
        numericality: true
      },
      datePaid: {
        presence: true
      }
    }
  });
});
define('hospitalrun/models/photo', ['exports', 'hospitalrun/models/abstract', 'ember-data', 'ember'], function (exports, _hospitalrunModelsAbstract, _emberData, _ember) {
  var attr = _emberData['default'].attr;
  var belongsTo = _emberData['default'].belongsTo;
  var computed = _ember['default'].computed;
  var get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    // Attributes
    /* Temporarily store file as attachment until it gets uploaded to the server */
    caption: attr('string'),
    coverImage: attr('boolean'),
    files: attr('attachments', {
      defaultValue: function defaultValue() {
        return [];
      }
    }),
    fileName: attr('string'),
    isImage: _emberData['default'].attr('boolean', { defaultValue: false }),
    localFile: _emberData['default'].attr('boolean', { defaultValue: false }),
    url: attr('string'),

    // Associations
    patient: belongsTo('patient', { async: false }),

    shortFileName: computed('fileName', function () {
      var fileName = get(this, 'fileName');
      if (!isEmpty(fileName)) {
        fileName = fileName.substr(fileName.lastIndexOf('/') + 1);
      }
      return fileName;
    })
  });
});
define('hospitalrun/models/price-profile', ['exports', 'hospitalrun/models/abstract', 'ember-data'], function (exports, _hospitalrunModelsAbstract, _emberData) {
  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    name: _emberData['default'].attr('string'),
    discountAmount: _emberData['default'].attr('number'),
    discountPercentage: _emberData['default'].attr('number'),
    setFee: _emberData['default'].attr('number'),

    validations: {
      name: {
        presence: true
      },
      discountAmount: {
        numericality: {
          allowBlank: true
        }
      },
      discountPercentage: {
        numericality: {
          allowBlank: true
        }
      },
      setFee: {
        numericality: {
          allowBlank: true
        }
      }
    }
  });
});
define('hospitalrun/models/pricing', ['exports', 'hospitalrun/models/abstract', 'ember-data'], function (exports, _hospitalrunModelsAbstract, _emberData) {
  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    // Attributes
    category: _emberData['default'].attr('string'),
    expenseAccount: _emberData['default'].attr('string'),
    name: _emberData['default'].attr('string'),
    price: _emberData['default'].attr('number'),
    pricingType: _emberData['default'].attr('string'),

    // Associations
    pricingOverrides: _emberData['default'].hasMany('override-price', { async: false }),

    validations: {
      category: {
        presence: true
      },
      name: {
        presence: true
      },
      price: {
        numericality: true
      }
    }
  });
});
define('hospitalrun/models/proc-charge', ['exports', 'hospitalrun/models/abstract', 'ember-data', 'ember', 'hospitalrun/mixins/medication-details'], function (exports, _hospitalrunModelsAbstract, _emberData, _ember, _hospitalrunMixinsMedicationDetails) {
  var computed = _ember['default'].computed;
  var get = _ember['default'].get;

  /**
   * Procedure charges
   */
  exports['default'] = _hospitalrunModelsAbstract['default'].extend(_hospitalrunMixinsMedicationDetails['default'], {
    // Attributes
    quantity: _emberData['default'].attr('number'),
    dateCharged: _emberData['default'].attr('date'),

    // Associations
    medication: _emberData['default'].belongsTo('inventory', { async: false }),
    pricingItem: _emberData['default'].belongsTo('pricing', { async: false }),

    medicationCharge: computed('medication', 'newMedicationCharge', function () {
      var medication = get(this, 'medication');
      var newMedicationCharge = get(this, 'newMedicationCharge');
      return !_ember['default'].isEmpty(medication) || !_ember['default'].isEmpty(newMedicationCharge);
    }),

    medicationName: computed('medication', function () {
      return this.get('medication.name');
    }),

    medicationPrice: computed('medication', function () {
      return this.get('medication.price');
    }),

    validations: {
      itemName: {
        presence: true,
        acceptance: {
          accept: true,
          'if': function _if(object) {
            var medicationCharge = get(object, 'medicationCharge');
            if (!medicationCharge || !get(object, 'hasDirtyAttributes')) {
              return false;
            }
            var itemName = get(object, 'inventoryItem.name');
            var itemTypeAhead = get(object, 'itemName');
            if (_ember['default'].isEmpty(itemName) || _ember['default'].isEmpty(itemTypeAhead)) {
              // force validation to fail
              return true;
            } else {
              var typeAheadName = itemTypeAhead.substr(0, itemName.length);
              if (itemName !== typeAheadName) {
                return true;
              }
            }
            // Inventory item is properly selected; don't do any further validation
            return false;
          },
          message: 'Please select a valid medication'
        }

      },

      quantity: {
        numericality: {
          greaterThan: 0,
          messages: {
            greaterThan: 'must be greater than 0'
          }
        }
      }
    }
  });
});
define('hospitalrun/models/procedure', ['exports', 'hospitalrun/models/abstract', 'ember-data'], function (exports, _hospitalrunModelsAbstract, _emberData) {
  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    // Attributes
    anesthesiaType: _emberData['default'].attr('string'),
    anesthesiologist: _emberData['default'].attr('string'),
    assistant: _emberData['default'].attr('string'),
    description: _emberData['default'].attr('string'),
    cptCode: _emberData['default'].attr('string'),
    location: _emberData['default'].attr('string'),
    notes: _emberData['default'].attr('string'),
    physician: _emberData['default'].attr('string'),
    procedureDate: _emberData['default'].attr('date'),
    timeStarted: _emberData['default'].attr('string'),
    timeEnded: _emberData['default'].attr('string'),

    // Associations
    charges: _emberData['default'].hasMany('proc-charge', { async: false }),
    visit: _emberData['default'].belongsTo('visit', { async: false }),

    validations: {
      description: {
        presence: true
      },

      oxygenHours: {
        numericality: {
          allowBlank: true
        }
      },
      pacuHours: {
        numericality: {
          allowBlank: true
        }
      },
      physician: {
        presence: true
      },
      procedureDate: {
        presence: true
      },
      display_procedureDate: {
        presence: {
          message: 'Please select a valid date'
        }
      }
    }
  });
});
define('hospitalrun/models/report', ['exports', 'hospitalrun/models/abstract', 'ember-data'], function (exports, _hospitalrunModelsAbstract, _emberData) {
  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    // Attributes
    reportDate: _emberData['default'].attr('date'),
    customForms: _emberData['default'].attr('custom-forms'),
    reportType: _emberData['default'].attr('string'),

    // Associations
    visit: _emberData['default'].belongsTo('visit', { async: false }),

    validations: {
      visit: {
        presence: true
      },

      reportDate: {
        presence: true
      }
    }
  });
});
define('hospitalrun/models/sequence', ['exports', 'ember-pouch', 'ember-data'], function (exports, _emberPouch, _emberData) {
  exports['default'] = _emberPouch.Model.extend({
    // Attributes
    prefix: _emberData['default'].attr('string'),
    value: _emberData['default'].attr('number')
  });
});
define('hospitalrun/models/social-expense', ['exports', 'ember-data', 'ember-validations', 'ember-pouch'], function (exports, _emberData, _emberValidations, _emberPouch) {
  exports['default'] = _emberPouch.Model.extend(_emberValidations['default'], {
    // Attributes
    category: _emberData['default'].attr('string'),
    sources: _emberData['default'].attr('string'),
    cost: _emberData['default'].attr(),

    validations: {
      category: {
        presence: true
      },
      cost: {
        numericality: true
      }
    }
  });
});
/**
 * Model for social worker family info
 */
define('hospitalrun/models/text-expansion', ['exports', 'ember-data', 'ember-validations', 'ember-pouch'], function (exports, _emberData, _emberValidations, _emberPouch) {
  exports['default'] = _emberPouch.Model.extend(_emberValidations['default'], {
    from: _emberData['default'].attr('string'),
    to: _emberData['default'].attr('string'),

    validations: {
      from: {
        presence: true
      },
      to: {
        presence: true
      }
    }
  });
});
define('hospitalrun/models/user-role', ['exports', 'hospitalrun/models/abstract', 'ember-data'], function (exports, _hospitalrunModelsAbstract, _emberData) {
  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    // Attributes
    name: _emberData['default'].attr('string'),
    capabilities: _emberData['default'].attr(),
    navRoute: _emberData['default'].attr()
  });
});
define('hospitalrun/models/user', ['exports', 'ember-data', 'hospitalrun/utils/email-validation', 'ember', 'ember-validations'], function (exports, _emberData, _hospitalrunUtilsEmailValidation, _ember, _emberValidations) {
  var computed = _ember['default'].computed;

  var User = _emberData['default'].Model.extend(_emberValidations['default'], {
    // Attributes
    derived_key: _emberData['default'].attr('string'),
    deleted: _emberData['default'].attr('boolean'),
    displayName: _emberData['default'].attr('string'),
    email: _emberData['default'].attr('string'),
    iterations: _emberData['default'].attr(),
    name: _emberData['default'].attr('string'),
    password: _emberData['default'].attr('string'),
    password_scheme: _emberData['default'].attr('string'),
    password_sha: _emberData['default'].attr('string'),
    rev: _emberData['default'].attr('string'),
    roles: _emberData['default'].attr(),
    salt: _emberData['default'].attr('string'),
    userPrefix: _emberData['default'].attr('string'),

    displayRole: computed('roles', function () {
      var roles = this.get('roles');
      if (!_ember['default'].isEmpty(roles)) {
        return roles[0];
      }
    }),

    validations: {
      email: {
        format: {
          'with': _hospitalrunUtilsEmailValidation['default'].emailRegex,
          message: 'Please, enter a valid email address'
        }
      }
    }
  });

  exports['default'] = User;
});
define('hospitalrun/models/visit', ['exports', 'hospitalrun/models/abstract', 'ember-data', 'ember', 'moment'], function (exports, _hospitalrunModelsAbstract, _emberData, _ember, _moment) {

  function dateAcceptance(object) {
    if (!object.get('hasDirtyAttributes')) {
      return false;
    }
    var startDate = object.get('startDate');
    var endDate = object.get('endDate');
    if (_ember['default'].isEmpty(endDate) || _ember['default'].isEmpty(startDate)) {
      // Can't validate if empty
      return false;
    } else {
      if (endDate.getTime() < startDate.getTime()) {
        return true;
      }
    }
    return false;
  }

  var computed = _ember['default'].computed;

  var PAYMENT_STATES = {
    CLEAR: 'clear',
    PENDING: 'pending'
  };
  var COMPLETED_STATUS = 'Completed';
  var FULFILLED_STATUS = 'Fulfilled';
  var REQUESTED_STATUS = 'Requested';
  var STATUS_FIELD = 'status';

  function paymentStateAcceptance(object) {
    return !Object.keys(PAYMENT_STATES).some(function (state) {
      return PAYMENT_STATES[state] === object.get('paymentState');
    });
  }

  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    additionalDiagnoses: _emberData['default'].attr(), // Yes, the plural of diagnosis is diagnoses!
    charges: _emberData['default'].hasMany('proc-charge', {
      async: false
    }),
    customForms: _emberData['default'].attr('custom-forms'),
    diagnoses: _emberData['default'].hasMany('diagnosis', { async: false }),
    dischargeInfo: _emberData['default'].attr('string'),
    endDate: _emberData['default'].attr('date'), // if visit type is outpatient, startDate and endDate are equal
    examiner: _emberData['default'].attr('string'),
    hasAppointment: _emberData['default'].attr('boolean', { defaultValue: false }),
    history: _emberData['default'].attr('string'), // No longer used
    historySince: _emberData['default'].attr('string'), // History of the Present Illness -- no longer used
    imaging: _emberData['default'].hasMany('imaging', { async: true }),
    labs: _emberData['default'].hasMany('lab', { async: true }),
    location: _emberData['default'].attr('string'),
    medication: _emberData['default'].hasMany('medication', { async: true }),
    // this field is being deprecated in favor of patient-note
    notes: _emberData['default'].attr('string'),
    patientNotes: _emberData['default'].hasMany('patient-note', { async: true }),
    outPatient: _emberData['default'].attr('boolean'),
    patient: _emberData['default'].belongsTo('patient', {
      async: false
    }),
    paymentState: _emberData['default'].attr('string', { defaultValue: PAYMENT_STATES.PENDING }),
    primaryDiagnosis: _emberData['default'].attr('string'), // No longer used -- diagnoses are stored in diagnoses hasMany relationship
    primaryBillingDiagnosis: _emberData['default'].attr('string'), // AKA final diagnosis
    primaryBillingDiagnosisId: _emberData['default'].attr('string'),
    procedures: _emberData['default'].hasMany('procedure', { async: true }),
    reasonForVisit: _emberData['default'].attr('string'),
    startDate: _emberData['default'].attr('date'),
    status: _emberData['default'].attr('string'),
    visitType: _emberData['default'].attr(),
    vitals: _emberData['default'].hasMany('vital', { async: true }),
    reports: _emberData['default'].hasMany('report', { async: true }),

    diagnosisList: computed('diagnoses.[]', function () {
      var diagnoses = this.get('diagnoses');
      var diagnosisList = diagnoses.map(function (diagnosis) {
        return diagnosis.get('diagnosis');
      });
      return diagnosisList;
    }),

    hasAppointmentLabel: computed('hasAppointment', function () {
      var hasAppointment = this.get('hasAppointment');
      var i18n = this.get('i18n');
      if (hasAppointment === true) {
        return i18n.t('visits.labels.haveAppointment');
      } else {
        return i18n.t('visits.labels.noAppointment');
      }
    }),

    hasCompletedImaging: computed('imaging.@each.status', function () {
      var imaging = this.get('imaging');
      return imaging.isAny(STATUS_FIELD, COMPLETED_STATUS);
    }),

    hasCompletedLabs: computed('labs.@each.status', function () {
      var labs = this.get('labs');
      return labs.isAny(STATUS_FIELD, COMPLETED_STATUS);
    }),

    hasCompletedMedication: computed('medication.@each.status', function () {
      var medication = this.get('medication');
      return medication.isAny(STATUS_FIELD, FULFILLED_STATUS);
    }),

    hasDoneOrders: computed('imaging.@each.status', 'labs.@each.status', function () {
      var i18n = this.get('i18n');
      var imaging = this.get('imaging');
      var labs = this.get('labs');
      if (imaging.isAny(STATUS_FIELD, REQUESTED_STATUS) || labs.isAny(STATUS_FIELD, REQUESTED_STATUS)) {
        return i18n.t('visits.labels.ordersNotDone');
      } else {
        return i18n.t('visits.labels.haveDoneOrders');
      }
    }),

    primaryDiagnoses: computed('diagnoses.[].secondaryDiagnosis', function () {
      var diagnoses = this.get('diagnoses');
      var diagnosisList = diagnoses.filterBy('secondaryDiagnosis', false).map(function (diagnosis) {
        return diagnosis.get('diagnosis');
      });
      return diagnosisList.join(', ');
    }),

    visitDate: (function () {
      var endDate = this.get('endDate');
      var startDate = (0, _moment['default'])(this.get('startDate'));
      var visitDate = startDate.format('l');
      if (!_ember['default'].isEmpty(endDate) && !startDate.isSame(endDate, 'day')) {
        visitDate += ' - ' + (0, _moment['default'])(endDate).format('l');
      }
      return visitDate;
    }).property('startDate', 'endDate'),

    visitDescription: (function () {
      var visitDate = this.get('visitDate');
      var visitType = this.get('visitType');
      return visitDate + ' (' + visitType + ')';
    }).property('visitDate', 'visitType'),

    validations: {
      endDate: {
        acceptance: {
          accept: true,
          'if': dateAcceptance,
          message: 'Please select an end date later than the start date'
        }
      },
      patientTypeAhead: {
        presence: {
          'if': function _if(object) {
            return object.get('checkIn') && !object.get('hidePatientSelection');
          }
        }
      },
      paymentState: {
        acceptance: {
          accept: true,
          'if': paymentStateAcceptance
        },
        presence: true
      },
      startDate: {
        acceptance: {
          accept: true,
          'if': dateAcceptance,
          message: 'Please select a start date earlier than the end date'
        },
        presence: true
      },
      visitType: {
        presence: true
      }

    }

  });
});
define('hospitalrun/models/vital', ['exports', 'hospitalrun/models/abstract', 'ember-data'], function (exports, _hospitalrunModelsAbstract, _emberData) {
  exports['default'] = _hospitalrunModelsAbstract['default'].extend({
    // Attributes
    dateRecorded: _emberData['default'].attr('date'),
    dbp: _emberData['default'].attr('number'),
    heartRate: _emberData['default'].attr('number'),
    height: _emberData['default'].attr('string'),
    respiratoryRate: _emberData['default'].attr('number'),
    sbp: _emberData['default'].attr('number'),
    temperature: _emberData['default'].attr('number'),
    weight: _emberData['default'].attr('string'),

    validations: {
      temperature: {
        numericality: true
      },
      sbp: {
        numericality: true
      },
      dbp: {
        numericality: true
      },
      heartRate: {
        numericality: true
      },
      respiratoryRate: {
        numericality: true
      }
    }
  });
});
define('hospitalrun/patients/add-contact/controller', ['exports', 'ember', 'hospitalrun/mixins/is-update-disabled', 'ember-i18n'], function (exports, _ember, _hospitalrunMixinsIsUpdateDisabled, _emberI18n) {
  exports['default'] = _ember['default'].Controller.extend(_hospitalrunMixinsIsUpdateDisabled['default'], {
    patientsEdit: _ember['default'].inject.controller('patients/edit'),
    editController: _ember['default'].computed.alias('patientsEdit'),
    title: (0, _emberI18n.translationMacro)('patients.titles.addContact'),
    updateButtonText: (0, _emberI18n.translationMacro)('buttons.add'),
    updateButtonAction: 'add',
    showUpdateButton: true,

    actions: {
      cancel: function cancel() {
        this.send('closeModal');
      },

      add: function add() {
        var newContact = this.getProperties('name', 'phone', 'email', 'relationship');
        this.get('editController').send('addContact', newContact);
      }
    }
  });
});
define("hospitalrun/patients/add-contact/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "NAQnh0cZ", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"hideCancelButton\",\"hideUpdateButton\",\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"hideCancelButton\"]],[\"get\",[\"hideUpdateButton\"]],[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"labels.name\"],null],\"name\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"patients.labels.phone\"],null],\"phone\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"patients.labels.email\"],null],\"email\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"patients.labels.relationships\"],null],\"relationship\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[null]],false]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/patients/add-contact/template.hbs" } });
});
define('hospitalrun/patients/admitted/controller', ['exports', 'hospitalrun/patients/index/controller'], function (exports, _hospitalrunPatientsIndexController) {
  exports['default'] = _hospitalrunPatientsIndexController['default'].extend({});
});
define('hospitalrun/patients/admitted/route', ['exports', 'ember-i18n', 'hospitalrun/patients/index/route'], function (exports, _emberI18n, _hospitalrunPatientsIndexRoute) {
  exports['default'] = _hospitalrunPatientsIndexRoute['default'].extend({
    pageTitle: (0, _emberI18n.translationMacro)('patients.titles.admittedPatients'),

    _modelQueryParams: function _modelQueryParams() {
      return {
        mapReduce: 'patient_by_admission'
      };
    }
  });
});
define("hospitalrun/patients/admitted/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "e9lk7Mce", "block": "{\"statements\":[[\"partial\",\"patients/index\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/patients/admitted/template.hbs" } });
});
define('hospitalrun/patients/delete/controller', ['exports', 'hospitalrun/controllers/abstract-delete-controller', 'hospitalrun/mixins/patient-visits', 'hospitalrun/mixins/patient-appointments', 'hospitalrun/mixins/patient-invoices', 'hospitalrun/mixins/pouchdb', 'hospitalrun/mixins/progress-dialog', 'ember', 'ember-i18n', 'ember-concurrency'], function (exports, _hospitalrunControllersAbstractDeleteController, _hospitalrunMixinsPatientVisits, _hospitalrunMixinsPatientAppointments, _hospitalrunMixinsPatientInvoices, _hospitalrunMixinsPouchdb, _hospitalrunMixinsProgressDialog, _ember, _emberI18n, _emberConcurrency) {
  exports['default'] = _hospitalrunControllersAbstractDeleteController['default'].extend(_hospitalrunMixinsPatientVisits['default'], _hospitalrunMixinsPatientInvoices['default'], _hospitalrunMixinsPouchdb['default'], _hospitalrunMixinsProgressDialog['default'], _hospitalrunMixinsPatientAppointments['default'], {
    title: (0, _emberI18n.translationMacro)('patients.titles.delete'),
    progressTitle: (0, _emberI18n.translationMacro)('patients.titles.deletePatientRecord'),
    progressMessage: (0, _emberI18n.translationMacro)('patients.messages.deletingPatient'),
    deleting: (0, _emberConcurrency.taskGroup)(),

    deleteMany: function deleteMany(manyArray) {
      return this.get('deleteManyTask').perform(manyArray);
    },

    deleteManyTask: (0, _emberConcurrency.task)(regeneratorRuntime.mark(function callee$0$0(manyArray) {
      var resolvedArray, deleteRecordTask, archivePromises;
      return regeneratorRuntime.wrap(function callee$0$0$(context$1$0) {
        while (1) switch (context$1$0.prev = context$1$0.next) {
          case 0:
            if (manyArray) {
              context$1$0.next = 2;
              break;
            }

            return context$1$0.abrupt('return');

          case 2:
            context$1$0.next = 4;
            return manyArray;

          case 4:
            resolvedArray = context$1$0.sent;

            if (!_ember['default'].isEmpty(resolvedArray)) {
              context$1$0.next = 7;
              break;
            }

            return context$1$0.abrupt('return');

          case 7:
            deleteRecordTask = this.get('deleteRecordTask');
            archivePromises = [];

            resolvedArray.forEach(function (recordToDelete) {
              archivePromises.push(deleteRecordTask.perform(recordToDelete));
            });
            context$1$0.next = 12;
            return (0, _emberConcurrency.all)(archivePromises, 'async array deletion');

          case 12:
            return context$1$0.abrupt('return', context$1$0.sent);

          case 13:
          case 'end':
            return context$1$0.stop();
        }
      }, callee$0$0, this);
    })).group('deleting'),

    deleteRecordTask: (0, _emberConcurrency.task)(regeneratorRuntime.mark(function callee$0$0(recordToDelete) {
      return regeneratorRuntime.wrap(function callee$0$0$(context$1$0) {
        while (1) switch (context$1$0.prev = context$1$0.next) {
          case 0:
            recordToDelete.set('archived', true);
            context$1$0.next = 3;
            return recordToDelete.save();

          case 3:
            context$1$0.next = 5;
            return recordToDelete.unloadRecord();

          case 5:
            return context$1$0.abrupt('return', context$1$0.sent);

          case 6:
          case 'end':
            return context$1$0.stop();
        }
      }, callee$0$0, this);
    })).group('deleting'),

    // Override delete action on controller; we must delete
    // all related records before deleting patient record
    // otherwise errors will occur
    deletePatient: function deletePatient() {
      return this.get('deletePatientTask').perform();
    },

    deletePatientTask: (0, _emberConcurrency.task)(regeneratorRuntime.mark(function callee$0$0() {
      var patient, visits, invoices, appointments, payments;
      return regeneratorRuntime.wrap(function callee$0$0$(context$1$0) {
        while (1) switch (context$1$0.prev = context$1$0.next) {
          case 0:
            patient = this.get('model');
            context$1$0.next = 3;
            return this.getPatientVisits(patient);

          case 3:
            visits = context$1$0.sent;
            context$1$0.next = 6;
            return this.getPatientInvoices(patient);

          case 6:
            invoices = context$1$0.sent;
            context$1$0.next = 9;
            return this.getPatientAppointments(patient);

          case 9:
            appointments = context$1$0.sent;
            context$1$0.next = 12;
            return patient.get('payments');

          case 12:
            payments = context$1$0.sent;
            context$1$0.next = 15;
            return (0, _emberConcurrency.all)([this.deleteVisits(visits), this.deleteInvoices(invoices), this.deleteMany(appointments), this.deleteMany(payments)]);

          case 15:
            context$1$0.next = 17;
            return patient.destroyRecord();

          case 17:
            return context$1$0.abrupt('return', context$1$0.sent);

          case 18:
          case 'end':
            return context$1$0.stop();
        }
      }, callee$0$0, this);
    })).group('deleting'),

    deleteVisits: function deleteVisits(visits) {
      return this.get('deleteVisitsTask').perform(visits);
    },

    deleteVisitsTask: (0, _emberConcurrency.task)(regeneratorRuntime.mark(function callee$0$0(visits) {
      var pendingTasks;
      return regeneratorRuntime.wrap(function callee$0$0$(context$1$0) {
        var _this = this;

        while (1) switch (context$1$0.prev = context$1$0.next) {
          case 0:
            pendingTasks = [];

            visits.forEach(function (visit) {
              var labs = visit.get('labs');
              var procedures = visit.get('procedures');
              var imaging = visit.get('imaging');
              var procCharges = procedures.get('charges');
              var labCharges = labs.get('charges');
              var imagingCharges = imaging.get('charges');
              var visitCharges = visit.get('charges');
              pendingTasks.push(_this.deleteMany(labs));
              pendingTasks.push(_this.deleteMany(labCharges));
              pendingTasks.push(_this.deleteMany(visit.get('patientNotes')));
              pendingTasks.push(_this.deleteMany(visit.get('vitals')));
              pendingTasks.push(_this.deleteMany(procedures));
              pendingTasks.push(_this.deleteMany(procCharges));
              pendingTasks.push(_this.deleteMany(visit.get('medication')));
              pendingTasks.push(_this.deleteMany(imaging));
              pendingTasks.push(_this.deleteMany(imagingCharges));
              pendingTasks.push(_this.deleteMany(visitCharges));
            });
            context$1$0.next = 4;
            return (0, _emberConcurrency.all)(pendingTasks);

          case 4:
            context$1$0.next = 6;
            return this.deleteMany(visits);

          case 6:
            return context$1$0.abrupt('return', context$1$0.sent);

          case 7:
          case 'end':
            return context$1$0.stop();
        }
      }, callee$0$0, this);
    })).group('deleting'),

    deleteInvoices: function deleteInvoices(patientInvoices) {
      return this.get('deleteInvoicesTask').perform(patientInvoices);
    },

    deleteInvoicesTask: (0, _emberConcurrency.task)(regeneratorRuntime.mark(function callee$0$0(patientInvoices) {
      var invoices, lineItems, lineItemDetails;
      return regeneratorRuntime.wrap(function callee$0$0$(context$1$0) {
        while (1) switch (context$1$0.prev = context$1$0.next) {
          case 0:
            context$1$0.next = 2;
            return patientInvoices;

          case 2:
            invoices = context$1$0.sent;
            context$1$0.next = 5;
            return (0, _emberConcurrency.all)(invoices.mapBy('lineItems'));

          case 5:
            lineItems = context$1$0.sent;
            context$1$0.next = 8;
            return (0, _emberConcurrency.all)(lineItems.mapBy('details'));

          case 8:
            lineItemDetails = context$1$0.sent;
            context$1$0.next = 11;
            return (0, _emberConcurrency.all)([this.deleteMany(invoices), this.deleteMany(lineItems), this.deleteMany(lineItemDetails)]);

          case 11:
            return context$1$0.abrupt('return', context$1$0.sent);

          case 12:
          case 'end':
            return context$1$0.stop();
        }
      }, callee$0$0, this);
    })).group('deleting'),

    deleteActionTask: (0, _emberConcurrency.task)(regeneratorRuntime.mark(function callee$0$0(patient) {
      return regeneratorRuntime.wrap(function callee$0$0$(context$1$0) {
        while (1) switch (context$1$0.prev = context$1$0.next) {
          case 0:
            // delete related records without modal dialogs
            this.send('closeModal');
            this.showProgressModal();
            context$1$0.next = 4;
            return this.deletePatient(patient);

          case 4:
            this.closeProgressModal();
            this.send(this.get('afterDeleteAction'), patient);

          case 6:
          case 'end':
            return context$1$0.stop();
        }
      }, callee$0$0, this);
    })).drop(),

    actions: {
      'delete': function _delete(patient) {
        this.get('deleteActionTask').perform(patient);
      }
    }
  });
});

// empty array: no records to delete
define("hospitalrun/patients/delete/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "SMvuTzOG", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-warning-sign\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"t\"],[\"messages.delete\"],[[\"name\"],[[\"get\",[\"model\",\"shortDisplayName\"]]]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/patients/delete/template.hbs" } });
});
define('hospitalrun/patients/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'hospitalrun/mixins/allergy-actions', 'hospitalrun/mixins/blood-types', 'hospitalrun/mixins/diagnosis-actions', 'ember', 'hospitalrun/mixins/patient-id', 'hospitalrun/mixins/patient-notes', 'hospitalrun/mixins/return-to', 'hospitalrun/utils/select-values', 'hospitalrun/mixins/user-session', 'hospitalrun/utils/visit-statuses', 'hospitalrun/mixins/patient-visits'], function (exports, _hospitalrunControllersAbstractEditController, _hospitalrunMixinsAllergyActions, _hospitalrunMixinsBloodTypes, _hospitalrunMixinsDiagnosisActions, _ember, _hospitalrunMixinsPatientId, _hospitalrunMixinsPatientNotes, _hospitalrunMixinsReturnTo, _hospitalrunUtilsSelectValues, _hospitalrunMixinsUserSession, _hospitalrunUtilsVisitStatuses, _hospitalrunMixinsPatientVisits) {
  var get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsAllergyActions['default'], _hospitalrunMixinsBloodTypes['default'], _hospitalrunMixinsDiagnosisActions['default'], _hospitalrunMixinsReturnTo['default'], _hospitalrunMixinsUserSession['default'], _hospitalrunMixinsPatientId['default'], _hospitalrunMixinsPatientNotes['default'], _hospitalrunMixinsPatientVisits['default'], {

    canAddAppointment: (function () {
      return this.currentUserCan('add_appointment');
    }).property(),

    canAddContact: (function () {
      return this.currentUserCan('add_patient');
    }).property(),

    canAddImaging: (function () {
      return this.currentUserCan('add_imaging');
    }).property(),

    canAddLab: (function () {
      return this.currentUserCan('add_lab');
    }).property(),

    canAddMedication: (function () {
      return this.currentUserCan('add_medication');
    }).property(),

    canAddPhoto: (function () {
      var isFileSystemEnabled = this.get('isFileSystemEnabled');
      return this.currentUserCan('add_photo') && isFileSystemEnabled;
    }).property(),

    canAddSocialWork: (function () {
      return this.currentUserCan('add_socialwork');
    }).property(),

    canAddVisit: (function () {
      return this.currentUserCan('add_visit');
    }).property(),

    canDeleteAppointment: (function () {
      return this.currentUserCan('delete_appointment');
    }).property(),

    canDeleteContact: (function () {
      return this.currentUserCan('add_patient');
    }).property(),

    canDeleteImaging: (function () {
      return this.currentUserCan('delete_imaging');
    }).property(),

    canDeleteLab: (function () {
      return this.currentUserCan('delete_lab');
    }).property(),

    canDeleteMedication: (function () {
      return this.currentUserCan('delete_medication');
    }).property(),

    canDeletePhoto: (function () {
      return this.currentUserCan('delete_photo');
    }).property(),

    canDeleteSocialWork: (function () {
      return this.currentUserCan('delete_socialwork');
    }).property(),

    canDeleteVisit: (function () {
      return this.currentUserCan('delete_visit');
    }).property(),

    patientTypes: _ember['default'].computed(function () {
      var i18n = get(this, 'i18n');
      var types = ['Charity', 'Private'];
      return types.map(function (type) {
        return i18n.t('patients.labels.patientType' + type);
      });
    }),

    config: _ember['default'].inject.service(),
    filesystem: _ember['default'].inject.service(),
    database: _ember['default'].inject.service(),
    patientController: _ember['default'].inject.controller('patients'),

    addressOptions: _ember['default'].computed.alias('patientController.addressOptions'),
    address1Include: _ember['default'].computed.alias('patientController.addressOptions.value.address1Include'),
    address1Label: _ember['default'].computed.alias('patientController.addressOptions.value.address1Label'),
    address2Include: _ember['default'].computed.alias('patientController.addressOptions.value.address2Include'),
    address2Label: _ember['default'].computed.alias('patientController.addressOptions.value.address2Label'),
    address3Include: _ember['default'].computed.alias('patientController.addressOptions.value.address3Include'),
    address3Label: _ember['default'].computed.alias('patientController.addressOptions.value.address3Label'),
    address4Include: _ember['default'].computed.alias('patientController.addressOptions.value.address4Include'),
    address4Label: _ember['default'].computed.alias('patientController.addressOptions.value.address4Label'),

    clinicList: _ember['default'].computed.alias('patientController.clinicList'),
    countryList: _ember['default'].computed.alias('patientController.countryList'),
    diagnosisList: _ember['default'].computed.alias('patientController.diagnosisList'),
    isFileSystemEnabled: _ember['default'].computed.alias('filesystem.isFileSystemEnabled'),
    pricingProfiles: _ember['default'].computed.map('patientController.pricingProfiles', _hospitalrunUtilsSelectValues['default'].selectObjectMap),
    sexList: _ember['default'].computed.alias('patientController.sexList'),
    statusList: _ember['default'].computed.alias('patientController.statusList'),

    haveAdditionalContacts: (function () {
      var additionalContacts = this.get('model.additionalContacts');
      return !_ember['default'].isEmpty(additionalContacts);
    }).property('model.additionalContacts'),

    haveAddressOptions: (function () {
      var addressOptions = this.get('addressOptions');
      return !_ember['default'].isEmpty(addressOptions);
    }).property('addressOptions'),

    lookupListsToUpdate: [{
      name: 'countryList',
      property: 'model.country',
      id: 'country_list'
    }, {
      name: 'clinicList',
      property: 'model.clinic',
      id: 'clinic_list'
    }, {
      name: 'sexList',
      property: 'model.sex',
      id: 'sex'
    }, {
      name: 'statusList',
      property: 'model.status',
      id: 'patient_status_list'
    }],

    patientImaging: (function () {
      return this.getVisitCollection('imaging');
    }).property('model.visits.[].imaging'),

    patientLabs: (function () {
      return this.getVisitCollection('labs');
    }).property('model.visits.[].labs'),

    patientMedications: (function () {
      return this.getVisitCollection('medication');
    }).property('model.visits.[].medication'),

    patientProcedures: (function () {
      var visits = this.get('model.visits');
      var operationReports = get(this, 'model.operationReports');
      return this._getPatientProcedures(operationReports, visits);
    }).property('model.visits.[].procedures', 'model.operationReports.[].procedures'),

    showExpenseTotal: (function () {
      var expenses = this.get('model.expenses');
      return !_ember['default'].isEmpty(expenses);
    }).property('model.expenses.[]'),

    totalExpenses: (function () {
      var expenses = this.get('model.expenses');
      if (!_ember['default'].isEmpty(expenses)) {
        var total = expenses.reduce(function (previousValue, expense) {
          if (!_ember['default'].isEmpty(expense.cost)) {
            return previousValue + parseInt(expense.cost);
          }
        }, 0);
        return total;
      }
    }).property('model.expenses.@each.cost'),

    updateCapability: 'add_patient',

    actions: {
      addAllergy: function addAllergy(newAllergy) {
        var patient = get(this, 'model');
        this.savePatientAllergy(patient, newAllergy);
      },

      addContact: function addContact(newContact) {
        var additionalContacts = this.getWithDefault('model.additionalContacts', []);
        var model = this.get('model');
        additionalContacts.addObject(newContact);
        model.set('additionalContacts', additionalContacts);
        this.send('update', true);
        this.send('closeModal');
      },

      addDiagnosis: function addDiagnosis(newDiagnosis) {
        var diagnoses = this.get('model.diagnoses');
        diagnoses.addObject(newDiagnosis);
        this.send('update', true);
        this.send('closeModal');
      },

      returnToPatient: function returnToPatient() {
        this.transitionToRoute('patients.index');
      },
      /**
       * Add the specified photo to the patient's record.
       */
      addPhoto: function addPhoto(savedPhotoRecord) {
        var photos = this.get('model.photos');
        photos.addObject(savedPhotoRecord);
        this.send('closeModal');
      },

      appointmentDeleted: function appointmentDeleted(deletedAppointment) {
        var appointments = this.get('model.appointments');
        appointments.removeObject(deletedAppointment);
        this.send('closeModal');
      },

      deleteAllergy: function deleteAllergy(allergy) {
        var patient = get(this, 'model');
        this.deletePatientAllergy(patient, allergy);
      },

      deleteContact: function deleteContact(model) {
        var contact = model.get('contactToDelete');
        var additionalContacts = this.get('model.additionalContacts');
        additionalContacts.removeObject(contact);
        this.send('update', true);
      },

      deleteExpense: function deleteExpense(model) {
        var expense = model.get('expenseToDelete');
        var expenses = this.get('model.expenses');
        expenses.removeObject(expense);
        this.send('update', true);
      },

      deleteFamily: function deleteFamily(model) {
        var family = model.get('familyToDelete');
        var familyInfo = this.get('model.familyInfo');
        familyInfo.removeObject(family);
        this.send('update', true);
      },

      deletePhoto: function deletePhoto(model) {
        var photo = model.get('photoToDelete');
        var photoId = photo.get('id');
        var photos = this.get('model.photos');
        var filePath = photo.get('fileName');
        photos.removeObject(photo);
        photo.destroyRecord().then((function () {
          var fileSystem = this.get('filesystem');
          var isFileSystemEnabled = this.get('isFileSystemEnabled');
          if (isFileSystemEnabled) {
            var pouchDbId = this.get('database').getPouchId(photoId, 'photo');
            fileSystem.deleteFile(filePath, pouchDbId);
          }
        }).bind(this));
      },

      editAppointment: function editAppointment(appointment) {
        if (this.get('canAddAppointment')) {
          appointment.set('returnToPatient', this.get('model.id'));
          appointment.set('returnTo', null);
          this.transitionToRoute('appointments.edit', appointment);
        }
      },

      editImaging: function editImaging(imaging) {
        if (this.get('canAddImaging')) {
          if (imaging.get('canEdit')) {
            imaging.set('returnToPatient', this.get('model.id'));
            this.transitionToRoute('imaging.edit', imaging);
          }
        }
      },

      editLab: function editLab(lab) {
        if (this.get('canAddLab')) {
          if (lab.get('canEdit')) {
            lab.setProperties('returnToPatient', this.get('model.id'));
            this.transitionToRoute('labs.edit', lab);
          }
        }
      },

      editMedication: function editMedication(medication) {
        if (this.get('canAddMedication')) {
          if (medication.get('canEdit')) {
            medication.set('returnToPatient', this.get('model.id'));
            this.transitionToRoute('medication.edit', medication);
          }
        }
      },

      editOperativePlan: function editOperativePlan(operativePlan) {
        var _this = this;

        var model = operativePlan;
        if (isEmpty(model)) {
          this._addChildObject('patients.operative-plan', function (route) {
            route.controller.getPatientDiagnoses(_this.get('model'), route.currentModel);
          });
        } else {
          model.set('returnToVisit');
          model.set('returnToPatient', this.get('model.id'));
          this.transitionToRoute('patients.operative-plan', model);
        }
      },

      editOperationReport: function editOperationReport(operationReport) {
        operationReport.set('returnToPatient', this.get('model.id'));
        this.transitionToRoute('patients.operation-report', operationReport);
      },

      editPhoto: function editPhoto(photo) {
        this.send('openModal', 'patients.photo', photo);
      },

      editProcedure: function editProcedure(procedure) {
        if (this.get('canAddVisit')) {
          procedure.set('patient', this.get('model'));
          procedure.set('returnToVisit');
          procedure.set('returnToPatient', this.get('model.id'));
          this.transitionToRoute('procedures.edit', procedure);
        }
      },

      editVisit: function editVisit(visit) {
        if (this.get('canAddVisit')) {
          visit.set('returnToPatient', this.get('model.id'));
          this.transitionToRoute('visits.edit', visit);
        }
      },

      newAppointment: function newAppointment() {
        this._addChildObject('appointments.edit');
      },

      newImaging: function newImaging() {
        this._addChildObject('imaging.edit');
      },

      newLab: function newLab() {
        this._addChildObject('labs.edit');
      },

      newMedication: function newMedication() {
        this._addChildObject('medication.edit');
      },

      newSurgicalAppointment: function newSurgicalAppointment() {
        var _this2 = this;

        this.transitionToRoute('appointments.edit', 'newsurgery').then(function (newRoute) {
          newRoute.currentModel.setProperties({
            patient: _this2.get('model'),
            returnToPatient: _this2.get('model.id'),
            selectPatient: false
          });
        });
      },

      newVisit: function newVisit() {
        var patient = this.get('model');
        this.send('createNewVisit', patient, true);
      },

      showAddContact: function showAddContact() {
        this.send('openModal', 'patients.add-contact', {});
      },

      showAddPhoto: function showAddPhoto() {
        var newPatientPhoto = this.get('store').createRecord('photo', {
          patient: this.get('model'),
          saveToDir: this.get('model.id') + '/photos/'
        });
        this.send('openModal', 'patients.photo', newPatientPhoto);
      },

      showAddPatientNote: function showAddPatientNote(model) {
        if (this.get('canAddNote')) {
          if (_ember['default'].isEmpty(model)) {
            model = this.get('store').createRecord('patient-note', {
              patient: this.get('model'),
              createdBy: this.getUserName()
            });
          }
          this.send('openModal', 'patients.notes', model);
        }
      },

      showDeleteAppointment: function showDeleteAppointment(appointment) {
        appointment.set('deleteFromPatient', true);
        this.send('openModal', 'appointments.delete', appointment);
      },

      showDeleteContact: function showDeleteContact(contact) {
        this.send('openModal', 'dialog', _ember['default'].Object.create({
          confirmAction: 'deleteContact',
          title: this.get('i18n').t('patients.titles.deleteContact'),
          message: this.get('i18n').t('patients.titles.deletePhoto', { object: 'contact' }),
          contactToDelete: contact,
          updateButtonAction: 'confirm',
          updateButtonText: this.get('i18n').t('buttons.ok')
        }));
      },

      showDeleteExpense: function showDeleteExpense(expense) {
        this.send('openModal', 'dialog', _ember['default'].Object.create({
          confirmAction: 'deleteExpense',
          title: this.get('i18n').t('patients.titles.deleteExpense'),
          message: this.get('i18n').t('patients.titles.deletePhoto', { object: 'expense' }),
          expenseToDelete: expense,
          updateButtonAction: 'confirm',
          updateButtonText: this.get('i18n').t('buttons.ok')
        }));
      },

      showDeleteFamily: function showDeleteFamily(familyInfo) {
        this.send('openModal', 'dialog', _ember['default'].Object.create({
          confirmAction: 'deleteFamily',
          title: this.get('i18n').t('patients.titles.deleteFamilyMember'),
          message: this.get('i18n').t('patients.titles.deletePhoto', { object: 'family member' }),
          familyToDelete: familyInfo,
          updateButtonAction: 'confirm',
          updateButtonText: this.get('i18n').t('buttons.ok')
        }));
      },

      showDeleteImaging: function showDeleteImaging(imaging) {
        this.send('openModal', 'imaging.delete', imaging);
      },

      showDeleteLab: function showDeleteLab(lab) {
        this.send('openModal', 'labs.delete', lab);
      },

      showDeleteMedication: function showDeleteMedication(medication) {
        this.send('openModal', 'medication.delete', medication);
      },

      showDeletePhoto: function showDeletePhoto(photo) {
        this.send('openModal', 'dialog', _ember['default'].Object.create({
          confirmAction: 'deletePhoto',
          title: this.get('i18n').t('patients.titles.deletePhoto'),
          message: this.get('i18n').t('patients.titles.deletePhoto', { object: 'photo' }),
          photoToDelete: photo,
          updateButtonAction: 'confirm',
          updateButtonText: this.get('i18n').t('buttons.ok')
        }));
      },

      showDeleteVisit: function showDeleteVisit(visit) {
        visit.set('deleteFromPatient', true);
        this.send('openModal', 'visits.delete', visit);
      },

      showEditExpense: function showEditExpense(expenseInfo) {
        this._showEditSocial(expenseInfo, 'social-expense', 'expense');
      },

      showEditFamily: function showEditFamily(familyInfo) {
        this._showEditSocial(familyInfo, 'family-info', 'family-info');
      },

      updateExpense: function updateExpense(model) {
        this._updateSocialRecord(model, 'expenses');
      },

      updateFamilyInfo: function updateFamilyInfo(model) {
        this._updateSocialRecord(model, 'familyInfo');
      },

      visitDeleted: function visitDeleted(deletedVisit) {
        var _this3 = this;

        var visits = this.get('model.visits');
        var patient = this.get('model');
        var patientCheckedIn = patient.get('checkedIn');
        var patientAdmitted = patient.get('admitted');
        visits.removeObject(deletedVisit);
        if (patientAdmitted || patientCheckedIn) {
          var patientUpdate = false;
          if (patientAdmitted && _ember['default'].isEmpty(visits.findBy('status', _hospitalrunUtilsVisitStatuses['default'].ADMITTED))) {
            patient.set('admitted', false);
            patientUpdate = true;
          }
          if (patientCheckedIn && _ember['default'].isEmpty(visits.findBy('status', _hospitalrunUtilsVisitStatuses['default'].CHECKED_IN))) {
            patient.set('checkedIn', false);
            patientUpdate = true;
          }
          if (patientUpdate === true) {
            patient.save().then(function () {
              return _this3.send('closeModal');
            });
          } else {
            this.send('closeModal');
          }
        } else {
          this.send('closeModal');
        }
      }

    },

    _addChildObject: function _addChildObject(route, afterTransition) {
      var options = {
        queryParams: {
          forPatientId: this.get('model.id')
        }
      };
      this.transitionToRoute(route, 'new', options).then(function (newRoute) {
        if (afterTransition) {
          afterTransition(newRoute);
        }
      });
    },

    _showEditSocial: function _showEditSocial(editAttributes, modelName, route) {
      var model = undefined;
      if (_ember['default'].isEmpty(editAttributes)) {
        model = this.get('store').createRecord(modelName, {
          newRecord: true
        });
      } else {
        model = this.get('store').push({
          data: {
            id: _ember['default'].get(editAttributes, 'id'),
            type: modelName,
            attributes: editAttributes
          }
        });
      }
      this.send('openModal', 'patients.socialwork.' + route, model);
    },

    getVisitCollection: function getVisitCollection(name) {
      var visits = this.get('model.visits');
      return this._getVisitCollection(visits, name);
    },

    _updateSocialRecord: function _updateSocialRecord(recordToUpdate, name) {
      var socialRecords = this.getWithDefault('model.' + name, []);
      var isNew = recordToUpdate.get('isNew');
      var patient = this.get('model');
      var objectToUpdate = recordToUpdate.serialize();
      objectToUpdate.id = recordToUpdate.get('id');
      if (isNew) {
        socialRecords.addObject(_ember['default'].Object.create(objectToUpdate));
      } else {
        var updateRecord = socialRecords.findBy('id', objectToUpdate.id);
        _ember['default'].setProperties(updateRecord, objectToUpdate);
      }
      patient.set(name, socialRecords);
      this.send('update', true);
      this.send('closeModal');
    },

    _updateSequence: function _updateSequence(record) {
      var _this4 = this;

      var config = this.get('config');
      var friendlyId = record.get('friendlyId');
      return config.getPatientPrefix().then(function (prefix) {
        var re = new RegExp('^' + prefix + '\\d{5}$');
        if (!re.test(friendlyId)) {
          return;
        }
        return _this4.store.find('sequence', 'patient').then(function (sequence) {
          var sequenceNumber = sequence.get('value');
          var patientNumber = parseInt(friendlyId.slice(prefix.length));
          if (patientNumber > sequenceNumber) {
            sequence.set('value', patientNumber);
            return sequence.save();
          }
        });
      });
    },

    beforeUpdate: function beforeUpdate() {
      var _this5 = this;

      if (!this.get('model.isNew')) {
        return _ember['default'].RSVP.resolve();
      }
      return this.generateFriendlyId('patient').then(function (friendlyId) {
        _this5.model.set('friendlyId', friendlyId);
      });
    },

    afterUpdate: function afterUpdate(record) {
      var _this6 = this;

      this._updateSequence(record).then(function () {
        $('.message').show();
        $('.message').text(_this6.get('i18n').t('patients.messages.savedPatient', record));
        $('.message').delay(3000).fadeOut(100);
      });
    }

  });
});
define('hospitalrun/patients/edit/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'ember', 'hospitalrun/mixins/patient-visits', 'hospitalrun/mixins/patient-notes', 'hospitalrun/mixins/pouchdb', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractEditRoute, _ember, _hospitalrunMixinsPatientVisits, _hospitalrunMixinsPatientNotes, _hospitalrunMixinsPouchdb, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend(_hospitalrunMixinsPatientVisits['default'], _hospitalrunMixinsPouchdb['default'], _hospitalrunMixinsPatientNotes['default'], {
    customForms: _ember['default'].inject.service(),
    editTitle: (0, _emberI18n.translationMacro)('patients.titles.edit'),
    modelName: 'patient',
    newTitle: (0, _emberI18n.translationMacro)('patients.titles.new'),
    photos: null,

    actions: {
      updateNote: function updateNote(note) {
        note.get('visit').save().then(function () {
          // noop
        });
      },
      appointmentDeleted: function appointmentDeleted(model) {
        this.controller.send('appointmentDeleted', model);
      },
      returnToPatient: function returnToPatient() {
        this.controller.send('returnToPatient');
      },
      deleteContact: function deleteContact(model) {
        this.controller.send('deleteContact', model);
      },

      deleteExpense: function deleteExpense(model) {
        this.controller.send('deleteExpense', model);
      },

      deleteFamily: function deleteFamily(model) {
        this.controller.send('deleteFamily', model);
      },

      deletePhoto: function deletePhoto(model) {
        this.controller.send('deletePhoto', model);
      },

      updateExpense: function updateExpense(model) {
        this.controller.send('updateExpense', model);
      },

      updateFamilyInfo: function updateFamilyInfo(model) {
        this.controller.send('updateFamilyInfo', model);
      },

      visitDeleted: function visitDeleted(model) {
        this.controller.send('visitDeleted', model);
      }
    },

    getNewData: function getNewData() {
      var customForms = this.get('customForms');
      var newPatientData = {
        customForms: _ember['default'].Object.create()
      };
      return customForms.setDefaultCustomForms(['patient', 'socialwork'], newPatientData);
    },

    setupController: function setupController(controller, model) {
      // Load appointments, photos and visits asynchronously.
      var friendlyId = model.get('friendlyId');
      var externalId = model.get('externalPatientId');
      var maxValue = this.get('maxValue');
      var patientId = model.get('id');
      if (_ember['default'].isEmpty(friendlyId) && !_ember['default'].isEmpty(externalId)) {
        model.set('friendlyId', externalId);
      }
      this._super(controller, model);
      this.getPatientVisits(model).then(function (visits) {
        model.set('visits', visits);
      });
      this.store.query('appointment', {
        options: {
          startkey: [patientId, null, null, 'appointment_'],
          endkey: [patientId, maxValue, maxValue, maxValue]
        },
        mapReduce: 'appointments_by_patient'
      }).then(function (appointments) {
        model.set('appointments', appointments);
      });
      this.store.query('photo', {
        options: {
          key: patientId
        },
        mapReduce: 'photo_by_patient'
      }).then(function (photos) {
        var patientPhotos = [];
        patientPhotos.addObjects(photos);
        model.set('photos', patientPhotos);
      });
    }

  });
});
define("hospitalrun/patients/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "oQuMyGUt", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],52]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"                    \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"colspan\",\"2\"],[\"flush-element\"],[\"open-element\",\"b\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.labels.totalMontlyExpense\"],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"totalExpenses\"]],false],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                          \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteExpense\",[\"get\",[\"expense\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                            \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"text\",\"\\n                          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                    \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"expense\",\"category\"]],false],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"expense\",\"sources\"]],false],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"expense\",\"cost\"]],false],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n                        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showEditExpense\",[\"get\",[\"expense\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canDeleteSocialWork\"]]],null,1],[\"text\",\"                      \"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"expense\"]},{\"statements\":[[\"text\",\"                          \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteFamily\",[\"get\",[\"info\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                            \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"text\",\"\\n                          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                    \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"info\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"info\",\"age\"]],false],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"info\",\"civilStatus\"]],false],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"info\",\"relationship\"]],false],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"info\",\"education\"]],false],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"info\",\"occupation\"]],false],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"info\",\"income\"]],false],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"info\",\"insurance\"]],false],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n                        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showEditFamily\",[\"get\",[\"info\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canDeleteSocialWork\"]]],null,3],[\"text\",\"                      \"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"info\"]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"role\",\"tabpanel\"],[\"static-attr\",\"class\",\"tab-pane\"],[\"static-attr\",\"id\",\"social\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"h4\",[]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"append\",[\"helper\",[\"t\"],[\"patients.titles.familyInformation\"],null],false],[\"text\",\"\\n                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showEditFamily\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"patients.buttons.addFamilyMember\"],null],false],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.name\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.age\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.labels.civilStatus\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.labels.relationship\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.labels.education\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.labels.occupation\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.labels.income\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.labels.insurance\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.action\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"familyInfo\"]]],null,4],[\"text\",\"                \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"h4\",[]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"append\",[\"helper\",[\"t\"],[\"patients.titles.expenses\"],null],false],[\"text\",\"\\n                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showEditExpense\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.buttons.addExpense\"],null],false],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.category\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.labels.sources\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.labels.monthlyCost\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"expenses\"]]],null,2],[\"block\",[\"if\"],[[\"get\",[\"showExpenseTotal\"]]],null,0],[\"text\",\"                \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"custom-form-manager\"],null,[[\"model\",\"formType\"],[[\"get\",[\"model\"]],\"socialwork\"]]],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newLab\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"patients.buttons.newLab\"],null],false],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newImaging\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"patients.buttons.newImaging\"],null],false],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newMedication\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.buttons.newMedication\"],null],false],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteVisit\",[\"get\",[\"visit\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editVisit\",[\"get\",[\"visit\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"tr\",[]],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editVisit\",[\"get\",[\"visit\"]]]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"visit\",\"startDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"visit\",\"endDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"visit\",\"primaryDiagnoses\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"visit\",\"examiner\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"visit\",\"location\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"visit\",\"visitType\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddVisit\"]]],null,10],[\"block\",[\"if\"],[[\"get\",[\"canDeleteVisit\"]]],null,9],[\"text\",\"                    \"],[\"close-element\"],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"visit\"]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newVisit\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"patients.buttons.newVisit\"],null],false],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteAppointment\",[\"get\",[\"appointment\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                          \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"text\",\"\\n                        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editAppointment\",[\"get\",[\"appointment\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"tr\",[]],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editAppointment\",[\"get\",[\"appointment\"]]]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"appointment\",\"formattedAppointmentDate\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"appointment\",\"provider\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"appointment\",\"location\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"appointment\",\"appointmentType\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"appointment\",\"displayStatus\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddAppointment\"]]],null,14],[\"block\",[\"if\"],[[\"get\",[\"canDeleteAppointment\"]]],null,13],[\"text\",\"                    \"],[\"close-element\"],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"appointment\"]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"right\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newAppointment\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.buttons.newAppointment\"],null],false],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\" \\n                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newSurgicalAppointment\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.buttons.scheduleSurgery\"],null],false],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                            \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeletePhoto\",[\"get\",[\"photo\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                              \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"text\",\"\\n                            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                            \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editPhoto\",[\"get\",[\"photo\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-sm-4 col-md-3\"],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"thumbnail\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editPhoto\",[\"get\",[\"photo\"]]]],[\"flush-element\"],[\"text\",\"\\n                      \"],[\"append\",[\"helper\",[\"photo-display\"],null,[[\"photo\"],[[\"get\",[\"photo\"]]]]],false],[\"text\",\"\\n                      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"caption\"],[\"flush-element\"],[\"text\",\"\\n                        \"],[\"append\",[\"unknown\",[\"photo\",\"caption\"]],false],[\"text\",\"\\n                        \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddPhoto\"]]],null,18],[\"block\",[\"if\"],[[\"get\",[\"canDeletePhoto\"]]],null,17],[\"text\",\"                        \"],[\"close-element\"],[\"text\",\"\\n                      \"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"close-element\"],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"photo\"]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddPhoto\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.buttons.newPhoto\"],null],false],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"role\",\"tabpanel\"],[\"static-attr\",\"class\",\"tab-pane\"],[\"static-attr\",\"id\",\"photos\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddPhoto\"]]],null,20],[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"photos\"]]],null,19],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"role\",\"tabpanel\"],[\"static-attr\",\"class\",\"tab-pane\"],[\"static-attr\",\"id\",\"appointments\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddAppointment\"]]],null,16],[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.date\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"visits.labels.examiner\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.location\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.type\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.status\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"appointments\"]]],null,15],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"role\",\"tabpanel\"],[\"static-attr\",\"class\",\"tab-pane\"],[\"static-attr\",\"id\",\"visits\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddVisit\"]]],null,12],[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.startDate\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.endDate\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"visits.labels.diagnosis\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.provider\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.location\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.type\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"visits\"]]],null,11],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"role\",\"tabpanel\"],[\"static-attr\",\"class\",\"tab-pane\"],[\"static-attr\",\"id\",\"medication\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddMedication\"]]],null,8],[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"partial\",\"patients/medication\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"role\",\"tabpanel\"],[\"static-attr\",\"class\",\"tab-pane\"],[\"static-attr\",\"id\",\"imaging\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddImaging\"]]],null,7],[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"partial\",\"patients/imaging\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"role\",\"tabpanel\"],[\"static-attr\",\"class\",\"tab-pane\"],[\"static-attr\",\"id\",\"labs\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddLab\"]]],null,6],[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"partial\",\"patients/labs\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddSocialWork\"]]],null,5]],\"locals\":[]},{\"statements\":[[\"text\",\"                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteContact\",[\"get\",[\"additionalContact\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                        \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"text\",\"\\n                      \"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"additionalContact\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"additionalContact\",\"phone\"]],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"additionalContact\",\"email\"]],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"additionalContact\",\"relationship\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canDeleteContact\"]]],null,22],[\"text\",\"                \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"additionalContact\"]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.action\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"h4\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.titles.additionalContacts\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.name\"],null],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.labels.phone\"],null],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.email\"],null],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.labels.relationship\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canDeleteContact\"]]],null,24],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"additionalContacts\"]]],null,23],[\"text\",\"            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"append\",[\"helper\",[\"em-text\"],null,[[\"label\",\"property\",\"rows\",\"class\"],[[\"helper\",[\"t\"],[\"labels.address\"],null],\"address\",3,\"col-xs-12 col-sm-6\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"address4Label\"]],\"address4\",\"col-xs-12 col-sm-6\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"address3Label\"]],\"address3\",\"col-xs-12 col-sm-6\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"address2Label\"]],\"address2\",\"col-xs-12 col-sm-6\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"append\",[\"helper\",[\"em-text\"],null,[[\"label\",\"property\",\"rows\",\"class\"],[[\"get\",[\"address1Label\"]],\"address\",3,\"col-xs-12 col-sm-6\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"address1Include\"]]],null,30],[\"block\",[\"if\"],[[\"get\",[\"address2Include\"]]],null,29],[\"block\",[\"if\"],[[\"get\",[\"address3Include\"]]],null,28],[\"block\",[\"if\"],[[\"get\",[\"address4Include\"]]],null,27]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddContact\"],[[\"bubbles\",\"on\"],[false,\"click\"]]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.buttons.addContact\"],null],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"append\",[\"helper\",[\"t\"],[\"messages.noHistoryAvailable\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                            \"],[\"open-element\",\"h5\",[]],[\"static-attr\",\"class\",\"ph-note-heading\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"medication\",\"prescriptionDate\"]]],null],false],[\"text\",\": \"],[\"append\",[\"unknown\",[\"medication\",\"medicationName\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[[\"get\",[\"medication\",\"status\"]],\"Fulfilled\"],null]],null,34]],\"locals\":[\"medication\"]},{\"statements\":[[\"text\",\"                      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ph-note-item\"],[\"flush-element\"],[\"text\",\"\\n                        \"],[\"open-element\",\"h5\",[]],[\"static-attr\",\"class\",\"ph-note-heading\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.medication\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"visit\",\"medication\"]]],null,35],[\"text\",\"                      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                            \"],[\"open-element\",\"h5\",[]],[\"static-attr\",\"class\",\"ph-note-heading\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"lab\",\"labDate\"]]],null],false],[\"text\",\": \"],[\"append\",[\"unknown\",[\"lab\",\"labType\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[[\"get\",[\"lab\",\"status\"]],\"Completed\"],null]],null,37]],\"locals\":[\"lab\"]},{\"statements\":[[\"text\",\"                      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ph-note-item\"],[\"flush-element\"],[\"text\",\"\\n                        \"],[\"open-element\",\"h5\",[]],[\"static-attr\",\"class\",\"ph-note-heading\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.labOrders\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"visit\",\"labs\"]]],null,38],[\"text\",\"                      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                            \"],[\"open-element\",\"h5\",[]],[\"static-attr\",\"class\",\"ph-note-heading\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"imaging\",\"imagingDate\"]]],null],false],[\"text\",\": \"],[\"append\",[\"unknown\",[\"imaging\",\"imagingType\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[[\"get\",[\"imaging\",\"status\"]],\"Completed\"],null]],null,40]],\"locals\":[\"imaging\"]},{\"statements\":[[\"text\",\"                      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ph-note-item\"],[\"flush-element\"],[\"text\",\"\\n                        \"],[\"open-element\",\"h5\",[]],[\"static-attr\",\"class\",\"ph-note-heading\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.imageOrders\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"visit\",\"imaging\"]]],null,41],[\"text\",\"                      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"clickable\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editProcedure\",[\"get\",[\"procedure\"]]]],[\"flush-element\"],[\"text\",\"\\n                            \"],[\"open-element\",\"h5\",[]],[\"static-attr\",\"class\",\"ph-note-heading\"],[\"flush-element\"],[\"text\",\"\\n                              \"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"procedure\",\"procedureDate\"]]],null],false],[\"text\",\":\\n                              \"],[\"append\",[\"unknown\",[\"procedure\",\"description\"]],false],[\"text\",\"\\n                            \"],[\"close-element\"],[\"text\",\"\\n                          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"procedure\"]},{\"statements\":[[\"text\",\"                      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ph-note-item\"],[\"flush-element\"],[\"text\",\"\\n                        \"],[\"open-element\",\"h5\",[]],[\"static-attr\",\"class\",\"ph-note-heading\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.procedures\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"visit\",\"procedures\"]]],null,43],[\"text\",\"                      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"patient-history-item\"],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"patient-history-heading clickable\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editVisit\",[\"get\",[\"visit\"]]]],[\"flush-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"ph-visit-date\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"visit\",\"visitDate\"]],false],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"ph-visit-type\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"visit\",\"visitType\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"visit\",\"procedures\"]]],null,44],[\"block\",[\"if\"],[[\"get\",[\"visit\",\"hasCompletedImaging\"]]],null,42],[\"block\",[\"if\"],[[\"get\",[\"visit\",\"hasCompletedLabs\"]]],null,39],[\"block\",[\"if\"],[[\"get\",[\"visit\",\"hasCompletedMedication\"]]],null,36],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"visit\"]},{\"statements\":[[\"block\",[\"each\"],[[\"get\",[\"model\",\"visits\"]]],null,45]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading clearfix\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddPatientNote\"],[[\"bubbles\",\"on\"],[false,\"click\"]]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.newNote\"],null],false],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"role\",\"tabpanel\"],[\"static-attr\",\"class\",\"tab-pane active\"],[\"static-attr\",\"id\",\"history\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel detail-section\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddNote\"]]],null,47],[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"model\",\"visits\"]]],null,46,33],[\"text\",\"            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"flush-element\"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#social\"],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"static-attr\",\"data-test-selector\",\"social-tab\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.navigation.socialWork\"],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"patient-summary\"],null,[[\"patient\",\"patientProcedures\",\"disablePatientLink\",\"store\",\"allowAddAllergy\",\"allowAddDiagnosis\",\"allowAddOperativePlan\",\"diagnosisList\"],[[\"get\",[\"model\"]],[\"get\",[\"patientProcedures\"]],true,[\"get\",[\"store\"]],true,true,true,[\"get\",[\"diagnosisList\"]]]]],false],[\"text\",\"\\n      \"],[\"open-element\",\"ul\",[]],[\"static-attr\",\"class\",\"nav nav-pills tab-nav\"],[\"static-attr\",\"role\",\"tablist\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"static-attr\",\"class\",\"active\"],[\"flush-element\"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#history\"],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"static-attr\",\"data-test-selector\",\"history-tab\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.navigation.history\"],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"flush-element\"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#general\"],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"static-attr\",\"data-test-selector\",\"general-tab\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.navigation.general\"],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"flush-element\"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#photos\"],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"static-attr\",\"data-test-selector\",\"photos-tab\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.navigation.photos\"],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"flush-element\"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#appointments\"],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"static-attr\",\"data-test-selector\",\"appointments-tab\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.navigation.appointments\"],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"flush-element\"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#visits\"],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"static-attr\",\"data-test-selector\",\"visits-tab\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.navigation.visits\"],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"flush-element\"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#medication\"],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"static-attr\",\"data-test-selector\",\"medication-tab\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.navigation.medication\"],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"flush-element\"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#imaging\"],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"static-attr\",\"data-test-selector\",\"imaging-tab\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.navigation.imaging\"],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"flush-element\"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#labs\"],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"static-attr\",\"data-test-selector\",\"labs-tab\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.navigation.labs\"],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddSocialWork\"]]],null,49],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"unless\"],[[\"get\",[\"isNewOrDeleted\"]]],null,50],[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"tab-content\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"unless\"],[[\"get\",[\"isNewOrDeleted\"]]],null,48],[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"role\",\"tabpanel\"],[\"dynamic-attr\",\"class\",[\"concat\",[\"tab-pane \",[\"helper\",[\"if\"],[[\"get\",[\"isNewOrDeleted\"]],\"active\"],null]]]],[\"static-attr\",\"id\",\"general\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel detail-section\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-xs-12 col-sm-6\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"firstName\",[\"helper\",[\"t\"],[\"patients.labels.firstName\"],null],\"form-input-group required test-first-name\"]]],false],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"middleName\",[\"helper\",[\"t\"],[\"patients.labels.middleName\"],null],\"form-input-group test-middle-name\"]]],false],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"lastName\",[\"helper\",[\"t\"],[\"patients.labels.lastName\"],null],\"form-input-group required test-last-name\"]]],false],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"class\",\"list\",\"selection\"],[\"sex\",[\"helper\",[\"t\"],[\"patients.labels.sex\"],null],\"form-input-group\",[\"get\",[\"sexList\"]],[\"get\",[\"model\",\"sex\"]]]]],false],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\",\"maxDate\"],[\"dateOfBirth\",[\"helper\",[\"t\"],[\"patients.labels.dateOfBirth\"],null],\"form-input-group \",\"now\"]]],false],[\"text\",\"\\n                \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-input-group\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.age\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"age\"]],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"placeOfBirth\",[\"helper\",[\"t\"],[\"patients.labels.placeOfBirth\"],null],\"form-input-group\"]]],false],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"occupation\",[\"helper\",[\"t\"],[\"patients.labels.occupation\"],null],\"form-input-group\"]]],false],[\"text\",\"\\n                \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-input-group\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.labels.patientType\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"div\",[]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"append\",[\"helper\",[\"ext-radio\"],null,[[\"content\",\"value\",\"showInline\"],[[\"get\",[\"patientTypes\"]],[\"get\",[\"model\",\"patientType\"]],true]]],false],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-xs-12 col-sm-6\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"class\"],[\"status\",[\"helper\",[\"t\"],[\"patients.labels.status\"],null],[\"get\",[\"statusList\"]],[\"get\",[\"model\",\"status\"]],\"form-input-group\"]]],false],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"externalPatientId\",[\"helper\",[\"t\"],[\"patients.labels.externalPatientId\"],null],\"form-input-group\"]]],false],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"prompt\",\"label\",\"property\",\"content\",\"class\"],[\" \",[\"helper\",[\"t\"],[\"patients.labels.bloodType\"],null],\"bloodType\",[\"get\",[\"bloodTypes\"]],\"form-input-group\"]]],false],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"class\"],[\"clinic\",[\"helper\",[\"t\"],[\"patients.labels.clinic\"],null],[\"get\",[\"clinicList\"]],[\"get\",[\"model\",\"clinic\"]],\"form-input-group\"]]],false],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"referredBy\",[\"helper\",[\"t\"],[\"patients.labels.referredBy\"],null],\"form-input-group\"]]],false],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"referredDate\",[\"helper\",[\"t\"],[\"patients.labels.referredDate\"],null],\"form-input-group\"]]],false],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"religion\",[\"helper\",[\"t\"],[\"patients.labels.religion\"],null],\"form-input-group\"]]],false],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"parent\",[\"helper\",[\"t\"],[\"patients.labels.parent\"],null],\"form-input-group\"]]],false],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"label\",\"property\",\"content\",\"optionValuePath\",\"optionLabelPath\",\"prompt\",\"class\"],[[\"helper\",[\"t\"],[\"billing.labels.paymentProfile\"],null],\"paymentProfile\",[\"get\",[\"pricingProfiles\"]],\"selectObject\",\"selectObject.name\",\" \",\"form-input-group\"]]],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel detail-section\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddContact\"]]],null,32],[\"text\",\"          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"phone\",[\"helper\",[\"t\"],[\"patients.labels.phone\"],null],\"col-xs-12 col-sm-6\"]]],false],[\"text\",\"\\n              \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"type\",\"label\",\"class\"],[\"email\",\"email\",[\"helper\",[\"t\"],[\"labels.email\"],null],\"col-xs-12 col-sm-6\"]]],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"haveAddressOptions\"]]],null,31,26],[\"text\",\"              \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"className\"],[\"country\",[\"helper\",[\"t\"],[\"labels.country\"],null],[\"get\",[\"countryList\"]],[\"get\",[\"model\",\"country\"]],\"col-xs-12 col-sm-6\"]]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"haveAdditionalContacts\"]]],null,25],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"custom-form-manager\"],null,[[\"model\",\"formType\"],[[\"get\",[\"model\"]],\"patient\"]]],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"unless\"],[[\"get\",[\"isNewOrDeleted\"]]],null,21],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\",\"bubbles\"],[[\"get\",[\"model\"]],false,false]],51],[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-success message\"],[\"static-attr\",\"style\",\"display:none;\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/patients/edit/template.hbs" } });
});
define("hospitalrun/patients/imaging/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "b0VbAwnT", "block": "{\"statements\":[[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.dateRequested\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.imagingType\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.status\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.labels.dateProcessed\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.result\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.notes\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.requestedBy\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"patientImaging\"]]],null,3],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteImaging\",[\"get\",[\"imaging\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"labels.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editImaging\",[\"get\",[\"imaging\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"canAddImaging\"]]],null,1],[\"block\",[\"if\"],[[\"get\",[\"canDeleteImaging\"]]],null,0]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"tr\",[]],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editImaging\",[\"get\",[\"imaging\"]]]],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"imaging\",\"requestedDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"imaging\",\"imagingType\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"imaging\",\"status\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"imaging\",\"imagingDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"imaging\",\"result\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"imaging\",\"notes\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"imaging\",\"requestedBy\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"imaging\",\"canEdit\"]]],null,2],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"imaging\"]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/patients/imaging/template.hbs" } });
});
define('hospitalrun/patients/index/controller', ['exports', 'hospitalrun/controllers/abstract-paged-controller', 'hospitalrun/mixins/patient-visits', 'hospitalrun/utils/visit-statuses'], function (exports, _hospitalrunControllersAbstractPagedController, _hospitalrunMixinsPatientVisits, _hospitalrunUtilsVisitStatuses) {
  exports['default'] = _hospitalrunControllersAbstractPagedController['default'].extend(_hospitalrunMixinsPatientVisits['default'], {
    addPermission: 'add_patient',
    deletePermission: 'delete_patient',
    canAdmitPatient: (function () {
      return this.currentUserCan('admit_patient');
    }).property(),

    canDischargePatient: (function () {
      return this.currentUserCan('discharge_patient');
    }).property(),

    startKey: [],
    actions: {
      checkInPatient: function checkInPatient(patient) {
        this.send('createNewVisit', patient);
      },

      checkoutPatient: function checkoutPatient(patient) {
        this.editPatientVisitWithStatus(patient, _hospitalrunUtilsVisitStatuses['default'].CHECKED_IN);
      },

      dischargePatient: function dischargePatient(patient) {
        this.editPatientVisitWithStatus(patient, _hospitalrunUtilsVisitStatuses['default'].ADMITTED);
      }
    },

    editPatientVisitWithStatus: function editPatientVisitWithStatus(patient, status) {
      var _this = this;

      this.getPatientVisits(patient).then(function (visits) {
        var visitToEdit = visits.findBy('status', status);
        if (visitToEdit) {
          visitToEdit.set('endDate', new Date());
          _this.transitionToRoute('visits.edit', visitToEdit);
        }
      });
    }
  });
});
define('hospitalrun/patients/index/route', ['exports', 'hospitalrun/routes/abstract-index-route', 'ember', 'ember-i18n', 'hospitalrun/mixins/user-session'], function (exports, _hospitalrunRoutesAbstractIndexRoute, _ember, _emberI18n, _hospitalrunMixinsUserSession) {
  var computed = _ember['default'].computed;
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend(_hospitalrunMixinsUserSession['default'], {
    modelName: 'patient',
    newButtonAction: computed(function () {
      if (this.currentUserCan('add_patient')) {
        return 'newItem';
      } else {
        return null;
      }
    }),
    newButtonText: (0, _emberI18n.translationMacro)('patients.buttons.newPatient'),
    pageTitle: (0, _emberI18n.translationMacro)('patients.titles.patientListing'),

    _getStartKeyFromItem: function _getStartKeyFromItem(item) {
      var displayPatientId = item.get('displayPatientId');
      var id = this._getPouchIdFromItem(item);
      return [displayPatientId, id];
    },

    _modelQueryParams: function _modelQueryParams() {
      return {
        mapReduce: 'patient_by_display_id'
      };
    }

  });
});
define("hospitalrun/patients/index/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "RoAn9yIP", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]],21]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\" \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newItem\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.messages.createNewPatient\"],null],false],[\"close-element\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-info\"],[\"static-attr\",\"data-test-selector\",\"no-patients-found\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.messages.noPatientsFound\"],null],false],[\"block\",[\"if\"],[[\"get\",[\"canAdd\"]]],null,0],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"deleteItem\",[\"get\",[\"patient\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary success admit\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"checkInPatient\",[\"get\",[\"patient\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-log-in\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"visits.buttons.checkIn\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"canAdmitPatient\"]]],null,3]],\"locals\":[]},{\"statements\":[[\"text\",\"                      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary info\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"checkoutPatient\",[\"get\",[\"patient\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-log-out\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"visits.buttons.checkOut\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"canDischargePatient\"]]],null,5]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"patient\",\"checkedIn\"]]],null,6,4]],\"locals\":[]},{\"statements\":[[\"text\",\"                    \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary info\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"dischargePatient\",[\"get\",[\"patient\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-log-out\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"visits.buttons.discharge\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"canDischargePatient\"]]],null,8]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"patient\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAdd\"]]],null,10],[\"block\",[\"if\"],[[\"get\",[\"patient\",\"admitted\"]]],null,9,7],[\"block\",[\"if\"],[[\"get\",[\"canDelete\"]]],null,2],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"clickable\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"patient\"]]]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"patient\",\"displayPatientId\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"patient\",\"firstName\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"patient\",\"lastName\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"patient\",\"sex\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"patient\",\"dateOfBirth\"]]],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"patient\",\"status\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,11],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"patient\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"labels.status\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"patients.labels.dob\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"patients.labels.sex\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"patients.labels.lastName\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"patients.labels.firstName\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"labels.id\"],null],false]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"thead\",[]],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"id\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],19],[\"text\",\"\\n          \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"firstName\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],18],[\"text\",\"\\n          \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"lastName\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],17],[\"text\",\"\\n          \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"sex\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],16],[\"text\",\"\\n          \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"dateOfBirth\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],15],[\"text\",\"\\n          \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"status\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],14],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,13],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tbody\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\"]]],null,12],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"hasRecords\"]]],null,20,1]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/patients/index/template.hbs" } });
});
define("hospitalrun/patients/labs/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "NZjGsEXR", "block": "{\"statements\":[[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.dateRequested\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labs.labels.labType\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.status\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.labels.dateProcessed\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.result\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.notes\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.requestedBy\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"patientLabs\"]]],null,3],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteLab\",[\"get\",[\"lab\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"labels.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editLab\",[\"get\",[\"lab\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"canAddLab\"]]],null,1],[\"block\",[\"if\"],[[\"get\",[\"canDeleteLab\"]]],null,0]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"tr\",[]],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editLab\",[\"get\",[\"lab\"]]]],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"lab\",\"requestedDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"lab\",\"labType\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"lab\",\"status\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"lab\",\"labDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"lab\",\"result\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"lab\",\"notes\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"lab\",\"requestedBy\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"lab\",\"canEdit\"]]],null,2],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"lab\"]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/patients/labs/template.hbs" } });
});
define("hospitalrun/patients/medication/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "s3chlZL2", "block": "{\"statements\":[[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.date\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.name\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.status\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.prescription\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.requestedBy\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"patientMedications\"]]],null,3],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteMedication\",[\"get\",[\"medication\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editMedication\",[\"get\",[\"medication\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"canAddMedication\"]]],null,1],[\"block\",[\"if\"],[[\"get\",[\"canDeleteMedication\"]]],null,0]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"tr\",[]],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editMedication\",[\"get\",[\"medication\"]]]],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"medication\",\"prescriptionDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"medication\",\"medicationName\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"medication\",\"status\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"medication\",\"prescription\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"medication\",\"requestedBy\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"medication\",\"canEdit\"]]],null,2],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"medication\"]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/patients/medication/template.hbs" } });
});
define('hospitalrun/patients/notes/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember', 'hospitalrun/mixins/is-update-disabled', 'moment', 'hospitalrun/mixins/patient-submodule', 'hospitalrun/mixins/patient-notes', 'hospitalrun/mixins/user-session'], function (exports, _hospitalrunControllersAbstractEditController, _ember, _hospitalrunMixinsIsUpdateDisabled, _moment, _hospitalrunMixinsPatientSubmodule, _hospitalrunMixinsPatientNotes, _hospitalrunMixinsUserSession) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsIsUpdateDisabled['default'], _hospitalrunMixinsUserSession['default'], _hospitalrunMixinsPatientSubmodule['default'], _hospitalrunMixinsPatientNotes['default'], {
    cancelAction: 'closeModal',
    updateAction: 'updateNote',
    moduleController: _ember['default'].inject.controller('patients'),
    physicianList: _ember['default'].computed.alias('moduleController.physicianList'),
    lookupListsToUpdate: [{
      name: 'physicianList',
      property: 'model.attribution',
      id: 'physician_list'
    }],
    title: (function () {
      if (this.get('model.isNew')) {
        return this.get('i18n').t('patients.notes.newNote') + ' ' + this.get('model.patient.displayName');
      } else {
        return this.get('i18n').t('patients.notes.newNote') + ' ' + (0, _moment['default'])(this.get('model.date')).format('MM/DD/YYYY') + ' for ' + this.get('model.patient.displayName');
      }
    }).property('model.patient.displayName'),
    updateCapability: 'add_note',
    beforeUpdate: function beforeUpdate() {
      this._setNoteType();
      this.set('model.date', new Date());
      this.set('model.createdBy', this.getUserName());
      return _ember['default'].RSVP.Promise.resolve();
    },
    afterUpdate: function afterUpdate() {
      this.send(this.get('updateAction'), this.get('model'));
      this.send(this.get('cancelAction'));
    }
  });
});
define("hospitalrun/patients/notes/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "MTd3HhDs", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"hideCancelButton\",\"hideUpdateButton\",\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"hideCancelButton\"]],[\"get\",[\"hideUpdateButton\"]],[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"label\",\"property\",\"rows\",\"class\"],[[\"helper\",[\"t\"],[\"labels.note\"],null],\"content\",3,\"test-note-content required form-input-group\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\",\"optionValuePath\",\"optionLabelPath\",\"prompt\",\"selected\"],[\"required\",[\"helper\",[\"t\"],[\"labels.visit\"],null],\"visit\",[\"get\",[\"patientVisitsForSelect\"]],\"selectObject\",\"selectObject.visitDescription\",[\"helper\",[\"t\"],[\"patients.notes.pleaseSelectAVisit\"],null],[\"get\",[\"model\",\"visit\"]]]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"className\"],[\"attribution\",[\"helper\",[\"t\"],[\"patients.notes.onBehalfOfLabel\"],null],[\"get\",[\"physicianList\"]],[\"get\",[\"attribution\"]],\"form-input-group test-note-attribution\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/patients/notes/template.hbs" } });
});
define('hospitalrun/patients/operation-report/controller', ['exports', 'ember', 'hospitalrun/patients/operative-plan/controller'], function (exports, _ember, _hospitalrunPatientsOperativePlanController) {
  var alias = _ember['default'].computed.alias;
  var get = _ember['default'].get;
  exports['default'] = _hospitalrunPatientsOperativePlanController['default'].extend({
    additionalButtons: null,
    lookupListsToUpdate: [{
      name: 'physicianList',
      property: 'model.assistant',
      id: 'physician_list'
    }, {
      name: 'physicianList',
      property: 'model.surgeon',
      id: 'physician_list'
    }, {
      name: 'procedureList',
      property: 'modelProcedures',
      id: 'procedure_list'
    }],
    updateCapability: 'add_operation_report',

    diagnosisList: alias('patientController.diagnosisList'),

    _finishAfterUpdate: function _finishAfterUpdate() {
      var i18n = get(this, 'i18n');
      var updateMessage = i18n.t('operationReport.messages.reportSaved');
      var updateTitle = i18n.t('operationReport.titles.reportSaved');
      this.displayAlert(updateTitle, updateMessage);
    },

    actions: {
      addDiagnosis: function addDiagnosis(newDiagnosis) {
        this.addDiagnosisToModelAndPatient(newDiagnosis);
      }
    }

  });
});
define('hospitalrun/patients/operation-report/route', ['exports', 'hospitalrun/patients/operative-plan/route', 'ember-i18n'], function (exports, _hospitalrunPatientsOperativePlanRoute, _emberI18n) {
  exports['default'] = _hospitalrunPatientsOperativePlanRoute['default'].extend({
    editTitle: (0, _emberI18n.translationMacro)('operationReport.titles.editTitle'),
    modelName: 'operation-report',
    newTitle: (0, _emberI18n.translationMacro)('operationReport.titles.newTitle')
  });
});
define("hospitalrun/patients/operation-report/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "WQ0WTHDG", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"patient-summary\"],null,[[\"allowAddDiagnosis\",\"diagnosisContainer\",\"diagnosisList\",\"disablePatientLink\",\"patient\"],[true,[\"get\",[\"model\"]],[\"get\",[\"diagnosisList\"]],true,[\"get\",[\"model\",\"patient\"]]]]],false],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"patient-summary clearfix\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"patient-diagnosis\"],null,[[\"diagnosisContainer\",\"diagnosisProperty\",\"primaryDiagnosisLabel\",\"secondaryDiagnosisLabel\"],[[\"get\",[\"model\"]],\"preOpDiagnoses\",[\"helper\",[\"t\"],[\"operationReport.labels.preOpPrimaryDiagnosis\"],null],[\"helper\",[\"t\"],[\"operationReport.labels.preOpSecondaryDiagnosis\"],null]]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"property\",\"label\",\"class\"],[\"operationDescription\",[\"helper\",[\"t\"],[\"operationReport.labels.operationDescription\"],null],\"operation-description\"]]],false],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"surgeryDate\",[\"helper\",[\"t\"],[\"operationReport.labels.surgeryDate\"],null],\"form-input-group col-sm-4 surgery-date\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\",\"class\"],[\"col-sm-3\",\"surgeon\",[\"helper\",[\"t\"],[\"operationReport.labels.surgeon\"],null],[\"get\",[\"physicianList\"]],[\"get\",[\"model\",\"surgeon\"]],\"operation-surgeon\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\",\"class\"],[\"col-sm-3\",\"assistant\",[\"helper\",[\"t\"],[\"operationReport.labels.assistant\"],null],[\"get\",[\"physicianList\"]],[\"get\",[\"model\",\"assistant\"]],\"operation-assistant\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"caseComplexity\",[\"helper\",[\"t\"],[\"operationReport.labels.caseComplexity\"],null],\"col-sm-2 case-complexity\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"operative-procedures\"],null,[[\"model\",\"procedureList\"],[[\"get\",[\"model\"]],[\"get\",[\"procedureList\"]]]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"property\",\"label\"],[\"additionalNotes\",[\"helper\",[\"t\"],[\"operationReport.labels.additionalNotes\"],null]]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"upcoming-appointments\"],null,[[\"patient\"],[[\"get\",[\"model\",\"patient\"]]]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"custom-form-manager\"],null,[[\"model\",\"formType\"],[[\"get\",[\"model\"]],\"operativePlan\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/patients/operation-report/template.hbs" } });
});
define('hospitalrun/patients/operative-plan/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember', 'hospitalrun/components/operative-procedures', 'hospitalrun/mixins/operative-plan-statuses', 'hospitalrun/mixins/patient-submodule'], function (exports, _hospitalrunControllersAbstractEditController, _ember, _hospitalrunComponentsOperativeProcedures, _hospitalrunMixinsOperativePlanStatuses, _hospitalrunMixinsPatientSubmodule) {
  var computed = _ember['default'].computed;
  var alias = _ember['default'].computed.alias;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var RSVP = _ember['default'].RSVP;
  var set = _ember['default'].set;

  // Properties to copy from plan to operative report
  var PLAN_KEYS_TO_COPY = ['additionalNotes', 'caseComplexity', 'customForms', 'patient', 'procedures', 'operationDescription', 'surgeon'];

  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsOperativePlanStatuses['default'], _hospitalrunMixinsPatientSubmodule['default'], {
    completedPlan: false,
    lookupListsToUpdate: [{
      name: 'physicianList',
      property: 'model.surgeon',
      id: 'physician_list'
    }, {
      name: 'procedureList',
      property: 'modelProcedures',
      id: 'procedure_list'
    }],
    newPlan: false,
    updateCapability: 'add_operative_plan',

    patientsController: inject.controller('patients'),

    physicianList: alias('patientsController.physicianList'),
    procedureList: alias('patientsController.procedureList'),

    additionalButtons: computed('model.{isNew,status}', function () {
      var i18n = get(this, 'i18n');
      var isNew = get(this, 'model.isNew');
      var status = get(this, 'model.status');
      if (!isNew && status !== _hospitalrunMixinsOperativePlanStatuses.COMPLETED_STATUS) {
        return [{
          'class': 'btn btn-primary on-white',
          buttonAction: 'completePlan',
          buttonIcon: 'octicon octicon-check',
          buttonText: i18n.t('operativePlan.buttons.completePlan')
        }];
      }
    }),

    modelProcedures: computed.map('model.procedures', function (procedure) {
      return get(procedure, 'description');
    }),

    afterUpdate: function afterUpdate() {
      var _this = this;

      var newPlan = get(this, 'newPlan');
      if (newPlan) {
        var patient = get(this, 'model.patient');
        patient.save().then(this._finishAfterUpdate.bind(this)).then(function () {
          var editTitle = get(_this, 'i18n').t('operativePlan.titles.editTitle');
          var sectionDetails = {};
          sectionDetails.currentScreenTitle = editTitle;
          _this.send('setSectionHeader', sectionDetails);
        });
      } else {
        this._finishAfterUpdate();
      }
    },

    beforeUpdate: function beforeUpdate() {
      var model = get(this, 'model');
      var isNew = get(model, 'isNew');
      var status = get(model, 'status');
      (0, _hospitalrunComponentsOperativeProcedures.addProcedure)(model);
      set(this, 'newPlan', isNew);
      if (status === _hospitalrunMixinsOperativePlanStatuses.COMPLETED_STATUS) {
        var changedAttributes = model.changedAttributes();
        if (changedAttributes.status) {
          set(this, 'completedPlan', true);
        }
      } else {
        set(this, 'completedPlan', false);
      }
      if (isNew) {
        return this.saveNewDiagnoses();
      } else {
        return RSVP.resolve();
      }
    },

    _createOperationReport: function _createOperationReport() {
      var _this2 = this;

      var store = get(this, 'store');
      var operativePlan = get(this, 'model');
      var propertiesToCopy = operativePlan.getProperties.apply(operativePlan, PLAN_KEYS_TO_COPY);
      var diagnoses = get(operativePlan, 'diagnoses');
      var patient = get(operativePlan, 'patient');
      set(propertiesToCopy, 'operativePlan', operativePlan);
      set(propertiesToCopy, 'preOpDiagnosis', diagnoses);
      set(propertiesToCopy, 'surgeryDate', new Date());
      set(propertiesToCopy, 'returnToPatient', get(patient, 'id'));
      var operationReport = store.createRecord('operation-report', propertiesToCopy);
      this.getPatientDiagnoses(patient, operationReport);
      operationReport.save().then(function (newReport) {
        patient.save().then(function () {
          var i18n = get(_this2, 'i18n');
          var updateMessage = i18n.t('operativePlan.messages.planCompleted');
          var updateTitle = i18n.t('operativePlan.titles.planCompleted');
          _this2.displayAlert(updateTitle, updateMessage, 'showOperationReport', newReport, 'ok');
        });
      });
    },

    _finishAfterUpdate: function _finishAfterUpdate() {
      var completedPlan = get(this, 'completedPlan');
      if (completedPlan) {
        this._createOperationReport();
      } else {
        var i18n = get(this, 'i18n');
        var updateMessage = i18n.t('operativePlan.messages.planSaved');
        var updateTitle = i18n.t('operativePlan.titles.planSaved');
        this.displayAlert(updateTitle, updateMessage);
      }
    },

    actions: {
      completePlan: function completePlan() {
        var model = get(this, 'model');
        set(model, 'status', _hospitalrunMixinsOperativePlanStatuses.COMPLETED_STATUS);
        this.send('update');
      }
    }
  });
});
define('hospitalrun/patients/operative-plan/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'hospitalrun/mixins/add-to-patient-route', 'ember', 'moment', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractEditRoute, _hospitalrunMixinsAddToPatientRoute, _ember, _moment, _emberI18n) {
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend(_hospitalrunMixinsAddToPatientRoute['default'], {
    editTitle: (0, _emberI18n.translationMacro)('operativePlan.titles.editTitle'),
    modelName: 'operative-plan',
    newTitle: (0, _emberI18n.translationMacro)('operativePlan.titles.newTitle'),

    customForms: inject.service(),
    database: inject.service(),

    getNewData: function getNewData() {
      var customForms = get(this, 'customForms');
      var newData = {
        customForms: _ember['default'].Object.create()
      };
      return customForms.setDefaultCustomForms(['operativePlan'], newData);
    },

    setupController: function setupController(controller, model) {
      this._super(controller, model);
      var database = get(this, 'database');
      var maxApptId = database.getMaxPouchId('appointment');
      var minApptId = database.getMinPouchId('appointment');
      var patientId = get(model, 'patient.id');
      var startDate = (0, _moment['default'])().toDate().getTime();
      var endDate = (0, _moment['default'])().add(10, 'years').toDate().getTime();

      this.store.query('appointment', {
        options: {
          startkey: [patientId, startDate, startDate, minApptId],
          endkey: [patientId, endDate, endDate, maxApptId]
        },
        mapReduce: 'appointments_by_patient'
      }).then(function (appointments) {
        model.set('appointments', appointments);
      });
    },

    actions: {
      showOperationReport: function showOperationReport(report) {
        this.transitionTo('patients.operation-report', report);
      }
    }
  });
});
define("hospitalrun/patients/operative-plan/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "Y/rrp7oM", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"patient-summary\"],null,[[\"patient\",\"disablePatientLink\",\"diagnosisContainer\"],[[\"get\",[\"model\",\"patient\"]],true,[\"get\",[\"model\"]]]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"property\",\"label\",\"class\"],[\"operationDescription\",[\"helper\",[\"t\"],[\"operativePlan.labels.operationDescription\"],null],\"operation-description\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"operative-procedures\"],null,[[\"model\",\"procedureList\"],[[\"get\",[\"model\"]],[\"get\",[\"procedureList\"]]]]],false],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\",\"class\"],[\"col-sm-4\",\"surgeon\",[\"helper\",[\"t\"],[\"operativePlan.labels.surgeon\"],null],[\"get\",[\"physicianList\"]],[\"get\",[\"model\",\"surgeon\"]],\"plan-surgeon\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"prompt\",\"label\",\"property\",\"content\",\"class\"],[\" \",[\"helper\",[\"t\"],[\"operativePlan.labels.status\"],null],\"status\",[\"get\",[\"planStatuses\"]],\"form-input-group col-sm-2 plan-status\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"caseComplexity\",[\"helper\",[\"t\"],[\"operativePlan.labels.caseComplexity\"],null],\"col-sm-2 case-complexity\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"property\",\"label\",\"class\"],[\"admissionInstructions\",[\"helper\",[\"t\"],[\"operativePlan.labels.admissionInstructions\"],null],\"admission-instructions\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"property\",\"label\",\"class\"],[\"additionalNotes\",[\"helper\",[\"t\"],[\"operativePlan.labels.additionalNotes\"],null],\"additional-notes\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"upcoming-appointments\"],null,[[\"patient\"],[[\"get\",[\"model\",\"patient\"]]]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"custom-form-manager\"],null,[[\"model\",\"formType\"],[[\"get\",[\"model\"]],\"operativePlan\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/patients/operative-plan/template.hbs" } });
});
define('hospitalrun/patients/outpatient/controller', ['exports', 'ember', 'hospitalrun/mixins/filter-list', 'hospitalrun/mixins/modal-helper', 'hospitalrun/mixins/patient-visits', 'hospitalrun/utils/select-values', 'hospitalrun/mixins/user-session', 'hospitalrun/utils/visit-statuses', 'hospitalrun/mixins/visit-types'], function (exports, _ember, _hospitalrunMixinsFilterList, _hospitalrunMixinsModalHelper, _hospitalrunMixinsPatientVisits, _hospitalrunUtilsSelectValues, _hospitalrunMixinsUserSession, _hospitalrunUtilsVisitStatuses, _hospitalrunMixinsVisitTypes) {
  var computed = _ember['default'].computed;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _ember['default'].Controller.extend(_hospitalrunMixinsFilterList['default'], _hospitalrunMixinsModalHelper['default'], _hospitalrunMixinsPatientVisits['default'], _hospitalrunUtilsSelectValues['default'], _hospitalrunMixinsUserSession['default'], _hospitalrunMixinsVisitTypes['default'], {
    addPermission: 'add_patient',
    deletePermission: 'delete_patient',
    queryParams: ['visitDate', 'visitLocation'],
    visitLocation: null,
    visitDate: null,
    canAddVisit: computed(function () {
      return this.currentUserCan('add_visit');
    }),
    hasAppointmentLabels: computed(function () {
      var i18n = this.get('i18n');
      return [i18n.t('visits.labels.haveAppointment'), i18n.t('visits.labels.noAppointment')];
    }),
    doneOrdersValues: computed(function () {
      var i18n = this.get('i18n');
      return [i18n.t('visits.labels.ordersNotDone'), i18n.t('visits.labels.haveDoneOrders')];
    }),
    locationList: _ember['default'].computed.map('patientController.locationList.value', _hospitalrunUtilsSelectValues['default'].selectValuesMap).volatile(),
    patientNames: computed.map('model', function (visit) {
      return visit.get('patient.shortDisplayName');
    }),
    patientController: _ember['default'].inject.controller('patients'),
    sexList: computed.alias('patientController.sexList.value'),
    visitTypesList: computed.alias('patientController.visitTypesList'),
    visitTypesValues: computed.map('visitTypes', function (visitType) {
      return visitType.value;
    }),

    checkedInVisits: computed.filter('model.@each.status', function (visit) {
      return visit.get('visitType') !== 'Admission' && visit.get('status') === _hospitalrunUtilsVisitStatuses['default'].CHECKED_IN;
    }),

    filteredVisits: computed('checkedInVisits', 'filterBy', 'filterValue', 'visitLocation', function () {
      var filterBy = this.get('filterBy');
      var filterValue = this.get('filterValue');
      var filteredBy = this.get('filteredBy');
      var visitLocation = this.get('visitLocation');
      var visits = this.get('checkedInVisits');
      if (isEmpty(visitLocation)) {
        filteredBy['delete']('location');
      } else {
        filteredBy.set('location', visitLocation);
      }
      return this.filterList(visits, filterBy, filterValue);
    }),

    sortedVisits: computed('filteredVisits', 'sortByKey', 'sortByDesc', function () {
      var filteredList = this.get('filteredVisits');
      return this.sortFilteredList(filteredList);
    }),

    startKey: [],
    actions: {
      checkOut: function checkOut(visit) {
        var i18n = this.get('i18n');
        var patientDetails = { patientName: visit.get('patient.displayName') };
        var confirmMessage = i18n.t('visits.messages.checkOut', patientDetails);
        this.displayConfirm(i18n.t('visits.titles.checkOut'), confirmMessage, 'finishCheckOut', visit);
      },

      editVisit: function editVisit(visit) {
        if (this.get('canAddVisit')) {
          visit.set('returnTo', 'patients.outpatient');
          this.transitionToRoute('visits.edit', visit);
        }
      },

      finishCheckOut: function finishCheckOut(visit) {
        this.checkoutVisit(visit, _hospitalrunUtilsVisitStatuses['default'].CHECKED_OUT);
      },

      search: function search() {
        var visitDate = this.get('model.selectedVisitDate');
        var visitLocation = this.get('model.selectedLocation');
        if (!isEmpty(visitDate)) {
          this.set('visitDate', visitDate.getTime());
        }
        if (isEmpty(visitLocation)) {
          this.set('visitLocation', null);
        } else {
          this.set('visitLocation', visitLocation);
        }
      },

      patientCheckIn: function patientCheckIn() {
        this.transitionToRoute('visits.edit', 'checkin').then(function (newRoute) {
          var visitProps = {
            outPatient: true,
            visitType: null,
            returnTo: 'patients.outpatient'
          };
          newRoute.currentModel.setProperties(visitProps);
        });
      }

    }
  });
});
define('hospitalrun/patients/outpatient/route', ['exports', 'hospitalrun/routes/abstract-index-route', 'hospitalrun/mixins/date-format', 'ember', 'moment', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractIndexRoute, _hospitalrunMixinsDateFormat, _ember, _moment, _emberI18n) {
  var computed = _ember['default'].computed;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend(_hospitalrunMixinsDateFormat['default'], {
    database: _ember['default'].inject.service(),
    itemsPerPage: null, // Fetch all outpatient visits as one page
    modelName: 'visit',
    newButtonAction: 'patientCheckIn',
    newButtonText: (0, _emberI18n.translationMacro)('patients.buttons.patientCheckIn'),
    selectedVisitDate: null,
    showingTodaysPatients: true,
    pageTitle: computed('showingTodaysPatients', 'selectedVisitDate', function () {
      var i18n = this.get('i18n');
      var showingTodaysPatients = this.get('showingTodaysPatients');
      if (showingTodaysPatients) {
        return i18n.t('patients.titles.todaysOutpatients');
      } else {
        var selectedVisitDate = this._dateFormat(this.get('selectedVisitDate'));
        return i18n.t('patients.titles.outpatientsForDate', { visitDate: selectedVisitDate });
      }
    }),

    queryParams: {
      visitDate: { refreshModel: true },
      visitLocation: { refreshModel: false }
    },

    _getStartKeyFromItem: function _getStartKeyFromItem(item) {
      var displayPatientId = item.get('displayPatientId');
      return [displayPatientId, 'patient_' + item.get('id')];
    },

    _modelQueryParams: function _modelQueryParams(params) {
      var database = this.get('database');
      var maxId = database.getMaxPouchId('visit');
      var minId = database.getMinPouchId('visit');
      var visitDate = params.visitDate;

      if (isEmpty(visitDate)) {
        visitDate = (0, _moment['default'])();
      } else {
        visitDate = (0, _moment['default'])(parseInt(visitDate));
      }
      if (visitDate.isSame((0, _moment['default'])(), 'day')) {
        this.set('showingTodaysPatients', true);
      } else {
        this.set('showingTodaysPatients', false);
        this.set('selectedVisitDate', visitDate.toDate());
      }
      var endOfDay = visitDate.endOf('day').valueOf();
      var startOfDay = visitDate.startOf('day').valueOf();
      return {
        mapReduce: 'visit_by_date',
        options: {
          endkey: [endOfDay, endOfDay, maxId],
          startkey: [startOfDay, null, minId]
        }
      };
    },

    model: function model(params) {
      var _this = this;

      return this._super(params).then(function (model) {
        var visitDate = new Date();
        if (!isEmpty(params.visitDate)) {
          visitDate.setTime(params.visitDate);
        }
        model.set('selectedVisitDate', visitDate);
        model.set('display_selectedVisitDate', _this._dateFormat(visitDate));
        model.set('selectedLocation', params.visitLocation);
        return model;
      });
    },

    actions: {
      finishCheckOut: function finishCheckOut(visit) {
        this.controller.send('finishCheckOut', visit);
      },

      patientCheckIn: function patientCheckIn() {
        this.controller.send('patientCheckIn');
      }
    }

  });
});
define("hospitalrun/patients/outpatient/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "i/Y69zgf", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]],11]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"clickable\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editVisit\",[\"get\",[\"visit\"]]]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"visit\",\"patient\",\"displayPatientId\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"visit\",\"patient\",\"shortDisplayName\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"visit\",\"patient\",\"sex\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"visit\",\"patient\",\"shortAge\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"visit\",\"visitType\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"visit\",\"startDate\"]]],[[\"format\"],[\"h:mm A\"]]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1 text-center\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"visit\",\"hasAppointmentLabel\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"visit\",\"examiner\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1 text-center\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"visit\",\"hasDoneOrders\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"checkOut\",[\"get\",[\"visit\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"visits.buttons.checkOut\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"visit\"]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"t\"],[\"visits.labels.ordersDone\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"visits.labels.examiner\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"visits.labels.appointment\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"visits.labels.checkInTime\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"visits.labels.visitType\"],null],false]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"labels.age\"],null],false]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"t\"],[\"patients.labels.sex\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"t\"],[\"labels.name\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"labels.id\"],null],false]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"selectedVisitDate\",[\"helper\",[\"t\"],[\"visits.labels.visitDate\"],null],\"col-sm-3 outpatient-date\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"property\",\"label\",\"content\",\"prompt\"],[\"col-sm-3 form-input-group outpatient-location\",\"selectedLocation\",[\"helper\",[\"t\"],[\"labels.location\"],null],[\"get\",[\"locationList\"]],\" \"]]],false],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-sm-3\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"search\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.search\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-info\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],10],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table outpatient-list\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"thead\",[]],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"patient.displayPatientId\",[\"get\",[\"sortByDesc\"]],[\"get\",[\"sortByKey\"]]]],9],[\"text\",\"\\n\"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\",\"filterBy\",\"filteredBy\",\"filterType\",\"filterValues\"],[\"patient.shortDisplayName\",[\"get\",[\"sortByDesc\"]],[\"get\",[\"sortByKey\"]],\"patient.shortDisplayName\",[\"get\",[\"filteredBy\"]],\"typeahead\",[\"get\",[\"patientNames\"]]]],8],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\",\"filterBy\",\"filteredBy\",\"filterValues\"],[\"patient.sex\",[\"get\",[\"sortByDesc\"]],[\"get\",[\"sortByKey\"]],\"patient.sex\",[\"get\",[\"filteredBy\"]],[\"get\",[\"sexList\"]]]],7],[\"text\",\"        \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"patient.dateOfBirth\",[\"get\",[\"sortByDesc\"]],[\"get\",[\"sortByKey\"]]]],6],[\"text\",\"\\n        \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\",\"filterBy\",\"filteredBy\",\"filterValues\"],[\"visitType\",[\"get\",[\"sortByDesc\"]],[\"get\",[\"sortByKey\"]],\"visitType\",[\"get\",[\"filteredBy\"]],[\"get\",[\"visitTypesValues\"]]]],5],[\"text\",\"\\n        \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"startDate\",[\"get\",[\"sortByDesc\"]],[\"get\",[\"sortByKey\"]]]],4],[\"text\",\"\\n        \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\",\"filterBy\",\"filteredBy\",\"filterValues\"],[\"hasAppointmentLabel\",[\"get\",[\"sortByDesc\"]],[\"get\",[\"sortByKey\"]],\"hasAppointmentLabel\",[\"get\",[\"filteredBy\"]],[\"get\",[\"hasAppointmentLabels\"]]]],3],[\"text\",\"\\n        \"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"examiner\",[\"get\",[\"sortByDesc\"]],[\"get\",[\"sortByKey\"]]]],2],[\"text\",\"\\n\"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\",\"filterBy\",\"filteredBy\",\"filterValues\"],[\"hasDoneOrders\",[\"get\",[\"sortByDesc\"]],[\"get\",[\"sortByKey\"]],\"hasDoneOrders\",[\"get\",[\"filteredBy\"]],[\"get\",[\"doneOrdersValues\"]]]],1],[\"text\",\"        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"tbody\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"sortedVisits\"]]],null,0],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/patients/outpatient/template.hbs" } });
});
define('hospitalrun/patients/photo/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember', 'ember-i18n'], function (exports, _hospitalrunControllersAbstractEditController, _ember, _emberI18n) {
  var computed = _ember['default'].computed;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var isEmpty = _ember['default'].isEmpty;
  var RSVP = _ember['default'].RSVP;
  var set = _ember['default'].set;
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend({
    addAction: 'addPhoto',
    editTitle: (0, _emberI18n.translationMacro)('patients.titles.editPhoto'),
    fileRequiredMessage: (0, _emberI18n.translationMacro)('patients.messages.photoFileRequired'),
    modelName: 'photo',
    newTitle: (0, _emberI18n.translationMacro)('patients.titles.addPhoto'),
    newModel: false,
    showFileRequired: false,
    showUpdateButton: true,

    database: inject.service(),
    editController: inject.controller('patients/edit'),
    filesystem: inject.service(),

    photoFileNotSet: computed('model.photoFile', function () {
      var model = get(this, 'model');
      var isNew = get(model, 'isNew');
      var photoFile = get(model, 'photoFile');
      return isNew && isEmpty(photoFile);
    }),

    title: computed('model.isNew', function () {
      var isNew = get(this, 'model.isNew');
      if (isNew) {
        return get(this, 'newTitle');
      } else {
        return get(this, 'editTitle');
      }
    }),

    updateButtonAction: computed('photoFileNotSet', function () {
      var photoFileNotSet = get(this, 'photoFileNotSet');
      if (photoFileNotSet) {
        return 'showFileRequired';
      } else {
        set(this, 'showFileRequired', false);
        return 'update';
      }
    }),

    updateButtonClass: computed('photoFileNotSet', function () {
      var photoFileNotSet = get(this, 'photoFileNotSet');
      if (photoFileNotSet) {
        return 'disabled-btn';
      }
    }),

    afterUpdate: function afterUpdate(model) {
      var _this = this;

      var isNew = get(this, 'newModel');
      var editController = get(this, 'editController');
      if (isNew) {
        var photoFile = get(model, 'photoFile');
        var saveToDir = get(model, 'saveToDir');
        var fileSystem = get(this, 'filesystem');
        var modelName = get(this, 'modelName');
        var pouchDbId = get(this, 'database').getPouchId(get(model, 'id'), modelName);
        fileSystem.addFile(photoFile, saveToDir, pouchDbId).then(function (fileEntry) {
          model.setProperties({
            localFile: true,
            fileName: fileEntry.fullPath,
            url: fileEntry.toURL()
          });
          model.save().then(function () {
            editController.send(get(_this, 'addAction'), model);
          })['catch'](function (err) {
            throw err;
          });
        });
      } else {
        this.send('closeModal');
      }
    },

    beforeUpdate: function beforeUpdate() {
      var model = get(this, 'model');
      var photoFile = get(model, 'photoFile');
      var isImage = get(model, 'isImage');
      var isNew = get(model, 'isNew');
      set(this, 'newModel', isNew);
      if (isNew) {
        model.setProperties({
          files: [_ember['default'].Object.create({
            content_type: photoFile.type,
            data: photoFile,
            name: 'file'
          })],
          isImage: isImage
        });
      }
      return RSVP.resolve();
    },

    actions: {
      cancel: function cancel() {
        this.send('closeModal');
      },

      showFileRequired: function showFileRequired() {
        set(this, 'showFileRequired', true);
      }
    }
  });
});
define("hospitalrun/patients/photo/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "SsGKTUmE", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"hideCancelButton\",\"hideUpdateButton\",\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonClass\",\"updateButtonText\"],[[\"get\",[\"hideCancelButton\"]],[\"get\",[\"hideUpdateButton\"]],[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonClass\"]],[\"get\",[\"updateButtonText\"]]]],6]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-warning\"],[\"static-attr\",\"role\",\"alert\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"fileRequiredMessage\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"a\",[]],[\"dynamic-attr\",\"href\",[\"unknown\",[\"model\",\"url\"]],null],[\"static-attr\",\"target\",\"_blank\"],[\"dynamic-attr\",\"download\",[\"concat\",[[\"unknown\",[\"model\",\"shortFileName\"]]]]],[\"static-attr\",\"class\",\"btn btn-default\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-download\"],[\"static-attr\",\"aria-hidden\",\"true\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"patients.buttons.download\"],null],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"thumbnail\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"img\",[]],[\"dynamic-attr\",\"alt\",[\"unknown\",[\"model\",\"caption\"]],null],[\"dynamic-attr\",\"src\",[\"unknown\",[\"model\",\"url\"]],null],[\"static-attr\",\"class\",\"img-responsive\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"model\",\"isImage\"]]],null,2,1]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"take-photo\"],null,[[\"photoFile\",\"isImage\"],[[\"get\",[\"model\",\"photoFile\"]],[\"get\",[\"model\",\"isImage\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\"],[\"caption\",[\"helper\",[\"t\"],[\"patients.labels.caption\"],null]]]],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"model\",\"isNew\"]]],null,4,3],[\"block\",[\"if\"],[[\"get\",[\"showFileRequired\"]]],null,0]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],5]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/patients/photo/template.hbs" } });
});
define('hospitalrun/patients/quick-add/controller', ['exports', 'ember', 'hospitalrun/controllers/abstract-edit-controller', 'ember-i18n'], function (exports, _ember, _hospitalrunControllersAbstractEditController, _emberI18n) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend({
    sexList: _ember['default'].computed.alias('model.requestingController.sexList'),
    title: (0, _emberI18n.translationMacro)('patients.titles.new'),

    updateCapability: 'add_patient',

    actions: {
      cancel: function cancel() {
        this.send('closeModal');
      }
    },

    afterUpdate: function afterUpdate(record) {
      var requestingController = this.get('model.requestingController');
      requestingController.send('addedNewPatient', record);
    }
  });
});
define("hospitalrun/patients/quick-add/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "CI80Vogk", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"hideCancelButton\",\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"hideCancelButton\"]],[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"friendlyId\",\"Id\",\"required col-sm-6\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"firstName\",\"First Name\",\"required col-sm-6\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"middleName\",\"Middle Name\",\"col-sm-6\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"lastName\",\"Last Name\",\"required col-sm-6\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"class\"],[\"sex\",\"Sex\",[\"get\",[\"sexList\"]],[\"get\",[\"model\",\"sex\"]],\"col-sm-6 form-input-group\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"maxDate\",\"class\"],[\"dateOfBirth\",\"Date of Birth\",\"now\",\"col-sm-6\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"phone\",[\"helper\",[\"t\"],[\"patients.labels.phone\"],null],\"col-xs-12 col-sm-6\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-text\"],null,[[\"label\",\"property\",\"rows\",\"class\"],[[\"helper\",[\"t\"],[\"labels.address\"],null],\"address\",3,\"col-xs-12 col-sm-6\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-warning\"],[\"static-attr\",\"role\",\"alert\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"t\"],[\"patients.messages.notFoundQuickAdd\",[\"get\",[\"model\"]]],null],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/patients/quick-add/template.hbs" } });
});
define('hospitalrun/patients/reports/controller', ['exports', 'ember', 'hospitalrun/controllers/abstract-report-controller', 'moment', 'hospitalrun/mixins/patient-diagnosis', 'hospitalrun/mixins/patient-visits', 'hospitalrun/utils/select-values', 'hospitalrun/mixins/visit-types'], function (exports, _ember, _hospitalrunControllersAbstractReportController, _moment, _hospitalrunMixinsPatientDiagnosis, _hospitalrunMixinsPatientVisits, _hospitalrunUtilsSelectValues, _hospitalrunMixinsVisitTypes) {
  exports['default'] = _hospitalrunControllersAbstractReportController['default'].extend(_hospitalrunMixinsPatientDiagnosis['default'], _hospitalrunMixinsPatientVisits['default'], _hospitalrunMixinsVisitTypes['default'], {
    patientsController: _ember['default'].inject.controller('patients'),

    clinicList: _ember['default'].computed.map('patientsController.clinicList.value', _hospitalrunUtilsSelectValues['default'].selectValuesMap),
    diagnosisList: _ember['default'].computed.alias('patientsController.diagnosisList'),
    physicianList: _ember['default'].computed.map('patientsController.physicianList.value', _hospitalrunUtilsSelectValues['default'].selectValuesMap),
    locationList: _ember['default'].computed.map('patientsController.locationList.value', _hospitalrunUtilsSelectValues['default'].selectValuesMap),
    statusList: _ember['default'].computed.map('patientsController.statusList.value', _hospitalrunUtilsSelectValues['default'].selectValuesMap),
    visitTypesList: _ember['default'].computed.alias('patientsController.visitTypesList'),
    reportType: 'detailedAdmissions',
    patientDetails: {},

    admissionReportColumns: _ember['default'].computed(function () {
      var i18n = this.get('i18n');
      return {
        sex: {
          label: i18n.t('labels.sex'),
          include: true,
          property: 'sex'
        },
        total: {
          label: i18n.t('labels.total'),
          include: true,
          property: 'total',
          format: '_numberFormat'
        }
      };
    }),
    admissionDetailReportColumns: _ember['default'].computed(function () {
      var i18n = this.get('i18n');
      return {
        id: {
          label: i18n.t('labels.id'),
          include: true,
          property: 'patientId'
        },
        name: {
          label: i18n.t('labels.name'),
          include: true,
          property: 'patientName'
        },
        admissionDate: {
          label: i18n.t('patients.labels.admissionDate'),
          include: true,
          property: 'admissionDate',
          format: '_dateTimeFormat'
        },
        dischargeDate: {
          label: i18n.t('patients.labels.dischargeDate'),
          include: false,
          property: 'dischargeDate',
          format: '_dateTimeFormat'
        },
        patientDays: {
          label: i18n.t('patients.labels.patientDays'),
          include: false,
          property: 'patientDays',
          format: '_numberFormat'
        }
      };
    }),
    diagnosticReportColumns: _ember['default'].computed(function () {
      var i18n = this.get('i18n');
      return {
        type: {
          label: i18n.t('labels.type'),
          include: true,
          property: 'type'
        },
        total: {
          label: i18n.t('labels.total'),
          include: true,
          property: 'total',
          format: '_numberFormat'
        }
      };
    }),
    procedureDetailReportColumns: _ember['default'].computed(function () {
      var i18n = this.get('i18n');
      return {
        id: {
          label: i18n.t('labels.id'),
          include: true,
          property: 'patient.displayPatientId'
        },
        name: {
          label: i18n.t('labels.name'),
          include: true,
          property: 'patient.displayName'
        },
        procedure: {
          label: i18n.t('visits.labels.procedure'),
          include: true,
          property: 'procedure'
        },
        procedureDate: {
          label: i18n.t('visits.labels.procedureDate'),
          include: true,
          property: 'procedureDate',
          format: '_dateTimeFormat'
        }
      };
    }),
    reportColumns: _ember['default'].computed(function () {
      var i18n = this.get('i18n');
      return {
        visitDate: {
          label: i18n.t('visits.labels.visitDate'),
          include: true,
          property: 'visitDate'
        },
        visitType: {
          label: i18n.t('visits.labels.visitType'),
          include: true,
          property: 'visitType'
        },
        visitLocation: {
          label: i18n.t('labels.location'),
          include: false,
          property: 'location'
        },
        examiner: {
          label: i18n.t('visits.labels.examiner'),
          include: true,
          property: 'examiner'
        },
        name: {
          label: i18n.t('labels.name'),
          include: true,
          property: 'patient.displayName'
        },
        id: {
          label: i18n.t('labels.id'),
          include: true,
          property: 'patient.displayPatientId'
        },
        sex: {
          label: i18n.t('patients.labels.sex'),
          include: true,
          property: 'patient.sex'
        },
        dateOfBirth: {
          label: i18n.t('patients.labels.dateOfBirth'),
          include: true,
          property: 'patient.dateOfBirth',
          format: '_dateFormat'
        },
        age: {
          label: i18n.t('labels.age'),
          include: false,
          property: 'patient.age'
        },
        primaryDiagnosis: {
          label: i18n.t('patients.labels.primaryDiagnosis'),
          include: false,
          property: 'primaryDiagnosis'
        },
        secondaryDiagnoses: {
          label: i18n.t('patients.labels.secondaryDiagnosis'),
          include: false,
          property: 'additionalDiagnoses',
          format: '_diagnosisListToString'
        },
        procedures: {
          label: i18n.t('labels.procedures'),
          include: false,
          property: 'resolvedProcedures',
          format: '_procedureListToString'
        },
        contacts: {
          label: i18n.t('patients.labels.contacts'),
          include: false,
          property: 'patient',
          format: '_contactListToString'
        },
        referredBy: {
          label: i18n.t('patients.labels.referredBy'),
          include: false,
          property: 'patient.referredBy'
        },
        referredDate: {
          label: i18n.t('patients.labels.referredDate'),
          include: false,
          property: 'patient.referredDate',
          format: '_dateFormat'
        }
      };
    }),
    statusReportColumns: _ember['default'].computed(function () {
      var i18n = this.get('i18n');
      return {
        id: {
          label: i18n.t('labels.id'),
          include: true,
          property: 'patient.displayPatientId'
        },
        name: {
          label: i18n.t('labels.name'),
          include: true,
          property: 'patient.displayName'
        },
        status: {
          label: i18n.t('labels.status'),
          include: true,
          property: 'patient.status'
        },
        primaryDiagnosis: {
          label: i18n.t('patients.labels.primaryDiagnosis'),
          include: true,
          property: 'patient',
          format: '_formatPrimaryDiagnosis'
        },
        secondaryDiagnoses: {
          label: i18n.t('patients.labels.secondaryDiagnosis'),
          include: true,
          property: 'patient',
          format: '_formatSecondaryDiagnosis'
        }
      };
    }),
    reportTypes: _ember['default'].computed(function () {
      var i18n = this.get('i18n');
      return [{
        name: i18n.t('patients.titles.admissionsDetail'),
        value: 'detailedAdmissions'
      }, {
        name: i18n.t('patients.titles.admissionsSummary'),
        value: 'admissions'
      }, {
        name: i18n.t('patients.titles.diagnosticTesting'),
        value: 'diagnostic'
      }, {
        name: i18n.t('patients.titles.dischargesDetail'),
        value: 'detailedDischarges'
      }, {
        name: i18n.t('patients.titles.dischargesSummary'),
        value: 'discharges'
      }, {
        name: i18n.t('patients.titles.proceduresDetail'),
        value: 'detailedProcedures'
      }, {
        name: i18n.t('patients.titles.proceduresSummary'),
        value: 'procedures'
      }, {
        name: i18n.t('patients.titles.patientStatus'),
        value: 'status'
      }, {
        name: i18n.t('patients.titles.totalPatientDays'),
        value: 'patientDays'
      }, {
        name: i18n.t('patients.titles.totalPatientDaysDetailed'),
        value: 'detailedPatientDays'
      }, {
        name: i18n.t('patients.titles.visit'),
        value: 'visit'
      }];
    }),

    isDischargeReport: (function () {
      var reportType = this.get('reportType');
      return reportType.toLowerCase().indexOf('discharges') > -1;
    }).property('reportType'),

    isStatusReport: (function () {
      var reportType = this.get('reportType');
      return reportType === 'status';
    }).property('reportType'),

    isVisitReport: (function () {
      var reportType = this.get('reportType');
      return reportType === 'visit';
    }).property('reportType'),

    _addContactToList: function _addContactToList(phone, email, prefix, contactList) {
      var contactArray = [];
      if (!_ember['default'].isEmpty(email) || !_ember['default'].isEmpty(phone)) {
        if (!_ember['default'].isEmpty(phone)) {
          contactArray.push(phone);
        }
        if (!_ember['default'].isEmpty(email)) {
          contactArray.push(email);
        }
        contactList.push(prefix + contactArray.join(', '));
      }
    },

    _addReportRow: function _addReportRow(row, skipFormatting, reportColumns, rowAction) {
      if (_ember['default'].isEmpty(rowAction) && !_ember['default'].isEmpty(row.patient)) {
        var patientId = null;
        if (row.get) {
          patientId = row.get('patient.id');
        } else {
          patientId = row.patient.get('id');
        }
        if (!_ember['default'].isEmpty(patientId)) {
          rowAction = {
            action: 'viewPatient',
            model: patientId
          };
        }
      }
      this._super(row, skipFormatting, reportColumns, rowAction);
    },

    /**
     * Given a list of records, organize and total by them by type and then add them to the report.
     * @param records {Array} list of records to total.
     * @param typeField {String} the field in the records containing the type.
     * @param totalLabel {String} the label for the grand total.
     * @param reportColumns
     */
    _addRowsByType: function _addRowsByType(records, typeField, totalLabel, reportColumns) {
      var types = this._totalByType(records, typeField, totalLabel);
      types.forEach((function (type) {
        this._addReportRow(type, true, reportColumns);
      }).bind(this));
    },

    _addPatientProcedureRows: function _addPatientProcedureRows(procedureTotals, reportColumns) {
      procedureTotals.forEach((function (procedureTotal) {
        if (!_ember['default'].isEmpty(procedureTotal.records)) {
          procedureTotal.records.forEach((function (patientProcedure, index) {
            this._addReportRow({
              patient: patientProcedure.get('patient'),
              procedure: patientProcedure.get('description'),
              procedureDate: patientProcedure.get('procedureDate')
            }, false, reportColumns);
            if (index + 1 === procedureTotal.records.length) {
              this._addReportRow({
                procedure: 'Total for ' + procedureTotal.type + ': ' + procedureTotal.total
              }, true, reportColumns);
            }
          }).bind(this));
        } else {
          this._addReportRow({
            procedure: 'Total for ' + procedureTotal.type + ': ' + procedureTotal.total
          }, true, reportColumns);
        }
      }).bind(this));
    },

    _contactListToString: function _contactListToString(patient) {
      var additionalContacts = patient.get('additionalContacts');
      var contactDesc = undefined;
      var contactList = [];
      var email = patient.get('email');
      var phone = patient.get('phone');
      this._addContactToList(phone, email, 'Primary: ', contactList);
      if (!_ember['default'].isEmpty(additionalContacts)) {
        additionalContacts.forEach((function (contact) {
          contactDesc = '';
          if (!_ember['default'].isEmpty(contact.name) && !_ember['default'].isEmpty(contact.relationship)) {
            if (!_ember['default'].isEmpty(contact.name)) {
              contactDesc += contact.name;
            }
            if (!_ember['default'].isEmpty(contact.relationship)) {
              if (!_ember['default'].isEmpty(contactDesc)) {
                contactDesc += ' - ';
              }
              contactDesc += contact.relationship;
            }
            contactDesc += ': ';
          }
          this._addContactToList(contact.phone, contact.email, contactDesc, contactList);
        }).bind(this));
      }
      return contactList.join(';\n');
    },

    _dateTimeFormat: function _dateTimeFormat(value) {
      return this._dateFormat(value, 'l h:mm A');
    },

    _diagnosisListToString: function _diagnosisListToString(diagnoses) {
      return this._listToString(diagnoses, 'diagnosis', 'date');
    },
    /**
       * Find diagnostics by the specified dates and the record's start and (optional) end dates.
       */
    _findDiagnosticsByDate: function _findDiagnosticsByDate() {
      var filterEndDate = this.get('endDate');
      var filterStartDate = this.get('startDate');
      var findParams = {
        options: {},
        mapReduce: 'imaging_by_status'
      };
      var maxValue = this.get('maxValue');
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        findParams.options.startkey = ['Completed', null, filterStartDate.getTime(), null];

        if (!_ember['default'].isEmpty(filterEndDate)) {
          filterEndDate = (0, _moment['default'])(filterEndDate).endOf('day').toDate();
          findParams.options.endkey = ['Completed', maxValue, filterEndDate.getTime(), maxValue];
        }
        this.store.query('imaging', findParams).then((function (imagingRecords) {
          var returnRecords = {
            imaging: imagingRecords
          };
          findParams.mapReduce = 'lab_by_status';
          this.store.query('lab', findParams).then(function (labRecords) {
            returnRecords.labs = labRecords;
            resolve(returnRecords);
          }, reject);
        }).bind(this), reject);
      }).bind(this));
    },

    /**
     * Find procedures by the specified dates and the record's start and (optional) end dates.
     */
    _findPatientsByStatus: function _findPatientsByStatus() {
      var status = this.get('status');
      var findParams = {
        options: {
          key: status
        },
        mapReduce: 'patient_by_status'
      };
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        this.store.query('patient', findParams).then(resolve, reject);
      }).bind(this));
    },

    /**
     * Find procedures by the specified dates and the record's start and (optional) end dates.
     */
    _findProceduresByDate: function _findProceduresByDate() {
      var filterEndDate = this.get('endDate');
      var filterStartDate = this.get('startDate');
      var findParams = {
        options: {},
        mapReduce: 'procedure_by_date'
      };
      var maxValue = this.get('maxValue');
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        findParams.options.startkey = [filterStartDate.getTime(), null];

        if (!_ember['default'].isEmpty(filterEndDate)) {
          filterEndDate = (0, _moment['default'])(filterEndDate).endOf('day').toDate();
          findParams.options.endkey = [filterEndDate.getTime(), maxValue];
        }
        this.store.query('procedure', findParams).then(resolve, reject);
      }).bind(this));
    },

    /**
     * Find visits by the specified dates and the record's start and (optional) end dates.
     * @param {String} reportType the type of report to find visits for.
     */
    _findVisitsByDate: function _findVisitsByDate() {
      var filterEndDate = this.get('endDate');
      var filterStartDate = this.get('startDate');
      var findParams = {
        options: {},
        mapReduce: 'visit_by_date'
      };
      var isDischargeReport = this.get('isDischargeReport');
      var maxValue = this.get('maxValue');
      if (isDischargeReport) {
        findParams.mapReduce = 'visit_by_discharge_date';
      }

      /**
       * Admissions - start date between start and end date
       * Discharge end date between start and end date
       */
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        var isDischargeReport = this.get('isDischargeReport');
        findParams.options.startkey = [filterStartDate.getTime(), null];
        if (!_ember['default'].isEmpty(filterEndDate)) {
          filterEndDate = (0, _moment['default'])(filterEndDate).endOf('day').toDate();
          if (isDischargeReport) {
            findParams.options.endkey = [filterEndDate.getTime(), maxValue];
          } else {
            findParams.options.endkey = [filterEndDate.getTime(), maxValue, maxValue];
          }
        }
        this.store.query('visit', findParams).then(resolve, reject);
      }).bind(this));
    },

    _filterByLike: function _filterByLike(records, field, likeCondition) {
      return records.filter(function (record) {
        var fieldValue = record.get('field');
        if (_ember['default'].isEmpty(fieldValue)) {
          return false;
        } else {
          if (_ember['default'].isArray(fieldValue)) {
            var foundValue = fieldValue.find((function (value) {
              return this._haveLikeValue(value, likeCondition);
            }).bind(this));
            return !_ember['default'].isEmpty(foundValue);
          } else {
            return this._haveLikeValue(fieldValue, likeCondition);
          }
        }
      });
    },

    _filterInPatientVisit: function _filterInPatientVisit(visit) {
      var outPatient = visit.get('outPatient');
      var status = visit.get('status');
      return !outPatient && !_ember['default'].isEmpty(status);
    },

    _finishVisitReport: function _finishVisitReport(visits) {
      var visitTypes = this._totalByType(visits, 'visitType', 'total');
      visitTypes.forEach((function (visitType) {
        if (visitType.type === 'total') {
          this._addReportRow({
            visitDate: 'Total visits: ' + visitType.total
          });
        } else {
          visitType.records.forEach((function (visit) {
            this._addReportRow(visit);
          }).bind(this));
          this._addReportRow({
            visitDate: 'Total for ' + visitType.type + ': ' + visitType.total
          });
        }
      }).bind(this));
      this._finishReport();
    },
    _formatPrimaryDiagnosis: function _formatPrimaryDiagnosis(patient) {
      var primaryDiagnoses = this.getDiagnoses(patient, true, false);
      return this._diagnosisListToString(primaryDiagnoses);
    },

    _formatSecondaryDiagnosis: function _formatSecondaryDiagnosis(patient) {
      var secondaryDiagnoses = this.getDiagnoses(patient, true, true);
      return this._diagnosisListToString(secondaryDiagnoses);
    },

    _generateAdmissionOrDischargeReport: function _generateAdmissionOrDischargeReport(visits, reportType) {
      var _this = this;

      var detailedReport = false;
      var reportColumns = undefined;
      var patientBySex = {};
      var sexNotEnteredLabel = this.get('i18n').t('patients.labels.sexNotEntered');

      if (reportType.indexOf('detailed') > -1) {
        detailedReport = true;
        reportColumns = this.get('admissionDetailReportColumns');
        reportColumns.patientDays.include = false;
        if (reportType === 'detailedDischarges') {
          reportColumns.dischargeDate.include = true;
        } else {
          reportColumns.dischargeDate.include = false;
        }
      } else {
        reportColumns = this.get('admissionReportColumns');
      }
      visits = visits.filter(this._filterInPatientVisit);
      visits.forEach((function (visit) {
        if (!this.get('isDischargeReport') || !_ember['default'].isEmpty(visit.get('endDate'))) {
          var reportRow = {
            patient: visit.get('patient'),
            patientId: visit.get('patient.displayPatientId'),
            patientName: visit.get('patient.displayName'),
            admissionDate: visit.get('startDate'),
            dischargeDate: visit.get('endDate')
          };
          var sex = visit.get('patient.sex');
          if (!sex) {
            sex = sexNotEnteredLabel;
          }
          var sexGrouping = patientBySex[sex];
          if (!sexGrouping) {
            sexGrouping = {
              count: 0,
              rows: []
            };
            patientBySex[sex] = sexGrouping;
          }
          sexGrouping.count++;
          sexGrouping.rows.push(reportRow);
        }
      }).bind(this));
      var sexTotal = 0;
      var addPatientBySexRows = function addPatientBySexRows(reportRow) {
        _this._addReportRow(reportRow, false, reportColumns);
      };
      for (var sex in patientBySex) {
        if (detailedReport) {
          patientBySex[sex].rows.forEach(addPatientBySexRows);
          this._addReportRow({ patientId: sex + ' Total: ' + patientBySex[sex].count }, true, reportColumns);
        } else {
          this._addReportRow({ sex: sex, total: patientBySex[sex].count }, true, reportColumns);
        }
        sexTotal += patientBySex[sex].count;
      }
      this._addReportRow({ patientId: 'Grand Total: ' + sexTotal }, true, reportColumns);
      this._finishReport(reportColumns);
    },

    _generateDiagnosticReport: function _generateDiagnosticReport() {
      this._findDiagnosticsByDate().then((function (diagnostics) {
        var reportColumns = this.get('diagnosticReportColumns');
        this._addRowsByType(diagnostics.imaging, 'imagingType.name', 'Total for imaging: ', reportColumns);
        this._addRowsByType(diagnostics.labs, 'labType.name', 'Total for labs: ', reportColumns);
        this._finishReport(reportColumns);
      }).bind(this), (function (err) {
        this._notifyReportError('Error in _generateDiagnosticReport: ' + err);
      }).bind(this));
    },

    _generatePatientDaysReport: function _generatePatientDaysReport(visits, reportType) {
      visits = visits.filter(this._filterInPatientVisit);
      var detailed = reportType.indexOf('detailed') === 0;
      var reportEndDate = this.get('endDate');
      var reportColumns = undefined;
      var reportStartDate = (0, _moment['default'])(this.get('startDate')).startOf('day');
      if (detailed) {
        reportColumns = this.get('admissionDetailReportColumns');
        reportColumns.patientDays.include = true;
        reportColumns.dischargeDate.include = true;
      } else {
        reportColumns = {
          total: {
            label: 'Total',
            include: true,
            property: 'total',
            format: '_numberFormat'
          }
        };
      }
      if (_ember['default'].isEmpty(reportEndDate)) {
        reportEndDate = (0, _moment['default'])().endOf('day');
      } else {
        reportEndDate = (0, _moment['default'])(reportEndDate).endOf('day');
      }
      var patientDays = visits.reduce((function (previousValue, visit) {
        var calcEndDate = visit.get('endDate');
        var calcStartDate = (0, _moment['default'])(visit.get('startDate')).startOf('day');
        if (_ember['default'].isEmpty(calcEndDate)) {
          calcEndDate = (0, _moment['default'])().endOf('day');
        } else {
          calcEndDate = (0, _moment['default'])(calcEndDate).endOf('day');
        }
        if (calcStartDate.isBefore(reportStartDate)) {
          calcStartDate = reportStartDate;
        }
        if (calcEndDate.isAfter(reportEndDate)) {
          calcEndDate = reportEndDate;
        }
        var daysDiff = calcEndDate.diff(calcStartDate, 'days', true);
        if (detailed) {
          this._addReportRow({
            patient: visit.get('patient'),
            patientId: visit.get('patient.displayPatientId'),
            patientName: visit.get('patient.displayName'),
            admissionDate: visit.get('startDate'),
            dischargeDate: visit.get('endDate'),
            patientDays: daysDiff
          }, false, reportColumns);
        }
        return previousValue += daysDiff;
      }).bind(this), 0);
      if (detailed) {
        this._addReportRow({ patientDays: 'Total: ' + this._numberFormat(patientDays) }, true, reportColumns);
      } else {
        this._addReportRow({ total: patientDays }, false, reportColumns);
      }
      this._finishReport(reportColumns);
    },

    _generateProcedureReport: function _generateProcedureReport(reportType) {
      this._findProceduresByDate().then((function (procedures) {
        var reportColumns = undefined;
        procedures = procedures.filter(function (procedure) {
          var visit = procedure.get('visit');
          if (_ember['default'].isEmpty(visit) || _ember['default'].isEmpty(visit.get('patient.id')) || visit.get('patient.archived') === true) {
            return false;
          } else {
            return true;
          }
        });
        if (reportType.indexOf('detailed') === 0) {
          reportColumns = this.get('procedureDetailReportColumns');
          procedures.forEach(function (procedure) {
            procedure.set('patient', procedure.get('visit.patient'));
          });
          var procedureTotals = this._totalByType(procedures, 'description', 'all procedures');
          this._addPatientProcedureRows(procedureTotals, reportColumns);
          this._finishReport(reportColumns);
        } else {
          reportColumns = this.get('diagnosticReportColumns');
          this._addRowsByType(procedures, 'description', 'Total procedures: ', reportColumns);
          this._finishReport(reportColumns);
        }
      }).bind(this), (function (err) {
        this._notifyReportError('Error in _generateProcedureReport: ' + err);
      }).bind(this));
    },

    _generateStatusReport: function _generateStatusReport() {
      this._findPatientsByStatus().then((function (patients) {
        var reportColumns = this.get('statusReportColumns');
        var sortedPatients = patients.sortBy('lastName', 'firstName');
        this._getPatientVisits(sortedPatients).then((function (resolvedPatients) {
          resolvedPatients.forEach((function (patient) {
            this._addReportRow({ patient: patient }, false, reportColumns);
          }).bind(this));
          this._finishReport(reportColumns);
        }).bind(this))['catch']((function (err) {
          this._notifyReportError('Error in _generateStatusReport: ' + err);
        }).bind(this));
      }).bind(this))['catch']((function (err) {
        this._notifyReportError('Error in _generateStatusReport: ' + err);
      }).bind(this));
    },

    _generateVisitReport: function _generateVisitReport(visits) {
      var _this2 = this;

      var reportColumns = this.get('reportColumns');
      var visitFilters = this.getProperties('examiner', 'visitDate', 'visitType', 'location', 'clinic', 'primaryDiagnosis', 'secondaryDiagnosis');
      for (var filter in visitFilters) {
        if (!_ember['default'].isEmpty(visitFilters[filter])) {
          switch (filter) {
            case 'diagnosis':
              {
                visits = this._filterByLike(visits, 'diagnosisList', visitFilters[filter]);
                break;
              }
            default:
              {
                visits = visits.filterBy(filter, visitFilters[filter]);
                break;
              }
          }
        }
      }
      if (reportColumns.procedures.include) {
        (function () {
          var promisesMap = {};
          visits.forEach(function (visit) {
            promisesMap[visit.get('id')] = visit.get('procedures');
          });
          _ember['default'].RSVP.hash(promisesMap).then((function (resolutionHash) {
            visits.forEach(function (visit) {
              visit.set('resolvedProcedures', resolutionHash[visit.get('id')]);
            });
            this._finishVisitReport(visits);
          }).bind(_this2));
        })();
      } else {
        this._finishVisitReport(visits);
      }
    },

    _getPatientVisits: function _getPatientVisits(patients) {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        var visitHash = {};
        patients.forEach((function (patient) {
          visitHash[patient.get('id')] = this.getPatientVisits(patient);
        }).bind(this));
        _ember['default'].RSVP.hash(visitHash).then(function (resolvedHash) {
          patients.forEach(function (patient) {
            patient.set('visits', resolvedHash[patient.get('id')]);
          });
          resolve(patients);
        }, reject);
      }).bind(this));
    },

    _haveLikeValue: function _haveLikeValue(valueToCompare, likeCondition) {
      return valueToCompare.toLowerCase().indexOf(likeCondition.toLowerCase()) > -1;
    },

    _listToString: function _listToString(items, descField, dateField) {
      var itemList = [];
      if (!_ember['default'].isEmpty(items)) {
        itemList = items.map((function (item) {
          return _ember['default'].get(item, descField) + ' ( ' + this._dateFormat(_ember['default'].get(item, dateField)) + ')';
        }).bind(this));
      }
      return itemList.join(',\n');
    },

    /**
     * Given a list of records, total them by type and also add a grand total.
     * @param records {Array} list of records to total.
     * @param typeField {String} the field in the records containing the type.
     * @param totalLabel {String} the label for the grand total.
     * @param reportColumns
     */
    _totalByType: function _totalByType(records, typeField, totalLabel) {
      var total = 0;
      var types = [];
      records.forEach(function (record) {
        var type = record.get(typeField);
        var typeObject = undefined;
        if (!_ember['default'].isEmpty(type)) {
          typeObject = types.find(function (item) {
            var itemType = item.type;
            return itemType.trim().toLowerCase() === type.toLowerCase();
          });
          if (_ember['default'].isEmpty(typeObject)) {
            typeObject = {
              type: type.trim(),
              total: 0,
              records: []
            };
            types.push(typeObject);
          }
          typeObject.total++;
          typeObject.records.push(record);
          total++;
        }
      });
      types = types.sortBy('type');
      types.push({ type: totalLabel, total: total });
      return types;
    },

    _procedureListToString: function _procedureListToString(procedures) {
      return this._listToString(procedures, 'description', 'procedureDate');
    },

    _validateDates: function _validateDates() {
      var alertMessage = undefined;
      var endDate = this.get('endDate');
      var isValid = true;
      var reportType = this.get('reportType');
      var startDate = this.get('startDate');
      if (reportType === 'status') {
        return true;
      }
      if (_ember['default'].isEmpty(startDate)) {
        alertMessage = 'Please enter a start date.';
        isValid = false;
      } else if (!_ember['default'].isEmpty(endDate) && endDate.getTime() < startDate.getTime()) {
        alertMessage = 'Please enter an end date after the start date.';
        isValid = false;
      }
      if (!isValid) {
        this.displayAlert('Error Generating Report', alertMessage);
      }
      return isValid;
    },

    actions: {
      generateReport: function generateReport() {
        var _this3 = this;

        if (this._validateDates()) {
          (function () {
            var reportRows = _this3.get('reportRows');
            var reportType = _this3.get('reportType');
            reportRows.clear();
            _this3.showProgressModal();
            switch (reportType) {
              case 'diagnostic':
                {
                  _this3._generateDiagnosticReport();
                  break;
                }
              case 'detailedProcedures':
              case 'procedures':
                {
                  _this3._generateProcedureReport(reportType);
                  break;
                }
              case 'admissions':
              case 'discharges':
              case 'detailedAdmissions':
              case 'detailedDischarges':
              case 'detailedPatientDays':
              case 'patientDays':
              case 'visit':
                {
                  _this3._findVisitsByDate().then((function (visits) {
                    switch (reportType) {
                      case 'admissions':
                      case 'detailedAdmissions':
                      case 'detailedDischarges':
                      case 'discharges':
                        {
                          this._generateAdmissionOrDischargeReport(visits, reportType);
                          break;
                        }
                      case 'detailedPatientDays':
                      case 'patientDays':
                        {
                          this._generatePatientDaysReport(visits, reportType);
                          break;
                        }
                      case 'visit':
                        {
                          this._generateVisitReport(visits);
                          break;
                        }
                    }
                  }).bind(_this3), (function (err) {
                    this._notifyReportError('Error in _findVisitsByDate: ' + err);
                  }).bind(_this3));
                  break;
                }
              case 'status':
                {
                  _this3._generateStatusReport();
                  break;
                }
            }
          })();
        }
      },
      viewPatient: function viewPatient(id) {
        this.store.find('patient', id).then((function (item) {
          item.set('returnTo', 'patients.reports');
          this.transitionToRoute('patients.edit', item);
        }).bind(this));
      }

    }
  });
});
define('hospitalrun/patients/reports/route', ['exports', 'hospitalrun/routes/abstract-index-route', 'ember', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractIndexRoute, _ember, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend({
    pageTitle: (0, _emberI18n.translationMacro)('patients.titles.patientReport'),

    // No model for reports; data gets retrieved when report is run.
    model: function model() {
      return _ember['default'].RSVP.resolve(_ember['default'].Object.create({}));
    }

  });
});
define("hospitalrun/patients/reports/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "POWKbhtv", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[null]],false]],5],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"generateReport\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.reports.generate\"],null],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showReportResults\"]]],null,1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"get\",[\"reportHeader\"]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"reportHeader\"]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"reportTitle\"]],false],[\"append\",[\"helper\",[\"nav-paging\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"reportHeaders\"]]],null,0],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"partial\",\"report-rows\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"a\",[]],[\"dynamic-attr\",\"href\",[\"unknown\",[\"csvExport\"]],null],[\"static-attr\",\"target\",\"_blank\"],[\"dynamic-attr\",\"download\",[\"concat\",[[\"unknown\",[\"reportTitle\"]],\".csv\"]]],[\"static-attr\",\"class\",\"btn btn-default\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.reports.export\"],null],false],[\"close-element\"],[\"text\",\"\\n\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\",\"prompt\"],[\"col-sm-6\",\"Visit Type\",\"visitType\",[\"get\",[\"visitTypes\"]],\" \"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\",\"prompt\"],[\"col-sm-6\",\"Examiner\",\"examiner\",[\"get\",[\"physicianList\"]],\" \"]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\",\"prompt\"],[\"col-sm-6\",\"Location\",\"location\",[\"get\",[\"locationList\"]],\" \"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\",\"prompt\"],[\"col-sm-6\",\"Clinic\",\"clinic\",[\"get\",[\"clinicList\"]],\" \"]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-xs-12\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\"],[\"diagnosis\",\"Diagnosis\",[\"get\",[\"diagnosisList\"]]]]],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\\n        \"],[\"open-element\",\"h3\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.reports.fields\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"id\",\"label\"]],\"reportColumns.id.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"name\",\"label\"]],\"reportColumns.name.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"age\",\"label\"]],\"reportColumns.age.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"contacts\",\"label\"]],\"reportColumns.contacts.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"dateOfBirth\",\"label\"]],\"reportColumns.dateOfBirth.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"examiner\",\"label\"]],\"reportColumns.examiner.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"sex\",\"label\"]],\"reportColumns.sex.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"primaryDiagnosis\",\"label\"]],\"reportColumns.primaryDiagnosis.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"procedures\",\"label\"]],\"reportColumns.procedures.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"referredBy\",\"label\"]],\"reportColumns.referredBy.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-xs-1\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"referredDate\",\"label\"]],\"reportColumns.referredDate.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"secondaryDiagnoses\",\"label\"]],\"reportColumns.secondaryDiagnoses.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"visitDate\",\"label\"]],\"reportColumns.visitDate.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"visitLocation\",\"label\"]],\"reportColumns.visitLocation.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"reportColumns\",\"visitType\",\"label\"]],\"reportColumns.visitType.include\",\"col-xs-2\"]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"data-test-selector\",\"select-report-start-date\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"startDate\",\"Start Date\",\"col-sm-4\"]]],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"data-test-selector\",\"select-report-end-date\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"endDate\",\"End Date\",\"col-sm-4\"]]],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"property\",\"label\",\"content\",\"prompt\"],[\"status\",\"Patient Status\",[\"get\",[\"statusList\"]],\" \"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"static-attr\",\"data-test-selector\",\"select-report-type\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-xs-6\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"static-attr\",\"for\",\"report-type\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.reports.reportType\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"select-list\"],null,[[\"action\",\"class\",\"content\",\"id\",\"optionValuePath\",\"optionLabelPath\",\"value\"],[[\"helper\",[\"action\"],[[\"get\",[null]],[\"helper\",[\"mut\"],[[\"get\",[\"reportType\"]]],null]],null],\"form-control\",[\"get\",[\"reportTypes\"]],\"report-type\",\"value\",\"name\",[\"get\",[\"reportType\"]]]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"isStatusReport\"]]],null,4,3],[\"block\",[\"if\"],[[\"get\",[\"isVisitReport\"]]],null,2]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/patients/reports/template.hbs" } });
});
define('hospitalrun/patients/route', ['exports', 'hospitalrun/routes/abstract-module-route', 'hospitalrun/mixins/patient-id', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractModuleRoute, _hospitalrunMixinsPatientId, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractModuleRoute['default'].extend(_hospitalrunMixinsPatientId['default'], {
    addCapability: 'add_patient',
    additionalModels: [{
      name: 'addressOptions',
      findArgs: ['option', 'address_options']
    }, {
      name: 'clinicList',
      findArgs: ['lookup', 'clinic_list']
    }, {
      name: 'countryList',
      findArgs: ['lookup', 'country_list']
    }, {
      name: 'diagnosisList',
      findArgs: ['lookup', 'diagnosis_list']
    }, {
      name: 'locationList',
      findArgs: ['lookup', 'visit_location_list']
    }, {
      name: 'physicianList',
      findArgs: ['lookup', 'physician_list']
    }, {
      name: 'pricingProfiles',
      findArgs: ['price-profile']
    }, {
      name: 'procedureList',
      findArgs: ['lookup', 'procedure_list']
    }, {
      name: 'sexList',
      findArgs: ['lookup', 'sex']
    }, {
      name: 'socialCustomForms',
      queryArgs: ['custom-form', {
        options: {
          key: 'socialwork'
        },
        mapReduce: 'custom_form_by_type'
      }]
    }, {
      name: 'statusList',
      findArgs: ['lookup', 'patient_status_list']
    }, {
      name: 'visitTypesList',
      findArgs: ['lookup', 'visit_types']
    }],

    actions: {
      createNewVisit: function createNewVisit(patient, requestedFromPatient) {
        var typeOfNewVisit = 'checkin';
        if (requestedFromPatient) {
          typeOfNewVisit = 'new';
        }
        this.transitionTo('visits.edit', typeOfNewVisit).then(function (newRoute) {
          if (requestedFromPatient) {
            newRoute.currentModel.set('returnToPatient', patient.get('id'));
          } else {
            newRoute.currentModel.set('returnTo', 'patients');
          }
          newRoute.currentModel.set('patient', patient);
          newRoute.currentModel.set('hidePatientSelection', true);
          newRoute.controller.getPatientDiagnoses(patient, newRoute.currentModel);
        });
      }
    },
    newButtonText: (0, _emberI18n.translationMacro)('patients.buttons.newPatient'),
    moduleName: 'patients'
  });
});
define('hospitalrun/patients/search/controller', ['exports', 'hospitalrun/patients/index/controller'], function (exports, _hospitalrunPatientsIndexController) {
  exports['default'] = _hospitalrunPatientsIndexController['default'].extend();
});
define('hospitalrun/patients/search/route', ['exports', 'hospitalrun/routes/abstract-search-route'], function (exports, _hospitalrunRoutesAbstractSearchRoute) {
  exports['default'] = _hospitalrunRoutesAbstractSearchRoute['default'].extend({
    moduleName: 'patients',
    searchKeys: [{
      name: 'friendlyId',
      type: 'contains'
    }, {
      name: 'externalPatientId',
      type: 'contains'
    }, {
      name: 'firstName',
      type: 'fuzzy'
    }, {
      name: 'lastName',
      type: 'fuzzy'
    }, {
      name: 'phone',
      type: 'contains'
    }],
    searchModel: 'patient'
  });
});
define("hospitalrun/patients/search/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "1Xb3qJ1a", "block": "{\"statements\":[[\"block\",[\"search-listing\"],null,[[\"newButtonText\",\"allButtonText\"],[\"New Patient\",\"All Patients\"]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"partial\",\"patients/index\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/patients/search/template.hbs" } });
});
define('hospitalrun/patients/socialwork/expense/controller', ['exports', 'ember', 'hospitalrun/mixins/is-update-disabled', 'hospitalrun/utils/select-values', 'ember-i18n'], function (exports, _ember, _hospitalrunMixinsIsUpdateDisabled, _hospitalrunUtilsSelectValues, _emberI18n) {
  exports['default'] = _ember['default'].Controller.extend(_hospitalrunMixinsIsUpdateDisabled['default'], {
    patientsController: _ember['default'].inject.controller('patients'),

    categoryTypes: ['Clothing', 'Education', 'Electricity', 'Food', 'Fuel', 'Other', 'Rent', 'Transportation', 'Water'].map(_hospitalrunUtilsSelectValues['default'].selectValuesMap),

    editController: _ember['default'].computed.alias('patientsController'),
    showUpdateButton: true,
    title: (0, _emberI18n.translationMacro)('patients.titles.socialWork'),
    updateButtonAction: 'update',

    updateButtonText: (function () {
      var isNew = this.get('model.isNew');
      if (isNew) {
        return this.get('i18n').t('buttons.add');
      } else {
        return this.get('i18n').t('buttons.update');
      }
    }).property('model.isNew'),

    actions: {
      cancel: function cancel() {
        this.send('closeModal');
      },

      update: function update() {
        var model = this.get('model');
        this.get('editController').send('updateExpense', model);
      }
    }
  });
});
define("hospitalrun/patients/socialwork/expense/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "By+TRbow", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"hideCancelButton\",\"hideUpdateButton\",\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"hideCancelButton\"]],[\"get\",[\"hideUpdateButton\"]],[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"label\",\"property\",\"class\",\"content\",\"prompt\"],[[\"helper\",[\"t\"],[\"inventory.reports.rows.category\"],null],\"category\",\"required\",[\"get\",[\"categoryTypes\"]],\" \"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"patients.labels.sources\"],null],\"sources\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"patients.labels.cost\"],null],\"cost\",\"required\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/patients/socialwork/expense/template.hbs" } });
});
define('hospitalrun/patients/socialwork/family-info/controller', ['exports', 'ember', 'hospitalrun/mixins/is-update-disabled', 'ember-i18n'], function (exports, _ember, _hospitalrunMixinsIsUpdateDisabled, _emberI18n) {
  exports['default'] = _ember['default'].Controller.extend(_hospitalrunMixinsIsUpdateDisabled['default'], {
    patientsController: _ember['default'].inject.controller('patients'),

    editController: _ember['default'].computed.alias('patientsController'),
    showUpdateButton: true,
    title: (0, _emberI18n.translationMacro)('patients.titles.familyInfo'),
    updateButtonAction: 'update',

    updateButtonText: (function () {
      var isNew = this.get('model.isNew');
      if (isNew) {
        return this.get('i18n').t('buttons.add');
      } else {
        return this.get('i18n').t('buttons.update');
      }
    }).property('model.isNew'),

    actions: {
      cancel: function cancel() {
        this.send('closeModal');
      },

      update: function update() {
        var model = this.get('model');
        this.get('editController').send('updateFamilyInfo', model);
      }
    }
  });
});
define("hospitalrun/patients/socialwork/family-info/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "yqGU5ZlJ", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"hideCancelButton\",\"hideUpdateButton\",\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"hideCancelButton\"]],[\"get\",[\"hideUpdateButton\"]],[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"labels.name\"],null],\"name\",\"required col-xs-6\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"labels.age\"],null],\"age\",\"col-xs-3\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"patients.labels.civilStatus\"],null],\"civilStatus\",\"col-xs-6\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"patients.labels.relationship\"],null],\"relationship\",\"col-xs-6\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"patients.labels.education\"],null],\"education\",\"col-xs-6\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"patients.labels.occupation\"],null],\"occupation\",\"col-xs-6\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"patients.labels.income\"],null],\"income\",\"col-xs-6\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"patients.labels.insurance\"],null],\"insurance\",\"col-xs-6\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/patients/socialwork/family-info/template.hbs" } });
});
define('hospitalrun/pricing/delete/controller', ['exports', 'hospitalrun/controllers/abstract-delete-controller'], function (exports, _hospitalrunControllersAbstractDeleteController) {
  exports['default'] = _hospitalrunControllersAbstractDeleteController['default'].extend({
    title: 'Delete Pricing Item'
  });
});
define("hospitalrun/pricing/delete/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "1Lb8pDNK", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-warning-sign\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"t\"],[\"messages.delete\"],[[\"name\"],[[\"get\",[\"model\",\"name\"]]]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/pricing/delete/template.hbs" } });
});
define('hospitalrun/pricing/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember', 'hospitalrun/mixins/return-to', 'hospitalrun/utils/select-values'], function (exports, _hospitalrunControllersAbstractEditController, _ember, _hospitalrunMixinsReturnTo, _hospitalrunUtilsSelectValues) {
  var computed = _ember['default'].computed;
  var isEmpty = _ember['default'].isEmpty;

  var IMAGING_PRICING_TYPE = 'Imaging Procedure';
  var LAB_PRICING_TYPE = 'Lab Procedure';

  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsReturnTo['default'], {
    pricingController: _ember['default'].inject.controller('pricing'),

    actions: {
      addOverride: function addOverride(override) {
        var pricingOverrides = this.get('model.pricingOverrides');
        pricingOverrides.addObject(override);
        this.send('update', true);
        this.send('closeModal');
      },
      categoryChanged: function categoryChanged(category) {
        var model = this.get('model');
        var pricingType = model.get('pricingType');
        model.set('category', category);
        if (!isEmpty(category)) {
          if (category === 'Imaging') {
            model.set('pricingType', IMAGING_PRICING_TYPE);
          } else if (category === 'Lab') {
            model.set('pricingType', LAB_PRICING_TYPE);
          } else {
            var pricingTypeValues = this.get('pricingTypes.value');
            if (isEmpty(pricingTypeValues) || !pricingTypeValues.includes(pricingType)) {
              model.set('pricingType');
            }
          }
        }
      },
      deleteOverride: function deleteOverride(model) {
        var overrideToDelete = model.overrideToDelete;

        var pricingOverrides = this.get('model.pricingOverrides');
        pricingOverrides.removeObject(overrideToDelete);
        overrideToDelete.destroyRecord().then((function () {
          this.send('update', true);
          this.send('closeModal');
        }).bind(this));
      },
      editOverride: function editOverride(overrideToEdit) {
        if (isEmpty(overrideToEdit)) {
          overrideToEdit = this.store.createRecord('override-price');
        }
        this.send('openModal', 'pricing.override', overrideToEdit);
      },
      showDeleteOverride: function showDeleteOverride(overrideToDelete) {
        var message = 'Are you sure you want to delete this override?';
        var model = _ember['default'].Object.create({
          overrideToDelete: overrideToDelete
        });
        var title = 'Delete Override';
        this.displayConfirm(title, message, 'deleteOverride', model);
      }
    },

    categories: ['Imaging', 'Lab', 'Procedure', 'Ward'].map(_hospitalrunUtilsSelectValues['default'].selectValuesMap),
    expenseAccountList: computed.alias('pricingController.expenseAccountList'),
    procedurePricingTypes: computed.alias('pricingController.procedurePricingTypes'),
    wardPricingTypes: computed.alias('pricingController.wardPricingTypes'),

    lookupListsToUpdate: computed('model.category', function () {
      var category = this.get('model.category').toLowerCase();
      var listsToUpdate = [{
        name: 'expenseAccountList',
        property: 'model.expenseAccount',
        id: 'expense_account_list'
      }];
      var showPricingType = this.get('showPricingType');
      if (showPricingType) {
        listsToUpdate.push({
          name: category + 'PricingTypes',
          property: 'model.pricingType',
          id: category + '_pricing_types'
        });
      }
      return listsToUpdate;
    }),

    pricingTypes: computed('model.category', function () {
      var category = this.get('model.category');
      if (!isEmpty(category)) {
        var typesList = this.get(category.toLowerCase() + 'PricingTypes');
        return typesList;
      }
    }),

    showPricingType: computed('model.category', function () {
      var model = this.get('model');
      var category = model.get('category');
      if (category === 'Imaging' || category === 'Lab') {
        return false;
      } else {
        return true;
      }
    }),

    updateCapability: 'add_pricing',

    afterUpdate: function afterUpdate(record) {
      var message = 'The pricing record for ' + record.get('name') + ' has been saved.';
      this.displayAlert('Pricing Item Saved', message);
    }
  });
});
define('hospitalrun/pricing/edit/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'ember'], function (exports, _hospitalrunRoutesAbstractEditRoute, _ember) {
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend({
    editTitle: 'Edit Pricing Item',
    modelName: 'pricing',
    newTitle: 'New Pricing Item',

    actions: {
      deleteOverride: function deleteOverride(overrideToDelete) {
        this.controller.send('deleteOverride', overrideToDelete);
      }
    },

    getNewData: function getNewData(params) {
      var newCategory = params.pricing_id.substr(3);
      if (_ember['default'].isEmpty(newCategory)) {
        newCategory = 'Imaging';
      }
      return _ember['default'].RSVP.resolve({
        category: newCategory
      });
    },

    model: function model(params) {
      var idParam = this.get('idParam');
      if (!_ember['default'].isEmpty(idParam) && params[idParam].indexOf('new') === 0) {
        return this._createNewRecord(params);
      } else {
        return this._super(params);
      }
    }

  });
});
define("hospitalrun/pricing/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "Vf9mcSin", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],7]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"                    \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editOverride\",[\"get\",[\"override\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteOverride\",[\"get\",[\"override\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"  \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"text\",\"\\n                    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"override-profile\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"override\",\"profile\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"override\",\"price\"]],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showUpdateButton\"]]],null,0],[\"text\",\"                \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"override\"]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editOverride\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.buttons.addOverride\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"className\",\"prompt\"],[\"pricingType\",[\"helper\",[\"t\"],[\"labels.type\"],null],[\"get\",[\"pricingTypes\"]],[\"get\",[\"model\",\"pricingType\"]],\"col-xs-4 price-type form-input-group\",\" \"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"option\",[]],[\"dynamic-attr\",\"value\",[\"concat\",[[\"unknown\",[\"category\",\"id\"]]]]],[\"dynamic-attr\",\"selected\",[\"helper\",[\"is-equal\"],[[\"get\",[\"category\",\"id\"]],[\"get\",[\"model\",\"category\"]]],null],null],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"unknown\",[\"category\",\"value\"]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"category\"]},{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"labels.name\"],null],\"name\",\"required price-name\"]]],false],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"labels.price\"],null],\"price\",\"required col-xs-2 price-amount\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"className\"],[\"expenseAccount\",[\"helper\",[\"t\"],[\"labels.expenseTo\"],null],[\"get\",[\"expenseAccountList\"]],[\"get\",[\"model\",\"expenseAccount\"]],\"col-xs-4 price-department\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"required col-xs-4 price-category form-input-group\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.category\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"select\",[]],[\"dynamic-attr\",\"onchange\",[\"helper\",[\"action\"],[[\"get\",[null]],\"categoryChanged\"],[[\"value\"],[\"target.value\"]]],null],[\"static-attr\",\"class\",\"form-control\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"categories\"]]],null,5],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showPricingType\"]]],null,4],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"t\"],[\"billing.labels.pricingPanelOverrides\"],null],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showUpdateButton\"]]],null,3],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"tbody\",[]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.labels.pricingProfile\"],null],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.price\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showUpdateButton\"]]],null,2],[\"text\",\"            \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"pricingOverrides\"]]],null,1],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],6]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/pricing/edit/template.hbs" } });
});
define('hospitalrun/pricing/imaging/controller', ['exports', 'hospitalrun/pricing/index/controller'], function (exports, _hospitalrunPricingIndexController) {
  exports['default'] = _hospitalrunPricingIndexController['default'].extend();
});
define('hospitalrun/pricing/imaging/route', ['exports', 'hospitalrun/pricing/index/route'], function (exports, _hospitalrunPricingIndexRoute) {
  exports['default'] = _hospitalrunPricingIndexRoute['default'].extend({
    category: 'Imaging',
    pageTitle: 'Imaging Pricing',

    actions: {
      editItem: function editItem(item) {
        item.set('returnTo', 'pricing.imaging');
        this.transitionTo('pricing.edit', item);
      }
    }
  });
});
define("hospitalrun/pricing/imaging/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "AmO6sS3R", "block": "{\"statements\":[[\"partial\",\"pricing/index\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/pricing/imaging/template.hbs" } });
});
define('hospitalrun/pricing/index/controller', ['exports', 'hospitalrun/controllers/abstract-paged-controller'], function (exports, _hospitalrunControllersAbstractPagedController) {
  exports['default'] = _hospitalrunControllersAbstractPagedController['default'].extend({
    addPermission: 'add_pricing',
    deletePermission: 'delete_pricing',
    showCategory: true,
    startKey: []
  });
});
define('hospitalrun/pricing/index/route', ['exports', 'hospitalrun/routes/abstract-index-route', 'ember', 'hospitalrun/mixins/user-session'], function (exports, _hospitalrunRoutesAbstractIndexRoute, _ember, _hospitalrunMixinsUserSession) {
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend(_hospitalrunMixinsUserSession['default'], {
    category: null,
    modelName: 'pricing',
    pageTitle: 'All Pricing Items',

    _getStartKeyFromItem: function _getStartKeyFromItem(item) {
      var category = item.get('category');
      var id = this._getPouchIdFromItem(item);
      var name = item.get('name');
      var pricingType = item.get('pricingType');
      return [category, name, pricingType, id];
    },

    _modelQueryParams: function _modelQueryParams() {
      var category = this.get('category');
      var maxId = this._getMaxPouchId();
      var queryParams = {
        mapReduce: 'pricing_by_category'
      };
      if (!_ember['default'].isEmpty(category)) {
        queryParams.options = {
          startkey: [category, null, null, null],
          endkey: [category, {}, {}, maxId]
        };
      }
      return queryParams;
    },

    actions: {
      newItem: function newItem() {
        if (this.currentUserCan('add_pricing')) {
          var routeId = 'new';
          var routeParts = this.routeName.split('.');
          if (routeParts.length === 2 && routeParts[1] !== 'index') {
            routeId += routeParts[1].capitalize();
          }
          this.transitionTo('pricing.edit', routeId);
        }
      }
    }
  });
});
define("hospitalrun/pricing/index/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "gAbtScEq", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]],10]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newItem\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"messages.createNewRecord\"],null],false],[\"close-element\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-info\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.alerts.noPricingItems\"],null],false],[\"text\",\" \"],[\"block\",[\"if\"],[[\"get\",[\"canAdd\"]]],null,0],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"deleteItem\",[\"get\",[\"pricingItem\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"pricingItem\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canEdit\"]]],null,3],[\"block\",[\"if\"],[[\"get\",[\"canDelete\"]]],null,2],[\"text\",\"            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"pricingItem\",\"category\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"clickable\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"pricingItem\"]]]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showCategory\"]]],null,5],[\"text\",\"          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"price-name\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"pricingItem\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"pricingItem\",\"price\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"pricingItem\",\"pricingType\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"pricingItem\",\"expenseAccount\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,4],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"pricingItem\"]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.category\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showCategory\"]]],null,8],[\"text\",\"        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.name\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.price\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.type\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.expenseTo\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,7],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\"]]],null,6],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"hasRecords\"]]],null,9,1]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/pricing/index/template.hbs" } });
});
define('hospitalrun/pricing/lab/controller', ['exports', 'hospitalrun/pricing/index/controller'], function (exports, _hospitalrunPricingIndexController) {
  exports['default'] = _hospitalrunPricingIndexController['default'].extend();
});
define('hospitalrun/pricing/lab/route', ['exports', 'hospitalrun/pricing/index/route'], function (exports, _hospitalrunPricingIndexRoute) {
  exports['default'] = _hospitalrunPricingIndexRoute['default'].extend({
    category: 'Lab',
    pageTitle: 'Lab Pricing',

    actions: {
      editItem: function editItem(item) {
        item.set('returnTo', 'pricing.lab');
        this.transitionTo('pricing.edit', item);
      }
    }
  });
});
define("hospitalrun/pricing/lab/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "F2s2iidX", "block": "{\"statements\":[[\"partial\",\"pricing/index\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/pricing/lab/template.hbs" } });
});
define('hospitalrun/pricing/override/controller', ['exports', 'ember', 'hospitalrun/mixins/is-update-disabled', 'hospitalrun/utils/select-values'], function (exports, _ember, _hospitalrunMixinsIsUpdateDisabled, _hospitalrunUtilsSelectValues) {
  exports['default'] = _ember['default'].Controller.extend(_hospitalrunMixinsIsUpdateDisabled['default'], {
    pricingController: _ember['default'].inject.controller('pricing'),

    actions: {
      cancel: function cancel() {
        this.get('model').rollbackAttributes();
        this.send('closeModal');
      },

      update: function update() {
        var isNew = this.get('model.isNew');
        var override = this.get('model');
        override.save().then((function () {
          if (isNew) {
            this.get('editController').send('addOverride', override);
          } else {
            this.send('closeModal');
          }
        }).bind(this));
      }
    },

    editController: _ember['default'].inject.controller('pricing/edit'),
    pricingProfiles: _ember['default'].computed.map('pricingController.pricingProfiles', _hospitalrunUtilsSelectValues['default'].selectObjectMap),
    showUpdateButton: true,

    title: (function () {
      if (this.get('model.isNew')) {
        return 'Add Override';
      } else {
        return 'Edit Override';
      }
    }).property('model.isNew'),

    updateButtonAction: 'update',
    updateButtonText: (function () {
      var isNew = this.get('model.isNew');
      if (isNew) {
        return 'Add';
      } else {
        return 'Update';
      }
    }).property('model.isNew')

  });
});
define("hospitalrun/pricing/override/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "O/VRD/br", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"label\",\"property\",\"content\",\"optionValuePath\",\"optionLabelPath\",\"class\",\"prompt\"],[[\"helper\",[\"t\"],[\"billing.labels.pricingProfile\"],null],\"profile\",[\"get\",[\"pricingProfiles\"]],\"selectObject\",\"selectObject.name\",\"required pricing-profile\",\" \"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"labels.price\"],null],\"price\",\"required pricing-override-price\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/pricing/override/template.hbs" } });
});
define('hospitalrun/pricing/procedure/controller', ['exports', 'hospitalrun/pricing/index/controller'], function (exports, _hospitalrunPricingIndexController) {
  exports['default'] = _hospitalrunPricingIndexController['default'].extend();
});
define('hospitalrun/pricing/procedure/route', ['exports', 'hospitalrun/pricing/index/route'], function (exports, _hospitalrunPricingIndexRoute) {
  exports['default'] = _hospitalrunPricingIndexRoute['default'].extend({
    category: 'Procedure',
    pageTitle: 'Procedure Pricing',

    actions: {
      editItem: function editItem(item) {
        item.set('returnTo', 'pricing.procedure');
        this.transitionTo('pricing.edit', item);
      }
    }
  });
});
define("hospitalrun/pricing/procedure/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "axJKSd5I", "block": "{\"statements\":[[\"partial\",\"pricing/index\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/pricing/procedure/template.hbs" } });
});
define('hospitalrun/pricing/profiles/controller', ['exports', 'hospitalrun/controllers/abstract-paged-controller'], function (exports, _hospitalrunControllersAbstractPagedController) {
  exports['default'] = _hospitalrunControllersAbstractPagedController['default'].extend({
    addPermission: 'add_pricing_profile',
    deletePermission: 'delete_pricing_profile'
  });
});
define('hospitalrun/pricing/profiles/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller'], function (exports, _hospitalrunControllersAbstractEditController) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend({
    actions: {
      cancel: function cancel() {
        this.send('closeModal');
      }
    },

    afterUpdate: function afterUpdate(record) {
      var message = 'The pricing profile ' + record.get('name') + ' has been saved.';
      this.displayAlert('Pricing Profile Saved', message, 'refreshProfiles');
    },

    title: (function () {
      var isNew = this.get('model.isNew');
      if (isNew) {
        return 'New Pricing Profile';
      } else {
        return 'Edit Pricing Profile';
      }
    }).property('model.isNew')
  });
});
define("hospitalrun/pricing/profiles/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "F7bfeip8", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"name\",[\"helper\",[\"t\"],[\"labels.name\"],null],\"required pricing-profile-name\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"property\",\"label\",\"class\"],[\"discountPercentage\",[\"helper\",[\"t\"],[\"pricing.labels.discountPercentage\"],null],\"pricing-profile-percentage\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"property\",\"label\",\"class\"],[\"discountAmount\",[\"helper\",[\"t\"],[\"pricing.labels.discountAmount\"],null],\"pricing-profile-discount\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"setFee\",[\"helper\",[\"t\"],[\"pricing.labels.setFee\"],null],\"pricing-set-fee\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/pricing/profiles/edit/template.hbs" } });
});
define('hospitalrun/pricing/profiles/route', ['exports', 'hospitalrun/routes/abstract-index-route', 'ember', 'hospitalrun/mixins/modal-helper'], function (exports, _hospitalrunRoutesAbstractIndexRoute, _ember, _hospitalrunMixinsModalHelper) {
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend(_hospitalrunMixinsModalHelper['default'], {
    category: null,
    modelName: 'price-profile',
    pageTitle: 'Pricing Profiles',

    actions: {
      editItem: function editItem(item) {
        this.send('openModal', 'pricing.profiles.edit', item);
      },

      deleteItem: function deleteItem(item) {
        var message = 'Are you sure you want to delete this profile?';
        var model = _ember['default'].Object.create({
          itemToDelete: item
        });
        var title = 'Delete Profile';
        this.displayConfirm(title, message, 'deletePricingProfile', model);
      },

      deletePricingProfile: function deletePricingProfile(model) {
        model.itemToDelete.set('archived', true);
        model.itemToDelete.save().then(function () {
          model.itemToDelete.unloadRecord();
        });
      },

      newItem: function newItem() {
        var newItem = this.store.createRecord('price-profile');
        this.send('openModal', 'pricing.profiles.edit', newItem);
      },

      refreshProfiles: function refreshProfiles() {
        this.refresh();
      }
    }
  });
});
define("hospitalrun/pricing/profiles/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "uyhf3+y7", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]],8]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newItem\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"messages.createNewRecord\"],null],false],[\"close-element\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-info\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.alerts.noPricingProfiles\"],null],false],[\"text\",\". \"],[\"block\",[\"if\"],[[\"get\",[\"canAdd\"]]],null,0],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"deleteItem\",[\"get\",[\"profile\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"profile\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canEdit\"]]],null,3],[\"block\",[\"if\"],[[\"get\",[\"canDelete\"]]],null,2],[\"text\",\"            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"clickable\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"profile\"]]]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"pricing-profile-name\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"profile\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"profile\",\"discountAmount\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"profile\",\"discountPercentage\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"profile\",\"setFee\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,4],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"profile\"]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.name\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.labels.discountAmount\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.labels.discountPercentage\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.labels.setFee\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,6],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\"]]],null,5],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"hasRecords\"]]],null,7,1]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/pricing/profiles/template.hbs" } });
});
define('hospitalrun/pricing/route', ['exports', 'hospitalrun/routes/abstract-module-route'], function (exports, _hospitalrunRoutesAbstractModuleRoute) {
  exports['default'] = _hospitalrunRoutesAbstractModuleRoute['default'].extend({
    addCapability: 'add_pricing',
    additionalModels: [{
      name: 'expenseAccountList',
      findArgs: ['lookup', 'expense_account_list']
    }, {
      name: 'procedurePricingTypes',
      findArgs: ['lookup', 'procedure_pricing_types']
    }, {
      name: 'pricingProfiles',
      findArgs: ['price-profile']
    }, {
      name: 'wardPricingTypes',
      findArgs: ['lookup', 'ward_pricing_types']
    }],
    allowSearch: true,
    moduleName: 'pricing',
    newButtonText: '+ new item',
    sectionTitle: 'Pricing',
    subActions: [{
      text: 'All Pricing Items',
      linkTo: 'pricing.index'
    }, {
      text: 'Imaging Pricing',
      linkTo: 'pricing.imaging'
    }, {
      text: 'Lab Pricing',
      linkTo: 'pricing.lab'
    }, {
      text: 'Procedure Pricing',
      linkTo: 'pricing.procedure'
    }, {
      text: 'Ward Pricing',
      linkTo: 'pricing.ward'
    }, {
      text: 'Pricing Profiles',
      linkTo: 'pricing.profiles'
    }]
  });
});
define('hospitalrun/pricing/search/controller', ['exports', 'hospitalrun/patients/index/controller'], function (exports, _hospitalrunPatientsIndexController) {
  exports['default'] = _hospitalrunPatientsIndexController['default'].extend();
});
define('hospitalrun/pricing/search/route', ['exports', 'hospitalrun/routes/abstract-search-route'], function (exports, _hospitalrunRoutesAbstractSearchRoute) {
  exports['default'] = _hospitalrunRoutesAbstractSearchRoute['default'].extend({
    moduleName: 'pricing',
    searchKeys: [{
      'name': 'fuzzy'
    }],
    searchModel: 'pricing'
  });
});
define("hospitalrun/pricing/search/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "O7x5RLxb", "block": "{\"statements\":[[\"block\",[\"search-listing\"],null,[[\"newButtonText\",\"allButtonText\"],[[\"helper\",[\"t\"],[\"labels.newItem\"],null],[\"helper\",[\"t\"],[\"labels.allItems\"],null]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"partial\",\"pricing/index\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/pricing/search/template.hbs" } });
});
define('hospitalrun/pricing/ward/controller', ['exports', 'hospitalrun/pricing/index/controller'], function (exports, _hospitalrunPricingIndexController) {
  exports['default'] = _hospitalrunPricingIndexController['default'].extend();
});
define('hospitalrun/pricing/ward/route', ['exports', 'hospitalrun/pricing/index/route'], function (exports, _hospitalrunPricingIndexRoute) {
  exports['default'] = _hospitalrunPricingIndexRoute['default'].extend({
    category: 'Ward',
    pageTitle: 'Ward Pricing',

    actions: {
      editItem: function editItem(item) {
        item.set('returnTo', 'pricing.ward');
        this.transitionTo('pricing.edit', item);
      }
    }
  });
});
define("hospitalrun/pricing/ward/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "No6fuAvq", "block": "{\"statements\":[[\"partial\",\"pricing/index\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/pricing/ward/template.hbs" } });
});
define('hospitalrun/print/invoice/controller', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Controller.extend({
    actions: {
      returnToInvoice: function returnToInvoice() {
        this.transitionTo('invoices.edit', this.get('model'));
      }
    }
  });
});
define("hospitalrun/print/invoice/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "k7ZujwVg", "block": "{\"statements\":[[\"block\",[\"print-this\"],null,null,5]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"buttons.returnButton\"],null],false]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-12\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"helper\",[\"t\"],[\"print.invoice.labels.remarks\"],null],false],[\"text\",\" \"],[\"append\",[\"unknown\",[\"model\",\"remarks\"]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-12\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"helper\",[\"t\"],[\"print.invoice.labels.dischargeNotes\"],null],false],[\"text\",\" \"],[\"append\",[\"unknown\",[\"model\",\"visit\",\"dischargeInfo\"]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"append\",[\"unknown\",[\"item\",\"name\"]],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"item\",\"total\"]]],null],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"item\",\"discount\"]]],null],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"item\",\"nationalInsurance\"]]],null],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"item\",\"privateInsurance\"]]],null],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"item\",\"amountOwed\"]]],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"item\"]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"colspan\",\"6\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"categoryGroup\",\"category\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"categoryGroup\",\"items\"]]],null,3],[\"text\",\"          \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.total\"],null],false],[\"text\",\" \"],[\"append\",[\"unknown\",[\"categoryGroup\",\"category\"]],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"categoryGroup\",\"total\"]]],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"categoryGroup\",\"discount\"]]],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"categoryGroup\",\"nationalInsurance\"]]],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"categoryGroup\",\"privateInsurance\"]]],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"categoryGroup\",\"amountOwed\"]]],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"categoryGroup\"]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary print-invoice\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"h5\",[]],[\"static-attr\",\"class\",\"text-center\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"t\"],[\"print.invoice.titles.patients\"],null],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"h5\",[]],[\"static-attr\",\"class\",\"text-center\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"t\"],[\"print.invoice.titles.billingStatement\"],null],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"table\",[]],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"colspan\",\"2\"],[\"static-attr\",\"class\",\"col-xs-8\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"t\"],[\"print.invoice.labels.patientName\"],null],false],[\"text\",\" \"],[\"append\",[\"unknown\",[\"model\",\"patient\",\"displayName\"]],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-4\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"t\"],[\"print.invoice.labels.patientId\"],null],false],[\"text\",\" \"],[\"append\",[\"unknown\",[\"model\",\"patient\",\"displayPatientId\"]],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-5\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"t\"],[\"print.invoice.labels.patientAge\"],null],false],[\"text\",\" \"],[\"append\",[\"unknown\",[\"model\",\"patient\",\"age\"]],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-3\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"t\"],[\"print.invoice.labels.dateAdmitted\"],null],false],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"model\",\"visit\",\"startDate\"]]],null],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-4\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-5\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-3\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"print.invoice.labels.dateDischarged\"],null],false],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"model\",\"visit\",\"endDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-4\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"colspan\",\"3\"],[\"static-attr\",\"class\",\"col-xs-12\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"t\"],[\"print.invoice.labels.patientAddress\"],null],false],[\"text\",\" \"],[\"append\",[\"unknown\",[\"model\",\"patient\",\"displayAddress\"]],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.description\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.labels.actualCharges\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.discount\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.labels.insurance\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.labels.hmoCom\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.excess\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"lineItemsByCategory\"]]],null,4],[\"text\",\"        \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.total\"],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"model\",\"total\"]]],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"model\",\"discount\"]]],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"model\",\"nationalInsurance\"]]],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"model\",\"privateInsurance\"]]],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"model\",\"amountOwed\"]]],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"billing.labels.paymentsDeposits\"],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"colspan\",\"4\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"text\",\"-\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"model\",\"paidTotal\"]]],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.grandTotal\"],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"colspan\",\"4\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-right\"],[\"flush-element\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"number-format\"],[[\"get\",[\"model\",\"remainingBalance\"]]],null],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"table\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"model\",\"visit\",\"dischargeInfo\"]]],null,2],[\"block\",[\"if\"],[[\"get\",[\"model\",\"remarks\"]]],null,1],[\"text\",\"        \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-7\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-5\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"print.invoice.messages.whereConducted\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-8\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"print.invoice.labels.billedBy\"],null],false],[\"text\",\" \"],[\"append\",[\"unknown\",[\"model\",\"modifiedBy\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-4\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"print.invoice.labels.spacer\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-8\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"print.invoice.labels.billedDate\"],null],false],[\"text\",\" \"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"model\",\"billDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-center col-xs-4\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"print.invoice.titles.patientMember\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-8\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-4\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"print.invoice.labels.spacer\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"col-xs-8\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"text-center col-xs-4\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"print.invoice.titles.relContact\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"block\",[\"link-to\"],[\"invoices.edit\",[\"get\",[\"model\"]]],[[\"class\"],[\"btn btn-default warning\"]],0],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/print/invoice/template.hbs" } });
});
define('hospitalrun/procedures/charge/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember'], function (exports, _hospitalrunControllersAbstractEditController, _ember) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend({
    cancelAction: 'closeModal',
    newCharge: false,
    newPricingItem: false,
    requestingController: _ember['default'].inject.controller('procedures/edit'),
    database: _ember['default'].inject.service(),
    pricingList: _ember['default'].computed.alias('requestingController.pricingList'),
    selectedItem: null,
    updateCapability: 'add_charge',

    title: (function () {
      var isNew = this.get('model.isNew');
      if (isNew) {
        return this.get('i18n').t('procedures.titles.addChargeItem');
      }
      return this.get('i18n').t('procedures.titles.editChargeItem');
    }).property('model.isNew'),

    beforeUpdate: function beforeUpdate() {
      var _this = this;

      this.set('newCharge', this.get('model.isNew'));
      return new _ember['default'].RSVP.Promise(function (resolve, reject) {
        var model = _this.get('model');
        var pricingItem = model.get('pricingItem');
        var selectedItem = _this.get('selectedItem');
        if (!_ember['default'].isEmpty(selectedItem) && (_ember['default'].isEmpty(pricingItem) || selectedItem.id !== pricingItem.get('id'))) {
          _this.store.find('pricing', selectedItem.id).then(function (item) {
            model.set('pricingItem', item);
            resolve();
          });
        } else {
          (function () {
            var newItem = false;
            var saveItem = false;
            if (_ember['default'].isEmpty(pricingItem)) {
              pricingItem = _this.store.createRecord('pricing', {
                name: model.get('itemName'),
                category: model.get('pricingCategory')
              });
              newItem = true;
              saveItem = true;
            } else {
              if (pricingItem.get('name') !== model.get('itemName')) {
                pricingItem.set('name', model.get('itemName'));
                saveItem = true;
              }
            }
            if (saveItem) {
              pricingItem.save().then(function () {
                var pricingList = _this.get('pricingList');
                if (newItem) {
                  pricingList.addObject({
                    id: pricingItem.get('id'),
                    name: pricingItem.get('name')
                  });
                  model.set('pricingItem', pricingItem);
                } else {
                  var itemToUpdate = pricingList.findBy('id', pricingItem.get('id'));
                  itemToUpdate.name = pricingItem.get('name');
                }
                resolve();
              }, reject);
            } else {
              resolve();
            }
          })();
        }
      });
    },

    afterUpdate: function afterUpdate(record) {
      if (this.get('newCharge') === true) {
        this.get('requestingController').send('addCharge', record);
      } else {
        this.send('closeModal');
      }
    }
  });
});
define("hospitalrun/procedures/charge/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "jTar8j7h", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"hideCancelButton\",\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"hideCancelButton\"]],[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"pricing-typeahead\"],null,[[\"property\",\"label\",\"content\",\"selection\",\"class\"],[\"itemName\",[\"helper\",[\"t\"],[\"inventory.labels.item\"],null],[\"get\",[\"pricingList\"]],[\"get\",[\"selectedItem\"]],\"required charge-item-name\"]]],false],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"labels.quantity\"],null],\"quantity\",\"col-xs-3 required\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"dateCharged\",\"Date Charged\",\"col-xs-4 required\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/procedures/charge/template.hbs" } });
});
define('hospitalrun/procedures/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'hospitalrun/mixins/charge-actions', 'ember', 'hospitalrun/mixins/patient-submodule'], function (exports, _hospitalrunControllersAbstractEditController, _hospitalrunMixinsChargeActions, _ember, _hospitalrunMixinsPatientSubmodule) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsChargeActions['default'], _hospitalrunMixinsPatientSubmodule['default'], {
    visitsController: _ember['default'].inject.controller('visits'),

    chargePricingCategory: 'Procedure',
    chargeRoute: 'procedures.charge',

    anesthesiaTypes: _ember['default'].computed.alias('visitsController.anesthesiaTypes'),
    anesthesiologistList: _ember['default'].computed.alias('visitsController.anesthesiologistList'),
    cptCodeList: _ember['default'].computed.alias('visitsController.cptCodeList'),
    medicationList: null,
    physicianList: _ember['default'].computed.alias('visitsController.physicianList'),
    procedureList: _ember['default'].computed.alias('visitsController.procedureList'),
    procedureLocations: _ember['default'].computed.alias('visitsController.procedureLocations'),
    lookupListsToUpdate: [{
      name: 'anesthesiaTypes',
      property: 'model.anesthesiaType',
      id: 'anesthesia_types'
    }, {
      name: 'anesthesiologistList',
      property: 'model.anesthesiologist',
      id: 'anesthesiologists'
    }, {
      name: 'cptCodeList',
      property: 'model.cptCode',
      id: 'cpt_code_list'
    }, {
      name: 'physicianList',
      property: 'model.assistant',
      id: 'physician_list'
    }, {
      name: 'physicianList',
      property: 'model.physician',
      id: 'physician_list'
    }, {
      name: 'procedureList',
      property: 'model.description',
      id: 'procedure_list'
    }, {
      name: 'procedureLocations',
      property: 'model.location',
      id: 'procedure_locations'
    }],

    editController: _ember['default'].inject.controller('visits/edit'),
    pricingList: null, // This gets filled in by the route
    pricingTypes: _ember['default'].computed.alias('visitsController.procedurePricingTypes'),
    newProcedure: false,

    title: (function () {
      var isNew = this.get('model.isNew');
      if (isNew) {
        return this.get('i18n').t('procedures.titles.add');
      }
      return this.get('i18n').t('procedures.titles.edit');
    }).property('model.isNew'),

    updateCapability: 'add_procedure',

    actions: {
      showAddMedication: function showAddMedication() {
        var newCharge = this.get('store').createRecord('proc-charge', {
          dateCharged: new Date(),
          newMedicationCharge: true,
          quantity: 1
        });
        this.send('openModal', 'procedures.medication', newCharge);
      },

      showEditMedication: function showEditMedication(charge) {
        var medicationList = this.get('medicationList');
        var selectedMedication = medicationList.findBy('id', charge.get('medication.id'));
        charge.set('itemName', selectedMedication.name);
        this.send('openModal', 'procedures.medication', charge);
      },

      showDeleteMedication: function showDeleteMedication(charge) {
        this.send('openModal', 'dialog', _ember['default'].Object.create({
          closeModalOnConfirm: false,
          confirmAction: 'deleteCharge',
          title: this.get('i18n').t('procedures.titles.deleteMedicationUsed'),
          name: this.get('i18n').t('models.medication.names.singular'),
          message: this.get('i18n').t('messages.delete_singular', { name: this.name }),
          chargeToDelete: charge,
          updateButtonAction: 'confirm',
          updateButtonText: this.get('i18n').t('buttons.ok')
        }));
      }
    },

    beforeUpdate: function beforeUpdate() {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        this.updateCharges().then((function () {
          if (this.get('model.isNew')) {
            this.addChildToVisit(this.get('model'), 'procedures').then(resolve, reject);
          } else {
            resolve();
          }
        }).bind(this), reject);
      }).bind(this));
    },

    afterUpdate: function afterUpdate() {
      var alertTitle = this.get('i18n').t('procedures.titles.saved');
      var alertMessage = this.get('i18n').t('procedures.messages.saved');
      this.saveVisitIfNeeded(alertTitle, alertMessage);
    }
  });
});
define('hospitalrun/procedures/edit/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'hospitalrun/mixins/add-to-patient-route', 'hospitalrun/mixins/charge-route', 'ember', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractEditRoute, _hospitalrunMixinsAddToPatientRoute, _hospitalrunMixinsChargeRoute, _ember, _emberI18n) {
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend(_hospitalrunMixinsAddToPatientRoute['default'], _hospitalrunMixinsChargeRoute['default'], {
    editTitle: (0, _emberI18n.translationMacro)('procedures.titles.edit'),
    modelName: 'procedure',
    newTitle: (0, _emberI18n.translationMacro)('procedures.titles.new'),
    pricingCategory: 'Procedure',
    database: _ember['default'].inject.service(),

    getNewData: function getNewData() {
      return _ember['default'].RSVP.resolve({
        procedureDate: new Date()
      });
    },

    setupController: function setupController(controller, model) {
      this._super(controller, model);
      var medicationQuery = {
        key: 'Medication',
        include_docs: true
      };
      this.get('database').queryMainDB(medicationQuery, 'inventory_by_type').then(function (result) {
        var medicationList = result.rows.map(function (medication) {
          return medication.doc;
        });
        controller.set('medicationList', medicationList);
      });
    }
  });
});
define("hospitalrun/procedures/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "VsJTrj18", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],6]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"                    \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteMedication\",[\"get\",[\"charge\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"text\",\"\\n                    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                    \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showEditMedication\",[\"get\",[\"charge\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"charge\",\"medicationName\"]],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"medication-charge-quantity\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"charge\",\"quantity\"]],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddCharge\"]]],null,1],[\"block\",[\"if\"],[[\"get\",[\"canAddCharge\"]]],null,0],[\"text\",\"                \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"charge\",\"medicationCharge\"]]],null,2]],\"locals\":[\"charge\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddMedication\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"procedures.buttons.addMedication\"],null],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\",\"hint\"],[\"required procedure-description\",\"description\",\"Procedure\",[\"get\",[\"procedureList\"]],[\"get\",[\"model\",\"description\"]],false]]],false],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\"],[\"col-xs-6\",\"cptCode\",\"CPT Code\",[\"get\",[\"cptCodeList\"]],[\"get\",[\"model\",\"cptCode\"]]]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\"],[\"col-sm-3\",\"location\",\"Procedure Location\",[\"get\",[\"procedureLocations\"]],[\"get\",[\"model\",\"location\"]]]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"procedureDate\",\"Procedure Date\",\"col-sm-3 required\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"timeStarted\",\"Time Started\",\"col-sm-3\"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"timeEnded\",\"Time Ended\",\"col-sm-3\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\"],[\"col-sm-4 required procedure-physician\",\"physician\",\"Physician\",[\"get\",[\"physicianList\"]],[\"get\",[\"model\",\"physician\"]]]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\",\"prompt\"],[\"col-sm-4\",\"assistant\",\"Assistant\",[\"get\",[\"physicianList\"]],[\"get\",[\"model\",\"assistant\"]],\" \"]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\"],[\"col-sm-4\",\"anesthesiologist\",\"Anesthesiologist\",[\"get\",[\"anesthesiologistList\"]],[\"get\",[\"model\",\"anesthesiologist\"]]]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\"],[\"col-sm-4\",\"anesthesiaType\",\"Anesthesia Type\",[\"get\",[\"anesthesiaTypes\"]],[\"get\",[\"model\",\"anesthesiaTypes\"]]]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"label\",\"property\",\"rows\",\"class\"],[\"Notes\",\"notes\",3,\"procedure-notes\"]]],false],[\"text\",\"\\n    \"],[\"partial\",\"item-charges\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel detail-section medication-charges\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"t\"],[\"procedures.titles.medicationUsed\"],null],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddCharge\"]]],null,4],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.item\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.quantity\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.action\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"charges\"]]],null,3],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],5]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/procedures/edit/template.hbs" } });
});
define('hospitalrun/procedures/medication/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember'], function (exports, _hospitalrunControllersAbstractEditController, _ember) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend({
    cancelAction: 'closeModal',
    newCharge: false,
    requestingController: _ember['default'].inject.controller('procedures/edit'),
    medicationList: _ember['default'].computed.alias('requestingController.medicationList'),

    updateCapability: 'add_charge',

    title: (function () {
      var isNew = this.get('model.isNew');
      if (isNew) {
        return this.get('i18n').t('procedures.titles.addMedicationUsed');
      }
      return this.get('i18n').t('procedures.titles.editMedicationUsed');
    }).property('model.isNew'),

    beforeUpdate: function beforeUpdate() {
      var isNew = this.get('model.isNew');
      if (isNew) {
        this.set('newCharge', true);
        var model = this.get('model');
        var inventoryItem = model.get('inventoryItem');
        model.set('medication', inventoryItem);
        model.set('medicationTitle', inventoryItem.get('name'));
        model.set('priceOfMedication', inventoryItem.get('price'));
      }
      return _ember['default'].RSVP.Promise.resolve();
    },

    afterUpdate: function afterUpdate(record) {
      if (this.get('newCharge')) {
        this.get('requestingController').send('addCharge', record);
      } else {
        this.send('closeModal');
      }
    }
  });
});
define("hospitalrun/procedures/medication/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "AYUw1LaS", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"hideCancelButton\",\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"hideCancelButton\"]],[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"inventory-typeahead\"],null,[[\"property\",\"label\",\"content\",\"selection\",\"class\"],[\"itemName\",[\"helper\",[\"t\"],[\"procedures.labels.medicationUsed\"],null],[\"get\",[\"medicationList\"]],[\"get\",[\"selectedInventoryItem\"]],\"medication-used\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"label\",\"property\",\"class\"],[[\"helper\",[\"t\"],[\"labels.quantity\"],null],\"quantity\",\"required medication-quantity\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/procedures/medication/template.hbs" } });
});
define('hospitalrun/resolver', ['exports', 'ember-resolver'], function (exports, _emberResolver) {
  exports['default'] = _emberResolver['default'];
});
define('hospitalrun/router', ['exports', 'ember', 'hospitalrun/config/environment'], function (exports, _ember, _hospitalrunConfigEnvironment) {

  var Router = _ember['default'].Router.extend({
    location: _hospitalrunConfigEnvironment['default'].locationType,
    rootURL: _hospitalrunConfigEnvironment['default'].rootURL
  });

  Router.map(function () {
    this.route('admin', function () {
      this.route('address');
      this.route('print-header');
      this.route('custom-forms', function () {
        this.route('edit', { path: '/edit/:custom-form_id' });
      });
      this.route('loaddb');
      this.route('inc-category', {
        resetNamespace: true
      }, function () {
        this.route('edit', { path: '/edit/:inc-category_id' });
      });
      this.route('lookup', { path: '/' });
      this.route('textreplace');
      this.route('users', {
        resetNamespace: true
      }, function () {
        this.route('edit', { path: '/edit/:user_id' });
      });
      this.route('roles');
      this.route('query');
      this.route('visit-forms');
      this.route('workflow');
    });

    this.route('appointments', function () {
      this.route('edit', { path: '/edit/:appointment_id' });
      this.route('search');
      this.route('today');
      this.route('calendar');
      this.route('theater');
    });

    this.route('finishgauth', { path: '/finishgauth/:s1/:s2/:k/:t/:i/:p' });

    this.route('index', { path: '/' });

    this.route('imaging', function () {
      this.route('completed');
      this.route('edit', { path: '/edit/:imaging_id' });
    });

    this.route('inventory', function () {
      this.route('barcode', { path: '/barcode/:inventory_id' });
      this.route('edit', { path: '/edit/:inventory_id' });
      this.route('batch', { path: '/batch/:inventory-batch_id' });
      this.route('listing');
      this.route('reports');
      this.route('request', { path: '/request/:inv-request_id' });
      this.route('search', { path: '/search/:search_text' });
    });

    this.route('incident', function () {
      this.route('completed');
      this.route('edit', { path: '/edit/:incident_id' });
      this.route('reports');
    });

    this.route('invoices', function () {
      this.route('cashier');
      this.route('edit', { path: '/edit/:invoice_id' });
      this.route('search', { path: '/search/:search_text' });
    });

    this.route('labs', function () {
      this.route('completed');
      this.route('edit', { path: '/edit/:lab_id' });
    });

    this.route('login');

    this.route('medication', function () {
      this.route('completed');
      this.route('edit', { path: '/edit/:medication_id' });
      this.route('return', { path: '/return/:inv-request_id' });
      this.route('search', { path: '/search/:search_text' });
    });

    this.route('patients', function () {
      this.route('edit', { path: '/edit/:patient_id' });
      this.route('reports');
      this.route('admitted');
      this.route('search', { path: '/search/:search_text' });
      this.route('operative-plan', { path: '/operative-plan/:operative-plan_id' });
      this.route('operation-report', { path: '/operation-report/:operation-report_id' });
      this.route('outpatient');
    });

    this.route('pricing', function () {
      this.route('imaging');
      this.route('lab');
      this.route('procedure');
      this.route('ward');
      this.route('edit', { path: '/edit/:pricing_id' });
      this.route('search', { path: '/search/:search_text' });
      this.route('profiles');
    });

    this.route('print', function () {
      this.route('invoice', { path: '/invoice/:invoice_id' });
    });

    this.route('visits', function () {
      this.route('edit', { path: '/edit/:visit_id' });
      this.route('procedures', {
        resetNamespace: true
      }, function () {
        this.route('edit', { path: '/edit/:procedure_id' });
      });
      this.route('reports', function () {
        this.route('edit', { path: '/edit/:report_id' });
      });
    });
  });

  exports['default'] = Router;
});
define('hospitalrun/routes/abstract-edit-route', ['exports', 'ember-simple-auth/mixins/authenticated-route-mixin', 'ember'], function (exports, _emberSimpleAuthMixinsAuthenticatedRouteMixin, _ember) {
  var get = _ember['default'].get;
  exports['default'] = _ember['default'].Route.extend(_emberSimpleAuthMixinsAuthenticatedRouteMixin['default'], {
    editTitle: null,
    hideNewButton: false,
    modelName: null,
    newTitle: null,

    _createNewRecord: function _createNewRecord(params) {
      return new _ember['default'].RSVP.Promise((function (resolve) {
        this.generateId().then((function (newId) {
          this.getNewData(params).then((function (data) {
            var modelName = get(this, 'modelName');
            if (newId) {
              data.id = newId;
            }
            if (newId && this.store.hasRecordForId(modelName, newId)) {
              resolve(this.store.push(this.store.normalize(modelName, data)));
            } else {
              resolve(this.store.createRecord(modelName, data));
            }
          }).bind(this));
        }).bind(this));
      }).bind(this));
    },

    idParam: (function () {
      var modelName = get(this, 'modelName');
      return modelName + '_id';
    }).property('modelName'),

    /**
     * Override this function to generate an id for a new record
     * @return a promise that will resolved to a generated id;default is null which means that an
     * id will be automatically generated via Ember data.
     */
    generateId: function generateId() {
      return _ember['default'].RSVP.resolve(null);
    },

    /**
     * Override this function to define what data a new model should be instantiated with.
     * @return a promise that will resolve with the data for a new record; defaults to empty object.
     */
    getNewData: function getNewData() {
      return _ember['default'].RSVP.resolve({});
    },

    getScreenTitle: function getScreenTitle(model) {
      if (get(model, 'isNew')) {
        return get(this, 'newTitle');
      } else {
        return get(this, 'editTitle');
      }
    },

    model: function model(params) {
      var idParam = get(this, 'idParam');
      if (!_ember['default'].isEmpty(idParam) && params[idParam] === 'new') {
        return this._createNewRecord(params);
      } else {
        return this._super(params);
      }
    },

    setupController: function setupController(controller, model) {
      var sectionDetails = {};
      sectionDetails.currentScreenTitle = this.getScreenTitle(model);
      if (get(this, 'hideNewButton')) {
        sectionDetails.newButtonAction = null;
      }
      this.send('setSectionHeader', sectionDetails);
      this._super(controller, model);
    }
  });
});
define('hospitalrun/routes/abstract-index-route', ['exports', 'ember-simple-auth/mixins/authenticated-route-mixin', 'ember', 'hospitalrun/mixins/pouchdb', 'hospitalrun/mixins/progress-dialog'], function (exports, _emberSimpleAuthMixinsAuthenticatedRouteMixin, _ember, _hospitalrunMixinsPouchdb, _hospitalrunMixinsProgressDialog) {
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _ember['default'].Route.extend(_hospitalrunMixinsPouchdb['default'], _hospitalrunMixinsProgressDialog['default'], _emberSimpleAuthMixinsAuthenticatedRouteMixin['default'], {
    database: _ember['default'].inject.service(),
    filterParams: null,
    firstKey: null,
    hideNewButton: false,
    itemsPerPage: 25,
    modelName: null,
    newButtonAction: null,
    newButtonText: null,
    nextStartKey: null,
    pageTitle: null,

    _getFilterParams: function _getFilterParams(params) {
      var filterByList = [];
      var filterParams = this.get('filterParams');
      if (!isEmpty(filterParams)) {
        filterParams.forEach(function (paramName) {
          if (!isEmpty(params[paramName])) {
            filterByList.push({
              name: paramName,
              value: params[paramName]
            });
          }
        });
      }
      return filterByList;
    },

    _getMaxPouchId: function _getMaxPouchId() {
      return this.get('database').getMaxPouchId(this.get('modelName').camelize());
    },

    _getMinPouchId: function _getMinPouchId() {
      return this.get('database').getMinPouchId(this.get('modelName').camelize());
    },

    _getPouchIdFromItem: function _getPouchIdFromItem(item) {
      return this.get('database').getPouchId(item.get('id'), this.get('modelName').camelize());
    },

    _getStartKeyFromItem: function _getStartKeyFromItem(item) {
      return item.get('id');
    },

    _modelQueryParams: function _modelQueryParams() {
      return {};
    },

    model: function model(params) {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        var filterParams = this._getFilterParams(params);
        var modelName = this.get('modelName');
        var itemsPerPage = this.get('itemsPerPage');
        var queryParams = this._modelQueryParams(params);
        if (!isEmpty(params.sortKey)) {
          queryParams.sortKey = params.sortKey;
          if (!isEmpty(params.sortDesc)) {
            queryParams.sortDesc = params.sortDesc;
          }
        }
        if (!isEmpty(filterParams)) {
          queryParams.filterBy = filterParams;
        }
        if (isEmpty(queryParams.options)) {
          queryParams.options = {};
        }
        if (!isEmpty(itemsPerPage)) {
          queryParams.options.limit = itemsPerPage + 1;
        }
        if (!isEmpty(params.startKey)) {
          queryParams.options.startkey = params.startKey;
        }
        this.store.query(modelName, queryParams).then((function (model) {
          if (!isEmpty(itemsPerPage)) {
            if (model.get('length') > 0) {
              this.set('firstKey', this._getStartKeyFromItem(model.get('firstObject')));
            }
            if (model.get('length') > itemsPerPage) {
              var lastItem = model.popObject();
              this.set('nextStartKey', this._getStartKeyFromItem(lastItem));
            } else {
              this.set('nextStartKey');
            }
          }
          resolve(model);
        }).bind(this), reject);
      }).bind(this));
    },

    queryParams: {
      sortDesc: { refreshModel: true },
      sortKey: { refreshModel: true },
      startKey: { refreshModel: true }
    },

    setupController: function setupController(controller, model) {
      var props = this.getProperties('firstKey', 'nextStartKey');
      controller.setProperties(props);
      var sectionDetails = {
        currentScreenTitle: this.get('pageTitle')
      };
      if (this.get('hideNewButton')) {
        sectionDetails.newButtonAction = null;
      } else if (!isEmpty(this.get('newButtonAction'))) {
        sectionDetails.newButtonAction = this.get('newButtonAction');
      }
      if (!isEmpty(this.get('newButtonText'))) {
        sectionDetails.newButtonText = this.get('newButtonText');
      }
      this.send('setSectionHeader', sectionDetails);
      this.closeProgressModal();
      this._super(controller, model);
    }
  });
});
define('hospitalrun/routes/abstract-module-route', ['exports', 'ember-simple-auth/mixins/authenticated-route-mixin', 'ember', 'hospitalrun/mixins/user-session'], function (exports, _emberSimpleAuthMixinsAuthenticatedRouteMixin, _ember, _hospitalrunMixinsUserSession) {
  function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }

  /**
   * Abstract route for top level modules (eg patients, inventory, users)
   */
  exports['default'] = _ember['default'].Route.extend(_hospitalrunMixinsUserSession['default'], _emberSimpleAuthMixinsAuthenticatedRouteMixin['default'], {
    addCapability: null,
    additionalModels: null,
    allowSearch: true,
    currentScreenTitle: null,
    moduleName: null,
    newButtonText: null,
    sectionTitle: null,
    subActions: null,

    editPath: (function () {
      var module = this.get('moduleName');
      return module + '.edit';
    }).property('moduleName'),

    deletePath: (function () {
      var module = this.get('moduleName');
      return module + '.delete';
    }).property('moduleName'),

    newButtonAction: (function () {
      if (this.currentUserCan(this.get('addCapability'))) {
        return 'newItem';
      } else {
        return null;
      }
    }).property(),

    searchRoute: (function () {
      var module = this.get('moduleName');
      return '/' + module + '/search';
    }).property('moduleName'),

    actions: {
      allItems: function allItems() {
        this.transitionTo(this.get('moduleName') + '.index');
      },
      deleteItem: function deleteItem(item) {
        var deletePath = this.get('deletePath');
        this.send('openModal', deletePath, item);
      },
      editItem: function editItem(item) {
        this.transitionTo(this.get('editPath'), item);
      },
      newItem: function newItem() {
        if (this.currentUserCan(this.get('addCapability'))) {
          this.transitionTo(this.get('editPath'), 'new');
        }
      },

      /**
       * Action to set items in the section header.
       * @param details an object containing details to set on the section header.
       * The following parameters are supported:
       * - currentScreenTitle - The current screen title.
       * - newButtonText - The text to display for the "new" button.
       * - newButtonAction - The action to fire for the "new" button.
       */
      setSectionHeader: function setSectionHeader(details) {
        var currentController = this.controllerFor(this.get('moduleName'));
        currentController.setProperties(details);
      }

    },

    /**
     * Make sure the user has permissions to the module; if not reroute to index.
     */
    beforeModel: function beforeModel(transition) {
      var moduleName = this.get('moduleName');
      if (this.currentUserCan(moduleName)) {
        return this._super(transition);
      } else {
        this.transitionTo('index');
        return _ember['default'].RSVP.reject('Not available');
      }
    },

    model: function model() {
      if (!_ember['default'].isEmpty(this.additionalModels)) {
        return new _ember['default'].RSVP.Promise((function (resolve, reject) {
          var promises = this.additionalModels.map((function (modelMap) {

            if (modelMap.queryArgs) {
              var _store;

              return (_store = this.store).query.apply(_store, _toConsumableArray(modelMap.queryArgs));
            } else if (modelMap.findArgs.length === 1) {
              var _store2;

              return (_store2 = this.store).findAll.apply(_store2, _toConsumableArray(modelMap.findArgs));
            } else {
              var _store3;

              return (_store3 = this.store).find.apply(_store3, _toConsumableArray(modelMap.findArgs));
            }
          }).bind(this));
          _ember['default'].RSVP.allSettled(promises, 'All additional Models for ' + this.get('moduleName')).then((function (array) {
            array.forEach((function (item, index) {
              if (item.state === 'fulfilled') {
                this.set(this.additionalModels[index].name, item.value);
              }
            }).bind(this));
            resolve();
          }).bind(this), reject);
        }).bind(this), 'Additional Models for ' + this.get('moduleName'));
      } else {
        return _ember['default'].RSVP.resolve();
      }
    },

    renderTemplate: function renderTemplate() {
      this.render('section');
    },

    setupController: function setupController(controller, model) {
      var navigationController = this.controllerFor('navigation');
      if (this.get('allowSearch') === true) {
        navigationController.set('allowSearch', true);
        navigationController.set('searchRoute', this.get('searchRoute'));
      } else {
        navigationController.set('allowSearch', false);
      }
      var currentController = this.controllerFor(this.get('moduleName'));
      var propsToSet = this.getProperties('additionalButtons', 'currentScreenTitle', 'newButtonAction', 'newButtonText', 'sectionTitle', 'subActions');
      currentController.setProperties(propsToSet);
      if (!_ember['default'].isEmpty(this.additionalModels)) {
        this.additionalModels.forEach((function (item) {
          controller.set(item.name, this.get(item.name));
        }).bind(this));
      }
      this._super(controller, model);
    }

  });
});
define('hospitalrun/routes/abstract-search-route', ['exports', 'ember-simple-auth/mixins/authenticated-route-mixin', 'ember-data', 'ember'], function (exports, _emberSimpleAuthMixinsAuthenticatedRouteMixin, _emberData, _ember) {
  exports['default'] = _ember['default'].Route.extend(_emberSimpleAuthMixinsAuthenticatedRouteMixin['default'], {
    searchKeys: null,
    searchModel: null,
    searchText: null,

    _findByContains: function _findByContains(searchText) {
      var searchKeys = this.get('searchKeys');
      var searchModel = this.get('searchModel');
      var queryParams = {
        containsValue: {
          value: searchText,
          keys: searchKeys
        }
      };
      return this.store.query(searchModel, queryParams);
    },

    model: function model(params) {
      return new _ember['default'].RSVP.Promise((function (resolve) {
        var searchText = params.search_text;
        this.controllerFor('navigation').set('currentSearchText', searchText);
        this.set('searchText', searchText);
        this._findByContains(searchText).then(resolve, (function (err) {
          resolve(new _emberData['default'].AdapterPopulatedRecordArray());
          throw new Error(err);
        }).bind(this));
      }).bind(this));
    },

    setupController: function setupController(controller, model) {
      this._super(controller, model);
      if (!_ember['default'].isEmpty(model)) {
        controller.set('hasRecords', model.get('length') > 0);
      } else {
        controller.set('hasRecords', false);
      }
      controller.set('searchText', this.get('searchText'));
      this.controllerFor('navigation').closeProgressModal();
      var parentController = this.controllerFor(this.get('moduleName'));
      var searchTitle = 'Search Results for <i>' + _ember['default'].Handlebars.Utils.escapeExpression(this.get('searchText')) + '</i>';
      parentController.set('currentScreenTitle', searchTitle.htmlSafe());
    }

  });
});
define('hospitalrun/routes/application', ['exports', 'ember-simple-auth/mixins/application-route-mixin', 'ember', 'hospitalrun/mixins/modal-helper', 'hospitalrun/mixins/setup-user-role', 'hospitalrun/utils/unauthorized-error'], function (exports, _emberSimpleAuthMixinsApplicationRouteMixin, _ember, _hospitalrunMixinsModalHelper, _hospitalrunMixinsSetupUserRole, _hospitalrunUtilsUnauthorizedError) {
  function _instanceof(left, right) { if (right != null && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } }

  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var isEmpty = _ember['default'].isEmpty;
  var Route = _ember['default'].Route;
  var set = _ember['default'].set;

  var TRANSITION_AFTER_LOGIN = 'transitionAfterLogin';

  var ApplicationRoute = Route.extend(_emberSimpleAuthMixinsApplicationRouteMixin['default'], _hospitalrunMixinsModalHelper['default'], _hospitalrunMixinsSetupUserRole['default'], {
    database: inject.service(),
    config: inject.service(),
    session: inject.service(),
    shouldSetupUserRole: true,

    actions: {
      closeModal: function closeModal() {
        this.render('empty', {
          outlet: 'modal',
          into: 'application'
        });
      },

      error: function error(reason, transition) {
        var _this = this;

        if (_instanceof(reason, _hospitalrunUtilsUnauthorizedError['default'])) {
          (function () {
            var i18n = _this.get('i18n');
            var message = i18n.t('application.messages.sessionExpired');
            var session = get(_this, 'session');
            var title = i18n.t('application.titles.sessionExpired');
            if (!isEmpty(transition)) {
              var sessionStore = session.get('store');
              var sessionData = session.get('data');
              var transitionName = undefined;
              if (transition.targetName) {
                transitionName = transition.targetName;
              } else {
                transitionName = transition;
              }
              set(sessionData, TRANSITION_AFTER_LOGIN, transitionName);
              sessionStore.persist(sessionData).then(function () {
                _this.displayAlert(title, message, 'unauthorizeSession');
              });
            } else {
              _this.displayAlert(title, message, 'unauthorizeSession');
            }
          })();
        } else {
          this._super(reason);
        }
      },

      /**
       * Render a modal using the specifed path and optionally set a model.
       * @param modalPath the path to use for the controller and template.
       * @param model (optional) the model to set on the controller for the modal.
       */
      openModal: function openModal(modalPath, model) {
        if (model) {
          set(this.controllerFor(modalPath), 'model', model);
        }
        this.renderModal(modalPath);
      },

      unauthorizeSession: function unauthorizeSession() {
        var session = get(this, 'session');
        if (get(session, 'isAuthenticated')) {
          session.invalidate();
        }
      },

      /**
       * Update an open modal using the specifed model.
       * @param modalPath the path to use for the controller and template.
       * @param model (optional) the model to set on the controller for the modal.
       */
      updateModal: function updateModal(modalPath, model) {
        set(this.controllerFor(modalPath), 'model', model);
      }
    },

    model: function model(params, transition) {
      var _this2 = this;

      var session = get(this, 'session');
      var isAuthenticated = session && get(session, 'isAuthenticated');
      var config = get(this, 'config');
      var database = get(this, 'database');

      return config.setup().then(function () {
        var standAlone = config.get('standAlone');
        if (transition.targetName !== 'finishgauth' && transition.targetName !== 'login') {
          set(_this2, 'shouldSetupUserRole', true);
          if (isAuthenticated || standAlone) {
            return database.setup()['catch'](function () {
              // Error thrown indicates missing auth, so invalidate session.
              session.invalidate();
            });
          }
        } else if (transition.targetName === 'login' && standAlone) {
          return database.createUsersDB();
        } else if (transition.targetName === 'finishgauth') {
          set(_this2, 'shouldSetupUserRole', false);
        }
      });
    },

    afterModel: function afterModel() {
      set(this.controllerFor('navigation'), 'allowSearch', false);
      $('#apploading').remove();
    },

    renderModal: function renderModal(template) {
      this.render(template, {
        into: 'application',
        outlet: 'modal'
      });
    },

    sessionAuthenticated: function sessionAuthenticated() {
      var _this3 = this;

      if (get(this, 'shouldSetupUserRole') === true) {
        this.setupUserRole();
      }
      var session = get(this, 'session');
      var sessionData = session.get('data');
      var transitionAfterLogin = get(sessionData, TRANSITION_AFTER_LOGIN);
      if (!isEmpty(transitionAfterLogin)) {
        var sessionStore = session.get('store');
        set(sessionData, 'transitionAfterLogin', null);
        sessionStore.persist(sessionData).then(function () {
          _this3.transitionTo(transitionAfterLogin);
        });
      } else {
        this._super();
      }
    }
  });
  exports['default'] = ApplicationRoute;
});
define('hospitalrun/routes/index', ['exports', 'ember-simple-auth/mixins/authenticated-route-mixin', 'hospitalrun/mixins/navigation', 'hospitalrun/mixins/user-roles', 'ember'], function (exports, _emberSimpleAuthMixinsAuthenticatedRouteMixin, _hospitalrunMixinsNavigation, _hospitalrunMixinsUserRoles, _ember) {
  var inject = _ember['default'].inject;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _ember['default'].Route.extend(_emberSimpleAuthMixinsAuthenticatedRouteMixin['default'], _hospitalrunMixinsNavigation['default'], _hospitalrunMixinsUserRoles['default'], {
    session: inject.service(),
    beforeModel: function beforeModel() {
      var session = this.get('session');
      if (!isEmpty(session)) {
        var role = session.get('data.authenticated.role');
        if (!isEmpty(role)) {
          var userRole = this.findUserRole(role);
          if (!isEmpty(userRole) && !isEmpty(userRole.defaultRoute)) {
            var navelement = this.findNavItemByRoute(userRole.defaultRoute);
            // validate that there really is a navigation element that matches that route.
            if (!isEmpty(navelement)) {
              return this.transitionTo(navelement.route);
            }
          }
        }
      }
      return this._super.apply(this, arguments);
    },

    afterModel: function afterModel() {
      this.controllerFor('navigation').set('allowSearch', false);
    },

    actions: {
      createNewUser: function createNewUser() {
        return this.transitionTo('users.edit', 'new');
      }
    }
  });
});
define('hospitalrun/routes/login', ['exports', 'ember', 'ember-simple-auth/mixins/unauthenticated-route-mixin'], function (exports, _ember, _emberSimpleAuthMixinsUnauthenticatedRouteMixin) {
  var alias = _ember['default'].computed.alias;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var Route = _ember['default'].Route;
  exports['default'] = Route.extend(_emberSimpleAuthMixinsUnauthenticatedRouteMixin['default'], {
    config: inject.service(),
    database: inject.service(),

    requireLogin: alias('database.requireLogin'),
    standAlone: alias('config.standAlone'),

    beforeModel: function beforeModel(transition) {
      var session = get(this, 'session');
      if (get(session, 'isAuthenticated')) {
        this._super(transition);
      } else {
        var requireLogin = get(this, 'requireLogin');
        var standAlone = get(this, 'standAlone');
        if (standAlone === true && requireLogin === false) {
          return this.get('session').authenticate('authenticator:custom', {
            identification: 'hradmin',
            password: 'test'
          });
        } else {
          return get(this, 'config').useGoogleAuth().then(function (useGoogleAuth) {
            if (useGoogleAuth) {
              window.location.replace('/auth/google');
            }
          });
        }
      }
    }
  });
});
define('hospitalrun/serializers/application', ['exports', 'ember-pouch'], function (exports, _emberPouch) {
  exports['default'] = _emberPouch.Serializer.extend();
});
define('hospitalrun/serializers/user', ['exports', 'ember-data'], function (exports, _emberData) {
  var couchSerializer = _emberData['default'].JSONSerializer.extend({
    attrs: {
      rev: '_rev'
    },
    primaryKey: '_id',

    isNewSerializerAPI: true,

    normalizeArrayResponse: function normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {
      var newPayload = payload.rows.map((function (row) {
        return row.doc;
      }).bind(this));
      return this._super(store, primaryModelClass, newPayload, id, requestType);
    },

    normalizeSaveResponse: function normalizeSaveResponse(store, primaryModelClass, payload) {
      return {
        data: {
          id: payload.id,
          type: 'user',
          attrs: {
            rev: payload.rev
          }
        }
      };
    }

  });

  exports['default'] = couchSerializer;
});
define('hospitalrun/services/ajax', ['exports', 'ember-ajax/services/ajax'], function (exports, _emberAjaxServicesAjax) {
  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _emberAjaxServicesAjax['default'];
    }
  });
});
define('hospitalrun/services/config', ['exports', 'ember'], function (exports, _ember) {
  var RSVP = _ember['default'].RSVP;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var run = _ember['default'].run;
  var set = _ember['default'].set;
  exports['default'] = _ember['default'].Service.extend({
    configDB: null,
    database: inject.service(),
    session: inject.service(),
    sessionData: _ember['default'].computed.alias('session.data'),
    standAlone: false,
    needsUserSetup: false,
    markUserSetupComplete: function markUserSetupComplete() {
      var _this = this;

      if (get(this, 'needsUserSetup') === true) {
        var _ret = (function () {
          set(_this, 'needsUserSetup', false);
          var config = _this.get('configDB');
          return {
            v: new RSVP.Promise(function (resolve, reject) {
              config.put({ _id: 'config_user_setup_flag', value: false }, function (err, doc) {
                if (err) {
                  reject(err);
                }
                resolve(doc);
              });
            })
          };
        })();

        if (typeof _ret === 'object') return _ret.v;
      } else {
        return RSVP.resolve(true);
      }
    },
    setup: function setup() {
      var replicateConfigDB = this.replicateConfigDB.bind(this);
      var loadConfig = this.loadConfig.bind(this);
      var db = this.createDB();
      this.set('configDB', db);
      this.setCurrentUser();
      if (window.ELECTRON) {
        this.set('standAlone', true);
      }
      if (this.get('standAlone') === false) {
        return replicateConfigDB(db).then(loadConfig);
      } else {
        return loadConfig();
      }
    },
    createDB: function createDB() {
      return new PouchDB('config');
    },
    replicateConfigDB: function replicateConfigDB(db) {
      var promise = new RSVP.Promise(function (resolve) {
        var url = document.location.protocol + '//' + document.location.host + '/db/config';
        db.replicate.from(url).then(resolve)['catch'](resolve);
      });
      return promise;
    },
    loadConfig: function loadConfig() {
      var config = this.get('configDB');
      var options = {
        include_docs: true,
        keys: ['config_consumer_key', 'config_consumer_secret', 'config_disable_offline_sync', 'config_external_search', 'config_oauth_token', 'config_token_secret', 'config_use_google_auth']
      };
      return new _ember['default'].RSVP.Promise(function (resolve, reject) {
        config.allDocs(options, function (err, response) {
          if (err) {
            console.log('Could not get configDB configs:', err);
            reject(err);
          }
          var configObj = {};
          for (var i = 0; i < response.rows.length; i++) {
            if (!response.rows[i].error && response.rows[i].doc) {
              configObj[response.rows[i].id] = response.rows[i].doc.value;
            }
          }
          resolve(configObj);
        });
      }, 'getting configuration from the database');
    },
    getFileLink: function getFileLink(id) {
      var config = this.get('configDB');
      return new _ember['default'].RSVP.Promise(function (resolve, reject) {
        config.get('file-link_' + id, function (err, doc) {
          if (err) {
            reject(err);
          }
          resolve(doc);
        });
      });
    },
    removeFileLink: function removeFileLink(id) {
      var config = this.get('configDB');
      return this.getFileLink(id).then(function (fileLink) {
        config.remove(fileLink);
      });
    },
    saveFileLink: function saveFileLink(fileName, id) {
      var config = this.get('configDB');
      return new _ember['default'].RSVP.Promise(function (resolve, reject) {
        config.put({ fileName: fileName, _id: 'file-link_' + id }, function (err, doc) {
          if (err) {
            reject(err);
          }
          resolve(doc);
        });
      });
    },
    saveOauthConfigs: function saveOauthConfigs(configs) {
      var configDB = this.get('configDB');
      var configKeys = Object.keys(configs);
      var savePromises = [];
      return this._getOauthConfigs(configKeys).then(function (records) {
        configKeys.forEach(function (key) {
          var configRecord = records.rows.findBy('key', key);
          if (!configRecord || !configRecord.doc) {
            configRecord = {
              _id: key,
              value: configs[key]
            };
          } else {
            configRecord = configRecord.doc;
            configRecord.value = configs[key];
          }
          savePromises.push(configDB.put(configRecord));
        });
        return _ember['default'].RSVP.all(savePromises);
      });
    },
    useGoogleAuth: function useGoogleAuth() {
      return this.getConfigValue('use_google_auth', false);
    },

    getPatientPrefix: function getPatientPrefix() {
      return this.getConfigValue('patient_id_prefix', 'P');
    },

    getConfigDB: function getConfigDB() {
      return this.get('configDB');
    },

    getConfigValue: function getConfigValue(id, defaultValue) {
      var configDB = this.get('configDB');
      return new _ember['default'].RSVP.Promise(function (resolve) {
        configDB.get('config_' + id).then(function (doc) {
          run(null, resolve, doc.value);
        })['catch'](function () {
          run(null, resolve, defaultValue);
        });
      }, 'get ' + id + ' from config database');
    },

    _getOauthConfigs: function _getOauthConfigs(configKeys) {
      var configDB = this.get('configDB');
      var options = {
        include_docs: true,
        keys: configKeys
      };
      return configDB.allDocs(options);
    },

    setCurrentUser: function setCurrentUser(userName) {
      var config = this.get('configDB');
      var sessionData = this.get('sessionData');
      if (!userName && sessionData.authenticated) {
        userName = sessionData.authenticated.name;
      }
      config.get('current_user').then(function (doc) {
        doc.value = userName;
        config.put(doc);
      })['catch'](function () {
        config.put({
          _id: 'current_user',
          value: userName
        });
      });
    }

  });
});
define('hospitalrun/services/cookies', ['exports', 'ember-cookies/services/cookies'], function (exports, _emberCookiesServicesCookies) {
  exports['default'] = _emberCookiesServicesCookies['default'];
});
define('hospitalrun/services/custom-forms', ['exports', 'ember'], function (exports, _ember) {
  var Service = _ember['default'].Service;
  var computed = _ember['default'].computed;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var isEmpty = _ember['default'].isEmpty;
  var set = _ember['default'].set;
  exports['default'] = Service.extend({
    currentModel: null,
    customForms: {},
    formsForType: null,
    store: inject.service(),

    formsForSelect: computed('formsForType', 'usedForms', function () {
      var formsForType = get(this, 'formsForType');
      var usedForms = get(this, 'usedForms');
      if (!isEmpty(formsForType)) {
        var formsForSelect = formsForType.filter(function (customForm) {
          return !usedForms.includes(get(customForm, 'id'));
        });
        formsForSelect = formsForSelect.map(function (customForm) {
          return {
            id: get(customForm, 'id'),
            value: get(customForm, 'name')
          };
        });
        return formsForSelect;
      }
    }),

    formsToDisplay: computed('formsForType', 'currentModel.customForms', function () {
      var formsForType = get(this, 'formsForType');
      var modelForms = get(this, 'currentModel.customForms');
      if (!isEmpty(modelForms) && !isEmpty(formsForType)) {
        return Object.keys(modelForms).map(function (formId) {
          return {
            form: formsForType.findBy('id', formId),
            propertyPrefix: 'customForms.' + formId + '.'
          };
        });
      }
    }),

    showAddButton: computed('formsForSelect', function () {
      var formsForSelect = get(this, 'formsForSelect');
      return !isEmpty(formsForSelect);
    }),

    usedForms: computed('currentModel.customForms', function () {
      var modelForms = get(this, 'currentModel.customForms');
      if (isEmpty(modelForms)) {
        return [];
      } else {
        return Object.keys(modelForms);
      }
    }),

    getCustomForms: function getCustomForms(formTypes) {
      var _this = this;

      var customForms = get(this, 'customForms');
      var store = get(this, 'store');
      var formTypesToQuery = formTypes.filter(function (formType) {
        if (isEmpty(customForms[formType])) {
          return true;
        }
      });
      if (isEmpty(formTypesToQuery)) {
        return _ember['default'].RSVP.resolve(this._getCustomFormsFromCache(formTypes));
      } else {
        return store.query('custom-form', {
          options: {
            keys: formTypesToQuery
          },
          mapReduce: 'custom_form_by_type'
        }).then(function (forms) {
          formTypesToQuery.forEach(function (formType) {
            customForms[formType] = forms.filterBy('formType', formType);
          });
          return _this._getCustomFormsFromCache(formTypes);
        });
      }
    },

    resetCustomFormByType: function resetCustomFormByType(formType) {
      var customForms = get(this, 'customForms');
      delete customForms[formType];
    },

    setDefaultCustomForms: function setDefaultCustomForms(customFormNames, model) {
      return this.getCustomForms(customFormNames).then(function (customForms) {
        if (!isEmpty(customForms)) {
          customForms.forEach(function (customForm) {
            if (get(customForm, 'alwaysInclude')) {
              set(model, 'customForms.' + get(customForm, 'id'), _ember['default'].Object.create());
            }
          });
        }
        return model;
      });
    },

    setupForms: function setupForms(formType, model) {
      var _this2 = this;

      this.getCustomForms([formType]).then(function (forms) {
        set(_this2, 'currentModel', model);
        set(_this2, 'formsForType', forms);
      });
    },

    _getCustomFormsFromCache: function _getCustomFormsFromCache(formTypes) {
      var customForms = get(this, 'customForms');
      var returnForms = [];
      formTypes.forEach(function (formType) {
        returnForms.addObjects(customForms[formType]);
      });
      return returnForms;
    }

  });
});
define('hospitalrun/services/database', ['exports', 'ember', 'hospitalrun/utils/pouch-views', 'npm:pouchdb-list', 'hospitalrun/mixins/oauth-headers', 'npm:pouchdb-adapter-memory', 'hospitalrun/mixins/pouch-find-indexes', 'npm:pouchdb-users', 'npm:worker-pouch/client', 'hospitalrun/utils/unauthorized-error'], function (exports, _ember, _hospitalrunUtilsPouchViews, _npmPouchdbList, _hospitalrunMixinsOauthHeaders, _npmPouchdbAdapterMemory, _hospitalrunMixinsPouchFindIndexes, _npmPouchdbUsers, _npmWorkerPouchClient, _hospitalrunUtilsUnauthorizedError) {
  var alias = _ember['default'].computed.alias;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var isEmpty = _ember['default'].isEmpty;
  var RSVP = _ember['default'].RSVP;
  var Service = _ember['default'].Service;
  var set = _ember['default'].set;
  exports['default'] = Service.extend(_hospitalrunMixinsOauthHeaders['default'], _hospitalrunMixinsPouchFindIndexes['default'], {
    mainDB: null, // Server DB
    oauthHeaders: null,
    requireLogin: true,
    setMainDB: false,
    usePouchFind: false,
    usersDB: null, // local users database for standAlone mode

    config: inject.service(),
    standAlone: alias('config.standAlone'),

    createDB: function createDB(configs) {
      var standAlone = get(this, 'standAlone');
      if (standAlone || !configs.config_external_search) {
        set(this, 'usePouchFind', true);
      }
      if (standAlone) {
        var localDb = this._createLocalDB();
        return RSVP.resolve(localDb);
      }
      return this._createMainDB(configs);
    },

    getDBInfo: function getDBInfo() {
      var mainDB = get(this, 'mainDB');
      return mainDB.info();
    },

    getDocFromMainDB: function getDocFromMainDB(docId) {
      var _this = this;

      return new RSVP.Promise(function (resolve, reject) {
        var mainDB = get(_this, 'mainDB');
        mainDB.get(docId, function (err, doc) {
          if (err) {
            reject(_this.handleErrorResponse(err));
          } else {
            resolve(doc);
          }
        });
      }, 'getDocFromMainDB ' + docId);
    },

    /**
    * Given an pouchDB doc id, return the corresponding ember record id.
    * @param {String} docId the pouchDB doc id.
    * @returns {String} the corresponding Ember id.
    */
    getEmberId: function getEmberId(docId) {
      var parsedId = get(this, 'mainDB').rel.parseDocID(docId);
      if (!isEmpty(parsedId.id)) {
        return parsedId.id;
      }
    },

    /**
     * Given an record type, return back the maximum pouchdb id.  Useful for endkeys.
     * @param {String} type the record type.
     * @returns {String} the max pouch id for the type.
     */
    getMaxPouchId: function getMaxPouchId(type) {
      return this.getPouchId({}, type);
    },

    /**
    * Given an record type, return back the minimum pouchdb id.  Useful for startkeys.
    * @param {String} type the record type.
    * @returns {String} the min pouch id for the type.
    */
    getMinPouchId: function getMinPouchId(type) {
      return this.getPouchId(null, type);
    },

    /**
    * Given an Ember record id and type, return back the corresponding pouchDB id.
    * @param {String} emberId the ember record id.
    * @param {String} type the record type.
    * @returns {String} the corresponding pouch id.
    */
    getPouchId: function getPouchId(emberId, type) {
      var idInfo = {
        type: type
      };
      if (!isEmpty(emberId)) {
        idInfo.id = emberId;
      }
      return get(this, 'mainDB').rel.makeDocID(idInfo);
    },

    getRemoteDBUrl: function getRemoteDBUrl() {
      return document.location.protocol + '//' + document.location.host + '/db/main';
    },

    handleErrorResponse: function handleErrorResponse(err) {
      if (!err.status) {
        if (err.errors && err.errors.length > 0) {
          err.status = parseInt(err.errors[0].status);
        }
      }
      if (err.status === 401 || err.status === 403) {
        var detailedMessage = JSON.stringify(err, null, 2);
        return new _hospitalrunUtilsUnauthorizedError['default'](err, detailedMessage);
      } else {
        return err;
      }
    },

    /**
     * Load the specified db dump into the database.
     * @param {String} dbDump A couchdb dump string produced by pouchdb-dump-cli.
     * @returns {Promise} A promise that resolves once the dump has been loaded.
     */
    loadDBFromDump: function loadDBFromDump(dbDump) {
      var _this2 = this;

      return new RSVP.Promise(function (resolve, reject) {
        PouchDB.plugin(_npmPouchdbAdapterMemory['default']);
        var db = new PouchDB('dbdump', {
          adapter: 'memory'
        });
        db.load(dbDump).then(function () {
          var mainDB = get(_this2, 'mainDB');
          db.replicate.to(mainDB).on('complete', function (info) {
            resolve(info);
          }).on('error', function (err) {
            reject(err);
          });
        }, reject);
      }, 'loadDBFromDump');
    },

    queryMainDB: function queryMainDB(queryParams, mapReduce) {
      var _this3 = this;

      return new RSVP.Promise(function (resolve, reject) {
        var mainDB = get(_this3, 'mainDB');
        if (mapReduce) {
          mainDB.query(mapReduce, queryParams, function (err, response) {
            if (err) {
              reject(_this3.handleErrorResponse(err));
            } else {
              response.rows = _this3._mapPouchData(response.rows);
              resolve(response);
            }
          });
        } else {
          mainDB.allDocs(queryParams, function (err, response) {
            if (err) {
              reject(_this3.handleErrorResponse(err));
            } else {
              response.rows = _this3._mapPouchData(response.rows);
              resolve(response);
            }
          });
        }
      }, 'queryMainDB');
    },

    setup: function setup() {
      var _this4 = this;

      PouchDB.plugin(_npmPouchdbList['default']);
      var config = get(this, 'config');
      return config.loadConfig().then(function (configs) {
        return _this4.createDB(configs).then(function (db) {
          set(_this4, 'mainDB', db);
          set(_this4, 'setMainDB', true);
          if (get(_this4, 'standAlone')) {
            return _this4.createUsersDB();
          } else {
            _this4.setupSubscription(configs);
          }
        });
      });
    },

    setupSubscription: function setupSubscription(configs) {
      var _this5 = this;

      if (!configs.config_disable_offline_sync && navigator.serviceWorker) {
        var _ret = (function () {
          var config = get(_this5, 'config');
          var localDB = _this5._createLocalDB();
          return {
            v: config.getConfigValue('push_subscription').then(function (pushSub) {
              if (isEmpty(pushSub)) {
                return localDB.id().then(function (dbId) {
                  var dbInfo = {
                    id: dbId,
                    remoteSeq: 0
                  };
                  return _this5._getPermissionAndSubscribe(dbInfo);
                }).then(function () {
                  return _this5._requestSync();
                });
              } else {
                return _this5._requestSync();
              }
            })
          };
        })();

        if (typeof _ret === 'object') return _ret.v;
      }
    },

    _askPermission: function _askPermission() {
      return new RSVP.Promise(function (resolve, reject) {
        var permissionResult = Notification.requestPermission(function (result) {
          resolve(result);
        });

        if (permissionResult) {
          permissionResult.then(resolve, reject);
        }
      }).then(function (permissionResult) {
        if (permissionResult !== 'granted') {
          throw new Error('We weren\'t granted permission.');
        }
        return permissionResult;
      }, 'Ask for notification permisson');
    },

    _createLocalDB: function _createLocalDB(pouchOptions) {
      var localDB = new PouchDB('localMainDB', pouchOptions);
      (0, _hospitalrunUtilsPouchViews['default'])(localDB);
      this.buildPouchFindIndexes(localDB);
      return localDB;
    },

    _createMainDB: function _createMainDB(configs) {
      var _this6 = this;

      this._setOAuthHeaders(configs);
      if (!configs.config_disable_offline_sync && navigator.serviceWorker) {
        // Use pouch-worker to run the DB in the service worker
        return navigator.serviceWorker.ready.then(function () {
          if (navigator.serviceWorker.controller && navigator.serviceWorker.controller.postMessage) {
            PouchDB.adapter('worker', _npmWorkerPouchClient['default']);
            var localDB = _this6._createLocalDB({
              adapter: 'worker',
              worker: function worker() {
                return navigator.serviceWorker;
              }
            });
            return localDB;
          } else {
            return _this6._createRemoteDB(configs);
          }
        });
      } else {
        return this._createRemoteDB(configs);
      }
    },

    _createRemoteDB: function _createRemoteDB(configs) {
      var remoteUrl = this.getRemoteDBUrl();
      var pouchOptions = this._getOptions(configs);
      var remoteDB = new PouchDB(remoteUrl, pouchOptions);
      return remoteDB.info().then(function () {
        (0, _hospitalrunUtilsPouchViews['default'])(remoteDB);
        return remoteDB;
      })['catch'](function (err) {
        console.log('error with remote db:', JSON.stringify(err, null, 2));
        throw err;
      });
    },

    _getNotificationPermissionState: function _getNotificationPermissionState() {
      if (navigator.permissions) {
        return navigator.permissions.query({ name: 'notifications' }).then(function (result) {
          return result.state;
        });
      }
      return RSVP.resolve(Notification.permission);
    },

    _getPermissionAndSubscribe: function _getPermissionAndSubscribe(dbInfo) {
      var _this7 = this;

      return new RSVP.Promise(function (resolve, reject) {
        navigator.serviceWorker.ready.then(function (registration) {
          return _this7._getNotificationPermissionState().then(function (permission) {
            if (permission !== 'granted') {
              return _this7._askPermission().then(function () {
                return _this7._subscribeUserToPush(registration, dbInfo).then(resolve, reject);
              });
            } else {
              return _this7._subscribeUserToPush(registration, dbInfo).then(resolve, reject);
            }
          });
        });
      }, 'Get notification permission and subscribe to push');
    },

    _urlBase64ToUint8Array: function _urlBase64ToUint8Array(base64String) {
      var padding = '='.repeat((4 - base64String.length % 4) % 4);
      var base64 = (base64String + padding).replace(/\-/g, '+').replace(/_/g, '/');

      var rawData = window.atob(base64);
      var outputArray = new Uint8Array(rawData.length);

      for (var i = 0; i < rawData.length; ++i) {
        outputArray[i] = rawData.charCodeAt(i);
      }
      return outputArray;
    },

    _sendSubscriptionToServer: function _sendSubscriptionToServer(subscription, dbInfo) {
      return new RSVP.Promise(function (resolve, reject) {
        return fetch('/save-subscription/', {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json'
          },
          body: JSON.stringify({
            dbInfo: dbInfo,
            subscription: subscription
          })
        }).then(function (response) {
          if (!response.ok) {
            throw new Error('Bad status code from server.');
          }
          return response.json();
        }).then(function (responseData) {
          if (responseData.ok !== true) {
            throw new Error('There was a bad response from server.', JSON.stringify(responseData, null, 2));
          }
          resolve(responseData);
        })['catch'](reject);
      }, 'Send push subscription to server');
    },

    _subscribeUserToPush: function _subscribeUserToPush(registration, dbInfo) {
      var _this8 = this;

      var config = get(this, 'config');
      return config.getConfigValue('push_public_key').then(function (serverKey) {
        if (!serverKey) {
          return;
        }
        var subscribeOptions = {
          userVisibleOnly: true,
          applicationServerKey: _this8._urlBase64ToUint8Array(serverKey)
        };
        return new RSVP.Promise(function (resolve, reject) {
          return registration.pushManager.subscribe(subscribeOptions).then(function (pushSubscription) {
            var subInfo = JSON.stringify(pushSubscription);
            subInfo = JSON.parse(subInfo);
            return _this8._sendSubscriptionToServer(subInfo, dbInfo);
          }).then(function (savedSubscription) {
            var configDB = config.getConfigDB();
            return configDB.put({
              _id: 'config_push_subscription',
              value: savedSubscription.id
            }).then(resolve, reject);
          })['catch'](reject);
        });
      }, 'Subscribe user to push service.');
    },

    _requestSync: function _requestSync() {
      return new RSVP.Promise(function (resolve, reject) {
        var messageChannel = new MessageChannel();
        messageChannel.port1.onmessage = function (event) {
          if (event.data.error) {
            reject(event.data.error);
          } else {
            resolve(event.data);
          }
        };
        navigator.serviceWorker.controller.postMessage('remotesync', [messageChannel.port2]);
      }, 'Request offline sync');
    },

    createUsersDB: function createUsersDB() {
      var _this9 = this;

      PouchDB.plugin(_npmPouchdbUsers['default']);
      var usersDB = new PouchDB('_users');
      return usersDB.installUsersBehavior().then(function () {
        set(_this9, 'usersDB', usersDB);
        return usersDB.allDocs().then(function (results) {
          if (results.total_rows < 2) {
            set(_this9, 'requireLogin', false);
            if (results.total_rows === 0) {

              return usersDB.put({
                _id: 'org.couchdb.user:hradmin',
                type: 'user',
                name: 'hradmin',
                password: 'test',
                roles: ['System Administrator', 'admin', 'user'],
                userPrefix: 'p1'
              });
            }
          }
        });
      });
    },

    _getOptions: function _getOptions(configs) {
      var pouchOptions = {};
      if (configs) {
        pouchOptions.ajax = {
          timeout: 30000
        };
        // If we don't have the proper credentials, throw error to force login.
        if (isEmpty(configs.config_consumer_key) || isEmpty(configs.config_consumer_secret) || isEmpty(configs.config_oauth_token) || isEmpty(configs.config_token_secret)) {
          throw Error('login required');
        } else {
          var headers = get(this, 'oauthHeaders');
          pouchOptions.ajax.headers = headers;
        }
      }
      return pouchOptions;
    },

    _mapPouchData: function _mapPouchData(rows) {
      var _this10 = this;

      var mappedRows = [];
      if (rows) {
        mappedRows = rows.map(function (row) {
          if (row.doc) {
            var rowValues = {
              doc: row.doc.data
            };
            rowValues.doc.id = _this10.getEmberId(row.id);
            return rowValues;
          } else {
            return row;
          }
        });
      }
      return mappedRows;
    },

    _setOAuthHeaders: function _setOAuthHeaders(configs) {
      var headers = this.getOAuthHeaders(configs);
      set(this, 'oauthHeaders', headers);
    }

  });
});
define('hospitalrun/services/filesystem', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = _ember['default'].Service.extend({
    config: _ember['default'].inject.service(),

    filer: null, // Injected via initializer
    fileSystemSize: 1024 * 1024 * 1024 * 8, // 8GB max size for local filesystem;chrome only,

    _onError: function _onError(e) {
      console.log('Filer filesystem error: ' + e);
    },

    _downloadFiles: function _downloadFiles() {
      this.store.find('photo').then((function (photos) {
        photos.forEach((function (photo) {
          this.downloadIfNeeded(photo);
        }).bind(this));
      }).bind(this));
    },

    /**
     * Downloads the file from the server and saves it to the local filesystem.
     * @param {Object} fileRecord Record to use to download the file.
     */
    _downloadFileFromServer: function _downloadFileFromServer(fileRecord) {
      var fileName = _ember['default'].get(fileRecord, 'fileName');
      var pouchDbId = _ember['default'].get(fileRecord, 'id');
      var url = _ember['default'].get(fileRecord, 'url');
      var xhr = new XMLHttpRequest();
      if (!_ember['default'].isEmpty(url)) {
        xhr.open('GET', url, true);
        xhr.responseType = 'blob';
        xhr.onload = (function () {
          var file = new Blob([xhr.response]);
          this.addFile(file, fileName, pouchDbId);
        }).bind(this);
        xhr.send();
      }
    },

    setup: function setup() {
      var size = this.get('fileSystemSize');
      var filer = new Filer();
      filer.init({ persistent: true, size: size }, (function () {
        try {
          this.set('filer', filer);
        } catch (ignored) {
          // Exception may happen during testing an can be ignored.
        }
      }).bind(this));
    },

    /**
     * Add the specified file to the local filesystem
     * @param {File} file the file to save.
     * @param {String} path the file path to save the file to.
     * @param {String} pouchDbId database id that the file is associated with.
     * The pouch DB ids are prefixed with the type of record (eg patient record is
     * prefixed by 'patient_'.
     * @returns {Promise} returns a Promise that resolves once the file is saved.
     */
    addFile: function addFile(file, path, pouchDbId) {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        var currentDate = new Date();
        var filer = this.get('filer');
        var fileName = file.name || currentDate.getTime();
        var newFileName = path + fileName;
        var config = this.get('config');
        if (path.indexOf('.') > -1) {
          newFileName = path;
          // If a full file path was provided, figure out the path and file name.
          var pathParts = path.split('/');
          fileName = pathParts.pop();
          path = pathParts.join('/');
          path += '/';
        }

        if (newFileName.indexOf('.') === -1) {
          if (file.type) {
            var typeParts = file.type.split('/');
            newFileName += '.' + typeParts.pop();
          } else {
            // Default to png extension
            newFileName += '.png';
          }
        }

        this.fileExists(newFileName).then((function (exists) {
          if (exists) {
            // Make sure a unique name is used.
            newFileName = path + currentDate.getTime() + fileName;
          }
          if (_ember['default'].isEmpty(filer)) {
            reject('Local filesystem unavailable, please use Google Chrome browser');
          }
          if (_ember['default'].isEmpty(fileName) && !_ember['default'].isEmpty(file.type)) {
            var typeParts = file.type.split('/');
            if (typeParts.length > 1) {
              newFileName += '.' + typeParts[1];
            }
          }
          filer.mkdir(path, false, function () {
            filer.write(newFileName, { data: file, type: file.type }, function (fileEntry) {
              config.saveFileLink(newFileName, pouchDbId);
              resolve(fileEntry);
            }, function (e) {
              reject(e);
            });
          }, function (e) {
            reject(e);
          });
        }).bind(this));
      }).bind(this));
    },

    /**
     * Delete the specified file
     * @param {String} filePath path of file to delete.
     * @param {String} pouchId database id that the file is associated with.
     * The pouch DB ids are prefixed with the type of record (eg patient record is
     * prefixed by 'patient_'.
     * @returns {Promise} returns a Promise that resolves once the file is deleted.
     */
    deleteFile: function deleteFile(filePath, pouchDbId) {
      return new _ember['default'].RSVP.Promise((function (resolve, reject) {
        var filer = this.get('filer');
        var config = this.get('config');
        try {
          filer.ls(filePath, function () {
            filer.rm(filePath, function () {
              config.removeFileLink(pouchDbId);
              resolve();
            }, reject);
          }, function (err) {
            if (err.name === 'NotFoundError') {
              resolve();
            } else {
              reject(err);
            }
          });
        } catch (ex) {
          reject(ex);
        }
      }).bind(this));
    },

    downloadIfNeeded: function downloadIfNeeded(fileRecord) {
      var fileName = _ember['default'].get(fileRecord, 'fileName');
      this.fileExists(fileName).then((function (exists) {
        if (!exists) {
          this._downloadFileFromServer(fileRecord);
        }
      }).bind(this));
    },

    /**
     * Determine if specified file exists
     * @param {String} the path of the file to determine if it exists.
     * @returns {Promise} returns a Promise that resolves with a boolean indicating
     * if the file exists.
     */
    fileExists: function fileExists(filePath) {
      return new _ember['default'].RSVP.Promise((function (resolve) {
        var filer = this.get('filer');
        filer.fs.root.getFile(filePath, {}, function () {
          resolve(true);
        }, function () {
          // if ls errs, file doesn't exist.
          resolve(false);
        });
      }).bind(this));
    },

    /**
     * Convert specified file to a data url
     * @param {File} file to convert
     * @returns {Promise} returns a Promise that resolves with the data url
     * for the file.
     */
    fileToDataURL: function fileToDataURL(file) {
      return new _ember['default'].RSVP.Promise(function (resolve) {
        var reader = new FileReader();
        reader.onloadend = function (e) {
          resolve(e.target.result);
        };
        reader.readAsDataURL(file);
      });
    },

    /**
     * Read the specified file into a string
     * @param {File} file to read
     * @returns {Promise} returns a Promise that resolves with the data url
     * for the file.
     */
    fileToString: function fileToString(file) {
      return new _ember['default'].RSVP.Promise(function (resolve) {
        var reader = new FileReader();
        reader.onloadend = function (e) {
          resolve(e.target.result);
        };
        reader.readAsText(file);
      });
    },

    /**
     * Property to determine if file system API is available.
     */
    isFileSystemEnabled: (function () {
      var filer = this.get('filer');
      return !_ember['default'].isEmpty(filer);
    }).property('filer'),

    /**
     * Get filesystem url from specified path.
     * @param {String} the path of the file to get the url for.
     * @returns {Promise} returns a Promise that resolves with the file system
     * url or null if the file doesn't exist.
     */
    pathToFileSystemURL: function pathToFileSystemURL(path) {
      return new _ember['default'].RSVP.Promise((function (resolve) {
        var filer = this.get('filer');
        filer.fs.root.getFile(path, {}, function (fileEntry) {
          resolve(fileEntry.toURL());
        }, function () {
          // if ls errs, just return empty, file doesn't exist.
          resolve();
        });
      }).bind(this));
    }
  });
});
define('hospitalrun/services/i18n', ['exports', 'ember-i18n/services/i18n'], function (exports, _emberI18nServicesI18n) {
  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _emberI18nServicesI18n['default'];
    }
  });
});
define('hospitalrun/services/keyboard', ['exports', 'ember-keyboard/services/keyboard'], function (exports, _emberKeyboardServicesKeyboard) {
  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _emberKeyboardServicesKeyboard['default'];
    }
  });
});
define('hospitalrun/services/lookup-lists', ['exports', 'ember'], function (exports, _ember) {
  var Service = _ember['default'].Service;
  var get = _ember['default'].get;
  var inject = _ember['default'].inject;
  var isEmpty = _ember['default'].isEmpty;
  var RSVP = _ember['default'].RSVP;
  exports['default'] = Service.extend({
    lookupLists: {},
    store: inject.service(),

    /*
     * Get a lookup list by name
     * @param listName String containing the name of the lookup list to retrieve.
     * Usually the id of a lookup object, but the special value of 'incidentCategories'
     * will retrieve incident categories
     */
    getLookupList: function getLookupList(listName) {
      return this.getLookupLists([listName]).then(function (lists) {
        return lists[listName];
      });
    },

    /*
     * Given a list of lookup names, return the specified lists.
     * @param listName Array containg the names of the lookup lists to retrieve.
     * Can be the ids of lookup objects, and/or the special value of 'incidentCategories'
     * will retrieve incident categories.
     */
    getLookupLists: function getLookupLists(listNames) {
      var _this = this;

      var lookupLists = get(this, 'lookupLists');
      var store = get(this, 'store');
      var listsToQuery = listNames.filter(function (listName) {
        if (isEmpty(lookupLists[listName])) {
          return true;
        }
      });
      if (isEmpty(listsToQuery)) {
        return _ember['default'].RSVP.resolve(this._getLookupListsFromCache(listNames));
      } else {
        var queryHash = {};
        if (listsToQuery.includes('incidentCategories')) {
          queryHash.incidentCategories = store.findAll('inc-category');
          listsToQuery.removeObject('incidentCategories');
        }
        if (!isEmpty(listsToQuery)) {
          queryHash.lookup = store.query('lookup', {
            options: {
              keys: listsToQuery
            }
          });
        }
        return RSVP.hash(queryHash).then(function (hash) {
          if (!isEmpty(hash.incidentCategories)) {
            lookupLists.incidentCategories = hash.incidentCategories.filterBy('archived', false);
          }
          if (!isEmpty(hash.lookup)) {
            listsToQuery.forEach(function (list) {
              lookupLists[list] = hash.lookup.findBy('id', list);
            });
          }
          return _this._getLookupListsFromCache(listNames);
        });
      }
    },

    resetLookupList: function resetLookupList(listName) {
      var lookupLists = get(this, 'lookupLists');
      delete lookupLists[listName];
    },

    _getIncidentCategories: function _getIncidentCategories() {
      var store = get(this, 'store');
      return store.findAll('inc-category');
    },

    _getLookupListsFromCache: function _getLookupListsFromCache(listNames) {
      var lookupLists = get(this, 'lookupLists');
      var returnLists = {};
      listNames.forEach(function (listName) {
        if (!isEmpty(lookupLists[listName])) {
          returnLists[listName] = lookupLists[listName];
        }
      });
      return returnLists;
    }
  });
});
define('hospitalrun/services/session', ['exports', 'ember-simple-auth/services/session'], function (exports, _emberSimpleAuthServicesSession) {
  exports['default'] = _emberSimpleAuthServicesSession['default'];
});
define('hospitalrun/services/validations', ['exports', 'ember'], function (exports, _ember) {

  var set = _ember['default'].set;

  exports['default'] = _ember['default'].Service.extend({
    init: function init() {
      set(this, 'cache', {});
    }
  });
});
define('hospitalrun/serviceworkers/pouchdb-sync', ['exports'], function (exports) {
  var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();

  function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }

  function _typeof(obj) { return obj && obj.constructor === Symbol ? 'symbol' : typeof obj; }

  var allChanges = {};
  var configs = false;
  var syncingRemote = false;
  var configDB = new PouchDB('config');
  var localMainDB = new PouchDB('localMainDB');
  var lastServerSeq = undefined;

  function PouchError(opts) {
    Error.call(opts.reason);
    this.status = opts.status;
    this.name = opts.error;
    this.message = opts.reason;
    this.error = true;
  }

  function createError(err) {
    var status = err.status || 500;

    // last argument is optional
    if (err.name && err.message) {
      if (err.name === 'Error' || err.name === 'TypeError') {
        if (err.message.indexOf('Bad special document member') !== -1) {
          err.name = 'doc_validation';
          // add more clauses here if the error name is too general
        } else {
            err.name = 'bad_request';
          }
      }
      err = {
        error: err.name,
        name: err.name,
        reason: err.message,
        message: err.message,
        status: status
      };
    }
    return err;
  }

  function safeEval(str) {
    var target = {};
    /* jshint evil: true */
    eval('target.target = (' + str + ');');
    return target.target;
  }

  function decodeArgs(args) {
    var funcArgs = ['filter', 'map', 'reduce'];
    args.forEach(function (arg) {
      if ((typeof arg === 'undefined' ? 'undefined' : _typeof(arg)) === 'object' && arg !== null && !Array.isArray(arg)) {
        funcArgs.forEach(function (funcArg) {
          if (!(funcArg in arg) || arg[funcArg] === null) {
            delete arg[funcArg];
          } else if (arg[funcArg].type === 'func' && arg[funcArg].func) {
            arg[funcArg] = safeEval(arg[funcArg].func);
          }
        });
      }
    });
    return args;
  }

  function postMessage(msg, event) {
    event.ports[0].postMessage(msg);
  }

  function sendError(clientId, messageId, data, event) {
    logDebug(' -> sendError', clientId, messageId, data);
    postMessage({
      type: 'error',
      id: clientId,
      messageId: messageId,
      content: createError(data)
    }, event);
  }

  function sendSuccess(clientId, messageId, data, event) {
    logDebug(' -> sendSuccess', clientId, messageId);
    postMessage({
      type: 'success',
      id: clientId,
      messageId: messageId,
      content: data
    }, event);
  }

  function sendUpdate(clientId, messageId, data, event) {
    logDebug(' -> sendUpdate', clientId, messageId);
    postMessage({
      type: 'update',
      id: clientId,
      messageId: messageId,
      content: data
    }, event);
  }

  function getCurrentDB(clientId) {
    switch (clientId) {
      case 'localMainDB':
        {
          return Promise.resolve(localMainDB);
        }
      case 'hospitalrun-test-database':
        {
          return Promise.resolve(new PouchDB('hospitalrun-test-database', {
            adapter: 'memory'
          }));
        }
      default:
        {
          return getRemoteDB();
        }
    }
  }

  function dbMethod(clientId, methodName, messageId, args, event) {
    var dbAdapter = undefined;
    return getCurrentDB(clientId).then(function (db) {
      if (!db) {
        return sendError(clientId, messageId, { error: 'db not found' }, event);
      }
      dbAdapter = db.adapter;
      return db[methodName].apply(db, _toConsumableArray(args));
    }).then(function (res) {
      sendSuccess(clientId, messageId, res, event);
      switch (methodName) {
        case 'put':
        case 'bulkDocs':
        case 'post':
        case 'remove':
        case 'removeAttachment':
        case 'putAttachment':
          remoteSync();
      }
    })['catch'](function (err) {
      if (dbAdapter === 'http') {
        // If the failure was on http, retry with local db.
        return dbMethod('localMainDB', methodName, messageId, args, event);
      } else {
        sendError(clientId, messageId, err, event);
      }
    });
  }

  function changes(clientId, messageId, args, event) {
    var _args = _slicedToArray(args, 1);

    var opts = _args[0];

    if (opts && (typeof opts === 'undefined' ? 'undefined' : _typeof(opts)) === 'object') {
      // just send all the docs anyway because we need to emit change events
      // TODO: be smarter about emitting changes without building up an array
      opts.returnDocs = true;
      opts.return_docs = true;
    }
    dbMethod(clientId, 'changes', messageId, args, event);
  }

  function createDatabase(clientId, messageId, args, event) {
    return sendSuccess(clientId, messageId, { ok: true, exists: true }, event);
  }

  function getAttachment(clientId, messageId, args, event) {
    return getCurrentDB(clientId).then(function (db) {
      if (!db) {
        return sendError(clientId, messageId, { error: 'db not found' }, event);
      }

      var _args2 = _slicedToArray(args, 3);

      var docId = _args2[0];
      var attId = _args2[1];
      var opts = _args2[2];

      if ((typeof opts === 'undefined' ? 'undefined' : _typeof(opts)) !== 'object') {
        opts = {};
      }
      return db.get(docId, opts).then(function (doc) {
        if (!doc._attachments || !doc._attachments[attId]) {
          throw new PouchError({
            status: 404,
            error: 'not_found',
            reason: 'missing'
          });
        }
        return db.getAttachment.apply(db, _toConsumableArray(args)).then(function (buff) {
          sendSuccess(clientId, messageId, buff, event);
        });
      });
    })['catch'](function (err) {
      sendError(clientId, messageId, err, event);
    });
  }

  function destroy(clientId, messageId, args, event) {
    if (clientId === 'hospitalrun-test-database') {
      getCurrentDB(clientId).then(function (db) {
        if (!db) {
          return sendError(clientId, messageId, { error: 'db not found' }, event);
        }
        Promise.resolve().then(function () {
          return db.destroy.apply(db, _toConsumableArray(args));
        }).then(function (res) {
          sendSuccess(clientId, messageId, res, event);
        })['catch'](function (err) {
          sendError(clientId, messageId, err, event);
        });
      });
    } else {
      return sendError(clientId, messageId, { error: 'permission denied' }, event);
    }
  }

  function liveChanges(clientId, messageId, args, event) {
    getCurrentDB(clientId).then(function (db) {
      if (!db) {
        return sendError(clientId, messageId, { error: 'db not found' }, event);
      }
      var changes = db.changes(args[0]);
      allChanges[messageId] = changes;
      changes.on('change', function (change) {
        sendUpdate(clientId, messageId, change, event);
      }).on('complete', function (change) {
        changes.removeAllListeners();
        delete allChanges[messageId];
        sendSuccess(clientId, messageId, change, event);
      }).on('error', function (change) {
        changes.removeAllListeners();
        delete allChanges[messageId];
        sendError(clientId, messageId, change, event);
      });
    });
  }

  function cancelChanges(messageId) {
    var changes = allChanges[messageId];
    if (changes) {
      changes.cancel();
    }
  }

  function onReceiveMessage(clientId, type, messageId, args, event) {
    switch (type) {
      case 'createDatabase':
        return createDatabase(clientId, messageId, args, event);
      case 'id':
        sendSuccess(clientId, messageId, clientId, event);
        return;
      case 'info':
      case 'put':
      case 'allDocs':
      case 'bulkDocs':
      case 'post':
      case 'get':
      case 'remove':
      case 'revsDiff':
      case 'compact':
      case 'viewCleanup':
      case 'removeAttachment':
      case 'putAttachment':
      case 'query':
        return dbMethod(clientId, type, messageId, args, event);
      case 'changes':
        return changes(clientId, messageId, args, event);
      case 'getAttachment':
        return getAttachment(clientId, messageId, args, event);
      case 'liveChanges':
        return liveChanges(clientId, messageId, args, event);
      case 'cancelChanges':
        return cancelChanges(messageId);
      case 'destroy':
        return destroy(clientId, messageId, args, event);
      default:
        return sendError(clientId, messageId, { error: 'unknown API method: ' + type }, event);
    }
  }

  function handleMessage(message, clientId, event) {
    var type = message.type;
    var messageId = message.messageId;

    var args = decodeArgs(message.args);
    onReceiveMessage(clientId, type, messageId, args, event);
  }

  self.addEventListener('push', function (event) {
    if (event.data) {
      var pushData = event.data.json();
      if (pushData.type === 'couchDBChange') {
        logDebug('Got couchDBChange pushed, attempting to sync to: ' + pushData.seq);
        event.waitUntil(remoteSync(pushData.seq).then(function (resp) {
          logDebug('Response from sync ' + JSON.stringify(resp, null, 2));
        }));
      } else {
        logDebug('Unknown push event has data and here it is: ', pushData);
      }
    }
  });

  self.addEventListener('message', function (event) {
    logDebug('got message', event);
    if (event.data === 'remotesync') {
      remoteSync();
      return;
    }
    if (!event.data || !event.data.id || !event.data.args || !event.data.type || !event.data.messageId) {
      // assume this is not a message from worker-pouch
      // (e.g. the user is using the custom API instead)
      return;
    }
    var clientId = event.data.id;
    if (event.data.type === 'close') {
      // logDebug('closing worker', clientId);
    } else {
        handleMessage(event.data, clientId, event);
      }
  });

  self.addEventListener('sync', function (event) {
    if (event.tag === 'remoteSync') {
      event.waitUntil(remoteSync(null, true)['catch'](function (err) {
        if (event.lastChance) {
          logDebug('Sync failed for the last time, so give up for now.', err);
        } else {
          logDebug('Sync failed, will try again later', err);
        }
      }));
    }
  });

  function getRemoteDB() {
    return setupConfigs().then(function () {
      var pouchOptions = {
        ajax: {
          headers: {},
          timeout: 30000
        }
      };
      if (configs.config_consumer_secret && configs.config_token_secret && configs.config_consumer_key && configs.config_oauth_token) {
        pouchOptions.ajax.headers['x-oauth-consumer-secret'] = configs.config_consumer_secret;
        pouchOptions.ajax.headers['x-oauth-consumer-key'] = configs.config_consumer_key;
        pouchOptions.ajax.headers['x-oauth-token-secret'] = configs.config_token_secret;
        pouchOptions.ajax.headers['x-oauth-token'] = configs.config_oauth_token;
      }
      var remoteURL = self.location.protocol + '//' + self.location.host + '/db/main';
      return new PouchDB(remoteURL, pouchOptions);
    });
  }

  function remoteSync(remoteSequence, retryingSync) {
    lastServerSeq = remoteSequence;
    if (!syncingRemote && configs.config_disable_offline_sync !== true) {
      logDebug('Synching local db to remoteSequence: ' + remoteSequence + ' at: ' + new Date());
      syncingRemote = true;
      return getRemoteDB().then(function (remoteDB) {
        return localMainDB.sync(remoteDB);
      }).then(function (info) {
        syncingRemote = false;
        logDebug('local sync complete:', info, configs);

        // Update push subscription with latest sync info
        fetch('/update-subscription/', {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json'
          },
          body: JSON.stringify({
            subscriptionId: configs.config_push_subscription,
            remoteSeq: info.pull.last_seq
          })
        });
        // handle complete
        if (info.pull.last_seq < lastServerSeq) {
          return remoteSync(lastServerSeq);
        } else {

          return true;
        }
      })['catch'](function (err) {
        syncingRemote = false;
        logDebug('local sync error, register remote sync: ' + new Date(), err);
        if (retryingSync) {
          throw err;
        } else {
          self.registration.sync.register('remoteSync');
        }
      });
    } else {
      if (syncingRemote) {
        logDebug('Skipping sync to: ' + remoteSequence + ' because sync is in process');
      }
      return Promise.resolve(false);
    }
  }

  function setupConfigs() {
    return new Promise(function (resolve, reject) {
      if (configs) {
        resolve();
      } else {
        configDB.allDocs({
          include_docs: true
        }).then(function (result) {
          configs = {};
          result.rows.forEach(function (row) {
            configs[row.id] = row.doc.value;
          });
          resolve();
        }, reject);
      }
    });
  }
});
define('hospitalrun/session-stores/application', ['exports', 'ember-simple-auth/session-stores/adaptive'], function (exports, _emberSimpleAuthSessionStoresAdaptive) {
  exports['default'] = _emberSimpleAuthSessionStoresAdaptive['default'].extend();
});
define("hospitalrun/templates/application", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "fysxepod", "block": "{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"session\",\"isAuthenticated\"]]],null,0],[\"append\",[\"unknown\",[\"outlet\"]],false],[\"text\",\"\\n\"],[\"append\",[\"helper\",[\"outlet\"],[\"modal\"],null],false],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"append\",[\"helper\",[\"render\"],[\"navigation\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/application.hbs" } });
});
define("hospitalrun/templates/charges-by-type", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "YF92WpEg", "block": "{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"showPricingTypeTabs\"]]],null,2],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"tab-content\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"pricingTypeList\"]]],null,0],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"price-list\"],null,[[\"canAddCharge\",\"pricingType\",\"index\",\"pricingList\",\"model\"],[[\"get\",[\"canAddCharge\"]],[\"get\",[\"pricingType\"]],[\"get\",[\"index\"]],[\"get\",[\"pricingList\"]],[\"get\",[\"model\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[\"pricingType\",\"index\"]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"charges-by-type-tab\"],null,[[\"pricingType\",\"index\"],[[\"get\",[\"pricingType\"]],[\"get\",[\"index\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[\"pricingType\",\"index\"]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"ul\",[]],[\"static-attr\",\"class\",\"nav nav-pills tab-nav\"],[\"static-attr\",\"role\",\"tablist\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"pricingTypeList\"]]],null,1],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/charges-by-type.hbs" } });
});
define("hospitalrun/templates/components/array-display", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "GyouM0iu", "block": "{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"isArray\"]]],null,2,0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"append\",[\"unknown\",[\"content\"]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"append\",[\"get\",[\"item\"]],false],[\"open-element\",\"br\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"item\"]},{\"statements\":[[\"block\",[\"each\"],[[\"get\",[\"content\"]]],null,1]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/array-display.hbs" } });
});
define("hospitalrun/templates/components/calendar-control", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "6rC05zmE", "block": "{\"statements\":[[\"append\",[\"helper\",[\"full-calendar\"],null,[[\"events\",\"dayClick\",\"date\",\"editable\",\"eventAfterAllRender\",\"eventClick\",\"eventDrop\",\"eventResize\",\"groupByDateAndResource\",\"groupByResource\",\"header\",\"height\",\"resources\",\"viewName\",\"views\"],[[\"get\",[\"events\"]],[\"get\",[\"onDayClick\"]],[\"get\",[\"defaultDate\"]],[\"get\",[\"userCanEdit\"]],[\"helper\",[\"action\"],[[\"get\",[null]],\"handleRenderingComplete\"],null],[\"get\",[\"onEventClick\"]],[\"get\",[\"onEventDrop\"]],[\"get\",[\"onEventResize\"]],[\"get\",[\"groupByDateAndResource\"]],[\"get\",[\"groupByResource\"]],[\"get\",[\"calendarHeader\"]],[\"get\",[\"height\"]],[\"get\",[\"resources\"]],[\"get\",[\"defaultView\"]],[\"get\",[\"views\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/calendar-control.hbs" } });
});
define("hospitalrun/templates/components/charge-quantity", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "g04lh/y7", "block": "{\"statements\":[[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"pricingItem\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"append\",[\"helper\",[\"input\"],null,[[\"value\",\"class\"],[[\"get\",[\"quantitySelected\"]],\"form-control\"]]],false],[\"text\",\"\\n\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"help-block\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"quantityHelp\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/charge-quantity.hbs" } });
});
define("hospitalrun/templates/components/charges-by-type-tab", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "NB3Hyb4g", "block": "{\"statements\":[[\"open-element\",\"a\",[]],[\"dynamic-attr\",\"href\",[\"unknown\",[\"tabHref\"]],null],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"pricingType\"]],false],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"components.chargesByTypeTab.charges\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/charges-by-type-tab.hbs" } });
});
define("hospitalrun/templates/components/checkbox-or-typeahead", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "CqhQeoNp", "block": "{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"userCanAdd\"]]],null,4,3]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"has-error\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"help-block\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"errors\"]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"checkbox col-xs-2\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"action-checkbox\"],null,[[\"value\",\"action\"],[[\"get\",[\"checkbox\",\"value\"]],\"checkboxChanged\"]]],false],[\"append\",[\"unknown\",[\"checkbox\",\"label\"]],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"checkbox\"]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"checkbox col-xs-1\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"checkboxRow\"]]],null,1],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"checkboxRow\"]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[\"required \",[\"helper\",[\"if\"],[[\"get\",[\"errors\"]],\"has-error\"],null]]]],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"label\"]],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"checkboxRows\"]]],null,2],[\"block\",[\"if\"],[[\"get\",[\"errors\"]]],null,0]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"partial\",\"components/render-typeahead\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/templates/components/checkbox-or-typeahead.hbs" } });
});
define("hospitalrun/templates/components/cross-icon-svg", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "4cplfYDG", "block": "{\"statements\":[[\"open-element\",\"svg\",[]],[\"static-attr\",\"class\",\"cross-icon-svg\"],[\"static-attr\",\"xmlns\",\"http://www.w3.org/2000/svg\",\"http://www.w3.org/2000/xmlns/\"],[\"static-attr\",\"xmlns:xlink\",\"http://www.w3.org/1999/xlink\",\"http://www.w3.org/2000/xmlns/\"],[\"static-attr\",\"x\",\"0px\"],[\"static-attr\",\"y\",\"0px\"],[\"static-attr\",\"viewBox\",\"0 0 32 32\"],[\"static-attr\",\"enable-background\",\"new 0 0 32 32\"],[\"static-attr\",\"xml:space\",\"preserve\",\"http://www.w3.org/XML/1998/namespace\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"polygon\",[]],[\"static-attr\",\"fill\",\"#1ABC9C\"],[\"static-attr\",\"points\",\"21.33,10.67 21.33,0 10.67,0 10.67,10.67 0,10.67 0,21.33 10.67,21.33 10.67,32 21.33,32\\n  21.33,21.33 32,21.33 32,10.67 \"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/cross-icon-svg.hbs" } });
});
define("hospitalrun/templates/components/custom-form-manager", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "ovwf3Gaj", "block": "{\"statements\":[[\"block\",[\"each\"],[[\"get\",[\"formsToDisplay\"]]],null,1],[\"block\",[\"if\"],[[\"get\",[\"showAddButton\"]]],null,0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-sm-2\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"text\",\" \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\" form-control-static\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"addForm\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"t\"],[\"components.customFormManager.buttons.addForm\"],null],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"h4\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"customForm\",\"form\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"append\",[\"helper\",[\"custom-form\"],null,[[\"model\",\"form\",\"propertyPrefix\"],[[\"get\",[\"model\"]],[\"get\",[\"customForm\",\"form\"]],[\"get\",[\"customForm\",\"propertyPrefix\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[\"customForm\"]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/custom-form-manager.hbs" } });
});
define("hospitalrun/templates/components/custom-form", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "1ag54g4j", "block": "{\"statements\":[[\"block\",[\"each\"],[[\"get\",[\"fieldsByRow\"]]],null,7]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"label\",\"property\",\"content\",\"class\",\"prompt\",\"optionValuePath\",\"optionLabelPath\"],[[\"get\",[\"field\",\"label\"]],[\"helper\",[\"concat\"],[[\"get\",[\"propertyPrefix\"]],[\"get\",[\"field\",\"property\"]]],null],[\"get\",[\"field\",\"values\"]],[\"get\",[\"field\",\"displayClassNames\"]],[\"get\",[\"field\",\"prompt\"]],\"label\",\"label\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"field\",\"label\"]],[\"helper\",[\"concat\"],[[\"get\",[\"propertyPrefix\"]],[\"get\",[\"field\",\"property\"]]],null],[\"get\",[\"field\",\"displayClassNames\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"label\",\"property\",\"class\"],[[\"get\",[\"field\",\"label\"]],[\"helper\",[\"concat\"],[[\"get\",[\"propertyPrefix\"]],[\"get\",[\"field\",\"property\"]]],null],[\"get\",[\"field\",\"displayClassNames\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\"],[[\"get\",[\"checkbox\",\"label\"]],[\"helper\",[\"concat\"],[[\"get\",[\"propertyPrefix\"]],[\"get\",[\"checkbox\",\"property\"]]],null]]]],false],[\"text\",\"\\n\"]],\"locals\":[\"checkbox\"]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[\"form-group \",[\"unknown\",[\"field\",\"displayClassNames\"]]]]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"field\",\"label\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"field\",\"values\"]]],null,3],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[\"form-group \",[\"unknown\",[\"field\",\"displayClassNames\"]]]]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"field\",\"label\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"ext-radio\"],null,[[\"content\",\"value\",\"includeOtherOption\",\"otherOptionLabel\"],[[\"get\",[\"field\",\"mappedValues\"]],[\"helper\",[\"get\"],[[\"get\",[\"model\"]],[\"helper\",[\"concat\"],[[\"get\",[\"propertyPrefix\"]],[\"get\",[\"field\",\"property\"]]],null]],null],[\"get\",[\"field\",\"includeOtherOption\"]],[\"get\",[\"field\",\"otherOptionLabel\"]]]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[[\"get\",[\"field\",\"type\"]],\"radio\"],null]],null,5],[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[[\"get\",[\"field\",\"type\"]],\"checkbox\"],null]],null,4],[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[[\"get\",[\"field\",\"type\"]],\"textarea\"],null]],null,2],[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[[\"get\",[\"field\",\"type\"]],\"text\"],null]],null,1],[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[[\"get\",[\"field\",\"type\"]],\"select\"],null]],null,0]],\"locals\":[\"field\"]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row form-group\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"row\"]]],null,6],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"row\"]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/custom-form.hbs" } });
});
define("hospitalrun/templates/components/date-filter", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "TgCpG0RP", "block": "{\"statements\":[[\"open-element\",\"input\",[]],[\"static-attr\",\"type\",\"text\"],[\"static-attr\",\"class\",\"form-control\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"input-group-btn\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"static-attr\",\"type\",\"button\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"clearFilter\"]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/date-filter.hbs" } });
});
define("hospitalrun/templates/components/date-time-picker", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "ndwQ/Jui", "block": "{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[null]],false]],6]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"help-block\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"appointments.messages.endTimeLaterThanStart\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"option\",[]],[\"dynamic-attr\",\"value\",[\"concat\",[[\"unknown\",[\"item\",\"value\"]]]]],[\"dynamic-attr\",\"selected\",[\"helper\",[\"is-equal\"],[[\"get\",[\"item\",\"value\"]],[\"get\",[\"endMinute\"]]],null],null],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"unknown\",[\"item\",\"name\"]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"item\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"option\",[]],[\"dynamic-attr\",\"value\",[\"concat\",[[\"unknown\",[\"item\",\"value\"]]]]],[\"dynamic-attr\",\"selected\",[\"helper\",[\"is-equal\"],[[\"get\",[\"item\",\"value\"]],[\"get\",[\"endHour\"]]],null],null],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"unknown\",[\"item\",\"name\"]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"item\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"option\",[]],[\"dynamic-attr\",\"value\",[\"concat\",[[\"unknown\",[\"item\",\"value\"]]]]],[\"dynamic-attr\",\"selected\",[\"helper\",[\"is-equal\"],[[\"get\",[\"item\",\"value\"]],[\"get\",[\"startMinute\"]]],null],null],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"unknown\",[\"item\",\"name\"]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"item\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"option\",[]],[\"dynamic-attr\",\"value\",[\"concat\",[[\"unknown\",[\"item\",\"value\"]]]]],[\"dynamic-attr\",\"selected\",[\"helper\",[\"is-equal\"],[[\"get\",[\"item\",\"value\"]],[\"get\",[\"startHour\"]]],null],null],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"unknown\",[\"item\",\"name\"]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"item\"]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-input-group col-sm-3 required\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"static-attr\",\"for\",\"startTime\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.startTime\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"input-group\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"select\",[]],[\"dynamic-attr\",\"onchange\",[\"helper\",[\"action\"],[[\"get\",[null]],\"startHourChanged\"],[[\"value\"],[\"target.value\"]]],null],[\"static-attr\",\"class\",\"form-control start-hour\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"hourList\"]]],null,4],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"input-group-addon\"],[\"flush-element\"],[\"text\",\":\"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"select\",[]],[\"dynamic-attr\",\"onchange\",[\"helper\",[\"action\"],[[\"get\",[null]],\"startMinuteChanged\"],[[\"value\"],[\"target.value\"]]],null],[\"static-attr\",\"class\",\"form-control start-minute\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"minuteList\"]]],null,3],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[\"form-input-group col-sm-3 required has-feedback \",[\"helper\",[\"if\"],[[\"get\",[\"endTimeHasError\"]],\"has-error\"],null]]]],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"static-attr\",\"for\",\"endTime\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.endTime\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"input-group\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"select\",[]],[\"dynamic-attr\",\"onchange\",[\"helper\",[\"action\"],[[\"get\",[null]],\"endHourChanged\"],[[\"value\"],[\"target.value\"]]],null],[\"static-attr\",\"class\",\"form-control end-hour\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"hourList\"]]],null,2],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"input-group-addon\"],[\"flush-element\"],[\"text\",\":\"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"select\",[]],[\"dynamic-attr\",\"onchange\",[\"helper\",[\"action\"],[[\"get\",[null]],\"endMinuteChanged\"],[[\"value\"],[\"target.value\"]]],null],[\"static-attr\",\"class\",\"form-control end-minute\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"minuteList\"]]],null,1],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"endTimeHasError\"]]],null,0],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\",\"dateSetAction\"],[\"dateTimePickerDate\",[\"get\",[\"label\"]],[\"helper\",[\"concat\"],[\"col-sm-4 \",[\"get\",[\"datePickerClass\"]]],null],\"dateChanged\"]]],false],[\"text\",\"\\n\"],[\"block\",[\"unless\"],[[\"get\",[\"isAllDay\"]]],null,5]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/date-time-picker.hbs" } });
});
define("hospitalrun/templates/components/edit-panel", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "9HE59IZp", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"yield\",\"default\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"unless\"],[[\"get\",[\"editPanelProps\",\"hideCancelButton\"]]],null,6],[\"block\",[\"if\"],[[\"get\",[\"editPanelProps\",\"showUpdateButton\"]]],null,3],[\"block\",[\"each\"],[[\"get\",[\"editPanelProps\",\"additionalButtons\"]]],null,1],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[\"default\"],\"blocks\":[{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"span\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[[\"unknown\",[\"button\",\"buttonIcon\"]]]]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"button\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[[\"unknown\",[\"button\",\"class\"]]]]],[\"modifier\",[\"action\"],[[\"get\",[null]],\"fireButtonAction\",[\"get\",[\"button\",\"buttonAction\"]]]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"button\",\"buttonIcon\"]]],null,0],[\"text\",\"        \"],[\"append\",[\"unknown\",[\"button\",\"buttonText\"]],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"button\"]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"span\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[[\"unknown\",[\"editPanelProps\",\"updateButtonIcon\"]]]]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"button\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[\"btn btn-primary on-white \",[\"helper\",[\"if\"],[[\"get\",[\"editPanelProps\",\"disabledAction\"]],\"disabled-btn\"],null]]]],[\"modifier\",[\"action\"],[[\"get\",[null]],[\"get\",[\"editPanelProps\",\"actionForUpdateButton\"]]]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"editPanelProps\",\"updateButtonIcon\"]]],null,2],[\"text\",\"          \"],[\"append\",[\"unknown\",[\"editPanelProps\",\"updateButtonText\"]],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"cancel\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.cancel\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"cancel\"]],[\"flush-element\"],[\"append\",[\"unknown\",[\"editPanelProps\",\"cancelButtonText\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"editPanelProps\",\"cancelButtonText\"]]],null,5,4]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/edit-panel.hbs" } });
});
define("hospitalrun/templates/components/expand-text", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "A2ZHDk/T", "block": "{\"statements\":[[\"append\",[\"helper\",[\"em-text\"],null,[[\"label\",\"property\",\"rows\"],[[\"get\",[\"label\"]],[\"get\",[\"property\"]],[\"get\",[\"rows\"]]]]],false],[\"text\",\"\\n\"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"text-expansion-div\"],[\"dynamic-attr\",\"style\",[\"unknown\",[\"expansionDivStyle\"]],null],[\"flush-element\"],[\"append\",[\"unknown\",[\"expansionText\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/expand-text.hbs" } });
});
define("hospitalrun/templates/components/ext-radio", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "KoweKIgU", "block": "{\"statements\":[[\"block\",[\"each\"],[[\"get\",[\"content\"]]],null,3],[\"block\",[\"if\"],[[\"get\",[\"includeOtherOption\"]]],null,0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"radio\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"radio-button\"],null,[[\"value\",\"checked\"],[[\"get\",[\"otherValue\"]],[\"get\",[\"value\"]]]]],false],[\"text\",\"\\n      \"],[\"append\",[\"unknown\",[\"otherOptionLabel\"]],false],[\"text\",\" \"],[\"append\",[\"helper\",[\"input\"],null,[[\"value\",\"class\"],[[\"get\",[\"otherValue\"]],\"form-control\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"radio-button\"],null,[[\"value\",\"checked\"],[[\"get\",[\"radio\"]],[\"get\",[\"value\"]]]]],false],[\"text\",\" \"],[\"append\",[\"get\",[\"radio\"]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"helper\",[\"radio-button\"],null,[[\"value\",\"checked\"],[[\"get\",[\"radio\",\"value\"]],[\"get\",[\"value\"]]]]],false],[\"text\",\" \"],[\"append\",[\"unknown\",[\"radio\",\"label\"]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"label\",[]],[\"dynamic-attr\",\"class\",[\"unknown\",[\"radioClass\"]],null],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"haveLabel\"]]],null,2,1],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"radio\"]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/ext-radio.hbs" } });
});
define("hospitalrun/templates/components/inventory-location-picker", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "vGkhvVxa", "block": "{\"statements\":[[\"block\",[\"each\"],[[\"get\",[\"locationPickers\"]]],null,0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"locationPicker\",\"label\"]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"location-select\"],null,[[\"locationPicker\"],[[\"get\",[\"locationPicker\"]]]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"locationPicker\"]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/inventory-location-picker.hbs" } });
});
define("hospitalrun/templates/components/item-listing", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "eQoNRFGh", "block": "{\"statements\":[[\"append\",[\"helper\",[\"nav-paging\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]]],false],[\"text\",\"\\n\"],[\"yield\",\"default\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[\"default\"],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/item-listing.hbs" } });
});
define("hospitalrun/templates/components/location-select", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "5LCNN7Ha", "block": "{\"statements\":[[\"append\",[\"helper\",[\"select-list\"],null,[[\"value\",\"content\",\"class\",\"optionValuePath\",\"optionLabelPath\",\"action\"],[[\"get\",[\"locationPicker\",\"selectedLocation\"]],[\"get\",[\"locationPicker\",\"subLocationList\"]],\"form-control\",\"selectObject\",\"selectObject.locationNameWithQuantity\",[\"get\",[\"locationChange\"]]]]],false]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/location-select.hbs" } });
});
define("hospitalrun/templates/components/logo-dark-svg", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "1zkQQkU+", "block": "{\"statements\":[[\"open-element\",\"svg\",[]],[\"static-attr\",\"class\",\"logo-svg\"],[\"static-attr\",\"xmlns\",\"http://www.w3.org/2000/svg\",\"http://www.w3.org/2000/xmlns/\"],[\"static-attr\",\"xmlns:xlink\",\"http://www.w3.org/1999/xlink\",\"http://www.w3.org/2000/xmlns/\"],[\"static-attr\",\"x\",\"0px\"],[\"static-attr\",\"y\",\"0px\"],[\"static-attr\",\"viewBox\",\"0 0 200 31.36\"],[\"static-attr\",\"enable-background\",\"new 0 0 200 31.36\"],[\"static-attr\",\"xml:space\",\"preserve\",\"http://www.w3.org/XML/1998/namespace\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"g\",[]],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"g\",[]],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#273647\"],[\"static-attr\",\"d\",\"M51.29,25.59h-4.67V14.71H34.95v10.89h-4.67V0.69h4.67V11.4h11.68V0.69h4.67V25.59z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#273647\"],[\"static-attr\",\"d\",\"M61.71,7.65c1.32,0,2.52,0.21,3.59,0.64c1.07,0.42,1.99,1.03,2.75,1.81c0.76,0.78,1.34,1.73,1.76,2.86\\n        c0.41,1.13,0.62,2.38,0.62,3.77c0,1.4-0.21,2.66-0.62,3.79c-0.41,1.13-1,2.08-1.76,2.88c-0.76,0.79-1.67,1.4-2.75,1.83\\n        c-1.07,0.42-2.27,0.64-3.59,0.64c-1.32,0-2.52-0.21-3.6-0.64c-1.08-0.42-2-1.03-2.76-1.83c-0.76-0.79-1.36-1.75-1.77-2.88\\n        c-0.42-1.13-0.63-2.39-0.63-3.79c0-1.39,0.21-2.65,0.63-3.77c0.42-1.13,1.01-2.08,1.77-2.86c0.76-0.78,1.68-1.38,2.76-1.81\\n        C59.19,7.86,60.39,7.65,61.71,7.65z M61.71,22.58c1.47,0,2.56-0.49,3.26-1.48c0.71-0.99,1.06-2.43,1.06-4.34s-0.35-3.36-1.06-4.36\\n        c-0.71-1-1.79-1.5-3.26-1.5c-1.49,0-2.6,0.5-3.31,1.51c-0.71,1-1.07,2.45-1.07,4.35c0,1.89,0.36,3.34,1.07,4.33\\n        C59.11,22.08,60.21,22.58,61.71,22.58z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#273647\"],[\"static-attr\",\"d\",\"M83.4,11.37c-0.11,0.18-0.24,0.31-0.36,0.39c-0.13,0.07-0.29,0.11-0.48,0.11c-0.21,0-0.43-0.06-0.66-0.17\\n        c-0.24-0.11-0.51-0.24-0.82-0.39c-0.31-0.14-0.66-0.27-1.06-0.39c-0.4-0.11-0.86-0.17-1.4-0.17c-0.84,0-1.5,0.18-1.98,0.53\\n        c-0.48,0.36-0.72,0.82-0.72,1.39c0,0.38,0.12,0.7,0.37,0.96c0.25,0.26,0.57,0.49,0.98,0.68c0.41,0.2,0.87,0.37,1.39,0.53\\n        c0.52,0.15,1.04,0.32,1.58,0.51c0.54,0.18,1.07,0.39,1.58,0.63c0.52,0.24,0.98,0.53,1.39,0.9c0.41,0.36,0.73,0.8,0.98,1.3\\n        c0.25,0.51,0.37,1.11,0.37,1.83c0,0.85-0.16,1.63-0.47,2.35c-0.31,0.72-0.76,1.34-1.36,1.86c-0.6,0.52-1.33,0.93-2.21,1.22\\n        c-0.88,0.29-1.89,0.44-3.02,0.44c-0.61,0-1.2-0.05-1.78-0.16c-0.58-0.11-1.14-0.26-1.67-0.46c-0.53-0.2-1.03-0.42-1.48-0.69\\n        c-0.45-0.26-0.85-0.55-1.2-0.86l0.98-1.62c0.13-0.2,0.28-0.34,0.45-0.45c0.17-0.1,0.39-0.15,0.65-0.15c0.26,0,0.51,0.07,0.75,0.22\\n        c0.24,0.15,0.51,0.31,0.82,0.48c0.31,0.17,0.67,0.33,1.09,0.48c0.42,0.15,0.95,0.22,1.59,0.22c0.51,0,0.94-0.06,1.3-0.18\\n        c0.36-0.12,0.66-0.28,0.9-0.47c0.24-0.2,0.41-0.42,0.52-0.68c0.11-0.26,0.16-0.53,0.16-0.8c0-0.41-0.12-0.75-0.37-1.02\\n        c-0.25-0.26-0.57-0.49-0.98-0.69c-0.41-0.2-0.87-0.37-1.4-0.53c-0.52-0.15-1.06-0.32-1.6-0.51c-0.55-0.18-1.08-0.4-1.6-0.65\\n        c-0.52-0.25-0.99-0.56-1.4-0.94c-0.41-0.38-0.73-0.84-0.98-1.4c-0.25-0.55-0.37-1.22-0.37-2c0-0.72,0.14-1.41,0.43-2.07\\n        c0.29-0.65,0.71-1.23,1.27-1.71c0.56-0.49,1.25-0.88,2.08-1.17c0.83-0.29,1.79-0.44,2.88-0.44c1.22,0,2.33,0.2,3.32,0.6\\n        c1,0.4,1.83,0.93,2.5,1.58L83.4,11.37z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#273647\"],[\"static-attr\",\"d\",\"M86.58,31.36V7.92h2.6c0.28,0,0.51,0.06,0.71,0.19c0.2,0.13,0.32,0.32,0.38,0.59l0.34,1.64\\n        c0.71-0.82,1.53-1.48,2.45-1.98c0.92-0.51,2.01-0.76,3.25-0.76c0.96,0,1.85,0.2,2.64,0.6c0.8,0.4,1.49,0.98,2.07,1.75\\n        c0.58,0.76,1.03,1.71,1.34,2.82c0.32,1.12,0.47,2.4,0.47,3.85c0,1.32-0.18,2.54-0.53,3.67c-0.36,1.13-0.86,2.1-1.52,2.93\\n        c-0.66,0.83-1.46,1.47-2.39,1.94s-1.98,0.7-3.14,0.7c-1,0-1.85-0.15-2.54-0.46c-0.69-0.3-1.32-0.73-1.87-1.27v7.23H86.58z\\n        M94.85,10.95c-0.88,0-1.64,0.19-2.26,0.56c-0.63,0.37-1.21,0.9-1.75,1.58v7.92c0.48,0.6,1.01,1.01,1.58,1.25\\n        c0.57,0.24,1.18,0.35,1.83,0.35c0.64,0,1.23-0.12,1.75-0.36c0.52-0.24,0.96-0.61,1.33-1.1c0.36-0.49,0.64-1.12,0.84-1.87\\n        c0.2-0.75,0.29-1.64,0.29-2.66c0-1.03-0.08-1.91-0.25-2.63c-0.17-0.72-0.41-1.3-0.71-1.75c-0.31-0.45-0.69-0.78-1.13-0.98\\n        C95.92,11.06,95.41,10.95,94.85,10.95z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#273647\"],[\"static-attr\",\"d\",\"M109.85,2.77c0,0.37-0.07,0.71-0.22,1.03c-0.15,0.32-0.35,0.6-0.59,0.84c-0.25,0.24-0.54,0.43-0.87,0.58\\n        c-0.33,0.14-0.69,0.22-1.07,0.22c-0.37,0-0.71-0.07-1.04-0.22c-0.33-0.14-0.61-0.34-0.85-0.58c-0.24-0.24-0.43-0.52-0.58-0.84\\n        c-0.14-0.32-0.22-0.67-0.22-1.03c0-0.38,0.07-0.73,0.22-1.07c0.14-0.33,0.34-0.62,0.58-0.86c0.24-0.24,0.53-0.43,0.85-0.58\\n        c0.33-0.14,0.67-0.22,1.04-0.22c0.38,0,0.73,0.07,1.07,0.22c0.33,0.14,0.62,0.34,0.87,0.58c0.25,0.24,0.44,0.53,0.59,0.86\\n        C109.78,2.04,109.85,2.39,109.85,2.77z M109.22,7.92v17.67h-4.25V7.92H109.22z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#273647\"],[\"static-attr\",\"d\",\"M118.45,25.87c-1.53,0-2.7-0.43-3.53-1.3c-0.83-0.87-1.24-2.06-1.24-3.59v-9.87h-1.79\\n        c-0.23,0-0.43-0.07-0.59-0.22c-0.17-0.15-0.25-0.37-0.25-0.67V8.53l2.84-0.47l0.9-4.82c0.05-0.23,0.15-0.41,0.32-0.53\\n        c0.17-0.13,0.38-0.19,0.63-0.19h2.2v5.56h4.65v3.03h-4.65v9.58c0,0.55,0.14,0.98,0.41,1.29c0.28,0.31,0.64,0.46,1.1,0.46\\n        c0.26,0,0.48-0.03,0.66-0.09c0.18-0.06,0.33-0.13,0.47-0.2c0.13-0.07,0.25-0.14,0.35-0.2c0.1-0.06,0.21-0.09,0.31-0.09\\n        c0.13,0,0.23,0.03,0.31,0.09c0.08,0.06,0.17,0.16,0.26,0.28l1.27,2.07c-0.62,0.52-1.33,0.91-2.14,1.17\\n        C120.14,25.74,119.31,25.87,118.45,25.87z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#273647\"],[\"static-attr\",\"d\",\"M138.44,25.59h-1.91c-0.4,0-0.72-0.06-0.95-0.18c-0.23-0.12-0.4-0.36-0.52-0.73l-0.38-1.26\\n        c-0.45,0.4-0.89,0.75-1.32,1.06c-0.43,0.3-0.88,0.56-1.33,0.77c-0.46,0.21-0.95,0.36-1.46,0.47c-0.52,0.1-1.09,0.15-1.72,0.15\\n        c-0.75,0-1.44-0.1-2.07-0.3c-0.63-0.2-1.17-0.5-1.63-0.91c-0.45-0.4-0.81-0.9-1.06-1.5c-0.25-0.6-0.38-1.3-0.38-2.09\\n        c0-0.67,0.17-1.33,0.53-1.98c0.35-0.65,0.93-1.24,1.75-1.76c0.82-0.52,1.9-0.96,3.26-1.3c1.35-0.35,3.04-0.52,5.05-0.52v-1.04\\n        c0-1.19-0.25-2.07-0.75-2.65c-0.5-0.57-1.23-0.86-2.18-0.86c-0.69,0-1.26,0.08-1.72,0.24c-0.46,0.16-0.86,0.34-1.2,0.54\\n        c-0.34,0.2-0.65,0.38-0.94,0.54c-0.29,0.16-0.6,0.24-0.95,0.24c-0.29,0-0.53-0.07-0.74-0.22c-0.21-0.15-0.37-0.33-0.5-0.55\\n        l-0.77-1.36c2.03-1.86,4.48-2.79,7.35-2.79c1.03,0,1.95,0.17,2.76,0.51c0.81,0.34,1.5,0.81,2.06,1.41\\n        c0.56,0.6,0.99,1.32,1.28,2.16c0.29,0.84,0.44,1.76,0.44,2.76V25.59z M130.18,22.94c0.44,0,0.84-0.04,1.21-0.12\\n        c0.37-0.08,0.71-0.2,1.04-0.36c0.33-0.16,0.64-0.35,0.95-0.58c0.3-0.23,0.61-0.51,0.92-0.82V18.1c-1.24,0-2.28,0.08-3.11,0.23\\n        c-0.83,0.16-1.5,0.36-2.01,0.6c-0.51,0.24-0.86,0.53-1.08,0.85c-0.21,0.32-0.32,0.68-0.32,1.06c0,0.75,0.22,1.29,0.66,1.61\\n        C128.89,22.78,129.46,22.94,130.18,22.94z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#273647\"],[\"static-attr\",\"d\",\"M145.78,0v25.59h-4.25V0H145.78z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"g\",[]],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#1ABC9C\"],[\"static-attr\",\"d\",\"M152.86,14.18v11.41h-1.82V0.37h6.43c2.91,0,5.08,0.56,6.52,1.68c1.44,1.12,2.16,2.77,2.16,4.95\\n        c0,0.96-0.17,1.84-0.5,2.64c-0.33,0.8-0.81,1.49-1.43,2.09c-0.62,0.6-1.38,1.09-2.25,1.48c-0.88,0.39-1.87,0.64-2.98,0.76\\n        c0.29,0.18,0.54,0.42,0.77,0.71l8.68,10.91h-1.59c-0.19,0-0.35-0.04-0.49-0.11c-0.14-0.07-0.27-0.19-0.4-0.36l-8.07-10.23\\n        c-0.2-0.26-0.42-0.45-0.65-0.55c-0.23-0.11-0.59-0.16-1.08-0.16H152.86z M152.86,12.82h4.38c1.12,0,2.12-0.13,3-0.4\\n        c0.88-0.27,1.63-0.65,2.25-1.15c0.61-0.5,1.08-1.1,1.4-1.8c0.32-0.7,0.48-1.49,0.48-2.37c0-1.79-0.59-3.12-1.76-3.99\\n        c-1.18-0.87-2.89-1.3-5.13-1.3h-4.62V12.82z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#1ABC9C\"],[\"static-attr\",\"d\",\"M170.85,7.85v11.33c0,1.66,0.38,2.97,1.14,3.91c0.76,0.94,1.93,1.42,3.49,1.42c1.16,0,2.24-0.29,3.24-0.88\\n        c1-0.59,1.9-1.4,2.7-2.45V7.85h1.69v17.73h-0.93c-0.33,0-0.5-0.15-0.51-0.46l-0.16-2.64c-0.82,1.02-1.77,1.84-2.85,2.46\\n        c-1.08,0.62-2.28,0.93-3.6,0.93c-0.99,0-1.85-0.15-2.59-0.46c-0.74-0.31-1.35-0.75-1.84-1.34c-0.49-0.58-0.86-1.28-1.11-2.1\\n        c-0.25-0.82-0.37-1.75-0.37-2.78V7.85H170.85z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#1ABC9C\"],[\"static-attr\",\"d\",\"M186.06,25.58V7.85h0.93c0.31,0,0.49,0.15,0.53,0.45l0.16,2.67c0.81-1.02,1.75-1.84,2.82-2.47\\n        c1.08-0.62,2.27-0.94,3.59-0.94c0.97,0,1.83,0.15,2.58,0.46c0.74,0.31,1.36,0.75,1.84,1.34c0.49,0.58,0.86,1.28,1.1,2.1\\n        c0.25,0.82,0.37,1.75,0.37,2.78v11.33h-1.69V14.25c0-1.66-0.38-2.97-1.14-3.91c-0.76-0.94-1.92-1.42-3.49-1.42\\n        c-1.16,0-2.25,0.3-3.24,0.9c-1,0.6-1.89,1.42-2.67,2.47v13.29H186.06z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"g\",[]],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"polygon\",[]],[\"static-attr\",\"fill\",\"#1ABC9C\"],[\"static-attr\",\"points\",\"16.68,9.03 16.68,0.69 8.34,0.69 8.34,9.03 0,9.03 0,17.36 8.34,17.36 8.34,25.7 16.68,25.7\\n        16.68,17.36 25.01,17.36 25.01,9.03 \\t\\t\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/logo-dark-svg.hbs" } });
});
define("hospitalrun/templates/components/logo-svg", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "aMQvzuDV", "block": "{\"statements\":[[\"open-element\",\"svg\",[]],[\"static-attr\",\"class\",\"logo-svg\"],[\"static-attr\",\"xmlns\",\"http://www.w3.org/2000/svg\",\"http://www.w3.org/2000/xmlns/\"],[\"static-attr\",\"xmlns:xlink\",\"http://www.w3.org/1999/xlink\",\"http://www.w3.org/2000/xmlns/\"],[\"static-attr\",\"x\",\"0px\"],[\"static-attr\",\"y\",\"0px\"],[\"static-attr\",\"viewBox\",\"0 0 200 31.36\"],[\"static-attr\",\"enable-background\",\"new 0 0 200 31.36\"],[\"static-attr\",\"xml:space\",\"preserve\",\"http://www.w3.org/XML/1998/namespace\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"g\",[]],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"g\",[]],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#FFFFFF\"],[\"static-attr\",\"d\",\"M51.29,25.59h-4.67V14.71H34.95v10.89h-4.67V0.69h4.67V11.4h11.68V0.69h4.67V25.59z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#FFFFFF\"],[\"static-attr\",\"d\",\"M61.71,7.65c1.32,0,2.52,0.21,3.59,0.64c1.07,0.42,1.99,1.03,2.75,1.81c0.76,0.78,1.34,1.73,1.76,2.86\\n        c0.41,1.13,0.62,2.38,0.62,3.77c0,1.4-0.21,2.66-0.62,3.79c-0.41,1.13-1,2.08-1.76,2.88c-0.76,0.79-1.67,1.4-2.75,1.83\\n        c-1.07,0.42-2.27,0.64-3.59,0.64c-1.32,0-2.52-0.21-3.6-0.64c-1.08-0.42-2-1.03-2.76-1.83c-0.76-0.79-1.36-1.75-1.77-2.88\\n        c-0.42-1.13-0.63-2.39-0.63-3.79c0-1.39,0.21-2.65,0.63-3.77c0.42-1.13,1.01-2.08,1.77-2.86c0.76-0.78,1.68-1.38,2.76-1.81\\n        C59.19,7.86,60.39,7.65,61.71,7.65z M61.71,22.58c1.47,0,2.56-0.49,3.26-1.48c0.71-0.99,1.06-2.43,1.06-4.34s-0.35-3.36-1.06-4.36\\n        c-0.71-1-1.79-1.5-3.26-1.5c-1.49,0-2.6,0.5-3.31,1.51c-0.71,1-1.07,2.45-1.07,4.35c0,1.89,0.36,3.34,1.07,4.33\\n        C59.11,22.08,60.21,22.58,61.71,22.58z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#FFFFFF\"],[\"static-attr\",\"d\",\"M83.4,11.37c-0.11,0.18-0.24,0.31-0.36,0.39c-0.13,0.07-0.29,0.11-0.48,0.11c-0.21,0-0.43-0.06-0.66-0.17\\n        c-0.24-0.11-0.51-0.24-0.82-0.39c-0.31-0.14-0.66-0.27-1.06-0.39c-0.4-0.11-0.86-0.17-1.4-0.17c-0.84,0-1.5,0.18-1.98,0.53\\n        c-0.48,0.36-0.72,0.82-0.72,1.39c0,0.38,0.12,0.7,0.37,0.96c0.25,0.26,0.57,0.49,0.98,0.68c0.41,0.2,0.87,0.37,1.39,0.53\\n        c0.52,0.15,1.04,0.32,1.58,0.51c0.54,0.18,1.07,0.39,1.58,0.63c0.52,0.24,0.98,0.53,1.39,0.9c0.41,0.36,0.73,0.8,0.98,1.3\\n        c0.25,0.51,0.37,1.11,0.37,1.83c0,0.85-0.16,1.63-0.47,2.35c-0.31,0.72-0.76,1.34-1.36,1.86c-0.6,0.52-1.33,0.93-2.21,1.22\\n        c-0.88,0.29-1.89,0.44-3.02,0.44c-0.61,0-1.2-0.05-1.78-0.16c-0.58-0.11-1.14-0.26-1.67-0.46c-0.53-0.2-1.03-0.42-1.48-0.69\\n        c-0.45-0.26-0.85-0.55-1.2-0.86l0.98-1.62c0.13-0.2,0.28-0.34,0.45-0.45c0.17-0.1,0.39-0.15,0.65-0.15c0.26,0,0.51,0.07,0.75,0.22\\n        c0.24,0.15,0.51,0.31,0.82,0.48c0.31,0.17,0.67,0.33,1.09,0.48c0.42,0.15,0.95,0.22,1.59,0.22c0.51,0,0.94-0.06,1.3-0.18\\n        c0.36-0.12,0.66-0.28,0.9-0.47c0.24-0.2,0.41-0.42,0.52-0.68c0.11-0.26,0.16-0.53,0.16-0.8c0-0.41-0.12-0.75-0.37-1.02\\n        c-0.25-0.26-0.57-0.49-0.98-0.69c-0.41-0.2-0.87-0.37-1.4-0.53c-0.52-0.15-1.06-0.32-1.6-0.51c-0.55-0.18-1.08-0.4-1.6-0.65\\n        c-0.52-0.25-0.99-0.56-1.4-0.94c-0.41-0.38-0.73-0.84-0.98-1.4c-0.25-0.55-0.37-1.22-0.37-2c0-0.72,0.14-1.41,0.43-2.07\\n        c0.29-0.65,0.71-1.23,1.27-1.71c0.56-0.49,1.25-0.88,2.08-1.17c0.83-0.29,1.79-0.44,2.88-0.44c1.22,0,2.33,0.2,3.32,0.6\\n        c1,0.4,1.83,0.93,2.5,1.58L83.4,11.37z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#FFFFFF\"],[\"static-attr\",\"d\",\"M86.58,31.36V7.92h2.6c0.28,0,0.51,0.06,0.71,0.19c0.2,0.13,0.32,0.32,0.38,0.59l0.34,1.64\\n        c0.71-0.82,1.53-1.48,2.45-1.98c0.92-0.51,2.01-0.76,3.25-0.76c0.96,0,1.85,0.2,2.64,0.6c0.8,0.4,1.49,0.98,2.07,1.75\\n        c0.58,0.76,1.03,1.71,1.34,2.82c0.32,1.12,0.47,2.4,0.47,3.85c0,1.32-0.18,2.54-0.53,3.67c-0.36,1.13-0.86,2.1-1.52,2.93\\n        c-0.66,0.83-1.46,1.47-2.39,1.94s-1.98,0.7-3.14,0.7c-1,0-1.85-0.15-2.54-0.46c-0.69-0.3-1.32-0.73-1.87-1.27v7.23H86.58z\\n        M94.85,10.95c-0.88,0-1.64,0.19-2.26,0.56c-0.63,0.37-1.21,0.9-1.75,1.58v7.92c0.48,0.6,1.01,1.01,1.58,1.25\\n        c0.57,0.24,1.18,0.35,1.83,0.35c0.64,0,1.23-0.12,1.75-0.36c0.52-0.24,0.96-0.61,1.33-1.1c0.36-0.49,0.64-1.12,0.84-1.87\\n        c0.2-0.75,0.29-1.64,0.29-2.66c0-1.03-0.08-1.91-0.25-2.63c-0.17-0.72-0.41-1.3-0.71-1.75c-0.31-0.45-0.69-0.78-1.13-0.98\\n        C95.92,11.06,95.41,10.95,94.85,10.95z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#FFFFFF\"],[\"static-attr\",\"d\",\"M109.85,2.77c0,0.37-0.07,0.71-0.22,1.03c-0.15,0.32-0.35,0.6-0.59,0.84c-0.25,0.24-0.54,0.43-0.87,0.58\\n        c-0.33,0.14-0.69,0.22-1.07,0.22c-0.37,0-0.71-0.07-1.04-0.22c-0.33-0.14-0.61-0.34-0.85-0.58c-0.24-0.24-0.43-0.52-0.58-0.84\\n        c-0.14-0.32-0.22-0.67-0.22-1.03c0-0.38,0.07-0.73,0.22-1.07c0.14-0.33,0.34-0.62,0.58-0.86c0.24-0.24,0.53-0.43,0.85-0.58\\n        c0.33-0.14,0.67-0.22,1.04-0.22c0.38,0,0.73,0.07,1.07,0.22c0.33,0.14,0.62,0.34,0.87,0.58c0.25,0.24,0.44,0.53,0.59,0.86\\n        C109.78,2.04,109.85,2.39,109.85,2.77z M109.22,7.92v17.67h-4.25V7.92H109.22z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#FFFFFF\"],[\"static-attr\",\"d\",\"M118.45,25.87c-1.53,0-2.7-0.43-3.53-1.3c-0.83-0.87-1.24-2.06-1.24-3.59v-9.87h-1.79\\n        c-0.23,0-0.43-0.07-0.59-0.22c-0.17-0.15-0.25-0.37-0.25-0.67V8.53l2.84-0.47l0.9-4.82c0.05-0.23,0.15-0.41,0.32-0.53\\n        c0.17-0.13,0.38-0.19,0.63-0.19h2.2v5.56h4.65v3.03h-4.65v9.58c0,0.55,0.14,0.98,0.41,1.29c0.28,0.31,0.64,0.46,1.1,0.46\\n        c0.26,0,0.48-0.03,0.66-0.09c0.18-0.06,0.33-0.13,0.47-0.2c0.13-0.07,0.25-0.14,0.35-0.2c0.1-0.06,0.21-0.09,0.31-0.09\\n        c0.13,0,0.23,0.03,0.31,0.09c0.08,0.06,0.17,0.16,0.26,0.28l1.27,2.07c-0.62,0.52-1.33,0.91-2.14,1.17\\n        C120.14,25.74,119.31,25.87,118.45,25.87z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#FFFFFF\"],[\"static-attr\",\"d\",\"M138.44,25.59h-1.91c-0.4,0-0.72-0.06-0.95-0.18c-0.23-0.12-0.4-0.36-0.52-0.73l-0.38-1.26\\n        c-0.45,0.4-0.89,0.75-1.32,1.06c-0.43,0.3-0.88,0.56-1.33,0.77c-0.46,0.21-0.95,0.36-1.46,0.47c-0.52,0.1-1.09,0.15-1.72,0.15\\n        c-0.75,0-1.44-0.1-2.07-0.3c-0.63-0.2-1.17-0.5-1.63-0.91c-0.45-0.4-0.81-0.9-1.06-1.5c-0.25-0.6-0.38-1.3-0.38-2.09\\n        c0-0.67,0.17-1.33,0.53-1.98c0.35-0.65,0.93-1.24,1.75-1.76c0.82-0.52,1.9-0.96,3.26-1.3c1.35-0.35,3.04-0.52,5.05-0.52v-1.04\\n        c0-1.19-0.25-2.07-0.75-2.65c-0.5-0.57-1.23-0.86-2.18-0.86c-0.69,0-1.26,0.08-1.72,0.24c-0.46,0.16-0.86,0.34-1.2,0.54\\n        c-0.34,0.2-0.65,0.38-0.94,0.54c-0.29,0.16-0.6,0.24-0.95,0.24c-0.29,0-0.53-0.07-0.74-0.22c-0.21-0.15-0.37-0.33-0.5-0.55\\n        l-0.77-1.36c2.03-1.86,4.48-2.79,7.35-2.79c1.03,0,1.95,0.17,2.76,0.51c0.81,0.34,1.5,0.81,2.06,1.41\\n        c0.56,0.6,0.99,1.32,1.28,2.16c0.29,0.84,0.44,1.76,0.44,2.76V25.59z M130.18,22.94c0.44,0,0.84-0.04,1.21-0.12\\n        c0.37-0.08,0.71-0.2,1.04-0.36c0.33-0.16,0.64-0.35,0.95-0.58c0.3-0.23,0.61-0.51,0.92-0.82V18.1c-1.24,0-2.28,0.08-3.11,0.23\\n        c-0.83,0.16-1.5,0.36-2.01,0.6c-0.51,0.24-0.86,0.53-1.08,0.85c-0.21,0.32-0.32,0.68-0.32,1.06c0,0.75,0.22,1.29,0.66,1.61\\n        C128.89,22.78,129.46,22.94,130.18,22.94z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#FFFFFF\"],[\"static-attr\",\"d\",\"M145.78,0v25.59h-4.25V0H145.78z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"g\",[]],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#1ABC9C\"],[\"static-attr\",\"d\",\"M152.86,14.18v11.41h-1.82V0.37h6.43c2.91,0,5.08,0.56,6.52,1.68c1.44,1.12,2.16,2.77,2.16,4.95\\n        c0,0.96-0.17,1.84-0.5,2.64c-0.33,0.8-0.81,1.49-1.43,2.09c-0.62,0.6-1.38,1.09-2.25,1.48c-0.88,0.39-1.87,0.64-2.98,0.76\\n        c0.29,0.18,0.54,0.42,0.77,0.71l8.68,10.91h-1.59c-0.19,0-0.35-0.04-0.49-0.11c-0.14-0.07-0.27-0.19-0.4-0.36l-8.07-10.23\\n        c-0.2-0.26-0.42-0.45-0.65-0.55c-0.23-0.11-0.59-0.16-1.08-0.16H152.86z M152.86,12.82h4.38c1.12,0,2.12-0.13,3-0.4\\n        c0.88-0.27,1.63-0.65,2.25-1.15c0.61-0.5,1.08-1.1,1.4-1.8c0.32-0.7,0.48-1.49,0.48-2.37c0-1.79-0.59-3.12-1.76-3.99\\n        c-1.18-0.87-2.89-1.3-5.13-1.3h-4.62V12.82z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#1ABC9C\"],[\"static-attr\",\"d\",\"M170.85,7.85v11.33c0,1.66,0.38,2.97,1.14,3.91c0.76,0.94,1.93,1.42,3.49,1.42c1.16,0,2.24-0.29,3.24-0.88\\n        c1-0.59,1.9-1.4,2.7-2.45V7.85h1.69v17.73h-0.93c-0.33,0-0.5-0.15-0.51-0.46l-0.16-2.64c-0.82,1.02-1.77,1.84-2.85,2.46\\n        c-1.08,0.62-2.28,0.93-3.6,0.93c-0.99,0-1.85-0.15-2.59-0.46c-0.74-0.31-1.35-0.75-1.84-1.34c-0.49-0.58-0.86-1.28-1.11-2.1\\n        c-0.25-0.82-0.37-1.75-0.37-2.78V7.85H170.85z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill\",\"#1ABC9C\"],[\"static-attr\",\"d\",\"M186.06,25.58V7.85h0.93c0.31,0,0.49,0.15,0.53,0.45l0.16,2.67c0.81-1.02,1.75-1.84,2.82-2.47\\n        c1.08-0.62,2.27-0.94,3.59-0.94c0.97,0,1.83,0.15,2.58,0.46c0.74,0.31,1.36,0.75,1.84,1.34c0.49,0.58,0.86,1.28,1.1,2.1\\n        c0.25,0.82,0.37,1.75,0.37,2.78v11.33h-1.69V14.25c0-1.66-0.38-2.97-1.14-3.91c-0.76-0.94-1.92-1.42-3.49-1.42\\n        c-1.16,0-2.25,0.3-3.24,0.9c-1,0.6-1.89,1.42-2.67,2.47v13.29H186.06z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"g\",[]],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"polygon\",[]],[\"static-attr\",\"fill\",\"#1ABC9C\"],[\"static-attr\",\"points\",\"16.68,9.03 16.68,0.69 8.34,0.69 8.34,9.03 0,9.03 0,17.36 8.34,17.36 8.34,25.7 16.68,25.7\\n        16.68,17.36 25.01,17.36 25.01,9.03 \\t\\t\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/logo-svg.hbs" } });
});
define("hospitalrun/templates/components/medication-allergy", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "+9j0nX51", "block": "{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"showAllergies\"]]],null,5]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"span\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"allergy\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"class\",\"clickable allergy-button\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editAllergy\",[\"get\",[\"allergy\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"unknown\",[\"allergy\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\", \"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"block\",[\"unless\"],[[\"helper\",[\"eq\"],[[\"get\",[\"index\"]],0],null]],null,2],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddAllergy\"]]],null,1,0]],\"locals\":[\"allergy\",\"index\"]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"class\",\"clickable\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"createNewAllergy\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"  \"],[\"append\",[\"helper\",[\"t\"],[\"allergies.buttons.addAllergy\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label wide\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"allergies.labels.patientAllergy\"],null],false],[\"close-element\"],[\"text\",\"\\n\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddAllergy\"]]],null,4],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-data-block allergy-list\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"patient\",\"allergies\"]]],null,3],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/medication-allergy.hbs" } });
});
define("hospitalrun/templates/components/menu-svg", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "ofEee7T6", "block": "{\"statements\":[[\"open-element\",\"svg\",[]],[\"static-attr\",\"version\",\"1.1\"],[\"static-attr\",\"class\",\"icon-nav\"],[\"static-attr\",\"xmlns\",\"http://www.w3.org/2000/svg\",\"http://www.w3.org/2000/xmlns/\"],[\"static-attr\",\"xmlns:xlink\",\"http://www.w3.org/1999/xlink\",\"http://www.w3.org/2000/xmlns/\"],[\"static-attr\",\"x\",\"0px\"],[\"static-attr\",\"y\",\"0px\"],[\"static-attr\",\"width\",\"28px\"],[\"static-attr\",\"height\",\"21px\"],[\"static-attr\",\"viewBox\",\"0 0 28 21\"],[\"static-attr\",\"enable-background\",\"new 0 0 28 21\"],[\"static-attr\",\"xml:space\",\"preserve\",\"http://www.w3.org/XML/1998/namespace\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"path\",[]],[\"static-attr\",\"fill-rule\",\"evenodd\"],[\"static-attr\",\"clip-rule\",\"evenodd\"],[\"static-attr\",\"fill\",\"#FFFFFF\"],[\"static-attr\",\"d\",\"M2.154,16.8h23.692C27.036,16.8,28,17.74,28,18.9\\n  c0,1.16-0.964,2.1-2.154,2.1H2.154C0.964,21,0,20.06,0,18.9C0,17.74,0.964,16.8,2.154,16.8z M2.154,8.4h23.692\\n  C27.036,8.4,28,9.34,28,10.5c0,1.16-0.964,2.1-2.154,2.1H2.154C0.964,12.6,0,11.66,0,10.5C0,9.34,0.964,8.4,2.154,8.4z M2.154,0\\n  h23.692C27.036,0,28,0.94,28,2.1c0,1.16-0.964,2.1-2.154,2.1H2.154C0.964,4.2,0,3.26,0,2.1C0,0.94,0.964,0,2.154,0z\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/menu-svg.hbs" } });
});
define("hospitalrun/templates/components/modal-dialog", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "GO5Dm01H", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"modal fade\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"modal-dialog\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"modal-content\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"modal-header\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"close\"],[\"static-attr\",\"data-dismiss\",\"modal\"],[\"static-attr\",\"aria-hidden\",\"true\"],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"h4\",[]],[\"static-attr\",\"class\",\"modal-title\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"title\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"modal-body\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"yield\",\"default\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"modal-footer\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"unless\"],[[\"get\",[\"hideCancelButton\"]]],null,3],[\"block\",[\"unless\"],[[\"get\",[\"hideUpdateButton\"]]],null,2],[\"block\",[\"each\"],[[\"get\",[\"additionalButtons\"]]],null,1],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[\"default\"],\"blocks\":[{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"span\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[[\"unknown\",[\"button\",\"buttonIcon\"]]]]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"button\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[[\"unknown\",[\"button\",\"class\"]]]]],[\"modifier\",[\"action\"],[[\"get\",[null]],\"fireButtonAction\",[\"get\",[\"button\",\"buttonAction\"]]]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"button\",\"buttonIcon\"]]],null,0],[\"text\",\"              \"],[\"append\",[\"unknown\",[\"button\",\"buttonText\"]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"button\"]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"button\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[\"btn btn-primary on-white \",[\"unknown\",[\"updateButtonClass\"]]]]],[\"dynamic-attr\",\"disabled\",[\"unknown\",[\"isUpdateDisabled\"]],null],[\"modifier\",[\"action\"],[[\"get\",[null]],\"updateAction\"]],[\"flush-element\"],[\"append\",[\"unknown\",[\"updateButtonText\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"cancelAction\"]],[\"flush-element\"],[\"append\",[\"unknown\",[\"cancelBtnText\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/modal-dialog.hbs" } });
});
define("hospitalrun/templates/components/nav-menu", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "vQ24x3h4", "block": "{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"show\"]]],null,8]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"span\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[\"octicon \",[\"unknown\",[\"subnav\",\"iconClass\"]]]]],[\"flush-element\"],[\"close-element\"],[\"append\",[\"unknown\",[\"subnav\",\"localizedTitle\"]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"link-to\"],[[\"get\",[\"subnav\",\"route\"]]],[[\"class\"],[\"category-sub-item nav-link\"]],0]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"span\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[\"octicon \",[\"unknown\",[\"subnav\",\"iconClass\"]]]]],[\"flush-element\"],[\"close-element\"],[\"append\",[\"unknown\",[\"subnav\",\"localizedTitle\"]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"link-to\"],[[\"get\",[\"subnav\",\"route\"]],[\"get\",[\"subnav\",\"subroute\"]]],[[\"class\"],[\"category-sub-item nav-link\"]],2]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"div\",[]],[\"modifier\",[\"action\"],[[\"get\",[null]],\"resetNav\"]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"subnav\",\"subroute\"]]],null,3,1],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"subnav\",\"show\"]]],null,4]],\"locals\":[\"subnav\"]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"category-sub-items\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"nav\",\"subnav\"]]],null,5],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"span\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[\"mega-octicon \",[\"unknown\",[\"nav\",\"iconClass\"]]]]],[\"flush-element\"],[\"close-element\"],[\"append\",[\"unknown\",[\"nav\",\"localizedTitle\"]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"category-title\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"toggleContent\"]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"link-to\"],[[\"get\",[\"nav\",\"route\"]]],[[\"class\"],[\"primary-section-link nav-link\"]],7],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"isShowing\"]]],null,6]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/nav-menu.hbs" } });
});
define("hospitalrun/templates/components/nav-paging", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "oyrFudjG", "block": "{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"paginationProps\",\"showPagination\"]]],null,2]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default on-white\"],[\"dynamic-attr\",\"disabled\",[\"unknown\",[\"paginationProps\",\"disableNextPage\"]],null],[\"modifier\",[\"action\"],[[\"get\",[null]],\"lastPage\"]],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-step-forward\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default on-white\"],[\"dynamic-attr\",\"disabled\",[\"unknown\",[\"paginationProps\",\"disablePreviousPage\"]],null],[\"modifier\",[\"action\"],[[\"get\",[null]],\"firstPage\"]],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-step-backward\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"paginationProps\",\"showFirstPageButton\"]]],null,1],[\"text\",\"  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default on-white\"],[\"dynamic-attr\",\"disabled\",[\"unknown\",[\"paginationProps\",\"disablePreviousPage\"]],null],[\"modifier\",[\"action\"],[[\"get\",[null]],\"previousPage\"]],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-chevron-left\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default on-white\"],[\"dynamic-attr\",\"disabled\",[\"unknown\",[\"paginationProps\",\"disableNextPage\"]],null],[\"modifier\",[\"action\"],[[\"get\",[null]],\"nextPage\"]],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-chevron-right\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"paginationProps\",\"showLastPageButton\"]]],null,0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/nav-paging.hbs" } });
});
define("hospitalrun/templates/components/operative-procedures", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "7qD58/Ke", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\",\"hint\"],[[\"helper\",[\"concat\"],[[\"helper\",[\"if\"],[[\"helper\",[\"not-eq\"],[[\"get\",[\"haveProcedures\"]],true],null],\"required \"],null],\"procedure-description col-sm-10\"],null],\"procedureDescription\",[\"helper\",[\"t\"],[\"components.operativeProcedures.labels.procedure\"],null],[\"get\",[\"procedureList\"]],[\"get\",[\"procedureDescription\"]],false]]],false],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-sm-2\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"text\",\" \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\" form-control-static\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"addProcedure\"]],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"components.operativeProcedures.buttons.addProcedure\"],null],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"haveProcedures\"]]],null,1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"procedure-description\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"procedure\",\"description\"]],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"deleteProcedure\",[\"get\",[\"procedure\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"procedure\"]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"h4\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"components.operativeProcedures.titles.procedures\"],null],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table procedure-listing\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"components.operativeProcedures.labels.procedure\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.action\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"procedures\"]]],null,0],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/operative-procedures.hbs" } });
});
define("hospitalrun/templates/components/patient-diagnosis", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "LnQSMaPi", "block": "{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"showPrimaryDiagnoses\"]]],null,10],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"haveSecondaryDiagnoses\"]]],null,4]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"secondary-diagnosis\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"unknown\",[\"diagnosis\",\"diagnosis\"]],false],[\"text\",\" (\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"diagnosis\",\"date\"]]],null],false],[\"close-element\"],[\"text\",\")\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"class\",\"clickable secondary-diagnosis\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editDiagnosis\",[\"get\",[\"diagnosis\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"unknown\",[\"diagnosis\",\"diagnosis\"]],false],[\"text\",\" (\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"diagnosis\",\"date\"]]],null],false],[\"close-element\"],[\"text\",\")\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\", \"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"block\",[\"unless\"],[[\"helper\",[\"eq\"],[[\"get\",[\"index\"]],0],null]],null,2],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddDiagnosis\"]]],null,1,0]],\"locals\":[\"diagnosis\",\"index\"]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group long-form\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label wide\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"secondaryDiagnosisLabel\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-data-block\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"secondaryDiagnoses\"]]],null,3],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"primary-diagnosis\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"unknown\",[\"diagnosis\",\"diagnosis\"]],false],[\"text\",\" (\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"diagnosis\",\"date\"]]],null],false],[\"close-element\"],[\"text\",\")\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"class\",\"clickable primary-diagnosis\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editDiagnosis\",[\"get\",[\"diagnosis\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"append\",[\"unknown\",[\"diagnosis\",\"diagnosis\"]],false],[\"text\",\" (\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"diagnosis\",\"date\"]]],null],false],[\"close-element\"],[\"text\",\")\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\", \"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"block\",[\"unless\"],[[\"helper\",[\"eq\"],[[\"get\",[\"index\"]],0],null]],null,7],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddDiagnosis\"]]],null,6,5]],\"locals\":[\"diagnosis\",\"index\"]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"class\",\"clickable\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddDiagnosis\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"visits.buttons.addDiagnosis\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group long-form\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label wide\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"primaryDiagnosisLabel\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddDiagnosis\"]]],null,9],[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-data-block\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"primaryDiagnoses\"]]],null,8],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/patient-diagnosis.hbs" } });
});
define("hospitalrun/templates/components/patient-orders", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "dR3b/83I", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel detail-section\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"requestedDate\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],11],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"name\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],10],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\",\"filterBy\",\"filteredBy\",\"filterValues\"],[\"orderType\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]],\"orderType\",[\"get\",[\"filteredBy\"]],[\"get\",[\"orderTypeFilters\"]]]],9],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"status\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],8],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"dateProcessed\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],7],[\"text\",\"        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.result\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.notes\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"sortable-column\"],null,[[\"sortBy\",\"sortDesc\",\"sortKey\"],[\"requestedBy\",[\"get\",[\"sortDesc\"]],[\"get\",[\"sortKey\"]]]],6],[\"text\",\"        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"sortedOrders\"]]],null,5],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddImaging\"]]],null,2],[\"block\",[\"if\"],[[\"get\",[\"canAddLab\"]]],null,1],[\"block\",[\"if\"],[[\"get\",[\"canAddMedication\"]]],null,0],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newMedication\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"components.patientOrders.buttons.newMedication\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newLab\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"components.patientOrders.buttons.newLab\"],null],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newImaging\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"components.patientOrders.buttons.newImaging\"],null],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteOrder\",[\"get\",[\"order\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editOrder\",[\"get\",[\"order\"]]]],[\"flush-element\"],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"tr\",[]],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editOrder\",[\"get\",[\"order\"]]]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"order\",\"requestedDate\"]]],[[\"format\"],[\"l h:mm A\"]]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"order\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"order\",\"orderType\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"order\",\"status\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"order\",\"dateProcessed\"]]],[[\"format\"],[\"l h:mm A\"]]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"order\",\"result\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"order\",\"notes\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"order\",\"requestedBy\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"order\",\"canEdit\"]]],null,4],[\"block\",[\"if\"],[[\"get\",[\"order\",\"canDelete\"]]],null,3],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"order\"]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"t\"],[\"labels.requestedBy\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"t\"],[\"patients.labels.dateProcessed\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"t\"],[\"labels.status\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"t\"],[\"components.patientOrders.labels.orderType\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"t\"],[\"labels.name\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"t\"],[\"labels.dateRequested\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/patient-orders.hbs" } });
});
define("hospitalrun/templates/components/patient-summary", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "wCdiiNDr", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"clearfix\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"linkToPatient\"]],[\"flush-element\"],[\"text\",\"\\n\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group patient-id\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.id\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"ps-info-data\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"patient\",\"displayPatientId\"]],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group patient-name\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.name\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"ps-info-data\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"patient\",\"displayName\"]],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"patient\",\"sex\"]]],null,7],[\"block\",[\"if\"],[[\"get\",[\"patient\",\"dateOfBirth\"]]],null,6],[\"text\",\"\\n  \"],[\"append\",[\"helper\",[\"patient-diagnosis\"],null,[[\"allowAddDiagnosis\",\"diagnosisContainer\",\"diagnosisList\",\"hideInActiveDiagnoses\"],[[\"get\",[\"allowAddDiagnosis\"]],[\"get\",[\"diagnosisContainer\"]],[\"get\",[\"diagnosisList\"]],[\"get\",[\"hideInActiveDiagnoses\"]]]]],false],[\"text\",\"\\n\\n\"],[\"block\",[\"if\"],[[\"get\",[\"haveProcedures\"]]],null,5],[\"text\",\"\\n  \"],[\"append\",[\"helper\",[\"medication-allergy\"],null,[[\"patient\",\"canAddAllergy\"],[[\"get\",[\"patient\"]],[\"get\",[\"canAddAllergy\"]]]]],false],[\"text\",\"\\n\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddOperativePlan\"]]],null,2],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"class\",\"clickable\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editOperativePlan\",[\"get\",[\"currentOperativePlan\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"t\"],[\"patients.buttons.editOperativePlan\"],null],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"class\",\"clickable\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"addOperativePlan\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"t\"],[\"patients.buttons.addOperativePlan\"],null],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group long-form\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label wide\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"patients.labels.operativePlan\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"unless\"],[[\"get\",[\"currentOperativePlan\"]]],null,1],[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-data-block\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"currentOperativePlan\"]]],null,0],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\", \"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"block\",[\"unless\"],[[\"helper\",[\"eq\"],[[\"get\",[\"index\"]],0],null]],null,3],[\"text\",\"\\n          \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"class\",\"clickable patient-procedure\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editProcedure\",[\"get\",[\"procedure\"]]]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"unknown\",[\"procedure\",\"description\"]],false],[\"text\",\" (\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"procedure\",\"procedureDate\"]]],null],false],[\"close-element\"],[\"text\",\")\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"procedure\",\"index\"]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group long-form\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label wide\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.procedures\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-data-block\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"patientProcedures\"]]],null,4],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.age\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"ps-info-data\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"patient\",\"age\"]],false],[\"text\",\" (\"],[\"open-element\",\"strong\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"patient\",\"dateOfBirth\"]]],null],false],[\"close-element\"],[\"text\",\")\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.sex\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"ps-info-data\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"patient\",\"sex\"]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/patient-summary.hbs" } });
});
define("hospitalrun/templates/components/photo-display", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "93j1zXNj", "block": "{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"photo\",\"isImage\"]]],null,0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"img\",[]],[\"dynamic-attr\",\"alt\",[\"concat\",[[\"unknown\",[\"photo\",\"caption\"]]]]],[\"dynamic-attr\",\"src\",[\"concat\",[[\"unknown\",[\"photoUrl\"]]]]],[\"static-attr\",\"class\",\"img-responsive\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/photo-display.hbs" } });
});
define("hospitalrun/templates/components/price-list", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "foQr8r3n", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel detail-section\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"t\"],[\"components.priceList.charges\"],[[\"pricingType\"],[[\"get\",[\"pricingType\"]]]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body detail-section-content\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table table-bordered\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tbody\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"pricingListByType\"]]],null,1],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"              \"],[\"append\",[\"helper\",[\"charge-quantity\"],null,[[\"pricingItem\",\"model\"],[[\"get\",[\"price\"]],[\"get\",[\"model\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[\"price\"]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"pricingList\"]]],null,0],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"pricingList\"]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/price-list.hbs" } });
});
define("hospitalrun/templates/components/quantity-calc", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "DjNF8ryV", "block": "{\"statements\":[[\"block\",[\"each\"],[[\"get\",[\"currentQuantityGroups\"]]],null,1],[\"block\",[\"if\"],[[\"get\",[\"showTotal\"]]],null,0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-xs-6\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"components.quantityCalc.result\"],[[\"targetUnit\",\"calculated\"],[[\"get\",[\"targetUnit\"]],[\"get\",[\"calculated\"]]]]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"append\",[\"helper\",[\"quantity-conv\"],null,[[\"unit\",\"firstQuantity\",\"unitName\",\"index\",\"quantity\",\"unitList\"],[[\"get\",[\"quantityGroup\",\"unit\"]],[\"get\",[\"quantityGroup\",\"firstQuantity\"]],[\"get\",[\"quantityGroup\",\"unitName\"]],[\"get\",[\"quantityGroup\",\"index\"]],[\"get\",[\"quantityGroup\",\"quantity\"]],[\"get\",[\"unitList\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[\"quantityGroup\"]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/quantity-calc.hbs" } });
});
define("hospitalrun/templates/components/quantity-conv", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "4Du5H5x0", "block": "{\"statements\":[[\"block\",[\"unless\"],[[\"get\",[\"firstQuantity\"]]],null,2],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-xs-3\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[\"form-group required \",[\"unknown\",[\"quantityClass\"]],\" test-inv-quantity\"]]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"firstQuantity\"]]],null,1],[\"text\",\"      \"],[\"append\",[\"helper\",[\"input\"],null,[[\"type\",\"value\",\"class\"],[\"text\",[\"get\",[\"quantity\"]],\"form-control\"]]],false],[\"text\",\"\\n      \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"help-block\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"quantityHelp\"]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-xs-3\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[\"form-group required \",[\"unknown\",[\"unitClass\"]]]]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"firstQuantity\"]]],null,0],[\"text\",\"      \"],[\"append\",[\"helper\",[\"select-list\"],null,[[\"class\",\"content\",\"value\",\"action\",\"prompt\"],[\"form-control test-inv-unit\",[\"get\",[\"unitList\"]],[\"get\",[\"unit\"]],[\"helper\",[\"action\"],[[\"get\",[null]],[\"helper\",[\"mut\"],[[\"get\",[\"unit\"]]],null]],null],\" \"]]],false],[\"text\",\"\\n      \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"help-block\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"unitHelp\"]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"components.quantityConv.unit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.quantity\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-xs-5\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[\"form-group required \",[\"unknown\",[\"quantityClass\"]]]]],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"components.quantityConv.conversion\"],[[\"name\"],[[\"get\",[\"unitName\"]]]]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/quantity-conv.hbs" } });
});
define("hospitalrun/templates/components/render-typeahead", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "rhjRhMHS", "block": "{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"usePricingTypeAhead\"]]],null,1,0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"append\",[\"helper\",[\"type-ahead\"],null,[[\"class\",\"property\",\"label\",\"content\",\"selection\",\"setOnBlur\",\"hint\"],[[\"get\",[\"className\"]],[\"get\",[\"property\"]],[\"get\",[\"label\"]],[\"get\",[\"content\"]],[\"get\",[\"selection\"]],[\"get\",[\"setOnBlur\"]],[\"get\",[\"hint\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"append\",[\"helper\",[\"pricing-typeahead\"],null,[[\"class\",\"property\",\"label\",\"content\",\"selection\"],[[\"get\",[\"className\"]],[\"get\",[\"property\"]],[\"get\",[\"label\"]],[\"get\",[\"content\"]],[\"get\",[\"selection\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/render-typeahead.hbs" } });
});
define("hospitalrun/templates/components/role-select", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "YVGu01Yp", "block": "{\"statements\":[[\"open-element\",\"select\",[]],[\"static-attr\",\"class\",\"form-control\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"change\"],[[\"on\"],[\"change\"]]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"prompt\"]]],null,1],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"content\"]]],[[\"key\"],[\"@identity\"]],0],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"option\",[]],[\"dynamic-attr\",\"value\",[\"concat\",[[\"helper\",[\"read-path\"],[[\"get\",[\"item\"]],[\"get\",[\"optionLabelPath\"]]],null]]]],[\"dynamic-attr\",\"selected\",[\"helper\",[\"is-equal-array\"],[[\"get\",[\"item\",\"roles\"]],[\"get\",[\"selection\"]]],null],null],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"read-path\"],[[\"get\",[\"item\"]],[\"get\",[\"optionLabelPath\"]]],null],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"item\"]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"option\",[]],[\"static-attr\",\"disabled\",\"\"],[\"dynamic-attr\",\"selected\",[\"helper\",[\"is-not\"],[[\"get\",[\"selection\"]]],null],null],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"unknown\",[\"prompt\"]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/role-select.hbs" } });
});
define("hospitalrun/templates/components/search-listing", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "Q02KlFkD", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-primary\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"yield\",\"default\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary on-white\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"allItems\"]],[\"flush-element\"],[\"append\",[\"unknown\",[\"allButtonText\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[\"default\"],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/search-listing.hbs" } });
});
define("hospitalrun/templates/components/select-list", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "qmwW7YZp", "block": "{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"prompt\"]]],null,1],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"content\"]]],[[\"key\"],[\"@identity\"]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"option\",[]],[\"dynamic-attr\",\"value\",[\"concat\",[[\"helper\",[\"read-path\"],[[\"get\",[\"item\"]],[\"get\",[\"optionValuePath\"]]],null]]]],[\"dynamic-attr\",\"selected\",[\"helper\",[\"is-equal-by-path\"],[[\"get\",[\"item\"]],[\"get\",[\"value\"]],[\"get\",[\"optionValuePath\"]]],null],null],[\"flush-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"read-path\"],[[\"get\",[\"item\"]],[\"get\",[\"optionLabelPath\"]]],null],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"item\"]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"option\",[]],[\"static-attr\",\"value\",\"\"],[\"static-attr\",\"disabled\",\"\"],[\"dynamic-attr\",\"selected\",[\"helper\",[\"is-not\"],[[\"get\",[\"selection\"]]],null],null],[\"flush-element\"],[\"text\",\"\\n    \"],[\"append\",[\"unknown\",[\"prompt\"]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/select-list.hbs" } });
});
define("hospitalrun/templates/components/select-or-typeahead", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "NuoGi2qP", "block": "{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"userCanAdd\"]]],null,1,0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\",\"optionValuePath\",\"optionLabelPath\",\"selected\",\"prompt\"],[[\"helper\",[\"concat\"],[\"form-input-group \",[\"get\",[\"className\"]]],null],[\"get\",[\"label\"]],[\"get\",[\"property\"]],[\"get\",[\"content\"]],[\"get\",[\"optionValuePath\"]],[\"get\",[\"optionLabelPath\"]],[\"get\",[\"selection\"]],[\"get\",[\"prompt\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"partial\",\"components/render-typeahead\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/templates/components/select-or-typeahead.hbs" } });
});
define("hospitalrun/templates/components/sortable-column", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "fNoFyFLx", "block": "{\"statements\":[[\"open-element\",\"span\",[]],[\"modifier\",[\"action\"],[[\"get\",[null]],\"sort\"]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"sorted\"]]],null,6,5],[\"text\",\"  \"],[\"yield\",\"default\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"filterBy\"]]],null,4]],\"locals\":[],\"named\":[],\"yields\":[\"default\"],\"blocks\":[{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"li\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"unknown\",[\"date-filter\"]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"li\",[]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"a\",[]],[\"modifier\",[\"action\"],[[\"get\",[null]],\"filter\",[\"get\",[\"filterValue\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"get\",[\"filterValue\"]],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"filterValue\"]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"li\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"a\",[]],[\"modifier\",[\"action\"],[[\"get\",[null]],\"filter\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"t\"],[\"components.sortableColumn.labels.selectAll\"],null],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"filterValues\"]]],null,1]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"li\",[]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"typeahead-filter\"],null,[[\"content\"],[[\"get\",[\"filterValues\"]]]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"dropdown\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[\"glyphicon glyphicon-filter dropdown-toggle \",[\"helper\",[\"if\"],[[\"get\",[\"filtered\"]],\"\",\"inactive neutral\"],null]]]],[\"static-attr\",\"data-toggle\",\"dropdown\"],[\"static-attr\",\"role\",\"button\"],[\"static-attr\",\"aria-haspopup\",\"true\"],[\"static-attr\",\"aria-expanded\",\"false\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"ul\",[]],[\"static-attr\",\"class\",\"dropdown-menu\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[[\"get\",[\"filterType\"]],\"typeahead\"],null]],null,3],[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[\"list\",[\"get\",[\"filterType\"]]],null]],null,2],[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[[\"get\",[\"filterType\"]],\"date\"],null]],null,0],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-triangle-down inactive\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"span\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[\"octicon \",[\"helper\",[\"if\"],[[\"get\",[\"sortDesc\"]],\"octicon-triangle-down\",\"octicon-triangle-up\"],null]]]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/sortable-column.hbs" } });
});
define("hospitalrun/templates/components/static-text", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "Zt5EQlAz", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"dynamic-attr\",\"class\",[\"concat\",[\"form-group \",[\"unknown\",[\"class\"]]]]],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"label\"]],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"value\"]]],null,1,0],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[\"default\"],\"blocks\":[{\"statements\":[[\"text\",\"      \"],[\"yield\",\"default\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"append\",[\"unknown\",[\"value\"]],false],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/static-text.hbs" } });
});
define("hospitalrun/templates/components/take-photo", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "6Tbo4NY+", "block": "{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"canCaptureVideo\"]]],null,2],[\"block\",[\"if\"],[[\"get\",[\"showFileUpload\"]]],null,0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"append\",[\"helper\",[\"image-upload\"],null,[[\"label\",\"property\",\"selectedFile\",\"isImage\"],[[\"helper\",[\"t\"],[\"components.takePhoto.uploadFile\"],null],\"fileName\",[\"get\",[\"photoFile\"]],[\"get\",[\"isImage\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"static-attr\",\"for\",\"camera\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"components.takePhoto.camera\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"select-list\"],null,[[\"action\",\"class\",\"content\",\"id\",\"label\",\"optionLabelPath\",\"optionValuePath\",\"value\"],[[\"helper\",[\"action\"],[[\"get\",[null]],\"cameraChange\"],null],\"form-control\",[\"get\",[\"videoSources\"]],\"camera\",[\"helper\",[\"t\"],[\"components.takePhoto.camera\"],null],\"label\",\"id\",[\"get\",[\"selectedCamera\"]]]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"static-attr\",\"for\",\"photo-source\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"sourceChooserLabel\"]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"select-list\"],null,[[\"action\",\"class\",\"content\",\"id\",\"optionLabelPath\",\"optionValuePath\",\"value\"],[[\"helper\",[\"action\"],[[\"get\",[null]],\"photoSourceChange\"],null],\"form-control\",[\"get\",[\"photoSources\"]],\"photo-source\",\"label\",\"value\",[\"get\",[\"photoSource\"]]]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showCameraSelect\"]]],null,1],[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"camera panel panel-success\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-sm-4\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"h2\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"components.takePhoto.preview\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"video\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-sm-2\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"col-sm-4\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"h2\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"components.takePhoto.photo\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"canvas\",[]],[\"static-attr\",\"id\",\"canvas\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"takePhoto\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"components.takePhoto.takePhoto\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/take-photo.hbs" } });
});
define("hospitalrun/templates/components/typeahead-filter", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "CrTUQFvE", "block": "{\"statements\":[[\"open-element\",\"input\",[]],[\"static-attr\",\"type\",\"text\"],[\"static-attr\",\"class\",\"form-control\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"input-group-btn\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"static-attr\",\"type\",\"button\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"clearFilter\"]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/typeahead-filter.hbs" } });
});
define("hospitalrun/templates/components/upcoming-appointments", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "8FzSthKe", "block": "{\"statements\":[[\"open-element\",\"h4\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"components.upcomingAppointments.titles.upcomingAppointments\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"components.upcomingAppointments.labels.date\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"components.upcomingAppointments.labels.with\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"components.upcomingAppointments.labels.location\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"components.upcomingAppointments.labels.type\"],null],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"appointments\"]]],null,0],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"appointment\",\"formattedAppointmentDate\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"appointment\",\"provider\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"appointment\",\"location\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"appointment\",\"appointmentType\"]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"appointment\"]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/components/upcoming-appointments.hbs" } });
});
define("hospitalrun/templates/empty", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "h00Hzqio", "block": "{\"statements\":[],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/empty.hbs" } });
});
define("hospitalrun/templates/error", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "I5e40x0v", "block": "{\"statements\":[[\"open-element\",\"section\",[]],[\"static-attr\",\"class\",\"view error\"],[\"flush-element\"],[\"text\",\"\\n\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"view-top-bar\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"h1\",[]],[\"static-attr\",\"class\",\"view-current-title\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"messages.sorry\"],null],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-info\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"append\",[\"unknown\",[\"message\"]],false],[\"text\",\"\\n    \"],[\"open-element\",\"pre\",[]],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"unknown\",[\"stack\"]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/error.hbs" } });
});
define("hospitalrun/templates/index", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "lNWMN3lo", "block": "{\"statements\":[[\"open-element\",\"section\",[]],[\"static-attr\",\"class\",\"view index\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"view-top-bar\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"h1\",[]],[\"static-attr\",\"class\",\"view-current-title\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"dashboard.title\"],null],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"standAlone\"]]],null,1],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"dashboard.needs_user_setup\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-primary align-left\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newUser\"]],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.newUser\"],null],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"t\"],[\"dashboard.standalone_welcome\"],null],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"needsUserSetup\"]]],null,0],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/index.hbs" } });
});
define("hospitalrun/templates/inv-purchase", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "Lh4olg2h", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\"],[\"dateReceived\",[\"helper\",[\"t\"],[\"inventory.labels.dateReceived\"],null],\"col-sm-4\"]]],false],[\"text\",\"\\n  \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"invoiceNo\",[\"helper\",[\"t\"],[\"inventory.labels.invoiceNumber\"],null],\"col-sm-4\"]]],false],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canEditQuantity\"]]],null,2,1],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"property\",\"label\",\"class\"],[\"purchaseCost\",[\"helper\",[\"t\"],[\"inventory.labels.purchaseCost\"],null],\"required col-sm-4 test-inv-cost\"]]],false],[\"text\",\"\\n  \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"lotNumber\",[\"helper\",[\"t\"],[\"inventory.labels.serialNumber\"],null],\"col-sm-4\"]]],false],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"minDate\",\"class\"],[\"expirationDate\",[\"helper\",[\"t\"],[\"inventory.labels.expirationDate\"],null],\"now\",\"col-sm-4\"]]],false],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\",\"className\"],[\"vendor\",[\"helper\",[\"t\"],[\"inventory.labels.vendor\"],null],[\"get\",[\"vendorList\"]],[\"get\",[\"model\",\"vendor\"]],\"col-sm-6 required test-vendor\"]]],false],[\"text\",\"\\n  \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"vendorItemNo\",[\"helper\",[\"t\"],[\"inventory.labels.vendorItemNumber\"],null],\"col-sm-6\"]]],false],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"model\",\"isNew\"]]],null,0],[\"append\",[\"helper\",[\"em-checkbox\"],null,[[\"label\",\"property\"],[[\"helper\",[\"t\"],[\"inventory.labels.gift\"],null],\"giftInKind\"]]],false],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\"],[\"location\",[\"helper\",[\"t\"],[\"inventory.labels.location\"],null],[\"get\",[\"warehouseList\"]],[\"get\",[\"model\",\"location\"]]]]],false],[\"text\",\"\\n  \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"property\",\"label\",\"list\",\"selection\"],[\"aisleLocation\",[\"helper\",[\"t\"],[\"inventory.labels.aisleLocation\"],null],[\"get\",[\"aisleLocationList\"]],[\"get\",[\"model\",\"aisleLocation\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.quantity\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"input\"],null,[[\"class\",\"value\",\"type\",\"disabled\"],[\"form-control\",[\"get\",[\"model\",\"originalQuantity\"]],\"text\",true]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"append\",[\"helper\",[\"quantity-calc\"],null,[[\"calculated\",\"targetUnit\",\"quantityGroups\",\"unitList\"],[[\"get\",[\"model\",\"originalQuantity\"]],[\"get\",[\"model\",\"distributionUnit\"]],[\"get\",[\"model\",\"quantityGroups\"]],[\"get\",[\"unitList\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/inv-purchase.hbs" } });
});
define("hospitalrun/templates/inventory-basic", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "cxYSLr+l", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"unless\"],[[\"get\",[\"model\",\"isNew\"]]],null,1],[\"text\",\"  \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"name\",[\"helper\",[\"t\"],[\"labels.name\"],null],\"required  col-sm-6 test-inv-name\"]]],false],[\"text\",\"\\n  \"],[\"append\",[\"helper\",[\"inventory/rank-select\"],null,[[\"property\"],[\"rank\"]]],false],[\"text\",\"\\n\"],[\"block\",[\"unless\"],[[\"get\",[\"model\",\"isNew\"]]],null,0],[\"close-element\"],[\"text\",\"\\n\\n\"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"label\",\"property\",\"rows\"],[[\"helper\",[\"t\"],[\"labels.description\"],null],\"description\",1]]],false],[\"text\",\"\\n\"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"label\",\"property\",\"content\",\"class\",\"prompt\"],[[\"helper\",[\"t\"],[\"labels.type\"],null],\"inventoryType\",[\"get\",[\"inventoryTypes\"]],\"required col-sm-4 test-inv-type\",\" \"]]],false],[\"text\",\"\\n  \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"crossReference\",[\"helper\",[\"t\"],[\"inventory.labels.crossReference\"],null],\"col-sm-8 test-inv-cross\"]]],false],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"reorderPoint\",[\"helper\",[\"t\"],[\"inventory.labels.reorderPoint\"],null],\"col-sm-3 test-inv-reorder\"]]],false],[\"text\",\"\\n  \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"property\",\"label\",\"class\"],[\"price\",[\"helper\",[\"t\"],[\"inventory.labels.salePricePerUnit\"],null],\"col-sm-3 test-inv-price\"]]],false],[\"text\",\"\\n  \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"label\",\"class\",\"property\",\"content\",\"prompt\"],[[\"helper\",[\"t\"],[\"inventory.labels.distributionUnit\"],null],\"col-sm-3 required test-inv-dist-unit\",\"distributionUnit\",[\"get\",[\"unitListForSelect\"]],\" \"]]],false],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-sm-2\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.quantity\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"quantity\"]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-sm-2\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.id\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"input\"],null,[[\"class\",\"value\",\"type\",\"disabled\"],[\"form-control test-item-id\",[\"get\",[\"model\",\"friendlyId\"]],\"text\",true]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/inventory-basic.hbs" } });
});
define("hospitalrun/templates/item-charges", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "z4tJwpGD", "block": "{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"organizeByType\"]]],null,8,7]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddCharge\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.addItem\"],null],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddCharge\"]]],null,0],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showEditCharge\",[\"get\",[\"charge\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteCharge\",[\"get\",[\"charge\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"charge\",\"dateCharged\"]]],null],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"charge-item-name\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"charge\",\"pricingItem\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"charge\",\"quantity\"]],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddCharge\"]]],null,2],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"unless\"],[[\"get\",[\"charge\",\"medicationCharge\"]]],null,3]],\"locals\":[\"charge\"]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddCharge\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.addItem\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"t\"],[\"headings.chargedItems\"],null],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddCharge\"]]],null,5],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel detail-section\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"unless\"],[[\"get\",[\"hideChargeHeader\"]]],null,6],[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table charge-items\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.date\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"inventory.labels.item\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.quantity\"],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.action\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"charges\"]]],null,4],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"hideChargeHeader\"]]],null,1],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"partial\",\"charges-by-type\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/templates/item-charges.hbs" } });
});
define("hospitalrun/templates/loading", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "xB/noGTW", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"loading-notice\"],[\"static-attr\",\"role\",\"alert\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"wrapper\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"spinner\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"rect1\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"rect2\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"rect3\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"rect4\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"rect5\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"loading-text\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.loading\"],null],false],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/loading.hbs" } });
});
define("hospitalrun/templates/login", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "DjXQk8E0", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"container\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"form\",[]],[\"static-attr\",\"class\",\"form-signin\"],[\"static-attr\",\"role\",\"form\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"authenticate\"],[[\"on\"],[\"submit\"]]],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"signin-logo\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"partial\",\"components/logo-dark-svg\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"signin-contents\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"h2\",[]],[\"static-attr\",\"class\",\"form-signin-heading\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"login.messages.signIn\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"errorMessage\"]]],null,1],[\"block\",[\"if\"],[[\"get\",[\"offlineError\"]]],null,0],[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"input\"],null,[[\"id\",\"value\",\"placeholder\",\"class\"],[\"identification\",[\"get\",[\"identification\"]],[\"helper\",[\"t\"],[\"login.labels.username\"],null],\"form-control\"]]],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"append\",[\"helper\",[\"input\"],null,[[\"id\",\"type\",\"value\",\"placeholder\",\"class\"],[\"password\",\"password\",[\"get\",[\"password\"]],[\"helper\",[\"t\"],[\"login.labels.password\"],null],\"form-control\"]]],false],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\\n      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-lg btn-primary btn-block\"],[\"static-attr\",\"type\",\"submit\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"login.labels.signIn\"],null],false],[\"close-element\"],[\"text\",\"\\n\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\" \"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger form-signin-alert\"],[\"static-attr\",\"role\",\"alert\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"login.messages.offlineError\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger form-signin-alert\"],[\"static-attr\",\"role\",\"alert\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"login.messages.error\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/templates/login.hbs" } });
});
define("hospitalrun/templates/navigation", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "M9yrhQIh", "block": "{\"statements\":[[\"open-element\",\"nav\",[]],[\"static-attr\",\"class\",\"view sidebar-nav hidden-print\"],[\"static-attr\",\"role\",\"navigation\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"partial\",\"sidebar_nav/header\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"scroll-container\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"partial\",\"sidebar_nav/search\"],[\"text\",\"\\n    \"],[\"partial\",\"sidebar_nav/primary_nav\"],[\"text\",\"\\n    \"],[\"partial\",\"sidebar_nav/message\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/templates/navigation.hbs" } });
});
define("hospitalrun/templates/report-rows", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "QK/f4nmM", "block": "{\"statements\":[[\"block\",[\"each\"],[[\"get\",[\"currentReportRows\"]]],null,4]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"array-display\"],null,[[\"content\"],[[\"get\",[\"column\"]]]]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"column\"]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"reportRow\"]]],null,0],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"array-display\"],null,[[\"content\"],[[\"get\",[\"column\"]]]]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"column\"]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"tr\",[]],[\"modifier\",[\"action\"],[[\"get\",[null]],[\"get\",[\"reportRow\",\"rowAction\",\"action\"]],[\"get\",[\"reportRow\",\"rowAction\",\"model\"]]]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"reportRow\",\"row\"]]],null,2],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"reportRow\",\"rowAction\"]]],null,3,1]],\"locals\":[\"reportRow\"]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/report-rows.hbs" } });
});
define("hospitalrun/templates/section", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "uvXN5JWC", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel panel-default\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading clearfix\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"view-top-bar\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"h1\",[]],[\"static-attr\",\"class\",\"view-current-title\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"currentScreenTitle\"]],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"view-action-buttons\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"newButtonAction\"]]],null,10],[\"block\",[\"if\"],[[\"get\",[\"additionalButtons\"]]],null,9],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"view-sub-bar\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"ul\",[]],[\"static-attr\",\"class\",\"nav nav-pills view-sub-nav\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"subActions\"]]],null,6],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"append\",[\"unknown\",[\"outlet\"]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"append\",[\"unknown\",[\"subAction\",\"text\"]],false]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"block\",[\"link-to\"],[[\"get\",[\"subAction\",\"linkTo\"]]],null,0],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"active-link\"],null,null,1]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"append\",[\"unknown\",[\"subAction\",\"text\"]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"link-to\"],[[\"get\",[\"subAction\",\"linkTo\"]],[\"helper\",[\"query-params\"],null,[[\"status\"],[[\"get\",[\"subAction\",\"statusQuery\"]]]]]],null,3]],\"locals\":[]},{\"statements\":[[\"block\",[\"active-link\"],null,null,4]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"subAction\",\"statusQuery\"]]],null,5,2]],\"locals\":[\"subAction\"]},{\"statements\":[[\"open-element\",\"span\",[]],[\"dynamic-attr\",\"class\",[\"unknown\",[\"button\",\"buttonIcon\"]],null],[\"flush-element\"],[\"close-element\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"button\",[]],[\"dynamic-attr\",\"class\",[\"unknown\",[\"button\",\"class\"]],null],[\"modifier\",[\"action\"],[[\"get\",[null]],[\"get\",[\"button\",\"buttonAction\"]]]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"block\",[\"if\"],[[\"get\",[\"buttonIcon\"]]],null,7],[\"text\",\"\\n              \"],[\"append\",[\"unknown\",[\"button\",\"buttonText\"]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"button\"]},{\"statements\":[[\"block\",[\"each\"],[[\"get\",[\"additionalButtons\"]]],null,8]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],[\"get\",[\"newButtonAction\"]]]],[\"flush-element\"],[\"append\",[\"unknown\",[\"newButtonText\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/section.hbs" } });
});
define("hospitalrun/templates/sidebar_nav/header", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "LZNX8nF+", "block": "{\"statements\":[[\"open-element\",\"header\",[]],[\"static-attr\",\"class\",\"sidebar-nav-header\"],[\"flush-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"class\",\"sidebar-nav-logo\"],[\"static-attr\",\"href\",\"#\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"partial\",\"components/logo-svg\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#\"],[\"dynamic-attr\",\"class\",[\"concat\",[\"settings-trigger \",[\"helper\",[\"if\"],[[\"get\",[\"isShowingSettings\"]],\"active\"],null]]]],[\"modifier\",[\"action\"],[[\"get\",[null]],\"toggleSettings\"]],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"mega-octicon octicon-gear\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\\n\"],[\"block\",[\"if\"],[[\"get\",[\"isShowingSettings\"]]],null,3],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"append\",[\"helper\",[\"t\"],[\"navigation.actions.login\"],null],false]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"block\",[\"link-to\"],[\"login\"],null,0],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#\"],[\"static-attr\",\"class\",\"logout\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"invalidateSession\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"navigation.actions.logout\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"nav\",[]],[\"static-attr\",\"class\",\"settings-nav\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"session\",\"isAuthenticated\"]]],null,2,1],[\"text\",\"      \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"about\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"navigation.about\"],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/templates/sidebar_nav/header.hbs" } });
});
define("hospitalrun/templates/sidebar_nav/message", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "rGEdjBSz", "block": "{\"statements\":[[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"sync-status\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"syncStatus\"]],false],[\"close-element\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/sidebar_nav/message.hbs" } });
});
define("hospitalrun/templates/sidebar_nav/primary_nav", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "A/YEQ6Sd", "block": "{\"statements\":[[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"primary-nav\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"localizedNavItems\"]]],null,0],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"append\",[\"helper\",[\"nav-menu\"],null,[[\"nav\",\"session\"],[[\"get\",[\"nav\"]],[\"get\",[\"session\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[\"nav\"]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/sidebar_nav/primary_nav.hbs" } });
});
define("hospitalrun/templates/sidebar_nav/search", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "rmEAw+D+", "block": "{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"allowSearch\"]]],null,0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"sidebar-nav-search sidebar-nav-section\"],[\"static-attr\",\"role\",\"search\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"text-search\"],null,[[\"value\",\"placeholder\",\"class\"],[[\"get\",[\"searchText\"]],[\"helper\",[\"t\"],[\"labels.search\"],null],\"form-control\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-default\"],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-search\"],[\"flush-element\"],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/templates/sidebar_nav/search.hbs" } });
});
define('hospitalrun/tests/fixtures/admin', ['exports'], function (exports) {
  exports['default'] = '{"version":"1.2.5","db_type":"http","start_time":"2017-03-16T14:26:11.883Z","db_info":{"db_name":"main","doc_count":35,"doc_del_count":0,"update_seq":62,"purge_seq":0,"compact_running":false,"disk_size":94312,"data_size":28825,"instance_start_time":"1489673660482960","disk_format_version":6,"committed_update_seq":62,"host":"http://localhost:5984/main/","auto_compaction":false,"adapter":"http"}}\n{"docs":[{"_id":"_design/custom_form_by_type","_rev":"1-ddf0ee75c1e8e859d821a9f5c1ec43b6","version":1,"views":{"custom_form_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'customForm\') {\\n        emit(doc.data.formType);\\n      }\\n    }\\n  }"}}}]}\n{"seq":4}\n{"docs":[{"_id":"_design/inventory_by_friendly_id","_rev":"1-82e24378f074a284cae14da4db5431ed","version":1,"views":{"inventory_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}}]}\n{"seq":6}\n{"docs":[{"_id":"_design/appointments_by_date","_rev":"2-1c77e85fa63d80716da7ac836c981daa","_deleted":true,"_revisions":{"start":2,"ids":["1c77e85fa63d80716da7ac836c981daa","5df29f1d7dbd39d6b3a2145923ab73cf"]}},{"_id":"_design/appointments_by_date","_rev":"2-28b4bff0597e8254f67140d44550b806","_deleted":true,"_revisions":{"start":2,"ids":["28b4bff0597e8254f67140d44550b806","178add045be11a7fd6aa7fdf97c8f3f0"]}},{"_id":"_design/appointments_by_date","_rev":"2-1fc384eae57485ff9100c0614780ab62","_deleted":true,"_revisions":{"start":2,"ids":["1fc384eae57485ff9100c0614780ab62","03951858f9232df2e774548b0f5fd068"]}},{"_id":"_design/appointments_by_date","_rev":"3-461875fa3e8aa582009473a4ebccf3bb","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":3,"ids":["461875fa3e8aa582009473a4ebccf3bb","2e78ab0f6da3881df4871d0b028148b9","4c8dd95ad6d36b9b4d86136d5e417f5c"]}},{"_id":"_design/appointments_by_patient","_rev":"2-f03ac9b51ff8ff5d0ac0c2dcbf275311","_deleted":true,"_revisions":{"start":2,"ids":["f03ac9b51ff8ff5d0ac0c2dcbf275311","9a97acd5b8fd071ad81afc9e730721c5"]}},{"_id":"_design/appointments_by_patient","_rev":"2-a8bb26daf0329c069a18ec0ce64532cb","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate,doc._id]);}}}"}},"_revisions":{"start":2,"ids":["a8bb26daf0329c069a18ec0ce64532cb","9868b6586898a48c3fd68722ca3fe1d4"]}},{"_id":"_design/appointments_by_patient","_rev":"2-3f36f32ad4537056da92d236724bcbe9","_deleted":true,"_revisions":{"start":2,"ids":["3f36f32ad4537056da92d236724bcbe9","7232d3292344540b2511e709422e2cbf"]}},{"_id":"_design/closed_incidents_by_user","_rev":"1-bf16176c13be57af9a4f1a0980710190","version":1,"views":{"closed_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status === \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["bf16176c13be57af9a4f1a0980710190"]}},{"_id":"_design/closed_incidents_by_user","_rev":"2-43dbd6661048f122110a7bbd4d2af45e","_deleted":true,"_revisions":{"start":2,"ids":["43dbd6661048f122110a7bbd4d2af45e","5250950488663a397583dfe34240c4f3"]}},{"_id":"_design/imaging_by_status","_rev":"2-57660077d48a8a4a0c1a3dd6ae214aac","version":4,"views":{"imaging_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"imaging\\") {var imagingDate = doc.data.imagingDate;if (imagingDate && imagingDate !== \\"\\") {imagingDate = new Date(imagingDate);if (imagingDate.getTime) {imagingDate = imagingDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, imagingDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["57660077d48a8a4a0c1a3dd6ae214aac","9236042e1fb9f567d1d527bbb429cd8e"]}},{"_id":"_design/imaging_by_status","_rev":"2-416ed7687768844c4164283d01161e16","_deleted":true,"_revisions":{"start":2,"ids":["416ed7687768844c4164283d01161e16","2feb5103c3f6d149bf98f0adeaa76b38"]}},{"_id":"_design/imaging_by_status","_rev":"2-c13cdf46b0ada4601e71c65353dae3df","_deleted":true,"_revisions":{"start":2,"ids":["c13cdf46b0ada4601e71c65353dae3df","1a3bab3d2d1403299a9e4ad8dffe5fa1"]}},{"_id":"_design/incident_by_date","_rev":"2-75cfce2f961c68be72b9ce8b0b44f49e","version":1,"views":{"incident_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        var dateOfIncident = doc.data.dateOfIncident;\\n    if (dateOfIncident && dateOfIncident !== \\"\\") {\\n      dateOfIncident = new Date(dateOfIncident);\\n      if (dateOfIncident.getTime) {\\n        dateOfIncident = dateOfIncident.getTime();\\n      }\\n    }\\n    emit([dateOfIncident, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":2,"ids":["75cfce2f961c68be72b9ce8b0b44f49e","c7499a4c007e736e1da794397ae627ac"]}},{"_id":"_design/incident_by_date","_rev":"2-8384943355d3e24c14622b00c86a0985","_deleted":true,"_revisions":{"start":2,"ids":["8384943355d3e24c14622b00c86a0985","59fa59734ee129cff0560b20a95d2d4e"]}},{"_id":"_design/incident_by_friendly_id","_rev":"1-885a12b67da47e956bc190fe1fe0d4e6","version":1,"views":{"incident_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/incident_by_reviewers","_rev":"1-8ef52cda8ddd504acf6c76752ed6da03","version":2,"views":{"incident_by_reviewers":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incReviewer\') {\\n        var inc = doc.data.incident;if (inc) { emit([doc.data.reviewerEmail, doc._id], { _id: doc.data.incident });}\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_by_name","_rev":"2-6993fbc5ef18283f83c6afe5be9a9351","version":5,"views":{"inventory_by_name":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.name, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["6993fbc5ef18283f83c6afe5be9a9351","c12e4467c9c3ecc8021b660934257f25"]}},{"_id":"_design/inventory_by_name","_rev":"2-434f4cb5ef0baef4dddaf2c1914d2f0e","_deleted":true,"_revisions":{"start":2,"ids":["434f4cb5ef0baef4dddaf2c1914d2f0e","91f55ae6bd30f766d9da95bffe054bcb"]}},{"_id":"_design/inventory_by_name","_rev":"2-6970ab89b44af8c2703a89d6dea9b20b","_deleted":true,"_revisions":{"start":2,"ids":["6970ab89b44af8c2703a89d6dea9b20b","304304d63beaffd8d1ae4ae1cddf4b2b"]}},{"_id":"_design/inventory_by_type","_rev":"1-65423cfcd4b0acd93b58aa2003907c92","version":5,"views":{"inventory_by_type":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit(doc.data.inventoryType);}}}"}},"_revisions":{"start":1,"ids":["65423cfcd4b0acd93b58aa2003907c92"]}},{"_id":"_design/inventory_by_type","_rev":"2-2f0df4e3dc8ba6d384f896efd4a272cf","_deleted":true,"_revisions":{"start":2,"ids":["2f0df4e3dc8ba6d384f896efd4a272cf","003ef699ab0f2b8628c0bf613fabf7a2"]}},{"_id":"_design/inventory_by_type","_rev":"2-a5cd4eb9d62940627bd99b9e73cd7b15","_deleted":true,"_revisions":{"start":2,"ids":["a5cd4eb9d62940627bd99b9e73cd7b15","18455500e1e86544edceaab01bb511bc"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-823be94576112c800022b256ccd9b725","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var dateReceived = doc.data.dateReceived;if (dateReceived && dateReceived !== \\"\\") {dateReceived = new Date(dateReceived);if (dateReceived.getTime) {dateReceived = dateReceived.getTime();}}emit([dateReceived, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["823be94576112c800022b256ccd9b725"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"2-65f020065c11403193b02742a05b91ae","_deleted":true,"_revisions":{"start":2,"ids":["65f020065c11403193b02742a05b91ae","78939ec45bef330bbfa87763dbbfce37"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"2-392c104e0d9eac6f20948f0d97dd192d","_deleted":true,"_revisions":{"start":2,"ids":["392c104e0d9eac6f20948f0d97dd192d","0d7b597aeae746589980b12903768252"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-7aea58304996ccb168865141592a024f","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var expirationDate = doc.data.expirationDate;if (expirationDate && expirationDate !== \\"\\") {expirationDate = new Date(expirationDate);if (expirationDate.getTime) {expirationDate = expirationDate.getTime();}}emit([expirationDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7aea58304996ccb168865141592a024f"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"2-9da617bbfd6e7355864c21be36c690c4","_deleted":true,"_revisions":{"start":2,"ids":["9da617bbfd6e7355864c21be36c690c4","1f41dd6d030c58884d7013ef9436decb"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"2-d900cddd5fcc673d77fbd2f6d783475d","_deleted":true,"_revisions":{"start":2,"ids":["d900cddd5fcc673d77fbd2f6d783475d","17bd9d3619ae03155d9929d3ebcd5023"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-e9eb2d7f1e35296646399c7414525c33","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);}}}"}},"_revisions":{"start":1,"ids":["e9eb2d7f1e35296646399c7414525c33"]}},{"_id":"_design/inventory_request_by_item","_rev":"2-c2f0efb7a0a9b3ece1cf9b7b0e88d37f","_deleted":true,"_revisions":{"start":2,"ids":["c2f0efb7a0a9b3ece1cf9b7b0e88d37f","7e7ef275a9fc15f2b5f328b1479c6097"]}},{"_id":"_design/inventory_request_by_item","_rev":"2-81a90ac8fc850741d7f64b4fbd9df7e0","_deleted":true,"_revisions":{"start":2,"ids":["81a90ac8fc850741d7f64b4fbd9df7e0","021f4c24b5b6202594f610cf5d4c63a4"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-f4a7252ebf2802c53a572bf150eae05c","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.status, dateCompleted, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["f4a7252ebf2802c53a572bf150eae05c"]}},{"_id":"_design/inventory_request_by_status","_rev":"2-530bd2809cbceb7392fdb758d496fd29","_deleted":true,"_revisions":{"start":2,"ids":["530bd2809cbceb7392fdb758d496fd29","cc0c1e0e01060aa62456d6ea768d8ec7"]}},{"_id":"_design/inventory_request_by_status","_rev":"2-0338b756f9c3471052577cadc4ed9505","_deleted":true,"_revisions":{"start":2,"ids":["0338b756f9c3471052577cadc4ed9505","187394c79d3206e11e112891f0d63550"]}},{"_id":"_design/invoice_by_patient","_rev":"1-a491390f74ce432d9cfab78291e0753b","version":1,"views":{"invoice_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":1,"ids":["a491390f74ce432d9cfab78291e0753b"]}},{"_id":"_design/invoice_by_patient","_rev":"2-6f4cea4e5d7ba4aa3ed8d0ab6bb052af","_deleted":true,"_revisions":{"start":2,"ids":["6f4cea4e5d7ba4aa3ed8d0ab6bb052af","9f67a58d4e428614844ac82cb2548268"]}},{"_id":"_design/invoice_by_status","_rev":"2-072e2f7f1519a12260fe98c90f794b06","version":4,"views":{"invoice_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {var billDate = doc.data.billDate;if (billDate && billDate !== \\"\\") {billDate = new Date(billDate);if (billDate.getTime) {billDate = billDate.getTime();}}emit([doc.data.status, billDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["072e2f7f1519a12260fe98c90f794b06","73e3e45673ed0c4f4ae1cee855f216f0"]}},{"_id":"_design/invoice_by_status","_rev":"2-7850ddbe88cf85231bfe32a1f996f093","_deleted":true,"_revisions":{"start":2,"ids":["7850ddbe88cf85231bfe32a1f996f093","d411e6f66f897f0b9b985dc6e5188d85"]}},{"_id":"_design/invoice_by_status","_rev":"2-d88d6c08ad0c49ed6d2b3a55a0268931","_deleted":true,"_revisions":{"start":2,"ids":["d88d6c08ad0c49ed6d2b3a55a0268931","25a58e1cec7f01d0a7e8da1293f59b69"]}},{"_id":"_design/lab_by_status","_rev":"2-9a69b9bd5a85bd3ae2a6659abbb13d83","_deleted":true,"_revisions":{"start":2,"ids":["9a69b9bd5a85bd3ae2a6659abbb13d83","16b2c13356e8dac3b3594018f91cccfb"]}},{"_id":"_design/lab_by_status","_rev":"2-a3e2e3df161e7880986b81f873a974d5","_deleted":true,"_revisions":{"start":2,"ids":["a3e2e3df161e7880986b81f873a974d5","7d4de6e219b482171b7ecd485ef72238"]}},{"_id":"_design/lab_by_status","_rev":"2-ef5e8b51b3704c0cb1e525a63c81bd80","version":4,"views":{"lab_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"lab\\") {var labDate = doc.data.labDate;if (labDate && labDate !== \\"\\") {labDate = new Date(labDate);if (labDate.getTime) {labDate = labDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, labDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["ef5e8b51b3704c0cb1e525a63c81bd80","db4393c6856b98a40afd6ceef31db2a7"]}},{"_id":"_design/medication_by_status","_rev":"2-05c7746b86e7abeadba7b3b5b512a03f","_deleted":true,"_revisions":{"start":2,"ids":["05c7746b86e7abeadba7b3b5b512a03f","a6403c53b2db46905b3b1861120c6601"]}},{"_id":"_design/medication_by_status","_rev":"2-9dec70f4b5aeaf7d9b8d70719125c41c","version":4,"views":{"medication_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"medication\\") {var prescriptionDate = doc.data.prescriptionDate;if (prescriptionDate && prescriptionDate !== \\"\\") {prescriptionDate = new Date(prescriptionDate);if (prescriptionDate.getTime) {prescriptionDate = prescriptionDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["9dec70f4b5aeaf7d9b8d70719125c41c","36ce9e9853552f5eb646ed26de7184dc"]}},{"_id":"_design/medication_by_status","_rev":"2-79762c4d3cd11ead2ca9150d49b87908","_deleted":true,"_revisions":{"start":2,"ids":["79762c4d3cd11ead2ca9150d49b87908","09e1d1c201823532161ef48ba23200be"]}},{"_id":"_design/open_incidents_by_user","_rev":"2-d564bf4c24a2cb54da07044a77d0184d","version":1,"views":{"open_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status !== \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      }\\n      return 0; // Don\'t sort\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["d564bf4c24a2cb54da07044a77d0184d","ca0e7f9b3378f58be85f176c80a3c23b"]}},{"_id":"_design/open_incidents_by_user","_rev":"2-05984c30c0ffb50b2823e8805ed9444d","_deleted":true,"_revisions":{"start":2,"ids":["05984c30c0ffb50b2823e8805ed9444d","34770efd210920a30c96d3787521e8a5"]}},{"_id":"_design/patient_by_admission","_rev":"2-cb3270a3d44a370d50128b93179d3503","version":4,"views":{"patient_by_admission":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.admitted === true) {\\n      if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["cb3270a3d44a370d50128b93179d3503","ee7b6ead26ac6b8b3f106c6d85dc175b"]}},{"_id":"_design/patient_by_admission","_rev":"2-0c4a20f605b836224bc438f1bca26c9b","_deleted":true,"_revisions":{"start":2,"ids":["0c4a20f605b836224bc438f1bca26c9b","3c2da4380d257c95ebf4430afa48de3b"]}},{"_id":"_design/patient_by_display_id","_rev":"2-88a46c350d8994362cc0e5910f15d726","version":7,"views":{"patient_by_display_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["88a46c350d8994362cc0e5910f15d726","c619a041bccecc7e83b05015cc92706e"]}},{"_id":"_design/patient_by_display_id","_rev":"2-0d054f7b541c310fdc1c7994ee2ccd49","_deleted":true,"_revisions":{"start":2,"ids":["0d054f7b541c310fdc1c7994ee2ccd49","8a6930002af6d588ecdedd5f07da0230"]}},{"_id":"_design/patient_by_display_id","_rev":"2-04967bcb87fd6a7fffc0d779044dd0b8","_deleted":true,"_revisions":{"start":2,"ids":["04967bcb87fd6a7fffc0d779044dd0b8","6f596cec9eb82609308fd9d25a9f9df2"]}},{"_id":"_design/patient_by_status","_rev":"2-b56763993297cda52343d99f7fdd1b03","version":3,"views":{"patient_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {emit(doc.data.status);}}}"}},"_revisions":{"start":2,"ids":["b56763993297cda52343d99f7fdd1b03","ff26a12cdb8747aae5bf26f9af3a1953"]}},{"_id":"_design/patient_by_status","_rev":"2-01f23790dd42e69b4ed27f04d61f1adf","_deleted":true,"_revisions":{"start":2,"ids":["01f23790dd42e69b4ed27f04d61f1adf","54bc74ff93db4aedff83bc649f766596"]}},{"_id":"_design/patient_by_status","_rev":"2-28bbabc89f372c977f8f25a2dc4748e8","_deleted":true,"_revisions":{"start":2,"ids":["28bbabc89f372c977f8f25a2dc4748e8","49f3f7f86891fb7d60f0ee1b2db1220b"]}},{"_id":"_design/photo_by_patient","_rev":"2-5fc163e6b59fe7fe49ea0d0b07f5b78c","_deleted":true,"_revisions":{"start":2,"ids":["5fc163e6b59fe7fe49ea0d0b07f5b78c","6a4fad4fa682efbbd058e858c328574f"]}},{"_id":"_design/photo_by_patient","_rev":"2-0ea32da890536de0910ea412a3fa015c","version":4,"views":{"photo_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"photo\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":2,"ids":["0ea32da890536de0910ea412a3fa015c","e3dc5506f7f370535b85be0adc59c7cc"]}},{"_id":"_design/photo_by_patient","_rev":"2-29a6fd37f05e4fdd0563837230cf1664","_deleted":true,"_revisions":{"start":2,"ids":["29a6fd37f05e4fdd0563837230cf1664","727ba2a3d1a106196746643395a859d0"]}},{"_id":"_design/pricing_by_category","_rev":"1-b34429f4f8aff13ed218f70f039b3591","version":5,"views":{"pricing_by_category":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"pricing\\") {emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["b34429f4f8aff13ed218f70f039b3591"]}},{"_id":"_design/pricing_by_category","_rev":"2-b410254aa19dffe8ec92ad1aa5253030","_deleted":true,"_revisions":{"start":2,"ids":["b410254aa19dffe8ec92ad1aa5253030","3d703b5f240ae5838d1f20a8ad0471de"]}},{"_id":"_design/pricing_by_category","_rev":"2-68d447e856a6194de82dcd9e506569ae","_deleted":true,"_revisions":{"start":2,"ids":["68d447e856a6194de82dcd9e506569ae","23d44e44019170eadd086734c87e3976"]}},{"_id":"_design/procedure_by_date","_rev":"1-a44decd8f14d01c615cf3f5b8e70f10b","version":4,"views":{"procedure_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'procedure\') {\\n        var procedureDate = doc.data.procedureDate;\\n    if (procedureDate && procedureDate !== \\"\\") {\\n      procedureDate = new Date(procedureDate);\\n      if (procedureDate.getTime) {\\n        procedureDate = procedureDate.getTime();\\n      }\\n    }\\n    emit([procedureDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["a44decd8f14d01c615cf3f5b8e70f10b"]}},{"_id":"_design/procedure_by_date","_rev":"2-5b5eb6c8ca33d0d3ff9c1f6ee70eb04c","_deleted":true,"_revisions":{"start":2,"ids":["5b5eb6c8ca33d0d3ff9c1f6ee70eb04c","25ccef2a9dff3addd8c0d15cc79c363c"]}},{"_id":"_design/procedure_by_date","_rev":"2-876a312fff8d17933d798db8d69e9938","_deleted":true,"_revisions":{"start":2,"ids":["876a312fff8d17933d798db8d69e9938","7c23f1d0feaff1358bee1ddea760daac"]}},{"_id":"_design/report_by_visit","_rev":"1-1295cef10df82554859efdb4c38c1c1e","version":1,"views":{"report_by_visit":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'report\') {\\n        emit(doc.data.visit);\\n      }\\n    }\\n  }"}}},{"_id":"_design/sequence_by_prefix","_rev":"2-2ab8142fd9e3bdfd7b4d6444fe9afa4f","_deleted":true,"_revisions":{"start":2,"ids":["2ab8142fd9e3bdfd7b4d6444fe9afa4f","4a47589314718c2d8add1266b64b5ea6"]}},{"_id":"_design/sequence_by_prefix","_rev":"2-dcfc7e63d8ab52146460bd36ff0d5555","_deleted":true,"_revisions":{"start":2,"ids":["dcfc7e63d8ab52146460bd36ff0d5555","10f81c9287f2db782b8e293e7d9b1cde"]}},{"_id":"_design/sequence_by_prefix","_rev":"2-73756debd255ca93fb25eab24ed9e12a","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"sequence\\") {emit(doc.data.prefix);}}}"}},"_revisions":{"start":2,"ids":["73756debd255ca93fb25eab24ed9e12a","8ac3a62b4c0b624ebed3b68b27cd197e"]}},{"_id":"_design/surgical_appointments_by_date","_rev":"1-90d8de834de1fe0e154d1cdab8889984","version":1,"views":{"surgical_appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType === \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/visit_by_date","_rev":"1-fd0a50125860ba3c17844c0567a70d65","version":4,"views":{"visit_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["fd0a50125860ba3c17844c0567a70d65"]}},{"_id":"_design/visit_by_date","_rev":"2-db03c0d562a1ae49095d68c63bc3d68f","_deleted":true,"_revisions":{"start":2,"ids":["db03c0d562a1ae49095d68c63bc3d68f","db61f993a1e1699c8205fee3434fc4c8"]}},{"_id":"_design/visit_by_date","_rev":"2-add6c18db9db449d2af501f6f3fc9a68","_deleted":true,"_revisions":{"start":2,"ids":["add6c18db9db449d2af501f6f3fc9a68","367a7fa42f1067f645190d560f83ef5e"]}},{"_id":"_design/visit_by_discharge_date","_rev":"2-76f05f3060660ab74749fa0def9cea07","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}emit([endDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["76f05f3060660ab74749fa0def9cea07","e53c95160dacaf007fe01c01215729ce"]}},{"_id":"_design/visit_by_discharge_date","_rev":"2-a14fd5cb9029d2e114f084d7ce01d874","_deleted":true,"_revisions":{"start":2,"ids":["a14fd5cb9029d2e114f084d7ce01d874","b4baca85d54e727966aeb2e8ad172136"]}},{"_id":"_design/visit_by_discharge_date","_rev":"2-ed42fc360c36cf527a4fdb67fc0d81ee","_deleted":true,"_revisions":{"start":2,"ids":["ed42fc360c36cf527a4fdb67fc0d81ee","57a0b69b2792963e5112bbdd53bbba2d"]}},{"_id":"_design/visit_by_patient","_rev":"1-f2865c74eefee716937492db914f2ccd","version":4,"views":{"visit_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["f2865c74eefee716937492db914f2ccd"]}},{"_id":"_design/visit_by_patient","_rev":"2-15d7d524e104be716e8c93fbf367a28e","_deleted":true,"_revisions":{"start":2,"ids":["15d7d524e104be716e8c93fbf367a28e","bf45f0e7e8e9123a59095b609570a4ea"]}},{"_id":"_design/visit_by_patient","_rev":"2-048bd179b127054d3279071160a6f314","_deleted":true,"_revisions":{"start":2,"ids":["048bd179b127054d3279071160a6f314","412252178488867e2350dcd13da779ea"]}},{"_id":"lookup_2_anesthesia_types","_rev":"9-d77994ca90296681be7de203fea0430a","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Epidural"]},"_revisions":{"start":9,"ids":["d77994ca90296681be7de203fea0430a","1d1ae87c72651a279f4d2c1538bdc098","35208a178d11903681c43f9b98ec6513","575acff9e89f60a3ac9df9f4e22e3e04","66570c168285e90d2b69a114f56a648e","281f6900e4c336126ea848f4629312d6","b6a2997fdff472cc26879f1e2c7fb534","739c522ef659467bceea962699319751","f44ab6ebc23a2e0fabdae6239f2c9aa5"]}},{"_id":"lookup_2_anesthesiologists","_rev":"2-15912b0c0e68bb5e33a3a1f6a3e6b9e4","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":[]},"_revisions":{"start":2,"ids":["15912b0c0e68bb5e33a3a1f6a3e6b9e4","1dcbe81d2cdb89574a56ab17f3f0f26c"]}},{"_id":"lookup_2_visit_types","_rev":"1-52a2e0e0211f6cbdb55e97318d8fc790","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Admission","Clinic","Imaging","Lab","Pharmacy"]}}]}\n{"seq":62}\n';
});
define('hospitalrun/tests/fixtures/appointments',['exports'],function(exports){exports['default'] = '{"version":"1.2.5","db_type":"http","start_time":"2017-03-16T14:28:07.957Z","db_info":{"db_name":"main","doc_count":70,"doc_del_count":21,"update_seq":115,"purge_seq":0,"compact_running":false,"disk_size":139368,"data_size":81270,"instance_start_time":"1489674429731914","disk_format_version":6,"committed_update_seq":115,"host":"http://localhost:5984/main/","auto_compaction":false,"adapter":"http"}}\n{"docs":[{"_id":"_design/custom_form_by_type","_rev":"1-ddf0ee75c1e8e859d821a9f5c1ec43b6","version":1,"views":{"custom_form_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'customForm\') {\\n        emit(doc.data.formType);\\n      }\\n    }\\n  }"}}}]}\n{"seq":5}\n{"docs":[{"_id":"_design/inventory_by_friendly_id","_rev":"1-82e24378f074a284cae14da4db5431ed","version":1,"views":{"inventory_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}}]}\n{"seq":7}\n{"docs":[{"_id":"_design/appointments_by_date","_rev":"1-5df29f1d7dbd39d6b3a2145923ab73cf","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["5df29f1d7dbd39d6b3a2145923ab73cf"]}},{"_id":"_design/appointments_by_date","_rev":"1-3c37df4fed5a034aedc1a295f4a672fd","version":4,"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n            var i,\\n                filterBy = null,\\n                includeRow = true;\\n            if (req.query && req.query.filterBy) {\\n                filterBy = JSON.parse(req.query.filterBy);\\n            }\\n            if (!filterBy) {\\n                return true;\\n            }\\n            for (i = 0; i < filterBy.length; i++) {\\n                var currentValue = row.doc[filterBy[i].name];\\n                if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n                    currentValue = \'Scheduled\';\\n                }\\n                if (currentValue !== filterBy[i].value) {\\n                    includeRow = false;\\n                    break;\\n                }\\n            }\\n            return includeRow;\\n        });rows.sort(function (a, b) {\\n            function defaultStatus(value) {\\n                if (!value || value === \'\') {\\n                    return \'Scheduled\';\\n                } else {\\n                    return value;\\n                }\\n            }\\n            var sortBy = \'\';\\n            if (req.query && req.query.sortKey) {\\n                sortBy = req.query.sortKey;\\n            }\\n            switch (sortBy) {\\n                case \'appointmentType\':\\n                case \'location\':\\n                case \'provider\':\\n                    return compareStrings(a.doc[sortBy], b.doc[sortBy]);\\n                case \'date\':\\n                    {\\n                        var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n                        if (startDiff === 0) {\\n                            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n                        } else {\\n                            return startDiff;\\n                        }\\n                        break;\\n                    }\\n                case \'status\':\\n                    {\\n                        var aStatus = defaultStatus(a.doc.data[sortBy]),\\n                            bStatus = defaultStatus(b.doc.data[sortBy]);\\n                        return compareStrings(aStatus, bStatus);\\n                    }\\n                default:\\n                    {\\n                        return 0; //Don\'t sort\\n                    }\\n            }\\n        });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"views":{"appointments_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["3c37df4fed5a034aedc1a295f4a672fd"]}},{"_id":"_design/appointments_by_date","_rev":"1-178add045be11a7fd6aa7fdf97c8f3f0","version":6,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([startDate, endDate, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n      var filterBy = null;\\n      var includeRow = true;\\n      if (req.query && req.query.filterBy) {\\n        filterBy = JSON.parse(req.query.filterBy);\\n      }\\n      if (!filterBy) {\\n        return true;\\n      }\\n      for (var i = 0; i < filterBy.length; i++) {\\n        var currentValue = row.doc.data[filterBy[i].name];\\n        if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n          currentValue = \'Scheduled\';\\n        }\\n        if (currentValue !== filterBy[i].value) {\\n          includeRow = false;\\n          break;\\n        }\\n      }\\n      return includeRow;\\n    });rows.sort(function (a, b) {\\n      function defaultStatus(value) {\\n        if (!value || value === \'\') {\\n          return \'Scheduled\';\\n        } else {\\n          return value;\\n        }\\n      }\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'appointmentType\':\\n        case \'location\':\\n        case \'provider\':\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        case \'date\':\\n          {\\n            var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n            if (startDiff === 0) {\\n              return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n            } else {\\n              return startDiff;\\n            }\\n          }\\n        case \'status\':\\n          {\\n            var aStatus = defaultStatus(a.doc.data[sortBy]);\\n            var bStatus = defaultStatus(b.doc.data[sortBy]);\\n            return compareStrings(aStatus, bStatus);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["178add045be11a7fd6aa7fdf97c8f3f0"]}},{"_id":"_design/appointments_by_date","_rev":"1-03951858f9232df2e774548b0f5fd068","version":4,"views":{"appointments_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n      var i,\\n          filterBy = null,\\n          includeRow = true;\\n      if (req.query && req.query.filterBy) {\\n        filterBy = JSON.parse(req.query.filterBy);\\n      }\\n      if (!filterBy) {\\n        return true;\\n      }\\n      for (i = 0; i < filterBy.length; i++) {\\n        var currentValue = row.doc.data[filterBy[i].name];\\n        if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n          currentValue = \'Scheduled\';\\n        }\\n        if (currentValue !== filterBy[i].value) {\\n          includeRow = false;\\n          break;\\n        }\\n      }\\n      return includeRow;\\n    });rows.sort(function (a, b) {\\n      function defaultStatus(value) {\\n        if (!value || value === \'\') {\\n          return \'Scheduled\';\\n        } else {\\n          return value;\\n        }\\n      }\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'appointmentType\':\\n        case \'location\':\\n        case \'provider\':\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        case \'date\':\\n          {\\n            var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n            if (startDiff === 0) {\\n              return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n            } else {\\n              return startDiff;\\n            }\\n            break;\\n          }\\n        case \'status\':\\n          {\\n            var aStatus = defaultStatus(a.doc.data[sortBy]),\\n                bStatus = defaultStatus(b.doc.data[sortBy]);\\n            return compareStrings(aStatus, bStatus);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["03951858f9232df2e774548b0f5fd068"]}},{"_id":"_design/appointments_by_date","_rev":"3-461875fa3e8aa582009473a4ebccf3bb","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":3,"ids":["461875fa3e8aa582009473a4ebccf3bb","2e78ab0f6da3881df4871d0b028148b9","4c8dd95ad6d36b9b4d86136d5e417f5c"]}},{"_id":"_design/appointments_by_patient","_rev":"1-7232d3292344540b2511e709422e2cbf","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate,doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7232d3292344540b2511e709422e2cbf"]}},{"_id":"_design/appointments_by_patient","_rev":"1-9a97acd5b8fd071ad81afc9e730721c5","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate,doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["9a97acd5b8fd071ad81afc9e730721c5"]}},{"_id":"_design/appointments_by_patient","_rev":"2-a8bb26daf0329c069a18ec0ce64532cb","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate,doc._id]);}}}"}},"_revisions":{"start":2,"ids":["a8bb26daf0329c069a18ec0ce64532cb","9868b6586898a48c3fd68722ca3fe1d4"]}},{"_id":"_design/closed_incidents_by_user","_rev":"1-bf16176c13be57af9a4f1a0980710190","version":1,"views":{"closed_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status === \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}}},{"_id":"_design/imaging_by_status","_rev":"1-2feb5103c3f6d149bf98f0adeaa76b38","version":4,"views":{"imaging_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"imaging\\") {var imagingDate = doc.data.imagingDate;if (imagingDate && imagingDate !== \\"\\") {imagingDate = new Date(imagingDate);if (imagingDate.getTime) {imagingDate = imagingDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, imagingDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["2feb5103c3f6d149bf98f0adeaa76b38"]}},{"_id":"_design/imaging_by_status","_rev":"1-1a3bab3d2d1403299a9e4ad8dffe5fa1","version":4,"views":{"imaging_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'imaging\') {\\n        var imagingDate = doc.data.imagingDate;\\n    if (imagingDate && imagingDate !== \\"\\") {\\n      imagingDate = new Date(imagingDate);\\n      if (imagingDate.getTime) {\\n        imagingDate = imagingDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, imagingDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["1a3bab3d2d1403299a9e4ad8dffe5fa1"]}},{"_id":"_design/imaging_by_status","_rev":"2-57660077d48a8a4a0c1a3dd6ae214aac","version":4,"views":{"imaging_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"imaging\\") {var imagingDate = doc.data.imagingDate;if (imagingDate && imagingDate !== \\"\\") {imagingDate = new Date(imagingDate);if (imagingDate.getTime) {imagingDate = imagingDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, imagingDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["57660077d48a8a4a0c1a3dd6ae214aac","9236042e1fb9f567d1d527bbb429cd8e"]}},{"_id":"_design/incident_by_date","_rev":"1-59fa59734ee129cff0560b20a95d2d4e","version":1,"views":{"incident_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        var dateOfIncident = doc.data.dateOfIncident;\\n    if (dateOfIncident && dateOfIncident !== \\"\\") {\\n      dateOfIncident = new Date(dateOfIncident);\\n      if (dateOfIncident.getTime) {\\n        dateOfIncident = dateOfIncident.getTime();\\n      }\\n    }\\n    emit([dateOfIncident, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/incident_by_friendly_id","_rev":"1-885a12b67da47e956bc190fe1fe0d4e6","version":1,"views":{"incident_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_by_name","_rev":"1-91f55ae6bd30f766d9da95bffe054bcb","version":5,"views":{"inventory_by_name":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.name, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["91f55ae6bd30f766d9da95bffe054bcb"]}},{"_id":"_design/inventory_by_name","_rev":"1-304304d63beaffd8d1ae4ae1cddf4b2b","version":3,"views":{"inventory_by_name":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit([doc.data.name, doc._id]);}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["304304d63beaffd8d1ae4ae1cddf4b2b"]}},{"_id":"_design/inventory_by_name","_rev":"1-3eb498726e0d057818618808c0db46bf","version":3,"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n            var sortBy = \'\';\\n            if (req.query && req.query.sortKey) {\\n                sortBy = req.query.sortKey;\\n            }\\n            switch (sortBy) {\\n                case \'crossReference\':\\n                case \'description\':\\n                case \'friendlyId\':\\n                case \'name\':\\n                case \'price\':\\n                case \'quantity\':\\n                case \'inventoryType\':\\n                    {\\n                        return compareStrings(a.doc[sortBy], b.doc[sortBy]);\\n                    }\\n                default:\\n                    {\\n                        return 0; //Don\'t sort\\n                    }\\n            }\\n        });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"views":{"inventory_by_name":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit([doc.data.name, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["3eb498726e0d057818618808c0db46bf"]}},{"_id":"_design/inventory_by_name","_rev":"2-6993fbc5ef18283f83c6afe5be9a9351","version":5,"views":{"inventory_by_name":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.name, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["6993fbc5ef18283f83c6afe5be9a9351","c12e4467c9c3ecc8021b660934257f25"]}},{"_id":"_design/inventory_by_type","_rev":"1-003ef699ab0f2b8628c0bf613fabf7a2","version":4,"views":{"inventory_by_type":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit(doc.data.inventoryType);}}}"}},"_revisions":{"start":1,"ids":["003ef699ab0f2b8628c0bf613fabf7a2"]}},{"_id":"_design/inventory_by_type","_rev":"1-18455500e1e86544edceaab01bb511bc","version":5,"views":{"inventory_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit(doc.data.inventoryType);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["18455500e1e86544edceaab01bb511bc"]}},{"_id":"_design/inventory_by_type","_rev":"1-65423cfcd4b0acd93b58aa2003907c92","version":5,"views":{"inventory_by_type":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit(doc.data.inventoryType);}}}"}},"_revisions":{"start":1,"ids":["65423cfcd4b0acd93b58aa2003907c92"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-0d7b597aeae746589980b12903768252","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invPurchase\') {\\n        var dateReceived = doc.data.dateReceived;\\n    if (dateReceived && dateReceived !== \\"\\") {\\n      dateReceived = new Date(dateReceived);\\n      if (dateReceived.getTime) {\\n        dateReceived = dateReceived.getTime();\\n      }\\n    }\\n    emit([dateReceived, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["0d7b597aeae746589980b12903768252"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-78939ec45bef330bbfa87763dbbfce37","version":4,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var dateReceived = doc.data.dateReceived;if (dateReceived && dateReceived !== \\"\\") {dateReceived = new Date(dateReceived);if (dateReceived.getTime) {dateReceived = dateReceived.getTime();}}emit([dateReceived, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["78939ec45bef330bbfa87763dbbfce37"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-823be94576112c800022b256ccd9b725","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var dateReceived = doc.data.dateReceived;if (dateReceived && dateReceived !== \\"\\") {dateReceived = new Date(dateReceived);if (dateReceived.getTime) {dateReceived = dateReceived.getTime();}}emit([dateReceived, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["823be94576112c800022b256ccd9b725"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-7aea58304996ccb168865141592a024f","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var expirationDate = doc.data.expirationDate;if (expirationDate && expirationDate !== \\"\\") {expirationDate = new Date(expirationDate);if (expirationDate.getTime) {expirationDate = expirationDate.getTime();}}emit([expirationDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7aea58304996ccb168865141592a024f"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-17bd9d3619ae03155d9929d3ebcd5023","version":4,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var expirationDate = doc.data.expirationDate;if (expirationDate && expirationDate !== \\"\\") {expirationDate = new Date(expirationDate);if (expirationDate.getTime) {expirationDate = expirationDate.getTime();}}emit([expirationDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["17bd9d3619ae03155d9929d3ebcd5023"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-1f41dd6d030c58884d7013ef9436decb","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invPurchase\') {\\n        var expirationDate = doc.data.expirationDate;\\n    if (expirationDate && expirationDate !== \\"\\") {\\n      expirationDate = new Date(expirationDate);\\n      if (expirationDate.getTime) {\\n        expirationDate = expirationDate.getTime();\\n      }\\n    }\\n    emit([expirationDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["1f41dd6d030c58884d7013ef9436decb"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-e9eb2d7f1e35296646399c7414525c33","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);}}}"}},"_revisions":{"start":1,"ids":["e9eb2d7f1e35296646399c7414525c33"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-021f4c24b5b6202594f610cf5d4c63a4","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invRequest\') {\\n        var dateCompleted = doc.data.dateCompleted;\\n    if (dateCompleted && dateCompleted !== \\"\\") {\\n      dateCompleted = new Date(dateCompleted);\\n      if (dateCompleted.getTime) {\\n        dateCompleted = dateCompleted.getTime();\\n      }\\n    }\\n    emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["021f4c24b5b6202594f610cf5d4c63a4"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-7e7ef275a9fc15f2b5f328b1479c6097","version":4,"views":{"inventory_request_by_item":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);}}}"}},"_revisions":{"start":1,"ids":["7e7ef275a9fc15f2b5f328b1479c6097"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-187394c79d3206e11e112891f0d63550","version":4,"views":{"inventory_request_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.status, dateCompleted, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["187394c79d3206e11e112891f0d63550"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-cc0c1e0e01060aa62456d6ea768d8ec7","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invRequest\') {\\n        var dateCompleted = doc.data.dateCompleted;\\n    if (dateCompleted && dateCompleted !== \\"\\") {\\n      dateCompleted = new Date(dateCompleted);\\n      if (dateCompleted.getTime) {\\n        dateCompleted = dateCompleted.getTime();\\n      }\\n    }\\n    emit([doc.data.status, dateCompleted, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["cc0c1e0e01060aa62456d6ea768d8ec7"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-f4a7252ebf2802c53a572bf150eae05c","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.status, dateCompleted, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["f4a7252ebf2802c53a572bf150eae05c"]}},{"_id":"_design/invoice_by_patient","_rev":"1-9f67a58d4e428614844ac82cb2548268","version":1,"views":{"invoice_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invoice\') {\\n        emit(doc.data.patient);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["9f67a58d4e428614844ac82cb2548268"]}},{"_id":"_design/invoice_by_patient","_rev":"1-a491390f74ce432d9cfab78291e0753b","version":1,"views":{"invoice_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":1,"ids":["a491390f74ce432d9cfab78291e0753b"]}},{"_id":"_design/invoice_by_status","_rev":"1-25a58e1cec7f01d0a7e8da1293f59b69","version":4,"views":{"invoice_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {var billDate = doc.data.billDate;if (billDate && billDate !== \\"\\") {billDate = new Date(billDate);if (billDate.getTime) {billDate = billDate.getTime();}}emit([doc.data.status, billDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["25a58e1cec7f01d0a7e8da1293f59b69"]}},{"_id":"_design/invoice_by_status","_rev":"1-d411e6f66f897f0b9b985dc6e5188d85","version":4,"views":{"invoice_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invoice\') {\\n        var billDate = doc.data.billDate;\\n    if (billDate && billDate !== \\"\\") {\\n      billDate = new Date(billDate);\\n      if (billDate.getTime) {\\n        billDate = billDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, billDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["d411e6f66f897f0b9b985dc6e5188d85"]}},{"_id":"_design/invoice_by_status","_rev":"2-072e2f7f1519a12260fe98c90f794b06","version":4,"views":{"invoice_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {var billDate = doc.data.billDate;if (billDate && billDate !== \\"\\") {billDate = new Date(billDate);if (billDate.getTime) {billDate = billDate.getTime();}}emit([doc.data.status, billDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["072e2f7f1519a12260fe98c90f794b06","73e3e45673ed0c4f4ae1cee855f216f0"]}},{"_id":"_design/lab_by_status","_rev":"1-7d4de6e219b482171b7ecd485ef72238","version":4,"views":{"lab_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'lab\') {\\n        var labDate = doc.data.labDate;\\n    if (labDate && labDate !== \\"\\") {\\n      labDate = new Date(labDate);\\n      if (labDate.getTime) {\\n        labDate = labDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, labDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["7d4de6e219b482171b7ecd485ef72238"]}},{"_id":"_design/lab_by_status","_rev":"1-16b2c13356e8dac3b3594018f91cccfb","version":4,"views":{"lab_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"lab\\") {var labDate = doc.data.labDate;if (labDate && labDate !== \\"\\") {labDate = new Date(labDate);if (labDate.getTime) {labDate = labDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, labDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["16b2c13356e8dac3b3594018f91cccfb"]}},{"_id":"_design/lab_by_status","_rev":"2-ef5e8b51b3704c0cb1e525a63c81bd80","version":4,"views":{"lab_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"lab\\") {var labDate = doc.data.labDate;if (labDate && labDate !== \\"\\") {labDate = new Date(labDate);if (labDate.getTime) {labDate = labDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, labDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["ef5e8b51b3704c0cb1e525a63c81bd80","db4393c6856b98a40afd6ceef31db2a7"]}},{"_id":"_design/medication_by_status","_rev":"1-09e1d1c201823532161ef48ba23200be","version":4,"views":{"medication_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"medication\\") {var prescriptionDate = doc.data.prescriptionDate;if (prescriptionDate && prescriptionDate !== \\"\\") {prescriptionDate = new Date(prescriptionDate);if (prescriptionDate.getTime) {prescriptionDate = prescriptionDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["09e1d1c201823532161ef48ba23200be"]}},{"_id":"_design/medication_by_status","_rev":"1-a6403c53b2db46905b3b1861120c6601","version":4,"views":{"medication_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'medication\') {\\n        var prescriptionDate = doc.data.prescriptionDate;\\n    if (prescriptionDate && prescriptionDate !== \\"\\") {\\n      prescriptionDate = new Date(prescriptionDate);\\n      if (prescriptionDate.getTime) {\\n        prescriptionDate = prescriptionDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["a6403c53b2db46905b3b1861120c6601"]}},{"_id":"_design/medication_by_status","_rev":"2-9dec70f4b5aeaf7d9b8d70719125c41c","version":4,"views":{"medication_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"medication\\") {var prescriptionDate = doc.data.prescriptionDate;if (prescriptionDate && prescriptionDate !== \\"\\") {prescriptionDate = new Date(prescriptionDate);if (prescriptionDate.getTime) {prescriptionDate = prescriptionDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["9dec70f4b5aeaf7d9b8d70719125c41c","36ce9e9853552f5eb646ed26de7184dc"]}},{"_id":"_design/open_incidents_by_user","_rev":"1-34770efd210920a30c96d3787521e8a5","version":1,"views":{"open_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status !== \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      }\\n      return 0; // Don\'t sort\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/patient_by_admission","_rev":"1-3c2da4380d257c95ebf4430afa48de3b","version":4,"views":{"patient_by_admission":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.admitted === true) {\\n      if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["3c2da4380d257c95ebf4430afa48de3b"]}},{"_id":"_design/patient_by_admission","_rev":"2-cb3270a3d44a370d50128b93179d3503","version":4,"views":{"patient_by_admission":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.admitted === true) {\\n      if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["cb3270a3d44a370d50128b93179d3503","ee7b6ead26ac6b8b3f106c6d85dc175b"]}},{"_id":"_design/patient_by_display_id","_rev":"1-c619a041bccecc7e83b05015cc92706e","version":6,"views":{"patient_by_display_id":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {if (doc.data.friendlyId) {emit([doc.data.friendlyId, doc._id]);} else if (doc.data.externalPatientId) {emit([doc.data.externalPatientId, doc._id]);} else {emit([doc._id, doc._id]);}}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["c619a041bccecc7e83b05015cc92706e"]}},{"_id":"_design/patient_by_display_id","_rev":"1-0b75ee7c82a1aadebd0bc0fd403622fb","version":5,"views":{"patient_by_display_id":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {if (doc.data.friendlyId) {emit([doc.data.friendlyId, doc._id]);} else if (doc.data.externalPatientId) {emit([doc.data.externalPatientId, doc._id]);} else {emit([doc._id, doc._id]);}}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'firstName\':\\n        case \'sex\':\\n        case \'lastName\':\\n        case \'status\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        case \'dateOfBirth\':\\n          {\\n            return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["0b75ee7c82a1aadebd0bc0fd403622fb"]}},{"_id":"_design/patient_by_display_id","_rev":"1-8a6930002af6d588ecdedd5f07da0230","version":7,"views":{"patient_by_display_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["8a6930002af6d588ecdedd5f07da0230"]}},{"_id":"_design/patient_by_display_id","_rev":"3-76930b682e13aef4b2a31fcc57c0ba17","version":7,"views":{"patient_by_display_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":3,"ids":["76930b682e13aef4b2a31fcc57c0ba17","f2bcbc75b5c6af36a93ff450e1764247","e6d44a1448953362319c910bf33a8668"]}},{"_id":"_design/patient_by_status","_rev":"1-54bc74ff93db4aedff83bc649f766596","version":3,"views":{"patient_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        emit(doc.data.status);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["54bc74ff93db4aedff83bc649f766596"]}},{"_id":"_design/patient_by_status","_rev":"1-49f3f7f86891fb7d60f0ee1b2db1220b","version":3,"views":{"patient_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {emit(doc.data.status);}}}"}},"_revisions":{"start":1,"ids":["49f3f7f86891fb7d60f0ee1b2db1220b"]}},{"_id":"_design/patient_by_status","_rev":"2-b56763993297cda52343d99f7fdd1b03","version":3,"views":{"patient_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {emit(doc.data.status);}}}"}},"_revisions":{"start":2,"ids":["b56763993297cda52343d99f7fdd1b03","ff26a12cdb8747aae5bf26f9af3a1953"]}},{"_id":"_design/photo_by_patient","_rev":"1-727ba2a3d1a106196746643395a859d0","version":4,"views":{"photo_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"photo\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":1,"ids":["727ba2a3d1a106196746643395a859d0"]}},{"_id":"_design/photo_by_patient","_rev":"1-6a4fad4fa682efbbd058e858c328574f","version":4,"views":{"photo_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'photo\') {\\n        emit(doc.data.patient);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["6a4fad4fa682efbbd058e858c328574f"]}},{"_id":"_design/photo_by_patient","_rev":"2-0ea32da890536de0910ea412a3fa015c","version":4,"views":{"photo_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"photo\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":2,"ids":["0ea32da890536de0910ea412a3fa015c","e3dc5506f7f370535b85be0adc59c7cc"]}},{"_id":"_design/pricing_by_category","_rev":"1-b34429f4f8aff13ed218f70f039b3591","version":5,"views":{"pricing_by_category":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"pricing\\") {emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["b34429f4f8aff13ed218f70f039b3591"]}},{"_id":"_design/pricing_by_category","_rev":"1-3d703b5f240ae5838d1f20a8ad0471de","version":5,"views":{"pricing_by_category":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'pricing\') {\\n        emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["3d703b5f240ae5838d1f20a8ad0471de"]}},{"_id":"_design/pricing_by_category","_rev":"1-23d44e44019170eadd086734c87e3976","version":4,"views":{"pricing_by_category":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"pricing\\") {emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["23d44e44019170eadd086734c87e3976"]}},{"_id":"_design/procedure_by_date","_rev":"1-25ccef2a9dff3addd8c0d15cc79c363c","version":3,"views":{"procedure_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"procedure\\") {var procedureDate = doc.data.procedureDate;if (procedureDate && procedureDate !== \\"\\") {procedureDate = new Date(procedureDate);if (procedureDate.getTime) {procedureDate = procedureDate.getTime();}}emit([procedureDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["25ccef2a9dff3addd8c0d15cc79c363c"]}},{"_id":"_design/procedure_by_date","_rev":"1-7c23f1d0feaff1358bee1ddea760daac","version":4,"views":{"procedure_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"procedure\\") {var procedureDate = doc.data.procedureDate;if (procedureDate && procedureDate !== \\"\\") {procedureDate = new Date(procedureDate);if (procedureDate.getTime) {procedureDate = procedureDate.getTime();}}emit([procedureDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7c23f1d0feaff1358bee1ddea760daac"]}},{"_id":"_design/procedure_by_date","_rev":"1-a44decd8f14d01c615cf3f5b8e70f10b","version":4,"views":{"procedure_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'procedure\') {\\n        var procedureDate = doc.data.procedureDate;\\n    if (procedureDate && procedureDate !== \\"\\") {\\n      procedureDate = new Date(procedureDate);\\n      if (procedureDate.getTime) {\\n        procedureDate = procedureDate.getTime();\\n      }\\n    }\\n    emit([procedureDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["a44decd8f14d01c615cf3f5b8e70f10b"]}},{"_id":"_design/report_by_visit","_rev":"1-1295cef10df82554859efdb4c38c1c1e","version":1,"views":{"report_by_visit":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'report\') {\\n        emit(doc.data.visit);\\n      }\\n    }\\n  }"}}},{"_id":"_design/sequence_by_prefix","_rev":"1-4a47589314718c2d8add1266b64b5ea6","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"sequence\\") {emit(doc.data.prefix);}}}"}},"_revisions":{"start":1,"ids":["4a47589314718c2d8add1266b64b5ea6"]}},{"_id":"_design/sequence_by_prefix","_rev":"1-10f81c9287f2db782b8e293e7d9b1cde","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'sequence\') {\\n        emit(doc.data.prefix);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["10f81c9287f2db782b8e293e7d9b1cde"]}},{"_id":"_design/sequence_by_prefix","_rev":"2-73756debd255ca93fb25eab24ed9e12a","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"sequence\\") {emit(doc.data.prefix);}}}"}},"_revisions":{"start":2,"ids":["73756debd255ca93fb25eab24ed9e12a","8ac3a62b4c0b624ebed3b68b27cd197e"]}},{"_id":"_design/surgical_appointments_by_date","_rev":"1-90d8de834de1fe0e154d1cdab8889984","version":1,"views":{"surgical_appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType === \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/visit_by_date","_rev":"1-367a7fa42f1067f645190d560f83ef5e","version":3,"views":{"visit_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["367a7fa42f1067f645190d560f83ef5e"]}},{"_id":"_design/visit_by_date","_rev":"1-db61f993a1e1699c8205fee3434fc4c8","version":4,"views":{"visit_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([startDate, endDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["db61f993a1e1699c8205fee3434fc4c8"]}},{"_id":"_design/visit_by_date","_rev":"1-fd0a50125860ba3c17844c0567a70d65","version":4,"views":{"visit_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["fd0a50125860ba3c17844c0567a70d65"]}},{"_id":"_design/visit_by_discharge_date","_rev":"1-b4baca85d54e727966aeb2e8ad172136","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    emit([endDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["b4baca85d54e727966aeb2e8ad172136"]}},{"_id":"_design/visit_by_discharge_date","_rev":"1-57a0b69b2792963e5112bbdd53bbba2d","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}emit([endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["57a0b69b2792963e5112bbdd53bbba2d"]}},{"_id":"_design/visit_by_discharge_date","_rev":"2-76f05f3060660ab74749fa0def9cea07","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}emit([endDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["76f05f3060660ab74749fa0def9cea07","e53c95160dacaf007fe01c01215729ce"]}},{"_id":"_design/visit_by_patient","_rev":"1-f2865c74eefee716937492db914f2ccd","version":4,"views":{"visit_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["f2865c74eefee716937492db914f2ccd"]}},{"_id":"_design/visit_by_patient","_rev":"1-bf45f0e7e8e9123a59095b609570a4ea","version":4,"views":{"visit_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["bf45f0e7e8e9123a59095b609570a4ea"]}},{"_id":"_design/visit_by_patient","_rev":"1-412252178488867e2350dcd13da779ea","version":3,"views":{"visit_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["412252178488867e2350dcd13da779ea"]}},{"_id":"appointment_2_D0C3934D-E023-66E4-97D4-FC58F3595409","_rev":"1-5775c0c9cdf58099fa3ae4197634505f","data":{"allDay":true,"provider":"Dr Test","location":"Harare","appointmentType":"Admission","startDate":"2015-10-29T22:00:00.000Z","endDate":"2015-10-29T22:00:00.000Z","notes":"Admission","status":"Scheduled","lastModified":"2015-10-30T15:08:29.970Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"allDay":"2015-10-30T15:08:29.970Z","startDate":"2015-10-30T15:08:29.970Z","endDate":"2015-10-30T15:08:29.970Z","provider":"2015-10-30T15:08:29.970Z","location":"2015-10-30T15:08:29.970Z","appointmentType":"2015-10-30T15:08:29.970Z","notes":"2015-10-30T15:08:29.970Z"}}},{"_id":"imaging_2_07CC6746-C7D9-A410-9B8C-C4B4E095A96D","_rev":"2-ffa7adb60618346cba98a559d81df36a","data":{"imagingDate":"2015-10-15T09:39:44.603Z","notes":"random notes","radiologist":"zinyando","requestedBy":"hradmin","requestedDate":"2015-10-15T09:39:37.866Z","result":"to collect","status":"Completed","lastModified":"2015-10-15T09:39:44.603Z","modifiedBy":"hradmin","imagingType":"22208FBE-9C6E-079D-A1E6-A562F9310FE5","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"377AA288-AAD4-F60B-ABD1-B5A0B9C75D50","modifiedFields":{"radiologist":"2015-10-15T09:39:38.088Z","result":"2015-10-15T09:39:38.088Z","notes":"2015-10-15T09:39:38.088Z","status":"2015-10-15T09:39:44.603Z","requestedBy":"2015-10-15T09:39:38.088Z","requestedDate":"2015-10-15T09:39:38.088Z","imagingDate":"2015-10-15T09:39:44.603Z"},"charges":[]},"_revisions":{"start":2,"ids":["ffa7adb60618346cba98a559d81df36a","be0a6780ba1f2b7e3e8d49ebf20ed8d6"]}},{"_id":"imaging_2_1AC1DD3D-E7E7-15B4-A698-8A8AE62749EB","_rev":"1-83a3398c448faf2ea1962004c5652a52","data":{"imagingDate":null,"notes":"jkmn","radiologist":"zinyando","requestedBy":"hradmin","requestedDate":"2015-10-15T10:37:57.852Z","result":"hu","status":"Requested","lastModified":"2015-10-15T10:37:58.038Z","modifiedBy":"hradmin","imagingType":"4CEB69E7-B54A-9D45-B0EF-7643F0D48FA0","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"0BD42BD9-0E5D-0533-A8FA-1C0ADB0F0D65","modifiedFields":{"radiologist":"2015-10-15T10:37:58.038Z","result":"2015-10-15T10:37:58.038Z","notes":"2015-10-15T10:37:58.038Z","status":"2015-10-15T10:37:58.038Z","requestedBy":"2015-10-15T10:37:58.038Z","requestedDate":"2015-10-15T10:37:58.038Z"},"charges":[]}},{"_id":"imaging_2_4A7FC838-0B37-E151-AFD8-8DBAC9DE9D99","_rev":"2-0ddb54b6d0376b87fdf409eb6d205f82","data":{"imagingDate":"2015-10-28T07:32:45.311Z","notes":null,"radiologist":null,"requestedBy":"hradmin","requestedDate":"2015-10-26T11:49:08.227Z","result":null,"status":"Completed","lastModified":"2015-10-28T07:32:45.314Z","modifiedBy":"hradmin","imagingType":"CBB4C9D5-CE8C-2BB5-86F4-3FC16AE2E85D","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"C5C296AC-E238-CBA5-8DD8-99942843BC5A","modifiedFields":{"status":"2015-10-28T07:32:45.314Z","requestedBy":"2015-10-26T11:49:08.483Z","requestedDate":"2015-10-26T11:49:08.483Z","imagingDate":"2015-10-28T07:32:45.314Z"},"charges":[]},"_revisions":{"start":2,"ids":["0ddb54b6d0376b87fdf409eb6d205f82","0cefb2d2a3e8ba76052c1a08c27df1eb"]}},{"_id":"imaging_2_51D8DC28-78EB-62B1-942A-1158F5862F34","_rev":"2-40eac78a67beecaa77b17ea5e7481866","data":{"imagingDate":"2015-10-28T07:32:55.293Z","notes":"Chest is ok","radiologist":"Mr Test","requestedBy":"hradmin","requestedDate":"2015-10-28T07:23:34.834Z","result":"Ok","status":"Completed","lastModified":"2015-10-28T07:32:55.294Z","modifiedBy":"hradmin","imagingType":"E53305F3-BA40-B305-B2DC-0732C7AB0042","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"CBFA5C2C-191D-FC9C-AD19-14D26D5A3003","modifiedFields":{"radiologist":"2015-10-28T07:23:35.055Z","result":"2015-10-28T07:23:35.055Z","notes":"2015-10-28T07:23:35.055Z","status":"2015-10-28T07:32:55.294Z","requestedBy":"2015-10-28T07:23:35.055Z","requestedDate":"2015-10-28T07:23:35.055Z","imagingDate":"2015-10-28T07:32:55.294Z"},"charges":[]},"_revisions":{"start":2,"ids":["40eac78a67beecaa77b17ea5e7481866","fb212193dfed510d7935aed17e5f0456"]}},{"_id":"imaging_2_91B061E9-2986-D539-90C8-CD14EC2010B0","_rev":"1-2abe559a8f8075862b282ed4f9d54da5","data":{"imagingDate":null,"notes":"jbkj","radiologist":"b","requestedBy":"hradmin","requestedDate":"2015-10-28T07:39:18.255Z","result":"jjjk","status":"Requested","lastModified":"2015-10-28T07:39:18.406Z","modifiedBy":"hradmin","imagingType":null,"patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"6AD00ED1-670A-2C3F-BC10-0742B1F99264","modifiedFields":{"radiologist":"2015-10-28T07:39:18.406Z","result":"2015-10-28T07:39:18.406Z","notes":"2015-10-28T07:39:18.406Z","status":"2015-10-28T07:39:18.406Z","requestedBy":"2015-10-28T07:39:18.406Z","requestedDate":"2015-10-28T07:39:18.406Z"},"charges":[]}},{"_id":"imaging_2_D0F299E4-CD8D-557D-8C23-216FD23EF844","_rev":"3-8b87996abf9161e5d7908be6676a64d7","data":{"imagingDate":"2015-10-22T07:09:04.249Z","notes":"vbj nkm","radiologist":"fcgvb","requestedBy":"hradmin","requestedDate":"2015-10-22T07:08:38.080Z","result":"cgvhbj n","status":"Completed","lastModified":"2015-10-22T07:09:04.251Z","modifiedBy":"hradmin","imagingType":"B492AA26-22F2-52A9-93C7-17106A57A62E","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"9F1A65ED-683F-056E-8D50-A8AF63201CE2","modifiedFields":{"radiologist":"2015-10-22T07:08:38.523Z","result":"2015-10-22T07:08:38.523Z","notes":"2015-10-22T07:08:38.523Z","status":"2015-10-22T07:08:59.403Z","requestedBy":"2015-10-22T07:08:38.523Z","requestedDate":"2015-10-22T07:08:38.523Z","imagingDate":"2015-10-22T07:09:04.251Z"},"charges":[]},"_revisions":{"start":3,"ids":["8b87996abf9161e5d7908be6676a64d7","9f159b24551a1fa5acd7b84cd8d51994","c676b60d0d69556786f283da75b51c77"]}},{"_id":"imaging_2_DBE152F6-9508-2E12-81AC-39BC2CAFE08C","_rev":"2-69b11e7856d8b0fc3bd62debbfca3e55","data":{"imagingDate":"2015-10-28T07:33:17.867Z","notes":"ss","radiologist":"ss","requestedBy":"hradmin","requestedDate":"2015-10-28T07:31:20.891Z","result":"sss","status":"Completed","lastModified":"2015-10-28T07:33:17.868Z","modifiedBy":"hradmin","imagingType":"F51616AE-EB96-2778-824F-386DEAFFD2F9","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"D6938BD3-6346-F62B-8B19-5207B2E5A6AF","modifiedFields":{"radiologist":"2015-10-28T07:31:21.091Z","result":"2015-10-28T07:31:21.091Z","notes":"2015-10-28T07:31:21.091Z","status":"2015-10-28T07:33:17.868Z","requestedBy":"2015-10-28T07:31:21.091Z","requestedDate":"2015-10-28T07:31:21.091Z","imagingDate":"2015-10-28T07:33:17.868Z"},"charges":[]},"_revisions":{"start":2,"ids":["69b11e7856d8b0fc3bd62debbfca3e55","222ad15ae5eed89c6d8abe1c9e07c145"]}},{"_id":"imaging_2_EA6B989C-90B7-2E08-9D8F-CE4339BB9B4B","_rev":"2-63da6e42fb59a811a5468e32bda0eb76","data":{"imagingDate":"2015-10-28T07:33:05.759Z","notes":"hbjn","radiologist":"cgvhbn","requestedBy":"hradmin","requestedDate":"2015-10-28T07:27:44.346Z","result":"fcghvj","status":"Completed","lastModified":"2015-10-28T07:33:05.759Z","modifiedBy":"hradmin","imagingType":"C8826ADA-C3AC-37CD-84AE-FA86A203AC6E","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"74A4EF68-5D8D-BDF6-940F-33E50E50DDEA","modifiedFields":{"radiologist":"2015-10-28T07:27:44.514Z","result":"2015-10-28T07:27:44.514Z","notes":"2015-10-28T07:27:44.514Z","status":"2015-10-28T07:33:05.759Z","requestedBy":"2015-10-28T07:27:44.514Z","requestedDate":"2015-10-28T07:27:44.514Z","imagingDate":"2015-10-28T07:33:05.759Z"},"charges":[]},"_revisions":{"start":2,"ids":["63da6e42fb59a811a5468e32bda0eb76","51a7194f0c4b6b172b5d0b059285e118"]}},{"_id":"invLocation_2_B7B86EC1-6CCE-30B7-B4ED-FF2061879E03","_rev":"3-28a915c1093e6e8497c2742a4806f926","data":{"quantity":950,"location":null,"aisleLocation":null,"lastModified":"2015-10-30T12:44:28.530Z","modifiedBy":"hradmin","modifiedFields":{"quantity":"2015-10-30T12:44:28.530Z"}},"_revisions":{"start":3,"ids":["28a915c1093e6e8497c2742a4806f926","6b49176eeeafb82a88a10aa5d954d965","e7ffcb12925c148d50279cc2ee012d25"]}},{"_id":"invPurchase_2_CDC3AB7D-A0AD-E146-87A4-FDB1096C2EEC","_rev":"2-4f1115c8c7b03b0bf06059d01e5ff7bd","data":{"purchaseCost":4000,"lotNumber":null,"dateReceived":"2015-10-28T22:00:00.000Z","originalQuantity":1000,"currentQuantity":950,"expirationDate":null,"expired":false,"location":null,"aisleLocation":null,"giftInKind":false,"inventoryItem":"igbmk5zf_is","vendor":"Alpha Pharmacy","vendorItemNo":null,"distributionUnit":null,"invoiceNo":null,"lastModified":"2015-10-30T12:44:28.533Z","modifiedBy":"hradmin","modifiedFields":{"dateReceived":"2015-10-29T02:44:10.493Z","purchaseCost":"2015-10-29T02:44:10.493Z","vendor":"2015-10-29T02:44:10.493Z","originalQuantity":"2015-10-29T02:44:10.493Z","currentQuantity":"2015-10-30T12:44:28.533Z","inventoryItem":"2015-10-29T02:44:10.493Z"}},"_revisions":{"start":2,"ids":["4f1115c8c7b03b0bf06059d01e5ff7bd","d0a2104fa76a4161da3f527b23a6d61a"]}},{"_id":"invRequest_2_4691AB2D-AEF3-1AA8-A11E-790BA5788239","_rev":"2-cf9eeeed6d9004aa0479660df622e08c","data":{"adjustPurchases":true,"completedBy":"hradmin","costPerUnit":4,"dateCompleted":"2015-10-29T22:00:00.000Z","dateRequested":"2015-10-29T08:35:51.495Z","deliveryAisle":"C100","deliveryLocation":"Harare","expenseAccount":"Accounts","markAsConsumed":true,"quantity":50,"quantityAtCompletion":1000,"reason":null,"requestedBy":"hradmin","status":"Completed","transactionType":"Fulfillment","lastModified":"2015-10-30T12:44:28.623Z","modifiedBy":"hradmin","inventoryItem":"igbmk5zf_is","patient":null,"visit":null,"locationsAffected":[{"name":"No Location","quantity":50}],"purchasesAffected":[{"id":"CDC3AB7D-A0AD-E146-87A4-FDB1096C2EEC","quantity":50}],"modifiedFields":{"transactionType":"2015-10-30T12:44:28.623Z","quantity":"2015-10-29T08:35:51.497Z","deliveryLocation":"2015-10-29T08:35:51.497Z","deliveryAisle":"2015-10-29T08:35:51.497Z","expenseAccount":"2015-10-29T08:35:51.497Z","dateRequested":"2015-10-29T08:35:51.497Z","requestedBy":"2015-10-29T08:35:51.497Z","status":"2015-10-30T12:44:28.623Z","dateCompleted":"2015-10-30T12:44:28.623Z","adjustPurchases":"2015-10-30T12:44:28.623Z","costPerUnit":"2015-10-30T12:44:28.623Z","quantityAtCompletion":"2015-10-30T12:44:28.623Z","purchasesAffected":"2015-10-30T12:44:28.623Z","locationsAffected":"2015-10-30T12:44:28.623Z","completedBy":"2015-10-30T12:44:28.623Z"}},"_revisions":{"start":2,"ids":["cf9eeeed6d9004aa0479660df622e08c","0e093fbeafc9c59eaeaaf0739ad56e13"]}},{"_id":"inventory_2_igbmk5zf_is","_rev":"2-586df5949f0c9046947fae0fcf009b6f","data":{"description":"Biogesic nga medisina","friendlyId":"m00001","name":"Biogesic","quantity":950,"crossReference":"2600","inventoryType":"Medication","price":5,"reorderPoint":100,"distributionUnit":"tablet","lastModified":"2015-10-30T12:44:28.620Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-29T02:44:10.610Z","inventoryType":"2015-10-29T02:44:10.610Z","crossReference":"2015-10-29T02:44:10.610Z","description":"2015-10-29T02:44:10.610Z","reorderPoint":"2015-10-29T02:44:10.610Z","price":"2015-10-29T02:44:10.610Z","distributionUnit":"2015-10-29T02:44:10.610Z","quantity":"2015-10-30T12:44:28.620Z","friendlyId":"2015-10-29T02:44:10.610Z"},"purchases":["CDC3AB7D-A0AD-E146-87A4-FDB1096C2EEC"],"locations":["B7B86EC1-6CCE-30B7-B4ED-FF2061879E03"]},"_revisions":{"start":2,"ids":["586df5949f0c9046947fae0fcf009b6f","26fffdb13350d70c54f01078f7ea7058"]}},{"_id":"lookup_2_aisle_location_list","_rev":"1-7257ef0f361f763b2692f692dab6bb7c","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["C100"]}},{"_id":"lookup_2_expense_account_list","_rev":"1-bb8267ec5987084be9890734e55df7e0","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Accounts"]}},{"_id":"lookup_2_physician_list","_rev":"1-539fb71896153ad54253f5eb86f508cd","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Dr Test"]}},{"_id":"lookup_2_radiologists","_rev":"6-38c1cbc8559ef893d7ebd043e93ce427","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Mr Test","b","cgvhbn","fcgvb","ss","zinyando"]},"_revisions":{"start":6,"ids":["38c1cbc8559ef893d7ebd043e93ce427","515694dee3f8a35894f6287347485e40","10ef5b07a7d56f64ac26e84507484d41","33cff401403de9c1efd0a9edbec7e50b","cb3dd07e07a6fa2f9e9323b7e15c48fd","864e65b754e2ec13fe2eb8c452bce282"]}},{"_id":"lookup_2_sex","_rev":"1-c433c64d3ecf2a60e4539b1d1dc43d27","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Male"]}},{"_id":"lookup_2_vendor_list","_rev":"1-3b1a6a2565242e3db9cbdb6c579de2af","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Alpha Pharmacy"]}}]}\n{"seq":74}\n{"docs":[{"_id":"lookup_2_visit_location_list","_rev":"1-578a5af6fd231a89f2fdeb1baae7036c","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Harare"]}},{"_id":"lookup_2_warehouse_list","_rev":"1-578a5af6fd231a89f2fdeb1baae7036c","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Harare"]}},{"_id":"patient_2_19A03BBC-71F3-9F39-8B18-15773F446731","_rev":"3-c021a07297d99585de08b3fd96719914","_deleted":true,"_revisions":{"start":3,"ids":["c021a07297d99585de08b3fd96719914","a7323c9135948b4689f52c01826affe2","6ed64fbe474b36dac7c8ac071e33786d"]}},{"_id":"patient_2_2D1BEC2C-EA03-E737-9EC9-D2AEAF2C9EE6","_rev":"2-a587941fb557366a6b87122548a9ba0c","_deleted":true,"_revisions":{"start":2,"ids":["a587941fb557366a6b87122548a9ba0c","0048675586c8e2fd24c8cc2edc545769"]}},{"_id":"patient_2_3C01C5E5-7E64-B147-88F9-D127903B31D7","_rev":"4-be8dd294f8df42bcf220e1a4372340fd","_deleted":true,"_revisions":{"start":4,"ids":["be8dd294f8df42bcf220e1a4372340fd","74d74986cffc330788b0fc5e47f40788","1ed40ad430dba87ec4c0773779fac6aa","34e84dc96007fc737d932ebf875ce340"]}},{"_id":"patient_2_423A476C-2012-6339-8FED-D2E404037268","_rev":"4-263b75936a4ead5058dc1e17535c536c","_deleted":true,"_revisions":{"start":4,"ids":["263b75936a4ead5058dc1e17535c536c","12c22dbd6548922b326bd28b2f05ddb0","a4a9b0e7ed53aea140c1d3259c9b1e94","15ebcd46a46d830899afc17450d4b229"]}},{"_id":"patient_2_519E056C-BF04-2A3F-84D2-8963EAD04261","_rev":"2-13e0330c4610ea3dc8a8dcb64a9b61ae","_deleted":true,"_revisions":{"start":2,"ids":["13e0330c4610ea3dc8a8dcb64a9b61ae","193c2c5d9fcb17698411febac4015547"]}},{"_id":"patient_2_5DD90350-3A67-F3B7-BB4A-A6837A667697","_rev":"2-812e681275f7181b96e1428d5b2eb555","_deleted":true,"_revisions":{"start":2,"ids":["812e681275f7181b96e1428d5b2eb555","a9b1e632e8d3f96d106873396f7f04de"]}},{"_id":"patient_2_63165A06-C866-A0C2-BB43-5DE9A0146737","_rev":"2-5989c5e25baace8df71d475ae164bf40","_deleted":true,"_revisions":{"start":2,"ids":["5989c5e25baace8df71d475ae164bf40","4178d1d23fb9d40a647d573026480dad"]}},{"_id":"patient_2_632DBDA3-5DBF-DDCC-A2C6-915E357319BA","_rev":"2-6ce428f8cdb8d1ea864f976c1ade08e4","_deleted":true,"_revisions":{"start":2,"ids":["6ce428f8cdb8d1ea864f976c1ade08e4","abe897a1411af9ce5df82d2ddbe726f2"]}},{"_id":"patient_2_688E30F1-E068-A2E3-8986-C224AF671CDD","_rev":"2-cb950343c60eb7116359fb50dc58fb87","_deleted":true,"_revisions":{"start":2,"ids":["cb950343c60eb7116359fb50dc58fb87","949f54bb01a90f17a91a7b392aecd58e"]}},{"_id":"patient_2_694DF805-F7CD-9513-9EF5-4CF8EE009BE9","_rev":"2-005d256252779d14fb83b9614a75d84f","_deleted":true,"_revisions":{"start":2,"ids":["005d256252779d14fb83b9614a75d84f","79cbdb6ba8075de8b19b61f4ebd194b2"]}},{"_id":"patient_2_9C269C48-EE3E-FBEC-9371-A235EEFDA40E","_rev":"2-6d94af1fdf669e3d012e3370c17c7d0f","_deleted":true,"_revisions":{"start":2,"ids":["6d94af1fdf669e3d012e3370c17c7d0f","ba40f943d16f3594cdf2a1c0e7ce36eb"]}},{"_id":"patient_2_9ED02049-6F10-E89D-9BAA-9C113B3AA6E4","_rev":"2-472c94a0e9c78fde3be4c15a71e0f336","_deleted":true,"_revisions":{"start":2,"ids":["472c94a0e9c78fde3be4c15a71e0f336","c61b0ba276e4c88cfda15ae4b5d0768b"]}},{"_id":"patient_2_B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","_rev":"2-fdce7421d92a349d7b613a90d86dbef1","data":{"admitted":false,"address":null,"address2":null,"address3":null,"address4":null,"bloodType":null,"clinic":null,"country":null,"dateOfBirth":null,"economicClassification":null,"email":null,"externalPatientId":null,"familySupport1":null,"familySupport2":null,"familySupport3":null,"familySupport4":null,"familySupport5":null,"friendlyId":"P00017","firstName":"Lennex","sex":"Male","history":null,"insurance":null,"lastName":"Zinyando","livingArrangement":null,"middleName":"","notes":null,"otherIncome":null,"patientType":null,"parent":null,"phone":null,"placeOfBirth":null,"referredDate":null,"referredBy":null,"religion":null,"socialActionTaken":null,"socialRecommendation":null,"status":null,"lastModified":"2016-02-22T21:32:30.568Z","modifiedBy":"Admin User","paymentProfile":null,"payments":[],"modifiedFields":{"friendlyId":"2015-10-06T10:56:52.507Z","firstName":"2015-10-06T10:56:52.507Z","middleName":"2015-10-06T10:56:52.507Z","lastName":"2015-10-06T10:56:52.507Z","sex":"2016-02-22T21:32:30.568Z"}},"_revisions":{"start":2,"ids":["fdce7421d92a349d7b613a90d86dbef1","e5548781a44e741ceac358e5e3413d76"]}},{"_id":"patient_2_BB4E9598-BD8B-528B-9D9E-AD9C3980787B","_rev":"3-957a69aebfae063d61ee8aaa55006803","_deleted":true,"_revisions":{"start":3,"ids":["957a69aebfae063d61ee8aaa55006803","0345093ba84e9c117c7dbb94b45edb8f","3e24d132e3bcc29db9d41a4d9f4296bf"]}},{"_id":"patient_2_C0361670-8B10-F212-9F51-B889D5BF92DF","_rev":"2-7b2217e2c2cb01610c32e0de44910282","_deleted":true,"_revisions":{"start":2,"ids":["7b2217e2c2cb01610c32e0de44910282","13ecb169a07f0e5a78a11209c26ede78"]}},{"_id":"patient_2_C680710A-BFBB-2868-8E5E-F4DD648CA24E","_rev":"2-d9acde506f230ec53a1cff9c97fe58bf","_deleted":true,"_revisions":{"start":2,"ids":["d9acde506f230ec53a1cff9c97fe58bf","9d954090afc2085fb97060446f8e4da0"]}},{"_id":"patient_2_E011AC5D-6F55-A16E-AB47-148E418071EE","_rev":"2-c263c9e9cf93e6d7b98f445b0d800809","_deleted":true,"_revisions":{"start":2,"ids":["c263c9e9cf93e6d7b98f445b0d800809","66c46fd3db8b057d58a35aba6ca99a5a"]}},{"_id":"patient_2_E54A8685-A36F-D1D1-B938-080545EABD0E","_rev":"2-a53992302cf7a33bad522d2dc5835b6e","_deleted":true,"_revisions":{"start":2,"ids":["a53992302cf7a33bad522d2dc5835b6e","5cebaf4e3ffef745a70ef22a1be1f0e8"]}},{"_id":"patient_2_E5EF1B7A-51B7-1610-BFBA-B1B21365C574","_rev":"2-182384c7dc0a26973583a692bfecbce8","_deleted":true,"_revisions":{"start":2,"ids":["182384c7dc0a26973583a692bfecbce8","497eb6ebf5074eeb32e2c02aab754a18"]}},{"_id":"patient_2_F3AA5446-1DE5-AC50-B9CF-B0D491E1D45E","_rev":"2-036325f33884580d2785dadf44527e25","_deleted":true,"_revisions":{"start":2,"ids":["036325f33884580d2785dadf44527e25","9eb866d5ca50209aec98d96470acce98"]}},{"_id":"photo_2_CF5189F1-5BDA-6896-B350-6A1A9B6A217B","_rev":"3-82a9b8e6b9f827259083f9bc560d9ee6","_deleted":true,"_revisions":{"start":3,"ids":["82a9b8e6b9f827259083f9bc560d9ee6","ee9b1e0283b24f4a02b00f92ed70f0ab","5ee18d0589c4ac578fe4e8a5350f725b"]}},{"_id":"photo_2_D2B805B1-8F22-B5D2-956B-AFF6372D18FF","_rev":"3-734e1f5956d3d438f8ba6e187aa4d97f","_deleted":true,"_revisions":{"start":3,"ids":["734e1f5956d3d438f8ba6e187aa4d97f","f574559c84a634ca88d1d10d41c93953","112ad019aa78ef8e06584c9109a9a850"]}},{"_id":"pricing_2_22208FBE-9C6E-079D-A1E6-A562F9310FE5","_rev":"1-7f1b8398ae5dbed5782085efbfdf5ee8","data":{"category":"Imaging","expenseAccount":null,"name":"New","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-15T09:39:37.879Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-15T09:39:37.879Z","category":"2015-10-15T09:39:37.879Z","pricingType":"2015-10-15T09:39:37.879Z"},"pricingOverrides":[]}},{"_id":"pricing_2_4CEB69E7-B54A-9D45-B0EF-7643F0D48FA0","_rev":"1-866a210b1d9063493c97d580845fc13d","data":{"category":"Imaging","expenseAccount":null,"name":"New","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-15T10:37:57.867Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-15T10:37:57.867Z","category":"2015-10-15T10:37:57.867Z","pricingType":"2015-10-15T10:37:57.867Z"},"pricingOverrides":[]}},{"_id":"pricing_2_B492AA26-22F2-52A9-93C7-17106A57A62E","_rev":"1-a03187de833a34d46302b5a740244353","data":{"category":"Imaging","expenseAccount":null,"name":"fghj","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-22T07:08:38.099Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-22T07:08:38.099Z","category":"2015-10-22T07:08:38.099Z","pricingType":"2015-10-22T07:08:38.099Z"},"pricingOverrides":[]}},{"_id":"pricing_2_C8826ADA-C3AC-37CD-84AE-FA86A203AC6E","_rev":"1-fcefadf7300a60430090a0b91df95cce","data":{"category":"Imaging","expenseAccount":null,"name":"dfghn","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-28T07:27:44.358Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-28T07:27:44.358Z","category":"2015-10-28T07:27:44.358Z","pricingType":"2015-10-28T07:27:44.358Z"},"pricingOverrides":[]}},{"_id":"pricing_2_CBB4C9D5-CE8C-2BB5-86F4-3FC16AE2E85D","_rev":"1-a34a6a2d89ae9d5cd57f532f8db1b02f","data":{"category":"Imaging","expenseAccount":null,"name":"hg","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-26T11:49:08.235Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-26T11:49:08.235Z","category":"2015-10-26T11:49:08.235Z","pricingType":"2015-10-26T11:49:08.235Z"},"pricingOverrides":[]}},{"_id":"pricing_2_E53305F3-BA40-B305-B2DC-0732C7AB0042","_rev":"1-5b2724a6d2dce84919a16388a8983a49","data":{"category":"Imaging","expenseAccount":null,"name":"Scan","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-28T07:23:34.851Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-28T07:23:34.851Z","category":"2015-10-28T07:23:34.851Z","pricingType":"2015-10-28T07:23:34.851Z"},"pricingOverrides":[]}},{"_id":"pricing_2_F51616AE-EB96-2778-824F-386DEAFFD2F9","_rev":"1-13d626d1730a99b3da4dee1a25146ddd","data":{"category":"Imaging","expenseAccount":null,"name":"sss","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-28T07:31:20.903Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-28T07:31:20.903Z","category":"2015-10-28T07:31:20.903Z","pricingType":"2015-10-28T07:31:20.903Z"},"pricingOverrides":[]}},{"_id":"sequence_2_inventory_Medication","_rev":"1-1acccea88a50973cbe8840a31911aa7c","data":{"prefix":"m","value":1}},{"_id":"sequence_2_patient","_rev":"130-943328c138b701637a579574f516e90b","data":{"prefix":null,"value":130},"_revisions":{"start":130,"ids":["943328c138b701637a579574f516e90b","b527a87cb4f86205dcc62a9ea0fa7a63","973262d1b9be91e82f997cf103481c55","44582fef141bcd8b558595514d3ba0ff","4a8d8f8ca25aa960aef16e5c1e489b81","2a48a9bc803b0d60b5018c07017aedeb","fe6186b5bd38fce211c0dc76ef4a619b","4d41059d2cd8accf225fce92edbbc428","449ad29c390c73126670290e2a351dce","ef33fac6f75c92df977deadcefd2ea21","bde0d0a9a34c662a05458f1d379c6038","4e2b60d439b5001f0562aaa5e836de72","9b7cf30a3a428b0ffbc5c08469b60dc4","fdfa70107c954a955eddc00f1710a412","acb0081b558f7dfc06520ce59abdca9d","b611e8c2f6823f040262e4e983aa8b3e","803c06167d785dca413153687432b9da","e2c71646996df37f91cabb3881395db4","e07b6a9914e89ef9b68e6412801e47db","5c4e63e3ec27823d46d7048c34f1035c","85c90147d202a4eb1a047e2633fdc911","e7dae8e43e473a4b347f5c22161844b4","471182bdd694919456395e3b8ee81d85","c45ce9b872e266344359c0637f9dd5d0","962ad8bf64b30813c4fef6958e83e3f3","5b281c4ea003d026419d35d05dd0b87a","9ed77096845040620cd2354c1ed74001","409143da04d5575669e515f6214f6220","c35ff5c786890aa0005b360749cefdd2","48cba21a512868f2c8e3beb5646ff1c1","58fcaf249567f43db62a1c77a1440b8e","71c619fe66ac2a2246708c6733e7af9e","0e2a21c17d44457443a58dd2db6824fb","7449d0f1ba104902ca08b888dfdc546f","20f7d87b7b4a5326bb93f84c11ae627d","bef379849a35ec5a7408f26a83026e2b","5dd124839c582c23e9279eda6f821796","15a041f1e149ae2989eba580b93969b0","93e7694e1741666512f83bd1bd5064f3","002edd9949b2993af6ce18817d0bc666","a8795752b4a5c9e587d5bbbd05ef41d4","c6f60912813f86724b49110221b713fe","728c2adfea6754b048f7acae42edd25f","b1ddbe8c27e77a561d22fec546349409","923830cdb237b3ba2088779642bca716","85f7e7891658b988333439ee84dfcd39","a52f2c92c951c2c7266a9ad170d3ae9d","79cfca9fdd7b6cdae2396862f103599e","87221151cfb4cb5bbdf73eb694a7eb34","f1c5faf2bc8f82ec5a29071b6156e5e2","84612c5298273469c586955ee8427555","cc81c865b33cf6d967bde9ff60b9af6d","8b16de2d23b9c7e216215085a08caea8","8be1c3c951d7c2355f910f785cac2534","696488469a9aa721643875029f6de938","04ffb420af095d229c45a69d0e1c56c2","f8fc0538d0eacb22a767c9eb449f4c84","6adb4264d4dd3b13829ffc7e17ba58c2","f50856bf682db17eee3d3cafb366a6be","743e61dcfce262c16251ed396ee76eb7","4fcdf09a763ec5da89d41dab6dd9edc8","912874972749c40ea838145828c14173","fd8c5a0d7662b27c8cbdfbfdd45ee32d","173fe5c207973de53fd984078bbd73a2","4e9ef14c62f9312cd0fb1b47e7fabe1e","ce6f1f9584656970cfd92f1e361e2fed","cf8cf83cf02c266b75af0bc69467a07f","5816c2ba418d387facd7b6ed0a0e6054","b3839c763f128f2ccf99cfb874a2413e","68b05605500c0109d046a56680a5a7a1","a13d320fed2c85ed0b173d6645ec0274","ba1dad02a90e4ac18632c1a53a90b759","c5e7e81e97d0fc7d0797bd9822685176","b580fcf4f4291b408f4dda64a4bdec96","bb1a562af157e3c24d23c3e2f1171b29","e9f245d9566dd9e116caf7d074792d36","30b587f2b5204d237572c86a545756fb","7df53a1742b52647118fec21f331e94d","0a4c120f78fa5899d0cea5d87d92c9b0","e62f1b02721a75fd1ea290da9acdc199","3e39b429ea4cda00c9ac9d3f0b61029c","038d82911c8979c0cd58e807871a09ca","618d916a14cfa55aa8e65d42b3761ca5","8d24a6b355e64a680f0f03ab0f738b8c","999e1fa6e5175dad02e4f2db0cd41843","782e7a1c4097f1aa1d117a7fbd01c443","67b3c03ea8609652c494a22242ce5a1f","3b1fc1b83a352ef9c672110a69306064","8a0da1966531daede44592906bf8df99","279e844131c96ca7b647cacfa3508022","42733f5f658de7ee440c02286fd4e21c","e3a50044a3cb2ac901b5b65653d0fc7f","b7fb5627bee7f642f8e608be1bb1e859","2fdb16832a0ed61b7f9e780750b70898","e38f4adbab987a8c628599ea9052ca44","7ece3f9fcff7b57b28f1237ba1107a0f","8fb6c171e3c6a345d199a8884e42951a","c76709145ca58dfcf67c1f397b772689","76182e657f0b0aa6fa07bf5491d2b427","ab161b88c332f3df338f1f4aa2b2e307","e00a3184b07c0459cf4ebdeb825f991f","cee6a3aac677927abaf3ae61508954a2","86bed2b62e1e6b6f98790ecafefcc17f","ae44899fdbc41d69076ec6a8f7563181","61cce97f5cd6ff092f28fe9ec9da4f27","f9008b952322c32322ef0e7e42fdf383","8fdecd159563a90d7cbc9c9aedc3068f","9b1f0f8f0e4db1f8931d290966f3bc3c","a9b5402ea07343a1b6d5612312e07a34","25ef3d2573778c3ebda4ef7860fe310f","3e39e8d6ceabb2079042e81613858906","b4e15c555737aa9573724407ce84b667","b2538362e8afb57e3e11e5231ae60d5d","04add3d3926f54232b0e0ed7a9fc141a","e924dcf4bb51c7c552538273e08901bb","77b6f226033c656d3a9768085ff3e80a","676dd4835b46e8f62ec2ce5908d1c60a","762481b2c71611cce80a5a9ef03aa48d","b9b73bf1d2df1598cc164089375ed7bc","0a581f677e6d8f7a484fa0a80156d95b","6b51cfdb83336973df284e4d5c2f308b","4a27247e93fabb86b6a5a9676f47ec8e","8b542908965798dd683a68f507635a83","515d8987a1e11acb866ede87612b53b1","d19e3759adc65398cf6a42a61345cdae","ac63c129bee25dc4c59a639e2721fb81","17c1209032c06df436ad0a4fa76723cc","f0ef6923c78e739d9228517a4813b646","f9a8fd6c55cd4e5fb0064b7767586e05","5bc31ffefa482f2e66299cf0704623c8"]}},{"_id":"visit_2_0BD42BD9-0E5D-0533-A8FA-1C0ADB0F0D65","_rev":"2-0ddd43cbcc57cc5d6ff082a283d881ac","data":{"dischargeInfo":null,"endDate":"2015-10-15T10:37:57.902Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-15T10:37:57.902Z","status":null,"visitType":"Imaging","lastModified":"2015-10-15T10:37:57.915Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-15T10:37:57.915Z","endDate":"2015-10-15T10:37:57.915Z","outPatient":"2015-10-15T10:37:57.915Z","visitType":"2015-10-15T10:37:57.915Z"},"charges":[],"imaging":["1AC1DD3D-E7E7-15B4-A698-8A8AE62749EB"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["0ddd43cbcc57cc5d6ff082a283d881ac","e4540f9cf2a236335662116d4e0a66da"]}},{"_id":"visit_2_377AA288-AAD4-F60B-ABD1-B5A0B9C75D50","_rev":"2-ee5b0686e20e1011d11b3051b93e7a93","data":{"dischargeInfo":null,"endDate":"2015-10-15T09:39:37.940Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-15T09:39:37.940Z","status":null,"visitType":"Imaging","lastModified":"2015-10-15T09:39:37.948Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-15T09:39:37.948Z","endDate":"2015-10-15T09:39:37.948Z","outPatient":"2015-10-15T09:39:37.948Z","visitType":"2015-10-15T09:39:37.948Z"},"charges":[],"imaging":["07CC6746-C7D9-A410-9B8C-C4B4E095A96D"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["ee5b0686e20e1011d11b3051b93e7a93","5fee255cf57220ddf1c19977118a540e"]}},{"_id":"visit_2_6AD00ED1-670A-2C3F-BC10-0742B1F99264","_rev":"2-9bf9856192b6c8ef34d2fcdb27296593","data":{"dischargeInfo":null,"endDate":"2015-10-28T07:39:18.257Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-28T07:39:18.257Z","status":null,"visitType":"Imaging","lastModified":"2015-10-28T07:39:18.275Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-28T07:39:18.275Z","endDate":"2015-10-28T07:39:18.275Z","outPatient":"2015-10-28T07:39:18.275Z","visitType":"2015-10-28T07:39:18.275Z"},"charges":[],"imaging":["91B061E9-2986-D539-90C8-CD14EC2010B0"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["9bf9856192b6c8ef34d2fcdb27296593","e50477b58f5edd257b9ce20ea65b1bca"]}},{"_id":"visit_2_74A4EF68-5D8D-BDF6-940F-33E50E50DDEA","_rev":"2-c24a52b04610b293fff293b18dd0bb15","data":{"dischargeInfo":null,"endDate":"2015-10-28T07:27:44.394Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-28T07:27:44.394Z","status":null,"visitType":"Imaging","lastModified":"2015-10-28T07:27:44.406Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-28T07:27:44.406Z","endDate":"2015-10-28T07:27:44.406Z","outPatient":"2015-10-28T07:27:44.406Z","visitType":"2015-10-28T07:27:44.406Z"},"charges":[],"imaging":["EA6B989C-90B7-2E08-9D8F-CE4339BB9B4B"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["c24a52b04610b293fff293b18dd0bb15","5a6ae8f033eb99448ad898f164d822e8"]}},{"_id":"visit_2_9F1A65ED-683F-056E-8D50-A8AF63201CE2","_rev":"2-e19734a8deff62722e6e023af4b8e130","data":{"dischargeInfo":null,"endDate":"2015-10-22T07:08:38.175Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-22T07:08:38.175Z","status":null,"visitType":"Imaging","lastModified":"2015-10-22T07:08:38.189Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-22T07:08:38.189Z","endDate":"2015-10-22T07:08:38.189Z","outPatient":"2015-10-22T07:08:38.189Z","visitType":"2015-10-22T07:08:38.189Z"},"charges":[],"imaging":["D0F299E4-CD8D-557D-8C23-216FD23EF844"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["e19734a8deff62722e6e023af4b8e130","bd81a41820526c8c0450ee544867c6fa"]}},{"_id":"visit_2_C5C296AC-E238-CBA5-8DD8-99942843BC5A","_rev":"2-57e6740d8dac593d790cd7f76c4ad0c3","data":{"dischargeInfo":null,"endDate":"2015-10-26T11:49:08.277Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-26T11:49:08.277Z","status":null,"visitType":"Imaging","lastModified":"2015-10-26T11:49:08.282Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-26T11:49:08.282Z","endDate":"2015-10-26T11:49:08.282Z","outPatient":"2015-10-26T11:49:08.282Z","visitType":"2015-10-26T11:49:08.282Z"},"charges":[],"imaging":["4A7FC838-0B37-E151-AFD8-8DBAC9DE9D99"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["57e6740d8dac593d790cd7f76c4ad0c3","253e8d9f8c0865cb3e9ffd1f6849bcde"]}},{"_id":"visit_2_CBFA5C2C-191D-FC9C-AD19-14D26D5A3003","_rev":"2-f781f118fd87b036d8cbfbf7771cda99","data":{"dischargeInfo":null,"endDate":"2015-10-28T07:23:34.906Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-28T07:23:34.906Z","status":null,"visitType":"Imaging","lastModified":"2015-10-28T07:23:34.914Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-28T07:23:34.914Z","endDate":"2015-10-28T07:23:34.914Z","outPatient":"2015-10-28T07:23:34.914Z","visitType":"2015-10-28T07:23:34.914Z"},"charges":[],"imaging":["51D8DC28-78EB-62B1-942A-1158F5862F34"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["f781f118fd87b036d8cbfbf7771cda99","e2b8bf1f76ea01c32b414c184905511e"]}},{"_id":"visit_2_D6938BD3-6346-F62B-8B19-5207B2E5A6AF","_rev":"2-631f62b5121ccfcd1a8de2bc9d3d252f","data":{"dischargeInfo":null,"endDate":"2015-10-28T07:31:20.941Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-28T07:31:20.941Z","status":null,"visitType":"Imaging","lastModified":"2015-10-28T07:31:20.953Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-28T07:31:20.953Z","endDate":"2015-10-28T07:31:20.953Z","outPatient":"2015-10-28T07:31:20.953Z","visitType":"2015-10-28T07:31:20.953Z"},"charges":[],"imaging":["DBE152F6-9508-2E12-81AC-39BC2CAFE08C"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["631f62b5121ccfcd1a8de2bc9d3d252f","8b46887d52e3043d742262fc03ff48b8"]}}]}\n{"seq":115}\n';});
define('hospitalrun/tests/fixtures/billing', ['exports'], function (exports) {
  exports['default'] = '{"version":"1.2.5","db_type":"http","start_time":"2017-03-16T14:29:40.358Z","db_info":{"db_name":"main","doc_count":88,"doc_del_count":5,"update_seq":117,"purge_seq":0,"compact_running":false,"disk_size":131176,"data_size":60390,"instance_start_time":"1489674509261595","disk_format_version":6,"committed_update_seq":117,"host":"http://localhost:5984/main/","auto_compaction":false,"adapter":"http"}}\n{"docs":[{"_id":"_design/custom_form_by_type","_rev":"1-ddf0ee75c1e8e859d821a9f5c1ec43b6","version":1,"views":{"custom_form_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'customForm\') {\\n        emit(doc.data.formType);\\n      }\\n    }\\n  }"}}}]}\n{"seq":4}\n{"docs":[{"_id":"_design/inventory_by_friendly_id","_rev":"1-82e24378f074a284cae14da4db5431ed","version":1,"views":{"inventory_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}}]}\n{"seq":6}\n{"docs":[{"_id":"_design/appointments_by_date","_rev":"1-5df29f1d7dbd39d6b3a2145923ab73cf","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["5df29f1d7dbd39d6b3a2145923ab73cf"]}},{"_id":"_design/appointments_by_date","_rev":"2-28b4bff0597e8254f67140d44550b806","_deleted":true,"_revisions":{"start":2,"ids":["28b4bff0597e8254f67140d44550b806","178add045be11a7fd6aa7fdf97c8f3f0"]}},{"_id":"_design/appointments_by_date","_rev":"2-1fc384eae57485ff9100c0614780ab62","_deleted":true,"_revisions":{"start":2,"ids":["1fc384eae57485ff9100c0614780ab62","03951858f9232df2e774548b0f5fd068"]}},{"_id":"_design/appointments_by_date","_rev":"3-461875fa3e8aa582009473a4ebccf3bb","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":3,"ids":["461875fa3e8aa582009473a4ebccf3bb","2e78ab0f6da3881df4871d0b028148b9","4c8dd95ad6d36b9b4d86136d5e417f5c"]}},{"_id":"_design/appointments_by_patient","_rev":"2-a8bb26daf0329c069a18ec0ce64532cb","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate,doc._id]);}}}"}},"_revisions":{"start":2,"ids":["a8bb26daf0329c069a18ec0ce64532cb","9868b6586898a48c3fd68722ca3fe1d4"]}},{"_id":"_design/appointments_by_patient","_rev":"2-3f36f32ad4537056da92d236724bcbe9","_deleted":true,"_revisions":{"start":2,"ids":["3f36f32ad4537056da92d236724bcbe9","7232d3292344540b2511e709422e2cbf"]}},{"_id":"_design/appointments_by_patient","_rev":"2-f03ac9b51ff8ff5d0ac0c2dcbf275311","_deleted":true,"_revisions":{"start":2,"ids":["f03ac9b51ff8ff5d0ac0c2dcbf275311","9a97acd5b8fd071ad81afc9e730721c5"]}},{"_id":"_design/closed_incidents_by_user","_rev":"1-bf16176c13be57af9a4f1a0980710190","version":1,"views":{"closed_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status === \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}}},{"_id":"_design/imaging_by_status","_rev":"2-57660077d48a8a4a0c1a3dd6ae214aac","version":4,"views":{"imaging_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"imaging\\") {var imagingDate = doc.data.imagingDate;if (imagingDate && imagingDate !== \\"\\") {imagingDate = new Date(imagingDate);if (imagingDate.getTime) {imagingDate = imagingDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, imagingDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["57660077d48a8a4a0c1a3dd6ae214aac","9236042e1fb9f567d1d527bbb429cd8e"]}},{"_id":"_design/imaging_by_status","_rev":"2-c13cdf46b0ada4601e71c65353dae3df","_deleted":true,"_revisions":{"start":2,"ids":["c13cdf46b0ada4601e71c65353dae3df","1a3bab3d2d1403299a9e4ad8dffe5fa1"]}},{"_id":"_design/imaging_by_status","_rev":"2-416ed7687768844c4164283d01161e16","_deleted":true,"_revisions":{"start":2,"ids":["416ed7687768844c4164283d01161e16","2feb5103c3f6d149bf98f0adeaa76b38"]}},{"_id":"_design/incident_by_date","_rev":"1-59fa59734ee129cff0560b20a95d2d4e","version":1,"views":{"incident_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        var dateOfIncident = doc.data.dateOfIncident;\\n    if (dateOfIncident && dateOfIncident !== \\"\\") {\\n      dateOfIncident = new Date(dateOfIncident);\\n      if (dateOfIncident.getTime) {\\n        dateOfIncident = dateOfIncident.getTime();\\n      }\\n    }\\n    emit([dateOfIncident, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/incident_by_friendly_id","_rev":"1-885a12b67da47e956bc190fe1fe0d4e6","version":1,"views":{"incident_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_by_name","_rev":"2-434f4cb5ef0baef4dddaf2c1914d2f0e","_deleted":true,"_revisions":{"start":2,"ids":["434f4cb5ef0baef4dddaf2c1914d2f0e","91f55ae6bd30f766d9da95bffe054bcb"]}},{"_id":"_design/inventory_by_name","_rev":"2-6970ab89b44af8c2703a89d6dea9b20b","_deleted":true,"_revisions":{"start":2,"ids":["6970ab89b44af8c2703a89d6dea9b20b","304304d63beaffd8d1ae4ae1cddf4b2b"]}},{"_id":"_design/inventory_by_name","_rev":"2-6993fbc5ef18283f83c6afe5be9a9351","version":5,"views":{"inventory_by_name":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.name, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["6993fbc5ef18283f83c6afe5be9a9351","c12e4467c9c3ecc8021b660934257f25"]}},{"_id":"_design/inventory_by_type","_rev":"1-65423cfcd4b0acd93b58aa2003907c92","version":5,"views":{"inventory_by_type":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit(doc.data.inventoryType);}}}"}},"_revisions":{"start":1,"ids":["65423cfcd4b0acd93b58aa2003907c92"]}},{"_id":"_design/inventory_by_type","_rev":"2-2f0df4e3dc8ba6d384f896efd4a272cf","_deleted":true,"_revisions":{"start":2,"ids":["2f0df4e3dc8ba6d384f896efd4a272cf","003ef699ab0f2b8628c0bf613fabf7a2"]}},{"_id":"_design/inventory_by_type","_rev":"2-a5cd4eb9d62940627bd99b9e73cd7b15","_deleted":true,"_revisions":{"start":2,"ids":["a5cd4eb9d62940627bd99b9e73cd7b15","18455500e1e86544edceaab01bb511bc"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-823be94576112c800022b256ccd9b725","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var dateReceived = doc.data.dateReceived;if (dateReceived && dateReceived !== \\"\\") {dateReceived = new Date(dateReceived);if (dateReceived.getTime) {dateReceived = dateReceived.getTime();}}emit([dateReceived, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["823be94576112c800022b256ccd9b725"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"2-65f020065c11403193b02742a05b91ae","_deleted":true,"_revisions":{"start":2,"ids":["65f020065c11403193b02742a05b91ae","78939ec45bef330bbfa87763dbbfce37"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"2-392c104e0d9eac6f20948f0d97dd192d","_deleted":true,"_revisions":{"start":2,"ids":["392c104e0d9eac6f20948f0d97dd192d","0d7b597aeae746589980b12903768252"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-7aea58304996ccb168865141592a024f","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var expirationDate = doc.data.expirationDate;if (expirationDate && expirationDate !== \\"\\") {expirationDate = new Date(expirationDate);if (expirationDate.getTime) {expirationDate = expirationDate.getTime();}}emit([expirationDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7aea58304996ccb168865141592a024f"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"2-9da617bbfd6e7355864c21be36c690c4","_deleted":true,"_revisions":{"start":2,"ids":["9da617bbfd6e7355864c21be36c690c4","1f41dd6d030c58884d7013ef9436decb"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"2-d900cddd5fcc673d77fbd2f6d783475d","_deleted":true,"_revisions":{"start":2,"ids":["d900cddd5fcc673d77fbd2f6d783475d","17bd9d3619ae03155d9929d3ebcd5023"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-e9eb2d7f1e35296646399c7414525c33","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);}}}"}},"_revisions":{"start":1,"ids":["e9eb2d7f1e35296646399c7414525c33"]}},{"_id":"_design/inventory_request_by_item","_rev":"2-81a90ac8fc850741d7f64b4fbd9df7e0","_deleted":true,"_revisions":{"start":2,"ids":["81a90ac8fc850741d7f64b4fbd9df7e0","021f4c24b5b6202594f610cf5d4c63a4"]}},{"_id":"_design/inventory_request_by_item","_rev":"2-c2f0efb7a0a9b3ece1cf9b7b0e88d37f","_deleted":true,"_revisions":{"start":2,"ids":["c2f0efb7a0a9b3ece1cf9b7b0e88d37f","7e7ef275a9fc15f2b5f328b1479c6097"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-f4a7252ebf2802c53a572bf150eae05c","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.status, dateCompleted, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["f4a7252ebf2802c53a572bf150eae05c"]}},{"_id":"_design/inventory_request_by_status","_rev":"2-0338b756f9c3471052577cadc4ed9505","_deleted":true,"_revisions":{"start":2,"ids":["0338b756f9c3471052577cadc4ed9505","187394c79d3206e11e112891f0d63550"]}},{"_id":"_design/inventory_request_by_status","_rev":"2-530bd2809cbceb7392fdb758d496fd29","_deleted":true,"_revisions":{"start":2,"ids":["530bd2809cbceb7392fdb758d496fd29","cc0c1e0e01060aa62456d6ea768d8ec7"]}},{"_id":"_design/invoice_by_patient","_rev":"1-a491390f74ce432d9cfab78291e0753b","version":1,"views":{"invoice_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":1,"ids":["a491390f74ce432d9cfab78291e0753b"]}},{"_id":"_design/invoice_by_patient","_rev":"2-6f4cea4e5d7ba4aa3ed8d0ab6bb052af","_deleted":true,"_revisions":{"start":2,"ids":["6f4cea4e5d7ba4aa3ed8d0ab6bb052af","9f67a58d4e428614844ac82cb2548268"]}},{"_id":"_design/invoice_by_status","_rev":"2-d88d6c08ad0c49ed6d2b3a55a0268931","_deleted":true,"_revisions":{"start":2,"ids":["d88d6c08ad0c49ed6d2b3a55a0268931","25a58e1cec7f01d0a7e8da1293f59b69"]}},{"_id":"_design/invoice_by_status","_rev":"2-072e2f7f1519a12260fe98c90f794b06","version":4,"views":{"invoice_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {var billDate = doc.data.billDate;if (billDate && billDate !== \\"\\") {billDate = new Date(billDate);if (billDate.getTime) {billDate = billDate.getTime();}}emit([doc.data.status, billDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["072e2f7f1519a12260fe98c90f794b06","73e3e45673ed0c4f4ae1cee855f216f0"]}},{"_id":"_design/invoice_by_status","_rev":"2-7850ddbe88cf85231bfe32a1f996f093","_deleted":true,"_revisions":{"start":2,"ids":["7850ddbe88cf85231bfe32a1f996f093","d411e6f66f897f0b9b985dc6e5188d85"]}},{"_id":"_design/lab_by_status","_rev":"2-a3e2e3df161e7880986b81f873a974d5","_deleted":true,"_revisions":{"start":2,"ids":["a3e2e3df161e7880986b81f873a974d5","7d4de6e219b482171b7ecd485ef72238"]}},{"_id":"_design/lab_by_status","_rev":"2-9a69b9bd5a85bd3ae2a6659abbb13d83","_deleted":true,"_revisions":{"start":2,"ids":["9a69b9bd5a85bd3ae2a6659abbb13d83","16b2c13356e8dac3b3594018f91cccfb"]}},{"_id":"_design/lab_by_status","_rev":"2-ef5e8b51b3704c0cb1e525a63c81bd80","version":4,"views":{"lab_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"lab\\") {var labDate = doc.data.labDate;if (labDate && labDate !== \\"\\") {labDate = new Date(labDate);if (labDate.getTime) {labDate = labDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, labDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["ef5e8b51b3704c0cb1e525a63c81bd80","db4393c6856b98a40afd6ceef31db2a7"]}},{"_id":"_design/medication_by_status","_rev":"2-79762c4d3cd11ead2ca9150d49b87908","_deleted":true,"_revisions":{"start":2,"ids":["79762c4d3cd11ead2ca9150d49b87908","09e1d1c201823532161ef48ba23200be"]}},{"_id":"_design/medication_by_status","_rev":"2-05c7746b86e7abeadba7b3b5b512a03f","_deleted":true,"_revisions":{"start":2,"ids":["05c7746b86e7abeadba7b3b5b512a03f","a6403c53b2db46905b3b1861120c6601"]}},{"_id":"_design/medication_by_status","_rev":"2-9dec70f4b5aeaf7d9b8d70719125c41c","version":4,"views":{"medication_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"medication\\") {var prescriptionDate = doc.data.prescriptionDate;if (prescriptionDate && prescriptionDate !== \\"\\") {prescriptionDate = new Date(prescriptionDate);if (prescriptionDate.getTime) {prescriptionDate = prescriptionDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["9dec70f4b5aeaf7d9b8d70719125c41c","36ce9e9853552f5eb646ed26de7184dc"]}},{"_id":"_design/open_incidents_by_user","_rev":"1-34770efd210920a30c96d3787521e8a5","version":1,"views":{"open_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status !== \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      }\\n      return 0; // Don\'t sort\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/patient_by_admission","_rev":"2-cb3270a3d44a370d50128b93179d3503","version":4,"views":{"patient_by_admission":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.admitted === true) {\\n      if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["cb3270a3d44a370d50128b93179d3503","ee7b6ead26ac6b8b3f106c6d85dc175b"]}},{"_id":"_design/patient_by_admission","_rev":"2-0c4a20f605b836224bc438f1bca26c9b","_deleted":true,"_revisions":{"start":2,"ids":["0c4a20f605b836224bc438f1bca26c9b","3c2da4380d257c95ebf4430afa48de3b"]}},{"_id":"_design/patient_by_display_id","_rev":"2-eae82996b36349ac1fce13b33546eaec","_deleted":true,"_revisions":{"start":2,"ids":["eae82996b36349ac1fce13b33546eaec","0b75ee7c82a1aadebd0bc0fd403622fb"]}},{"_id":"_design/patient_by_display_id","_rev":"2-04967bcb87fd6a7fffc0d779044dd0b8","_deleted":true,"_revisions":{"start":2,"ids":["04967bcb87fd6a7fffc0d779044dd0b8","6f596cec9eb82609308fd9d25a9f9df2"]}},{"_id":"_design/patient_by_display_id","_rev":"2-0d054f7b541c310fdc1c7994ee2ccd49","_deleted":true,"_revisions":{"start":2,"ids":["0d054f7b541c310fdc1c7994ee2ccd49","8a6930002af6d588ecdedd5f07da0230"]}},{"_id":"_design/patient_by_display_id","_rev":"2-88a46c350d8994362cc0e5910f15d726","version":7,"views":{"patient_by_display_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["88a46c350d8994362cc0e5910f15d726","c619a041bccecc7e83b05015cc92706e"]}},{"_id":"_design/patient_by_status","_rev":"2-b56763993297cda52343d99f7fdd1b03","version":3,"views":{"patient_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {emit(doc.data.status);}}}"}},"_revisions":{"start":2,"ids":["b56763993297cda52343d99f7fdd1b03","ff26a12cdb8747aae5bf26f9af3a1953"]}},{"_id":"_design/patient_by_status","_rev":"2-28bbabc89f372c977f8f25a2dc4748e8","_deleted":true,"_revisions":{"start":2,"ids":["28bbabc89f372c977f8f25a2dc4748e8","49f3f7f86891fb7d60f0ee1b2db1220b"]}},{"_id":"_design/patient_by_status","_rev":"2-01f23790dd42e69b4ed27f04d61f1adf","_deleted":true,"_revisions":{"start":2,"ids":["01f23790dd42e69b4ed27f04d61f1adf","54bc74ff93db4aedff83bc649f766596"]}},{"_id":"_design/photo_by_patient","_rev":"2-0ea32da890536de0910ea412a3fa015c","version":4,"views":{"photo_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"photo\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":2,"ids":["0ea32da890536de0910ea412a3fa015c","e3dc5506f7f370535b85be0adc59c7cc"]}},{"_id":"_design/photo_by_patient","_rev":"2-5fc163e6b59fe7fe49ea0d0b07f5b78c","_deleted":true,"_revisions":{"start":2,"ids":["5fc163e6b59fe7fe49ea0d0b07f5b78c","6a4fad4fa682efbbd058e858c328574f"]}},{"_id":"_design/photo_by_patient","_rev":"2-29a6fd37f05e4fdd0563837230cf1664","_deleted":true,"_revisions":{"start":2,"ids":["29a6fd37f05e4fdd0563837230cf1664","727ba2a3d1a106196746643395a859d0"]}},{"_id":"_design/pricing_by_category","_rev":"1-b34429f4f8aff13ed218f70f039b3591","version":5,"views":{"pricing_by_category":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"pricing\\") {emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["b34429f4f8aff13ed218f70f039b3591"]}},{"_id":"_design/pricing_by_category","_rev":"2-b410254aa19dffe8ec92ad1aa5253030","_deleted":true,"_revisions":{"start":2,"ids":["b410254aa19dffe8ec92ad1aa5253030","3d703b5f240ae5838d1f20a8ad0471de"]}},{"_id":"_design/pricing_by_category","_rev":"2-68d447e856a6194de82dcd9e506569ae","_deleted":true,"_revisions":{"start":2,"ids":["68d447e856a6194de82dcd9e506569ae","23d44e44019170eadd086734c87e3976"]}},{"_id":"_design/procedure_by_date","_rev":"1-a44decd8f14d01c615cf3f5b8e70f10b","version":4,"views":{"procedure_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'procedure\') {\\n        var procedureDate = doc.data.procedureDate;\\n    if (procedureDate && procedureDate !== \\"\\") {\\n      procedureDate = new Date(procedureDate);\\n      if (procedureDate.getTime) {\\n        procedureDate = procedureDate.getTime();\\n      }\\n    }\\n    emit([procedureDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["a44decd8f14d01c615cf3f5b8e70f10b"]}},{"_id":"_design/procedure_by_date","_rev":"2-876a312fff8d17933d798db8d69e9938","_deleted":true,"_revisions":{"start":2,"ids":["876a312fff8d17933d798db8d69e9938","7c23f1d0feaff1358bee1ddea760daac"]}},{"_id":"_design/procedure_by_date","_rev":"2-5b5eb6c8ca33d0d3ff9c1f6ee70eb04c","_deleted":true,"_revisions":{"start":2,"ids":["5b5eb6c8ca33d0d3ff9c1f6ee70eb04c","25ccef2a9dff3addd8c0d15cc79c363c"]}},{"_id":"_design/report_by_visit","_rev":"1-1295cef10df82554859efdb4c38c1c1e","version":1,"views":{"report_by_visit":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'report\') {\\n        emit(doc.data.visit);\\n      }\\n    }\\n  }"}}},{"_id":"_design/sequence_by_prefix","_rev":"2-dcfc7e63d8ab52146460bd36ff0d5555","_deleted":true,"_revisions":{"start":2,"ids":["dcfc7e63d8ab52146460bd36ff0d5555","10f81c9287f2db782b8e293e7d9b1cde"]}},{"_id":"_design/sequence_by_prefix","_rev":"2-2ab8142fd9e3bdfd7b4d6444fe9afa4f","_deleted":true,"_revisions":{"start":2,"ids":["2ab8142fd9e3bdfd7b4d6444fe9afa4f","4a47589314718c2d8add1266b64b5ea6"]}},{"_id":"_design/sequence_by_prefix","_rev":"2-73756debd255ca93fb25eab24ed9e12a","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"sequence\\") {emit(doc.data.prefix);}}}"}},"_revisions":{"start":2,"ids":["73756debd255ca93fb25eab24ed9e12a","8ac3a62b4c0b624ebed3b68b27cd197e"]}},{"_id":"_design/surgical_appointments_by_date","_rev":"1-90d8de834de1fe0e154d1cdab8889984","version":1,"views":{"surgical_appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType === \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/visit_by_date","_rev":"1-fd0a50125860ba3c17844c0567a70d65","version":4,"views":{"visit_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["fd0a50125860ba3c17844c0567a70d65"]}},{"_id":"_design/visit_by_date","_rev":"2-db03c0d562a1ae49095d68c63bc3d68f","_deleted":true,"_revisions":{"start":2,"ids":["db03c0d562a1ae49095d68c63bc3d68f","db61f993a1e1699c8205fee3434fc4c8"]}},{"_id":"_design/visit_by_date","_rev":"2-add6c18db9db449d2af501f6f3fc9a68","_deleted":true,"_revisions":{"start":2,"ids":["add6c18db9db449d2af501f6f3fc9a68","367a7fa42f1067f645190d560f83ef5e"]}},{"_id":"_design/visit_by_discharge_date","_rev":"2-ed42fc360c36cf527a4fdb67fc0d81ee","_deleted":true,"_revisions":{"start":2,"ids":["ed42fc360c36cf527a4fdb67fc0d81ee","57a0b69b2792963e5112bbdd53bbba2d"]}},{"_id":"_design/visit_by_discharge_date","_rev":"2-76f05f3060660ab74749fa0def9cea07","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}emit([endDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["76f05f3060660ab74749fa0def9cea07","e53c95160dacaf007fe01c01215729ce"]}},{"_id":"_design/visit_by_discharge_date","_rev":"2-a14fd5cb9029d2e114f084d7ce01d874","_deleted":true,"_revisions":{"start":2,"ids":["a14fd5cb9029d2e114f084d7ce01d874","b4baca85d54e727966aeb2e8ad172136"]}},{"_id":"_design/visit_by_patient","_rev":"1-f2865c74eefee716937492db914f2ccd","version":4,"views":{"visit_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["f2865c74eefee716937492db914f2ccd"]}},{"_id":"_design/visit_by_patient","_rev":"2-048bd179b127054d3279071160a6f314","_deleted":true,"_revisions":{"start":2,"ids":["048bd179b127054d3279071160a6f314","412252178488867e2350dcd13da779ea"]}},{"_id":"_design/visit_by_patient","_rev":"2-15d7d524e104be716e8c93fbf367a28e","_deleted":true,"_revisions":{"start":2,"ids":["15d7d524e104be716e8c93fbf367a28e","bf45f0e7e8e9123a59095b609570a4ea"]}},{"_id":"billingLineItem_2_0CCADC1E-1A14-AD66-8423-7A3E6819AEBA","_rev":"2-11ec581b8c2c2f6c0a7dc18033f4e5fb","data":{"amountOwed":null,"category":"Hospital Charges","description":null,"discount":null,"name":"Test","nationalInsurance":null,"privateInsurance":null,"lastModified":"2015-11-12T21:17:00.771Z","modifiedBy":"Admin User","details":[],"modifiedFields":{"name":"2015-11-12T21:17:00.771Z","category":"2015-11-12T21:17:00.771Z"}},"_revisions":{"start":2,"ids":["11ec581b8c2c2f6c0a7dc18033f4e5fb","90fbdae0cfe722dbf01223fd001b95ab"]}},{"_id":"billingLineItem_2_5A0DDD6C-6A8B-D336-B0AC-2568B648DBA2","_rev":"5-1cbc6b21ccf94b7e42246c75c6bce181","data":{"amountOwed":120,"category":"Hospital Charges","description":null,"discount":null,"name":"Pharmacy","nationalInsurance":null,"privateInsurance":null,"lastModified":"2015-11-13T16:38:51.846Z","modifiedBy":"Admin User","details":["41A8F093-D8F1-30AD-A070-E9881F072F4C"],"modifiedFields":{"name":"2015-11-13T16:38:20.043Z","category":"2015-11-13T16:38:20.043Z","amountOwed":"2015-11-13T16:38:51.846Z"}},"_revisions":{"start":5,"ids":["1cbc6b21ccf94b7e42246c75c6bce181","e2f88432d42e3d68230146173e579b26","a9c69d3126d8f23d1de7ca2362997b0a","635b22c6bd2bebfb41d59375d4a26cc6","cbe1b2c0c29230d741875d4ae3cd46c1"]}},{"_id":"billingLineItem_2_7481C877-BCB1-EB99-BBCA-5E5DC4DADF7A","_rev":"1-b41fc57519199df35943d9c24fd047d7","data":{"amountOwed":null,"category":"Hospital Charges","description":null,"discount":null,"name":"Room/Accomodation","nationalInsurance":null,"privateInsurance":null,"lastModified":"2015-11-12T22:00:59.424Z","modifiedBy":"Admin User","details":["BAFBDD02-6953-5E5F-A7F6-59839997B2FC"],"modifiedFields":{"category":"2015-11-12T22:00:59.424Z","name":"2015-11-12T22:00:59.424Z"}}},{"_id":"billingLineItem_2_83D54C80-6493-9A02-9940-325B25A8C2B5","_rev":"1-063aa7e251503a018e8d3616f8e4f1f2","data":{"amountOwed":null,"category":"Hospital Charges","description":null,"discount":null,"name":"Physical Therapy","nationalInsurance":null,"privateInsurance":null,"lastModified":"2015-11-12T22:00:59.430Z","modifiedBy":"Admin User","details":[],"modifiedFields":{"name":"2015-11-12T22:00:59.430Z","category":"2015-11-12T22:00:59.430Z"}}},{"_id":"billingLineItem_2_87DA9B12-9822-ACA4-A5C4-1FFDD559635C","_rev":"1-e3d62a3ecceebeb32449b7aba49e24ad","data":{"amountOwed":null,"category":"Hospital Charges","description":null,"discount":null,"name":"Ward Items","nationalInsurance":null,"privateInsurance":null,"lastModified":"2015-11-12T22:00:59.429Z","modifiedBy":"Admin User","details":[],"modifiedFields":{"name":"2015-11-12T22:00:59.429Z","category":"2015-11-12T22:00:59.429Z"}}},{"_id":"billingLineItem_2_9733361B-5A85-9F2E-B9D5-F5C85872F7B9","_rev":"1-0e1922e2b361e48a37c6acd5f09dc417","data":{"amountOwed":null,"category":"Hospital Charges","description":null,"discount":null,"name":"Pharmacy","nationalInsurance":null,"privateInsurance":null,"lastModified":"2015-11-12T22:00:59.426Z","modifiedBy":"Admin User","details":[],"modifiedFields":{"name":"2015-11-12T22:00:59.426Z","category":"2015-11-12T22:00:59.426Z"}}},{"_id":"billingLineItem_2_9F1F38EA-168E-9F84-9F1D-C544D64DCD3D","_rev":"5-1c7e8423336ced251445be9ab2415e9a","data":{"amountOwed":0,"category":"Hospital Charges","description":null,"discount":null,"name":"Others/Misc","nationalInsurance":null,"privateInsurance":null,"lastModified":"2015-11-13T16:38:51.850Z","modifiedBy":"Admin User","details":[],"modifiedFields":{"name":"2015-11-13T16:38:20.049Z","category":"2015-11-13T16:38:20.049Z","amountOwed":"2015-11-13T16:38:51.850Z"}},"_revisions":{"start":5,"ids":["1c7e8423336ced251445be9ab2415e9a","5fd56534f9568ebbfedd24d87556c0f2","9a26cbbdec1ee0343e2fe4b7a77980c3","b70a6ee94f406a0b62f77b664819f193","4b741f261e7d842e66966d0878992a38"]}},{"_id":"billingLineItem_2_C193854D-A0D6-5E6B-A900-870904FE92DD","_rev":"5-c3555b12802aff9426590916449368d6","data":{"amountOwed":36,"category":"Hospital Charges","description":null,"discount":null,"name":"Ward Items","nationalInsurance":null,"privateInsurance":null,"lastModified":"2015-11-13T16:38:51.849Z","modifiedBy":"Admin User","details":["04A406D0-EB6B-7BD6-A328-4505150D5A70"],"modifiedFields":{"name":"2015-11-13T16:38:20.048Z","category":"2015-11-13T16:38:20.048Z","amountOwed":"2015-11-13T16:38:51.849Z"}},"_revisions":{"start":5,"ids":["c3555b12802aff9426590916449368d6","1857509859d8571c5e8c2cdc43de07ee","72437bd56ae7108eda0e66a11206f47c","d14d5f368af87d9f33338d31419bd855","9dfba0cdf988336e95ecd5e1eb15cda6"]}},{"_id":"billingLineItem_2_CCC87C0C-DD95-53E6-B645-C3DEAA1C266F","_rev":"5-1292a509ab23929242728137587fbef6","data":{"amountOwed":0,"category":"Hospital Charges","description":null,"discount":null,"name":"Physical Therapy","nationalInsurance":null,"privateInsurance":null,"lastModified":"2015-11-13T16:38:51.850Z","modifiedBy":"Admin User","details":[],"modifiedFields":{"name":"2015-11-13T16:38:20.048Z","category":"2015-11-13T16:38:20.048Z","amountOwed":"2015-11-13T16:38:51.850Z"}},"_revisions":{"start":5,"ids":["1292a509ab23929242728137587fbef6","6e8688e35c955a02bbfc595bda9ef10b","1955501435b44646703efaee24fe2b3b","3e169aeec3ba153a20ab6ac4de2f5423","1fb4106fed478276f3c3c5019e4c1022"]}},{"_id":"billingLineItem_2_D33B74D7-87A0-96F8-AAA1-8455635581A9","_rev":"5-7dbae08e82a6c48b6e46fa2d4baeed6a","data":{"amountOwed":495,"category":"Hospital Charges","description":null,"discount":null,"name":"Room/Accomodation","nationalInsurance":null,"privateInsurance":null,"lastModified":"2015-11-13T16:38:51.844Z","modifiedBy":"Admin User","details":["89E9DCF0-E5FD-F0FA-A34F-8A80A2892934"],"modifiedFields":{"category":"2015-11-13T16:38:20.041Z","name":"2015-11-13T16:38:20.041Z","amountOwed":"2015-11-13T16:38:51.844Z"}},"_revisions":{"start":5,"ids":["7dbae08e82a6c48b6e46fa2d4baeed6a","e54a02cebf64641ee0ee72d8ccc2e861","0e3bc753d21631cea51c1ba64965bb2a","72041c92e27af1a896ff8bf42592e8c7","6acbb6d7dae522de5c588959cda1279e"]}},{"_id":"billingLineItem_2_D6886EFD-5FD8-0048-8F18-70D1C2AF6B7B","_rev":"5-c7c6ba06c51bb71ff990f8032e238d89","data":{"amountOwed":14,"category":"Hospital Charges","description":null,"discount":null,"name":"X-ray/Lab/Supplies","nationalInsurance":null,"privateInsurance":null,"lastModified":"2015-11-13T16:38:51.848Z","modifiedBy":"Admin User","details":["EEA8B1B7-42DB-A4E1-BBB1-BDEDED85B17F","0195CE1B-EA11-CB34-8970-BD6378C11C0B"],"modifiedFields":{"name":"2015-11-13T16:38:20.047Z","category":"2015-11-13T16:38:20.047Z","amountOwed":"2015-11-13T16:38:51.848Z"}},"_revisions":{"start":5,"ids":["c7c6ba06c51bb71ff990f8032e238d89","d36d74e5e324a3fbfc2e9ff6f51204cf","ba5ece37936ad9017a6c225584f7e735","91075517952345cce4ca5d7106374174","83cf4f5966bdff2903a22158d1ff923e"]}},{"_id":"billingLineItem_2_E0882D10-63E3-024B-A8CF-9010FE23C75B","_rev":"1-3df9822ea1a19faeb0dbaf1aa00641e2","data":{"amountOwed":null,"category":"Hospital Charges","description":null,"discount":null,"name":"X-ray/Lab/Supplies","nationalInsurance":null,"privateInsurance":null,"lastModified":"2015-11-12T22:00:59.428Z","modifiedBy":"Admin User","details":["6006AE5D-5B16-4665-BF2A-0549CFA18B05"],"modifiedFields":{"name":"2015-11-12T22:00:59.428Z","category":"2015-11-12T22:00:59.428Z"}}},{"_id":"billingLineItem_2_FF5F6DA8-0359-1712-9E6E-AF50385E07A4","_rev":"1-9f11c1a15fdb9211cf994777d2ebffc7","data":{"amountOwed":null,"category":"Hospital Charges","description":null,"discount":null,"name":"Others/Misc","nationalInsurance":null,"privateInsurance":null,"lastModified":"2015-11-12T22:00:59.431Z","modifiedBy":"Admin User","details":[],"modifiedFields":{"name":"2015-11-12T22:00:59.431Z","category":"2015-11-12T22:00:59.431Z"}}},{"_id":"imaging_2_9DF8A9FF-D32D-371C-8F04-7D26B9EF5CB9","_rev":"2-ee8faaf2563a1aff848c3f1ac5c5eef4","data":{"imagingDate":"2015-11-12T21:54:33.372Z","notes":null,"radiologist":"","requestedBy":"Admin User","requestedDate":"2015-11-12T21:54:30.514Z","result":null,"status":"Completed","lastModified":"2015-11-12T21:54:33.372Z","modifiedBy":"Admin User","imagingType":"5931700E-7965-23B1-9835-2D1615E7E755","patient":"8F7CEF9B-D9C6-E4C4-8BE2-E4DC1E87FCDA","visit":"666DFC61-3230-A865-A145-C7D9139DA1CA","charges":[],"modifiedFields":{"radiologist":"2015-11-12T21:54:30.580Z","status":"2015-11-12T21:54:33.372Z","requestedBy":"2015-11-12T21:54:30.580Z","requestedDate":"2015-11-12T21:54:30.580Z","imagingDate":"2015-11-12T21:54:33.372Z"}},"_revisions":{"start":2,"ids":["ee8faaf2563a1aff848c3f1ac5c5eef4","86e7b70254a3e8d0d37cada4fe2c2dd5"]}},{"_id":"invLocation_2_871EBB5C-6F7A-8D53-A4D4-051E3AA3FFCF","_rev":"3-05c0170c92691e4cec16eaa5fd870093","data":{"quantity":14390,"location":"Pharmacy","aisleLocation":null,"lastModified":"2015-11-13T16:23:27.174Z","modifiedBy":"Admin User","modifiedFields":{"location":"2015-11-13T16:22:40.565Z","quantity":"2015-11-13T16:23:27.174Z"}},"_revisions":{"start":3,"ids":["05c0170c92691e4cec16eaa5fd870093","b12149871eb3a15641ed6288033fafc7","8ed685da9b4f64d6f1700feefd146c00"]}},{"_id":"invPurchase_2_C28F1C3D-2963-B8EB-903E-78913E9E2B32","_rev":"2-730d39d0cb831606ff5d92371b0e2ddf","data":{"purchaseCost":532,"lotNumber":null,"dateReceived":"2015-11-13T05:00:00.000Z","originalQuantity":14400,"currentQuantity":14390,"expirationDate":null,"expired":false,"location":"Pharmacy","aisleLocation":null,"giftInKind":false,"inventoryItem":"igxvfw26_lh","vendor":"ACME","vendorItemNo":null,"distributionUnit":null,"invoiceNo":null,"lastModified":"2015-11-13T16:23:27.174Z","modifiedBy":"Admin User","modifiedFields":{"dateReceived":"2015-11-13T16:22:40.557Z","purchaseCost":"2015-11-13T16:22:40.557Z","location":"2015-11-13T16:22:40.557Z","vendor":"2015-11-13T16:22:40.557Z","originalQuantity":"2015-11-13T16:22:40.557Z","currentQuantity":"2015-11-13T16:23:27.174Z","inventoryItem":"2015-11-13T16:22:40.557Z"}},"_revisions":{"start":2,"ids":["730d39d0cb831606ff5d92371b0e2ddf","fc582e29abb009231245cb59fdd2ccee"]}},{"_id":"invRequest_2_D3C66D97-6371-9453-94EC-8610D69A7152","_rev":"1-886cc49f90ce562971dad25d3fb8de65","data":{"adjustPurchases":true,"completedBy":"Admin User","costPerUnit":0.04,"dateCompleted":"2015-11-13T16:23:27.165Z","dateRequested":null,"deliveryAisle":null,"deliveryLocation":null,"expenseAccount":null,"markAsConsumed":true,"quantity":10,"quantityAtCompletion":14400,"reason":null,"requestedBy":null,"status":"Completed","transactionType":"Fulfillment","lastModified":"2015-11-13T16:23:27.346Z","modifiedBy":"Admin User","inventoryItem":"igxvfw26_lh","patient":"8F7CEF9B-D9C6-E4C4-8BE2-E4DC1E87FCDA","visit":null,"modifiedFields":{"dateCompleted":"2015-11-13T16:23:27.346Z","quantity":"2015-11-13T16:23:27.346Z","transactionType":"2015-11-13T16:23:27.346Z","markAsConsumed":"2015-11-13T16:23:27.346Z","adjustPurchases":"2015-11-13T16:23:27.346Z","costPerUnit":"2015-11-13T16:23:27.346Z","quantityAtCompletion":"2015-11-13T16:23:27.346Z","purchasesAffected":"2015-11-13T16:23:27.346Z","locationsAffected":"2015-11-13T16:23:27.346Z","status":"2015-11-13T16:23:27.346Z","completedBy":"2015-11-13T16:23:27.346Z"},"purchasesAffected":[{"id":"C28F1C3D-2963-B8EB-903E-78913E9E2B32","quantity":10}],"locationsAffected":[{"name":"Pharmacy","quantity":10}]}},{"_id":"inventory_2_igxvfw26_lh","_rev":"3-386a7bd74bfb2bbb81f1c5e9b599d2b9","data":{"description":null,"friendlyId":"m00001","name":"Acetaminophen 500 MG","quantity":14390,"crossReference":null,"inventoryType":"Medication","price":12,"reorderPoint":null,"distributionUnit":"tablet","lastModified":"2015-11-13T16:23:27.345Z","modifiedBy":"Admin User","locations":["871EBB5C-6F7A-8D53-A4D4-051E3AA3FFCF"],"purchases":["C28F1C3D-2963-B8EB-903E-78913E9E2B32"],"modifiedFields":{"name":"2015-11-13T16:22:40.649Z","inventoryType":"2015-11-13T16:22:40.649Z","distributionUnit":"2015-11-13T16:22:40.649Z","quantity":"2015-11-13T16:23:27.345Z","friendlyId":"2015-11-13T16:22:40.649Z","price":"2015-11-13T16:22:52.229Z"}},"_revisions":{"start":3,"ids":["386a7bd74bfb2bbb81f1c5e9b599d2b9","1c30ca3a4b102090fc0598cd7bbdf3ae","391bee3a85ef66bda23c89cabdd67956"]}},{"_id":"invoice_2_6414F250-C6F0-9B1F-94D7-621A539737AF","_rev":"2-e1898aa278789e1d7c91c4e59289344d","_deleted":true,"_revisions":{"start":2,"ids":["e1898aa278789e1d7c91c4e59289344d","8fad9853ba8f801a3375fb0149c140bf"]}}]}\n{"seq":74}\n{"docs":[{"_id":"invoice_2_7596419D-F512-29A0-81EE-346D6D42BB54","_rev":"2-31502fbbe7a5e4ec4f56bc4c7abd1fe3","_deleted":true,"_revisions":{"start":2,"ids":["31502fbbe7a5e4ec4f56bc4c7abd1fe3","dba012716b2add05d20b765a72bca9bd"]}},{"_id":"invoice_2_8929C38C-B621-B2FB-ABB7-DE15C61DFCC8","_rev":"5-7a7d93b820b6085c5beea49fc3efb520","data":{"externalInvoiceNumber":"inv00001","patientInfo":"Joe Bagadonuts - TCH 00001","status":"Billed","remarks":null,"billDate":"2015-11-13T05:00:00.000Z","paidTotal":0,"lastModified":"2015-11-13T16:50:24.904Z","modifiedBy":"Admin User","patient":"8F7CEF9B-D9C6-E4C4-8BE2-E4DC1E87FCDA","visit":"666DFC61-3230-A865-A145-C7D9139DA1CA","paymentProfile":null,"lineItems":["D33B74D7-87A0-96F8-AAA1-8455635581A9","5A0DDD6C-6A8B-D336-B0AC-2568B648DBA2","D6886EFD-5FD8-0048-8F18-70D1C2AF6B7B","C193854D-A0D6-5E6B-A900-870904FE92DD","CCC87C0C-DD95-53E6-B645-C3DEAA1C266F","9F1F38EA-168E-9F84-9F1D-C544D64DCD3D"],"payments":[],"modifiedFields":{"billDate":"2015-11-13T16:38:21.206Z","status":"2015-11-13T16:50:24.904Z","patientInfo":"2015-11-13T16:38:21.206Z","externalInvoiceNumber":"2015-11-13T16:44:21.692Z","paidTotal":"2015-11-13T16:50:24.904Z"}},"_revisions":{"start":5,"ids":["7a7d93b820b6085c5beea49fc3efb520","dd0fbb2e7a00eb9ee9be70696621571a","831c42f1a919ec0ad0592bc301c3f48f","db6828f498d4ec6147ef996cfb4b809a","3aeae1614fd7caa7178cf470bc62c366"]}},{"_id":"lab_2_0762040A-CAC7-130F-8D0C-E3DE9245EE38","_rev":"1-f7d92c5e72cc67fc22c1e7634ca08881","data":{"labDate":"2015-11-12T21:46:23.129Z","notes":null,"requestedBy":"Admin User","requestedDate":"2015-11-12T21:46:24.462Z","result":"Good","status":"Completed","lastModified":"2015-11-12T21:46:50.177Z","modifiedBy":"Admin User","labType":"F71A1788-3407-515B-8006-F9CC788CA8EA","patient":"8F7CEF9B-D9C6-E4C4-8BE2-E4DC1E87FCDA","visit":"666DFC61-3230-A865-A145-C7D9139DA1CA","charges":[],"modifiedFields":{"result":"2015-11-12T21:46:50.177Z","status":"2015-11-12T21:46:50.177Z","labDate":"2015-11-12T21:46:50.177Z","requestedBy":"2015-11-12T21:46:50.177Z","requestedDate":"2015-11-12T21:46:50.177Z"}}},{"_id":"lineItemDetail_2_0195CE1B-EA11-CB34-8970-BD6378C11C0B","_rev":"5-50e91d40fbef6f01247cdc2c797df755","data":{"department":"Imaging","expenseAccount":null,"name":"Xray Hand","price":12,"quantity":1,"total":null,"lastModified":"2015-11-13T16:38:20.046Z","modifiedBy":"Admin User","pricingItem":"5931700E-7965-23B1-9835-2D1615E7E755","modifiedFields":{"name":"2015-11-13T16:38:20.046Z","expenseAccount":"2015-11-13T16:38:20.046Z","quantity":"2015-11-13T16:38:20.046Z","price":"2015-11-13T16:38:20.046Z","department":"2015-11-13T16:38:20.046Z"}},"_revisions":{"start":5,"ids":["50e91d40fbef6f01247cdc2c797df755","b784cb137af68027834c22b372b7abab","0694194f05c3b79c026ff540d9736043","5cbe22057ba23a8ee0f81d8526d8fc8b","91688cbe5d5da849ea8d4cc2516bd0e6"]}},{"_id":"lineItemDetail_2_04A406D0-EB6B-7BD6-A328-4505150D5A70","_rev":"5-3c5cfebc1004ba1adc877f79101943b9","data":{"department":"Ward","expenseAccount":null,"name":"Gauze pad","price":3,"quantity":12,"total":null,"lastModified":"2015-11-13T16:38:20.047Z","modifiedBy":"Admin User","pricingItem":"5029F0F9-BBCF-62F5-BA2B-E8990AC7D151","modifiedFields":{"name":"2015-11-13T16:38:20.047Z","expenseAccount":"2015-11-13T16:38:20.047Z","quantity":"2015-11-13T16:38:20.047Z","price":"2015-11-13T16:38:20.047Z","department":"2015-11-13T16:38:20.047Z"}},"_revisions":{"start":5,"ids":["3c5cfebc1004ba1adc877f79101943b9","aa24b7d5f6f4be91b9f148bb3c090e5e","442c20d22e8ee94f549dbcd12f86f5db","4ee7bf808212cbaefddbcb1e6cd4bd16","46a4da005639ebeefc736b3cc305354c"]}},{"_id":"lineItemDetail_2_41A8F093-D8F1-30AD-A070-E9881F072F4C","_rev":"5-bb70abfec5de06d15fdc8bddb0153c50","data":{"department":"Pharmacy","expenseAccount":null,"name":"Acetaminophen 500 MG","price":12,"quantity":10,"total":null,"lastModified":"2015-11-13T16:38:20.042Z","modifiedBy":"Admin User","pricingItem":null,"modifiedFields":{"name":"2015-11-13T16:38:20.042Z","quantity":"2015-11-13T16:38:20.042Z","price":"2015-11-13T16:38:20.042Z","department":"2015-11-13T16:38:20.042Z"}},"_revisions":{"start":5,"ids":["bb70abfec5de06d15fdc8bddb0153c50","4da37ad0ef6925a3838db19d86c306e7","d7d4a2a5502c92b6225a354639f503d2","882434ab090177ffc5da7f5a20ec1663","f189693c2c4fac5b634b703dc3e253d7"]}},{"_id":"lineItemDetail_2_6006AE5D-5B16-4665-BF2A-0549CFA18B05","_rev":"1-b16638cf08bbd83f98e84c1b682249f9","data":{"department":"Imaging","expenseAccount":null,"name":"Xray Hand","price":12,"quantity":1,"total":null,"lastModified":"2015-11-12T22:00:59.427Z","modifiedBy":"Admin User","pricingItem":"5931700E-7965-23B1-9835-2D1615E7E755","modifiedFields":{"name":"2015-11-12T22:00:59.427Z","expenseAccount":"2015-11-12T22:00:59.427Z","quantity":"2015-11-12T22:00:59.427Z","price":"2015-11-12T22:00:59.427Z","department":"2015-11-12T22:00:59.427Z"}}},{"_id":"lineItemDetail_2_89E9DCF0-E5FD-F0FA-A34F-8A80A2892934","_rev":"5-4008862e1efdded3cc2c5e77e445f214","data":{"department":null,"expenseAccount":null,"name":"Days","price":45,"quantity":11,"total":null,"lastModified":"2015-11-13T16:38:51.843Z","modifiedBy":"Admin User","pricingItem":null,"modifiedFields":{"name":"2015-11-13T16:38:20.039Z","quantity":"2015-11-13T16:38:20.039Z","price":"2015-11-13T16:38:51.843Z"}},"_revisions":{"start":5,"ids":["4008862e1efdded3cc2c5e77e445f214","03d46eaecd46f6336d0ccc07f6881cfd","376b97227567079e8dfd82bad223e1de","d18636e346ef69fa1d9617e177148704","74f4293f387b050c85e3a520eccfeb1a"]}},{"_id":"lineItemDetail_2_BAFBDD02-6953-5E5F-A7F6-59839997B2FC","_rev":"1-461b69d47c783b5fddc3e697d42d0764","data":{"department":null,"expenseAccount":null,"name":"Days","price":null,"quantity":11,"total":null,"lastModified":"2015-11-12T22:00:59.422Z","modifiedBy":"Admin User","pricingItem":null,"modifiedFields":{"name":"2015-11-12T22:00:59.422Z","quantity":"2015-11-12T22:00:59.422Z"}}},{"_id":"lineItemDetail_2_EEA8B1B7-42DB-A4E1-BBB1-BDEDED85B17F","_rev":"5-b4ecd3a3ca2ec72abb2b265aa6a865a0","data":{"department":"O.R.","expenseAccount":null,"name":"Leg Casting","price":2,"quantity":1,"total":null,"lastModified":"2015-11-13T16:38:20.044Z","modifiedBy":"Admin User","pricingItem":"1D198B41-338B-6E49-8BB1-4696D5DAD715","modifiedFields":{"name":"2015-11-13T16:38:20.044Z","expenseAccount":"2015-11-13T16:38:20.044Z","quantity":"2015-11-13T16:38:20.044Z","price":"2015-11-13T16:38:20.044Z","department":"2015-11-13T16:38:20.044Z"}},"_revisions":{"start":5,"ids":["b4ecd3a3ca2ec72abb2b265aa6a865a0","88e87af8cff7a93b0d14ad1152dc40bf","d9d966a397398a53cf66ad2452e904e2","48400862e9be71150140585017cf0b3e","a2a39c01032abf83c945fc5dcbfa1fdc"]}},{"_id":"lookup_2_cpt_code_list","_rev":"1-13d3772f546b5c7a9dfcbb9ad8c27a63","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Leg casting"]}},{"_id":"lookup_2_imaging_pricing_types","_rev":"1-508f1018b1af1f65de250cd110e8ae4a","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Imaging Procedure"]}},{"_id":"lookup_2_lab_pricing_types","_rev":"1-f64bac71fc698147e7b5802e38d326ec","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Lab Procedure"]}},{"_id":"lookup_2_physician_list","_rev":"1-fe60344a75c70341b869b5211a85d89c","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Dr Watson"]}},{"_id":"lookup_2_procedure_list","_rev":"2-5818e879a750999f9f317d262b70cabd","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Fix broken leg","Leg casting"]},"_revisions":{"start":2,"ids":["5818e879a750999f9f317d262b70cabd","13d3772f546b5c7a9dfcbb9ad8c27a63"]}},{"_id":"lookup_2_sex","_rev":"1-c433c64d3ecf2a60e4539b1d1dc43d27","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Male"]}},{"_id":"lookup_2_vendor_list","_rev":"1-e4823048fbfcefa1b230c38548dd6465","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["ACME"]}},{"_id":"lookup_2_warehouse_list","_rev":"1-4f316909ed8500d0f80cf20a684ce343","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Pharmacy"]}},{"_id":"medication_2_7F51BB93-6086-49D0-A284-FEB6C6690C95","_rev":"2-c438baf544b44547413edf90837cab1a","data":{"notes":null,"prescription":"Take two once a day for 5 days","prescriptionDate":"2015-11-13T05:00:00.000Z","quantity":10,"refills":null,"requestedDate":"2015-11-13T16:23:27.163Z","requestedBy":"Admin User","status":"Fulfilled","lastModified":"2015-11-13T16:23:27.176Z","modifiedBy":"Admin User","inventoryItem":"igxvfw26_lh","patient":"8F7CEF9B-D9C6-E4C4-8BE2-E4DC1E87FCDA","visit":"666DFC61-3230-A865-A145-C7D9139DA1CA","medicationTitle":"Acetaminophen 500 MG","priceOfMedication":null,"modifiedFields":{"prescriptionDate":"2015-11-13T16:23:27.176Z","prescription":"2015-11-13T16:23:27.176Z","quantity":"2015-11-13T16:23:27.176Z","status":"2015-11-13T16:23:27.176Z","requestedBy":"2015-11-13T16:23:27.176Z","requestedDate":"2015-11-13T16:23:27.176Z"}},"_revisions":{"start":2,"ids":["c438baf544b44547413edf90837cab1a","f441e894d0aaaab3c3c394186e0cad67"]}},{"_id":"overridePrice_2_9C4DC6CF-EC9B-B303-A483-6B80930CC658","_rev":"1-73b042aa49125ce4f3961ed9316756f7","data":{"price":4,"lastModified":"2015-11-11T21:52:55.514Z","modifiedBy":"Admin User","profile":"5331626A-EF59-E723-AC44-A063049201DC","modifiedFields":{"price":"2015-11-11T21:52:55.514Z"}}},{"_id":"overridePrice_2_FBF5B1A6-BBEE-6D17-99C8-EB4A91358183","_rev":"1-87dc3dc101c2d1b1a122e74de183281a","data":{"price":2,"lastModified":"2015-11-11T21:06:20.663Z","modifiedBy":"Admin User","profile":"5331626A-EF59-E723-AC44-A063049201DC","modifiedFields":{"price":"2015-11-11T21:06:20.663Z"}}},{"_id":"patient_2_8F7CEF9B-D9C6-E4C4-8BE2-E4DC1E87FCDA","_rev":"4-c630f25455e20c41f394ac77f0f7a73c","data":{"admitted":true,"address":null,"address2":null,"address3":null,"address4":null,"bloodType":null,"clinic":null,"country":null,"dateOfBirth":null,"economicClassification":null,"email":null,"externalPatientId":null,"familySupport1":null,"familySupport2":null,"familySupport3":null,"familySupport4":null,"familySupport5":null,"friendlyId":"TCH 00001","firstName":"Joe","sex":"Male","history":null,"insurance":null,"lastName":"Bagadonuts","livingArrangement":null,"middleName":"","notes":null,"otherIncome":null,"patientType":null,"parent":null,"phone":null,"placeOfBirth":null,"referredDate":null,"referredBy":null,"religion":null,"socialActionTaken":null,"socialRecommendation":null,"status":null,"lastModified":"2016-02-22T21:51:59.117Z","modifiedBy":"Admin User","payments":[],"modifiedFields":{"friendlyId":"2015-11-12T21:13:52.796Z","firstName":"2015-11-12T21:13:52.796Z","middleName":"2015-11-12T21:13:52.796Z","lastName":"2015-11-12T21:13:52.796Z","admitted":"2015-11-12T21:15:12.204Z","sex":"2016-02-22T21:51:59.117Z"}},"_revisions":{"start":4,"ids":["c630f25455e20c41f394ac77f0f7a73c","63565b6c7b01bbb4af8dbd37a6cd7ca2","7ab83617d991bfa730e55757d90c35ad","d5bb9506d7ebd07a2fd7e2bd8a9afc03"]}},{"_id":"priceProfile_2_5331626A-EF59-E723-AC44-A063049201DC","_rev":"1-c9ede1cd1775d2ccc9e0bcc5d099d614","data":{"name":"Half off","discountAmount":null,"discountPercentage":50,"lastModified":"2015-11-11T21:05:25.047Z","modifiedBy":"Admin User","modifiedFields":{"name":"2015-11-11T21:05:25.047Z","discountPercentage":"2015-11-11T21:05:25.047Z"}}},{"_id":"pricing_2_1D198B41-338B-6E49-8BB1-4696D5DAD715","_rev":"1-5fd5619f2cc1dcf4e7c051add2deaf5d","data":{"category":"Procedure","expenseAccount":null,"name":"Leg Casting","price":2,"pricingType":null,"lastModified":"2015-11-11T21:53:29.953Z","modifiedBy":"Admin User","pricingOverrides":[],"modifiedFields":{"category":"2015-11-11T21:53:29.953Z","name":"2015-11-11T21:53:29.953Z","price":"2015-11-11T21:53:29.953Z"}}},{"_id":"pricing_2_5029F0F9-BBCF-62F5-BA2B-E8990AC7D151","_rev":"1-7f85b8fb293360badee861fb4a685721","data":{"category":"Ward","expenseAccount":null,"name":"Gauze pad","price":3,"pricingType":null,"lastModified":"2015-11-11T21:53:52.661Z","modifiedBy":"Admin User","pricingOverrides":[],"modifiedFields":{"category":"2015-11-11T21:53:52.661Z","name":"2015-11-11T21:53:52.661Z","price":"2015-11-11T21:53:52.661Z"}}},{"_id":"pricing_2_5931700E-7965-23B1-9835-2D1615E7E755","_rev":"2-300f644f420f7f76581093329a9aa519","data":{"category":"Imaging","expenseAccount":null,"name":"Xray Hand","price":12,"pricingType":"Imaging Procedure","lastModified":"2015-11-11T21:52:55.549Z","modifiedBy":"Admin User","pricingOverrides":["9C4DC6CF-EC9B-B303-A483-6B80930CC658"],"modifiedFields":{"category":"2015-11-11T21:52:55.549Z","name":"2015-11-11T21:52:55.549Z","price":"2015-11-11T21:52:55.549Z","pricingType":"2015-11-11T21:52:55.549Z"}},"_revisions":{"start":2,"ids":["300f644f420f7f76581093329a9aa519","9f00f9d6a35374e7d7fcbeffd8d4697b"]}},{"_id":"pricing_2_F71A1788-3407-515B-8006-F9CC788CA8EA","_rev":"2-9762d8a2d76d242671a3bea610a0904f","data":{"category":"Lab","expenseAccount":null,"name":"Blood test","price":123,"pricingType":"Lab Procedure","lastModified":"2015-11-11T21:06:20.719Z","modifiedBy":"Admin User","pricingOverrides":["FBF5B1A6-BBEE-6D17-99C8-EB4A91358183"],"modifiedFields":{"category":"2015-11-11T21:06:20.719Z","name":"2015-11-11T21:06:20.719Z","price":"2015-11-11T21:06:20.719Z","pricingType":"2015-11-11T21:06:20.719Z"}},"_revisions":{"start":2,"ids":["9762d8a2d76d242671a3bea610a0904f","e6eada16de79ddba78e890c01837a3f5"]}},{"_id":"procCharge_2_0834BF27-A2E0-5ADD-9509-B97CA547E532","_rev":"1-0bb58d85915b11cbcb1547ba44b86f5f","data":{"quantity":1,"dateCharged":"2015-11-13T05:00:00.000Z","lastModified":"2015-11-13T16:11:54.012Z","modifiedBy":"Admin User","medication":null,"pricingItem":"1D198B41-338B-6E49-8BB1-4696D5DAD715","modifiedFields":{"dateCharged":"2015-11-13T16:11:54.012Z","quantity":"2015-11-13T16:11:54.012Z"}}},{"_id":"procCharge_2_17BC9913-E49F-FB8A-AA42-4F617D839510","_rev":"1-2917bd58af0d9cbb9e3835013c857d2f","data":{"quantity":1,"dateCharged":"2015-11-12T05:00:00.000Z","lastModified":"2015-11-12T21:53:52.879Z","modifiedBy":"Admin User","medication":null,"pricingItem":"1D198B41-338B-6E49-8BB1-4696D5DAD715","modifiedFields":{"dateCharged":"2015-11-12T21:53:52.879Z","quantity":"2015-11-12T21:53:52.879Z"}}},{"_id":"procCharge_2_2648E500-C287-2EE4-B569-99D6291FB46C","_rev":"2-1875764ed6d4a41e96277d678bcda2b3","_deleted":true,"_revisions":{"start":2,"ids":["1875764ed6d4a41e96277d678bcda2b3","f0554786c3ad14c941dced65e1df8649"]}},{"_id":"procCharge_2_412AD48B-EDD4-E5E2-8134-BB3B5E459972","_rev":"1-2cdee6e8d8fd1207c073b5e6f33b4c6e","data":{"quantity":12,"dateCharged":"2015-11-03T05:00:00.000Z","lastModified":"2015-11-12T21:18:30.366Z","modifiedBy":"Admin User","medication":null,"pricingItem":"5029F0F9-BBCF-62F5-BA2B-E8990AC7D151","modifiedFields":{"dateCharged":"2015-11-12T21:18:30.366Z","quantity":"2015-11-12T21:18:30.366Z"}}},{"_id":"procCharge_2_561AD584-144B-D21F-840A-8600B8D900CF","_rev":"1-8f30246e0bba661deeb2c08617ec1128","data":{"quantity":12,"dateCharged":"2015-11-11T05:00:00.000Z","lastModified":"2015-11-13T16:24:24.528Z","modifiedBy":"Admin User","medication":null,"pricingItem":"5029F0F9-BBCF-62F5-BA2B-E8990AC7D151","modifiedFields":{"dateCharged":"2015-11-13T16:24:24.528Z","quantity":"2015-11-13T16:24:24.528Z"}}},{"_id":"procCharge_2_704FA289-CA15-A178-B571-D0ECCE8229F3","_rev":"2-6d00bf1656e7ef89bc6ba38c3711982b","_deleted":true,"_revisions":{"start":2,"ids":["6d00bf1656e7ef89bc6ba38c3711982b","2103b76190a412ab081bae469ef27dee"]}},{"_id":"procCharge_2_A28911F7-FC62-9F3D-A82E-8EB0D43B9B68","_rev":"2-3959e9c3eb93a0fd7bc1d36ece0dbcd9","_deleted":true,"_revisions":{"start":2,"ids":["3959e9c3eb93a0fd7bc1d36ece0dbcd9","b5b4fd9fa56d91b689be62a9fc0506ae"]}},{"_id":"procCharge_2_A2F0320B-AFD0-BB29-AFFE-6470FD537D05","_rev":"1-d29a0c613aa6282b87a3e3eb37278453","data":{"medicationTitle":"Acetaminophen 500 MG","priceOfMedication":12,"quantity":12,"dateCharged":"2016-02-09T20:18:54.966Z","lastModified":"2016-02-09T20:18:59.012Z","modifiedBy":"Admin User","medication":"igxvfw26_lh","pricingItem":null,"modifiedFields":{"dateCharged":"2016-02-09T20:18:59.012Z","quantity":"2016-02-09T20:18:59.012Z","medicationTitle":"2016-02-09T20:18:59.012Z","priceOfMedication":"2016-02-09T20:18:59.012Z"}}},{"_id":"procCharge_2_BDAC9E94-96A0-1994-9196-BD3F56F891CA","_rev":"1-090a8baf0cf5219ab842f6a5f85c98b2","data":{"medicationTitle":"Acetaminophen 500 MG","priceOfMedication":12,"medication":"<hospitalrun@model:inventory::ember1608:igxvfw26_lh>","quantity":12,"dateCharged":"2016-02-09T19:20:16.119Z","lastModified":"2016-02-09T19:20:22.089Z","modifiedBy":"Admin User","pricingItem":null,"modifiedFields":{"dateCharged":"2016-02-09T19:20:22.089Z","quantity":"2016-02-09T19:20:22.089Z","medication":"2016-02-09T19:20:22.089Z","medicationTitle":"2016-02-09T19:20:22.089Z","priceOfMedication":"2016-02-09T19:20:22.089Z"}}},{"_id":"procCharge_2_F632124D-557D-0B35-8213-F7054DE6AFB0","_rev":"1-f88672a41bab0bf53f3d744944b623e5","data":{"medicationTitle":"Acetaminophen 500 MG","priceOfMedication":12,"medication":"<hospitalrun@model:inventory::ember2102:igxvfw26_lh>","quantity":12,"dateCharged":"2016-02-09T19:16:13.269Z","lastModified":"2016-02-09T19:16:22.209Z","modifiedBy":"Admin User","pricingItem":null,"modifiedFields":{"dateCharged":"2016-02-09T19:16:22.209Z","quantity":"2016-02-09T19:16:22.209Z","medication":"2016-02-09T19:16:22.209Z","medicationTitle":"2016-02-09T19:16:22.209Z","priceOfMedication":"2016-02-09T19:16:22.209Z"}}},{"_id":"procedure_2_539C4B9B-B275-EF14-8BA2-9CAC6403424A","_rev":"1-e4a243fe73d67885206ff1d406beba1a","data":{"anesthesiaType":null,"anesthesiologist":null,"assistant":null,"description":"Leg casting","cptCode":"Leg casting","location":null,"notes":null,"physician":"Dr Watson","procedureDate":"2015-11-12T05:00:00.000Z","timeStarted":"","timeEnded":"","lastModified":"2015-11-12T21:54:00.381Z","modifiedBy":"Admin User","visit":"666DFC61-3230-A865-A145-C7D9139DA1CA","charges":["17BC9913-E49F-FB8A-AA42-4F617D839510"],"modifiedFields":{"procedureDate":"2015-11-12T21:54:00.381Z","description":"2015-11-12T21:54:00.381Z","cptCode":"2015-11-12T21:54:00.381Z","timeStarted":"2015-11-12T21:54:00.381Z","timeEnded":"2015-11-12T21:54:00.381Z","physician":"2015-11-12T21:54:00.381Z"}}},{"_id":"procedure_2_653A07CE-66E2-1DC8-A83C-4A25934559F0","_rev":"11-9852c642c6108359ec3d1a1915be7d77","data":{"anesthesiaType":"","anesthesiologist":null,"assistant":null,"description":"Fix broken leg","cptCode":null,"location":null,"notes":null,"physician":"Dr Watson","procedureDate":"2015-11-13T05:00:00.000Z","timeStarted":"","timeEnded":"","lastModified":"2015-11-13T16:11:57.940Z","modifiedBy":"Admin User","visit":"666DFC61-3230-A865-A145-C7D9139DA1CA","charges":["0834BF27-A2E0-5ADD-9509-B97CA547E532","A2F0320B-AFD0-BB29-AFFE-6470FD537D05"],"modifiedFields":{"procedureDate":"2015-11-13T16:11:57.940Z","description":"2015-11-13T16:11:57.940Z","timeStarted":"2015-11-13T16:11:57.940Z","timeEnded":"2015-11-13T16:11:57.940Z","physician":"2015-11-13T16:11:57.940Z","anesthesiaType":"2015-11-13T16:11:57.940Z"}},"_revisions":{"start":11,"ids":["9852c642c6108359ec3d1a1915be7d77","32f7b134f4a1489bad30b20b41a402b7","79317aa8224c831799a41588c9c00572","25edbe7f3e8f872997aec5b8e57959c0","53e45632484af05ac967f6af430bced9","8700b634cefddb7c2ef0b810e4d8241a","e0abfee94018abcefb7b541c6bb7b242","715ed4e72deba043868bfbe500f964a0","483b770e04706f935dc6275abf496a3a","0f22a93f70def208660a024b0fa6a6c6","b078e6e7004154529f8fd0901b60ed19"]}},{"_id":"sequence_2_inventory_Medication","_rev":"1-1acccea88a50973cbe8840a31911aa7c","data":{"prefix":"m","value":1}},{"_id":"sequence_2_invoice","_rev":"3-f0ef6923c78e739d9228517a4813b646","data":{"prefix":null,"value":3},"_revisions":{"start":3,"ids":["f0ef6923c78e739d9228517a4813b646","f9a8fd6c55cd4e5fb0064b7767586e05","5bc31ffefa482f2e66299cf0704623c8"]}},{"_id":"sequence_2_patient","_rev":"1-5bc31ffefa482f2e66299cf0704623c8","data":{"prefix":null,"value":1}},{"_id":"visit_2_666DFC61-3230-A865-A145-C7D9139DA1CA","_rev":"12-9f26178fcda83e39cc9df1950035a7fc","data":{"dischargeInfo":null,"endDate":"2015-11-12T05:00:00.000Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-01T04:00:00.000Z","status":"Discharged","visitType":"Admission","lastModified":"2015-11-12T21:47:53.994Z","modifiedBy":"Admin User","patient":"8F7CEF9B-D9C6-E4C4-8BE2-E4DC1E87FCDA","vitals":[],"procedures":["653A07CE-66E2-1DC8-A83C-4A25934559F0"],"medication":["7F51BB93-6086-49D0-A284-FEB6C6690C95"],"labs":["0762040A-CAC7-130F-8D0C-E3DE9245EE38"],"imaging":["9DF8A9FF-D32D-371C-8F04-7D26B9EF5CB9"],"charges":["561AD584-144B-D21F-840A-8600B8D900CF"],"modifiedFields":{"visitType":"2015-11-12T21:15:12.160Z","startDate":"2015-11-12T21:15:12.160Z","status":"2015-11-12T21:47:53.994Z","outPatient":"2015-11-12T21:15:12.160Z","endDate":"2015-11-12T21:47:53.994Z"}},"_revisions":{"start":12,"ids":["9f26178fcda83e39cc9df1950035a7fc","64ef0abb729090bd64b948f9ca2318de","19a1560274f7e5dc07c3b6b0543278a1","793cb2bc5919ef9ced471818f5e7c3b5","8201fa77027c3929455f4c9368ce1c32","4f345e06fefbc87fa23fa1a0d194d1ee","e82f9737c00c8b9004653355ed0cb743","03b09430dde4f6d3c5b62f1c5c6b1378","1db70a4f91b8ed3da25df05dcc91713d","5745b4455c849281c543b2c447feb480","37ad5eae5583240c5143012937658d48","c35ad6c0332fc471d3a8fa485a48d1de"]}}]}\n{"seq":117}\n';
});
define('hospitalrun/tests/fixtures/default', ['exports'], function (exports) {
  exports['default'] = '{"version":"1.2.5","db_type":"http","start_time":"2017-03-16T14:31:32.556Z","db_info":{"db_name":"main","doc_count":31,"doc_del_count":0,"update_seq":55,"purge_seq":0,"compact_running":false,"disk_size":110696,"data_size":48547,"instance_start_time":"1489674638687677","disk_format_version":6,"committed_update_seq":55,"host":"http://localhost:5984/main/","auto_compaction":false,"adapter":"http"}}\n{"docs":[{"_id":"_design/custom_form_by_type","_rev":"1-ddf0ee75c1e8e859d821a9f5c1ec43b6","version":1,"views":{"custom_form_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'customForm\') {\\n        emit(doc.data.formType);\\n      }\\n    }\\n  }"}}}]}\n{"seq":2}\n{"docs":[{"_id":"_design/inventory_by_friendly_id","_rev":"1-82e24378f074a284cae14da4db5431ed","version":1,"views":{"inventory_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}}]}\n{"seq":5}\n{"docs":[{"_id":"_design/appointments_by_date","_rev":"1-178add045be11a7fd6aa7fdf97c8f3f0","version":6,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([startDate, endDate, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n      var filterBy = null;\\n      var includeRow = true;\\n      if (req.query && req.query.filterBy) {\\n        filterBy = JSON.parse(req.query.filterBy);\\n      }\\n      if (!filterBy) {\\n        return true;\\n      }\\n      for (var i = 0; i < filterBy.length; i++) {\\n        var currentValue = row.doc.data[filterBy[i].name];\\n        if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n          currentValue = \'Scheduled\';\\n        }\\n        if (currentValue !== filterBy[i].value) {\\n          includeRow = false;\\n          break;\\n        }\\n      }\\n      return includeRow;\\n    });rows.sort(function (a, b) {\\n      function defaultStatus(value) {\\n        if (!value || value === \'\') {\\n          return \'Scheduled\';\\n        } else {\\n          return value;\\n        }\\n      }\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'appointmentType\':\\n        case \'location\':\\n        case \'provider\':\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        case \'date\':\\n          {\\n            var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n            if (startDiff === 0) {\\n              return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n            } else {\\n              return startDiff;\\n            }\\n          }\\n        case \'status\':\\n          {\\n            var aStatus = defaultStatus(a.doc.data[sortBy]);\\n            var bStatus = defaultStatus(b.doc.data[sortBy]);\\n            return compareStrings(aStatus, bStatus);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["178add045be11a7fd6aa7fdf97c8f3f0"]}},{"_id":"_design/appointments_by_date","_rev":"1-5df29f1d7dbd39d6b3a2145923ab73cf","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["5df29f1d7dbd39d6b3a2145923ab73cf"]}},{"_id":"_design/appointments_by_date","_rev":"1-4bdc8957d4338cde0bdce05a2ecfe7b5","version":4,"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n            var i,\\n                filterBy = null,\\n                includeRow = true;\\n            if (req.query && req.query.filterBy) {\\n                filterBy = JSON.parse(req.query.filterBy);\\n            }\\n            if (!filterBy) {\\n                return true;\\n            }\\n            for (i = 0; i < filterBy.length; i++) {\\n                var currentValue = row.doc.data[filterBy[i].name];\\n                if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n                    currentValue = \'Scheduled\';\\n                }\\n                if (currentValue !== filterBy[i].value) {\\n                    includeRow = false;\\n                    break;\\n                }\\n            }\\n            return includeRow;\\n        });rows.sort(function (a, b) {\\n            function defaultStatus(value) {\\n                if (!value || value === \'\') {\\n                    return \'Scheduled\';\\n                } else {\\n                    return value;\\n                }\\n            }\\n            var sortBy = \'\';\\n            if (req.query && req.query.sortKey) {\\n                sortBy = req.query.sortKey;\\n            }\\n            switch (sortBy) {\\n                case \'appointmentType\':\\n                case \'location\':\\n                case \'provider\':\\n                    return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n                case \'date\':\\n                    {\\n                        var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n                        if (startDiff === 0) {\\n                            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n                        } else {\\n                            return startDiff;\\n                        }\\n                        break;\\n                    }\\n                case \'status\':\\n                    {\\n                        var aStatus = defaultStatus(a.doc.data[sortBy]),\\n                            bStatus = defaultStatus(b.doc.data[sortBy]);\\n                        return compareStrings(aStatus, bStatus);\\n                    }\\n                default:\\n                    {\\n                        return 0; //Don\'t sort\\n                    }\\n            }\\n        });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"views":{"appointments_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["4bdc8957d4338cde0bdce05a2ecfe7b5"]}},{"_id":"_design/appointments_by_date","_rev":"3-461875fa3e8aa582009473a4ebccf3bb","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":3,"ids":["461875fa3e8aa582009473a4ebccf3bb","2e78ab0f6da3881df4871d0b028148b9","4c8dd95ad6d36b9b4d86136d5e417f5c"]}},{"_id":"_design/appointments_by_patient","_rev":"1-9a97acd5b8fd071ad81afc9e730721c5","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate,doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["9a97acd5b8fd071ad81afc9e730721c5"]}},{"_id":"_design/appointments_by_patient","_rev":"1-7232d3292344540b2511e709422e2cbf","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate,doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7232d3292344540b2511e709422e2cbf"]}},{"_id":"_design/appointments_by_patient","_rev":"2-a8bb26daf0329c069a18ec0ce64532cb","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate,doc._id]);}}}"}},"_revisions":{"start":2,"ids":["a8bb26daf0329c069a18ec0ce64532cb","9868b6586898a48c3fd68722ca3fe1d4"]}},{"_id":"_design/closed_incidents_by_user","_rev":"1-bf16176c13be57af9a4f1a0980710190","version":1,"views":{"closed_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status === \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}}},{"_id":"_design/imaging_by_status","_rev":"1-2feb5103c3f6d149bf98f0adeaa76b38","version":4,"views":{"imaging_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"imaging\\") {var imagingDate = doc.data.imagingDate;if (imagingDate && imagingDate !== \\"\\") {imagingDate = new Date(imagingDate);if (imagingDate.getTime) {imagingDate = imagingDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, imagingDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["2feb5103c3f6d149bf98f0adeaa76b38"]}},{"_id":"_design/imaging_by_status","_rev":"1-1a3bab3d2d1403299a9e4ad8dffe5fa1","version":4,"views":{"imaging_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'imaging\') {\\n        var imagingDate = doc.data.imagingDate;\\n    if (imagingDate && imagingDate !== \\"\\") {\\n      imagingDate = new Date(imagingDate);\\n      if (imagingDate.getTime) {\\n        imagingDate = imagingDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, imagingDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["1a3bab3d2d1403299a9e4ad8dffe5fa1"]}},{"_id":"_design/imaging_by_status","_rev":"2-57660077d48a8a4a0c1a3dd6ae214aac","version":4,"views":{"imaging_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"imaging\\") {var imagingDate = doc.data.imagingDate;if (imagingDate && imagingDate !== \\"\\") {imagingDate = new Date(imagingDate);if (imagingDate.getTime) {imagingDate = imagingDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, imagingDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["57660077d48a8a4a0c1a3dd6ae214aac","9236042e1fb9f567d1d527bbb429cd8e"]}},{"_id":"_design/incident_by_date","_rev":"1-59fa59734ee129cff0560b20a95d2d4e","version":1,"views":{"incident_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        var dateOfIncident = doc.data.dateOfIncident;\\n    if (dateOfIncident && dateOfIncident !== \\"\\") {\\n      dateOfIncident = new Date(dateOfIncident);\\n      if (dateOfIncident.getTime) {\\n        dateOfIncident = dateOfIncident.getTime();\\n      }\\n    }\\n    emit([dateOfIncident, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/incident_by_friendly_id","_rev":"1-885a12b67da47e956bc190fe1fe0d4e6","version":1,"views":{"incident_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_by_name","_rev":"1-91f55ae6bd30f766d9da95bffe054bcb","version":5,"views":{"inventory_by_name":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.name, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["91f55ae6bd30f766d9da95bffe054bcb"]}},{"_id":"_design/inventory_by_name","_rev":"1-a1cd6b8922ed0f24a090ba9fd96f5c05","version":3,"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n            var sortBy = \'\';\\n            if (req.query && req.query.sortKey) {\\n                sortBy = req.query.sortKey;\\n            }\\n            switch (sortBy) {\\n                case \'crossReference\':\\n                case \'description\':\\n                case \'friendlyId\':\\n                case \'name\':\\n                case \'price\':\\n                case \'quantity\':\\n                case \'inventoryType\':\\n                    {\\n                        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n                    }\\n                default:\\n                    {\\n                        return 0; //Don\'t sort\\n                    }\\n            }\\n        });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"views":{"inventory_by_name":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit([doc.data.name, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["a1cd6b8922ed0f24a090ba9fd96f5c05"]}},{"_id":"_design/inventory_by_name","_rev":"2-6993fbc5ef18283f83c6afe5be9a9351","version":5,"views":{"inventory_by_name":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.name, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["6993fbc5ef18283f83c6afe5be9a9351","c12e4467c9c3ecc8021b660934257f25"]}},{"_id":"_design/inventory_by_type","_rev":"1-65423cfcd4b0acd93b58aa2003907c92","version":5,"views":{"inventory_by_type":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit(doc.data.inventoryType);}}}"}},"_revisions":{"start":1,"ids":["65423cfcd4b0acd93b58aa2003907c92"]}},{"_id":"_design/inventory_by_type","_rev":"1-18455500e1e86544edceaab01bb511bc","version":5,"views":{"inventory_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit(doc.data.inventoryType);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["18455500e1e86544edceaab01bb511bc"]}},{"_id":"_design/inventory_by_type","_rev":"1-003ef699ab0f2b8628c0bf613fabf7a2","version":4,"views":{"inventory_by_type":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit(doc.data.inventoryType);}}}"}},"_revisions":{"start":1,"ids":["003ef699ab0f2b8628c0bf613fabf7a2"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-823be94576112c800022b256ccd9b725","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var dateReceived = doc.data.dateReceived;if (dateReceived && dateReceived !== \\"\\") {dateReceived = new Date(dateReceived);if (dateReceived.getTime) {dateReceived = dateReceived.getTime();}}emit([dateReceived, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["823be94576112c800022b256ccd9b725"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-78939ec45bef330bbfa87763dbbfce37","version":4,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var dateReceived = doc.data.dateReceived;if (dateReceived && dateReceived !== \\"\\") {dateReceived = new Date(dateReceived);if (dateReceived.getTime) {dateReceived = dateReceived.getTime();}}emit([dateReceived, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["78939ec45bef330bbfa87763dbbfce37"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-0d7b597aeae746589980b12903768252","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invPurchase\') {\\n        var dateReceived = doc.data.dateReceived;\\n    if (dateReceived && dateReceived !== \\"\\") {\\n      dateReceived = new Date(dateReceived);\\n      if (dateReceived.getTime) {\\n        dateReceived = dateReceived.getTime();\\n      }\\n    }\\n    emit([dateReceived, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["0d7b597aeae746589980b12903768252"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-1f41dd6d030c58884d7013ef9436decb","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invPurchase\') {\\n        var expirationDate = doc.data.expirationDate;\\n    if (expirationDate && expirationDate !== \\"\\") {\\n      expirationDate = new Date(expirationDate);\\n      if (expirationDate.getTime) {\\n        expirationDate = expirationDate.getTime();\\n      }\\n    }\\n    emit([expirationDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["1f41dd6d030c58884d7013ef9436decb"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-17bd9d3619ae03155d9929d3ebcd5023","version":4,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var expirationDate = doc.data.expirationDate;if (expirationDate && expirationDate !== \\"\\") {expirationDate = new Date(expirationDate);if (expirationDate.getTime) {expirationDate = expirationDate.getTime();}}emit([expirationDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["17bd9d3619ae03155d9929d3ebcd5023"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-7aea58304996ccb168865141592a024f","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var expirationDate = doc.data.expirationDate;if (expirationDate && expirationDate !== \\"\\") {expirationDate = new Date(expirationDate);if (expirationDate.getTime) {expirationDate = expirationDate.getTime();}}emit([expirationDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7aea58304996ccb168865141592a024f"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-e9eb2d7f1e35296646399c7414525c33","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);}}}"}},"_revisions":{"start":1,"ids":["e9eb2d7f1e35296646399c7414525c33"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-7e7ef275a9fc15f2b5f328b1479c6097","version":4,"views":{"inventory_request_by_item":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);}}}"}},"_revisions":{"start":1,"ids":["7e7ef275a9fc15f2b5f328b1479c6097"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-021f4c24b5b6202594f610cf5d4c63a4","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invRequest\') {\\n        var dateCompleted = doc.data.dateCompleted;\\n    if (dateCompleted && dateCompleted !== \\"\\") {\\n      dateCompleted = new Date(dateCompleted);\\n      if (dateCompleted.getTime) {\\n        dateCompleted = dateCompleted.getTime();\\n      }\\n    }\\n    emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["021f4c24b5b6202594f610cf5d4c63a4"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-f4a7252ebf2802c53a572bf150eae05c","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.status, dateCompleted, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["f4a7252ebf2802c53a572bf150eae05c"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-cc0c1e0e01060aa62456d6ea768d8ec7","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invRequest\') {\\n        var dateCompleted = doc.data.dateCompleted;\\n    if (dateCompleted && dateCompleted !== \\"\\") {\\n      dateCompleted = new Date(dateCompleted);\\n      if (dateCompleted.getTime) {\\n        dateCompleted = dateCompleted.getTime();\\n      }\\n    }\\n    emit([doc.data.status, dateCompleted, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["cc0c1e0e01060aa62456d6ea768d8ec7"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-187394c79d3206e11e112891f0d63550","version":4,"views":{"inventory_request_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.status, dateCompleted, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["187394c79d3206e11e112891f0d63550"]}},{"_id":"_design/invoice_by_patient","_rev":"1-a491390f74ce432d9cfab78291e0753b","version":1,"views":{"invoice_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":1,"ids":["a491390f74ce432d9cfab78291e0753b"]}},{"_id":"_design/invoice_by_patient","_rev":"1-9f67a58d4e428614844ac82cb2548268","version":1,"views":{"invoice_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invoice\') {\\n        emit(doc.data.patient);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["9f67a58d4e428614844ac82cb2548268"]}},{"_id":"_design/invoice_by_status","_rev":"1-d411e6f66f897f0b9b985dc6e5188d85","version":4,"views":{"invoice_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invoice\') {\\n        var billDate = doc.data.billDate;\\n    if (billDate && billDate !== \\"\\") {\\n      billDate = new Date(billDate);\\n      if (billDate.getTime) {\\n        billDate = billDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, billDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["d411e6f66f897f0b9b985dc6e5188d85"]}},{"_id":"_design/invoice_by_status","_rev":"1-25a58e1cec7f01d0a7e8da1293f59b69","version":4,"views":{"invoice_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {var billDate = doc.data.billDate;if (billDate && billDate !== \\"\\") {billDate = new Date(billDate);if (billDate.getTime) {billDate = billDate.getTime();}}emit([doc.data.status, billDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["25a58e1cec7f01d0a7e8da1293f59b69"]}},{"_id":"_design/invoice_by_status","_rev":"2-072e2f7f1519a12260fe98c90f794b06","version":4,"views":{"invoice_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {var billDate = doc.data.billDate;if (billDate && billDate !== \\"\\") {billDate = new Date(billDate);if (billDate.getTime) {billDate = billDate.getTime();}}emit([doc.data.status, billDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["072e2f7f1519a12260fe98c90f794b06","73e3e45673ed0c4f4ae1cee855f216f0"]}},{"_id":"_design/lab_by_status","_rev":"1-7d4de6e219b482171b7ecd485ef72238","version":4,"views":{"lab_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'lab\') {\\n        var labDate = doc.data.labDate;\\n    if (labDate && labDate !== \\"\\") {\\n      labDate = new Date(labDate);\\n      if (labDate.getTime) {\\n        labDate = labDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, labDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["7d4de6e219b482171b7ecd485ef72238"]}},{"_id":"_design/lab_by_status","_rev":"1-16b2c13356e8dac3b3594018f91cccfb","version":4,"views":{"lab_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"lab\\") {var labDate = doc.data.labDate;if (labDate && labDate !== \\"\\") {labDate = new Date(labDate);if (labDate.getTime) {labDate = labDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, labDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["16b2c13356e8dac3b3594018f91cccfb"]}},{"_id":"_design/lab_by_status","_rev":"2-ef5e8b51b3704c0cb1e525a63c81bd80","version":4,"views":{"lab_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"lab\\") {var labDate = doc.data.labDate;if (labDate && labDate !== \\"\\") {labDate = new Date(labDate);if (labDate.getTime) {labDate = labDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, labDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["ef5e8b51b3704c0cb1e525a63c81bd80","db4393c6856b98a40afd6ceef31db2a7"]}},{"_id":"_design/medication_by_status","_rev":"1-a6403c53b2db46905b3b1861120c6601","version":4,"views":{"medication_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'medication\') {\\n        var prescriptionDate = doc.data.prescriptionDate;\\n    if (prescriptionDate && prescriptionDate !== \\"\\") {\\n      prescriptionDate = new Date(prescriptionDate);\\n      if (prescriptionDate.getTime) {\\n        prescriptionDate = prescriptionDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["a6403c53b2db46905b3b1861120c6601"]}},{"_id":"_design/medication_by_status","_rev":"1-09e1d1c201823532161ef48ba23200be","version":4,"views":{"medication_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"medication\\") {var prescriptionDate = doc.data.prescriptionDate;if (prescriptionDate && prescriptionDate !== \\"\\") {prescriptionDate = new Date(prescriptionDate);if (prescriptionDate.getTime) {prescriptionDate = prescriptionDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["09e1d1c201823532161ef48ba23200be"]}},{"_id":"_design/medication_by_status","_rev":"2-9dec70f4b5aeaf7d9b8d70719125c41c","version":4,"views":{"medication_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"medication\\") {var prescriptionDate = doc.data.prescriptionDate;if (prescriptionDate && prescriptionDate !== \\"\\") {prescriptionDate = new Date(prescriptionDate);if (prescriptionDate.getTime) {prescriptionDate = prescriptionDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["9dec70f4b5aeaf7d9b8d70719125c41c","36ce9e9853552f5eb646ed26de7184dc"]}},{"_id":"_design/open_incidents_by_user","_rev":"1-34770efd210920a30c96d3787521e8a5","version":1,"views":{"open_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status !== \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      }\\n      return 0; // Don\'t sort\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/patient_by_admission","_rev":"1-3c2da4380d257c95ebf4430afa48de3b","version":4,"views":{"patient_by_admission":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.admitted === true) {\\n      if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["3c2da4380d257c95ebf4430afa48de3b"]}},{"_id":"_design/patient_by_admission","_rev":"2-cb3270a3d44a370d50128b93179d3503","version":4,"views":{"patient_by_admission":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.admitted === true) {\\n      if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["cb3270a3d44a370d50128b93179d3503","ee7b6ead26ac6b8b3f106c6d85dc175b"]}},{"_id":"_design/patient_by_display_id","_rev":"1-8a6930002af6d588ecdedd5f07da0230","version":7,"views":{"patient_by_display_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["8a6930002af6d588ecdedd5f07da0230"]}},{"_id":"_design/patient_by_display_id","_rev":"1-c619a041bccecc7e83b05015cc92706e","version":6,"views":{"patient_by_display_id":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {if (doc.data.friendlyId) {emit([doc.data.friendlyId, doc._id]);} else if (doc.data.externalPatientId) {emit([doc.data.externalPatientId, doc._id]);} else {emit([doc._id, doc._id]);}}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["c619a041bccecc7e83b05015cc92706e"]}},{"_id":"_design/patient_by_display_id","_rev":"3-76930b682e13aef4b2a31fcc57c0ba17","version":7,"views":{"patient_by_display_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":3,"ids":["76930b682e13aef4b2a31fcc57c0ba17","f2bcbc75b5c6af36a93ff450e1764247","e6d44a1448953362319c910bf33a8668"]}},{"_id":"_design/patient_by_status","_rev":"1-54bc74ff93db4aedff83bc649f766596","version":3,"views":{"patient_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        emit(doc.data.status);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["54bc74ff93db4aedff83bc649f766596"]}},{"_id":"_design/patient_by_status","_rev":"1-49f3f7f86891fb7d60f0ee1b2db1220b","version":3,"views":{"patient_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {emit(doc.data.status);}}}"}},"_revisions":{"start":1,"ids":["49f3f7f86891fb7d60f0ee1b2db1220b"]}},{"_id":"_design/patient_by_status","_rev":"2-b56763993297cda52343d99f7fdd1b03","version":3,"views":{"patient_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {emit(doc.data.status);}}}"}},"_revisions":{"start":2,"ids":["b56763993297cda52343d99f7fdd1b03","ff26a12cdb8747aae5bf26f9af3a1953"]}},{"_id":"_design/photo_by_patient","_rev":"1-6a4fad4fa682efbbd058e858c328574f","version":4,"views":{"photo_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'photo\') {\\n        emit(doc.data.patient);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["6a4fad4fa682efbbd058e858c328574f"]}},{"_id":"_design/photo_by_patient","_rev":"1-727ba2a3d1a106196746643395a859d0","version":4,"views":{"photo_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"photo\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":1,"ids":["727ba2a3d1a106196746643395a859d0"]}},{"_id":"_design/photo_by_patient","_rev":"2-0ea32da890536de0910ea412a3fa015c","version":4,"views":{"photo_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"photo\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":2,"ids":["0ea32da890536de0910ea412a3fa015c","e3dc5506f7f370535b85be0adc59c7cc"]}},{"_id":"_design/pricing_by_category","_rev":"1-b34429f4f8aff13ed218f70f039b3591","version":5,"views":{"pricing_by_category":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"pricing\\") {emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["b34429f4f8aff13ed218f70f039b3591"]}},{"_id":"_design/pricing_by_category","_rev":"1-3d703b5f240ae5838d1f20a8ad0471de","version":5,"views":{"pricing_by_category":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'pricing\') {\\n        emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["3d703b5f240ae5838d1f20a8ad0471de"]}},{"_id":"_design/pricing_by_category","_rev":"1-23d44e44019170eadd086734c87e3976","version":4,"views":{"pricing_by_category":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"pricing\\") {emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["23d44e44019170eadd086734c87e3976"]}},{"_id":"_design/procedure_by_date","_rev":"1-25ccef2a9dff3addd8c0d15cc79c363c","version":3,"views":{"procedure_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"procedure\\") {var procedureDate = doc.data.procedureDate;if (procedureDate && procedureDate !== \\"\\") {procedureDate = new Date(procedureDate);if (procedureDate.getTime) {procedureDate = procedureDate.getTime();}}emit([procedureDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["25ccef2a9dff3addd8c0d15cc79c363c"]}},{"_id":"_design/procedure_by_date","_rev":"1-a44decd8f14d01c615cf3f5b8e70f10b","version":4,"views":{"procedure_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'procedure\') {\\n        var procedureDate = doc.data.procedureDate;\\n    if (procedureDate && procedureDate !== \\"\\") {\\n      procedureDate = new Date(procedureDate);\\n      if (procedureDate.getTime) {\\n        procedureDate = procedureDate.getTime();\\n      }\\n    }\\n    emit([procedureDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["a44decd8f14d01c615cf3f5b8e70f10b"]}},{"_id":"_design/procedure_by_date","_rev":"1-7c23f1d0feaff1358bee1ddea760daac","version":4,"views":{"procedure_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"procedure\\") {var procedureDate = doc.data.procedureDate;if (procedureDate && procedureDate !== \\"\\") {procedureDate = new Date(procedureDate);if (procedureDate.getTime) {procedureDate = procedureDate.getTime();}}emit([procedureDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7c23f1d0feaff1358bee1ddea760daac"]}},{"_id":"_design/report_by_visit","_rev":"1-1295cef10df82554859efdb4c38c1c1e","version":1,"views":{"report_by_visit":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'report\') {\\n        emit(doc.data.visit);\\n      }\\n    }\\n  }"}}},{"_id":"_design/sequence_by_prefix","_rev":"1-4a47589314718c2d8add1266b64b5ea6","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"sequence\\") {emit(doc.data.prefix);}}}"}},"_revisions":{"start":1,"ids":["4a47589314718c2d8add1266b64b5ea6"]}},{"_id":"_design/sequence_by_prefix","_rev":"1-10f81c9287f2db782b8e293e7d9b1cde","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'sequence\') {\\n        emit(doc.data.prefix);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["10f81c9287f2db782b8e293e7d9b1cde"]}},{"_id":"_design/sequence_by_prefix","_rev":"2-73756debd255ca93fb25eab24ed9e12a","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"sequence\\") {emit(doc.data.prefix);}}}"}},"_revisions":{"start":2,"ids":["73756debd255ca93fb25eab24ed9e12a","8ac3a62b4c0b624ebed3b68b27cd197e"]}},{"_id":"_design/surgical_appointments_by_date","_rev":"1-90d8de834de1fe0e154d1cdab8889984","version":1,"views":{"surgical_appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType === \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/visit_by_date","_rev":"1-fd0a50125860ba3c17844c0567a70d65","version":4,"views":{"visit_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["fd0a50125860ba3c17844c0567a70d65"]}},{"_id":"_design/visit_by_date","_rev":"1-db61f993a1e1699c8205fee3434fc4c8","version":4,"views":{"visit_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([startDate, endDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["db61f993a1e1699c8205fee3434fc4c8"]}},{"_id":"_design/visit_by_date","_rev":"1-367a7fa42f1067f645190d560f83ef5e","version":3,"views":{"visit_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["367a7fa42f1067f645190d560f83ef5e"]}},{"_id":"_design/visit_by_discharge_date","_rev":"1-b4baca85d54e727966aeb2e8ad172136","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    emit([endDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["b4baca85d54e727966aeb2e8ad172136"]}},{"_id":"_design/visit_by_discharge_date","_rev":"1-57a0b69b2792963e5112bbdd53bbba2d","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}emit([endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["57a0b69b2792963e5112bbdd53bbba2d"]}},{"_id":"_design/visit_by_discharge_date","_rev":"2-76f05f3060660ab74749fa0def9cea07","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}emit([endDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["76f05f3060660ab74749fa0def9cea07","e53c95160dacaf007fe01c01215729ce"]}},{"_id":"_design/visit_by_patient","_rev":"1-f2865c74eefee716937492db914f2ccd","version":4,"views":{"visit_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["f2865c74eefee716937492db914f2ccd"]}},{"_id":"_design/visit_by_patient","_rev":"1-bf45f0e7e8e9123a59095b609570a4ea","version":4,"views":{"visit_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["bf45f0e7e8e9123a59095b609570a4ea"]}},{"_id":"_design/visit_by_patient","_rev":"1-412252178488867e2350dcd13da779ea","version":3,"views":{"visit_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["412252178488867e2350dcd13da779ea"]}}]}\n{"seq":55}\n';
});
define('hospitalrun/tests/fixtures/imaging',['exports'],function(exports){exports['default'] = '{"version":"1.2.5","db_type":"http","start_time":"2017-03-16T14:33:17.854Z","db_info":{"db_name":"main","doc_count":76,"doc_del_count":0,"update_seq":100,"purge_seq":0,"compact_running":false,"disk_size":118888,"data_size":73837,"instance_start_time":"1489674729474434","disk_format_version":6,"committed_update_seq":100,"host":"http://localhost:5984/main/","auto_compaction":false,"adapter":"http"}}\n{"docs":[{"_id":"_design/custom_form_by_type","_rev":"1-ddf0ee75c1e8e859d821a9f5c1ec43b6","version":1,"views":{"custom_form_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'customForm\') {\\n        emit(doc.data.formType);\\n      }\\n    }\\n  }"}}}]}\n{"seq":5}\n{"docs":[{"_id":"_design/inventory_by_friendly_id","_rev":"1-82e24378f074a284cae14da4db5431ed","version":1,"views":{"inventory_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}}]}\n{"seq":7}\n{"docs":[{"_id":"_design/appointments_by_date","_rev":"1-5df29f1d7dbd39d6b3a2145923ab73cf","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["5df29f1d7dbd39d6b3a2145923ab73cf"]}},{"_id":"_design/appointments_by_date","_rev":"1-178add045be11a7fd6aa7fdf97c8f3f0","version":6,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([startDate, endDate, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n      var filterBy = null;\\n      var includeRow = true;\\n      if (req.query && req.query.filterBy) {\\n        filterBy = JSON.parse(req.query.filterBy);\\n      }\\n      if (!filterBy) {\\n        return true;\\n      }\\n      for (var i = 0; i < filterBy.length; i++) {\\n        var currentValue = row.doc.data[filterBy[i].name];\\n        if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n          currentValue = \'Scheduled\';\\n        }\\n        if (currentValue !== filterBy[i].value) {\\n          includeRow = false;\\n          break;\\n        }\\n      }\\n      return includeRow;\\n    });rows.sort(function (a, b) {\\n      function defaultStatus(value) {\\n        if (!value || value === \'\') {\\n          return \'Scheduled\';\\n        } else {\\n          return value;\\n        }\\n      }\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'appointmentType\':\\n        case \'location\':\\n        case \'provider\':\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        case \'date\':\\n          {\\n            var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n            if (startDiff === 0) {\\n              return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n            } else {\\n              return startDiff;\\n            }\\n          }\\n        case \'status\':\\n          {\\n            var aStatus = defaultStatus(a.doc.data[sortBy]);\\n            var bStatus = defaultStatus(b.doc.data[sortBy]);\\n            return compareStrings(aStatus, bStatus);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["178add045be11a7fd6aa7fdf97c8f3f0"]}},{"_id":"_design/appointments_by_date","_rev":"1-03951858f9232df2e774548b0f5fd068","version":4,"views":{"appointments_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n      var i,\\n          filterBy = null,\\n          includeRow = true;\\n      if (req.query && req.query.filterBy) {\\n        filterBy = JSON.parse(req.query.filterBy);\\n      }\\n      if (!filterBy) {\\n        return true;\\n      }\\n      for (i = 0; i < filterBy.length; i++) {\\n        var currentValue = row.doc.data[filterBy[i].name];\\n        if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n          currentValue = \'Scheduled\';\\n        }\\n        if (currentValue !== filterBy[i].value) {\\n          includeRow = false;\\n          break;\\n        }\\n      }\\n      return includeRow;\\n    });rows.sort(function (a, b) {\\n      function defaultStatus(value) {\\n        if (!value || value === \'\') {\\n          return \'Scheduled\';\\n        } else {\\n          return value;\\n        }\\n      }\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'appointmentType\':\\n        case \'location\':\\n        case \'provider\':\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        case \'date\':\\n          {\\n            var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n            if (startDiff === 0) {\\n              return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n            } else {\\n              return startDiff;\\n            }\\n            break;\\n          }\\n        case \'status\':\\n          {\\n            var aStatus = defaultStatus(a.doc.data[sortBy]),\\n                bStatus = defaultStatus(b.doc.data[sortBy]);\\n            return compareStrings(aStatus, bStatus);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["03951858f9232df2e774548b0f5fd068"]}},{"_id":"_design/appointments_by_date","_rev":"3-461875fa3e8aa582009473a4ebccf3bb","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":3,"ids":["461875fa3e8aa582009473a4ebccf3bb","2e78ab0f6da3881df4871d0b028148b9","4c8dd95ad6d36b9b4d86136d5e417f5c"]}},{"_id":"_design/appointments_by_patient","_rev":"1-7232d3292344540b2511e709422e2cbf","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate,doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7232d3292344540b2511e709422e2cbf"]}},{"_id":"_design/appointments_by_patient","_rev":"1-9a97acd5b8fd071ad81afc9e730721c5","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate,doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["9a97acd5b8fd071ad81afc9e730721c5"]}},{"_id":"_design/appointments_by_patient","_rev":"2-a8bb26daf0329c069a18ec0ce64532cb","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate,doc._id]);}}}"}},"_revisions":{"start":2,"ids":["a8bb26daf0329c069a18ec0ce64532cb","9868b6586898a48c3fd68722ca3fe1d4"]}},{"_id":"_design/closed_incidents_by_user","_rev":"1-bf16176c13be57af9a4f1a0980710190","version":1,"views":{"closed_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status === \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}}},{"_id":"_design/imaging_by_status","_rev":"1-2feb5103c3f6d149bf98f0adeaa76b38","version":4,"views":{"imaging_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"imaging\\") {var imagingDate = doc.data.imagingDate;if (imagingDate && imagingDate !== \\"\\") {imagingDate = new Date(imagingDate);if (imagingDate.getTime) {imagingDate = imagingDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, imagingDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["2feb5103c3f6d149bf98f0adeaa76b38"]}},{"_id":"_design/imaging_by_status","_rev":"1-1a3bab3d2d1403299a9e4ad8dffe5fa1","version":4,"views":{"imaging_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'imaging\') {\\n        var imagingDate = doc.data.imagingDate;\\n    if (imagingDate && imagingDate !== \\"\\") {\\n      imagingDate = new Date(imagingDate);\\n      if (imagingDate.getTime) {\\n        imagingDate = imagingDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, imagingDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["1a3bab3d2d1403299a9e4ad8dffe5fa1"]}},{"_id":"_design/imaging_by_status","_rev":"2-57660077d48a8a4a0c1a3dd6ae214aac","version":4,"views":{"imaging_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"imaging\\") {var imagingDate = doc.data.imagingDate;if (imagingDate && imagingDate !== \\"\\") {imagingDate = new Date(imagingDate);if (imagingDate.getTime) {imagingDate = imagingDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, imagingDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["57660077d48a8a4a0c1a3dd6ae214aac","9236042e1fb9f567d1d527bbb429cd8e"]}},{"_id":"_design/incident_by_date","_rev":"1-59fa59734ee129cff0560b20a95d2d4e","version":1,"views":{"incident_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        var dateOfIncident = doc.data.dateOfIncident;\\n    if (dateOfIncident && dateOfIncident !== \\"\\") {\\n      dateOfIncident = new Date(dateOfIncident);\\n      if (dateOfIncident.getTime) {\\n        dateOfIncident = dateOfIncident.getTime();\\n      }\\n    }\\n    emit([dateOfIncident, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/incident_by_friendly_id","_rev":"1-885a12b67da47e956bc190fe1fe0d4e6","version":1,"views":{"incident_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_by_name","_rev":"1-304304d63beaffd8d1ae4ae1cddf4b2b","version":3,"views":{"inventory_by_name":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit([doc.data.name, doc._id]);}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["304304d63beaffd8d1ae4ae1cddf4b2b"]}},{"_id":"_design/inventory_by_name","_rev":"1-91f55ae6bd30f766d9da95bffe054bcb","version":5,"views":{"inventory_by_name":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.name, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["91f55ae6bd30f766d9da95bffe054bcb"]}},{"_id":"_design/inventory_by_name","_rev":"2-6993fbc5ef18283f83c6afe5be9a9351","version":5,"views":{"inventory_by_name":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.name, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["6993fbc5ef18283f83c6afe5be9a9351","c12e4467c9c3ecc8021b660934257f25"]}},{"_id":"_design/inventory_by_type","_rev":"1-003ef699ab0f2b8628c0bf613fabf7a2","version":4,"views":{"inventory_by_type":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit(doc.data.inventoryType);}}}"}},"_revisions":{"start":1,"ids":["003ef699ab0f2b8628c0bf613fabf7a2"]}},{"_id":"_design/inventory_by_type","_rev":"1-18455500e1e86544edceaab01bb511bc","version":5,"views":{"inventory_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit(doc.data.inventoryType);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["18455500e1e86544edceaab01bb511bc"]}},{"_id":"_design/inventory_by_type","_rev":"1-65423cfcd4b0acd93b58aa2003907c92","version":5,"views":{"inventory_by_type":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit(doc.data.inventoryType);}}}"}},"_revisions":{"start":1,"ids":["65423cfcd4b0acd93b58aa2003907c92"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-78939ec45bef330bbfa87763dbbfce37","version":4,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var dateReceived = doc.data.dateReceived;if (dateReceived && dateReceived !== \\"\\") {dateReceived = new Date(dateReceived);if (dateReceived.getTime) {dateReceived = dateReceived.getTime();}}emit([dateReceived, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["78939ec45bef330bbfa87763dbbfce37"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-0d7b597aeae746589980b12903768252","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invPurchase\') {\\n        var dateReceived = doc.data.dateReceived;\\n    if (dateReceived && dateReceived !== \\"\\") {\\n      dateReceived = new Date(dateReceived);\\n      if (dateReceived.getTime) {\\n        dateReceived = dateReceived.getTime();\\n      }\\n    }\\n    emit([dateReceived, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["0d7b597aeae746589980b12903768252"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-823be94576112c800022b256ccd9b725","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var dateReceived = doc.data.dateReceived;if (dateReceived && dateReceived !== \\"\\") {dateReceived = new Date(dateReceived);if (dateReceived.getTime) {dateReceived = dateReceived.getTime();}}emit([dateReceived, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["823be94576112c800022b256ccd9b725"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-17bd9d3619ae03155d9929d3ebcd5023","version":4,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var expirationDate = doc.data.expirationDate;if (expirationDate && expirationDate !== \\"\\") {expirationDate = new Date(expirationDate);if (expirationDate.getTime) {expirationDate = expirationDate.getTime();}}emit([expirationDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["17bd9d3619ae03155d9929d3ebcd5023"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-7aea58304996ccb168865141592a024f","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var expirationDate = doc.data.expirationDate;if (expirationDate && expirationDate !== \\"\\") {expirationDate = new Date(expirationDate);if (expirationDate.getTime) {expirationDate = expirationDate.getTime();}}emit([expirationDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7aea58304996ccb168865141592a024f"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-1f41dd6d030c58884d7013ef9436decb","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invPurchase\') {\\n        var expirationDate = doc.data.expirationDate;\\n    if (expirationDate && expirationDate !== \\"\\") {\\n      expirationDate = new Date(expirationDate);\\n      if (expirationDate.getTime) {\\n        expirationDate = expirationDate.getTime();\\n      }\\n    }\\n    emit([expirationDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["1f41dd6d030c58884d7013ef9436decb"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-e9eb2d7f1e35296646399c7414525c33","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);}}}"}},"_revisions":{"start":1,"ids":["e9eb2d7f1e35296646399c7414525c33"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-021f4c24b5b6202594f610cf5d4c63a4","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invRequest\') {\\n        var dateCompleted = doc.data.dateCompleted;\\n    if (dateCompleted && dateCompleted !== \\"\\") {\\n      dateCompleted = new Date(dateCompleted);\\n      if (dateCompleted.getTime) {\\n        dateCompleted = dateCompleted.getTime();\\n      }\\n    }\\n    emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["021f4c24b5b6202594f610cf5d4c63a4"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-7e7ef275a9fc15f2b5f328b1479c6097","version":4,"views":{"inventory_request_by_item":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);}}}"}},"_revisions":{"start":1,"ids":["7e7ef275a9fc15f2b5f328b1479c6097"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-cc0c1e0e01060aa62456d6ea768d8ec7","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invRequest\') {\\n        var dateCompleted = doc.data.dateCompleted;\\n    if (dateCompleted && dateCompleted !== \\"\\") {\\n      dateCompleted = new Date(dateCompleted);\\n      if (dateCompleted.getTime) {\\n        dateCompleted = dateCompleted.getTime();\\n      }\\n    }\\n    emit([doc.data.status, dateCompleted, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["cc0c1e0e01060aa62456d6ea768d8ec7"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-187394c79d3206e11e112891f0d63550","version":4,"views":{"inventory_request_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.status, dateCompleted, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["187394c79d3206e11e112891f0d63550"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-f4a7252ebf2802c53a572bf150eae05c","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.status, dateCompleted, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["f4a7252ebf2802c53a572bf150eae05c"]}},{"_id":"_design/invoice_by_patient","_rev":"1-9f67a58d4e428614844ac82cb2548268","version":1,"views":{"invoice_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invoice\') {\\n        emit(doc.data.patient);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["9f67a58d4e428614844ac82cb2548268"]}},{"_id":"_design/invoice_by_patient","_rev":"1-a491390f74ce432d9cfab78291e0753b","version":1,"views":{"invoice_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":1,"ids":["a491390f74ce432d9cfab78291e0753b"]}},{"_id":"_design/invoice_by_status","_rev":"1-25a58e1cec7f01d0a7e8da1293f59b69","version":4,"views":{"invoice_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {var billDate = doc.data.billDate;if (billDate && billDate !== \\"\\") {billDate = new Date(billDate);if (billDate.getTime) {billDate = billDate.getTime();}}emit([doc.data.status, billDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["25a58e1cec7f01d0a7e8da1293f59b69"]}},{"_id":"_design/invoice_by_status","_rev":"1-d411e6f66f897f0b9b985dc6e5188d85","version":4,"views":{"invoice_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invoice\') {\\n        var billDate = doc.data.billDate;\\n    if (billDate && billDate !== \\"\\") {\\n      billDate = new Date(billDate);\\n      if (billDate.getTime) {\\n        billDate = billDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, billDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["d411e6f66f897f0b9b985dc6e5188d85"]}},{"_id":"_design/invoice_by_status","_rev":"2-072e2f7f1519a12260fe98c90f794b06","version":4,"views":{"invoice_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {var billDate = doc.data.billDate;if (billDate && billDate !== \\"\\") {billDate = new Date(billDate);if (billDate.getTime) {billDate = billDate.getTime();}}emit([doc.data.status, billDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["072e2f7f1519a12260fe98c90f794b06","73e3e45673ed0c4f4ae1cee855f216f0"]}},{"_id":"_design/lab_by_status","_rev":"1-7d4de6e219b482171b7ecd485ef72238","version":4,"views":{"lab_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'lab\') {\\n        var labDate = doc.data.labDate;\\n    if (labDate && labDate !== \\"\\") {\\n      labDate = new Date(labDate);\\n      if (labDate.getTime) {\\n        labDate = labDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, labDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["7d4de6e219b482171b7ecd485ef72238"]}},{"_id":"_design/lab_by_status","_rev":"1-16b2c13356e8dac3b3594018f91cccfb","version":4,"views":{"lab_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"lab\\") {var labDate = doc.data.labDate;if (labDate && labDate !== \\"\\") {labDate = new Date(labDate);if (labDate.getTime) {labDate = labDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, labDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["16b2c13356e8dac3b3594018f91cccfb"]}},{"_id":"_design/lab_by_status","_rev":"2-ef5e8b51b3704c0cb1e525a63c81bd80","version":4,"views":{"lab_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"lab\\") {var labDate = doc.data.labDate;if (labDate && labDate !== \\"\\") {labDate = new Date(labDate);if (labDate.getTime) {labDate = labDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, labDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["ef5e8b51b3704c0cb1e525a63c81bd80","db4393c6856b98a40afd6ceef31db2a7"]}},{"_id":"_design/medication_by_status","_rev":"1-a6403c53b2db46905b3b1861120c6601","version":4,"views":{"medication_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'medication\') {\\n        var prescriptionDate = doc.data.prescriptionDate;\\n    if (prescriptionDate && prescriptionDate !== \\"\\") {\\n      prescriptionDate = new Date(prescriptionDate);\\n      if (prescriptionDate.getTime) {\\n        prescriptionDate = prescriptionDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["a6403c53b2db46905b3b1861120c6601"]}},{"_id":"_design/medication_by_status","_rev":"1-09e1d1c201823532161ef48ba23200be","version":4,"views":{"medication_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"medication\\") {var prescriptionDate = doc.data.prescriptionDate;if (prescriptionDate && prescriptionDate !== \\"\\") {prescriptionDate = new Date(prescriptionDate);if (prescriptionDate.getTime) {prescriptionDate = prescriptionDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["09e1d1c201823532161ef48ba23200be"]}},{"_id":"_design/medication_by_status","_rev":"2-9dec70f4b5aeaf7d9b8d70719125c41c","version":4,"views":{"medication_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"medication\\") {var prescriptionDate = doc.data.prescriptionDate;if (prescriptionDate && prescriptionDate !== \\"\\") {prescriptionDate = new Date(prescriptionDate);if (prescriptionDate.getTime) {prescriptionDate = prescriptionDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["9dec70f4b5aeaf7d9b8d70719125c41c","36ce9e9853552f5eb646ed26de7184dc"]}},{"_id":"_design/open_incidents_by_user","_rev":"1-34770efd210920a30c96d3787521e8a5","version":1,"views":{"open_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status !== \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      }\\n      return 0; // Don\'t sort\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/patient_by_admission","_rev":"1-3c2da4380d257c95ebf4430afa48de3b","version":4,"views":{"patient_by_admission":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.admitted === true) {\\n      if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["3c2da4380d257c95ebf4430afa48de3b"]}},{"_id":"_design/patient_by_admission","_rev":"2-cb3270a3d44a370d50128b93179d3503","version":4,"views":{"patient_by_admission":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.admitted === true) {\\n      if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["cb3270a3d44a370d50128b93179d3503","ee7b6ead26ac6b8b3f106c6d85dc175b"]}},{"_id":"_design/patient_by_display_id","_rev":"1-8a6930002af6d588ecdedd5f07da0230","version":7,"views":{"patient_by_display_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["8a6930002af6d588ecdedd5f07da0230"]}},{"_id":"_design/patient_by_display_id","_rev":"1-0b75ee7c82a1aadebd0bc0fd403622fb","version":5,"views":{"patient_by_display_id":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {if (doc.data.friendlyId) {emit([doc.data.friendlyId, doc._id]);} else if (doc.data.externalPatientId) {emit([doc.data.externalPatientId, doc._id]);} else {emit([doc._id, doc._id]);}}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'firstName\':\\n        case \'sex\':\\n        case \'lastName\':\\n        case \'status\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        case \'dateOfBirth\':\\n          {\\n            return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["0b75ee7c82a1aadebd0bc0fd403622fb"]}},{"_id":"_design/patient_by_display_id","_rev":"1-6f596cec9eb82609308fd9d25a9f9df2","version":4,"views":{"patient_by_display_id":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {if (doc.data.friendlyId) {emit([doc.data.friendlyId, doc._id]);} else if (doc.data.externalPatientId) {emit([doc.data.externalPatientId, doc._id]);} else {emit([doc._id, doc._id]);}}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'firstName\':\\n        case \'gender\':\\n        case \'lastName\':\\n        case \'status\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        case \'dateOfBirth\':\\n          {\\n            return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["6f596cec9eb82609308fd9d25a9f9df2"]}},{"_id":"_design/patient_by_display_id","_rev":"2-88a46c350d8994362cc0e5910f15d726","version":7,"views":{"patient_by_display_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["88a46c350d8994362cc0e5910f15d726","c619a041bccecc7e83b05015cc92706e"]}},{"_id":"_design/patient_by_status","_rev":"1-54bc74ff93db4aedff83bc649f766596","version":3,"views":{"patient_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        emit(doc.data.status);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["54bc74ff93db4aedff83bc649f766596"]}},{"_id":"_design/patient_by_status","_rev":"1-49f3f7f86891fb7d60f0ee1b2db1220b","version":3,"views":{"patient_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {emit(doc.data.status);}}}"}},"_revisions":{"start":1,"ids":["49f3f7f86891fb7d60f0ee1b2db1220b"]}},{"_id":"_design/patient_by_status","_rev":"2-b56763993297cda52343d99f7fdd1b03","version":3,"views":{"patient_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {emit(doc.data.status);}}}"}},"_revisions":{"start":2,"ids":["b56763993297cda52343d99f7fdd1b03","ff26a12cdb8747aae5bf26f9af3a1953"]}},{"_id":"_design/photo_by_patient","_rev":"1-6a4fad4fa682efbbd058e858c328574f","version":4,"views":{"photo_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'photo\') {\\n        emit(doc.data.patient);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["6a4fad4fa682efbbd058e858c328574f"]}},{"_id":"_design/photo_by_patient","_rev":"1-727ba2a3d1a106196746643395a859d0","version":4,"views":{"photo_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"photo\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":1,"ids":["727ba2a3d1a106196746643395a859d0"]}},{"_id":"_design/photo_by_patient","_rev":"2-0ea32da890536de0910ea412a3fa015c","version":4,"views":{"photo_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"photo\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":2,"ids":["0ea32da890536de0910ea412a3fa015c","e3dc5506f7f370535b85be0adc59c7cc"]}},{"_id":"_design/pricing_by_category","_rev":"1-b34429f4f8aff13ed218f70f039b3591","version":5,"views":{"pricing_by_category":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"pricing\\") {emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["b34429f4f8aff13ed218f70f039b3591"]}},{"_id":"_design/pricing_by_category","_rev":"1-3d703b5f240ae5838d1f20a8ad0471de","version":5,"views":{"pricing_by_category":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'pricing\') {\\n        emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["3d703b5f240ae5838d1f20a8ad0471de"]}},{"_id":"_design/pricing_by_category","_rev":"1-23d44e44019170eadd086734c87e3976","version":4,"views":{"pricing_by_category":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"pricing\\") {emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["23d44e44019170eadd086734c87e3976"]}},{"_id":"_design/procedure_by_date","_rev":"1-25ccef2a9dff3addd8c0d15cc79c363c","version":3,"views":{"procedure_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"procedure\\") {var procedureDate = doc.data.procedureDate;if (procedureDate && procedureDate !== \\"\\") {procedureDate = new Date(procedureDate);if (procedureDate.getTime) {procedureDate = procedureDate.getTime();}}emit([procedureDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["25ccef2a9dff3addd8c0d15cc79c363c"]}},{"_id":"_design/procedure_by_date","_rev":"1-a44decd8f14d01c615cf3f5b8e70f10b","version":4,"views":{"procedure_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'procedure\') {\\n        var procedureDate = doc.data.procedureDate;\\n    if (procedureDate && procedureDate !== \\"\\") {\\n      procedureDate = new Date(procedureDate);\\n      if (procedureDate.getTime) {\\n        procedureDate = procedureDate.getTime();\\n      }\\n    }\\n    emit([procedureDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["a44decd8f14d01c615cf3f5b8e70f10b"]}},{"_id":"_design/procedure_by_date","_rev":"1-7c23f1d0feaff1358bee1ddea760daac","version":4,"views":{"procedure_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"procedure\\") {var procedureDate = doc.data.procedureDate;if (procedureDate && procedureDate !== \\"\\") {procedureDate = new Date(procedureDate);if (procedureDate.getTime) {procedureDate = procedureDate.getTime();}}emit([procedureDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7c23f1d0feaff1358bee1ddea760daac"]}},{"_id":"_design/report_by_visit","_rev":"1-1295cef10df82554859efdb4c38c1c1e","version":1,"views":{"report_by_visit":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'report\') {\\n        emit(doc.data.visit);\\n      }\\n    }\\n  }"}}},{"_id":"_design/sequence_by_prefix","_rev":"1-10f81c9287f2db782b8e293e7d9b1cde","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'sequence\') {\\n        emit(doc.data.prefix);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["10f81c9287f2db782b8e293e7d9b1cde"]}},{"_id":"_design/sequence_by_prefix","_rev":"1-4a47589314718c2d8add1266b64b5ea6","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"sequence\\") {emit(doc.data.prefix);}}}"}},"_revisions":{"start":1,"ids":["4a47589314718c2d8add1266b64b5ea6"]}},{"_id":"_design/sequence_by_prefix","_rev":"2-73756debd255ca93fb25eab24ed9e12a","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"sequence\\") {emit(doc.data.prefix);}}}"}},"_revisions":{"start":2,"ids":["73756debd255ca93fb25eab24ed9e12a","8ac3a62b4c0b624ebed3b68b27cd197e"]}},{"_id":"_design/surgical_appointments_by_date","_rev":"1-90d8de834de1fe0e154d1cdab8889984","version":1,"views":{"surgical_appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType === \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/visit_by_date","_rev":"1-367a7fa42f1067f645190d560f83ef5e","version":3,"views":{"visit_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["367a7fa42f1067f645190d560f83ef5e"]}},{"_id":"_design/visit_by_date","_rev":"1-db61f993a1e1699c8205fee3434fc4c8","version":4,"views":{"visit_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([startDate, endDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["db61f993a1e1699c8205fee3434fc4c8"]}},{"_id":"_design/visit_by_date","_rev":"1-fd0a50125860ba3c17844c0567a70d65","version":4,"views":{"visit_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["fd0a50125860ba3c17844c0567a70d65"]}},{"_id":"_design/visit_by_discharge_date","_rev":"1-57a0b69b2792963e5112bbdd53bbba2d","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}emit([endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["57a0b69b2792963e5112bbdd53bbba2d"]}},{"_id":"_design/visit_by_discharge_date","_rev":"1-b4baca85d54e727966aeb2e8ad172136","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    emit([endDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["b4baca85d54e727966aeb2e8ad172136"]}},{"_id":"_design/visit_by_discharge_date","_rev":"2-76f05f3060660ab74749fa0def9cea07","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}emit([endDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["76f05f3060660ab74749fa0def9cea07","e53c95160dacaf007fe01c01215729ce"]}},{"_id":"_design/visit_by_patient","_rev":"1-bf45f0e7e8e9123a59095b609570a4ea","version":4,"views":{"visit_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["bf45f0e7e8e9123a59095b609570a4ea"]}},{"_id":"_design/visit_by_patient","_rev":"1-f2865c74eefee716937492db914f2ccd","version":4,"views":{"visit_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["f2865c74eefee716937492db914f2ccd"]}},{"_id":"_design/visit_by_patient","_rev":"1-412252178488867e2350dcd13da779ea","version":3,"views":{"visit_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["412252178488867e2350dcd13da779ea"]}},{"_id":"appointment_2_C47BE127-E509-6322-BB33-2E6ABE03D0F0","_rev":"2-44597ea8b1cdd20dc8d2c0ad9b2edbb6","data":{"allDay":true,"provider":"Dr Nick","location":"Hospital","appointmentType":"Followup","startDate":"2015-12-30T06:00:00.000Z","endDate":"2015-12-30T06:00:00.000Z","notes":null,"status":"Scheduled","lastModified":"2015-12-29T04:14:36.585Z","modifiedBy":"Admin User","patient":"C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","modifiedFields":{"appointmentType":"2015-12-29T04:14:21.124Z","allDay":"2015-12-29T04:14:21.124Z","startDate":"2015-12-29T04:14:36.585Z","endDate":"2015-12-29T04:14:36.585Z","location":"2015-12-29T04:14:21.124Z","provider":"2015-12-29T04:14:21.124Z"}},"_revisions":{"start":2,"ids":["44597ea8b1cdd20dc8d2c0ad9b2edbb6","953a11c67a694ef2daa469bd8c0f40ec"]}},{"_id":"imaging_2_12DEDA58-4670-7A74-BA8B-9CC5E5CA82E7","_rev":"1-3237f1a60f7ef9869553893a25e91e87","data":{"imagingDate":null,"notes":null,"radiologist":"","requestedBy":"Admin User","requestedDate":"2015-12-29T04:15:41.380Z","result":null,"status":"Requested","lastModified":"2015-12-29T04:15:41.382Z","modifiedBy":"Admin User","imagingType":"B93625F1-3C41-2D3E-94B9-3A8BAF87EBE8","patient":"C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","visit":"03C7BF8B-04E0-DD9E-9469-96A5604F5340","charges":[],"modifiedFields":{"radiologist":"2015-12-29T04:15:41.382Z","status":"2015-12-29T04:15:41.382Z","requestedBy":"2015-12-29T04:15:41.382Z","requestedDate":"2015-12-29T04:15:41.382Z"}}},{"_id":"imaging_2_51AFF85A-69C0-97C1-B22C-716A1BA7B80B","_rev":"1-3e1a5d957291144f7ba1e9c0c7c2cb12","data":{"imagingDate":"2015-12-29T04:07:03.693Z","notes":null,"radiologist":"Dr Xray","requestedBy":"Admin User","requestedDate":"2015-12-29T04:07:03.694Z","result":null,"status":"Completed","lastModified":"2015-12-29T04:07:03.744Z","modifiedBy":"Admin User","imagingType":"B93625F1-3C41-2D3E-94B9-3A8BAF87EBE8","patient":"C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","visit":"03C7BF8B-04E0-DD9E-9469-96A5604F5340","charges":[],"modifiedFields":{"radiologist":"2015-12-29T04:07:03.744Z","status":"2015-12-29T04:07:03.744Z","imagingDate":"2015-12-29T04:07:03.744Z","requestedBy":"2015-12-29T04:07:03.744Z","requestedDate":"2015-12-29T04:07:03.744Z"}}},{"_id":"invLocation_2_0323721B-EDD0-6C91-BB34-52FBEACBA7DE","_rev":"3-f43e02982eff2b35453b4dcf537fec3f","data":{"quantity":0,"location":null,"aisleLocation":null,"lastModified":"2015-12-29T03:13:47.396Z","modifiedBy":"Admin User","modifiedFields":{"quantity":"2015-12-29T03:13:47.396Z"}},"_revisions":{"start":3,"ids":["f43e02982eff2b35453b4dcf537fec3f","e8c15241efd7bb6c8bf891c28558d83b","c2e397e9ebd1266da5de2e1a3033fcc6"]}},{"_id":"invLocation_2_24BB235E-B271-AF61-9A3D-9ACD77CE25AF","_rev":"3-b8964e3b548efa84d5602224e88a1126","data":{"quantity":0,"location":null,"aisleLocation":null,"lastModified":"2015-12-29T03:08:57.289Z","modifiedBy":"Admin User","modifiedFields":{"quantity":"2015-12-29T03:08:57.289Z"}},"_revisions":{"start":3,"ids":["b8964e3b548efa84d5602224e88a1126","dff7e3f8434279a562a3d4ffc0106c6e","2d8c410350e7ecfffd6e496f6f05ca30"]}},{"_id":"invLocation_2_32BCC947-E272-1564-90E1-C6E2ECE14881","_rev":"2-74b9d0e13f10a766c8e02a411b21bc9e","data":{"quantity":12,"location":"Warehouse","aisleLocation":"A1","lastModified":"2015-12-29T03:47:25.988Z","modifiedBy":"Admin User","modifiedFields":{"aisleLocation":"2015-12-29T03:47:25.919Z","location":"2015-12-29T03:47:25.919Z","quantity":"2015-12-29T03:47:25.988Z"}},"_revisions":{"start":2,"ids":["74b9d0e13f10a766c8e02a411b21bc9e","8adc0c9f4543aebccdfce691b8c1199d"]}},{"_id":"invLocation_2_7FD0F94A-6D4E-6365-A4EF-F7B4F8D35C22","_rev":"3-85e5ea976718b1331eade5d9f567654b","data":{"quantity":0,"location":"Warehouse","aisleLocation":null,"lastModified":"2015-12-29T03:46:41.557Z","modifiedBy":"Admin User","modifiedFields":{"location":"2015-12-29T03:13:47.288Z","quantity":"2015-12-29T03:46:41.557Z"}},"_revisions":{"start":3,"ids":["85e5ea976718b1331eade5d9f567654b","eb663365f6944558113da9820789b8fd","ac3af5754777c65209c3d9c7cc03dfb2"]}},{"_id":"invLocation_2_DBCF3E06-B812-B6C7-930E-74F9372D384A","_rev":"3-a15f0e36baae0abfa52ae68b42e3ad0e","data":{"quantity":999998,"location":"Pharmacy","aisleLocation":null,"lastModified":"2015-12-29T04:01:16.092Z","modifiedBy":"Admin User","modifiedFields":{"location":"2015-12-29T03:08:57.191Z","quantity":"2015-12-29T04:01:16.092Z"}},"_revisions":{"start":3,"ids":["a15f0e36baae0abfa52ae68b42e3ad0e","d365a641356ccd999cf5f91ec842f5a9","e8dfec40fbf6418583392d73b24a9b32"]}},{"_id":"invPurchase_2_05760051-8BD1-ACC0-8013-0C59A545FB8D","_rev":"2-d7477df9559ec794be0e3084f09c310b","data":{"purchaseCost":12,"lotNumber":"","dateReceived":"2015-11-01T05:00:00.000Z","originalQuantity":25,"currentQuantity":0,"expirationDate":null,"expired":false,"location":null,"aisleLocation":null,"giftInKind":false,"inventoryItem":"iiqtim0c_ex","vendor":"ACME INC","vendorItemNo":"","distributionUnit":null,"invoiceNo":null,"lastModified":"2015-12-29T03:46:41.558Z","modifiedBy":"Admin User","modifiedFields":{"dateReceived":"2015-12-29T03:12:56.853Z","purchaseCost":"2015-12-29T03:12:56.853Z","lotNumber":"2015-12-29T03:12:56.853Z","vendor":"2015-12-29T03:12:56.853Z","vendorItemNo":"2015-12-29T03:12:56.853Z","originalQuantity":"2015-12-29T03:12:56.853Z","currentQuantity":"2015-12-29T03:46:41.558Z","inventoryItem":"2015-12-29T03:12:56.853Z"}},"_revisions":{"start":2,"ids":["d7477df9559ec794be0e3084f09c310b","2b41a3edbfe25818058eca69712b2033"]}},{"_id":"invPurchase_2_155B2B94-6C47-E6B5-BD1E-11F375CB2C29","_rev":"1-8308be24f6677a3a6aefc7cdde9b1c13","data":{"purchaseCost":6,"lotNumber":null,"dateReceived":"2015-12-03T06:00:00.000Z","originalQuantity":12,"currentQuantity":12,"expirationDate":null,"expired":false,"location":"Warehouse","aisleLocation":"A1","giftInKind":false,"inventoryItem":"iiqtim0c_ex","vendor":"ACME INC","vendorItemNo":"","distributionUnit":"pcs","invoiceNo":"","lastModified":"2015-12-29T03:47:25.866Z","modifiedBy":"Admin User","modifiedFields":{"dateReceived":"2015-12-29T03:47:25.866Z","distributionUnit":"2015-12-29T03:47:25.866Z","inventoryItem":"2015-12-29T03:47:25.866Z","invoiceNo":"2015-12-29T03:47:25.866Z","originalQuantity":"2015-12-29T03:47:25.866Z","quantityGroups":"2015-12-29T03:47:25.866Z","purchaseCost":"2015-12-29T03:47:25.866Z","vendor":"2015-12-29T03:47:25.866Z","vendorItemNo":"2015-12-29T03:47:25.866Z","location":"2015-12-29T03:47:25.866Z","aisleLocation":"2015-12-29T03:47:25.866Z","currentQuantity":"2015-12-29T03:47:25.866Z"},"quantityGroups":[{"index":0,"unit":"pcs","firstQuantity":true,"quantity":"12"}]}},{"_id":"invPurchase_2_E3B2184F-4ECA-3B76-92C8-437846C2E3DC","_rev":"2-846e30db369e739e0603938b12776d45","data":{"purchaseCost":12345,"lotNumber":null,"dateReceived":"2015-12-01T06:00:00.000Z","originalQuantity":1000000,"currentQuantity":999998,"expirationDate":null,"expired":false,"location":null,"aisleLocation":null,"giftInKind":false,"inventoryItem":"iiqtc6w3_31","vendor":"ACME INC","vendorItemNo":null,"distributionUnit":null,"invoiceNo":null,"lastModified":"2015-12-29T04:01:16.093Z","modifiedBy":"Admin User","modifiedFields":{"dateReceived":"2015-12-29T03:08:23.921Z","purchaseCost":"2015-12-29T03:08:23.921Z","vendor":"2015-12-29T03:08:23.921Z","originalQuantity":"2015-12-29T03:08:23.921Z","currentQuantity":"2015-12-29T04:01:16.093Z","inventoryItem":"2015-12-29T03:08:23.921Z"}},"_revisions":{"start":2,"ids":["846e30db369e739e0603938b12776d45","03ddad7882d9ed7041637de509902109"]}},{"_id":"invRequest_2_2A5251B5-1919-CB55-8757-A53DC057A77E","_rev":"1-222c0c115dc924e7d90cbde2b6023ebd","data":{"adjustPurchases":false,"completedBy":"Admin User","costPerUnit":null,"dateCompleted":"2015-12-01T06:00:00.000Z","dateRequested":null,"deliveryAisle":null,"deliveryLocation":"Pharmacy","expenseAccount":null,"markAsConsumed":true,"quantity":1000000,"quantityAtCompletion":null,"reason":null,"requestedBy":null,"status":"Completed","transactionType":"Transfer","lastModified":"2015-12-29T03:08:57.351Z","modifiedBy":"Admin User","inventoryItem":"iiqtc6w3_31","patient":null,"visit":null,"modifiedFields":{"adjustPurchases":"2015-12-29T03:08:57.351Z","dateCompleted":"2015-12-29T03:08:57.351Z","quantity":"2015-12-29T03:08:57.351Z","deliveryLocation":"2015-12-29T03:08:57.351Z","transactionType":"2015-12-29T03:08:57.351Z","locationsAffected":"2015-12-29T03:08:57.351Z","status":"2015-12-29T03:08:57.351Z","completedBy":"2015-12-29T03:08:57.351Z"},"locationsAffected":[{"name":"No Location","quantity":"1000000"}]}},{"_id":"invRequest_2_6F095231-0D58-E48D-B59F-8D4CB3965802","_rev":"1-f709e83b929a4ac8e25c39de04bb36d9","data":{"adjustPurchases":true,"completedBy":"Admin User","costPerUnit":0.01,"dateCompleted":"2015-12-29T04:01:16.080Z","dateRequested":null,"deliveryAisle":null,"deliveryLocation":null,"expenseAccount":null,"markAsConsumed":true,"quantity":2,"quantityAtCompletion":1000000,"reason":null,"requestedBy":null,"status":"Completed","transactionType":"Fulfillment","lastModified":"2015-12-29T04:01:16.251Z","modifiedBy":"Admin User","inventoryItem":"iiqtc6w3_31","patient":"C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","visit":null,"modifiedFields":{"dateCompleted":"2015-12-29T04:01:16.251Z","quantity":"2015-12-29T04:01:16.251Z","transactionType":"2015-12-29T04:01:16.251Z","markAsConsumed":"2015-12-29T04:01:16.251Z","adjustPurchases":"2015-12-29T04:01:16.251Z","costPerUnit":"2015-12-29T04:01:16.251Z","quantityAtCompletion":"2015-12-29T04:01:16.251Z","purchasesAffected":"2015-12-29T04:01:16.251Z","locationsAffected":"2015-12-29T04:01:16.251Z","status":"2015-12-29T04:01:16.251Z","completedBy":"2015-12-29T04:01:16.251Z"},"purchasesAffected":[{"id":"E3B2184F-4ECA-3B76-92C8-437846C2E3DC","quantity":2}],"locationsAffected":[{"name":"Pharmacy","quantity":2}]}},{"_id":"invRequest_2_91481B28-0A00-9C72-9094-E34D6B70442D","_rev":"1-c1b1d2ef55725427ea6f31fafd43a776","data":{"adjustPurchases":false,"completedBy":null,"costPerUnit":null,"dateCompleted":null,"dateRequested":"2015-12-29T03:47:47.911Z","deliveryAisle":null,"deliveryLocation":"Pharmacy","expenseAccount":"Pharmacy","markAsConsumed":true,"quantity":2,"quantityAtCompletion":null,"reason":null,"requestedBy":"Admin User","status":"Requested","transactionType":"Request","lastModified":"2015-12-29T03:47:47.912Z","modifiedBy":"Admin User","inventoryItem":"iiqtim0c_ex","patient":null,"visit":null,"modifiedFields":{"transactionType":"2015-12-29T03:47:47.912Z","quantity":"2015-12-29T03:47:47.912Z","deliveryLocation":"2015-12-29T03:47:47.912Z","expenseAccount":"2015-12-29T03:47:47.912Z","dateRequested":"2015-12-29T03:47:47.912Z","requestedBy":"2015-12-29T03:47:47.912Z","status":"2015-12-29T03:47:47.912Z"}}},{"_id":"invRequest_2_B419E42C-87A8-1AFC-BDEF-3145ED774BE7","_rev":"1-a61eb2eac18550ed06ae528db3de51f0","data":{"adjustPurchases":false,"completedBy":"Admin User","costPerUnit":null,"dateCompleted":"2015-12-01T06:00:00.000Z","dateRequested":null,"deliveryAisle":null,"deliveryLocation":"Warehouse","expenseAccount":null,"markAsConsumed":true,"quantity":25,"quantityAtCompletion":null,"reason":null,"requestedBy":null,"status":"Completed","transactionType":"Transfer","lastModified":"2015-12-29T03:13:47.447Z","modifiedBy":"Admin User","inventoryItem":"iiqtim0c_ex","patient":null,"visit":null,"modifiedFields":{"adjustPurchases":"2015-12-29T03:13:47.447Z","dateCompleted":"2015-12-29T03:13:47.447Z","quantity":"2015-12-29T03:13:47.447Z","deliveryLocation":"2015-12-29T03:13:47.447Z","transactionType":"2015-12-29T03:13:47.447Z","locationsAffected":"2015-12-29T03:13:47.447Z","status":"2015-12-29T03:13:47.447Z","completedBy":"2015-12-29T03:13:47.447Z"},"locationsAffected":[{"name":"No Location","quantity":"25"}]}},{"_id":"invRequest_2_CA5F4301-1600-1230-B276-0B3C98402C13","_rev":"1-9c9872e5caf5f80fe4cf434e014fcfe3","data":{"adjustPurchases":true,"completedBy":"Admin User","costPerUnit":0.48,"dateCompleted":"2015-12-28T06:00:00.000Z","dateRequested":"2015-12-29T03:46:41.543Z","deliveryAisle":null,"deliveryLocation":"Ward 1","expenseAccount":"Ward","markAsConsumed":true,"quantity":25,"quantityAtCompletion":25,"reason":null,"requestedBy":"Admin User","status":"Completed","transactionType":"Fulfillment","lastModified":"2015-12-29T03:46:41.732Z","modifiedBy":"Admin User","inventoryItem":"iiqtim0c_ex","patient":null,"visit":null,"modifiedFields":{"transactionType":"2015-12-29T03:46:41.732Z","quantity":"2015-12-29T03:46:41.732Z","dateCompleted":"2015-12-29T03:46:41.732Z","deliveryLocation":"2015-12-29T03:46:41.732Z","expenseAccount":"2015-12-29T03:46:41.732Z","dateRequested":"2015-12-29T03:46:41.732Z","requestedBy":"2015-12-29T03:46:41.732Z","adjustPurchases":"2015-12-29T03:46:41.732Z","costPerUnit":"2015-12-29T03:46:41.732Z","quantityAtCompletion":"2015-12-29T03:46:41.732Z","purchasesAffected":"2015-12-29T03:46:41.732Z","locationsAffected":"2015-12-29T03:46:41.732Z","status":"2015-12-29T03:46:41.732Z","completedBy":"2015-12-29T03:46:41.732Z"},"purchasesAffected":[{"id":"05760051-8BD1-ACC0-8013-0C59A545FB8D","quantity":25}],"locationsAffected":[{"name":"Warehouse","quantity":25}]}},{"_id":"inventory_2_iiqtc6w3_31","_rev":"3-0c0a71f273bf0633cafce271b0f35007","data":{"description":null,"friendlyId":"m00001","name":"Cefazolin 500mg vial (Hazolin)","quantity":999998,"crossReference":null,"inventoryType":"Medication","price":null,"reorderPoint":null,"distributionUnit":"vial","rank":null,"lastModified":"2015-12-29T04:01:16.249Z","modifiedBy":"Admin User","locations":["24BB235E-B271-AF61-9A3D-9ACD77CE25AF","DBCF3E06-B812-B6C7-930E-74F9372D384A"],"purchases":["E3B2184F-4ECA-3B76-92C8-437846C2E3DC"],"modifiedFields":{"name":"2015-12-29T03:08:24.053Z","inventoryType":"2015-12-29T03:08:24.053Z","distributionUnit":"2015-12-29T03:08:24.053Z","quantity":"2015-12-29T04:01:16.249Z","friendlyId":"2015-12-29T03:08:24.053Z"}},"_revisions":{"start":3,"ids":["0c0a71f273bf0633cafce271b0f35007","42bc38c66d9a87103c7871aa9aadb6b5","295e3c0d1de3d7a7d384ae5090d82125"]}},{"_id":"inventory_2_iiqtim0c_ex","_rev":"4-6900f25cb0aa33334fb6c69e4a828718","data":{"description":null,"friendlyId":"s00001","name":"Pumpset Kangaroo 1000ml","quantity":12,"crossReference":null,"inventoryType":"Supply","price":null,"reorderPoint":null,"distributionUnit":"pcs","rank":null,"lastModified":"2015-12-29T03:47:26.017Z","modifiedBy":"Admin User","locations":["0323721B-EDD0-6C91-BB34-52FBEACBA7DE","7FD0F94A-6D4E-6365-A4EF-F7B4F8D35C22","32BCC947-E272-1564-90E1-C6E2ECE14881"],"purchases":["05760051-8BD1-ACC0-8013-0C59A545FB8D","155B2B94-6C47-E6B5-BD1E-11F375CB2C29"],"modifiedFields":{"name":"2015-12-29T03:12:56.959Z","inventoryType":"2015-12-29T03:12:56.959Z","distributionUnit":"2015-12-29T03:12:56.959Z","quantity":"2015-12-29T03:47:26.017Z","friendlyId":"2015-12-29T03:12:56.959Z"}},"_revisions":{"start":4,"ids":["6900f25cb0aa33334fb6c69e4a828718","03eb3fc36799eb0e78c1d4f5b45e50a0","064996d833372bc743ccd60baa1174b9","1622cc9c6428d24950f02c88112840f4"]}},{"_id":"lab_2_C9274C34-248C-FF7C-9E8B-F3110467C941","_rev":"2-78aaf934410f626a7dc64c8ce640ad17","data":{"labDate":"2015-12-29T04:07:25.725Z","notes":null,"requestedBy":"Admin User","requestedDate":"2015-12-29T04:03:22.879Z","result":"Normal","status":"Completed","lastModified":"2015-12-29T04:07:25.725Z","modifiedBy":"Admin User","labType":"A33BFA09-AFBB-CA35-A01C-702B568FFAE8","patient":"C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","visit":"03C7BF8B-04E0-DD9E-9469-96A5604F5340","charges":[],"modifiedFields":{"status":"2015-12-29T04:07:25.725Z","requestedBy":"2015-12-29T04:03:22.927Z","requestedDate":"2015-12-29T04:03:22.927Z","result":"2015-12-29T04:07:25.725Z","labDate":"2015-12-29T04:07:25.725Z"}},"_revisions":{"start":2,"ids":["78aaf934410f626a7dc64c8ce640ad17","0e55563ae178ae5b340c29a50f168925"]}}]}\n{"seq":74}\n{"docs":[{"_id":"lab_2_EE3063E6-832D-930D-AD4E-D27341709886","_rev":"1-b0364bd6b060df4a2084ca292de1ad71","data":{"labDate":null,"notes":null,"requestedBy":"Admin User","requestedDate":"2015-12-29T04:18:34.699Z","result":null,"status":"Requested","lastModified":"2015-12-29T04:18:34.731Z","modifiedBy":"Admin User","labType":"4C0FA251-6FEA-8DDA-9DEB-83993EAB25F2","patient":"C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","visit":"03C7BF8B-04E0-DD9E-9469-96A5604F5340","charges":[],"modifiedFields":{"status":"2015-12-29T04:18:34.731Z","requestedBy":"2015-12-29T04:18:34.731Z","requestedDate":"2015-12-29T04:18:34.731Z"}}},{"_id":"lookup_2_aisle_location_list","_rev":"1-255c62c74fb06e5c13664e9e70aebef5","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["A1"]}},{"_id":"lookup_2_cpt_code_list","_rev":"1-499cca90fccff759c62b2fc781010226","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["27001"]}},{"_id":"lookup_2_diagnosis_list","_rev":"1-889e0d198f50d28df33bf522106b9438","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Fall from in-line roller-skates, initial encounter"]}},{"_id":"lookup_2_expense_account_list","_rev":"2-3404736b154767f3fe30e297704480be","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Pharmacy","Ward"]},"_revisions":{"start":2,"ids":["3404736b154767f3fe30e297704480be","36426f839aa10324a85e92d34fcf2c26"]}},{"_id":"lookup_2_patient_status_list","_rev":"1-01d7dfb8ec77de492bf913c5c763578c","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Scheduled for surgery"]}},{"_id":"lookup_2_physician_list","_rev":"1-99c8212cef905d552ab95fc88b8c3d5b","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Dr Nick"]}},{"_id":"lookup_2_procedure_list","_rev":"1-d48989bf01a1ae70a26e397c43266278","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["hip adductor release"]}},{"_id":"lookup_2_radiologists","_rev":"1-f029e944b51dcc7fd6f980d72c7027c7","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Dr Xray"]}},{"_id":"lookup_2_sex","_rev":"1-c433c64d3ecf2a60e4539b1d1dc43d27","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Male"]}},{"_id":"lookup_2_vendor_list","_rev":"1-a2760a7c86532da3f92ac75899b37e06","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["ACME INC"]}},{"_id":"lookup_2_visit_location_list","_rev":"1-d373d65b719c266173d92d3bb8f14e9f","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Hospital"]}},{"_id":"lookup_2_warehouse_list","_rev":"3-86923622f95bb3f49a906cb7cbacdc85","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Pharmacy","Ward 1","Warehouse"]},"_revisions":{"start":3,"ids":["86923622f95bb3f49a906cb7cbacdc85","64a1b3813d337c7000044dbc2de21892","4f316909ed8500d0f80cf20a684ce343"]}},{"_id":"medication_2_7B63E873-D056-CCC5-A69C-60064472A16E","_rev":"1-1ebd1e9a0f4dd4d90b52eb37db7fb493","data":{"notes":null,"prescription":"Twice a day for two days","prescriptionDate":"2015-12-28T06:00:00.000Z","quantity":4,"refills":null,"requestedDate":"2015-12-29T04:16:44.877Z","requestedBy":"Admin User","status":"Requested","lastModified":"2015-12-29T04:16:44.879Z","modifiedBy":"Admin User","inventoryItem":"iiqtc6w3_31","patient":"C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","visit":"03C7BF8B-04E0-DD9E-9469-96A5604F5340","modifiedFields":{"prescriptionDate":"2015-12-29T04:16:44.879Z","prescription":"2015-12-29T04:16:44.879Z","quantity":"2015-12-29T04:16:44.879Z","status":"2015-12-29T04:16:44.879Z","requestedBy":"2015-12-29T04:16:44.879Z","requestedDate":"2015-12-29T04:16:44.879Z"}}},{"_id":"medication_2_9187CEE0-13EC-1816-A2A4-95E9797999BF","_rev":"1-271cd0960f61b322d66b57a994141733","data":{"notes":null,"prescription":"Once a day for 2 days","prescriptionDate":"2015-12-01T06:00:00.000Z","quantity":2,"refills":null,"requestedDate":"2015-12-29T04:01:16.079Z","requestedBy":"Admin User","status":"Fulfilled","lastModified":"2015-12-29T04:01:16.096Z","modifiedBy":"Admin User","inventoryItem":"iiqtc6w3_31","patient":"C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","visit":"03C7BF8B-04E0-DD9E-9469-96A5604F5340","modifiedFields":{"prescriptionDate":"2015-12-29T04:01:16.096Z","prescription":"2015-12-29T04:01:16.096Z","quantity":"2015-12-29T04:01:16.096Z","status":"2015-12-29T04:01:16.096Z","requestedBy":"2015-12-29T04:01:16.096Z","requestedDate":"2015-12-29T04:01:16.096Z"}}},{"_id":"patient_2_C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","_rev":"4-dfabed4aec7088c46df7dac9bce8bc3f","data":{"admitted":true,"address":null,"address2":null,"address3":null,"address4":null,"bloodType":null,"clinic":null,"country":null,"dateOfBirth":"2013-08-06T04:00:00.000Z","economicClassification":null,"email":null,"externalPatientId":null,"familySupport1":null,"familySupport2":null,"familySupport3":null,"familySupport4":null,"familySupport5":null,"friendlyId":"P00001","firstName":"Joe","sex":"Male","history":null,"insurance":null,"lastName":"Bagadonuts","livingArrangement":null,"middleName":"","notes":null,"otherIncome":null,"patientType":null,"parent":null,"phone":null,"placeOfBirth":null,"referredDate":null,"referredBy":null,"religion":null,"socialActionTaken":null,"socialRecommendation":null,"status":"Scheduled for surgery","lastModified":"2016-02-22T21:57:21.549Z","modifiedBy":"Admin User","paymentProfile":null,"payments":[],"modifiedFields":{"friendlyId":"2015-12-29T03:51:02.781Z","firstName":"2015-12-29T03:51:02.781Z","middleName":"2015-12-29T03:51:02.781Z","lastName":"2015-12-29T03:51:02.781Z","gender":"2015-12-29T03:51:02.781Z","dateOfBirth":"2016-02-22T21:57:21.549Z","status":"2015-12-29T03:53:17.032Z","admitted":"2015-12-29T03:53:58.574Z","sex":"2016-02-22T21:57:21.549Z"}},"_revisions":{"start":4,"ids":["dfabed4aec7088c46df7dac9bce8bc3f","1351af326b99acc03278830f30192916","105429e78d710023d6d490e880a3132a","fa6de36be0214f08f09477729bdfb339"]}},{"_id":"pricing_2_4C0FA251-6FEA-8DDA-9DEB-83993EAB25F2","_rev":"1-410ff865070244eac14c5cad5db0ad80","data":{"category":"Lab","expenseAccount":null,"name":"Fasting Blood Sugar (FBS)","price":null,"pricingType":"Lab Procedure","lastModified":"2015-12-29T04:18:34.703Z","modifiedBy":"Admin User","pricingOverrides":[],"modifiedFields":{"name":"2015-12-29T04:18:34.703Z","category":"2015-12-29T04:18:34.703Z","pricingType":"2015-12-29T04:18:34.703Z"}}},{"_id":"pricing_2_A33BFA09-AFBB-CA35-A01C-702B568FFAE8","_rev":"1-70ff211de7621293ffbd91df901f6d0f","data":{"category":"Lab","expenseAccount":null,"name":"Bleeding Time","price":null,"pricingType":"Lab Procedure","lastModified":"2015-12-29T04:03:22.884Z","modifiedBy":"Admin User","pricingOverrides":[],"modifiedFields":{"name":"2015-12-29T04:03:22.884Z","category":"2015-12-29T04:03:22.884Z","pricingType":"2015-12-29T04:03:22.884Z"}}},{"_id":"pricing_2_B93625F1-3C41-2D3E-94B9-3A8BAF87EBE8","_rev":"1-30c9df5437c85bb21539024c7222d307","data":{"category":"Imaging","expenseAccount":null,"name":"Ankle (Any Single View)","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-12-29T04:07:03.700Z","modifiedBy":"Admin User","pricingOverrides":[],"modifiedFields":{"name":"2015-12-29T04:07:03.700Z","category":"2015-12-29T04:07:03.700Z","pricingType":"2015-12-29T04:07:03.700Z"}}},{"_id":"procCharge_2_0AD46995-188B-EFB9-8A33-E47B3980476C","_rev":"1-3f577e28daa86e12c2ad71799e383c3b","data":{"quantity":1,"dateCharged":"2015-12-29T04:00:00.093Z","lastModified":"2015-12-29T04:00:08.611Z","modifiedBy":"Admin User","medication":"iiqtc6w3_31","pricingItem":null,"modifiedFields":{"dateCharged":"2015-12-29T04:00:08.611Z","quantity":"2015-12-29T04:00:08.611Z"}}},{"_id":"procedure_2_398B4F58-152F-1476-8ED1-329C4D85E25F","_rev":"5-979bd8081e0ae3ccebf595c28bafd145","data":{"anesthesiaType":"","anesthesiologist":null,"assistant":null,"description":"hip adductor release","cptCode":"27001","location":null,"notes":null,"physician":"Dr Nick","procedureDate":"2015-12-01T06:00:00.000Z","timeStarted":null,"timeEnded":null,"lastModified":"2015-12-29T04:00:33.229Z","modifiedBy":"Admin User","visit":"03C7BF8B-04E0-DD9E-9469-96A5604F5340","charges":["0AD46995-188B-EFB9-8A33-E47B3980476C"],"modifiedFields":{"procedureDate":"2015-12-29T03:59:55.401Z","description":"2015-12-29T03:59:37.244Z","physician":"2015-12-29T03:59:37.244Z","anesthesiaType":"2015-12-29T03:59:37.244Z","cptCode":"2015-12-29T04:00:33.229Z"}},"_revisions":{"start":5,"ids":["979bd8081e0ae3ccebf595c28bafd145","561ab91abdd5e0f240a3ec30c9a3e09c","0a938774f0f0e600f15dd29d08b98b50","5570e1e8726f29f430a5de6e81a36e60","6c0abd3cf72cb182b05caa21150fb113"]}},{"_id":"sequence_2_inventory_Medication","_rev":"1-1acccea88a50973cbe8840a31911aa7c","data":{"prefix":"m","value":1}},{"_id":"sequence_2_inventory_Supply","_rev":"1-538fc2bf7cd4745eea01fcf24ced6164","data":{"prefix":"s","value":1}},{"_id":"sequence_2_patient","_rev":"5-f6fd8c9cb7b07567399a04a72f02822a","data":{"prefix":null,"value":1},"_revisions":{"start":5,"ids":["f6fd8c9cb7b07567399a04a72f02822a","79dabe4ed5c7897e103171a7bf8bf1b6","945c072575a32fca103968a3cd425c31","f9a8fd6c55cd4e5fb0064b7767586e05","5bc31ffefa482f2e66299cf0704623c8"]}},{"_id":"visit_2_03C7BF8B-04E0-DD9E-9469-96A5604F5340","_rev":"12-48973daa88a2567931f70586aa5f4b6e","data":{"dischargeInfo":null,"endDate":"2015-12-29T04:11:00.724Z","examiner":"Dr Nick","history":null,"historySince":null,"location":null,"notes":null,"outPatient":false,"primaryDiagnosis":"Fall from in-line roller-skates, initial encounter","primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-12-01T15:53:00.000Z","status":"Discharged","visitType":"Admission","lastModified":"2015-12-29T04:11:47.272Z","modifiedBy":"Admin User","patient":"C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","vitals":["B9FDB59B-BA3F-40A2-9D42-2A9B0E7270FC"],"procedures":["398B4F58-152F-1476-8ED1-329C4D85E25F"],"medication":["9187CEE0-13EC-1816-A2A4-95E9797999BF","7B63E873-D056-CCC5-A69C-60064472A16E"],"labs":["C9274C34-248C-FF7C-9E8B-F3110467C941","EE3063E6-832D-930D-AD4E-D27341709886"],"imaging":["51AFF85A-69C0-97C1-B22C-716A1BA7B80B","12DEDA58-4670-7A74-BA8B-9CC5E5CA82E7"],"charges":[],"modifiedFields":{"visitType":"2015-12-29T03:53:58.543Z","startDate":"2015-12-29T04:11:47.272Z","status":"2015-12-29T04:11:47.272Z","outPatient":"2015-12-29T03:53:58.543Z","primaryDiagnosis":"2015-12-29T03:59:37.312Z","examiner":"2015-12-29T04:06:19.274Z","endDate":"2015-12-29T04:11:47.272Z"}},"_revisions":{"start":12,"ids":["48973daa88a2567931f70586aa5f4b6e","0baeb91a16dad77c0d8e55e6b38e6c8e","e26c621939e57cdf40fe92362f5dac3a","7315d0ff5e6eac570c2b47fd6e9d9406","d1be40a55f4329d18cc6c8f8b8b2d55a","e8567f5b5576aa5d4141f2776b24ab58","d54e63df97dd964288c6dd66d049dae9","210c948fb309be4793ca14cec7f3a335","29e6bb7a6732517b79f8c90fbcebdedd","a83b26f6b056f7c54d917160b366a75b","ebed6471bdd978af39c5acfc3f1f34b7","284cb8e69ca4b392156fe1d22866fcfb"]}},{"_id":"vital_2_B9FDB59B-BA3F-40A2-9D42-2A9B0E7270FC","_rev":"1-62233a35020adba2b7d65fd09e5e3cba","data":{"dateRecorded":"2015-12-04T04:08:00.000Z","temperature":36.67,"weight":"57lb","height":"3\'6\\"","sbp":117,"dbp":76,"heartRate":60,"respiratoryRate":12,"lastModified":"2015-12-29T04:11:11.942Z","modifiedBy":"Admin User","modifiedFields":{"dateRecorded":"2015-12-29T04:11:11.942Z","temperature":"2015-12-29T04:11:11.942Z","weight":"2015-12-29T04:11:11.942Z","height":"2015-12-29T04:11:11.942Z","sbp":"2015-12-29T04:11:11.942Z","dbp":"2015-12-29T04:11:11.942Z","heartRate":"2015-12-29T04:11:11.942Z","respiratoryRate":"2015-12-29T04:11:11.942Z"}}}]}\n{"seq":100}\n';});
define('hospitalrun/tests/fixtures/incident', ['exports'], function (exports) {
  exports['default'] = '{"version":"1.2.5","db_type":"http","start_time":"2017-03-16T14:38:47.756Z","db_info":{"db_name":"main","doc_count":40,"doc_del_count":0,"update_seq":41,"purge_seq":0,"compact_running":false,"disk_size":94312,"data_size":36552,"instance_start_time":"1489675080971419","disk_format_version":6,"committed_update_seq":41,"host":"http://localhost:5984/main/","auto_compaction":false,"adapter":"http"}}\n{"docs":[{"_id":"_design/custom_form_by_type","_rev":"1-ddf0ee75c1e8e859d821a9f5c1ec43b6","version":1,"views":{"custom_form_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'customForm\') {\\n        emit(doc.data.formType);\\n      }\\n    }\\n  }"}}}]}\n{"seq":2}\n{"docs":[{"_id":"_design/appointments_by_date","_rev":"1-5df29f1d7dbd39d6b3a2145923ab73cf","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}}]}\n{"seq":3}\n{"docs":[{"_id":"_design/appointments_by_patient","_rev":"1-9a97acd5b8fd071ad81afc9e730721c5","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate,doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/closed_incidents_by_user","_rev":"1-bf16176c13be57af9a4f1a0980710190","version":1,"views":{"closed_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status === \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}}},{"_id":"_design/imaging_by_status","_rev":"1-1a3bab3d2d1403299a9e4ad8dffe5fa1","version":4,"views":{"imaging_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'imaging\') {\\n        var imagingDate = doc.data.imagingDate;\\n    if (imagingDate && imagingDate !== \\"\\") {\\n      imagingDate = new Date(imagingDate);\\n      if (imagingDate.getTime) {\\n        imagingDate = imagingDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, imagingDate, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/incident_by_date","_rev":"1-59fa59734ee129cff0560b20a95d2d4e","version":1,"views":{"incident_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        var dateOfIncident = doc.data.dateOfIncident;\\n    if (dateOfIncident && dateOfIncident !== \\"\\") {\\n      dateOfIncident = new Date(dateOfIncident);\\n      if (dateOfIncident.getTime) {\\n        dateOfIncident = dateOfIncident.getTime();\\n      }\\n    }\\n    emit([dateOfIncident, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/incident_by_friendly_id","_rev":"1-885a12b67da47e956bc190fe1fe0d4e6","version":1,"views":{"incident_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_by_friendly_id","_rev":"1-82e24378f074a284cae14da4db5431ed","version":1,"views":{"inventory_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_by_name","_rev":"1-91f55ae6bd30f766d9da95bffe054bcb","version":5,"views":{"inventory_by_name":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.name, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/inventory_by_type","_rev":"1-18455500e1e86544edceaab01bb511bc","version":5,"views":{"inventory_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit(doc.data.inventoryType);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-0d7b597aeae746589980b12903768252","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invPurchase\') {\\n        var dateReceived = doc.data.dateReceived;\\n    if (dateReceived && dateReceived !== \\"\\") {\\n      dateReceived = new Date(dateReceived);\\n      if (dateReceived.getTime) {\\n        dateReceived = dateReceived.getTime();\\n      }\\n    }\\n    emit([dateReceived, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-1f41dd6d030c58884d7013ef9436decb","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invPurchase\') {\\n        var expirationDate = doc.data.expirationDate;\\n    if (expirationDate && expirationDate !== \\"\\") {\\n      expirationDate = new Date(expirationDate);\\n      if (expirationDate.getTime) {\\n        expirationDate = expirationDate.getTime();\\n      }\\n    }\\n    emit([expirationDate, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_request_by_item","_rev":"1-021f4c24b5b6202594f610cf5d4c63a4","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invRequest\') {\\n        var dateCompleted = doc.data.dateCompleted;\\n    if (dateCompleted && dateCompleted !== \\"\\") {\\n      dateCompleted = new Date(dateCompleted);\\n      if (dateCompleted.getTime) {\\n        dateCompleted = dateCompleted.getTime();\\n      }\\n    }\\n    emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_request_by_status","_rev":"1-cc0c1e0e01060aa62456d6ea768d8ec7","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invRequest\') {\\n        var dateCompleted = doc.data.dateCompleted;\\n    if (dateCompleted && dateCompleted !== \\"\\") {\\n      dateCompleted = new Date(dateCompleted);\\n      if (dateCompleted.getTime) {\\n        dateCompleted = dateCompleted.getTime();\\n      }\\n    }\\n    emit([doc.data.status, dateCompleted, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/invoice_by_patient","_rev":"1-9f67a58d4e428614844ac82cb2548268","version":1,"views":{"invoice_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invoice\') {\\n        emit(doc.data.patient);\\n      }\\n    }\\n  }"}}},{"_id":"_design/invoice_by_status","_rev":"1-d411e6f66f897f0b9b985dc6e5188d85","version":4,"views":{"invoice_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invoice\') {\\n        var billDate = doc.data.billDate;\\n    if (billDate && billDate !== \\"\\") {\\n      billDate = new Date(billDate);\\n      if (billDate.getTime) {\\n        billDate = billDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, billDate, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/lab_by_status","_rev":"1-7d4de6e219b482171b7ecd485ef72238","version":4,"views":{"lab_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'lab\') {\\n        var labDate = doc.data.labDate;\\n    if (labDate && labDate !== \\"\\") {\\n      labDate = new Date(labDate);\\n      if (labDate.getTime) {\\n        labDate = labDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, labDate, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/medication_by_status","_rev":"1-a6403c53b2db46905b3b1861120c6601","version":4,"views":{"medication_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'medication\') {\\n        var prescriptionDate = doc.data.prescriptionDate;\\n    if (prescriptionDate && prescriptionDate !== \\"\\") {\\n      prescriptionDate = new Date(prescriptionDate);\\n      if (prescriptionDate.getTime) {\\n        prescriptionDate = prescriptionDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/open_incidents_by_user","_rev":"1-34770efd210920a30c96d3787521e8a5","version":1,"views":{"open_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status !== \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      }\\n      return 0; // Don\'t sort\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/patient_by_admission","_rev":"1-3c2da4380d257c95ebf4430afa48de3b","version":4,"views":{"patient_by_admission":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.admitted === true) {\\n      if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/patient_by_display_id","_rev":"1-8a6930002af6d588ecdedd5f07da0230","version":7,"views":{"patient_by_display_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/patient_by_status","_rev":"1-54bc74ff93db4aedff83bc649f766596","version":3,"views":{"patient_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        emit(doc.data.status);\\n      }\\n    }\\n  }"}}},{"_id":"_design/photo_by_patient","_rev":"1-6a4fad4fa682efbbd058e858c328574f","version":4,"views":{"photo_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'photo\') {\\n        emit(doc.data.patient);\\n      }\\n    }\\n  }"}}},{"_id":"_design/pricing_by_category","_rev":"1-3d703b5f240ae5838d1f20a8ad0471de","version":5,"views":{"pricing_by_category":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'pricing\') {\\n        emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/procedure_by_date","_rev":"1-a44decd8f14d01c615cf3f5b8e70f10b","version":4,"views":{"procedure_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'procedure\') {\\n        var procedureDate = doc.data.procedureDate;\\n    if (procedureDate && procedureDate !== \\"\\") {\\n      procedureDate = new Date(procedureDate);\\n      if (procedureDate.getTime) {\\n        procedureDate = procedureDate.getTime();\\n      }\\n    }\\n    emit([procedureDate, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/report_by_visit","_rev":"1-1295cef10df82554859efdb4c38c1c1e","version":1,"views":{"report_by_visit":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'report\') {\\n        emit(doc.data.visit);\\n      }\\n    }\\n  }"}}},{"_id":"_design/sequence_by_prefix","_rev":"1-10f81c9287f2db782b8e293e7d9b1cde","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'sequence\') {\\n        emit(doc.data.prefix);\\n      }\\n    }\\n  }"}}},{"_id":"_design/surgical_appointments_by_date","_rev":"1-90d8de834de1fe0e154d1cdab8889984","version":1,"views":{"surgical_appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType === \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/visit_by_date","_rev":"1-db61f993a1e1699c8205fee3434fc4c8","version":4,"views":{"visit_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([startDate, endDate, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/visit_by_discharge_date","_rev":"1-b4baca85d54e727966aeb2e8ad172136","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    emit([endDate, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/visit_by_patient","_rev":"1-f2865c74eefee716937492db914f2ccd","version":4,"views":{"visit_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"attachment_2_58847f56-83af-4c15-a2e3-a57321d7ec99","_rev":"2-9a52175abfc01e988687f068cc0ecbb0","data":{"addedBy":"hradmin","addedByDisplayName":"Admin User","dateAdded":"2017-03-10T16:27:19.394Z","title":"Test attachment","caption":null,"coverImage":false,"fileName":"/incidents/56c64d71-ba30-4271-b899-f6f6b031f589/incident.txt","isImage":false,"localFile":true,"url":"filesystem:http://localhost:4200/persistent/incidents/56c64d71-ba30-4271-b899-f6f6b031f589/incident.txt","archived":false,"lastModified":"2017-03-10T16:27:55.024Z","modifiedBy":"Admin User","patient":null,"modifiedFields":{"dateAdded":"2017-03-10T16:27:54.840Z","addedBy":"2017-03-10T16:27:54.840Z","addedByDisplayName":"2017-03-10T16:27:54.840Z","fileName":"2017-03-10T16:27:55.024Z","title":"2017-03-10T16:27:54.840Z","files":"2017-03-10T16:27:54.840Z","isImage":"2017-03-10T16:27:54.840Z","localFile":"2017-03-10T16:27:55.024Z","url":"2017-03-10T16:27:55.024Z"},"files":{"file":{}}},"_revisions":{"start":2,"ids":["9a52175abfc01e988687f068cc0ecbb0","acc7631f57a6a19a20a3fd1cbd53719a"]},"_attachments":{"file":{"data":" ","digest":"md5-O8Ghp6RjqroMJxbCD4MFOg==","content_type":"text/plain","revpos":2}}},{"_id":"customForm_2_ad1cb1f2-4fc0-4c9d-b35a-a0f988ce7c5e","_rev":"7-4d8d52bedb330ab142fd53abf67a6347","data":{"alwaysInclude":false,"columns":2,"formType":"incident","name":"Pre-Incident Risk Assessment","archived":false,"lastModified":"2017-03-08T20:11:20.017Z","modifiedBy":"Admin User","modifiedFields":{"name":"2017-03-08T20:11:20.017Z","formType":"2017-03-08T20:11:20.017Z","columns":"2017-03-08T20:11:20.017Z"},"fields":[{"classNames":null,"colSpan":1,"includeOtherOption":false,"label":"Severity","otherOptionLabel":null,"prompt":null,"property":"severity","type":"radio","values":[{"label":"5 Extreme Death, toxic release off-site with detrimental effect, huge financial loss"},{"label":"4 High Extensive injuries, loss of production capability, off-site release with no detrimental effects, major financial loss"},{"label":"3 Moderate Medical treatment required, on-site release contained with outside assistance, high financial loss"},{"label":"2 Low First aid treatment, on-site release contained, medium financial loss"},{"label":"1 Minimum No injuries, low financial loss"}]},{"classNames":null,"colSpan":1,"includeOtherOption":false,"label":"Occurrence","otherOptionLabel":null,"prompt":null,"property":"occurrence","type":"radio","values":[{"label":"5  Almost Certain  Is expected to occur in most circumstances (e.g. most weeks or months)"},{"label":"4  Likely Will probably occur in most circumstances (several times a year)"},{"label":"3  Possible Might occur at some time (every 1 to 2 years)"},{"label":"2  Unlikely Could occur at some time (possibly in the next 2 to 5 years)"},{"label":"1  Rare May occur only in exceptional circumstances (perhaps every 5 to 30 years)"}]}]},"_revisions":{"start":7,"ids":["4d8d52bedb330ab142fd53abf67a6347","144ce899e9db5fc2300996da9fe6c0ab","8f368fdc9d9dbce5b4d2b90210f2bcb9","8073815fa73f6990e7bb2deb77fb12a7","414d73feddcf40f5a1fd167969c3a602","c8b7a441091612c4489f99c9bd57cd92","f8a4799a21ece3f03578fb51669a0728"]}},{"_id":"customForm_2_b5e70841-b78b-4155-9ab5-babc6e0f45d1","_rev":"2-0a9dc37a28abce63101be0fe49cc65c9","data":{"alwaysInclude":true,"columns":1,"formType":"incident","name":"Harm Score","archived":false,"lastModified":"2017-03-08T20:03:19.266Z","modifiedBy":"Admin User","modifiedFields":{"name":"2017-03-08T20:03:19.266Z","formType":"2017-03-08T20:03:19.266Z","columns":"2017-03-08T20:03:19.266Z","alwaysInclude":"2017-03-08T20:03:19.266Z"},"fields":[{"classNames":null,"colSpan":null,"includeOtherOption":false,"label":"Harm Score","otherOptionLabel":null,"prompt":null,"property":"harmScore","type":"radio","values":[{"label":"A   No Actual Event (Unsafe Condition)"},{"label":"B1  Near Miss - The event did not reach the individual because of chance alone."},{"label":"B2  Near Miss - The event did not reach the individual because of active recovery efforts by caregivers."},{"label":"C   The event reached the individual but did not cause harm."},{"label":"D   The event reached the individual and required additional monitoring or treatment to prevent harm."},{"label":"E   The individual experienced temporary harm and required treatment or intervention."},{"label":"F   The individual experienced temporary harm and required initial or prolonged hospitalization"},{"label":"G   The individual experienced permanent harm."},{"label":"H   The individual experienced permanent harm and required intervention necessary to sustain life (e.g. transfer to ICU)"},{"label":"I   The individual died."}]}]},"_revisions":{"start":2,"ids":["0a9dc37a28abce63101be0fe49cc65c9","022d3782509a2e39231098f91c4ff6e3"]}},{"_id":"incCategory_2_926014ae-09e8-4a84-b5ca-bf5b74e6a66e","_rev":"19-952fa439be55b5d05daac9b22036fcd8","data":{"incidentCategoryName":"Accident or Injury","archived":false,"lastModified":"2017-03-08T19:27:23.252Z","modifiedBy":"Admin User","modifiedFields":{"incidentCategoryName":"2017-03-08T19:27:23.252Z","incidentCategoryItems":"2017-03-08T19:27:23.252Z"},"incidentCategoryItems":[{"item":"Patient"},{"item":"Staff"},{"item":"Visitor"},{"item":"Other"}]},"_revisions":{"start":19,"ids":["952fa439be55b5d05daac9b22036fcd8","ff92925f5de774642b31741d1e719c72","62363351300b35a8ea08a76ebde70c78","0facd37c7353d2687b7e0016671e13ea","f488bef85e63a2cd37a4c8f87b124ad7","843d670f1505286c4776a2d31dd24a6d","4c640d62bf0def873d75c61cbbd1d028","4a60a36fa1a89745c9b463bc6a82ce63","62133b9c7b236b00c5afceb9ec237e35","1a668956ce9a132fd01b489af72ee2da","10073b164dc3b3d0327d54bfa1029893","deb532df62f7e43732f12a4e9048343f","5e02b2f9068bb01fa20174c45a191edd","adfad92715a125aff37b36a4146d1718","e6a883ee493837e4db871daec9502c38","6e9d1bdadecc23bc9a5784f933d757d1","2560c5753a67267ac7fb831242b66d36","a91da396124d6f02640966523267eff9","214dd63d68b1ee9c742814bad6a741c0"]}},{"_id":"incCategory_2_be540109-2e7a-4210-99f8-8ecc8229b121","_rev":"5-5aee5f81c211c37ad210e7bfd49b46f3","data":{"incidentCategoryName":"Patient Falls","archived":false,"lastModified":"2017-03-08T19:41:56.167Z","modifiedBy":"Admin User","modifiedFields":{"incidentCategoryName":"2017-03-08T19:41:56.167Z","incidentCategoryItems":"2017-03-08T19:41:56.167Z"},"incidentCategoryItems":[{"item":"From bed"},{"item":"Sitting in chair"},{"item":"Ambulating"},{"item":"Grounds of Facility"},{"item":"Other"}]},"_revisions":{"start":5,"ids":["5aee5f81c211c37ad210e7bfd49b46f3","32a8067d8f84878abf1cc54c3b2b7562","9ea62078a74699bf156bce2187bca7c7","7ec0ba317e5024a9b6f7c9515d543a8f","a329294e5cd5ab7be8b6e78f1284fc46"]}},{"_id":"incidentNote_2_6ce1b9e8-2059-4412-8fef-ac51ee66561e","_rev":"1-1ed671fa954a6f4fbf0076e547b6b4be","data":{"givenBy":"hradmin","givenByDisplayName":"Admin User","description":"The wet floor sign had fallen down.","dateRecorded":"2017-03-08T20:22:00.339Z","archived":false,"lastModified":"2017-03-08T20:22:30.894Z","modifiedBy":"Admin User","modifiedFields":{"dateRecorded":"2017-03-08T20:22:30.894Z","givenBy":"2017-03-08T20:22:30.894Z","givenByDisplayName":"2017-03-08T20:22:30.894Z","description":"2017-03-08T20:22:30.894Z"}}},{"_id":"incident_2_56c64d71-ba30-4271-b899-f6f6b031f589","_rev":"10-54985aff97faf8502d2c1bc7cac2e51c","data":{"categoryItem":"Patient","categoryName":"Accident or Injury","customForms":{"b5e70841-b78b-4155-9ab5-babc6e0f45d1":{}},"dateOfIncident":"2017-03-08T20:20:00.863Z","department":"Reception","description":"Patient fell on wet floor.","friendlyId":"i00001","modifiedByDisplayName":"Admin User","notificationSend":false,"reportedBy":"hradmin","reportedByDisplayName":"Admin User","reportedDate":"2017-03-08T20:20:31.863Z","reportedTo":"Jane Bagadonuts","sentinelEvent":true,"status":"Reported","archived":false,"lastModified":"2017-03-10T16:29:39.946Z","modifiedBy":"Admin User","patient":"965a8c39-81a3-42b5-9881-b7ad7da127d6","notes":["6ce1b9e8-2059-4412-8fef-ac51ee66561e"],"incidentAttachments":["58847f56-83af-4c15-a2e3-a57321d7ec99"],"modifiedFields":{"dateOfIncident":"2017-03-08T20:21:30.499Z","reportedDate":"2017-03-08T20:21:30.499Z","reportedBy":"2017-03-08T20:21:30.499Z","reportedByDisplayName":"2017-03-08T20:21:30.499Z","department":"2017-03-08T20:21:30.499Z","reportedTo":"2017-03-08T20:21:30.499Z","categoryName":"2017-03-08T20:21:30.499Z","categoryItem":"2017-03-08T20:21:30.499Z","description":"2017-03-08T20:21:30.499Z","modifiedByDisplayName":"2017-03-08T20:21:30.499Z","friendlyId":"2017-03-08T20:21:30.499Z","customForms":"2017-03-10T16:29:00.039Z","sentinelEvent":"2017-03-10T16:29:39.946Z"}},"_revisions":{"start":10,"ids":["54985aff97faf8502d2c1bc7cac2e51c","21d1afe4f6b7a583797fd227f4a62428","566a77dbbf92a5a46236e40f4d866034","acd64eadb33939525d3fb6df118be3c7","226742d6cca305a7b755555b4bd89758","4355d5493f1f3bcb32a73956bd7c4bbf","f5a1ac0398c14f65369ea37c7b8edd63","483618654c57d42fb9702be81277192e","fbd6489e112bce980737221ce4ca8e14","36a17cc165199d68f908d79841621edd"]}},{"_id":"lookup_2_incident_departments","_rev":"7-346b2f2d9db9396502eb24c702373816","data":{"organizeByType":false,"userCanAdd":true,"value":["Administrative Services","Laboratory","Operating Room","Pediatrics Clinic","Pharmacy","Radiology","Reception"]},"_revisions":{"start":7,"ids":["346b2f2d9db9396502eb24c702373816","705e350dc09fb1c8908c4b6106dfc82e","fbbbb0174932b837737db7ddfc8261e2","ab2df2af7b4c4d655535447ca7d67197","0268278fcfb97968347cf7d5b032c1c0","555e3dbd01a1e3a9f6b88c9b5c492d0d","c202d062450e1a8de13f65be9af8547c"]}},{"_id":"patient_2_965a8c39-81a3-42b5-9881-b7ad7da127d6","_rev":"2-b1e88abd56b3cad463a57905e06a7c76","data":{"admitted":false,"address":null,"address2":null,"address3":null,"address4":null,"bloodType":null,"clinic":null,"country":null,"checkedIn":false,"customForms":{},"dateOfBirth":"2016-06-07T04:00:00.000Z","economicClassification":null,"email":null,"externalPatientId":null,"familySupport1":null,"familySupport2":null,"familySupport3":null,"familySupport4":null,"familySupport5":null,"friendlyId":"P00001","firstName":"Joe","sex":"Male","occupation":null,"history":null,"insurance":null,"lastName":"Bagadonuts","livingArrangement":null,"middleName":"","notes":null,"otherIncome":null,"patientType":null,"parent":null,"phone":null,"placeOfBirth":null,"referredDate":null,"referredBy":null,"religion":null,"socialActionTaken":null,"socialRecommendation":null,"status":null,"archived":false,"lastModified":"2017-03-08T20:16:00.826Z","modifiedBy":"Admin User","paymentProfile":null,"payments":[],"operativePlans":[],"operationReports":[],"diagnoses":[],"allergies":[],"modifiedFields":{"customForms":"2017-03-08T20:15:35.198Z","firstName":"2017-03-08T20:15:35.198Z","middleName":"2017-03-08T20:15:35.198Z","lastName":"2017-03-08T20:15:35.198Z","friendlyId":"2017-03-08T20:15:35.198Z","sex":"2017-03-08T20:16:00.826Z","dateOfBirth":"2017-03-08T20:16:00.826Z"}},"_revisions":{"start":2,"ids":["b1e88abd56b3cad463a57905e06a7c76","0492d9142db03aa6d3434f2a3a64053e"]}}]}\n{"seq":41}\n';
});
define('hospitalrun/tests/fixtures/inventory',['exports'],function(exports){exports['default'] = '{"version":"1.2.5","db_type":"http","start_time":"2017-03-16T14:40:19.086Z","db_info":{"db_name":"main","doc_count":67,"doc_del_count":21,"update_seq":112,"purge_seq":0,"compact_running":false,"disk_size":127080,"data_size":79880,"instance_start_time":"1489675170112412","disk_format_version":6,"committed_update_seq":112,"host":"http://localhost:5984/main/","auto_compaction":false,"adapter":"http"}}\n{"docs":[{"_id":"_design/closed_incidents_by_user","_rev":"1-bf16176c13be57af9a4f1a0980710190","version":1,"views":{"closed_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status === \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}}}]}\n{"seq":4}\n{"docs":[{"_id":"_design/custom_form_by_type","_rev":"1-ddf0ee75c1e8e859d821a9f5c1ec43b6","version":1,"views":{"custom_form_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'customForm\') {\\n        emit(doc.data.formType);\\n      }\\n    }\\n  }"}}}]}\n{"seq":5}\n{"docs":[{"_id":"_design/appointments_by_date","_rev":"1-178add045be11a7fd6aa7fdf97c8f3f0","version":6,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([startDate, endDate, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n      var filterBy = null;\\n      var includeRow = true;\\n      if (req.query && req.query.filterBy) {\\n        filterBy = JSON.parse(req.query.filterBy);\\n      }\\n      if (!filterBy) {\\n        return true;\\n      }\\n      for (var i = 0; i < filterBy.length; i++) {\\n        var currentValue = row.doc.data[filterBy[i].name];\\n        if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n          currentValue = \'Scheduled\';\\n        }\\n        if (currentValue !== filterBy[i].value) {\\n          includeRow = false;\\n          break;\\n        }\\n      }\\n      return includeRow;\\n    });rows.sort(function (a, b) {\\n      function defaultStatus(value) {\\n        if (!value || value === \'\') {\\n          return \'Scheduled\';\\n        } else {\\n          return value;\\n        }\\n      }\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'appointmentType\':\\n        case \'location\':\\n        case \'provider\':\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        case \'date\':\\n          {\\n            var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n            if (startDiff === 0) {\\n              return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n            } else {\\n              return startDiff;\\n            }\\n          }\\n        case \'status\':\\n          {\\n            var aStatus = defaultStatus(a.doc.data[sortBy]);\\n            var bStatus = defaultStatus(b.doc.data[sortBy]);\\n            return compareStrings(aStatus, bStatus);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["178add045be11a7fd6aa7fdf97c8f3f0"]}},{"_id":"_design/appointments_by_date","_rev":"1-5df29f1d7dbd39d6b3a2145923ab73cf","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["5df29f1d7dbd39d6b3a2145923ab73cf"]}},{"_id":"_design/appointments_by_date","_rev":"1-3c37df4fed5a034aedc1a295f4a672fd","version":4,"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n            var i,\\n                filterBy = null,\\n                includeRow = true;\\n            if (req.query && req.query.filterBy) {\\n                filterBy = JSON.parse(req.query.filterBy);\\n            }\\n            if (!filterBy) {\\n                return true;\\n            }\\n            for (i = 0; i < filterBy.length; i++) {\\n                var currentValue = row.doc[filterBy[i].name];\\n                if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n                    currentValue = \'Scheduled\';\\n                }\\n                if (currentValue !== filterBy[i].value) {\\n                    includeRow = false;\\n                    break;\\n                }\\n            }\\n            return includeRow;\\n        });rows.sort(function (a, b) {\\n            function defaultStatus(value) {\\n                if (!value || value === \'\') {\\n                    return \'Scheduled\';\\n                } else {\\n                    return value;\\n                }\\n            }\\n            var sortBy = \'\';\\n            if (req.query && req.query.sortKey) {\\n                sortBy = req.query.sortKey;\\n            }\\n            switch (sortBy) {\\n                case \'appointmentType\':\\n                case \'location\':\\n                case \'provider\':\\n                    return compareStrings(a.doc[sortBy], b.doc[sortBy]);\\n                case \'date\':\\n                    {\\n                        var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n                        if (startDiff === 0) {\\n                            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n                        } else {\\n                            return startDiff;\\n                        }\\n                        break;\\n                    }\\n                case \'status\':\\n                    {\\n                        var aStatus = defaultStatus(a.doc.data[sortBy]),\\n                            bStatus = defaultStatus(b.doc.data[sortBy]);\\n                        return compareStrings(aStatus, bStatus);\\n                    }\\n                default:\\n                    {\\n                        return 0; //Don\'t sort\\n                    }\\n            }\\n        });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"views":{"appointments_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["3c37df4fed5a034aedc1a295f4a672fd"]}},{"_id":"_design/appointments_by_date","_rev":"1-03951858f9232df2e774548b0f5fd068","version":4,"views":{"appointments_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n      var i,\\n          filterBy = null,\\n          includeRow = true;\\n      if (req.query && req.query.filterBy) {\\n        filterBy = JSON.parse(req.query.filterBy);\\n      }\\n      if (!filterBy) {\\n        return true;\\n      }\\n      for (i = 0; i < filterBy.length; i++) {\\n        var currentValue = row.doc.data[filterBy[i].name];\\n        if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n          currentValue = \'Scheduled\';\\n        }\\n        if (currentValue !== filterBy[i].value) {\\n          includeRow = false;\\n          break;\\n        }\\n      }\\n      return includeRow;\\n    });rows.sort(function (a, b) {\\n      function defaultStatus(value) {\\n        if (!value || value === \'\') {\\n          return \'Scheduled\';\\n        } else {\\n          return value;\\n        }\\n      }\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'appointmentType\':\\n        case \'location\':\\n        case \'provider\':\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        case \'date\':\\n          {\\n            var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n            if (startDiff === 0) {\\n              return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n            } else {\\n              return startDiff;\\n            }\\n            break;\\n          }\\n        case \'status\':\\n          {\\n            var aStatus = defaultStatus(a.doc.data[sortBy]),\\n                bStatus = defaultStatus(b.doc.data[sortBy]);\\n            return compareStrings(aStatus, bStatus);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["03951858f9232df2e774548b0f5fd068"]}},{"_id":"_design/appointments_by_date","_rev":"3-461875fa3e8aa582009473a4ebccf3bb","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":3,"ids":["461875fa3e8aa582009473a4ebccf3bb","2e78ab0f6da3881df4871d0b028148b9","4c8dd95ad6d36b9b4d86136d5e417f5c"]}},{"_id":"_design/appointments_by_patient","_rev":"1-7232d3292344540b2511e709422e2cbf","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate,doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7232d3292344540b2511e709422e2cbf"]}},{"_id":"_design/appointments_by_patient","_rev":"1-9a97acd5b8fd071ad81afc9e730721c5","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate,doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["9a97acd5b8fd071ad81afc9e730721c5"]}},{"_id":"_design/appointments_by_patient","_rev":"2-a8bb26daf0329c069a18ec0ce64532cb","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate,doc._id]);}}}"}},"_revisions":{"start":2,"ids":["a8bb26daf0329c069a18ec0ce64532cb","9868b6586898a48c3fd68722ca3fe1d4"]}},{"_id":"_design/imaging_by_status","_rev":"1-2feb5103c3f6d149bf98f0adeaa76b38","version":4,"views":{"imaging_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"imaging\\") {var imagingDate = doc.data.imagingDate;if (imagingDate && imagingDate !== \\"\\") {imagingDate = new Date(imagingDate);if (imagingDate.getTime) {imagingDate = imagingDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, imagingDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["2feb5103c3f6d149bf98f0adeaa76b38"]}},{"_id":"_design/imaging_by_status","_rev":"1-1a3bab3d2d1403299a9e4ad8dffe5fa1","version":4,"views":{"imaging_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'imaging\') {\\n        var imagingDate = doc.data.imagingDate;\\n    if (imagingDate && imagingDate !== \\"\\") {\\n      imagingDate = new Date(imagingDate);\\n      if (imagingDate.getTime) {\\n        imagingDate = imagingDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, imagingDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["1a3bab3d2d1403299a9e4ad8dffe5fa1"]}},{"_id":"_design/imaging_by_status","_rev":"2-57660077d48a8a4a0c1a3dd6ae214aac","version":4,"views":{"imaging_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"imaging\\") {var imagingDate = doc.data.imagingDate;if (imagingDate && imagingDate !== \\"\\") {imagingDate = new Date(imagingDate);if (imagingDate.getTime) {imagingDate = imagingDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, imagingDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["57660077d48a8a4a0c1a3dd6ae214aac","9236042e1fb9f567d1d527bbb429cd8e"]}},{"_id":"_design/incident_by_date","_rev":"1-59fa59734ee129cff0560b20a95d2d4e","version":1,"views":{"incident_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        var dateOfIncident = doc.data.dateOfIncident;\\n    if (dateOfIncident && dateOfIncident !== \\"\\") {\\n      dateOfIncident = new Date(dateOfIncident);\\n      if (dateOfIncident.getTime) {\\n        dateOfIncident = dateOfIncident.getTime();\\n      }\\n    }\\n    emit([dateOfIncident, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/incident_by_friendly_id","_rev":"1-885a12b67da47e956bc190fe1fe0d4e6","version":1,"views":{"incident_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_by_friendly_id","_rev":"1-82e24378f074a284cae14da4db5431ed","version":1,"views":{"inventory_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_by_name","_rev":"1-304304d63beaffd8d1ae4ae1cddf4b2b","version":3,"views":{"inventory_by_name":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit([doc.data.name, doc._id]);}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["304304d63beaffd8d1ae4ae1cddf4b2b"]}},{"_id":"_design/inventory_by_name","_rev":"1-3eb498726e0d057818618808c0db46bf","version":3,"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n            var sortBy = \'\';\\n            if (req.query && req.query.sortKey) {\\n                sortBy = req.query.sortKey;\\n            }\\n            switch (sortBy) {\\n                case \'crossReference\':\\n                case \'description\':\\n                case \'friendlyId\':\\n                case \'name\':\\n                case \'price\':\\n                case \'quantity\':\\n                case \'inventoryType\':\\n                    {\\n                        return compareStrings(a.doc[sortBy], b.doc[sortBy]);\\n                    }\\n                default:\\n                    {\\n                        return 0; //Don\'t sort\\n                    }\\n            }\\n        });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"views":{"inventory_by_name":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit([doc.data.name, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["3eb498726e0d057818618808c0db46bf"]}},{"_id":"_design/inventory_by_name","_rev":"1-91f55ae6bd30f766d9da95bffe054bcb","version":5,"views":{"inventory_by_name":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.name, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["91f55ae6bd30f766d9da95bffe054bcb"]}},{"_id":"_design/inventory_by_name","_rev":"2-6993fbc5ef18283f83c6afe5be9a9351","version":5,"views":{"inventory_by_name":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.name, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["6993fbc5ef18283f83c6afe5be9a9351","c12e4467c9c3ecc8021b660934257f25"]}},{"_id":"_design/inventory_by_type","_rev":"1-003ef699ab0f2b8628c0bf613fabf7a2","version":4,"views":{"inventory_by_type":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit(doc.data.inventoryType);}}}"}},"_revisions":{"start":1,"ids":["003ef699ab0f2b8628c0bf613fabf7a2"]}},{"_id":"_design/inventory_by_type","_rev":"1-18455500e1e86544edceaab01bb511bc","version":5,"views":{"inventory_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit(doc.data.inventoryType);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["18455500e1e86544edceaab01bb511bc"]}},{"_id":"_design/inventory_by_type","_rev":"1-65423cfcd4b0acd93b58aa2003907c92","version":5,"views":{"inventory_by_type":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit(doc.data.inventoryType);}}}"}},"_revisions":{"start":1,"ids":["65423cfcd4b0acd93b58aa2003907c92"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-0d7b597aeae746589980b12903768252","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invPurchase\') {\\n        var dateReceived = doc.data.dateReceived;\\n    if (dateReceived && dateReceived !== \\"\\") {\\n      dateReceived = new Date(dateReceived);\\n      if (dateReceived.getTime) {\\n        dateReceived = dateReceived.getTime();\\n      }\\n    }\\n    emit([dateReceived, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["0d7b597aeae746589980b12903768252"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-78939ec45bef330bbfa87763dbbfce37","version":4,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var dateReceived = doc.data.dateReceived;if (dateReceived && dateReceived !== \\"\\") {dateReceived = new Date(dateReceived);if (dateReceived.getTime) {dateReceived = dateReceived.getTime();}}emit([dateReceived, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["78939ec45bef330bbfa87763dbbfce37"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-823be94576112c800022b256ccd9b725","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var dateReceived = doc.data.dateReceived;if (dateReceived && dateReceived !== \\"\\") {dateReceived = new Date(dateReceived);if (dateReceived.getTime) {dateReceived = dateReceived.getTime();}}emit([dateReceived, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["823be94576112c800022b256ccd9b725"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-1f41dd6d030c58884d7013ef9436decb","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invPurchase\') {\\n        var expirationDate = doc.data.expirationDate;\\n    if (expirationDate && expirationDate !== \\"\\") {\\n      expirationDate = new Date(expirationDate);\\n      if (expirationDate.getTime) {\\n        expirationDate = expirationDate.getTime();\\n      }\\n    }\\n    emit([expirationDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["1f41dd6d030c58884d7013ef9436decb"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-17bd9d3619ae03155d9929d3ebcd5023","version":4,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var expirationDate = doc.data.expirationDate;if (expirationDate && expirationDate !== \\"\\") {expirationDate = new Date(expirationDate);if (expirationDate.getTime) {expirationDate = expirationDate.getTime();}}emit([expirationDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["17bd9d3619ae03155d9929d3ebcd5023"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-7aea58304996ccb168865141592a024f","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var expirationDate = doc.data.expirationDate;if (expirationDate && expirationDate !== \\"\\") {expirationDate = new Date(expirationDate);if (expirationDate.getTime) {expirationDate = expirationDate.getTime();}}emit([expirationDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7aea58304996ccb168865141592a024f"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-021f4c24b5b6202594f610cf5d4c63a4","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invRequest\') {\\n        var dateCompleted = doc.data.dateCompleted;\\n    if (dateCompleted && dateCompleted !== \\"\\") {\\n      dateCompleted = new Date(dateCompleted);\\n      if (dateCompleted.getTime) {\\n        dateCompleted = dateCompleted.getTime();\\n      }\\n    }\\n    emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["021f4c24b5b6202594f610cf5d4c63a4"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-7e7ef275a9fc15f2b5f328b1479c6097","version":4,"views":{"inventory_request_by_item":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);}}}"}},"_revisions":{"start":1,"ids":["7e7ef275a9fc15f2b5f328b1479c6097"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-e9eb2d7f1e35296646399c7414525c33","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);}}}"}},"_revisions":{"start":1,"ids":["e9eb2d7f1e35296646399c7414525c33"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-187394c79d3206e11e112891f0d63550","version":4,"views":{"inventory_request_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.status, dateCompleted, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["187394c79d3206e11e112891f0d63550"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-cc0c1e0e01060aa62456d6ea768d8ec7","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invRequest\') {\\n        var dateCompleted = doc.data.dateCompleted;\\n    if (dateCompleted && dateCompleted !== \\"\\") {\\n      dateCompleted = new Date(dateCompleted);\\n      if (dateCompleted.getTime) {\\n        dateCompleted = dateCompleted.getTime();\\n      }\\n    }\\n    emit([doc.data.status, dateCompleted, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["cc0c1e0e01060aa62456d6ea768d8ec7"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-f4a7252ebf2802c53a572bf150eae05c","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.status, dateCompleted, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["f4a7252ebf2802c53a572bf150eae05c"]}},{"_id":"_design/invoice_by_patient","_rev":"1-a491390f74ce432d9cfab78291e0753b","version":1,"views":{"invoice_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":1,"ids":["a491390f74ce432d9cfab78291e0753b"]}},{"_id":"_design/invoice_by_patient","_rev":"1-9f67a58d4e428614844ac82cb2548268","version":1,"views":{"invoice_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invoice\') {\\n        emit(doc.data.patient);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["9f67a58d4e428614844ac82cb2548268"]}},{"_id":"_design/invoice_by_status","_rev":"1-25a58e1cec7f01d0a7e8da1293f59b69","version":4,"views":{"invoice_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {var billDate = doc.data.billDate;if (billDate && billDate !== \\"\\") {billDate = new Date(billDate);if (billDate.getTime) {billDate = billDate.getTime();}}emit([doc.data.status, billDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["25a58e1cec7f01d0a7e8da1293f59b69"]}},{"_id":"_design/invoice_by_status","_rev":"1-d411e6f66f897f0b9b985dc6e5188d85","version":4,"views":{"invoice_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invoice\') {\\n        var billDate = doc.data.billDate;\\n    if (billDate && billDate !== \\"\\") {\\n      billDate = new Date(billDate);\\n      if (billDate.getTime) {\\n        billDate = billDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, billDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["d411e6f66f897f0b9b985dc6e5188d85"]}},{"_id":"_design/invoice_by_status","_rev":"2-072e2f7f1519a12260fe98c90f794b06","version":4,"views":{"invoice_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {var billDate = doc.data.billDate;if (billDate && billDate !== \\"\\") {billDate = new Date(billDate);if (billDate.getTime) {billDate = billDate.getTime();}}emit([doc.data.status, billDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["072e2f7f1519a12260fe98c90f794b06","73e3e45673ed0c4f4ae1cee855f216f0"]}},{"_id":"_design/lab_by_status","_rev":"1-16b2c13356e8dac3b3594018f91cccfb","version":4,"views":{"lab_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"lab\\") {var labDate = doc.data.labDate;if (labDate && labDate !== \\"\\") {labDate = new Date(labDate);if (labDate.getTime) {labDate = labDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, labDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["16b2c13356e8dac3b3594018f91cccfb"]}},{"_id":"_design/lab_by_status","_rev":"1-7d4de6e219b482171b7ecd485ef72238","version":4,"views":{"lab_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'lab\') {\\n        var labDate = doc.data.labDate;\\n    if (labDate && labDate !== \\"\\") {\\n      labDate = new Date(labDate);\\n      if (labDate.getTime) {\\n        labDate = labDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, labDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["7d4de6e219b482171b7ecd485ef72238"]}},{"_id":"_design/lab_by_status","_rev":"2-ef5e8b51b3704c0cb1e525a63c81bd80","version":4,"views":{"lab_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"lab\\") {var labDate = doc.data.labDate;if (labDate && labDate !== \\"\\") {labDate = new Date(labDate);if (labDate.getTime) {labDate = labDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, labDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["ef5e8b51b3704c0cb1e525a63c81bd80","db4393c6856b98a40afd6ceef31db2a7"]}},{"_id":"_design/medication_by_status","_rev":"1-a6403c53b2db46905b3b1861120c6601","version":4,"views":{"medication_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'medication\') {\\n        var prescriptionDate = doc.data.prescriptionDate;\\n    if (prescriptionDate && prescriptionDate !== \\"\\") {\\n      prescriptionDate = new Date(prescriptionDate);\\n      if (prescriptionDate.getTime) {\\n        prescriptionDate = prescriptionDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["a6403c53b2db46905b3b1861120c6601"]}},{"_id":"_design/medication_by_status","_rev":"1-09e1d1c201823532161ef48ba23200be","version":4,"views":{"medication_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"medication\\") {var prescriptionDate = doc.data.prescriptionDate;if (prescriptionDate && prescriptionDate !== \\"\\") {prescriptionDate = new Date(prescriptionDate);if (prescriptionDate.getTime) {prescriptionDate = prescriptionDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["09e1d1c201823532161ef48ba23200be"]}},{"_id":"_design/medication_by_status","_rev":"2-9dec70f4b5aeaf7d9b8d70719125c41c","version":4,"views":{"medication_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"medication\\") {var prescriptionDate = doc.data.prescriptionDate;if (prescriptionDate && prescriptionDate !== \\"\\") {prescriptionDate = new Date(prescriptionDate);if (prescriptionDate.getTime) {prescriptionDate = prescriptionDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["9dec70f4b5aeaf7d9b8d70719125c41c","36ce9e9853552f5eb646ed26de7184dc"]}},{"_id":"_design/open_incidents_by_user","_rev":"1-34770efd210920a30c96d3787521e8a5","version":1,"views":{"open_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status !== \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      }\\n      return 0; // Don\'t sort\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/patient_by_admission","_rev":"1-3c2da4380d257c95ebf4430afa48de3b","version":4,"views":{"patient_by_admission":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.admitted === true) {\\n      if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["3c2da4380d257c95ebf4430afa48de3b"]}},{"_id":"_design/patient_by_admission","_rev":"2-cb3270a3d44a370d50128b93179d3503","version":4,"views":{"patient_by_admission":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.admitted === true) {\\n      if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["cb3270a3d44a370d50128b93179d3503","ee7b6ead26ac6b8b3f106c6d85dc175b"]}},{"_id":"_design/patient_by_display_id","_rev":"1-8a6930002af6d588ecdedd5f07da0230","version":7,"views":{"patient_by_display_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["8a6930002af6d588ecdedd5f07da0230"]}},{"_id":"_design/patient_by_display_id","_rev":"1-0b75ee7c82a1aadebd0bc0fd403622fb","version":5,"views":{"patient_by_display_id":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {if (doc.data.friendlyId) {emit([doc.data.friendlyId, doc._id]);} else if (doc.data.externalPatientId) {emit([doc.data.externalPatientId, doc._id]);} else {emit([doc._id, doc._id]);}}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'firstName\':\\n        case \'sex\':\\n        case \'lastName\':\\n        case \'status\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        case \'dateOfBirth\':\\n          {\\n            return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["0b75ee7c82a1aadebd0bc0fd403622fb"]}},{"_id":"_design/patient_by_display_id","_rev":"1-c619a041bccecc7e83b05015cc92706e","version":6,"views":{"patient_by_display_id":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {if (doc.data.friendlyId) {emit([doc.data.friendlyId, doc._id]);} else if (doc.data.externalPatientId) {emit([doc.data.externalPatientId, doc._id]);} else {emit([doc._id, doc._id]);}}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["c619a041bccecc7e83b05015cc92706e"]}},{"_id":"_design/patient_by_display_id","_rev":"3-76930b682e13aef4b2a31fcc57c0ba17","version":7,"views":{"patient_by_display_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":3,"ids":["76930b682e13aef4b2a31fcc57c0ba17","f2bcbc75b5c6af36a93ff450e1764247","e6d44a1448953362319c910bf33a8668"]}},{"_id":"_design/patient_by_status","_rev":"1-54bc74ff93db4aedff83bc649f766596","version":3,"views":{"patient_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        emit(doc.data.status);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["54bc74ff93db4aedff83bc649f766596"]}},{"_id":"_design/patient_by_status","_rev":"1-49f3f7f86891fb7d60f0ee1b2db1220b","version":3,"views":{"patient_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {emit(doc.data.status);}}}"}},"_revisions":{"start":1,"ids":["49f3f7f86891fb7d60f0ee1b2db1220b"]}},{"_id":"_design/patient_by_status","_rev":"2-b56763993297cda52343d99f7fdd1b03","version":3,"views":{"patient_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {emit(doc.data.status);}}}"}},"_revisions":{"start":2,"ids":["b56763993297cda52343d99f7fdd1b03","ff26a12cdb8747aae5bf26f9af3a1953"]}},{"_id":"_design/photo_by_patient","_rev":"1-6a4fad4fa682efbbd058e858c328574f","version":4,"views":{"photo_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'photo\') {\\n        emit(doc.data.patient);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["6a4fad4fa682efbbd058e858c328574f"]}},{"_id":"_design/photo_by_patient","_rev":"1-727ba2a3d1a106196746643395a859d0","version":4,"views":{"photo_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"photo\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":1,"ids":["727ba2a3d1a106196746643395a859d0"]}},{"_id":"_design/photo_by_patient","_rev":"2-0ea32da890536de0910ea412a3fa015c","version":4,"views":{"photo_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"photo\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":2,"ids":["0ea32da890536de0910ea412a3fa015c","e3dc5506f7f370535b85be0adc59c7cc"]}},{"_id":"_design/pricing_by_category","_rev":"1-23d44e44019170eadd086734c87e3976","version":4,"views":{"pricing_by_category":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"pricing\\") {emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["23d44e44019170eadd086734c87e3976"]}},{"_id":"_design/pricing_by_category","_rev":"1-b34429f4f8aff13ed218f70f039b3591","version":5,"views":{"pricing_by_category":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"pricing\\") {emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["b34429f4f8aff13ed218f70f039b3591"]}},{"_id":"_design/pricing_by_category","_rev":"1-3d703b5f240ae5838d1f20a8ad0471de","version":5,"views":{"pricing_by_category":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'pricing\') {\\n        emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["3d703b5f240ae5838d1f20a8ad0471de"]}},{"_id":"_design/procedure_by_date","_rev":"1-7c23f1d0feaff1358bee1ddea760daac","version":4,"views":{"procedure_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"procedure\\") {var procedureDate = doc.data.procedureDate;if (procedureDate && procedureDate !== \\"\\") {procedureDate = new Date(procedureDate);if (procedureDate.getTime) {procedureDate = procedureDate.getTime();}}emit([procedureDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7c23f1d0feaff1358bee1ddea760daac"]}},{"_id":"_design/procedure_by_date","_rev":"1-25ccef2a9dff3addd8c0d15cc79c363c","version":3,"views":{"procedure_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"procedure\\") {var procedureDate = doc.data.procedureDate;if (procedureDate && procedureDate !== \\"\\") {procedureDate = new Date(procedureDate);if (procedureDate.getTime) {procedureDate = procedureDate.getTime();}}emit([procedureDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["25ccef2a9dff3addd8c0d15cc79c363c"]}},{"_id":"_design/procedure_by_date","_rev":"1-a44decd8f14d01c615cf3f5b8e70f10b","version":4,"views":{"procedure_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'procedure\') {\\n        var procedureDate = doc.data.procedureDate;\\n    if (procedureDate && procedureDate !== \\"\\") {\\n      procedureDate = new Date(procedureDate);\\n      if (procedureDate.getTime) {\\n        procedureDate = procedureDate.getTime();\\n      }\\n    }\\n    emit([procedureDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["a44decd8f14d01c615cf3f5b8e70f10b"]}},{"_id":"_design/report_by_visit","_rev":"1-1295cef10df82554859efdb4c38c1c1e","version":1,"views":{"report_by_visit":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'report\') {\\n        emit(doc.data.visit);\\n      }\\n    }\\n  }"}}},{"_id":"_design/sequence_by_prefix","_rev":"1-10f81c9287f2db782b8e293e7d9b1cde","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'sequence\') {\\n        emit(doc.data.prefix);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["10f81c9287f2db782b8e293e7d9b1cde"]}},{"_id":"_design/sequence_by_prefix","_rev":"1-4a47589314718c2d8add1266b64b5ea6","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"sequence\\") {emit(doc.data.prefix);}}}"}},"_revisions":{"start":1,"ids":["4a47589314718c2d8add1266b64b5ea6"]}},{"_id":"_design/sequence_by_prefix","_rev":"2-73756debd255ca93fb25eab24ed9e12a","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"sequence\\") {emit(doc.data.prefix);}}}"}},"_revisions":{"start":2,"ids":["73756debd255ca93fb25eab24ed9e12a","8ac3a62b4c0b624ebed3b68b27cd197e"]}},{"_id":"_design/surgical_appointments_by_date","_rev":"1-90d8de834de1fe0e154d1cdab8889984","version":1,"views":{"surgical_appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType === \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/visit_by_date","_rev":"1-db61f993a1e1699c8205fee3434fc4c8","version":4,"views":{"visit_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([startDate, endDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["db61f993a1e1699c8205fee3434fc4c8"]}},{"_id":"_design/visit_by_date","_rev":"1-fd0a50125860ba3c17844c0567a70d65","version":4,"views":{"visit_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["fd0a50125860ba3c17844c0567a70d65"]}},{"_id":"_design/visit_by_date","_rev":"1-367a7fa42f1067f645190d560f83ef5e","version":3,"views":{"visit_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["367a7fa42f1067f645190d560f83ef5e"]}},{"_id":"_design/visit_by_discharge_date","_rev":"1-57a0b69b2792963e5112bbdd53bbba2d","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}emit([endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["57a0b69b2792963e5112bbdd53bbba2d"]}},{"_id":"_design/visit_by_discharge_date","_rev":"1-b4baca85d54e727966aeb2e8ad172136","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    emit([endDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["b4baca85d54e727966aeb2e8ad172136"]}},{"_id":"_design/visit_by_discharge_date","_rev":"2-76f05f3060660ab74749fa0def9cea07","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}emit([endDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["76f05f3060660ab74749fa0def9cea07","e53c95160dacaf007fe01c01215729ce"]}},{"_id":"_design/visit_by_patient","_rev":"1-f2865c74eefee716937492db914f2ccd","version":4,"views":{"visit_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["f2865c74eefee716937492db914f2ccd"]}},{"_id":"_design/visit_by_patient","_rev":"1-412252178488867e2350dcd13da779ea","version":3,"views":{"visit_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["412252178488867e2350dcd13da779ea"]}},{"_id":"_design/visit_by_patient","_rev":"1-bf45f0e7e8e9123a59095b609570a4ea","version":4,"views":{"visit_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["bf45f0e7e8e9123a59095b609570a4ea"]}},{"_id":"imaging_2_07CC6746-C7D9-A410-9B8C-C4B4E095A96D","_rev":"2-ffa7adb60618346cba98a559d81df36a","data":{"imagingDate":"2015-10-15T09:39:44.603Z","notes":"random notes","radiologist":"zinyando","requestedBy":"hradmin","requestedDate":"2015-10-15T09:39:37.866Z","result":"to collect","status":"Completed","lastModified":"2015-10-15T09:39:44.603Z","modifiedBy":"hradmin","imagingType":"22208FBE-9C6E-079D-A1E6-A562F9310FE5","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"377AA288-AAD4-F60B-ABD1-B5A0B9C75D50","modifiedFields":{"radiologist":"2015-10-15T09:39:38.088Z","result":"2015-10-15T09:39:38.088Z","notes":"2015-10-15T09:39:38.088Z","status":"2015-10-15T09:39:44.603Z","requestedBy":"2015-10-15T09:39:38.088Z","requestedDate":"2015-10-15T09:39:38.088Z","imagingDate":"2015-10-15T09:39:44.603Z"},"charges":[]},"_revisions":{"start":2,"ids":["ffa7adb60618346cba98a559d81df36a","be0a6780ba1f2b7e3e8d49ebf20ed8d6"]}},{"_id":"imaging_2_1AC1DD3D-E7E7-15B4-A698-8A8AE62749EB","_rev":"1-83a3398c448faf2ea1962004c5652a52","data":{"imagingDate":null,"notes":"jkmn","radiologist":"zinyando","requestedBy":"hradmin","requestedDate":"2015-10-15T10:37:57.852Z","result":"hu","status":"Requested","lastModified":"2015-10-15T10:37:58.038Z","modifiedBy":"hradmin","imagingType":"4CEB69E7-B54A-9D45-B0EF-7643F0D48FA0","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"0BD42BD9-0E5D-0533-A8FA-1C0ADB0F0D65","modifiedFields":{"radiologist":"2015-10-15T10:37:58.038Z","result":"2015-10-15T10:37:58.038Z","notes":"2015-10-15T10:37:58.038Z","status":"2015-10-15T10:37:58.038Z","requestedBy":"2015-10-15T10:37:58.038Z","requestedDate":"2015-10-15T10:37:58.038Z"},"charges":[]}},{"_id":"imaging_2_4A7FC838-0B37-E151-AFD8-8DBAC9DE9D99","_rev":"2-0ddb54b6d0376b87fdf409eb6d205f82","data":{"imagingDate":"2015-10-28T07:32:45.311Z","notes":null,"radiologist":null,"requestedBy":"hradmin","requestedDate":"2015-10-26T11:49:08.227Z","result":null,"status":"Completed","lastModified":"2015-10-28T07:32:45.314Z","modifiedBy":"hradmin","imagingType":"CBB4C9D5-CE8C-2BB5-86F4-3FC16AE2E85D","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"C5C296AC-E238-CBA5-8DD8-99942843BC5A","modifiedFields":{"status":"2015-10-28T07:32:45.314Z","requestedBy":"2015-10-26T11:49:08.483Z","requestedDate":"2015-10-26T11:49:08.483Z","imagingDate":"2015-10-28T07:32:45.314Z"},"charges":[]},"_revisions":{"start":2,"ids":["0ddb54b6d0376b87fdf409eb6d205f82","0cefb2d2a3e8ba76052c1a08c27df1eb"]}},{"_id":"imaging_2_51D8DC28-78EB-62B1-942A-1158F5862F34","_rev":"2-40eac78a67beecaa77b17ea5e7481866","data":{"imagingDate":"2015-10-28T07:32:55.293Z","notes":"Chest is ok","radiologist":"Mr Test","requestedBy":"hradmin","requestedDate":"2015-10-28T07:23:34.834Z","result":"Ok","status":"Completed","lastModified":"2015-10-28T07:32:55.294Z","modifiedBy":"hradmin","imagingType":"E53305F3-BA40-B305-B2DC-0732C7AB0042","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"CBFA5C2C-191D-FC9C-AD19-14D26D5A3003","modifiedFields":{"radiologist":"2015-10-28T07:23:35.055Z","result":"2015-10-28T07:23:35.055Z","notes":"2015-10-28T07:23:35.055Z","status":"2015-10-28T07:32:55.294Z","requestedBy":"2015-10-28T07:23:35.055Z","requestedDate":"2015-10-28T07:23:35.055Z","imagingDate":"2015-10-28T07:32:55.294Z"},"charges":[]},"_revisions":{"start":2,"ids":["40eac78a67beecaa77b17ea5e7481866","fb212193dfed510d7935aed17e5f0456"]}},{"_id":"imaging_2_91B061E9-2986-D539-90C8-CD14EC2010B0","_rev":"1-2abe559a8f8075862b282ed4f9d54da5","data":{"imagingDate":null,"notes":"jbkj","radiologist":"b","requestedBy":"hradmin","requestedDate":"2015-10-28T07:39:18.255Z","result":"jjjk","status":"Requested","lastModified":"2015-10-28T07:39:18.406Z","modifiedBy":"hradmin","imagingType":null,"patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"6AD00ED1-670A-2C3F-BC10-0742B1F99264","modifiedFields":{"radiologist":"2015-10-28T07:39:18.406Z","result":"2015-10-28T07:39:18.406Z","notes":"2015-10-28T07:39:18.406Z","status":"2015-10-28T07:39:18.406Z","requestedBy":"2015-10-28T07:39:18.406Z","requestedDate":"2015-10-28T07:39:18.406Z"},"charges":[]}},{"_id":"imaging_2_D0F299E4-CD8D-557D-8C23-216FD23EF844","_rev":"3-8b87996abf9161e5d7908be6676a64d7","data":{"imagingDate":"2015-10-22T07:09:04.249Z","notes":"vbj nkm","radiologist":"fcgvb","requestedBy":"hradmin","requestedDate":"2015-10-22T07:08:38.080Z","result":"cgvhbj n","status":"Completed","lastModified":"2015-10-22T07:09:04.251Z","modifiedBy":"hradmin","imagingType":"B492AA26-22F2-52A9-93C7-17106A57A62E","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"9F1A65ED-683F-056E-8D50-A8AF63201CE2","modifiedFields":{"radiologist":"2015-10-22T07:08:38.523Z","result":"2015-10-22T07:08:38.523Z","notes":"2015-10-22T07:08:38.523Z","status":"2015-10-22T07:08:59.403Z","requestedBy":"2015-10-22T07:08:38.523Z","requestedDate":"2015-10-22T07:08:38.523Z","imagingDate":"2015-10-22T07:09:04.251Z"},"charges":[]},"_revisions":{"start":3,"ids":["8b87996abf9161e5d7908be6676a64d7","9f159b24551a1fa5acd7b84cd8d51994","c676b60d0d69556786f283da75b51c77"]}},{"_id":"imaging_2_DBE152F6-9508-2E12-81AC-39BC2CAFE08C","_rev":"2-69b11e7856d8b0fc3bd62debbfca3e55","data":{"imagingDate":"2015-10-28T07:33:17.867Z","notes":"ss","radiologist":"ss","requestedBy":"hradmin","requestedDate":"2015-10-28T07:31:20.891Z","result":"sss","status":"Completed","lastModified":"2015-10-28T07:33:17.868Z","modifiedBy":"hradmin","imagingType":"F51616AE-EB96-2778-824F-386DEAFFD2F9","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"D6938BD3-6346-F62B-8B19-5207B2E5A6AF","modifiedFields":{"radiologist":"2015-10-28T07:31:21.091Z","result":"2015-10-28T07:31:21.091Z","notes":"2015-10-28T07:31:21.091Z","status":"2015-10-28T07:33:17.868Z","requestedBy":"2015-10-28T07:31:21.091Z","requestedDate":"2015-10-28T07:31:21.091Z","imagingDate":"2015-10-28T07:33:17.868Z"},"charges":[]},"_revisions":{"start":2,"ids":["69b11e7856d8b0fc3bd62debbfca3e55","222ad15ae5eed89c6d8abe1c9e07c145"]}},{"_id":"imaging_2_EA6B989C-90B7-2E08-9D8F-CE4339BB9B4B","_rev":"2-63da6e42fb59a811a5468e32bda0eb76","data":{"imagingDate":"2015-10-28T07:33:05.759Z","notes":"hbjn","radiologist":"cgvhbn","requestedBy":"hradmin","requestedDate":"2015-10-28T07:27:44.346Z","result":"fcghvj","status":"Completed","lastModified":"2015-10-28T07:33:05.759Z","modifiedBy":"hradmin","imagingType":"C8826ADA-C3AC-37CD-84AE-FA86A203AC6E","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"74A4EF68-5D8D-BDF6-940F-33E50E50DDEA","modifiedFields":{"radiologist":"2015-10-28T07:27:44.514Z","result":"2015-10-28T07:27:44.514Z","notes":"2015-10-28T07:27:44.514Z","status":"2015-10-28T07:33:05.759Z","requestedBy":"2015-10-28T07:27:44.514Z","requestedDate":"2015-10-28T07:27:44.514Z","imagingDate":"2015-10-28T07:33:05.759Z"},"charges":[]},"_revisions":{"start":2,"ids":["63da6e42fb59a811a5468e32bda0eb76","51a7194f0c4b6b172b5d0b059285e118"]}},{"_id":"invLocation_2_B7B86EC1-6CCE-30B7-B4ED-FF2061879E03","_rev":"2-6b49176eeeafb82a88a10aa5d954d965","data":{"quantity":1000,"location":null,"aisleLocation":null,"lastModified":"2015-10-29T02:44:10.582Z","modifiedBy":"hradmin","modifiedFields":{"quantity":"2015-10-29T02:44:10.582Z"}},"_revisions":{"start":2,"ids":["6b49176eeeafb82a88a10aa5d954d965","e7ffcb12925c148d50279cc2ee012d25"]}},{"_id":"invPurchase_2_CDC3AB7D-A0AD-E146-87A4-FDB1096C2EEC","_rev":"1-d0a2104fa76a4161da3f527b23a6d61a","data":{"purchaseCost":4000,"lotNumber":null,"dateReceived":"2015-10-28T22:00:00.000Z","originalQuantity":1000,"currentQuantity":1000,"expirationDate":null,"expired":false,"location":null,"aisleLocation":null,"giftInKind":false,"inventoryItem":"igbmk5zf_is","vendor":"Alpha Pharmacy","vendorItemNo":null,"distributionUnit":null,"invoiceNo":null,"lastModified":"2015-10-29T02:44:10.493Z","modifiedBy":"hradmin","modifiedFields":{"dateReceived":"2015-10-29T02:44:10.493Z","purchaseCost":"2015-10-29T02:44:10.493Z","vendor":"2015-10-29T02:44:10.493Z","originalQuantity":"2015-10-29T02:44:10.493Z","currentQuantity":"2015-10-29T02:44:10.493Z","inventoryItem":"2015-10-29T02:44:10.493Z"}}},{"_id":"invRequest_2_4691AB2D-AEF3-1AA8-A11E-790BA5788239","_rev":"1-0e093fbeafc9c59eaeaaf0739ad56e13","data":{"adjustPurchases":false,"completedBy":null,"costPerUnit":null,"dateCompleted":null,"dateRequested":"2015-10-29T08:35:51.495Z","deliveryAisle":"C100","deliveryLocation":"Harare","expenseAccount":"Accounts","markAsConsumed":true,"quantity":50,"quantityAtCompletion":null,"reason":null,"requestedBy":"hradmin","status":"Requested","transactionType":"Request","lastModified":"2015-10-29T08:35:51.497Z","modifiedBy":"hradmin","inventoryItem":"igbmk5zf_is","patient":null,"visit":null,"modifiedFields":{"transactionType":"2015-10-29T08:35:51.497Z","quantity":"2015-10-29T08:35:51.497Z","deliveryLocation":"2015-10-29T08:35:51.497Z","deliveryAisle":"2015-10-29T08:35:51.497Z","expenseAccount":"2015-10-29T08:35:51.497Z","dateRequested":"2015-10-29T08:35:51.497Z","requestedBy":"2015-10-29T08:35:51.497Z","status":"2015-10-29T08:35:51.497Z"}}},{"_id":"inventory_2_igbmk5zf_is","_rev":"1-26fffdb13350d70c54f01078f7ea7058","data":{"description":"Biogesic nga medisina","friendlyId":"m00001","name":"Biogesic","quantity":1000,"crossReference":"2600","inventoryType":"Medication","price":5,"reorderPoint":100,"distributionUnit":"tablet","lastModified":"2015-10-29T02:44:10.610Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-29T02:44:10.610Z","inventoryType":"2015-10-29T02:44:10.610Z","crossReference":"2015-10-29T02:44:10.610Z","description":"2015-10-29T02:44:10.610Z","reorderPoint":"2015-10-29T02:44:10.610Z","price":"2015-10-29T02:44:10.610Z","distributionUnit":"2015-10-29T02:44:10.610Z","quantity":"2015-10-29T02:44:10.610Z","friendlyId":"2015-10-29T02:44:10.610Z"},"purchases":["CDC3AB7D-A0AD-E146-87A4-FDB1096C2EEC"],"locations":["B7B86EC1-6CCE-30B7-B4ED-FF2061879E03"]}},{"_id":"lookup_2_aisle_location_list","_rev":"1-7257ef0f361f763b2692f692dab6bb7c","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["C100"]}},{"_id":"lookup_2_expense_account_list","_rev":"1-bb8267ec5987084be9890734e55df7e0","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Accounts"]}},{"_id":"lookup_2_radiologists","_rev":"6-38c1cbc8559ef893d7ebd043e93ce427","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Mr Test","b","cgvhbn","fcgvb","ss","zinyando"]},"_revisions":{"start":6,"ids":["38c1cbc8559ef893d7ebd043e93ce427","515694dee3f8a35894f6287347485e40","10ef5b07a7d56f64ac26e84507484d41","33cff401403de9c1efd0a9edbec7e50b","cb3dd07e07a6fa2f9e9323b7e15c48fd","864e65b754e2ec13fe2eb8c452bce282"]}},{"_id":"lookup_2_sex","_rev":"1-c433c64d3ecf2a60e4539b1d1dc43d27","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Male"]}},{"_id":"lookup_2_vendor_list","_rev":"1-3b1a6a2565242e3db9cbdb6c579de2af","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Alpha Pharmacy"]}},{"_id":"lookup_2_warehouse_list","_rev":"1-578a5af6fd231a89f2fdeb1baae7036c","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Harare"]}},{"_id":"patient_2_19A03BBC-71F3-9F39-8B18-15773F446731","_rev":"3-c021a07297d99585de08b3fd96719914","_deleted":true,"_revisions":{"start":3,"ids":["c021a07297d99585de08b3fd96719914","a7323c9135948b4689f52c01826affe2","6ed64fbe474b36dac7c8ac071e33786d"]}}]}\n{"seq":74}\n{"docs":[{"_id":"patient_2_2D1BEC2C-EA03-E737-9EC9-D2AEAF2C9EE6","_rev":"2-a587941fb557366a6b87122548a9ba0c","_deleted":true,"_revisions":{"start":2,"ids":["a587941fb557366a6b87122548a9ba0c","0048675586c8e2fd24c8cc2edc545769"]}},{"_id":"patient_2_3C01C5E5-7E64-B147-88F9-D127903B31D7","_rev":"4-be8dd294f8df42bcf220e1a4372340fd","_deleted":true,"_revisions":{"start":4,"ids":["be8dd294f8df42bcf220e1a4372340fd","74d74986cffc330788b0fc5e47f40788","1ed40ad430dba87ec4c0773779fac6aa","34e84dc96007fc737d932ebf875ce340"]}},{"_id":"patient_2_423A476C-2012-6339-8FED-D2E404037268","_rev":"4-263b75936a4ead5058dc1e17535c536c","_deleted":true,"_revisions":{"start":4,"ids":["263b75936a4ead5058dc1e17535c536c","12c22dbd6548922b326bd28b2f05ddb0","a4a9b0e7ed53aea140c1d3259c9b1e94","15ebcd46a46d830899afc17450d4b229"]}},{"_id":"patient_2_519E056C-BF04-2A3F-84D2-8963EAD04261","_rev":"2-13e0330c4610ea3dc8a8dcb64a9b61ae","_deleted":true,"_revisions":{"start":2,"ids":["13e0330c4610ea3dc8a8dcb64a9b61ae","193c2c5d9fcb17698411febac4015547"]}},{"_id":"patient_2_5DD90350-3A67-F3B7-BB4A-A6837A667697","_rev":"2-812e681275f7181b96e1428d5b2eb555","_deleted":true,"_revisions":{"start":2,"ids":["812e681275f7181b96e1428d5b2eb555","a9b1e632e8d3f96d106873396f7f04de"]}},{"_id":"patient_2_63165A06-C866-A0C2-BB43-5DE9A0146737","_rev":"2-5989c5e25baace8df71d475ae164bf40","_deleted":true,"_revisions":{"start":2,"ids":["5989c5e25baace8df71d475ae164bf40","4178d1d23fb9d40a647d573026480dad"]}},{"_id":"patient_2_632DBDA3-5DBF-DDCC-A2C6-915E357319BA","_rev":"2-6ce428f8cdb8d1ea864f976c1ade08e4","_deleted":true,"_revisions":{"start":2,"ids":["6ce428f8cdb8d1ea864f976c1ade08e4","abe897a1411af9ce5df82d2ddbe726f2"]}},{"_id":"patient_2_688E30F1-E068-A2E3-8986-C224AF671CDD","_rev":"2-cb950343c60eb7116359fb50dc58fb87","_deleted":true,"_revisions":{"start":2,"ids":["cb950343c60eb7116359fb50dc58fb87","949f54bb01a90f17a91a7b392aecd58e"]}},{"_id":"patient_2_694DF805-F7CD-9513-9EF5-4CF8EE009BE9","_rev":"2-005d256252779d14fb83b9614a75d84f","_deleted":true,"_revisions":{"start":2,"ids":["005d256252779d14fb83b9614a75d84f","79cbdb6ba8075de8b19b61f4ebd194b2"]}},{"_id":"patient_2_9C269C48-EE3E-FBEC-9371-A235EEFDA40E","_rev":"2-6d94af1fdf669e3d012e3370c17c7d0f","_deleted":true,"_revisions":{"start":2,"ids":["6d94af1fdf669e3d012e3370c17c7d0f","ba40f943d16f3594cdf2a1c0e7ce36eb"]}},{"_id":"patient_2_9ED02049-6F10-E89D-9BAA-9C113B3AA6E4","_rev":"2-472c94a0e9c78fde3be4c15a71e0f336","_deleted":true,"_revisions":{"start":2,"ids":["472c94a0e9c78fde3be4c15a71e0f336","c61b0ba276e4c88cfda15ae4b5d0768b"]}},{"_id":"patient_2_B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","_rev":"2-abadab1984c60d7e4e1a67576335a2bc","data":{"admitted":false,"address":null,"address2":null,"address3":null,"address4":null,"bloodType":null,"clinic":null,"country":null,"dateOfBirth":null,"economicClassification":null,"email":null,"externalPatientId":null,"familySupport1":null,"familySupport2":null,"familySupport3":null,"familySupport4":null,"familySupport5":null,"friendlyId":"P00017","firstName":"Lennex","sex":"Male","history":null,"insurance":null,"lastName":"Zinyando","livingArrangement":null,"middleName":"","notes":null,"otherIncome":null,"patientType":null,"parent":null,"phone":null,"placeOfBirth":null,"referredDate":null,"referredBy":null,"religion":null,"socialActionTaken":null,"socialRecommendation":null,"status":null,"lastModified":"2016-02-22T22:00:07.816Z","modifiedBy":"Admin User","paymentProfile":null,"payments":[],"modifiedFields":{"friendlyId":"2015-10-06T10:56:52.507Z","firstName":"2015-10-06T10:56:52.507Z","middleName":"2015-10-06T10:56:52.507Z","lastName":"2015-10-06T10:56:52.507Z","sex":"2016-02-22T22:00:07.816Z"}},"_revisions":{"start":2,"ids":["abadab1984c60d7e4e1a67576335a2bc","e5548781a44e741ceac358e5e3413d76"]}},{"_id":"patient_2_BB4E9598-BD8B-528B-9D9E-AD9C3980787B","_rev":"3-957a69aebfae063d61ee8aaa55006803","_deleted":true,"_revisions":{"start":3,"ids":["957a69aebfae063d61ee8aaa55006803","0345093ba84e9c117c7dbb94b45edb8f","3e24d132e3bcc29db9d41a4d9f4296bf"]}},{"_id":"patient_2_C0361670-8B10-F212-9F51-B889D5BF92DF","_rev":"2-7b2217e2c2cb01610c32e0de44910282","_deleted":true,"_revisions":{"start":2,"ids":["7b2217e2c2cb01610c32e0de44910282","13ecb169a07f0e5a78a11209c26ede78"]}},{"_id":"patient_2_C680710A-BFBB-2868-8E5E-F4DD648CA24E","_rev":"2-d9acde506f230ec53a1cff9c97fe58bf","_deleted":true,"_revisions":{"start":2,"ids":["d9acde506f230ec53a1cff9c97fe58bf","9d954090afc2085fb97060446f8e4da0"]}},{"_id":"patient_2_E011AC5D-6F55-A16E-AB47-148E418071EE","_rev":"2-c263c9e9cf93e6d7b98f445b0d800809","_deleted":true,"_revisions":{"start":2,"ids":["c263c9e9cf93e6d7b98f445b0d800809","66c46fd3db8b057d58a35aba6ca99a5a"]}},{"_id":"patient_2_E54A8685-A36F-D1D1-B938-080545EABD0E","_rev":"2-a53992302cf7a33bad522d2dc5835b6e","_deleted":true,"_revisions":{"start":2,"ids":["a53992302cf7a33bad522d2dc5835b6e","5cebaf4e3ffef745a70ef22a1be1f0e8"]}},{"_id":"patient_2_E5EF1B7A-51B7-1610-BFBA-B1B21365C574","_rev":"2-182384c7dc0a26973583a692bfecbce8","_deleted":true,"_revisions":{"start":2,"ids":["182384c7dc0a26973583a692bfecbce8","497eb6ebf5074eeb32e2c02aab754a18"]}},{"_id":"patient_2_F3AA5446-1DE5-AC50-B9CF-B0D491E1D45E","_rev":"2-036325f33884580d2785dadf44527e25","_deleted":true,"_revisions":{"start":2,"ids":["036325f33884580d2785dadf44527e25","9eb866d5ca50209aec98d96470acce98"]}},{"_id":"photo_2_CF5189F1-5BDA-6896-B350-6A1A9B6A217B","_rev":"3-82a9b8e6b9f827259083f9bc560d9ee6","_deleted":true,"_revisions":{"start":3,"ids":["82a9b8e6b9f827259083f9bc560d9ee6","ee9b1e0283b24f4a02b00f92ed70f0ab","5ee18d0589c4ac578fe4e8a5350f725b"]}},{"_id":"photo_2_D2B805B1-8F22-B5D2-956B-AFF6372D18FF","_rev":"3-734e1f5956d3d438f8ba6e187aa4d97f","_deleted":true,"_revisions":{"start":3,"ids":["734e1f5956d3d438f8ba6e187aa4d97f","f574559c84a634ca88d1d10d41c93953","112ad019aa78ef8e06584c9109a9a850"]}},{"_id":"pricing_2_22208FBE-9C6E-079D-A1E6-A562F9310FE5","_rev":"1-7f1b8398ae5dbed5782085efbfdf5ee8","data":{"category":"Imaging","expenseAccount":null,"name":"New","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-15T09:39:37.879Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-15T09:39:37.879Z","category":"2015-10-15T09:39:37.879Z","pricingType":"2015-10-15T09:39:37.879Z"},"pricingOverrides":[]}},{"_id":"pricing_2_4CEB69E7-B54A-9D45-B0EF-7643F0D48FA0","_rev":"1-866a210b1d9063493c97d580845fc13d","data":{"category":"Imaging","expenseAccount":null,"name":"New","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-15T10:37:57.867Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-15T10:37:57.867Z","category":"2015-10-15T10:37:57.867Z","pricingType":"2015-10-15T10:37:57.867Z"},"pricingOverrides":[]}},{"_id":"pricing_2_B492AA26-22F2-52A9-93C7-17106A57A62E","_rev":"1-a03187de833a34d46302b5a740244353","data":{"category":"Imaging","expenseAccount":null,"name":"fghj","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-22T07:08:38.099Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-22T07:08:38.099Z","category":"2015-10-22T07:08:38.099Z","pricingType":"2015-10-22T07:08:38.099Z"},"pricingOverrides":[]}},{"_id":"pricing_2_C8826ADA-C3AC-37CD-84AE-FA86A203AC6E","_rev":"1-fcefadf7300a60430090a0b91df95cce","data":{"category":"Imaging","expenseAccount":null,"name":"dfghn","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-28T07:27:44.358Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-28T07:27:44.358Z","category":"2015-10-28T07:27:44.358Z","pricingType":"2015-10-28T07:27:44.358Z"},"pricingOverrides":[]}},{"_id":"pricing_2_CBB4C9D5-CE8C-2BB5-86F4-3FC16AE2E85D","_rev":"1-a34a6a2d89ae9d5cd57f532f8db1b02f","data":{"category":"Imaging","expenseAccount":null,"name":"hg","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-26T11:49:08.235Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-26T11:49:08.235Z","category":"2015-10-26T11:49:08.235Z","pricingType":"2015-10-26T11:49:08.235Z"},"pricingOverrides":[]}},{"_id":"pricing_2_E53305F3-BA40-B305-B2DC-0732C7AB0042","_rev":"1-5b2724a6d2dce84919a16388a8983a49","data":{"category":"Imaging","expenseAccount":null,"name":"Scan","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-28T07:23:34.851Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-28T07:23:34.851Z","category":"2015-10-28T07:23:34.851Z","pricingType":"2015-10-28T07:23:34.851Z"},"pricingOverrides":[]}},{"_id":"pricing_2_F51616AE-EB96-2778-824F-386DEAFFD2F9","_rev":"1-13d626d1730a99b3da4dee1a25146ddd","data":{"category":"Imaging","expenseAccount":null,"name":"sss","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-28T07:31:20.903Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-28T07:31:20.903Z","category":"2015-10-28T07:31:20.903Z","pricingType":"2015-10-28T07:31:20.903Z"},"pricingOverrides":[]}},{"_id":"sequence_2_inventory_Medication","_rev":"1-1acccea88a50973cbe8840a31911aa7c","data":{"prefix":"m","value":1}},{"_id":"sequence_2_patient","_rev":"130-943328c138b701637a579574f516e90b","data":{"prefix":null,"value":130},"_revisions":{"start":130,"ids":["943328c138b701637a579574f516e90b","b527a87cb4f86205dcc62a9ea0fa7a63","973262d1b9be91e82f997cf103481c55","44582fef141bcd8b558595514d3ba0ff","4a8d8f8ca25aa960aef16e5c1e489b81","2a48a9bc803b0d60b5018c07017aedeb","fe6186b5bd38fce211c0dc76ef4a619b","4d41059d2cd8accf225fce92edbbc428","449ad29c390c73126670290e2a351dce","ef33fac6f75c92df977deadcefd2ea21","bde0d0a9a34c662a05458f1d379c6038","4e2b60d439b5001f0562aaa5e836de72","9b7cf30a3a428b0ffbc5c08469b60dc4","fdfa70107c954a955eddc00f1710a412","acb0081b558f7dfc06520ce59abdca9d","b611e8c2f6823f040262e4e983aa8b3e","803c06167d785dca413153687432b9da","e2c71646996df37f91cabb3881395db4","e07b6a9914e89ef9b68e6412801e47db","5c4e63e3ec27823d46d7048c34f1035c","85c90147d202a4eb1a047e2633fdc911","e7dae8e43e473a4b347f5c22161844b4","471182bdd694919456395e3b8ee81d85","c45ce9b872e266344359c0637f9dd5d0","962ad8bf64b30813c4fef6958e83e3f3","5b281c4ea003d026419d35d05dd0b87a","9ed77096845040620cd2354c1ed74001","409143da04d5575669e515f6214f6220","c35ff5c786890aa0005b360749cefdd2","48cba21a512868f2c8e3beb5646ff1c1","58fcaf249567f43db62a1c77a1440b8e","71c619fe66ac2a2246708c6733e7af9e","0e2a21c17d44457443a58dd2db6824fb","7449d0f1ba104902ca08b888dfdc546f","20f7d87b7b4a5326bb93f84c11ae627d","bef379849a35ec5a7408f26a83026e2b","5dd124839c582c23e9279eda6f821796","15a041f1e149ae2989eba580b93969b0","93e7694e1741666512f83bd1bd5064f3","002edd9949b2993af6ce18817d0bc666","a8795752b4a5c9e587d5bbbd05ef41d4","c6f60912813f86724b49110221b713fe","728c2adfea6754b048f7acae42edd25f","b1ddbe8c27e77a561d22fec546349409","923830cdb237b3ba2088779642bca716","85f7e7891658b988333439ee84dfcd39","a52f2c92c951c2c7266a9ad170d3ae9d","79cfca9fdd7b6cdae2396862f103599e","87221151cfb4cb5bbdf73eb694a7eb34","f1c5faf2bc8f82ec5a29071b6156e5e2","84612c5298273469c586955ee8427555","cc81c865b33cf6d967bde9ff60b9af6d","8b16de2d23b9c7e216215085a08caea8","8be1c3c951d7c2355f910f785cac2534","696488469a9aa721643875029f6de938","04ffb420af095d229c45a69d0e1c56c2","f8fc0538d0eacb22a767c9eb449f4c84","6adb4264d4dd3b13829ffc7e17ba58c2","f50856bf682db17eee3d3cafb366a6be","743e61dcfce262c16251ed396ee76eb7","4fcdf09a763ec5da89d41dab6dd9edc8","912874972749c40ea838145828c14173","fd8c5a0d7662b27c8cbdfbfdd45ee32d","173fe5c207973de53fd984078bbd73a2","4e9ef14c62f9312cd0fb1b47e7fabe1e","ce6f1f9584656970cfd92f1e361e2fed","cf8cf83cf02c266b75af0bc69467a07f","5816c2ba418d387facd7b6ed0a0e6054","b3839c763f128f2ccf99cfb874a2413e","68b05605500c0109d046a56680a5a7a1","a13d320fed2c85ed0b173d6645ec0274","ba1dad02a90e4ac18632c1a53a90b759","c5e7e81e97d0fc7d0797bd9822685176","b580fcf4f4291b408f4dda64a4bdec96","bb1a562af157e3c24d23c3e2f1171b29","e9f245d9566dd9e116caf7d074792d36","30b587f2b5204d237572c86a545756fb","7df53a1742b52647118fec21f331e94d","0a4c120f78fa5899d0cea5d87d92c9b0","e62f1b02721a75fd1ea290da9acdc199","3e39b429ea4cda00c9ac9d3f0b61029c","038d82911c8979c0cd58e807871a09ca","618d916a14cfa55aa8e65d42b3761ca5","8d24a6b355e64a680f0f03ab0f738b8c","999e1fa6e5175dad02e4f2db0cd41843","782e7a1c4097f1aa1d117a7fbd01c443","67b3c03ea8609652c494a22242ce5a1f","3b1fc1b83a352ef9c672110a69306064","8a0da1966531daede44592906bf8df99","279e844131c96ca7b647cacfa3508022","42733f5f658de7ee440c02286fd4e21c","e3a50044a3cb2ac901b5b65653d0fc7f","b7fb5627bee7f642f8e608be1bb1e859","2fdb16832a0ed61b7f9e780750b70898","e38f4adbab987a8c628599ea9052ca44","7ece3f9fcff7b57b28f1237ba1107a0f","8fb6c171e3c6a345d199a8884e42951a","c76709145ca58dfcf67c1f397b772689","76182e657f0b0aa6fa07bf5491d2b427","ab161b88c332f3df338f1f4aa2b2e307","e00a3184b07c0459cf4ebdeb825f991f","cee6a3aac677927abaf3ae61508954a2","86bed2b62e1e6b6f98790ecafefcc17f","ae44899fdbc41d69076ec6a8f7563181","61cce97f5cd6ff092f28fe9ec9da4f27","f9008b952322c32322ef0e7e42fdf383","8fdecd159563a90d7cbc9c9aedc3068f","9b1f0f8f0e4db1f8931d290966f3bc3c","a9b5402ea07343a1b6d5612312e07a34","25ef3d2573778c3ebda4ef7860fe310f","3e39e8d6ceabb2079042e81613858906","b4e15c555737aa9573724407ce84b667","b2538362e8afb57e3e11e5231ae60d5d","04add3d3926f54232b0e0ed7a9fc141a","e924dcf4bb51c7c552538273e08901bb","77b6f226033c656d3a9768085ff3e80a","676dd4835b46e8f62ec2ce5908d1c60a","762481b2c71611cce80a5a9ef03aa48d","b9b73bf1d2df1598cc164089375ed7bc","0a581f677e6d8f7a484fa0a80156d95b","6b51cfdb83336973df284e4d5c2f308b","4a27247e93fabb86b6a5a9676f47ec8e","8b542908965798dd683a68f507635a83","515d8987a1e11acb866ede87612b53b1","d19e3759adc65398cf6a42a61345cdae","ac63c129bee25dc4c59a639e2721fb81","17c1209032c06df436ad0a4fa76723cc","f0ef6923c78e739d9228517a4813b646","f9a8fd6c55cd4e5fb0064b7767586e05","5bc31ffefa482f2e66299cf0704623c8"]}},{"_id":"visit_2_0BD42BD9-0E5D-0533-A8FA-1C0ADB0F0D65","_rev":"2-0ddd43cbcc57cc5d6ff082a283d881ac","data":{"dischargeInfo":null,"endDate":"2015-10-15T10:37:57.902Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-15T10:37:57.902Z","status":null,"visitType":"Imaging","lastModified":"2015-10-15T10:37:57.915Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-15T10:37:57.915Z","endDate":"2015-10-15T10:37:57.915Z","outPatient":"2015-10-15T10:37:57.915Z","visitType":"2015-10-15T10:37:57.915Z"},"charges":[],"imaging":["1AC1DD3D-E7E7-15B4-A698-8A8AE62749EB"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["0ddd43cbcc57cc5d6ff082a283d881ac","e4540f9cf2a236335662116d4e0a66da"]}},{"_id":"visit_2_377AA288-AAD4-F60B-ABD1-B5A0B9C75D50","_rev":"2-ee5b0686e20e1011d11b3051b93e7a93","data":{"dischargeInfo":null,"endDate":"2015-10-15T09:39:37.940Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-15T09:39:37.940Z","status":null,"visitType":"Imaging","lastModified":"2015-10-15T09:39:37.948Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-15T09:39:37.948Z","endDate":"2015-10-15T09:39:37.948Z","outPatient":"2015-10-15T09:39:37.948Z","visitType":"2015-10-15T09:39:37.948Z"},"charges":[],"imaging":["07CC6746-C7D9-A410-9B8C-C4B4E095A96D"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["ee5b0686e20e1011d11b3051b93e7a93","5fee255cf57220ddf1c19977118a540e"]}},{"_id":"visit_2_6AD00ED1-670A-2C3F-BC10-0742B1F99264","_rev":"2-9bf9856192b6c8ef34d2fcdb27296593","data":{"dischargeInfo":null,"endDate":"2015-10-28T07:39:18.257Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-28T07:39:18.257Z","status":null,"visitType":"Imaging","lastModified":"2015-10-28T07:39:18.275Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-28T07:39:18.275Z","endDate":"2015-10-28T07:39:18.275Z","outPatient":"2015-10-28T07:39:18.275Z","visitType":"2015-10-28T07:39:18.275Z"},"charges":[],"imaging":["91B061E9-2986-D539-90C8-CD14EC2010B0"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["9bf9856192b6c8ef34d2fcdb27296593","e50477b58f5edd257b9ce20ea65b1bca"]}},{"_id":"visit_2_74A4EF68-5D8D-BDF6-940F-33E50E50DDEA","_rev":"2-c24a52b04610b293fff293b18dd0bb15","data":{"dischargeInfo":null,"endDate":"2015-10-28T07:27:44.394Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-28T07:27:44.394Z","status":null,"visitType":"Imaging","lastModified":"2015-10-28T07:27:44.406Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-28T07:27:44.406Z","endDate":"2015-10-28T07:27:44.406Z","outPatient":"2015-10-28T07:27:44.406Z","visitType":"2015-10-28T07:27:44.406Z"},"charges":[],"imaging":["EA6B989C-90B7-2E08-9D8F-CE4339BB9B4B"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["c24a52b04610b293fff293b18dd0bb15","5a6ae8f033eb99448ad898f164d822e8"]}},{"_id":"visit_2_9F1A65ED-683F-056E-8D50-A8AF63201CE2","_rev":"2-e19734a8deff62722e6e023af4b8e130","data":{"dischargeInfo":null,"endDate":"2015-10-22T07:08:38.175Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-22T07:08:38.175Z","status":null,"visitType":"Imaging","lastModified":"2015-10-22T07:08:38.189Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-22T07:08:38.189Z","endDate":"2015-10-22T07:08:38.189Z","outPatient":"2015-10-22T07:08:38.189Z","visitType":"2015-10-22T07:08:38.189Z"},"charges":[],"imaging":["D0F299E4-CD8D-557D-8C23-216FD23EF844"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["e19734a8deff62722e6e023af4b8e130","bd81a41820526c8c0450ee544867c6fa"]}},{"_id":"visit_2_C5C296AC-E238-CBA5-8DD8-99942843BC5A","_rev":"2-57e6740d8dac593d790cd7f76c4ad0c3","data":{"dischargeInfo":null,"endDate":"2015-10-26T11:49:08.277Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-26T11:49:08.277Z","status":null,"visitType":"Imaging","lastModified":"2015-10-26T11:49:08.282Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-26T11:49:08.282Z","endDate":"2015-10-26T11:49:08.282Z","outPatient":"2015-10-26T11:49:08.282Z","visitType":"2015-10-26T11:49:08.282Z"},"charges":[],"imaging":["4A7FC838-0B37-E151-AFD8-8DBAC9DE9D99"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["57e6740d8dac593d790cd7f76c4ad0c3","253e8d9f8c0865cb3e9ffd1f6849bcde"]}},{"_id":"visit_2_CBFA5C2C-191D-FC9C-AD19-14D26D5A3003","_rev":"2-f781f118fd87b036d8cbfbf7771cda99","data":{"dischargeInfo":null,"endDate":"2015-10-28T07:23:34.906Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-28T07:23:34.906Z","status":null,"visitType":"Imaging","lastModified":"2015-10-28T07:23:34.914Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-28T07:23:34.914Z","endDate":"2015-10-28T07:23:34.914Z","outPatient":"2015-10-28T07:23:34.914Z","visitType":"2015-10-28T07:23:34.914Z"},"charges":[],"imaging":["51D8DC28-78EB-62B1-942A-1158F5862F34"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["f781f118fd87b036d8cbfbf7771cda99","e2b8bf1f76ea01c32b414c184905511e"]}},{"_id":"visit_2_D6938BD3-6346-F62B-8B19-5207B2E5A6AF","_rev":"2-631f62b5121ccfcd1a8de2bc9d3d252f","data":{"dischargeInfo":null,"endDate":"2015-10-28T07:31:20.941Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-28T07:31:20.941Z","status":null,"visitType":"Imaging","lastModified":"2015-10-28T07:31:20.953Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-28T07:31:20.953Z","endDate":"2015-10-28T07:31:20.953Z","outPatient":"2015-10-28T07:31:20.953Z","visitType":"2015-10-28T07:31:20.953Z"},"charges":[],"imaging":["DBE152F6-9508-2E12-81AC-39BC2CAFE08C"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["631f62b5121ccfcd1a8de2bc9d3d252f","8b46887d52e3043d742262fc03ff48b8"]}}]}\n{"seq":112}\n';});
define('hospitalrun/tests/fixtures/labs',['exports'],function(exports){exports['default'] = '{"version":"1.2.5","db_type":"http","start_time":"2017-03-16T14:42:49.765Z","db_info":{"db_name":"main","doc_count":106,"doc_del_count":21,"update_seq":151,"purge_seq":0,"compact_running":false,"disk_size":176232,"data_size":104837,"instance_start_time":"1489675316627096","disk_format_version":6,"committed_update_seq":151,"host":"http://localhost:5984/main/","auto_compaction":false,"adapter":"http"}}\n{"docs":[{"_id":"_design/custom_form_by_type","_rev":"1-ddf0ee75c1e8e859d821a9f5c1ec43b6","version":1,"views":{"custom_form_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'customForm\') {\\n        emit(doc.data.formType);\\n      }\\n    }\\n  }"}}}]}\n{"seq":3}\n{"docs":[{"_id":"_design/incident_by_friendly_id","_rev":"1-885a12b67da47e956bc190fe1fe0d4e6","version":1,"views":{"incident_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}}]}\n{"seq":6}\n{"docs":[{"_id":"_design/appointments_by_date","_rev":"1-4c8dd95ad6d36b9b4d86136d5e417f5c","version":5,"views":{"appointments_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n      var i,\\n          filterBy = null,\\n          includeRow = true;\\n      if (req.query && req.query.filterBy) {\\n        filterBy = JSON.parse(req.query.filterBy);\\n      }\\n      if (!filterBy) {\\n        return true;\\n      }\\n      for (i = 0; i < filterBy.length; i++) {\\n        var currentValue = row.doc.data[filterBy[i].name];\\n        if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n          currentValue = \'Scheduled\';\\n        }\\n        if (currentValue !== filterBy[i].value) {\\n          includeRow = false;\\n          break;\\n        }\\n      }\\n      return includeRow;\\n    });rows.sort(function (a, b) {\\n      function defaultStatus(value) {\\n        if (!value || value === \'\') {\\n          return \'Scheduled\';\\n        } else {\\n          return value;\\n        }\\n      }\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'appointmentType\':\\n        case \'location\':\\n        case \'provider\':\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        case \'date\':\\n          {\\n            var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n            if (startDiff === 0) {\\n              return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n            } else {\\n              return startDiff;\\n            }\\n            break;\\n          }\\n        case \'status\':\\n          {\\n            var aStatus = defaultStatus(a.doc.data[sortBy]),\\n                bStatus = defaultStatus(b.doc.data[sortBy]);\\n            return compareStrings(aStatus, bStatus);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["4c8dd95ad6d36b9b4d86136d5e417f5c"]}},{"_id":"_design/appointments_by_date","_rev":"1-5df29f1d7dbd39d6b3a2145923ab73cf","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["5df29f1d7dbd39d6b3a2145923ab73cf"]}},{"_id":"_design/appointments_by_date","_rev":"1-178add045be11a7fd6aa7fdf97c8f3f0","version":6,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([startDate, endDate, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n      var filterBy = null;\\n      var includeRow = true;\\n      if (req.query && req.query.filterBy) {\\n        filterBy = JSON.parse(req.query.filterBy);\\n      }\\n      if (!filterBy) {\\n        return true;\\n      }\\n      for (var i = 0; i < filterBy.length; i++) {\\n        var currentValue = row.doc.data[filterBy[i].name];\\n        if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n          currentValue = \'Scheduled\';\\n        }\\n        if (currentValue !== filterBy[i].value) {\\n          includeRow = false;\\n          break;\\n        }\\n      }\\n      return includeRow;\\n    });rows.sort(function (a, b) {\\n      function defaultStatus(value) {\\n        if (!value || value === \'\') {\\n          return \'Scheduled\';\\n        } else {\\n          return value;\\n        }\\n      }\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'appointmentType\':\\n        case \'location\':\\n        case \'provider\':\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        case \'date\':\\n          {\\n            var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n            if (startDiff === 0) {\\n              return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n            } else {\\n              return startDiff;\\n            }\\n          }\\n        case \'status\':\\n          {\\n            var aStatus = defaultStatus(a.doc.data[sortBy]);\\n            var bStatus = defaultStatus(b.doc.data[sortBy]);\\n            return compareStrings(aStatus, bStatus);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["178add045be11a7fd6aa7fdf97c8f3f0"]}},{"_id":"_design/appointments_by_date","_rev":"2-1fc384eae57485ff9100c0614780ab62","_deleted":true,"_revisions":{"start":2,"ids":["1fc384eae57485ff9100c0614780ab62","03951858f9232df2e774548b0f5fd068"]}},{"_id":"_design/appointments_by_date","_rev":"6-d33b75c96b6747a173db1e2056cef3ad","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":6,"ids":["d33b75c96b6747a173db1e2056cef3ad","813b4e941fde42179a8c0bf84cbb0149","596eb2a7b7c8a9e5509d106fee8cb9a3","384efd51245c64e75b8307add874ff31","32e2a3c0bdbdef4511fd301ea83e0b6e","3c37df4fed5a034aedc1a295f4a672fd"]}},{"_id":"_design/appointments_by_patient","_rev":"1-7232d3292344540b2511e709422e2cbf","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate,doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7232d3292344540b2511e709422e2cbf"]}},{"_id":"_design/appointments_by_patient","_rev":"1-9a97acd5b8fd071ad81afc9e730721c5","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate,doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["9a97acd5b8fd071ad81afc9e730721c5"]}},{"_id":"_design/appointments_by_patient","_rev":"4-cc029ce23e24c88924abe875e644c20e","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate,doc._id]);}}}"}},"_revisions":{"start":4,"ids":["cc029ce23e24c88924abe875e644c20e","2c3d0116f9462d0945bba5d8092f1f13","b07bbda1569b8575e3fb3f118584c0c2","9868b6586898a48c3fd68722ca3fe1d4"]}},{"_id":"_design/closed_incidents_by_user","_rev":"1-bf16176c13be57af9a4f1a0980710190","version":1,"views":{"closed_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status === \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}}},{"_id":"_design/imaging_by_status","_rev":"1-2feb5103c3f6d149bf98f0adeaa76b38","version":4,"views":{"imaging_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"imaging\\") {var imagingDate = doc.data.imagingDate;if (imagingDate && imagingDate !== \\"\\") {imagingDate = new Date(imagingDate);if (imagingDate.getTime) {imagingDate = imagingDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, imagingDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["2feb5103c3f6d149bf98f0adeaa76b38"]}},{"_id":"_design/imaging_by_status","_rev":"1-1a3bab3d2d1403299a9e4ad8dffe5fa1","version":4,"views":{"imaging_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'imaging\') {\\n        var imagingDate = doc.data.imagingDate;\\n    if (imagingDate && imagingDate !== \\"\\") {\\n      imagingDate = new Date(imagingDate);\\n      if (imagingDate.getTime) {\\n        imagingDate = imagingDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, imagingDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["1a3bab3d2d1403299a9e4ad8dffe5fa1"]}},{"_id":"_design/imaging_by_status","_rev":"4-27780ee78d428c60962e7add42fbe696","version":4,"views":{"imaging_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"imaging\\") {var imagingDate = doc.data.imagingDate;if (imagingDate && imagingDate !== \\"\\") {imagingDate = new Date(imagingDate);if (imagingDate.getTime) {imagingDate = imagingDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, imagingDate, doc._id]);}}}"}},"_revisions":{"start":4,"ids":["27780ee78d428c60962e7add42fbe696","ed2e6ee8dd0c31542cd651be11c27d30","26b4791796949ad78268d383e39a1ee5","9236042e1fb9f567d1d527bbb429cd8e"]}},{"_id":"_design/incident_by_date","_rev":"1-59fa59734ee129cff0560b20a95d2d4e","version":1,"views":{"incident_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        var dateOfIncident = doc.data.dateOfIncident;\\n    if (dateOfIncident && dateOfIncident !== \\"\\") {\\n      dateOfIncident = new Date(dateOfIncident);\\n      if (dateOfIncident.getTime) {\\n        dateOfIncident = dateOfIncident.getTime();\\n      }\\n    }\\n    emit([dateOfIncident, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_by_friendly_id","_rev":"1-82e24378f074a284cae14da4db5431ed","version":1,"views":{"inventory_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_by_name","_rev":"1-91f55ae6bd30f766d9da95bffe054bcb","version":5,"views":{"inventory_by_name":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.name, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["91f55ae6bd30f766d9da95bffe054bcb"]}},{"_id":"_design/inventory_by_name","_rev":"1-c12e4467c9c3ecc8021b660934257f25","version":4,"views":{"inventory_by_name":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit([doc.data.name, doc._id]);}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["c12e4467c9c3ecc8021b660934257f25"]}},{"_id":"_design/inventory_by_name","_rev":"2-48c47b3b2eb831a69fd6c3d0b9ad1713","_deleted":true,"_revisions":{"start":2,"ids":["48c47b3b2eb831a69fd6c3d0b9ad1713","3eb498726e0d057818618808c0db46bf"]}},{"_id":"_design/inventory_by_name","_rev":"5-c925a4a9709410de9d08a3a93a44fa10","version":5,"views":{"inventory_by_name":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.name, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":5,"ids":["c925a4a9709410de9d08a3a93a44fa10","9e1ce570a02dce9309203bfc01903252","7f9be41d3ceb65d74450e57d51152c10","6970ab89b44af8c2703a89d6dea9b20b","304304d63beaffd8d1ae4ae1cddf4b2b"]}},{"_id":"_design/inventory_by_type","_rev":"1-18455500e1e86544edceaab01bb511bc","version":5,"views":{"inventory_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit(doc.data.inventoryType);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["18455500e1e86544edceaab01bb511bc"]}},{"_id":"_design/inventory_by_type","_rev":"1-65423cfcd4b0acd93b58aa2003907c92","version":5,"views":{"inventory_by_type":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit(doc.data.inventoryType);}}}"}},"_revisions":{"start":1,"ids":["65423cfcd4b0acd93b58aa2003907c92"]}},{"_id":"_design/inventory_by_type","_rev":"4-c1906643bf01c3824d2578f9bd3a1a80","version":5,"views":{"inventory_by_type":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit(doc.data.inventoryType);}}}"}},"_revisions":{"start":4,"ids":["c1906643bf01c3824d2578f9bd3a1a80","5e78c81a3f3acc2cd577f4743233b5f6","2f0df4e3dc8ba6d384f896efd4a272cf","003ef699ab0f2b8628c0bf613fabf7a2"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-0d7b597aeae746589980b12903768252","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invPurchase\') {\\n        var dateReceived = doc.data.dateReceived;\\n    if (dateReceived && dateReceived !== \\"\\") {\\n      dateReceived = new Date(dateReceived);\\n      if (dateReceived.getTime) {\\n        dateReceived = dateReceived.getTime();\\n      }\\n    }\\n    emit([dateReceived, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["0d7b597aeae746589980b12903768252"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-823be94576112c800022b256ccd9b725","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var dateReceived = doc.data.dateReceived;if (dateReceived && dateReceived !== \\"\\") {dateReceived = new Date(dateReceived);if (dateReceived.getTime) {dateReceived = dateReceived.getTime();}}emit([dateReceived, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["823be94576112c800022b256ccd9b725"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"4-ac6802792a6a84310f6116a36af282fa","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var dateReceived = doc.data.dateReceived;if (dateReceived && dateReceived !== \\"\\") {dateReceived = new Date(dateReceived);if (dateReceived.getTime) {dateReceived = dateReceived.getTime();}}emit([dateReceived, doc._id]);}}}"}},"_revisions":{"start":4,"ids":["ac6802792a6a84310f6116a36af282fa","0d58604e8df561f2a7e1f74df37aa699","65f020065c11403193b02742a05b91ae","78939ec45bef330bbfa87763dbbfce37"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-7aea58304996ccb168865141592a024f","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var expirationDate = doc.data.expirationDate;if (expirationDate && expirationDate !== \\"\\") {expirationDate = new Date(expirationDate);if (expirationDate.getTime) {expirationDate = expirationDate.getTime();}}emit([expirationDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7aea58304996ccb168865141592a024f"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-1f41dd6d030c58884d7013ef9436decb","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invPurchase\') {\\n        var expirationDate = doc.data.expirationDate;\\n    if (expirationDate && expirationDate !== \\"\\") {\\n      expirationDate = new Date(expirationDate);\\n      if (expirationDate.getTime) {\\n        expirationDate = expirationDate.getTime();\\n      }\\n    }\\n    emit([expirationDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["1f41dd6d030c58884d7013ef9436decb"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"4-ed94d431336c675269f8d885cf6286f9","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var expirationDate = doc.data.expirationDate;if (expirationDate && expirationDate !== \\"\\") {expirationDate = new Date(expirationDate);if (expirationDate.getTime) {expirationDate = expirationDate.getTime();}}emit([expirationDate, doc._id]);}}}"}},"_revisions":{"start":4,"ids":["ed94d431336c675269f8d885cf6286f9","018a00a593301ef97818b36d89501387","d900cddd5fcc673d77fbd2f6d783475d","17bd9d3619ae03155d9929d3ebcd5023"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-e9eb2d7f1e35296646399c7414525c33","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);}}}"}},"_revisions":{"start":1,"ids":["e9eb2d7f1e35296646399c7414525c33"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-021f4c24b5b6202594f610cf5d4c63a4","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invRequest\') {\\n        var dateCompleted = doc.data.dateCompleted;\\n    if (dateCompleted && dateCompleted !== \\"\\") {\\n      dateCompleted = new Date(dateCompleted);\\n      if (dateCompleted.getTime) {\\n        dateCompleted = dateCompleted.getTime();\\n      }\\n    }\\n    emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["021f4c24b5b6202594f610cf5d4c63a4"]}},{"_id":"_design/inventory_request_by_item","_rev":"4-677826d6dc14137e854f01eed77dbf02","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);}}}"}},"_revisions":{"start":4,"ids":["677826d6dc14137e854f01eed77dbf02","0040cb66e900e1886780881cdbb5ec39","c2f0efb7a0a9b3ece1cf9b7b0e88d37f","7e7ef275a9fc15f2b5f328b1479c6097"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-cc0c1e0e01060aa62456d6ea768d8ec7","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invRequest\') {\\n        var dateCompleted = doc.data.dateCompleted;\\n    if (dateCompleted && dateCompleted !== \\"\\") {\\n      dateCompleted = new Date(dateCompleted);\\n      if (dateCompleted.getTime) {\\n        dateCompleted = dateCompleted.getTime();\\n      }\\n    }\\n    emit([doc.data.status, dateCompleted, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["cc0c1e0e01060aa62456d6ea768d8ec7"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-f4a7252ebf2802c53a572bf150eae05c","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.status, dateCompleted, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["f4a7252ebf2802c53a572bf150eae05c"]}},{"_id":"_design/inventory_request_by_status","_rev":"4-c94aa7c5f3ed5ace3f9804b6c5c7a8a5","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.status, dateCompleted, doc._id]);}}}"}},"_revisions":{"start":4,"ids":["c94aa7c5f3ed5ace3f9804b6c5c7a8a5","0d7f2c75a57d13685e096bdbe9b42c20","0338b756f9c3471052577cadc4ed9505","187394c79d3206e11e112891f0d63550"]}},{"_id":"_design/invoice_by_patient","_rev":"1-9f67a58d4e428614844ac82cb2548268","version":1,"views":{"invoice_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invoice\') {\\n        emit(doc.data.patient);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["9f67a58d4e428614844ac82cb2548268"]}},{"_id":"_design/invoice_by_patient","_rev":"1-a491390f74ce432d9cfab78291e0753b","version":1,"views":{"invoice_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":1,"ids":["a491390f74ce432d9cfab78291e0753b"]}},{"_id":"_design/invoice_by_status","_rev":"1-25a58e1cec7f01d0a7e8da1293f59b69","version":4,"views":{"invoice_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {var billDate = doc.data.billDate;if (billDate && billDate !== \\"\\") {billDate = new Date(billDate);if (billDate.getTime) {billDate = billDate.getTime();}}emit([doc.data.status, billDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["25a58e1cec7f01d0a7e8da1293f59b69"]}},{"_id":"_design/invoice_by_status","_rev":"1-d411e6f66f897f0b9b985dc6e5188d85","version":4,"views":{"invoice_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invoice\') {\\n        var billDate = doc.data.billDate;\\n    if (billDate && billDate !== \\"\\") {\\n      billDate = new Date(billDate);\\n      if (billDate.getTime) {\\n        billDate = billDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, billDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["d411e6f66f897f0b9b985dc6e5188d85"]}},{"_id":"_design/invoice_by_status","_rev":"4-33a509053df2aeb2a3fa9c6f47862122","version":4,"views":{"invoice_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {var billDate = doc.data.billDate;if (billDate && billDate !== \\"\\") {billDate = new Date(billDate);if (billDate.getTime) {billDate = billDate.getTime();}}emit([doc.data.status, billDate, doc._id]);}}}"}},"_revisions":{"start":4,"ids":["33a509053df2aeb2a3fa9c6f47862122","cf3a304d6172c15cc8ecfe3f6b4857ff","cda5e78ae504f4aaf101cc43d434d5ab","73e3e45673ed0c4f4ae1cee855f216f0"]}},{"_id":"_design/lab_by_status","_rev":"1-16b2c13356e8dac3b3594018f91cccfb","version":4,"views":{"lab_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"lab\\") {var labDate = doc.data.labDate;if (labDate && labDate !== \\"\\") {labDate = new Date(labDate);if (labDate.getTime) {labDate = labDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, labDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["16b2c13356e8dac3b3594018f91cccfb"]}},{"_id":"_design/lab_by_status","_rev":"1-7d4de6e219b482171b7ecd485ef72238","version":4,"views":{"lab_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'lab\') {\\n        var labDate = doc.data.labDate;\\n    if (labDate && labDate !== \\"\\") {\\n      labDate = new Date(labDate);\\n      if (labDate.getTime) {\\n        labDate = labDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, labDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["7d4de6e219b482171b7ecd485ef72238"]}},{"_id":"_design/lab_by_status","_rev":"4-f931b82ee70f0d2996497c97bd76e57c","version":4,"views":{"lab_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"lab\\") {var labDate = doc.data.labDate;if (labDate && labDate !== \\"\\") {labDate = new Date(labDate);if (labDate.getTime) {labDate = labDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, labDate, doc._id]);}}}"}},"_revisions":{"start":4,"ids":["f931b82ee70f0d2996497c97bd76e57c","2ccbba6e4057a9b83d103aedefc00188","9fdf54dfbf4c6b9136d6addf5e624fcc","db4393c6856b98a40afd6ceef31db2a7"]}},{"_id":"_design/medication_by_status","_rev":"1-09e1d1c201823532161ef48ba23200be","version":4,"views":{"medication_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"medication\\") {var prescriptionDate = doc.data.prescriptionDate;if (prescriptionDate && prescriptionDate !== \\"\\") {prescriptionDate = new Date(prescriptionDate);if (prescriptionDate.getTime) {prescriptionDate = prescriptionDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["09e1d1c201823532161ef48ba23200be"]}},{"_id":"_design/medication_by_status","_rev":"1-a6403c53b2db46905b3b1861120c6601","version":4,"views":{"medication_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'medication\') {\\n        var prescriptionDate = doc.data.prescriptionDate;\\n    if (prescriptionDate && prescriptionDate !== \\"\\") {\\n      prescriptionDate = new Date(prescriptionDate);\\n      if (prescriptionDate.getTime) {\\n        prescriptionDate = prescriptionDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["a6403c53b2db46905b3b1861120c6601"]}},{"_id":"_design/medication_by_status","_rev":"4-63806ca3d30ae3bf789087e22f0f8a4b","version":4,"views":{"medication_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"medication\\") {var prescriptionDate = doc.data.prescriptionDate;if (prescriptionDate && prescriptionDate !== \\"\\") {prescriptionDate = new Date(prescriptionDate);if (prescriptionDate.getTime) {prescriptionDate = prescriptionDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);}}}"}},"_revisions":{"start":4,"ids":["63806ca3d30ae3bf789087e22f0f8a4b","3284bca2c5c65c2518fddfb7f7868d16","7949d287e31bd3487aa205ae3b23a352","36ce9e9853552f5eb646ed26de7184dc"]}},{"_id":"_design/open_incidents_by_user","_rev":"1-34770efd210920a30c96d3787521e8a5","version":1,"views":{"open_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status !== \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      }\\n      return 0; // Don\'t sort\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/patient_by_admission","_rev":"1-3c2da4380d257c95ebf4430afa48de3b","version":4,"views":{"patient_by_admission":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.admitted === true) {\\n      if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["3c2da4380d257c95ebf4430afa48de3b"]}},{"_id":"_design/patient_by_admission","_rev":"2-cb3270a3d44a370d50128b93179d3503","version":4,"views":{"patient_by_admission":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.admitted === true) {\\n      if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["cb3270a3d44a370d50128b93179d3503","ee7b6ead26ac6b8b3f106c6d85dc175b"]}},{"_id":"_design/patient_by_display_id","_rev":"1-8a6930002af6d588ecdedd5f07da0230","version":7,"views":{"patient_by_display_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["8a6930002af6d588ecdedd5f07da0230"]}},{"_id":"_design/patient_by_display_id","_rev":"1-c619a041bccecc7e83b05015cc92706e","version":6,"views":{"patient_by_display_id":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {if (doc.data.friendlyId) {emit([doc.data.friendlyId, doc._id]);} else if (doc.data.externalPatientId) {emit([doc.data.externalPatientId, doc._id]);} else {emit([doc._id, doc._id]);}}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["c619a041bccecc7e83b05015cc92706e"]}},{"_id":"_design/patient_by_display_id","_rev":"2-3f200c7d54cda6b4fea8699bc1a3e6d0","_deleted":true,"_revisions":{"start":2,"ids":["3f200c7d54cda6b4fea8699bc1a3e6d0","e6d44a1448953362319c910bf33a8668"]}},{"_id":"_design/patient_by_display_id","_rev":"5-1edbb6a3bad437e344e909f5a7c134cd","version":7,"views":{"patient_by_display_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":5,"ids":["1edbb6a3bad437e344e909f5a7c134cd","97cd67d85a6bfb0896c657f69014036a","02ebb613cc059e0541a8bc9e0c999df4","eae82996b36349ac1fce13b33546eaec","0b75ee7c82a1aadebd0bc0fd403622fb"]}},{"_id":"_design/patient_by_status","_rev":"1-49f3f7f86891fb7d60f0ee1b2db1220b","version":3,"views":{"patient_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {emit(doc.data.status);}}}"}},"_revisions":{"start":1,"ids":["49f3f7f86891fb7d60f0ee1b2db1220b"]}},{"_id":"_design/patient_by_status","_rev":"1-54bc74ff93db4aedff83bc649f766596","version":3,"views":{"patient_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        emit(doc.data.status);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["54bc74ff93db4aedff83bc649f766596"]}},{"_id":"_design/patient_by_status","_rev":"4-0ccbfd3ab95d03df289893210b0827bb","version":3,"views":{"patient_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {emit(doc.data.status);}}}"}},"_revisions":{"start":4,"ids":["0ccbfd3ab95d03df289893210b0827bb","56954022c675ccc9a4cd9f7807717559","9409c5c4fa24c2247009585f9d4a6833","ff26a12cdb8747aae5bf26f9af3a1953"]}},{"_id":"_design/photo_by_patient","_rev":"1-727ba2a3d1a106196746643395a859d0","version":4,"views":{"photo_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"photo\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":1,"ids":["727ba2a3d1a106196746643395a859d0"]}},{"_id":"_design/photo_by_patient","_rev":"1-6a4fad4fa682efbbd058e858c328574f","version":4,"views":{"photo_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'photo\') {\\n        emit(doc.data.patient);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["6a4fad4fa682efbbd058e858c328574f"]}},{"_id":"_design/photo_by_patient","_rev":"4-45b3ca4efb82f8d7a9fceb24b329989a","version":4,"views":{"photo_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"photo\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":4,"ids":["45b3ca4efb82f8d7a9fceb24b329989a","fa45a9cbe22c09f221ff666d54413588","8f2b02b810676cb5af00f6e34aff987e","e3dc5506f7f370535b85be0adc59c7cc"]}},{"_id":"_design/pricing_by_category","_rev":"1-3d703b5f240ae5838d1f20a8ad0471de","version":5,"views":{"pricing_by_category":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'pricing\') {\\n        emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["3d703b5f240ae5838d1f20a8ad0471de"]}},{"_id":"_design/pricing_by_category","_rev":"1-b34429f4f8aff13ed218f70f039b3591","version":5,"views":{"pricing_by_category":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"pricing\\") {emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["b34429f4f8aff13ed218f70f039b3591"]}},{"_id":"_design/pricing_by_category","_rev":"4-fe08fdf8bc669956b37ed0796869eeef","version":5,"views":{"pricing_by_category":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"pricing\\") {emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);}}}"}},"_revisions":{"start":4,"ids":["fe08fdf8bc669956b37ed0796869eeef","5462fbacd302cd763c692fb70c0eb521","68d447e856a6194de82dcd9e506569ae","23d44e44019170eadd086734c87e3976"]}},{"_id":"_design/procedure_by_date","_rev":"1-7c23f1d0feaff1358bee1ddea760daac","version":4,"views":{"procedure_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"procedure\\") {var procedureDate = doc.data.procedureDate;if (procedureDate && procedureDate !== \\"\\") {procedureDate = new Date(procedureDate);if (procedureDate.getTime) {procedureDate = procedureDate.getTime();}}emit([procedureDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7c23f1d0feaff1358bee1ddea760daac"]}},{"_id":"_design/procedure_by_date","_rev":"1-a44decd8f14d01c615cf3f5b8e70f10b","version":4,"views":{"procedure_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'procedure\') {\\n        var procedureDate = doc.data.procedureDate;\\n    if (procedureDate && procedureDate !== \\"\\") {\\n      procedureDate = new Date(procedureDate);\\n      if (procedureDate.getTime) {\\n        procedureDate = procedureDate.getTime();\\n      }\\n    }\\n    emit([procedureDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["a44decd8f14d01c615cf3f5b8e70f10b"]}},{"_id":"_design/procedure_by_date","_rev":"4-66384eddfc1ed1cc7dd604fa121b4a43","version":4,"views":{"procedure_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"procedure\\") {var procedureDate = doc.data.procedureDate;if (procedureDate && procedureDate !== \\"\\") {procedureDate = new Date(procedureDate);if (procedureDate.getTime) {procedureDate = procedureDate.getTime();}}emit([procedureDate, doc._id]);}}}"}},"_revisions":{"start":4,"ids":["66384eddfc1ed1cc7dd604fa121b4a43","3ad96e6c81fdac90bc4a3a1ccbe93047","5b5eb6c8ca33d0d3ff9c1f6ee70eb04c","25ccef2a9dff3addd8c0d15cc79c363c"]}},{"_id":"_design/report_by_visit","_rev":"1-1295cef10df82554859efdb4c38c1c1e","version":1,"views":{"report_by_visit":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'report\') {\\n        emit(doc.data.visit);\\n      }\\n    }\\n  }"}}},{"_id":"_design/sequence_by_prefix","_rev":"1-4a47589314718c2d8add1266b64b5ea6","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"sequence\\") {emit(doc.data.prefix);}}}"}},"_revisions":{"start":1,"ids":["4a47589314718c2d8add1266b64b5ea6"]}},{"_id":"_design/sequence_by_prefix","_rev":"1-10f81c9287f2db782b8e293e7d9b1cde","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'sequence\') {\\n        emit(doc.data.prefix);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["10f81c9287f2db782b8e293e7d9b1cde"]}},{"_id":"_design/sequence_by_prefix","_rev":"4-aa39124a28526c2347e4b54094cf6917","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"sequence\\") {emit(doc.data.prefix);}}}"}},"_revisions":{"start":4,"ids":["aa39124a28526c2347e4b54094cf6917","3909b0733e3185594d978e8a1cbe96bc","7c153bf61fed5e6742224f9df92cf676","8ac3a62b4c0b624ebed3b68b27cd197e"]}},{"_id":"_design/surgical_appointments_by_date","_rev":"1-90d8de834de1fe0e154d1cdab8889984","version":1,"views":{"surgical_appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType === \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/visit_by_date","_rev":"1-db61f993a1e1699c8205fee3434fc4c8","version":4,"views":{"visit_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([startDate, endDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["db61f993a1e1699c8205fee3434fc4c8"]}},{"_id":"_design/visit_by_date","_rev":"1-fd0a50125860ba3c17844c0567a70d65","version":4,"views":{"visit_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["fd0a50125860ba3c17844c0567a70d65"]}},{"_id":"_design/visit_by_date","_rev":"4-1af42c6d4d4ffc72aa0528198bdcf893","version":4,"views":{"visit_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":4,"ids":["1af42c6d4d4ffc72aa0528198bdcf893","92b1278be8c3eecc884da20ef05ce626","add6c18db9db449d2af501f6f3fc9a68","367a7fa42f1067f645190d560f83ef5e"]}},{"_id":"_design/visit_by_discharge_date","_rev":"1-b4baca85d54e727966aeb2e8ad172136","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    emit([endDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["b4baca85d54e727966aeb2e8ad172136"]}},{"_id":"_design/visit_by_discharge_date","_rev":"1-57a0b69b2792963e5112bbdd53bbba2d","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}emit([endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["57a0b69b2792963e5112bbdd53bbba2d"]}},{"_id":"_design/visit_by_discharge_date","_rev":"4-8350d43fffd50295bccd534888e236f9","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}emit([endDate, doc._id]);}}}"}},"_revisions":{"start":4,"ids":["8350d43fffd50295bccd534888e236f9","ddcfa99c875a0579775dfa3a0c98aa3f","6670d76cab3888a8c2c2a399beb1764f","e53c95160dacaf007fe01c01215729ce"]}},{"_id":"_design/visit_by_patient","_rev":"1-bf45f0e7e8e9123a59095b609570a4ea","version":4,"views":{"visit_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["bf45f0e7e8e9123a59095b609570a4ea"]}},{"_id":"_design/visit_by_patient","_rev":"1-f2865c74eefee716937492db914f2ccd","version":4,"views":{"visit_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["f2865c74eefee716937492db914f2ccd"]}},{"_id":"_design/visit_by_patient","_rev":"4-a265b65d70028f0be38677aa538d86e1","version":4,"views":{"visit_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);}}}"}},"_revisions":{"start":4,"ids":["a265b65d70028f0be38677aa538d86e1","91f492ce3aab5449a7fb4ad4bbffea95","048bd179b127054d3279071160a6f314","412252178488867e2350dcd13da779ea"]}},{"_id":"appointment_2_D0C3934D-E023-66E4-97D4-FC58F3595409","_rev":"1-5775c0c9cdf58099fa3ae4197634505f","data":{"allDay":true,"provider":"Dr Test","location":"Harare","appointmentType":"Admission","startDate":"2015-10-29T22:00:00.000Z","endDate":"2015-10-29T22:00:00.000Z","notes":"Admission","status":"Scheduled","lastModified":"2015-10-30T15:08:29.970Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"allDay":"2015-10-30T15:08:29.970Z","startDate":"2015-10-30T15:08:29.970Z","endDate":"2015-10-30T15:08:29.970Z","provider":"2015-10-30T15:08:29.970Z","location":"2015-10-30T15:08:29.970Z","appointmentType":"2015-10-30T15:08:29.970Z","notes":"2015-10-30T15:08:29.970Z"}}},{"_id":"appointment_2_EE5D1ABE-2625-645B-9F84-5B0DD4B4D5EC","_rev":"1-1bb336da899bbd4807cde6620d630bd1","data":{"allDay":true,"provider":"Dr Test","location":"Harare","appointmentType":"Admission","startDate":"2015-11-02T22:00:00.000Z","endDate":"2015-11-02T22:00:00.000Z","notes":"Basic Checkup","status":"Scheduled","lastModified":"2015-11-03T06:50:48.404Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"allDay":"2015-11-03T06:50:48.404Z","startDate":"2015-11-03T06:50:48.404Z","endDate":"2015-11-03T06:50:48.404Z","appointmentType":"2015-11-03T06:50:48.404Z","provider":"2015-11-03T06:50:48.404Z","location":"2015-11-03T06:50:48.404Z","notes":"2015-11-03T06:50:48.404Z"}}},{"_id":"imaging_2_07CC6746-C7D9-A410-9B8C-C4B4E095A96D","_rev":"2-ffa7adb60618346cba98a559d81df36a","data":{"imagingDate":"2015-10-15T09:39:44.603Z","notes":"random notes","radiologist":"zinyando","requestedBy":"hradmin","requestedDate":"2015-10-15T09:39:37.866Z","result":"to collect","status":"Completed","lastModified":"2015-10-15T09:39:44.603Z","modifiedBy":"hradmin","imagingType":"22208FBE-9C6E-079D-A1E6-A562F9310FE5","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"377AA288-AAD4-F60B-ABD1-B5A0B9C75D50","modifiedFields":{"radiologist":"2015-10-15T09:39:38.088Z","result":"2015-10-15T09:39:38.088Z","notes":"2015-10-15T09:39:38.088Z","status":"2015-10-15T09:39:44.603Z","requestedBy":"2015-10-15T09:39:38.088Z","requestedDate":"2015-10-15T09:39:38.088Z","imagingDate":"2015-10-15T09:39:44.603Z"},"charges":[]},"_revisions":{"start":2,"ids":["ffa7adb60618346cba98a559d81df36a","be0a6780ba1f2b7e3e8d49ebf20ed8d6"]}},{"_id":"imaging_2_1AC1DD3D-E7E7-15B4-A698-8A8AE62749EB","_rev":"1-83a3398c448faf2ea1962004c5652a52","data":{"imagingDate":null,"notes":"jkmn","radiologist":"zinyando","requestedBy":"hradmin","requestedDate":"2015-10-15T10:37:57.852Z","result":"hu","status":"Requested","lastModified":"2015-10-15T10:37:58.038Z","modifiedBy":"hradmin","imagingType":"4CEB69E7-B54A-9D45-B0EF-7643F0D48FA0","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"0BD42BD9-0E5D-0533-A8FA-1C0ADB0F0D65","modifiedFields":{"radiologist":"2015-10-15T10:37:58.038Z","result":"2015-10-15T10:37:58.038Z","notes":"2015-10-15T10:37:58.038Z","status":"2015-10-15T10:37:58.038Z","requestedBy":"2015-10-15T10:37:58.038Z","requestedDate":"2015-10-15T10:37:58.038Z"},"charges":[]}},{"_id":"imaging_2_4A7FC838-0B37-E151-AFD8-8DBAC9DE9D99","_rev":"2-0ddb54b6d0376b87fdf409eb6d205f82","data":{"imagingDate":"2015-10-28T07:32:45.311Z","notes":null,"radiologist":null,"requestedBy":"hradmin","requestedDate":"2015-10-26T11:49:08.227Z","result":null,"status":"Completed","lastModified":"2015-10-28T07:32:45.314Z","modifiedBy":"hradmin","imagingType":"CBB4C9D5-CE8C-2BB5-86F4-3FC16AE2E85D","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"C5C296AC-E238-CBA5-8DD8-99942843BC5A","modifiedFields":{"status":"2015-10-28T07:32:45.314Z","requestedBy":"2015-10-26T11:49:08.483Z","requestedDate":"2015-10-26T11:49:08.483Z","imagingDate":"2015-10-28T07:32:45.314Z"},"charges":[]},"_revisions":{"start":2,"ids":["0ddb54b6d0376b87fdf409eb6d205f82","0cefb2d2a3e8ba76052c1a08c27df1eb"]}},{"_id":"imaging_2_51D8DC28-78EB-62B1-942A-1158F5862F34","_rev":"2-40eac78a67beecaa77b17ea5e7481866","data":{"imagingDate":"2015-10-28T07:32:55.293Z","notes":"Chest is ok","radiologist":"Mr Test","requestedBy":"hradmin","requestedDate":"2015-10-28T07:23:34.834Z","result":"Ok","status":"Completed","lastModified":"2015-10-28T07:32:55.294Z","modifiedBy":"hradmin","imagingType":"E53305F3-BA40-B305-B2DC-0732C7AB0042","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"CBFA5C2C-191D-FC9C-AD19-14D26D5A3003","modifiedFields":{"radiologist":"2015-10-28T07:23:35.055Z","result":"2015-10-28T07:23:35.055Z","notes":"2015-10-28T07:23:35.055Z","status":"2015-10-28T07:32:55.294Z","requestedBy":"2015-10-28T07:23:35.055Z","requestedDate":"2015-10-28T07:23:35.055Z","imagingDate":"2015-10-28T07:32:55.294Z"},"charges":[]},"_revisions":{"start":2,"ids":["40eac78a67beecaa77b17ea5e7481866","fb212193dfed510d7935aed17e5f0456"]}},{"_id":"imaging_2_91B061E9-2986-D539-90C8-CD14EC2010B0","_rev":"1-2abe559a8f8075862b282ed4f9d54da5","data":{"imagingDate":null,"notes":"jbkj","radiologist":"b","requestedBy":"hradmin","requestedDate":"2015-10-28T07:39:18.255Z","result":"jjjk","status":"Requested","lastModified":"2015-10-28T07:39:18.406Z","modifiedBy":"hradmin","imagingType":null,"patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"6AD00ED1-670A-2C3F-BC10-0742B1F99264","modifiedFields":{"radiologist":"2015-10-28T07:39:18.406Z","result":"2015-10-28T07:39:18.406Z","notes":"2015-10-28T07:39:18.406Z","status":"2015-10-28T07:39:18.406Z","requestedBy":"2015-10-28T07:39:18.406Z","requestedDate":"2015-10-28T07:39:18.406Z"},"charges":[]}},{"_id":"imaging_2_D0F299E4-CD8D-557D-8C23-216FD23EF844","_rev":"3-8b87996abf9161e5d7908be6676a64d7","data":{"imagingDate":"2015-10-22T07:09:04.249Z","notes":"vbj nkm","radiologist":"fcgvb","requestedBy":"hradmin","requestedDate":"2015-10-22T07:08:38.080Z","result":"cgvhbj n","status":"Completed","lastModified":"2015-10-22T07:09:04.251Z","modifiedBy":"hradmin","imagingType":"B492AA26-22F2-52A9-93C7-17106A57A62E","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"9F1A65ED-683F-056E-8D50-A8AF63201CE2","modifiedFields":{"radiologist":"2015-10-22T07:08:38.523Z","result":"2015-10-22T07:08:38.523Z","notes":"2015-10-22T07:08:38.523Z","status":"2015-10-22T07:08:59.403Z","requestedBy":"2015-10-22T07:08:38.523Z","requestedDate":"2015-10-22T07:08:38.523Z","imagingDate":"2015-10-22T07:09:04.251Z"},"charges":[]},"_revisions":{"start":3,"ids":["8b87996abf9161e5d7908be6676a64d7","9f159b24551a1fa5acd7b84cd8d51994","c676b60d0d69556786f283da75b51c77"]}},{"_id":"imaging_2_DBE152F6-9508-2E12-81AC-39BC2CAFE08C","_rev":"2-69b11e7856d8b0fc3bd62debbfca3e55","data":{"imagingDate":"2015-10-28T07:33:17.867Z","notes":"ss","radiologist":"ss","requestedBy":"hradmin","requestedDate":"2015-10-28T07:31:20.891Z","result":"sss","status":"Completed","lastModified":"2015-10-28T07:33:17.868Z","modifiedBy":"hradmin","imagingType":"F51616AE-EB96-2778-824F-386DEAFFD2F9","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"D6938BD3-6346-F62B-8B19-5207B2E5A6AF","modifiedFields":{"radiologist":"2015-10-28T07:31:21.091Z","result":"2015-10-28T07:31:21.091Z","notes":"2015-10-28T07:31:21.091Z","status":"2015-10-28T07:33:17.868Z","requestedBy":"2015-10-28T07:31:21.091Z","requestedDate":"2015-10-28T07:31:21.091Z","imagingDate":"2015-10-28T07:33:17.868Z"},"charges":[]},"_revisions":{"start":2,"ids":["69b11e7856d8b0fc3bd62debbfca3e55","222ad15ae5eed89c6d8abe1c9e07c145"]}},{"_id":"imaging_2_EA6B989C-90B7-2E08-9D8F-CE4339BB9B4B","_rev":"2-63da6e42fb59a811a5468e32bda0eb76","data":{"imagingDate":"2015-10-28T07:33:05.759Z","notes":"hbjn","radiologist":"cgvhbn","requestedBy":"hradmin","requestedDate":"2015-10-28T07:27:44.346Z","result":"fcghvj","status":"Completed","lastModified":"2015-10-28T07:33:05.759Z","modifiedBy":"hradmin","imagingType":"C8826ADA-C3AC-37CD-84AE-FA86A203AC6E","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"74A4EF68-5D8D-BDF6-940F-33E50E50DDEA","modifiedFields":{"radiologist":"2015-10-28T07:27:44.514Z","result":"2015-10-28T07:27:44.514Z","notes":"2015-10-28T07:27:44.514Z","status":"2015-10-28T07:33:05.759Z","requestedBy":"2015-10-28T07:27:44.514Z","requestedDate":"2015-10-28T07:27:44.514Z","imagingDate":"2015-10-28T07:33:05.759Z"},"charges":[]},"_revisions":{"start":2,"ids":["63da6e42fb59a811a5468e32bda0eb76","51a7194f0c4b6b172b5d0b059285e118"]}},{"_id":"invLocation_2_B7B86EC1-6CCE-30B7-B4ED-FF2061879E03","_rev":"3-28a915c1093e6e8497c2742a4806f926","data":{"quantity":950,"location":null,"aisleLocation":null,"lastModified":"2015-10-30T12:44:28.530Z","modifiedBy":"hradmin","modifiedFields":{"quantity":"2015-10-30T12:44:28.530Z"}},"_revisions":{"start":3,"ids":["28a915c1093e6e8497c2742a4806f926","6b49176eeeafb82a88a10aa5d954d965","e7ffcb12925c148d50279cc2ee012d25"]}},{"_id":"invPurchase_2_CDC3AB7D-A0AD-E146-87A4-FDB1096C2EEC","_rev":"2-4f1115c8c7b03b0bf06059d01e5ff7bd","data":{"purchaseCost":4000,"lotNumber":null,"dateReceived":"2015-10-28T22:00:00.000Z","originalQuantity":1000,"currentQuantity":950,"expirationDate":null,"expired":false,"location":null,"aisleLocation":null,"giftInKind":false,"inventoryItem":"igbmk5zf_is","vendor":"Alpha Pharmacy","vendorItemNo":null,"distributionUnit":null,"invoiceNo":null,"lastModified":"2015-10-30T12:44:28.533Z","modifiedBy":"hradmin","modifiedFields":{"dateReceived":"2015-10-29T02:44:10.493Z","purchaseCost":"2015-10-29T02:44:10.493Z","vendor":"2015-10-29T02:44:10.493Z","originalQuantity":"2015-10-29T02:44:10.493Z","currentQuantity":"2015-10-30T12:44:28.533Z","inventoryItem":"2015-10-29T02:44:10.493Z"}},"_revisions":{"start":2,"ids":["4f1115c8c7b03b0bf06059d01e5ff7bd","d0a2104fa76a4161da3f527b23a6d61a"]}},{"_id":"invRequest_2_4691AB2D-AEF3-1AA8-A11E-790BA5788239","_rev":"2-cf9eeeed6d9004aa0479660df622e08c","data":{"adjustPurchases":true,"completedBy":"hradmin","costPerUnit":4,"dateCompleted":"2015-10-29T22:00:00.000Z","dateRequested":"2015-10-29T08:35:51.495Z","deliveryAisle":"C100","deliveryLocation":"Harare","expenseAccount":"Accounts","markAsConsumed":true,"quantity":50,"quantityAtCompletion":1000,"reason":null,"requestedBy":"hradmin","status":"Completed","transactionType":"Fulfillment","lastModified":"2015-10-30T12:44:28.623Z","modifiedBy":"hradmin","inventoryItem":"igbmk5zf_is","patient":null,"visit":null,"locationsAffected":[{"name":"No Location","quantity":50}],"purchasesAffected":[{"id":"CDC3AB7D-A0AD-E146-87A4-FDB1096C2EEC","quantity":50}],"modifiedFields":{"transactionType":"2015-10-30T12:44:28.623Z","quantity":"2015-10-29T08:35:51.497Z","deliveryLocation":"2015-10-29T08:35:51.497Z","deliveryAisle":"2015-10-29T08:35:51.497Z","expenseAccount":"2015-10-29T08:35:51.497Z","dateRequested":"2015-10-29T08:35:51.497Z","requestedBy":"2015-10-29T08:35:51.497Z","status":"2015-10-30T12:44:28.623Z","dateCompleted":"2015-10-30T12:44:28.623Z","adjustPurchases":"2015-10-30T12:44:28.623Z","costPerUnit":"2015-10-30T12:44:28.623Z","quantityAtCompletion":"2015-10-30T12:44:28.623Z","purchasesAffected":"2015-10-30T12:44:28.623Z","locationsAffected":"2015-10-30T12:44:28.623Z","completedBy":"2015-10-30T12:44:28.623Z"}},"_revisions":{"start":2,"ids":["cf9eeeed6d9004aa0479660df622e08c","0e093fbeafc9c59eaeaaf0739ad56e13"]}},{"_id":"inventory_2_igbmk5zf_is","_rev":"2-586df5949f0c9046947fae0fcf009b6f","data":{"description":"Biogesic nga medisina","friendlyId":"m00001","name":"Biogesic","quantity":950,"crossReference":"2600","inventoryType":"Medication","price":5,"reorderPoint":100,"distributionUnit":"tablet","lastModified":"2015-10-30T12:44:28.620Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-29T02:44:10.610Z","inventoryType":"2015-10-29T02:44:10.610Z","crossReference":"2015-10-29T02:44:10.610Z","description":"2015-10-29T02:44:10.610Z","reorderPoint":"2015-10-29T02:44:10.610Z","price":"2015-10-29T02:44:10.610Z","distributionUnit":"2015-10-29T02:44:10.610Z","quantity":"2015-10-30T12:44:28.620Z","friendlyId":"2015-10-29T02:44:10.610Z"},"purchases":["CDC3AB7D-A0AD-E146-87A4-FDB1096C2EEC"],"locations":["B7B86EC1-6CCE-30B7-B4ED-FF2061879E03"]},"_revisions":{"start":2,"ids":["586df5949f0c9046947fae0fcf009b6f","26fffdb13350d70c54f01078f7ea7058"]}},{"_id":"lab_2_8F1C615D-8E59-5090-BC4A-BFA41C57FABE","_rev":"1-5cc96eeacaa8118793770bd5a80f0b4f","data":{"labDate":null,"notes":"Dr ordered another test","requestedBy":"hradmin","requestedDate":"2015-11-03T14:39:16.608Z","result":"Everything is clear","status":"Requested","lastModified":"2015-11-03T14:39:16.920Z","modifiedBy":"hradmin","labType":"5AB262C7-719D-19A6-ADC8-06CBA3088FA8","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"EC9C09F9-676F-AD32-AB61-DDAD615F2632","modifiedFields":{"result":"2015-11-03T14:39:16.920Z","notes":"2015-11-03T14:39:16.920Z","status":"2015-11-03T14:39:16.920Z","requestedBy":"2015-11-03T14:39:16.920Z","requestedDate":"2015-11-03T14:39:16.920Z"},"charges":[]}},{"_id":"lookup_2_aisle_location_list","_rev":"1-7257ef0f361f763b2692f692dab6bb7c","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["C100"]}},{"_id":"lookup_2_expense_account_list","_rev":"1-bb8267ec5987084be9890734e55df7e0","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Accounts"]}},{"_id":"lookup_2_physician_list","_rev":"1-539fb71896153ad54253f5eb86f508cd","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Dr Test"]}},{"_id":"lookup_2_radiologists","_rev":"6-38c1cbc8559ef893d7ebd043e93ce427","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Mr Test","b","cgvhbn","fcgvb","ss","zinyando"]},"_revisions":{"start":6,"ids":["38c1cbc8559ef893d7ebd043e93ce427","515694dee3f8a35894f6287347485e40","10ef5b07a7d56f64ac26e84507484d41","33cff401403de9c1efd0a9edbec7e50b","cb3dd07e07a6fa2f9e9323b7e15c48fd","864e65b754e2ec13fe2eb8c452bce282"]}}]}\n{"seq":74}\n{"docs":[{"_id":"lookup_2_sex","_rev":"1-c433c64d3ecf2a60e4539b1d1dc43d27","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Male"]}},{"_id":"lookup_2_vendor_list","_rev":"1-3b1a6a2565242e3db9cbdb6c579de2af","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Alpha Pharmacy"]}},{"_id":"lookup_2_visit_location_list","_rev":"1-578a5af6fd231a89f2fdeb1baae7036c","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Harare"]}},{"_id":"lookup_2_warehouse_list","_rev":"1-578a5af6fd231a89f2fdeb1baae7036c","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Harare"]}},{"_id":"patient_2_19A03BBC-71F3-9F39-8B18-15773F446731","_rev":"3-c021a07297d99585de08b3fd96719914","_deleted":true,"_revisions":{"start":3,"ids":["c021a07297d99585de08b3fd96719914","a7323c9135948b4689f52c01826affe2","6ed64fbe474b36dac7c8ac071e33786d"]}},{"_id":"patient_2_2D1BEC2C-EA03-E737-9EC9-D2AEAF2C9EE6","_rev":"2-a587941fb557366a6b87122548a9ba0c","_deleted":true,"_revisions":{"start":2,"ids":["a587941fb557366a6b87122548a9ba0c","0048675586c8e2fd24c8cc2edc545769"]}},{"_id":"patient_2_3C01C5E5-7E64-B147-88F9-D127903B31D7","_rev":"4-be8dd294f8df42bcf220e1a4372340fd","_deleted":true,"_revisions":{"start":4,"ids":["be8dd294f8df42bcf220e1a4372340fd","74d74986cffc330788b0fc5e47f40788","1ed40ad430dba87ec4c0773779fac6aa","34e84dc96007fc737d932ebf875ce340"]}},{"_id":"patient_2_423A476C-2012-6339-8FED-D2E404037268","_rev":"4-263b75936a4ead5058dc1e17535c536c","_deleted":true,"_revisions":{"start":4,"ids":["263b75936a4ead5058dc1e17535c536c","12c22dbd6548922b326bd28b2f05ddb0","a4a9b0e7ed53aea140c1d3259c9b1e94","15ebcd46a46d830899afc17450d4b229"]}},{"_id":"patient_2_519E056C-BF04-2A3F-84D2-8963EAD04261","_rev":"2-13e0330c4610ea3dc8a8dcb64a9b61ae","_deleted":true,"_revisions":{"start":2,"ids":["13e0330c4610ea3dc8a8dcb64a9b61ae","193c2c5d9fcb17698411febac4015547"]}},{"_id":"patient_2_5DD90350-3A67-F3B7-BB4A-A6837A667697","_rev":"2-812e681275f7181b96e1428d5b2eb555","_deleted":true,"_revisions":{"start":2,"ids":["812e681275f7181b96e1428d5b2eb555","a9b1e632e8d3f96d106873396f7f04de"]}},{"_id":"patient_2_63165A06-C866-A0C2-BB43-5DE9A0146737","_rev":"2-5989c5e25baace8df71d475ae164bf40","_deleted":true,"_revisions":{"start":2,"ids":["5989c5e25baace8df71d475ae164bf40","4178d1d23fb9d40a647d573026480dad"]}},{"_id":"patient_2_632DBDA3-5DBF-DDCC-A2C6-915E357319BA","_rev":"2-6ce428f8cdb8d1ea864f976c1ade08e4","_deleted":true,"_revisions":{"start":2,"ids":["6ce428f8cdb8d1ea864f976c1ade08e4","abe897a1411af9ce5df82d2ddbe726f2"]}},{"_id":"patient_2_688E30F1-E068-A2E3-8986-C224AF671CDD","_rev":"2-cb950343c60eb7116359fb50dc58fb87","_deleted":true,"_revisions":{"start":2,"ids":["cb950343c60eb7116359fb50dc58fb87","949f54bb01a90f17a91a7b392aecd58e"]}},{"_id":"patient_2_694DF805-F7CD-9513-9EF5-4CF8EE009BE9","_rev":"2-005d256252779d14fb83b9614a75d84f","_deleted":true,"_revisions":{"start":2,"ids":["005d256252779d14fb83b9614a75d84f","79cbdb6ba8075de8b19b61f4ebd194b2"]}},{"_id":"patient_2_9C269C48-EE3E-FBEC-9371-A235EEFDA40E","_rev":"2-6d94af1fdf669e3d012e3370c17c7d0f","_deleted":true,"_revisions":{"start":2,"ids":["6d94af1fdf669e3d012e3370c17c7d0f","ba40f943d16f3594cdf2a1c0e7ce36eb"]}},{"_id":"patient_2_9ED02049-6F10-E89D-9BAA-9C113B3AA6E4","_rev":"2-472c94a0e9c78fde3be4c15a71e0f336","_deleted":true,"_revisions":{"start":2,"ids":["472c94a0e9c78fde3be4c15a71e0f336","c61b0ba276e4c88cfda15ae4b5d0768b"]}},{"_id":"patient_2_B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","_rev":"4-8c8179f150da9a8bb43bfd246f16f33b","data":{"admitted":true,"address":null,"address2":null,"address3":null,"address4":null,"bloodType":null,"clinic":null,"country":null,"dateOfBirth":null,"economicClassification":null,"email":null,"externalPatientId":null,"familySupport1":null,"familySupport2":null,"familySupport3":null,"familySupport4":null,"familySupport5":null,"friendlyId":"P00017","firstName":"Lennex","sex":"Male","history":null,"insurance":null,"lastName":"Zinyando","livingArrangement":null,"middleName":"","notes":null,"otherIncome":null,"patientType":null,"parent":null,"phone":null,"placeOfBirth":null,"referredDate":null,"referredBy":null,"religion":null,"socialActionTaken":null,"socialRecommendation":null,"status":null,"lastModified":"2016-02-22T22:02:54.249Z","modifiedBy":"Admin User","paymentProfile":null,"payments":[],"modifiedFields":{"friendlyId":"2015-10-06T10:56:52.507Z","firstName":"2015-10-06T10:56:52.507Z","middleName":"2015-10-06T10:56:52.507Z","lastName":"2015-10-06T10:56:52.507Z","admitted":"2015-11-03T07:08:13.749Z","sex":"2016-02-22T22:02:54.249Z"}},"_revisions":{"start":4,"ids":["8c8179f150da9a8bb43bfd246f16f33b","020fe2a48d4cbfcb78ce17b8dca2808a","09ad83b2ef8b869ecc41360ccee87e05","e5548781a44e741ceac358e5e3413d76"]}},{"_id":"patient_2_BB4E9598-BD8B-528B-9D9E-AD9C3980787B","_rev":"3-957a69aebfae063d61ee8aaa55006803","_deleted":true,"_revisions":{"start":3,"ids":["957a69aebfae063d61ee8aaa55006803","0345093ba84e9c117c7dbb94b45edb8f","3e24d132e3bcc29db9d41a4d9f4296bf"]}},{"_id":"patient_2_C0361670-8B10-F212-9F51-B889D5BF92DF","_rev":"2-7b2217e2c2cb01610c32e0de44910282","_deleted":true,"_revisions":{"start":2,"ids":["7b2217e2c2cb01610c32e0de44910282","13ecb169a07f0e5a78a11209c26ede78"]}},{"_id":"patient_2_C680710A-BFBB-2868-8E5E-F4DD648CA24E","_rev":"2-d9acde506f230ec53a1cff9c97fe58bf","_deleted":true,"_revisions":{"start":2,"ids":["d9acde506f230ec53a1cff9c97fe58bf","9d954090afc2085fb97060446f8e4da0"]}},{"_id":"patient_2_E011AC5D-6F55-A16E-AB47-148E418071EE","_rev":"2-c263c9e9cf93e6d7b98f445b0d800809","_deleted":true,"_revisions":{"start":2,"ids":["c263c9e9cf93e6d7b98f445b0d800809","66c46fd3db8b057d58a35aba6ca99a5a"]}},{"_id":"patient_2_E54A8685-A36F-D1D1-B938-080545EABD0E","_rev":"2-a53992302cf7a33bad522d2dc5835b6e","_deleted":true,"_revisions":{"start":2,"ids":["a53992302cf7a33bad522d2dc5835b6e","5cebaf4e3ffef745a70ef22a1be1f0e8"]}},{"_id":"patient_2_E5EF1B7A-51B7-1610-BFBA-B1B21365C574","_rev":"2-182384c7dc0a26973583a692bfecbce8","_deleted":true,"_revisions":{"start":2,"ids":["182384c7dc0a26973583a692bfecbce8","497eb6ebf5074eeb32e2c02aab754a18"]}},{"_id":"patient_2_F3AA5446-1DE5-AC50-B9CF-B0D491E1D45E","_rev":"2-036325f33884580d2785dadf44527e25","_deleted":true,"_revisions":{"start":2,"ids":["036325f33884580d2785dadf44527e25","9eb866d5ca50209aec98d96470acce98"]}},{"_id":"photo_2_CF5189F1-5BDA-6896-B350-6A1A9B6A217B","_rev":"3-82a9b8e6b9f827259083f9bc560d9ee6","_deleted":true,"_revisions":{"start":3,"ids":["82a9b8e6b9f827259083f9bc560d9ee6","ee9b1e0283b24f4a02b00f92ed70f0ab","5ee18d0589c4ac578fe4e8a5350f725b"]}},{"_id":"photo_2_D2B805B1-8F22-B5D2-956B-AFF6372D18FF","_rev":"3-734e1f5956d3d438f8ba6e187aa4d97f","_deleted":true,"_revisions":{"start":3,"ids":["734e1f5956d3d438f8ba6e187aa4d97f","f574559c84a634ca88d1d10d41c93953","112ad019aa78ef8e06584c9109a9a850"]}},{"_id":"pricing_2_22208FBE-9C6E-079D-A1E6-A562F9310FE5","_rev":"1-7f1b8398ae5dbed5782085efbfdf5ee8","data":{"category":"Imaging","expenseAccount":null,"name":"New","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-15T09:39:37.879Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-15T09:39:37.879Z","category":"2015-10-15T09:39:37.879Z","pricingType":"2015-10-15T09:39:37.879Z"},"pricingOverrides":[]}},{"_id":"pricing_2_4CEB69E7-B54A-9D45-B0EF-7643F0D48FA0","_rev":"1-866a210b1d9063493c97d580845fc13d","data":{"category":"Imaging","expenseAccount":null,"name":"New","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-15T10:37:57.867Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-15T10:37:57.867Z","category":"2015-10-15T10:37:57.867Z","pricingType":"2015-10-15T10:37:57.867Z"},"pricingOverrides":[]}},{"_id":"pricing_2_5AB262C7-719D-19A6-ADC8-06CBA3088FA8","_rev":"1-428c4aeffee433314c955d75e831332b","data":{"category":"Lab","expenseAccount":null,"name":"Chest","price":null,"pricingType":"Lab Procedure","lastModified":"2015-11-03T14:39:16.623Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-11-03T14:39:16.623Z","category":"2015-11-03T14:39:16.623Z","pricingType":"2015-11-03T14:39:16.623Z"},"pricingOverrides":[]}},{"_id":"pricing_2_B492AA26-22F2-52A9-93C7-17106A57A62E","_rev":"1-a03187de833a34d46302b5a740244353","data":{"category":"Imaging","expenseAccount":null,"name":"fghj","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-22T07:08:38.099Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-22T07:08:38.099Z","category":"2015-10-22T07:08:38.099Z","pricingType":"2015-10-22T07:08:38.099Z"},"pricingOverrides":[]}},{"_id":"pricing_2_C8826ADA-C3AC-37CD-84AE-FA86A203AC6E","_rev":"1-fcefadf7300a60430090a0b91df95cce","data":{"category":"Imaging","expenseAccount":null,"name":"dfghn","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-28T07:27:44.358Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-28T07:27:44.358Z","category":"2015-10-28T07:27:44.358Z","pricingType":"2015-10-28T07:27:44.358Z"},"pricingOverrides":[]}},{"_id":"pricing_2_CBB4C9D5-CE8C-2BB5-86F4-3FC16AE2E85D","_rev":"1-a34a6a2d89ae9d5cd57f532f8db1b02f","data":{"category":"Imaging","expenseAccount":null,"name":"hg","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-26T11:49:08.235Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-26T11:49:08.235Z","category":"2015-10-26T11:49:08.235Z","pricingType":"2015-10-26T11:49:08.235Z"},"pricingOverrides":[]}},{"_id":"pricing_2_E53305F3-BA40-B305-B2DC-0732C7AB0042","_rev":"1-5b2724a6d2dce84919a16388a8983a49","data":{"category":"Imaging","expenseAccount":null,"name":"Scan","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-28T07:23:34.851Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-28T07:23:34.851Z","category":"2015-10-28T07:23:34.851Z","pricingType":"2015-10-28T07:23:34.851Z"},"pricingOverrides":[]}},{"_id":"pricing_2_F51616AE-EB96-2778-824F-386DEAFFD2F9","_rev":"1-13d626d1730a99b3da4dee1a25146ddd","data":{"category":"Imaging","expenseAccount":null,"name":"sss","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-28T07:31:20.903Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-28T07:31:20.903Z","category":"2015-10-28T07:31:20.903Z","pricingType":"2015-10-28T07:31:20.903Z"},"pricingOverrides":[]}},{"_id":"sequence_2_inventory_Medication","_rev":"1-1acccea88a50973cbe8840a31911aa7c","data":{"prefix":"m","value":1}},{"_id":"sequence_2_patient","_rev":"130-943328c138b701637a579574f516e90b","data":{"prefix":null,"value":130},"_revisions":{"start":130,"ids":["943328c138b701637a579574f516e90b","b527a87cb4f86205dcc62a9ea0fa7a63","973262d1b9be91e82f997cf103481c55","44582fef141bcd8b558595514d3ba0ff","4a8d8f8ca25aa960aef16e5c1e489b81","2a48a9bc803b0d60b5018c07017aedeb","fe6186b5bd38fce211c0dc76ef4a619b","4d41059d2cd8accf225fce92edbbc428","449ad29c390c73126670290e2a351dce","ef33fac6f75c92df977deadcefd2ea21","bde0d0a9a34c662a05458f1d379c6038","4e2b60d439b5001f0562aaa5e836de72","9b7cf30a3a428b0ffbc5c08469b60dc4","fdfa70107c954a955eddc00f1710a412","acb0081b558f7dfc06520ce59abdca9d","b611e8c2f6823f040262e4e983aa8b3e","803c06167d785dca413153687432b9da","e2c71646996df37f91cabb3881395db4","e07b6a9914e89ef9b68e6412801e47db","5c4e63e3ec27823d46d7048c34f1035c","85c90147d202a4eb1a047e2633fdc911","e7dae8e43e473a4b347f5c22161844b4","471182bdd694919456395e3b8ee81d85","c45ce9b872e266344359c0637f9dd5d0","962ad8bf64b30813c4fef6958e83e3f3","5b281c4ea003d026419d35d05dd0b87a","9ed77096845040620cd2354c1ed74001","409143da04d5575669e515f6214f6220","c35ff5c786890aa0005b360749cefdd2","48cba21a512868f2c8e3beb5646ff1c1","58fcaf249567f43db62a1c77a1440b8e","71c619fe66ac2a2246708c6733e7af9e","0e2a21c17d44457443a58dd2db6824fb","7449d0f1ba104902ca08b888dfdc546f","20f7d87b7b4a5326bb93f84c11ae627d","bef379849a35ec5a7408f26a83026e2b","5dd124839c582c23e9279eda6f821796","15a041f1e149ae2989eba580b93969b0","93e7694e1741666512f83bd1bd5064f3","002edd9949b2993af6ce18817d0bc666","a8795752b4a5c9e587d5bbbd05ef41d4","c6f60912813f86724b49110221b713fe","728c2adfea6754b048f7acae42edd25f","b1ddbe8c27e77a561d22fec546349409","923830cdb237b3ba2088779642bca716","85f7e7891658b988333439ee84dfcd39","a52f2c92c951c2c7266a9ad170d3ae9d","79cfca9fdd7b6cdae2396862f103599e","87221151cfb4cb5bbdf73eb694a7eb34","f1c5faf2bc8f82ec5a29071b6156e5e2","84612c5298273469c586955ee8427555","cc81c865b33cf6d967bde9ff60b9af6d","8b16de2d23b9c7e216215085a08caea8","8be1c3c951d7c2355f910f785cac2534","696488469a9aa721643875029f6de938","04ffb420af095d229c45a69d0e1c56c2","f8fc0538d0eacb22a767c9eb449f4c84","6adb4264d4dd3b13829ffc7e17ba58c2","f50856bf682db17eee3d3cafb366a6be","743e61dcfce262c16251ed396ee76eb7","4fcdf09a763ec5da89d41dab6dd9edc8","912874972749c40ea838145828c14173","fd8c5a0d7662b27c8cbdfbfdd45ee32d","173fe5c207973de53fd984078bbd73a2","4e9ef14c62f9312cd0fb1b47e7fabe1e","ce6f1f9584656970cfd92f1e361e2fed","cf8cf83cf02c266b75af0bc69467a07f","5816c2ba418d387facd7b6ed0a0e6054","b3839c763f128f2ccf99cfb874a2413e","68b05605500c0109d046a56680a5a7a1","a13d320fed2c85ed0b173d6645ec0274","ba1dad02a90e4ac18632c1a53a90b759","c5e7e81e97d0fc7d0797bd9822685176","b580fcf4f4291b408f4dda64a4bdec96","bb1a562af157e3c24d23c3e2f1171b29","e9f245d9566dd9e116caf7d074792d36","30b587f2b5204d237572c86a545756fb","7df53a1742b52647118fec21f331e94d","0a4c120f78fa5899d0cea5d87d92c9b0","e62f1b02721a75fd1ea290da9acdc199","3e39b429ea4cda00c9ac9d3f0b61029c","038d82911c8979c0cd58e807871a09ca","618d916a14cfa55aa8e65d42b3761ca5","8d24a6b355e64a680f0f03ab0f738b8c","999e1fa6e5175dad02e4f2db0cd41843","782e7a1c4097f1aa1d117a7fbd01c443","67b3c03ea8609652c494a22242ce5a1f","3b1fc1b83a352ef9c672110a69306064","8a0da1966531daede44592906bf8df99","279e844131c96ca7b647cacfa3508022","42733f5f658de7ee440c02286fd4e21c","e3a50044a3cb2ac901b5b65653d0fc7f","b7fb5627bee7f642f8e608be1bb1e859","2fdb16832a0ed61b7f9e780750b70898","e38f4adbab987a8c628599ea9052ca44","7ece3f9fcff7b57b28f1237ba1107a0f","8fb6c171e3c6a345d199a8884e42951a","c76709145ca58dfcf67c1f397b772689","76182e657f0b0aa6fa07bf5491d2b427","ab161b88c332f3df338f1f4aa2b2e307","e00a3184b07c0459cf4ebdeb825f991f","cee6a3aac677927abaf3ae61508954a2","86bed2b62e1e6b6f98790ecafefcc17f","ae44899fdbc41d69076ec6a8f7563181","61cce97f5cd6ff092f28fe9ec9da4f27","f9008b952322c32322ef0e7e42fdf383","8fdecd159563a90d7cbc9c9aedc3068f","9b1f0f8f0e4db1f8931d290966f3bc3c","a9b5402ea07343a1b6d5612312e07a34","25ef3d2573778c3ebda4ef7860fe310f","3e39e8d6ceabb2079042e81613858906","b4e15c555737aa9573724407ce84b667","b2538362e8afb57e3e11e5231ae60d5d","04add3d3926f54232b0e0ed7a9fc141a","e924dcf4bb51c7c552538273e08901bb","77b6f226033c656d3a9768085ff3e80a","676dd4835b46e8f62ec2ce5908d1c60a","762481b2c71611cce80a5a9ef03aa48d","b9b73bf1d2df1598cc164089375ed7bc","0a581f677e6d8f7a484fa0a80156d95b","6b51cfdb83336973df284e4d5c2f308b","4a27247e93fabb86b6a5a9676f47ec8e","8b542908965798dd683a68f507635a83","515d8987a1e11acb866ede87612b53b1","d19e3759adc65398cf6a42a61345cdae","ac63c129bee25dc4c59a639e2721fb81","17c1209032c06df436ad0a4fa76723cc","f0ef6923c78e739d9228517a4813b646","f9a8fd6c55cd4e5fb0064b7767586e05","5bc31ffefa482f2e66299cf0704623c8"]}},{"_id":"visit_2_0312A352-EF8B-C1A2-B9DF-3EC932C96AD8","_rev":"2-8eb7818cb7b808ea467b2e60f0a6a5e2","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Discharged","visitType":"Admission","lastModified":"2015-11-03T07:43:21.662Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:31:15.853Z","startDate":"2015-11-03T07:31:15.853Z","status":"2015-11-03T07:43:21.662Z","outPatient":"2015-11-03T07:31:15.853Z","endDate":"2015-11-03T07:43:21.662Z","location":"2015-11-03T07:31:15.853Z","examiner":"2015-11-03T07:31:15.853Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["8eb7818cb7b808ea467b2e60f0a6a5e2","3036466a87ec0a9967be1433386b0bdc"]}},{"_id":"visit_2_07AF1E0E-3CB2-3837-990C-968158E25235","_rev":"1-ce894ba889d506531e4cb2a36394cab4","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:46:16.594Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:46:16.594Z","startDate":"2015-11-03T07:46:16.594Z","status":"2015-11-03T07:46:16.594Z","outPatient":"2015-11-03T07:46:16.594Z","endDate":"2015-11-03T07:46:16.594Z","location":"2015-11-03T07:46:16.594Z","examiner":"2015-11-03T07:46:16.594Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_0B84AF59-A182-5840-9E7A-CEF7633D4071","_rev":"1-ce3b40be34d77ec1d9c29ccb99a7e905","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:37:46.164Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:37:46.164Z","startDate":"2015-11-03T07:37:46.164Z","status":"2015-11-03T07:37:46.164Z","outPatient":"2015-11-03T07:37:46.164Z","endDate":"2015-11-03T07:37:46.164Z","location":"2015-11-03T07:37:46.164Z","examiner":"2015-11-03T07:37:46.164Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_0BD42BD9-0E5D-0533-A8FA-1C0ADB0F0D65","_rev":"2-0ddd43cbcc57cc5d6ff082a283d881ac","data":{"dischargeInfo":null,"endDate":"2015-10-15T10:37:57.902Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-15T10:37:57.902Z","status":null,"visitType":"Imaging","lastModified":"2015-10-15T10:37:57.915Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-15T10:37:57.915Z","endDate":"2015-10-15T10:37:57.915Z","outPatient":"2015-10-15T10:37:57.915Z","visitType":"2015-10-15T10:37:57.915Z"},"charges":[],"imaging":["1AC1DD3D-E7E7-15B4-A698-8A8AE62749EB"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["0ddd43cbcc57cc5d6ff082a283d881ac","e4540f9cf2a236335662116d4e0a66da"]}},{"_id":"visit_2_13340816-9F02-846D-85C3-C3278561BA23","_rev":"1-6ce02a99e4868c5a5bdb88a23f9ff400","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:24:20.451Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:24:20.451Z","startDate":"2015-11-03T07:24:20.451Z","status":"2015-11-03T07:24:20.451Z","outPatient":"2015-11-03T07:24:20.451Z","endDate":"2015-11-03T07:24:20.451Z","location":"2015-11-03T07:24:20.451Z","examiner":"2015-11-03T07:24:20.451Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_15759FA2-6691-6EF3-9636-21570F400F04","_rev":"1-d28274492b5b3cd306c3d38e535388a7","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:38:17.049Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:38:17.049Z","startDate":"2015-11-03T07:38:17.049Z","status":"2015-11-03T07:38:17.049Z","outPatient":"2015-11-03T07:38:17.049Z","endDate":"2015-11-03T07:38:17.049Z","location":"2015-11-03T07:38:17.049Z","examiner":"2015-11-03T07:38:17.049Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_17AB2BCF-5F9F-30FB-8B80-9FB82E51D0B3","_rev":"1-bc13c64ebb47144840cc91ce3087ebd6","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:23:03.461Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:23:03.461Z","startDate":"2015-11-03T07:23:03.461Z","status":"2015-11-03T07:23:03.461Z","outPatient":"2015-11-03T07:23:03.461Z","endDate":"2015-11-03T07:23:03.461Z","location":"2015-11-03T07:23:03.461Z","examiner":"2015-11-03T07:23:03.461Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_1800A65C-861C-CCA5-85C5-16950322C7E0","_rev":"1-a67e8d8a018844ef176184947055b683","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:40:08.177Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:40:08.177Z","startDate":"2015-11-03T07:40:08.177Z","status":"2015-11-03T07:40:08.177Z","outPatient":"2015-11-03T07:40:08.177Z","endDate":"2015-11-03T07:40:08.177Z","location":"2015-11-03T07:40:08.177Z","examiner":"2015-11-03T07:40:08.177Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_1EBA7E42-F96D-C5E2-923C-2F842FDFE714","_rev":"1-8fd6cfa23288f7394ce94970c4b3a8c2","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:19:45.676Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:19:45.676Z","startDate":"2015-11-03T07:19:45.676Z","status":"2015-11-03T07:19:45.676Z","outPatient":"2015-11-03T07:19:45.676Z","endDate":"2015-11-03T07:19:45.676Z","location":"2015-11-03T07:19:45.676Z","examiner":"2015-11-03T07:19:45.676Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_2D795EA3-DAEF-AA15-8846-607A873AD1AF","_rev":"1-4c665c9221069fe72f9d66ac458e92df","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:28:51.490Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:28:51.490Z","startDate":"2015-11-03T07:28:51.490Z","status":"2015-11-03T07:28:51.490Z","outPatient":"2015-11-03T07:28:51.490Z","endDate":"2015-11-03T07:28:51.490Z","location":"2015-11-03T07:28:51.490Z","examiner":"2015-11-03T07:28:51.490Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_377AA288-AAD4-F60B-ABD1-B5A0B9C75D50","_rev":"2-ee5b0686e20e1011d11b3051b93e7a93","data":{"dischargeInfo":null,"endDate":"2015-10-15T09:39:37.940Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-15T09:39:37.940Z","status":null,"visitType":"Imaging","lastModified":"2015-10-15T09:39:37.948Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-15T09:39:37.948Z","endDate":"2015-10-15T09:39:37.948Z","outPatient":"2015-10-15T09:39:37.948Z","visitType":"2015-10-15T09:39:37.948Z"},"charges":[],"imaging":["07CC6746-C7D9-A410-9B8C-C4B4E095A96D"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["ee5b0686e20e1011d11b3051b93e7a93","5fee255cf57220ddf1c19977118a540e"]}},{"_id":"visit_2_3A8FE46D-2CE6-C74E-98BB-ECFECB8F4AB9","_rev":"1-4c2559b35790501b6fae26a031a59cad","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:42:11.759Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:42:11.759Z","startDate":"2015-11-03T07:42:11.759Z","status":"2015-11-03T07:42:11.759Z","outPatient":"2015-11-03T07:42:11.759Z","endDate":"2015-11-03T07:42:11.759Z","location":"2015-11-03T07:42:11.759Z","examiner":"2015-11-03T07:42:11.759Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_50FD1C68-0889-0867-99D1-CFFDB3223154","_rev":"1-85d776e0088793e80073525cf6b7a501","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:47:59.399Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:47:59.399Z","startDate":"2015-11-03T07:47:59.399Z","status":"2015-11-03T07:47:59.399Z","outPatient":"2015-11-03T07:47:59.399Z","endDate":"2015-11-03T07:47:59.399Z","location":"2015-11-03T07:47:59.399Z","examiner":"2015-11-03T07:47:59.399Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_53E986EB-4C23-9B3B-B8D7-2C7A7ECDBC33","_rev":"1-fb5ce8d11793c3da21e06d1f88e48d00","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:23:24.134Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:23:24.134Z","startDate":"2015-11-03T07:23:24.134Z","status":"2015-11-03T07:23:24.134Z","outPatient":"2015-11-03T07:23:24.134Z","endDate":"2015-11-03T07:23:24.134Z","location":"2015-11-03T07:23:24.134Z","examiner":"2015-11-03T07:23:24.134Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}}]}\n{"seq":124}\n{"docs":[{"_id":"visit_2_542BB0F0-27BB-7C5C-99BC-28B013DDB837","_rev":"1-6e3af7515e9b2d7fbcec6264b9194a17","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:32:40.937Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:32:40.937Z","startDate":"2015-11-03T07:32:40.937Z","status":"2015-11-03T07:32:40.937Z","outPatient":"2015-11-03T07:32:40.937Z","endDate":"2015-11-03T07:32:40.937Z","location":"2015-11-03T07:32:40.937Z","examiner":"2015-11-03T07:32:40.937Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_560E25D9-9736-BA05-B2A6-4555A93B2628","_rev":"2-04c2d6343f6d2a10ad1f891718cecab5","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:08:13.698Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:08:13.698Z","startDate":"2015-11-03T07:08:13.698Z","status":"2015-11-03T07:08:13.698Z","outPatient":"2015-11-03T07:08:13.698Z","endDate":"2015-11-03T07:08:13.698Z","location":"2015-11-03T07:08:13.698Z","examiner":"2015-11-03T07:08:13.698Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["04c2d6343f6d2a10ad1f891718cecab5","6bbe45974af0b60410ea29026a38e2ec"]}},{"_id":"visit_2_59F8FB60-9956-E93F-826D-11618BC95E13","_rev":"1-8489694a221cd2c43e7c39fdcaa89700","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:41:35.597Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:41:35.597Z","startDate":"2015-11-03T07:41:35.597Z","status":"2015-11-03T07:41:35.597Z","outPatient":"2015-11-03T07:41:35.597Z","endDate":"2015-11-03T07:41:35.597Z","location":"2015-11-03T07:41:35.597Z","examiner":"2015-11-03T07:41:35.597Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_5F404B11-D8B6-CE18-9557-2B563BCFD2F8","_rev":"1-2637dc1d6c95364743de0c97c7fb443d","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:34:38.929Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:34:38.929Z","startDate":"2015-11-03T07:34:38.929Z","status":"2015-11-03T07:34:38.929Z","outPatient":"2015-11-03T07:34:38.929Z","endDate":"2015-11-03T07:34:38.929Z","location":"2015-11-03T07:34:38.929Z","examiner":"2015-11-03T07:34:38.929Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_6AD00ED1-670A-2C3F-BC10-0742B1F99264","_rev":"2-9bf9856192b6c8ef34d2fcdb27296593","data":{"dischargeInfo":null,"endDate":"2015-10-28T07:39:18.257Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-28T07:39:18.257Z","status":null,"visitType":"Imaging","lastModified":"2015-10-28T07:39:18.275Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-28T07:39:18.275Z","endDate":"2015-10-28T07:39:18.275Z","outPatient":"2015-10-28T07:39:18.275Z","visitType":"2015-10-28T07:39:18.275Z"},"charges":[],"imaging":["91B061E9-2986-D539-90C8-CD14EC2010B0"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["9bf9856192b6c8ef34d2fcdb27296593","e50477b58f5edd257b9ce20ea65b1bca"]}},{"_id":"visit_2_6D126583-2852-25C2-A352-E5BA4CBBD106","_rev":"1-222d722266f5d407204eb411f68ab4f0","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:20:56.778Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:20:56.778Z","startDate":"2015-11-03T07:20:56.778Z","status":"2015-11-03T07:20:56.778Z","outPatient":"2015-11-03T07:20:56.778Z","endDate":"2015-11-03T07:20:56.778Z","location":"2015-11-03T07:20:56.778Z","examiner":"2015-11-03T07:20:56.778Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_74A4EF68-5D8D-BDF6-940F-33E50E50DDEA","_rev":"2-c24a52b04610b293fff293b18dd0bb15","data":{"dischargeInfo":null,"endDate":"2015-10-28T07:27:44.394Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-28T07:27:44.394Z","status":null,"visitType":"Imaging","lastModified":"2015-10-28T07:27:44.406Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-28T07:27:44.406Z","endDate":"2015-10-28T07:27:44.406Z","outPatient":"2015-10-28T07:27:44.406Z","visitType":"2015-10-28T07:27:44.406Z"},"charges":[],"imaging":["EA6B989C-90B7-2E08-9D8F-CE4339BB9B4B"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["c24a52b04610b293fff293b18dd0bb15","5a6ae8f033eb99448ad898f164d822e8"]}},{"_id":"visit_2_7916D533-54AE-55EB-8DE7-E4B83A4BBAB2","_rev":"1-269d23778ac6f89244ff93d17c73352c","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:46:45.358Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:46:45.358Z","startDate":"2015-11-03T07:46:45.358Z","status":"2015-11-03T07:46:45.358Z","outPatient":"2015-11-03T07:46:45.358Z","endDate":"2015-11-03T07:46:45.358Z","location":"2015-11-03T07:46:45.358Z","examiner":"2015-11-03T07:46:45.358Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_817CE5FB-FF79-B05D-8296-2FCE91B125CD","_rev":"1-410079742e88e59e0598107fd9ef40c1","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:33:16.393Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:33:16.393Z","startDate":"2015-11-03T07:33:16.393Z","status":"2015-11-03T07:33:16.393Z","outPatient":"2015-11-03T07:33:16.393Z","endDate":"2015-11-03T07:33:16.393Z","location":"2015-11-03T07:33:16.393Z","examiner":"2015-11-03T07:33:16.393Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_90FCADB8-7109-3906-94A3-269F29CFAB69","_rev":"1-7a8189c07dde6b9bf498545cdaa3e621","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:31:49.176Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:31:49.176Z","startDate":"2015-11-03T07:31:49.176Z","status":"2015-11-03T07:31:49.176Z","outPatient":"2015-11-03T07:31:49.176Z","endDate":"2015-11-03T07:31:49.176Z","location":"2015-11-03T07:31:49.176Z","examiner":"2015-11-03T07:31:49.176Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_9C962DF7-E239-966B-A47B-15F405899B62","_rev":"1-d5bc412bfa629333e6cd79c978ea8218","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:25:27.802Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:25:27.802Z","startDate":"2015-11-03T07:25:27.802Z","status":"2015-11-03T07:25:27.802Z","outPatient":"2015-11-03T07:25:27.802Z","endDate":"2015-11-03T07:25:27.802Z","location":"2015-11-03T07:25:27.802Z","examiner":"2015-11-03T07:25:27.802Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_9E627361-BA73-210A-8E76-2FA13B559DB9","_rev":"1-30a87dbc678b99d42b1a90bebff97834","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:21:48.053Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:21:48.053Z","startDate":"2015-11-03T07:21:48.053Z","status":"2015-11-03T07:21:48.053Z","outPatient":"2015-11-03T07:21:48.053Z","endDate":"2015-11-03T07:21:48.053Z","location":"2015-11-03T07:21:48.053Z","examiner":"2015-11-03T07:21:48.053Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_9F1A65ED-683F-056E-8D50-A8AF63201CE2","_rev":"2-e19734a8deff62722e6e023af4b8e130","data":{"dischargeInfo":null,"endDate":"2015-10-22T07:08:38.175Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-22T07:08:38.175Z","status":null,"visitType":"Imaging","lastModified":"2015-10-22T07:08:38.189Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-22T07:08:38.189Z","endDate":"2015-10-22T07:08:38.189Z","outPatient":"2015-10-22T07:08:38.189Z","visitType":"2015-10-22T07:08:38.189Z"},"charges":[],"imaging":["D0F299E4-CD8D-557D-8C23-216FD23EF844"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["e19734a8deff62722e6e023af4b8e130","bd81a41820526c8c0450ee544867c6fa"]}},{"_id":"visit_2_A6E37F8D-F740-8B01-93C9-D476A886E030","_rev":"1-d094eb56a680b4a8a6a354bd48d6bfe2","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:42:53.782Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:42:53.782Z","startDate":"2015-11-03T07:42:53.782Z","status":"2015-11-03T07:42:53.782Z","outPatient":"2015-11-03T07:42:53.782Z","endDate":"2015-11-03T07:42:53.782Z","location":"2015-11-03T07:42:53.782Z","examiner":"2015-11-03T07:42:53.782Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_AAB85ADA-7058-DF7A-9244-C6B60A2EF743","_rev":"1-1bd78b61646023aacce18b1efaa27646","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:39:09.272Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:39:09.272Z","startDate":"2015-11-03T07:39:09.272Z","status":"2015-11-03T07:39:09.272Z","outPatient":"2015-11-03T07:39:09.272Z","endDate":"2015-11-03T07:39:09.272Z","location":"2015-11-03T07:39:09.272Z","examiner":"2015-11-03T07:39:09.272Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_C15054D2-D062-DB01-A96D-80ED1B8F8CBD","_rev":"1-5a9a0e7eafe911586556666ad1a2bd27","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:46:09.735Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:46:09.735Z","startDate":"2015-11-03T07:46:09.735Z","status":"2015-11-03T07:46:09.735Z","outPatient":"2015-11-03T07:46:09.735Z","endDate":"2015-11-03T07:46:09.735Z","location":"2015-11-03T07:46:09.735Z","examiner":"2015-11-03T07:46:09.735Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_C5C296AC-E238-CBA5-8DD8-99942843BC5A","_rev":"2-57e6740d8dac593d790cd7f76c4ad0c3","data":{"dischargeInfo":null,"endDate":"2015-10-26T11:49:08.277Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-26T11:49:08.277Z","status":null,"visitType":"Imaging","lastModified":"2015-10-26T11:49:08.282Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-26T11:49:08.282Z","endDate":"2015-10-26T11:49:08.282Z","outPatient":"2015-10-26T11:49:08.282Z","visitType":"2015-10-26T11:49:08.282Z"},"charges":[],"imaging":["4A7FC838-0B37-E151-AFD8-8DBAC9DE9D99"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["57e6740d8dac593d790cd7f76c4ad0c3","253e8d9f8c0865cb3e9ffd1f6849bcde"]}},{"_id":"visit_2_CBFA5C2C-191D-FC9C-AD19-14D26D5A3003","_rev":"2-f781f118fd87b036d8cbfbf7771cda99","data":{"dischargeInfo":null,"endDate":"2015-10-28T07:23:34.906Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-28T07:23:34.906Z","status":null,"visitType":"Imaging","lastModified":"2015-10-28T07:23:34.914Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-28T07:23:34.914Z","endDate":"2015-10-28T07:23:34.914Z","outPatient":"2015-10-28T07:23:34.914Z","visitType":"2015-10-28T07:23:34.914Z"},"charges":[],"imaging":["51D8DC28-78EB-62B1-942A-1158F5862F34"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["f781f118fd87b036d8cbfbf7771cda99","e2b8bf1f76ea01c32b414c184905511e"]}},{"_id":"visit_2_D6938BD3-6346-F62B-8B19-5207B2E5A6AF","_rev":"2-631f62b5121ccfcd1a8de2bc9d3d252f","data":{"dischargeInfo":null,"endDate":"2015-10-28T07:31:20.941Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-28T07:31:20.941Z","status":null,"visitType":"Imaging","lastModified":"2015-10-28T07:31:20.953Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-28T07:31:20.953Z","endDate":"2015-10-28T07:31:20.953Z","outPatient":"2015-10-28T07:31:20.953Z","visitType":"2015-10-28T07:31:20.953Z"},"charges":[],"imaging":["DBE152F6-9508-2E12-81AC-39BC2CAFE08C"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["631f62b5121ccfcd1a8de2bc9d3d252f","8b46887d52e3043d742262fc03ff48b8"]}},{"_id":"visit_2_D845EA6E-C4CD-3657-A6F6-3E40FE02B069","_rev":"1-16657f6b4014bf268d63323ed8832a56","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:50:55.344Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:50:55.344Z","startDate":"2015-11-03T07:50:55.344Z","status":"2015-11-03T07:50:55.344Z","outPatient":"2015-11-03T07:50:55.344Z","endDate":"2015-11-03T07:50:55.344Z","location":"2015-11-03T07:50:55.344Z","examiner":"2015-11-03T07:50:55.344Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_DA661CAB-1BB5-3119-B9DD-0A92D7C3913B","_rev":"1-ecb23bc4c60a32dd627969637f85d1fb","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:19:15.689Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:19:15.689Z","startDate":"2015-11-03T07:19:15.689Z","status":"2015-11-03T07:19:15.689Z","outPatient":"2015-11-03T07:19:15.689Z","endDate":"2015-11-03T07:19:15.689Z","location":"2015-11-03T07:19:15.689Z","examiner":"2015-11-03T07:19:15.689Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_E66983BC-BFB9-E361-A59F-AAC966A0FD3B","_rev":"1-8d0f4af9593120f2dfd0371303239e2b","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:15:24.456Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:15:24.456Z","startDate":"2015-11-03T07:15:24.456Z","status":"2015-11-03T07:15:24.456Z","outPatient":"2015-11-03T07:15:24.456Z","endDate":"2015-11-03T07:15:24.456Z","location":"2015-11-03T07:15:24.456Z","examiner":"2015-11-03T07:15:24.456Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_E8E7BD06-13EB-AA68-BBE2-51B9EEE85257","_rev":"1-c54a6aea31c6c3805edc706b4ed64d40","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:30:31.501Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:30:31.501Z","startDate":"2015-11-03T07:30:31.501Z","status":"2015-11-03T07:30:31.501Z","outPatient":"2015-11-03T07:30:31.501Z","endDate":"2015-11-03T07:30:31.501Z","location":"2015-11-03T07:30:31.501Z","examiner":"2015-11-03T07:30:31.501Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_E90C9A07-74D2-0589-8DDC-C94B09E0F238","_rev":"1-7a3d4f0d4056960dabad849d1da9bd7c","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:22:15.702Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:22:15.702Z","startDate":"2015-11-03T07:22:15.702Z","status":"2015-11-03T07:22:15.702Z","outPatient":"2015-11-03T07:22:15.702Z","endDate":"2015-11-03T07:22:15.702Z","location":"2015-11-03T07:22:15.702Z","examiner":"2015-11-03T07:22:15.702Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_EC9C09F9-676F-AD32-AB61-DDAD615F2632","_rev":"2-8ce10f08748bebcd2df0267258ec2433","data":{"dischargeInfo":null,"endDate":"2015-11-03T14:39:16.671Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-03T14:39:16.671Z","status":null,"visitType":"Lab","lastModified":"2015-11-03T14:39:16.679Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-11-03T14:39:16.679Z","endDate":"2015-11-03T14:39:16.679Z","outPatient":"2015-11-03T14:39:16.679Z","visitType":"2015-11-03T14:39:16.679Z"},"charges":[],"imaging":[],"labs":["8F1C615D-8E59-5090-BC4A-BFA41C57FABE"],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["8ce10f08748bebcd2df0267258ec2433","4a113155a529e6200ba18813cd922ad0"]}},{"_id":"visit_2_EF0D793D-346D-242A-8F4D-589448DA49A6","_rev":"1-413ff66d683c532d2be4cfa04632343c","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:26:35.010Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:26:35.010Z","startDate":"2015-11-03T07:26:35.010Z","status":"2015-11-03T07:26:35.010Z","outPatient":"2015-11-03T07:26:35.010Z","endDate":"2015-11-03T07:26:35.010Z","location":"2015-11-03T07:26:35.010Z","examiner":"2015-11-03T07:26:35.010Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_F9D51E3F-E938-1F24-9B19-D76F03E56892","_rev":"1-9e4fb077c716ccd6b149953e4c005aae","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:17:22.667Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:17:22.667Z","startDate":"2015-11-03T07:17:22.667Z","status":"2015-11-03T07:17:22.667Z","outPatient":"2015-11-03T07:17:22.667Z","endDate":"2015-11-03T07:17:22.667Z","location":"2015-11-03T07:17:22.667Z","examiner":"2015-11-03T07:17:22.667Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}}]}\n{"seq":151}\n';});
define('hospitalrun/tests/fixtures/medication',['exports'],function(exports){exports['default'] = '{"version":"1.2.5","db_type":"http","start_time":"2017-03-16T14:44:55.032Z","db_info":{"db_name":"main","doc_count":108,"doc_del_count":21,"update_seq":153,"purge_seq":0,"compact_running":false,"disk_size":168040,"data_size":108660,"instance_start_time":"1489675410840475","disk_format_version":6,"committed_update_seq":153,"host":"http://localhost:5984/main/","auto_compaction":false,"adapter":"http"}}\n{"docs":[{"_id":"_design/custom_form_by_type","_rev":"1-ddf0ee75c1e8e859d821a9f5c1ec43b6","version":1,"views":{"custom_form_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'customForm\') {\\n        emit(doc.data.formType);\\n      }\\n    }\\n  }"}}}]}\n{"seq":4}\n{"docs":[{"_id":"_design/inventory_by_friendly_id","_rev":"1-82e24378f074a284cae14da4db5431ed","version":1,"views":{"inventory_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}}]}\n{"seq":6}\n{"docs":[{"_id":"_design/appointments_by_date","_rev":"1-03951858f9232df2e774548b0f5fd068","version":4,"views":{"appointments_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n      var i,\\n          filterBy = null,\\n          includeRow = true;\\n      if (req.query && req.query.filterBy) {\\n        filterBy = JSON.parse(req.query.filterBy);\\n      }\\n      if (!filterBy) {\\n        return true;\\n      }\\n      for (i = 0; i < filterBy.length; i++) {\\n        var currentValue = row.doc.data[filterBy[i].name];\\n        if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n          currentValue = \'Scheduled\';\\n        }\\n        if (currentValue !== filterBy[i].value) {\\n          includeRow = false;\\n          break;\\n        }\\n      }\\n      return includeRow;\\n    });rows.sort(function (a, b) {\\n      function defaultStatus(value) {\\n        if (!value || value === \'\') {\\n          return \'Scheduled\';\\n        } else {\\n          return value;\\n        }\\n      }\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'appointmentType\':\\n        case \'location\':\\n        case \'provider\':\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        case \'date\':\\n          {\\n            var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n            if (startDiff === 0) {\\n              return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n            } else {\\n              return startDiff;\\n            }\\n            break;\\n          }\\n        case \'status\':\\n          {\\n            var aStatus = defaultStatus(a.doc.data[sortBy]),\\n                bStatus = defaultStatus(b.doc.data[sortBy]);\\n            return compareStrings(aStatus, bStatus);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["03951858f9232df2e774548b0f5fd068"]}},{"_id":"_design/appointments_by_date","_rev":"1-178add045be11a7fd6aa7fdf97c8f3f0","version":6,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([startDate, endDate, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n      var filterBy = null;\\n      var includeRow = true;\\n      if (req.query && req.query.filterBy) {\\n        filterBy = JSON.parse(req.query.filterBy);\\n      }\\n      if (!filterBy) {\\n        return true;\\n      }\\n      for (var i = 0; i < filterBy.length; i++) {\\n        var currentValue = row.doc.data[filterBy[i].name];\\n        if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n          currentValue = \'Scheduled\';\\n        }\\n        if (currentValue !== filterBy[i].value) {\\n          includeRow = false;\\n          break;\\n        }\\n      }\\n      return includeRow;\\n    });rows.sort(function (a, b) {\\n      function defaultStatus(value) {\\n        if (!value || value === \'\') {\\n          return \'Scheduled\';\\n        } else {\\n          return value;\\n        }\\n      }\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'appointmentType\':\\n        case \'location\':\\n        case \'provider\':\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        case \'date\':\\n          {\\n            var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n            if (startDiff === 0) {\\n              return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n            } else {\\n              return startDiff;\\n            }\\n          }\\n        case \'status\':\\n          {\\n            var aStatus = defaultStatus(a.doc.data[sortBy]);\\n            var bStatus = defaultStatus(b.doc.data[sortBy]);\\n            return compareStrings(aStatus, bStatus);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["178add045be11a7fd6aa7fdf97c8f3f0"]}},{"_id":"_design/appointments_by_date","_rev":"1-3c37df4fed5a034aedc1a295f4a672fd","version":4,"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n            var i,\\n                filterBy = null,\\n                includeRow = true;\\n            if (req.query && req.query.filterBy) {\\n                filterBy = JSON.parse(req.query.filterBy);\\n            }\\n            if (!filterBy) {\\n                return true;\\n            }\\n            for (i = 0; i < filterBy.length; i++) {\\n                var currentValue = row.doc[filterBy[i].name];\\n                if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n                    currentValue = \'Scheduled\';\\n                }\\n                if (currentValue !== filterBy[i].value) {\\n                    includeRow = false;\\n                    break;\\n                }\\n            }\\n            return includeRow;\\n        });rows.sort(function (a, b) {\\n            function defaultStatus(value) {\\n                if (!value || value === \'\') {\\n                    return \'Scheduled\';\\n                } else {\\n                    return value;\\n                }\\n            }\\n            var sortBy = \'\';\\n            if (req.query && req.query.sortKey) {\\n                sortBy = req.query.sortKey;\\n            }\\n            switch (sortBy) {\\n                case \'appointmentType\':\\n                case \'location\':\\n                case \'provider\':\\n                    return compareStrings(a.doc[sortBy], b.doc[sortBy]);\\n                case \'date\':\\n                    {\\n                        var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n                        if (startDiff === 0) {\\n                            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n                        } else {\\n                            return startDiff;\\n                        }\\n                        break;\\n                    }\\n                case \'status\':\\n                    {\\n                        var aStatus = defaultStatus(a.doc.data[sortBy]),\\n                            bStatus = defaultStatus(b.doc.data[sortBy]);\\n                        return compareStrings(aStatus, bStatus);\\n                    }\\n                default:\\n                    {\\n                        return 0; //Don\'t sort\\n                    }\\n            }\\n        });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"views":{"appointments_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["3c37df4fed5a034aedc1a295f4a672fd"]}},{"_id":"_design/appointments_by_date","_rev":"1-5df29f1d7dbd39d6b3a2145923ab73cf","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["5df29f1d7dbd39d6b3a2145923ab73cf"]}},{"_id":"_design/appointments_by_date","_rev":"3-461875fa3e8aa582009473a4ebccf3bb","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":3,"ids":["461875fa3e8aa582009473a4ebccf3bb","2e78ab0f6da3881df4871d0b028148b9","4c8dd95ad6d36b9b4d86136d5e417f5c"]}},{"_id":"_design/appointments_by_patient","_rev":"1-9a97acd5b8fd071ad81afc9e730721c5","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate,doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["9a97acd5b8fd071ad81afc9e730721c5"]}},{"_id":"_design/appointments_by_patient","_rev":"1-7232d3292344540b2511e709422e2cbf","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate,doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7232d3292344540b2511e709422e2cbf"]}},{"_id":"_design/appointments_by_patient","_rev":"2-a8bb26daf0329c069a18ec0ce64532cb","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate,doc._id]);}}}"}},"_revisions":{"start":2,"ids":["a8bb26daf0329c069a18ec0ce64532cb","9868b6586898a48c3fd68722ca3fe1d4"]}},{"_id":"_design/closed_incidents_by_user","_rev":"1-bf16176c13be57af9a4f1a0980710190","version":1,"views":{"closed_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status === \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}}},{"_id":"_design/imaging_by_status","_rev":"1-2feb5103c3f6d149bf98f0adeaa76b38","version":4,"views":{"imaging_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"imaging\\") {var imagingDate = doc.data.imagingDate;if (imagingDate && imagingDate !== \\"\\") {imagingDate = new Date(imagingDate);if (imagingDate.getTime) {imagingDate = imagingDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, imagingDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["2feb5103c3f6d149bf98f0adeaa76b38"]}},{"_id":"_design/imaging_by_status","_rev":"1-1a3bab3d2d1403299a9e4ad8dffe5fa1","version":4,"views":{"imaging_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'imaging\') {\\n        var imagingDate = doc.data.imagingDate;\\n    if (imagingDate && imagingDate !== \\"\\") {\\n      imagingDate = new Date(imagingDate);\\n      if (imagingDate.getTime) {\\n        imagingDate = imagingDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, imagingDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["1a3bab3d2d1403299a9e4ad8dffe5fa1"]}},{"_id":"_design/imaging_by_status","_rev":"2-57660077d48a8a4a0c1a3dd6ae214aac","version":4,"views":{"imaging_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"imaging\\") {var imagingDate = doc.data.imagingDate;if (imagingDate && imagingDate !== \\"\\") {imagingDate = new Date(imagingDate);if (imagingDate.getTime) {imagingDate = imagingDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, imagingDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["57660077d48a8a4a0c1a3dd6ae214aac","9236042e1fb9f567d1d527bbb429cd8e"]}},{"_id":"_design/incident_by_date","_rev":"1-59fa59734ee129cff0560b20a95d2d4e","version":1,"views":{"incident_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        var dateOfIncident = doc.data.dateOfIncident;\\n    if (dateOfIncident && dateOfIncident !== \\"\\") {\\n      dateOfIncident = new Date(dateOfIncident);\\n      if (dateOfIncident.getTime) {\\n        dateOfIncident = dateOfIncident.getTime();\\n      }\\n    }\\n    emit([dateOfIncident, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/incident_by_friendly_id","_rev":"1-885a12b67da47e956bc190fe1fe0d4e6","version":1,"views":{"incident_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_by_name","_rev":"1-304304d63beaffd8d1ae4ae1cddf4b2b","version":3,"views":{"inventory_by_name":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit([doc.data.name, doc._id]);}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["304304d63beaffd8d1ae4ae1cddf4b2b"]}},{"_id":"_design/inventory_by_name","_rev":"1-3eb498726e0d057818618808c0db46bf","version":3,"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n            var sortBy = \'\';\\n            if (req.query && req.query.sortKey) {\\n                sortBy = req.query.sortKey;\\n            }\\n            switch (sortBy) {\\n                case \'crossReference\':\\n                case \'description\':\\n                case \'friendlyId\':\\n                case \'name\':\\n                case \'price\':\\n                case \'quantity\':\\n                case \'inventoryType\':\\n                    {\\n                        return compareStrings(a.doc[sortBy], b.doc[sortBy]);\\n                    }\\n                default:\\n                    {\\n                        return 0; //Don\'t sort\\n                    }\\n            }\\n        });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"views":{"inventory_by_name":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit([doc.data.name, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["3eb498726e0d057818618808c0db46bf"]}},{"_id":"_design/inventory_by_name","_rev":"1-91f55ae6bd30f766d9da95bffe054bcb","version":5,"views":{"inventory_by_name":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.name, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["91f55ae6bd30f766d9da95bffe054bcb"]}},{"_id":"_design/inventory_by_name","_rev":"2-6993fbc5ef18283f83c6afe5be9a9351","version":5,"views":{"inventory_by_name":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.name, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["6993fbc5ef18283f83c6afe5be9a9351","c12e4467c9c3ecc8021b660934257f25"]}},{"_id":"_design/inventory_by_type","_rev":"1-003ef699ab0f2b8628c0bf613fabf7a2","version":4,"views":{"inventory_by_type":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit(doc.data.inventoryType);}}}"}},"_revisions":{"start":1,"ids":["003ef699ab0f2b8628c0bf613fabf7a2"]}},{"_id":"_design/inventory_by_type","_rev":"1-65423cfcd4b0acd93b58aa2003907c92","version":5,"views":{"inventory_by_type":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit(doc.data.inventoryType);}}}"}},"_revisions":{"start":1,"ids":["65423cfcd4b0acd93b58aa2003907c92"]}},{"_id":"_design/inventory_by_type","_rev":"1-18455500e1e86544edceaab01bb511bc","version":5,"views":{"inventory_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit(doc.data.inventoryType);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["18455500e1e86544edceaab01bb511bc"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-823be94576112c800022b256ccd9b725","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var dateReceived = doc.data.dateReceived;if (dateReceived && dateReceived !== \\"\\") {dateReceived = new Date(dateReceived);if (dateReceived.getTime) {dateReceived = dateReceived.getTime();}}emit([dateReceived, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["823be94576112c800022b256ccd9b725"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-78939ec45bef330bbfa87763dbbfce37","version":4,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var dateReceived = doc.data.dateReceived;if (dateReceived && dateReceived !== \\"\\") {dateReceived = new Date(dateReceived);if (dateReceived.getTime) {dateReceived = dateReceived.getTime();}}emit([dateReceived, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["78939ec45bef330bbfa87763dbbfce37"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-0d7b597aeae746589980b12903768252","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invPurchase\') {\\n        var dateReceived = doc.data.dateReceived;\\n    if (dateReceived && dateReceived !== \\"\\") {\\n      dateReceived = new Date(dateReceived);\\n      if (dateReceived.getTime) {\\n        dateReceived = dateReceived.getTime();\\n      }\\n    }\\n    emit([dateReceived, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["0d7b597aeae746589980b12903768252"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-17bd9d3619ae03155d9929d3ebcd5023","version":4,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var expirationDate = doc.data.expirationDate;if (expirationDate && expirationDate !== \\"\\") {expirationDate = new Date(expirationDate);if (expirationDate.getTime) {expirationDate = expirationDate.getTime();}}emit([expirationDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["17bd9d3619ae03155d9929d3ebcd5023"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-1f41dd6d030c58884d7013ef9436decb","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invPurchase\') {\\n        var expirationDate = doc.data.expirationDate;\\n    if (expirationDate && expirationDate !== \\"\\") {\\n      expirationDate = new Date(expirationDate);\\n      if (expirationDate.getTime) {\\n        expirationDate = expirationDate.getTime();\\n      }\\n    }\\n    emit([expirationDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["1f41dd6d030c58884d7013ef9436decb"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-7aea58304996ccb168865141592a024f","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var expirationDate = doc.data.expirationDate;if (expirationDate && expirationDate !== \\"\\") {expirationDate = new Date(expirationDate);if (expirationDate.getTime) {expirationDate = expirationDate.getTime();}}emit([expirationDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7aea58304996ccb168865141592a024f"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-021f4c24b5b6202594f610cf5d4c63a4","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invRequest\') {\\n        var dateCompleted = doc.data.dateCompleted;\\n    if (dateCompleted && dateCompleted !== \\"\\") {\\n      dateCompleted = new Date(dateCompleted);\\n      if (dateCompleted.getTime) {\\n        dateCompleted = dateCompleted.getTime();\\n      }\\n    }\\n    emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["021f4c24b5b6202594f610cf5d4c63a4"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-7e7ef275a9fc15f2b5f328b1479c6097","version":4,"views":{"inventory_request_by_item":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);}}}"}},"_revisions":{"start":1,"ids":["7e7ef275a9fc15f2b5f328b1479c6097"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-e9eb2d7f1e35296646399c7414525c33","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);}}}"}},"_revisions":{"start":1,"ids":["e9eb2d7f1e35296646399c7414525c33"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-187394c79d3206e11e112891f0d63550","version":4,"views":{"inventory_request_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.status, dateCompleted, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["187394c79d3206e11e112891f0d63550"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-cc0c1e0e01060aa62456d6ea768d8ec7","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invRequest\') {\\n        var dateCompleted = doc.data.dateCompleted;\\n    if (dateCompleted && dateCompleted !== \\"\\") {\\n      dateCompleted = new Date(dateCompleted);\\n      if (dateCompleted.getTime) {\\n        dateCompleted = dateCompleted.getTime();\\n      }\\n    }\\n    emit([doc.data.status, dateCompleted, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["cc0c1e0e01060aa62456d6ea768d8ec7"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-f4a7252ebf2802c53a572bf150eae05c","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.status, dateCompleted, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["f4a7252ebf2802c53a572bf150eae05c"]}},{"_id":"_design/invoice_by_patient","_rev":"1-a491390f74ce432d9cfab78291e0753b","version":1,"views":{"invoice_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":1,"ids":["a491390f74ce432d9cfab78291e0753b"]}},{"_id":"_design/invoice_by_patient","_rev":"1-9f67a58d4e428614844ac82cb2548268","version":1,"views":{"invoice_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invoice\') {\\n        emit(doc.data.patient);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["9f67a58d4e428614844ac82cb2548268"]}},{"_id":"_design/invoice_by_status","_rev":"1-d411e6f66f897f0b9b985dc6e5188d85","version":4,"views":{"invoice_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invoice\') {\\n        var billDate = doc.data.billDate;\\n    if (billDate && billDate !== \\"\\") {\\n      billDate = new Date(billDate);\\n      if (billDate.getTime) {\\n        billDate = billDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, billDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["d411e6f66f897f0b9b985dc6e5188d85"]}},{"_id":"_design/invoice_by_status","_rev":"1-25a58e1cec7f01d0a7e8da1293f59b69","version":4,"views":{"invoice_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {var billDate = doc.data.billDate;if (billDate && billDate !== \\"\\") {billDate = new Date(billDate);if (billDate.getTime) {billDate = billDate.getTime();}}emit([doc.data.status, billDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["25a58e1cec7f01d0a7e8da1293f59b69"]}},{"_id":"_design/invoice_by_status","_rev":"2-072e2f7f1519a12260fe98c90f794b06","version":4,"views":{"invoice_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {var billDate = doc.data.billDate;if (billDate && billDate !== \\"\\") {billDate = new Date(billDate);if (billDate.getTime) {billDate = billDate.getTime();}}emit([doc.data.status, billDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["072e2f7f1519a12260fe98c90f794b06","73e3e45673ed0c4f4ae1cee855f216f0"]}},{"_id":"_design/lab_by_status","_rev":"1-7d4de6e219b482171b7ecd485ef72238","version":4,"views":{"lab_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'lab\') {\\n        var labDate = doc.data.labDate;\\n    if (labDate && labDate !== \\"\\") {\\n      labDate = new Date(labDate);\\n      if (labDate.getTime) {\\n        labDate = labDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, labDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["7d4de6e219b482171b7ecd485ef72238"]}},{"_id":"_design/lab_by_status","_rev":"1-16b2c13356e8dac3b3594018f91cccfb","version":4,"views":{"lab_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"lab\\") {var labDate = doc.data.labDate;if (labDate && labDate !== \\"\\") {labDate = new Date(labDate);if (labDate.getTime) {labDate = labDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, labDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["16b2c13356e8dac3b3594018f91cccfb"]}},{"_id":"_design/lab_by_status","_rev":"2-ef5e8b51b3704c0cb1e525a63c81bd80","version":4,"views":{"lab_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"lab\\") {var labDate = doc.data.labDate;if (labDate && labDate !== \\"\\") {labDate = new Date(labDate);if (labDate.getTime) {labDate = labDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, labDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["ef5e8b51b3704c0cb1e525a63c81bd80","db4393c6856b98a40afd6ceef31db2a7"]}},{"_id":"_design/medication_by_status","_rev":"1-a6403c53b2db46905b3b1861120c6601","version":4,"views":{"medication_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'medication\') {\\n        var prescriptionDate = doc.data.prescriptionDate;\\n    if (prescriptionDate && prescriptionDate !== \\"\\") {\\n      prescriptionDate = new Date(prescriptionDate);\\n      if (prescriptionDate.getTime) {\\n        prescriptionDate = prescriptionDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["a6403c53b2db46905b3b1861120c6601"]}},{"_id":"_design/medication_by_status","_rev":"1-09e1d1c201823532161ef48ba23200be","version":4,"views":{"medication_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"medication\\") {var prescriptionDate = doc.data.prescriptionDate;if (prescriptionDate && prescriptionDate !== \\"\\") {prescriptionDate = new Date(prescriptionDate);if (prescriptionDate.getTime) {prescriptionDate = prescriptionDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["09e1d1c201823532161ef48ba23200be"]}},{"_id":"_design/medication_by_status","_rev":"2-9dec70f4b5aeaf7d9b8d70719125c41c","version":4,"views":{"medication_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"medication\\") {var prescriptionDate = doc.data.prescriptionDate;if (prescriptionDate && prescriptionDate !== \\"\\") {prescriptionDate = new Date(prescriptionDate);if (prescriptionDate.getTime) {prescriptionDate = prescriptionDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["9dec70f4b5aeaf7d9b8d70719125c41c","36ce9e9853552f5eb646ed26de7184dc"]}},{"_id":"_design/open_incidents_by_user","_rev":"1-34770efd210920a30c96d3787521e8a5","version":1,"views":{"open_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status !== \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      }\\n      return 0; // Don\'t sort\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/patient_by_admission","_rev":"1-3c2da4380d257c95ebf4430afa48de3b","version":4,"views":{"patient_by_admission":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.admitted === true) {\\n      if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["3c2da4380d257c95ebf4430afa48de3b"]}},{"_id":"_design/patient_by_admission","_rev":"2-cb3270a3d44a370d50128b93179d3503","version":4,"views":{"patient_by_admission":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.admitted === true) {\\n      if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["cb3270a3d44a370d50128b93179d3503","ee7b6ead26ac6b8b3f106c6d85dc175b"]}},{"_id":"_design/patient_by_display_id","_rev":"1-0b75ee7c82a1aadebd0bc0fd403622fb","version":5,"views":{"patient_by_display_id":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {if (doc.data.friendlyId) {emit([doc.data.friendlyId, doc._id]);} else if (doc.data.externalPatientId) {emit([doc.data.externalPatientId, doc._id]);} else {emit([doc._id, doc._id]);}}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'firstName\':\\n        case \'sex\':\\n        case \'lastName\':\\n        case \'status\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        case \'dateOfBirth\':\\n          {\\n            return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["0b75ee7c82a1aadebd0bc0fd403622fb"]}},{"_id":"_design/patient_by_display_id","_rev":"1-8a6930002af6d588ecdedd5f07da0230","version":7,"views":{"patient_by_display_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["8a6930002af6d588ecdedd5f07da0230"]}},{"_id":"_design/patient_by_display_id","_rev":"1-c619a041bccecc7e83b05015cc92706e","version":6,"views":{"patient_by_display_id":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {if (doc.data.friendlyId) {emit([doc.data.friendlyId, doc._id]);} else if (doc.data.externalPatientId) {emit([doc.data.externalPatientId, doc._id]);} else {emit([doc._id, doc._id]);}}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["c619a041bccecc7e83b05015cc92706e"]}},{"_id":"_design/patient_by_display_id","_rev":"3-76930b682e13aef4b2a31fcc57c0ba17","version":7,"views":{"patient_by_display_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":3,"ids":["76930b682e13aef4b2a31fcc57c0ba17","f2bcbc75b5c6af36a93ff450e1764247","e6d44a1448953362319c910bf33a8668"]}},{"_id":"_design/patient_by_status","_rev":"1-54bc74ff93db4aedff83bc649f766596","version":3,"views":{"patient_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        emit(doc.data.status);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["54bc74ff93db4aedff83bc649f766596"]}},{"_id":"_design/patient_by_status","_rev":"1-49f3f7f86891fb7d60f0ee1b2db1220b","version":3,"views":{"patient_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {emit(doc.data.status);}}}"}},"_revisions":{"start":1,"ids":["49f3f7f86891fb7d60f0ee1b2db1220b"]}},{"_id":"_design/patient_by_status","_rev":"2-b56763993297cda52343d99f7fdd1b03","version":3,"views":{"patient_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {emit(doc.data.status);}}}"}},"_revisions":{"start":2,"ids":["b56763993297cda52343d99f7fdd1b03","ff26a12cdb8747aae5bf26f9af3a1953"]}},{"_id":"_design/photo_by_patient","_rev":"1-727ba2a3d1a106196746643395a859d0","version":4,"views":{"photo_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"photo\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":1,"ids":["727ba2a3d1a106196746643395a859d0"]}},{"_id":"_design/photo_by_patient","_rev":"1-6a4fad4fa682efbbd058e858c328574f","version":4,"views":{"photo_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'photo\') {\\n        emit(doc.data.patient);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["6a4fad4fa682efbbd058e858c328574f"]}},{"_id":"_design/photo_by_patient","_rev":"2-0ea32da890536de0910ea412a3fa015c","version":4,"views":{"photo_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"photo\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":2,"ids":["0ea32da890536de0910ea412a3fa015c","e3dc5506f7f370535b85be0adc59c7cc"]}},{"_id":"_design/pricing_by_category","_rev":"1-3d703b5f240ae5838d1f20a8ad0471de","version":5,"views":{"pricing_by_category":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'pricing\') {\\n        emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["3d703b5f240ae5838d1f20a8ad0471de"]}},{"_id":"_design/pricing_by_category","_rev":"1-b34429f4f8aff13ed218f70f039b3591","version":5,"views":{"pricing_by_category":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"pricing\\") {emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["b34429f4f8aff13ed218f70f039b3591"]}},{"_id":"_design/pricing_by_category","_rev":"1-23d44e44019170eadd086734c87e3976","version":4,"views":{"pricing_by_category":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"pricing\\") {emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["23d44e44019170eadd086734c87e3976"]}},{"_id":"_design/procedure_by_date","_rev":"1-7c23f1d0feaff1358bee1ddea760daac","version":4,"views":{"procedure_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"procedure\\") {var procedureDate = doc.data.procedureDate;if (procedureDate && procedureDate !== \\"\\") {procedureDate = new Date(procedureDate);if (procedureDate.getTime) {procedureDate = procedureDate.getTime();}}emit([procedureDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7c23f1d0feaff1358bee1ddea760daac"]}},{"_id":"_design/procedure_by_date","_rev":"1-a44decd8f14d01c615cf3f5b8e70f10b","version":4,"views":{"procedure_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'procedure\') {\\n        var procedureDate = doc.data.procedureDate;\\n    if (procedureDate && procedureDate !== \\"\\") {\\n      procedureDate = new Date(procedureDate);\\n      if (procedureDate.getTime) {\\n        procedureDate = procedureDate.getTime();\\n      }\\n    }\\n    emit([procedureDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["a44decd8f14d01c615cf3f5b8e70f10b"]}},{"_id":"_design/procedure_by_date","_rev":"1-25ccef2a9dff3addd8c0d15cc79c363c","version":3,"views":{"procedure_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"procedure\\") {var procedureDate = doc.data.procedureDate;if (procedureDate && procedureDate !== \\"\\") {procedureDate = new Date(procedureDate);if (procedureDate.getTime) {procedureDate = procedureDate.getTime();}}emit([procedureDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["25ccef2a9dff3addd8c0d15cc79c363c"]}},{"_id":"_design/report_by_visit","_rev":"1-1295cef10df82554859efdb4c38c1c1e","version":1,"views":{"report_by_visit":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'report\') {\\n        emit(doc.data.visit);\\n      }\\n    }\\n  }"}}},{"_id":"_design/sequence_by_prefix","_rev":"1-10f81c9287f2db782b8e293e7d9b1cde","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'sequence\') {\\n        emit(doc.data.prefix);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["10f81c9287f2db782b8e293e7d9b1cde"]}},{"_id":"_design/sequence_by_prefix","_rev":"1-4a47589314718c2d8add1266b64b5ea6","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"sequence\\") {emit(doc.data.prefix);}}}"}},"_revisions":{"start":1,"ids":["4a47589314718c2d8add1266b64b5ea6"]}},{"_id":"_design/sequence_by_prefix","_rev":"2-73756debd255ca93fb25eab24ed9e12a","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"sequence\\") {emit(doc.data.prefix);}}}"}},"_revisions":{"start":2,"ids":["73756debd255ca93fb25eab24ed9e12a","8ac3a62b4c0b624ebed3b68b27cd197e"]}},{"_id":"_design/surgical_appointments_by_date","_rev":"1-90d8de834de1fe0e154d1cdab8889984","version":1,"views":{"surgical_appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType === \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/visit_by_date","_rev":"1-367a7fa42f1067f645190d560f83ef5e","version":3,"views":{"visit_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["367a7fa42f1067f645190d560f83ef5e"]}},{"_id":"_design/visit_by_date","_rev":"1-db61f993a1e1699c8205fee3434fc4c8","version":4,"views":{"visit_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([startDate, endDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["db61f993a1e1699c8205fee3434fc4c8"]}},{"_id":"_design/visit_by_date","_rev":"1-fd0a50125860ba3c17844c0567a70d65","version":4,"views":{"visit_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["fd0a50125860ba3c17844c0567a70d65"]}},{"_id":"_design/visit_by_discharge_date","_rev":"1-b4baca85d54e727966aeb2e8ad172136","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    emit([endDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["b4baca85d54e727966aeb2e8ad172136"]}},{"_id":"_design/visit_by_discharge_date","_rev":"1-57a0b69b2792963e5112bbdd53bbba2d","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}emit([endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["57a0b69b2792963e5112bbdd53bbba2d"]}},{"_id":"_design/visit_by_discharge_date","_rev":"2-76f05f3060660ab74749fa0def9cea07","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}emit([endDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["76f05f3060660ab74749fa0def9cea07","e53c95160dacaf007fe01c01215729ce"]}},{"_id":"_design/visit_by_patient","_rev":"1-bf45f0e7e8e9123a59095b609570a4ea","version":4,"views":{"visit_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["bf45f0e7e8e9123a59095b609570a4ea"]}},{"_id":"_design/visit_by_patient","_rev":"1-f2865c74eefee716937492db914f2ccd","version":4,"views":{"visit_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["f2865c74eefee716937492db914f2ccd"]}},{"_id":"_design/visit_by_patient","_rev":"1-412252178488867e2350dcd13da779ea","version":3,"views":{"visit_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["412252178488867e2350dcd13da779ea"]}},{"_id":"appointment_2_D0C3934D-E023-66E4-97D4-FC58F3595409","_rev":"1-5775c0c9cdf58099fa3ae4197634505f","data":{"allDay":true,"provider":"Dr Test","location":"Harare","appointmentType":"Admission","startDate":"2015-10-29T22:00:00.000Z","endDate":"2015-10-29T22:00:00.000Z","notes":"Admission","status":"Scheduled","lastModified":"2015-10-30T15:08:29.970Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"allDay":"2015-10-30T15:08:29.970Z","startDate":"2015-10-30T15:08:29.970Z","endDate":"2015-10-30T15:08:29.970Z","provider":"2015-10-30T15:08:29.970Z","location":"2015-10-30T15:08:29.970Z","appointmentType":"2015-10-30T15:08:29.970Z","notes":"2015-10-30T15:08:29.970Z"}}},{"_id":"appointment_2_EE5D1ABE-2625-645B-9F84-5B0DD4B4D5EC","_rev":"1-1bb336da899bbd4807cde6620d630bd1","data":{"allDay":true,"provider":"Dr Test","location":"Harare","appointmentType":"Admission","startDate":"2015-11-02T22:00:00.000Z","endDate":"2015-11-02T22:00:00.000Z","notes":"Basic Checkup","status":"Scheduled","lastModified":"2015-11-03T06:50:48.404Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"allDay":"2015-11-03T06:50:48.404Z","startDate":"2015-11-03T06:50:48.404Z","endDate":"2015-11-03T06:50:48.404Z","appointmentType":"2015-11-03T06:50:48.404Z","provider":"2015-11-03T06:50:48.404Z","location":"2015-11-03T06:50:48.404Z","notes":"2015-11-03T06:50:48.404Z"}}},{"_id":"imaging_2_07CC6746-C7D9-A410-9B8C-C4B4E095A96D","_rev":"2-ffa7adb60618346cba98a559d81df36a","data":{"imagingDate":"2015-10-15T09:39:44.603Z","notes":"random notes","radiologist":"zinyando","requestedBy":"hradmin","requestedDate":"2015-10-15T09:39:37.866Z","result":"to collect","status":"Completed","lastModified":"2015-10-15T09:39:44.603Z","modifiedBy":"hradmin","imagingType":"22208FBE-9C6E-079D-A1E6-A562F9310FE5","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"377AA288-AAD4-F60B-ABD1-B5A0B9C75D50","modifiedFields":{"radiologist":"2015-10-15T09:39:38.088Z","result":"2015-10-15T09:39:38.088Z","notes":"2015-10-15T09:39:38.088Z","status":"2015-10-15T09:39:44.603Z","requestedBy":"2015-10-15T09:39:38.088Z","requestedDate":"2015-10-15T09:39:38.088Z","imagingDate":"2015-10-15T09:39:44.603Z"},"charges":[]},"_revisions":{"start":2,"ids":["ffa7adb60618346cba98a559d81df36a","be0a6780ba1f2b7e3e8d49ebf20ed8d6"]}},{"_id":"imaging_2_1AC1DD3D-E7E7-15B4-A698-8A8AE62749EB","_rev":"1-83a3398c448faf2ea1962004c5652a52","data":{"imagingDate":null,"notes":"jkmn","radiologist":"zinyando","requestedBy":"hradmin","requestedDate":"2015-10-15T10:37:57.852Z","result":"hu","status":"Requested","lastModified":"2015-10-15T10:37:58.038Z","modifiedBy":"hradmin","imagingType":"4CEB69E7-B54A-9D45-B0EF-7643F0D48FA0","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"0BD42BD9-0E5D-0533-A8FA-1C0ADB0F0D65","modifiedFields":{"radiologist":"2015-10-15T10:37:58.038Z","result":"2015-10-15T10:37:58.038Z","notes":"2015-10-15T10:37:58.038Z","status":"2015-10-15T10:37:58.038Z","requestedBy":"2015-10-15T10:37:58.038Z","requestedDate":"2015-10-15T10:37:58.038Z"},"charges":[]}},{"_id":"imaging_2_4A7FC838-0B37-E151-AFD8-8DBAC9DE9D99","_rev":"2-0ddb54b6d0376b87fdf409eb6d205f82","data":{"imagingDate":"2015-10-28T07:32:45.311Z","notes":null,"radiologist":null,"requestedBy":"hradmin","requestedDate":"2015-10-26T11:49:08.227Z","result":null,"status":"Completed","lastModified":"2015-10-28T07:32:45.314Z","modifiedBy":"hradmin","imagingType":"CBB4C9D5-CE8C-2BB5-86F4-3FC16AE2E85D","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"C5C296AC-E238-CBA5-8DD8-99942843BC5A","modifiedFields":{"status":"2015-10-28T07:32:45.314Z","requestedBy":"2015-10-26T11:49:08.483Z","requestedDate":"2015-10-26T11:49:08.483Z","imagingDate":"2015-10-28T07:32:45.314Z"},"charges":[]},"_revisions":{"start":2,"ids":["0ddb54b6d0376b87fdf409eb6d205f82","0cefb2d2a3e8ba76052c1a08c27df1eb"]}},{"_id":"imaging_2_51D8DC28-78EB-62B1-942A-1158F5862F34","_rev":"2-40eac78a67beecaa77b17ea5e7481866","data":{"imagingDate":"2015-10-28T07:32:55.293Z","notes":"Chest is ok","radiologist":"Mr Test","requestedBy":"hradmin","requestedDate":"2015-10-28T07:23:34.834Z","result":"Ok","status":"Completed","lastModified":"2015-10-28T07:32:55.294Z","modifiedBy":"hradmin","imagingType":"E53305F3-BA40-B305-B2DC-0732C7AB0042","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"CBFA5C2C-191D-FC9C-AD19-14D26D5A3003","modifiedFields":{"radiologist":"2015-10-28T07:23:35.055Z","result":"2015-10-28T07:23:35.055Z","notes":"2015-10-28T07:23:35.055Z","status":"2015-10-28T07:32:55.294Z","requestedBy":"2015-10-28T07:23:35.055Z","requestedDate":"2015-10-28T07:23:35.055Z","imagingDate":"2015-10-28T07:32:55.294Z"},"charges":[]},"_revisions":{"start":2,"ids":["40eac78a67beecaa77b17ea5e7481866","fb212193dfed510d7935aed17e5f0456"]}},{"_id":"imaging_2_91B061E9-2986-D539-90C8-CD14EC2010B0","_rev":"1-2abe559a8f8075862b282ed4f9d54da5","data":{"imagingDate":null,"notes":"jbkj","radiologist":"b","requestedBy":"hradmin","requestedDate":"2015-10-28T07:39:18.255Z","result":"jjjk","status":"Requested","lastModified":"2015-10-28T07:39:18.406Z","modifiedBy":"hradmin","imagingType":null,"patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"6AD00ED1-670A-2C3F-BC10-0742B1F99264","modifiedFields":{"radiologist":"2015-10-28T07:39:18.406Z","result":"2015-10-28T07:39:18.406Z","notes":"2015-10-28T07:39:18.406Z","status":"2015-10-28T07:39:18.406Z","requestedBy":"2015-10-28T07:39:18.406Z","requestedDate":"2015-10-28T07:39:18.406Z"},"charges":[]}},{"_id":"imaging_2_D0F299E4-CD8D-557D-8C23-216FD23EF844","_rev":"3-8b87996abf9161e5d7908be6676a64d7","data":{"imagingDate":"2015-10-22T07:09:04.249Z","notes":"vbj nkm","radiologist":"fcgvb","requestedBy":"hradmin","requestedDate":"2015-10-22T07:08:38.080Z","result":"cgvhbj n","status":"Completed","lastModified":"2015-10-22T07:09:04.251Z","modifiedBy":"hradmin","imagingType":"B492AA26-22F2-52A9-93C7-17106A57A62E","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"9F1A65ED-683F-056E-8D50-A8AF63201CE2","modifiedFields":{"radiologist":"2015-10-22T07:08:38.523Z","result":"2015-10-22T07:08:38.523Z","notes":"2015-10-22T07:08:38.523Z","status":"2015-10-22T07:08:59.403Z","requestedBy":"2015-10-22T07:08:38.523Z","requestedDate":"2015-10-22T07:08:38.523Z","imagingDate":"2015-10-22T07:09:04.251Z"},"charges":[]},"_revisions":{"start":3,"ids":["8b87996abf9161e5d7908be6676a64d7","9f159b24551a1fa5acd7b84cd8d51994","c676b60d0d69556786f283da75b51c77"]}},{"_id":"imaging_2_DBE152F6-9508-2E12-81AC-39BC2CAFE08C","_rev":"2-69b11e7856d8b0fc3bd62debbfca3e55","data":{"imagingDate":"2015-10-28T07:33:17.867Z","notes":"ss","radiologist":"ss","requestedBy":"hradmin","requestedDate":"2015-10-28T07:31:20.891Z","result":"sss","status":"Completed","lastModified":"2015-10-28T07:33:17.868Z","modifiedBy":"hradmin","imagingType":"F51616AE-EB96-2778-824F-386DEAFFD2F9","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"D6938BD3-6346-F62B-8B19-5207B2E5A6AF","modifiedFields":{"radiologist":"2015-10-28T07:31:21.091Z","result":"2015-10-28T07:31:21.091Z","notes":"2015-10-28T07:31:21.091Z","status":"2015-10-28T07:33:17.868Z","requestedBy":"2015-10-28T07:31:21.091Z","requestedDate":"2015-10-28T07:31:21.091Z","imagingDate":"2015-10-28T07:33:17.868Z"},"charges":[]},"_revisions":{"start":2,"ids":["69b11e7856d8b0fc3bd62debbfca3e55","222ad15ae5eed89c6d8abe1c9e07c145"]}},{"_id":"imaging_2_EA6B989C-90B7-2E08-9D8F-CE4339BB9B4B","_rev":"2-63da6e42fb59a811a5468e32bda0eb76","data":{"imagingDate":"2015-10-28T07:33:05.759Z","notes":"hbjn","radiologist":"cgvhbn","requestedBy":"hradmin","requestedDate":"2015-10-28T07:27:44.346Z","result":"fcghvj","status":"Completed","lastModified":"2015-10-28T07:33:05.759Z","modifiedBy":"hradmin","imagingType":"C8826ADA-C3AC-37CD-84AE-FA86A203AC6E","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"74A4EF68-5D8D-BDF6-940F-33E50E50DDEA","modifiedFields":{"radiologist":"2015-10-28T07:27:44.514Z","result":"2015-10-28T07:27:44.514Z","notes":"2015-10-28T07:27:44.514Z","status":"2015-10-28T07:33:05.759Z","requestedBy":"2015-10-28T07:27:44.514Z","requestedDate":"2015-10-28T07:27:44.514Z","imagingDate":"2015-10-28T07:33:05.759Z"},"charges":[]},"_revisions":{"start":2,"ids":["63da6e42fb59a811a5468e32bda0eb76","51a7194f0c4b6b172b5d0b059285e118"]}},{"_id":"invLocation_2_B7B86EC1-6CCE-30B7-B4ED-FF2061879E03","_rev":"3-28a915c1093e6e8497c2742a4806f926","data":{"quantity":950,"location":null,"aisleLocation":null,"lastModified":"2015-10-30T12:44:28.530Z","modifiedBy":"hradmin","modifiedFields":{"quantity":"2015-10-30T12:44:28.530Z"}},"_revisions":{"start":3,"ids":["28a915c1093e6e8497c2742a4806f926","6b49176eeeafb82a88a10aa5d954d965","e7ffcb12925c148d50279cc2ee012d25"]}},{"_id":"invPurchase_2_CDC3AB7D-A0AD-E146-87A4-FDB1096C2EEC","_rev":"2-4f1115c8c7b03b0bf06059d01e5ff7bd","data":{"purchaseCost":4000,"lotNumber":null,"dateReceived":"2015-10-28T22:00:00.000Z","originalQuantity":1000,"currentQuantity":950,"expirationDate":null,"expired":false,"location":null,"aisleLocation":null,"giftInKind":false,"inventoryItem":"igbmk5zf_is","vendor":"Alpha Pharmacy","vendorItemNo":null,"distributionUnit":null,"invoiceNo":null,"lastModified":"2015-10-30T12:44:28.533Z","modifiedBy":"hradmin","modifiedFields":{"dateReceived":"2015-10-29T02:44:10.493Z","purchaseCost":"2015-10-29T02:44:10.493Z","vendor":"2015-10-29T02:44:10.493Z","originalQuantity":"2015-10-29T02:44:10.493Z","currentQuantity":"2015-10-30T12:44:28.533Z","inventoryItem":"2015-10-29T02:44:10.493Z"}},"_revisions":{"start":2,"ids":["4f1115c8c7b03b0bf06059d01e5ff7bd","d0a2104fa76a4161da3f527b23a6d61a"]}},{"_id":"invRequest_2_4691AB2D-AEF3-1AA8-A11E-790BA5788239","_rev":"2-cf9eeeed6d9004aa0479660df622e08c","data":{"adjustPurchases":true,"completedBy":"hradmin","costPerUnit":4,"dateCompleted":"2015-10-29T22:00:00.000Z","dateRequested":"2015-10-29T08:35:51.495Z","deliveryAisle":"C100","deliveryLocation":"Harare","expenseAccount":"Accounts","markAsConsumed":true,"quantity":50,"quantityAtCompletion":1000,"reason":null,"requestedBy":"hradmin","status":"Completed","transactionType":"Fulfillment","lastModified":"2015-10-30T12:44:28.623Z","modifiedBy":"hradmin","inventoryItem":"igbmk5zf_is","patient":null,"visit":null,"locationsAffected":[{"name":"No Location","quantity":50}],"purchasesAffected":[{"id":"CDC3AB7D-A0AD-E146-87A4-FDB1096C2EEC","quantity":50}],"modifiedFields":{"transactionType":"2015-10-30T12:44:28.623Z","quantity":"2015-10-29T08:35:51.497Z","deliveryLocation":"2015-10-29T08:35:51.497Z","deliveryAisle":"2015-10-29T08:35:51.497Z","expenseAccount":"2015-10-29T08:35:51.497Z","dateRequested":"2015-10-29T08:35:51.497Z","requestedBy":"2015-10-29T08:35:51.497Z","status":"2015-10-30T12:44:28.623Z","dateCompleted":"2015-10-30T12:44:28.623Z","adjustPurchases":"2015-10-30T12:44:28.623Z","costPerUnit":"2015-10-30T12:44:28.623Z","quantityAtCompletion":"2015-10-30T12:44:28.623Z","purchasesAffected":"2015-10-30T12:44:28.623Z","locationsAffected":"2015-10-30T12:44:28.623Z","completedBy":"2015-10-30T12:44:28.623Z"}},"_revisions":{"start":2,"ids":["cf9eeeed6d9004aa0479660df622e08c","0e093fbeafc9c59eaeaaf0739ad56e13"]}},{"_id":"inventory_2_igbmk5zf_is","_rev":"2-586df5949f0c9046947fae0fcf009b6f","data":{"description":"Biogesic nga medisina","friendlyId":"m00001","name":"Biogesic","quantity":950,"crossReference":"2600","inventoryType":"Medication","price":5,"reorderPoint":100,"distributionUnit":"tablet","lastModified":"2015-10-30T12:44:28.620Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-29T02:44:10.610Z","inventoryType":"2015-10-29T02:44:10.610Z","crossReference":"2015-10-29T02:44:10.610Z","description":"2015-10-29T02:44:10.610Z","reorderPoint":"2015-10-29T02:44:10.610Z","price":"2015-10-29T02:44:10.610Z","distributionUnit":"2015-10-29T02:44:10.610Z","quantity":"2015-10-30T12:44:28.620Z","friendlyId":"2015-10-29T02:44:10.610Z"},"purchases":["CDC3AB7D-A0AD-E146-87A4-FDB1096C2EEC"],"locations":["B7B86EC1-6CCE-30B7-B4ED-FF2061879E03"]},"_revisions":{"start":2,"ids":["586df5949f0c9046947fae0fcf009b6f","26fffdb13350d70c54f01078f7ea7058"]}},{"_id":"lab_2_8F1C615D-8E59-5090-BC4A-BFA41C57FABE","_rev":"1-5cc96eeacaa8118793770bd5a80f0b4f","data":{"labDate":null,"notes":"Dr ordered another test","requestedBy":"hradmin","requestedDate":"2015-11-03T14:39:16.608Z","result":"Everything is clear","status":"Requested","lastModified":"2015-11-03T14:39:16.920Z","modifiedBy":"hradmin","labType":"5AB262C7-719D-19A6-ADC8-06CBA3088FA8","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"EC9C09F9-676F-AD32-AB61-DDAD615F2632","modifiedFields":{"result":"2015-11-03T14:39:16.920Z","notes":"2015-11-03T14:39:16.920Z","status":"2015-11-03T14:39:16.920Z","requestedBy":"2015-11-03T14:39:16.920Z","requestedDate":"2015-11-03T14:39:16.920Z"},"charges":[]}},{"_id":"lookup_2_aisle_location_list","_rev":"1-7257ef0f361f763b2692f692dab6bb7c","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["C100"]}},{"_id":"lookup_2_expense_account_list","_rev":"1-bb8267ec5987084be9890734e55df7e0","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Accounts"]}},{"_id":"lookup_2_physician_list","_rev":"1-539fb71896153ad54253f5eb86f508cd","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Dr Test"]}},{"_id":"lookup_2_radiologists","_rev":"6-38c1cbc8559ef893d7ebd043e93ce427","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Mr Test","b","cgvhbn","fcgvb","ss","zinyando"]},"_revisions":{"start":6,"ids":["38c1cbc8559ef893d7ebd043e93ce427","515694dee3f8a35894f6287347485e40","10ef5b07a7d56f64ac26e84507484d41","33cff401403de9c1efd0a9edbec7e50b","cb3dd07e07a6fa2f9e9323b7e15c48fd","864e65b754e2ec13fe2eb8c452bce282"]}}]}\n{"seq":74}\n{"docs":[{"_id":"lookup_2_sex","_rev":"1-c433c64d3ecf2a60e4539b1d1dc43d27","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Male"]}},{"_id":"lookup_2_vendor_list","_rev":"1-3b1a6a2565242e3db9cbdb6c579de2af","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Alpha Pharmacy"]}},{"_id":"lookup_2_visit_location_list","_rev":"1-578a5af6fd231a89f2fdeb1baae7036c","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Harare"]}},{"_id":"lookup_2_warehouse_list","_rev":"1-578a5af6fd231a89f2fdeb1baae7036c","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Harare"]}},{"_id":"medication_2_35DC84B9-C25B-4C83-A287-D1DEC2FC6028","_rev":"1-03630e954041324546dba2254b04afd2","data":{"notes":null,"prescription":"60 Biogesic Pills","prescriptionDate":"2015-11-08T22:00:00.000Z","quantity":60,"refills":null,"requestedDate":"2015-11-09T10:09:25.619Z","requestedBy":"hradmin","status":"Requested","lastModified":"2015-11-09T10:09:25.950Z","modifiedBy":"hradmin","inventoryItem":"igbmk5zf_is","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","visit":"5108DC53-4E2D-53C8-A506-E55E554A3643","modifiedFields":{"prescriptionDate":"2015-11-09T10:09:25.950Z","prescription":"2015-11-09T10:09:25.950Z","quantity":"2015-11-09T10:09:25.950Z","status":"2015-11-09T10:09:25.950Z","requestedBy":"2015-11-09T10:09:25.950Z","requestedDate":"2015-11-09T10:09:25.950Z"}}},{"_id":"patient_2_19A03BBC-71F3-9F39-8B18-15773F446731","_rev":"3-c021a07297d99585de08b3fd96719914","_deleted":true,"_revisions":{"start":3,"ids":["c021a07297d99585de08b3fd96719914","a7323c9135948b4689f52c01826affe2","6ed64fbe474b36dac7c8ac071e33786d"]}},{"_id":"patient_2_2D1BEC2C-EA03-E737-9EC9-D2AEAF2C9EE6","_rev":"2-a587941fb557366a6b87122548a9ba0c","_deleted":true,"_revisions":{"start":2,"ids":["a587941fb557366a6b87122548a9ba0c","0048675586c8e2fd24c8cc2edc545769"]}},{"_id":"patient_2_3C01C5E5-7E64-B147-88F9-D127903B31D7","_rev":"4-be8dd294f8df42bcf220e1a4372340fd","_deleted":true,"_revisions":{"start":4,"ids":["be8dd294f8df42bcf220e1a4372340fd","74d74986cffc330788b0fc5e47f40788","1ed40ad430dba87ec4c0773779fac6aa","34e84dc96007fc737d932ebf875ce340"]}},{"_id":"patient_2_423A476C-2012-6339-8FED-D2E404037268","_rev":"4-263b75936a4ead5058dc1e17535c536c","_deleted":true,"_revisions":{"start":4,"ids":["263b75936a4ead5058dc1e17535c536c","12c22dbd6548922b326bd28b2f05ddb0","a4a9b0e7ed53aea140c1d3259c9b1e94","15ebcd46a46d830899afc17450d4b229"]}},{"_id":"patient_2_519E056C-BF04-2A3F-84D2-8963EAD04261","_rev":"2-13e0330c4610ea3dc8a8dcb64a9b61ae","_deleted":true,"_revisions":{"start":2,"ids":["13e0330c4610ea3dc8a8dcb64a9b61ae","193c2c5d9fcb17698411febac4015547"]}},{"_id":"patient_2_5DD90350-3A67-F3B7-BB4A-A6837A667697","_rev":"2-812e681275f7181b96e1428d5b2eb555","_deleted":true,"_revisions":{"start":2,"ids":["812e681275f7181b96e1428d5b2eb555","a9b1e632e8d3f96d106873396f7f04de"]}},{"_id":"patient_2_63165A06-C866-A0C2-BB43-5DE9A0146737","_rev":"2-5989c5e25baace8df71d475ae164bf40","_deleted":true,"_revisions":{"start":2,"ids":["5989c5e25baace8df71d475ae164bf40","4178d1d23fb9d40a647d573026480dad"]}},{"_id":"patient_2_632DBDA3-5DBF-DDCC-A2C6-915E357319BA","_rev":"2-6ce428f8cdb8d1ea864f976c1ade08e4","_deleted":true,"_revisions":{"start":2,"ids":["6ce428f8cdb8d1ea864f976c1ade08e4","abe897a1411af9ce5df82d2ddbe726f2"]}},{"_id":"patient_2_688E30F1-E068-A2E3-8986-C224AF671CDD","_rev":"2-cb950343c60eb7116359fb50dc58fb87","_deleted":true,"_revisions":{"start":2,"ids":["cb950343c60eb7116359fb50dc58fb87","949f54bb01a90f17a91a7b392aecd58e"]}},{"_id":"patient_2_694DF805-F7CD-9513-9EF5-4CF8EE009BE9","_rev":"2-005d256252779d14fb83b9614a75d84f","_deleted":true,"_revisions":{"start":2,"ids":["005d256252779d14fb83b9614a75d84f","79cbdb6ba8075de8b19b61f4ebd194b2"]}},{"_id":"patient_2_9C269C48-EE3E-FBEC-9371-A235EEFDA40E","_rev":"2-6d94af1fdf669e3d012e3370c17c7d0f","_deleted":true,"_revisions":{"start":2,"ids":["6d94af1fdf669e3d012e3370c17c7d0f","ba40f943d16f3594cdf2a1c0e7ce36eb"]}},{"_id":"patient_2_9ED02049-6F10-E89D-9BAA-9C113B3AA6E4","_rev":"2-472c94a0e9c78fde3be4c15a71e0f336","_deleted":true,"_revisions":{"start":2,"ids":["472c94a0e9c78fde3be4c15a71e0f336","c61b0ba276e4c88cfda15ae4b5d0768b"]}},{"_id":"patient_2_B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","_rev":"4-67b555cc65659782ad7e91606805b769","data":{"admitted":true,"address":null,"address2":null,"address3":null,"address4":null,"bloodType":null,"clinic":null,"country":null,"dateOfBirth":null,"economicClassification":null,"email":null,"externalPatientId":null,"familySupport1":null,"familySupport2":null,"familySupport3":null,"familySupport4":null,"familySupport5":null,"friendlyId":"P00017","firstName":"Lennex","sex":"Male","history":null,"insurance":null,"lastName":"Zinyando","livingArrangement":null,"middleName":"","notes":null,"otherIncome":null,"patientType":null,"parent":null,"phone":null,"placeOfBirth":null,"referredDate":null,"referredBy":null,"religion":null,"socialActionTaken":null,"socialRecommendation":null,"status":null,"lastModified":"2016-02-22T22:14:52.397Z","modifiedBy":"Admin User","paymentProfile":null,"payments":[],"modifiedFields":{"friendlyId":"2015-10-06T10:56:52.507Z","firstName":"2015-10-06T10:56:52.507Z","middleName":"2015-10-06T10:56:52.507Z","lastName":"2015-10-06T10:56:52.507Z","admitted":"2015-11-03T07:08:13.749Z","sex":"2016-02-22T22:14:52.397Z"}},"_revisions":{"start":4,"ids":["67b555cc65659782ad7e91606805b769","020fe2a48d4cbfcb78ce17b8dca2808a","09ad83b2ef8b869ecc41360ccee87e05","e5548781a44e741ceac358e5e3413d76"]}},{"_id":"patient_2_BB4E9598-BD8B-528B-9D9E-AD9C3980787B","_rev":"3-957a69aebfae063d61ee8aaa55006803","_deleted":true,"_revisions":{"start":3,"ids":["957a69aebfae063d61ee8aaa55006803","0345093ba84e9c117c7dbb94b45edb8f","3e24d132e3bcc29db9d41a4d9f4296bf"]}},{"_id":"patient_2_C0361670-8B10-F212-9F51-B889D5BF92DF","_rev":"2-7b2217e2c2cb01610c32e0de44910282","_deleted":true,"_revisions":{"start":2,"ids":["7b2217e2c2cb01610c32e0de44910282","13ecb169a07f0e5a78a11209c26ede78"]}},{"_id":"patient_2_C680710A-BFBB-2868-8E5E-F4DD648CA24E","_rev":"2-d9acde506f230ec53a1cff9c97fe58bf","_deleted":true,"_revisions":{"start":2,"ids":["d9acde506f230ec53a1cff9c97fe58bf","9d954090afc2085fb97060446f8e4da0"]}},{"_id":"patient_2_E011AC5D-6F55-A16E-AB47-148E418071EE","_rev":"2-c263c9e9cf93e6d7b98f445b0d800809","_deleted":true,"_revisions":{"start":2,"ids":["c263c9e9cf93e6d7b98f445b0d800809","66c46fd3db8b057d58a35aba6ca99a5a"]}},{"_id":"patient_2_E54A8685-A36F-D1D1-B938-080545EABD0E","_rev":"2-a53992302cf7a33bad522d2dc5835b6e","_deleted":true,"_revisions":{"start":2,"ids":["a53992302cf7a33bad522d2dc5835b6e","5cebaf4e3ffef745a70ef22a1be1f0e8"]}},{"_id":"patient_2_E5EF1B7A-51B7-1610-BFBA-B1B21365C574","_rev":"2-182384c7dc0a26973583a692bfecbce8","_deleted":true,"_revisions":{"start":2,"ids":["182384c7dc0a26973583a692bfecbce8","497eb6ebf5074eeb32e2c02aab754a18"]}},{"_id":"patient_2_F3AA5446-1DE5-AC50-B9CF-B0D491E1D45E","_rev":"2-036325f33884580d2785dadf44527e25","_deleted":true,"_revisions":{"start":2,"ids":["036325f33884580d2785dadf44527e25","9eb866d5ca50209aec98d96470acce98"]}},{"_id":"photo_2_CF5189F1-5BDA-6896-B350-6A1A9B6A217B","_rev":"3-82a9b8e6b9f827259083f9bc560d9ee6","_deleted":true,"_revisions":{"start":3,"ids":["82a9b8e6b9f827259083f9bc560d9ee6","ee9b1e0283b24f4a02b00f92ed70f0ab","5ee18d0589c4ac578fe4e8a5350f725b"]}},{"_id":"photo_2_D2B805B1-8F22-B5D2-956B-AFF6372D18FF","_rev":"3-734e1f5956d3d438f8ba6e187aa4d97f","_deleted":true,"_revisions":{"start":3,"ids":["734e1f5956d3d438f8ba6e187aa4d97f","f574559c84a634ca88d1d10d41c93953","112ad019aa78ef8e06584c9109a9a850"]}},{"_id":"pricing_2_22208FBE-9C6E-079D-A1E6-A562F9310FE5","_rev":"1-7f1b8398ae5dbed5782085efbfdf5ee8","data":{"category":"Imaging","expenseAccount":null,"name":"New","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-15T09:39:37.879Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-15T09:39:37.879Z","category":"2015-10-15T09:39:37.879Z","pricingType":"2015-10-15T09:39:37.879Z"},"pricingOverrides":[]}},{"_id":"pricing_2_4CEB69E7-B54A-9D45-B0EF-7643F0D48FA0","_rev":"1-866a210b1d9063493c97d580845fc13d","data":{"category":"Imaging","expenseAccount":null,"name":"New","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-15T10:37:57.867Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-15T10:37:57.867Z","category":"2015-10-15T10:37:57.867Z","pricingType":"2015-10-15T10:37:57.867Z"},"pricingOverrides":[]}},{"_id":"pricing_2_5AB262C7-719D-19A6-ADC8-06CBA3088FA8","_rev":"1-428c4aeffee433314c955d75e831332b","data":{"category":"Lab","expenseAccount":null,"name":"Chest","price":null,"pricingType":"Lab Procedure","lastModified":"2015-11-03T14:39:16.623Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-11-03T14:39:16.623Z","category":"2015-11-03T14:39:16.623Z","pricingType":"2015-11-03T14:39:16.623Z"},"pricingOverrides":[]}},{"_id":"pricing_2_B492AA26-22F2-52A9-93C7-17106A57A62E","_rev":"1-a03187de833a34d46302b5a740244353","data":{"category":"Imaging","expenseAccount":null,"name":"fghj","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-22T07:08:38.099Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-22T07:08:38.099Z","category":"2015-10-22T07:08:38.099Z","pricingType":"2015-10-22T07:08:38.099Z"},"pricingOverrides":[]}},{"_id":"pricing_2_C8826ADA-C3AC-37CD-84AE-FA86A203AC6E","_rev":"1-fcefadf7300a60430090a0b91df95cce","data":{"category":"Imaging","expenseAccount":null,"name":"dfghn","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-28T07:27:44.358Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-28T07:27:44.358Z","category":"2015-10-28T07:27:44.358Z","pricingType":"2015-10-28T07:27:44.358Z"},"pricingOverrides":[]}},{"_id":"pricing_2_CBB4C9D5-CE8C-2BB5-86F4-3FC16AE2E85D","_rev":"1-a34a6a2d89ae9d5cd57f532f8db1b02f","data":{"category":"Imaging","expenseAccount":null,"name":"hg","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-26T11:49:08.235Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-26T11:49:08.235Z","category":"2015-10-26T11:49:08.235Z","pricingType":"2015-10-26T11:49:08.235Z"},"pricingOverrides":[]}},{"_id":"pricing_2_E53305F3-BA40-B305-B2DC-0732C7AB0042","_rev":"1-5b2724a6d2dce84919a16388a8983a49","data":{"category":"Imaging","expenseAccount":null,"name":"Scan","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-28T07:23:34.851Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-28T07:23:34.851Z","category":"2015-10-28T07:23:34.851Z","pricingType":"2015-10-28T07:23:34.851Z"},"pricingOverrides":[]}},{"_id":"pricing_2_F51616AE-EB96-2778-824F-386DEAFFD2F9","_rev":"1-13d626d1730a99b3da4dee1a25146ddd","data":{"category":"Imaging","expenseAccount":null,"name":"sss","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-10-28T07:31:20.903Z","modifiedBy":"hradmin","modifiedFields":{"name":"2015-10-28T07:31:20.903Z","category":"2015-10-28T07:31:20.903Z","pricingType":"2015-10-28T07:31:20.903Z"},"pricingOverrides":[]}},{"_id":"sequence_2_inventory_Medication","_rev":"1-1acccea88a50973cbe8840a31911aa7c","data":{"prefix":"m","value":1}},{"_id":"sequence_2_patient","_rev":"130-943328c138b701637a579574f516e90b","data":{"prefix":null,"value":130},"_revisions":{"start":130,"ids":["943328c138b701637a579574f516e90b","b527a87cb4f86205dcc62a9ea0fa7a63","973262d1b9be91e82f997cf103481c55","44582fef141bcd8b558595514d3ba0ff","4a8d8f8ca25aa960aef16e5c1e489b81","2a48a9bc803b0d60b5018c07017aedeb","fe6186b5bd38fce211c0dc76ef4a619b","4d41059d2cd8accf225fce92edbbc428","449ad29c390c73126670290e2a351dce","ef33fac6f75c92df977deadcefd2ea21","bde0d0a9a34c662a05458f1d379c6038","4e2b60d439b5001f0562aaa5e836de72","9b7cf30a3a428b0ffbc5c08469b60dc4","fdfa70107c954a955eddc00f1710a412","acb0081b558f7dfc06520ce59abdca9d","b611e8c2f6823f040262e4e983aa8b3e","803c06167d785dca413153687432b9da","e2c71646996df37f91cabb3881395db4","e07b6a9914e89ef9b68e6412801e47db","5c4e63e3ec27823d46d7048c34f1035c","85c90147d202a4eb1a047e2633fdc911","e7dae8e43e473a4b347f5c22161844b4","471182bdd694919456395e3b8ee81d85","c45ce9b872e266344359c0637f9dd5d0","962ad8bf64b30813c4fef6958e83e3f3","5b281c4ea003d026419d35d05dd0b87a","9ed77096845040620cd2354c1ed74001","409143da04d5575669e515f6214f6220","c35ff5c786890aa0005b360749cefdd2","48cba21a512868f2c8e3beb5646ff1c1","58fcaf249567f43db62a1c77a1440b8e","71c619fe66ac2a2246708c6733e7af9e","0e2a21c17d44457443a58dd2db6824fb","7449d0f1ba104902ca08b888dfdc546f","20f7d87b7b4a5326bb93f84c11ae627d","bef379849a35ec5a7408f26a83026e2b","5dd124839c582c23e9279eda6f821796","15a041f1e149ae2989eba580b93969b0","93e7694e1741666512f83bd1bd5064f3","002edd9949b2993af6ce18817d0bc666","a8795752b4a5c9e587d5bbbd05ef41d4","c6f60912813f86724b49110221b713fe","728c2adfea6754b048f7acae42edd25f","b1ddbe8c27e77a561d22fec546349409","923830cdb237b3ba2088779642bca716","85f7e7891658b988333439ee84dfcd39","a52f2c92c951c2c7266a9ad170d3ae9d","79cfca9fdd7b6cdae2396862f103599e","87221151cfb4cb5bbdf73eb694a7eb34","f1c5faf2bc8f82ec5a29071b6156e5e2","84612c5298273469c586955ee8427555","cc81c865b33cf6d967bde9ff60b9af6d","8b16de2d23b9c7e216215085a08caea8","8be1c3c951d7c2355f910f785cac2534","696488469a9aa721643875029f6de938","04ffb420af095d229c45a69d0e1c56c2","f8fc0538d0eacb22a767c9eb449f4c84","6adb4264d4dd3b13829ffc7e17ba58c2","f50856bf682db17eee3d3cafb366a6be","743e61dcfce262c16251ed396ee76eb7","4fcdf09a763ec5da89d41dab6dd9edc8","912874972749c40ea838145828c14173","fd8c5a0d7662b27c8cbdfbfdd45ee32d","173fe5c207973de53fd984078bbd73a2","4e9ef14c62f9312cd0fb1b47e7fabe1e","ce6f1f9584656970cfd92f1e361e2fed","cf8cf83cf02c266b75af0bc69467a07f","5816c2ba418d387facd7b6ed0a0e6054","b3839c763f128f2ccf99cfb874a2413e","68b05605500c0109d046a56680a5a7a1","a13d320fed2c85ed0b173d6645ec0274","ba1dad02a90e4ac18632c1a53a90b759","c5e7e81e97d0fc7d0797bd9822685176","b580fcf4f4291b408f4dda64a4bdec96","bb1a562af157e3c24d23c3e2f1171b29","e9f245d9566dd9e116caf7d074792d36","30b587f2b5204d237572c86a545756fb","7df53a1742b52647118fec21f331e94d","0a4c120f78fa5899d0cea5d87d92c9b0","e62f1b02721a75fd1ea290da9acdc199","3e39b429ea4cda00c9ac9d3f0b61029c","038d82911c8979c0cd58e807871a09ca","618d916a14cfa55aa8e65d42b3761ca5","8d24a6b355e64a680f0f03ab0f738b8c","999e1fa6e5175dad02e4f2db0cd41843","782e7a1c4097f1aa1d117a7fbd01c443","67b3c03ea8609652c494a22242ce5a1f","3b1fc1b83a352ef9c672110a69306064","8a0da1966531daede44592906bf8df99","279e844131c96ca7b647cacfa3508022","42733f5f658de7ee440c02286fd4e21c","e3a50044a3cb2ac901b5b65653d0fc7f","b7fb5627bee7f642f8e608be1bb1e859","2fdb16832a0ed61b7f9e780750b70898","e38f4adbab987a8c628599ea9052ca44","7ece3f9fcff7b57b28f1237ba1107a0f","8fb6c171e3c6a345d199a8884e42951a","c76709145ca58dfcf67c1f397b772689","76182e657f0b0aa6fa07bf5491d2b427","ab161b88c332f3df338f1f4aa2b2e307","e00a3184b07c0459cf4ebdeb825f991f","cee6a3aac677927abaf3ae61508954a2","86bed2b62e1e6b6f98790ecafefcc17f","ae44899fdbc41d69076ec6a8f7563181","61cce97f5cd6ff092f28fe9ec9da4f27","f9008b952322c32322ef0e7e42fdf383","8fdecd159563a90d7cbc9c9aedc3068f","9b1f0f8f0e4db1f8931d290966f3bc3c","a9b5402ea07343a1b6d5612312e07a34","25ef3d2573778c3ebda4ef7860fe310f","3e39e8d6ceabb2079042e81613858906","b4e15c555737aa9573724407ce84b667","b2538362e8afb57e3e11e5231ae60d5d","04add3d3926f54232b0e0ed7a9fc141a","e924dcf4bb51c7c552538273e08901bb","77b6f226033c656d3a9768085ff3e80a","676dd4835b46e8f62ec2ce5908d1c60a","762481b2c71611cce80a5a9ef03aa48d","b9b73bf1d2df1598cc164089375ed7bc","0a581f677e6d8f7a484fa0a80156d95b","6b51cfdb83336973df284e4d5c2f308b","4a27247e93fabb86b6a5a9676f47ec8e","8b542908965798dd683a68f507635a83","515d8987a1e11acb866ede87612b53b1","d19e3759adc65398cf6a42a61345cdae","ac63c129bee25dc4c59a639e2721fb81","17c1209032c06df436ad0a4fa76723cc","f0ef6923c78e739d9228517a4813b646","f9a8fd6c55cd4e5fb0064b7767586e05","5bc31ffefa482f2e66299cf0704623c8"]}},{"_id":"visit_2_0312A352-EF8B-C1A2-B9DF-3EC932C96AD8","_rev":"2-8eb7818cb7b808ea467b2e60f0a6a5e2","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Discharged","visitType":"Admission","lastModified":"2015-11-03T07:43:21.662Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:31:15.853Z","startDate":"2015-11-03T07:31:15.853Z","status":"2015-11-03T07:43:21.662Z","outPatient":"2015-11-03T07:31:15.853Z","endDate":"2015-11-03T07:43:21.662Z","location":"2015-11-03T07:31:15.853Z","examiner":"2015-11-03T07:31:15.853Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["8eb7818cb7b808ea467b2e60f0a6a5e2","3036466a87ec0a9967be1433386b0bdc"]}},{"_id":"visit_2_07AF1E0E-3CB2-3837-990C-968158E25235","_rev":"1-ce894ba889d506531e4cb2a36394cab4","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:46:16.594Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:46:16.594Z","startDate":"2015-11-03T07:46:16.594Z","status":"2015-11-03T07:46:16.594Z","outPatient":"2015-11-03T07:46:16.594Z","endDate":"2015-11-03T07:46:16.594Z","location":"2015-11-03T07:46:16.594Z","examiner":"2015-11-03T07:46:16.594Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_0B84AF59-A182-5840-9E7A-CEF7633D4071","_rev":"1-ce3b40be34d77ec1d9c29ccb99a7e905","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:37:46.164Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:37:46.164Z","startDate":"2015-11-03T07:37:46.164Z","status":"2015-11-03T07:37:46.164Z","outPatient":"2015-11-03T07:37:46.164Z","endDate":"2015-11-03T07:37:46.164Z","location":"2015-11-03T07:37:46.164Z","examiner":"2015-11-03T07:37:46.164Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_0BD42BD9-0E5D-0533-A8FA-1C0ADB0F0D65","_rev":"2-0ddd43cbcc57cc5d6ff082a283d881ac","data":{"dischargeInfo":null,"endDate":"2015-10-15T10:37:57.902Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-15T10:37:57.902Z","status":null,"visitType":"Imaging","lastModified":"2015-10-15T10:37:57.915Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-15T10:37:57.915Z","endDate":"2015-10-15T10:37:57.915Z","outPatient":"2015-10-15T10:37:57.915Z","visitType":"2015-10-15T10:37:57.915Z"},"charges":[],"imaging":["1AC1DD3D-E7E7-15B4-A698-8A8AE62749EB"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["0ddd43cbcc57cc5d6ff082a283d881ac","e4540f9cf2a236335662116d4e0a66da"]}},{"_id":"visit_2_13340816-9F02-846D-85C3-C3278561BA23","_rev":"1-6ce02a99e4868c5a5bdb88a23f9ff400","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:24:20.451Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:24:20.451Z","startDate":"2015-11-03T07:24:20.451Z","status":"2015-11-03T07:24:20.451Z","outPatient":"2015-11-03T07:24:20.451Z","endDate":"2015-11-03T07:24:20.451Z","location":"2015-11-03T07:24:20.451Z","examiner":"2015-11-03T07:24:20.451Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_15759FA2-6691-6EF3-9636-21570F400F04","_rev":"1-d28274492b5b3cd306c3d38e535388a7","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:38:17.049Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:38:17.049Z","startDate":"2015-11-03T07:38:17.049Z","status":"2015-11-03T07:38:17.049Z","outPatient":"2015-11-03T07:38:17.049Z","endDate":"2015-11-03T07:38:17.049Z","location":"2015-11-03T07:38:17.049Z","examiner":"2015-11-03T07:38:17.049Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_17AB2BCF-5F9F-30FB-8B80-9FB82E51D0B3","_rev":"1-bc13c64ebb47144840cc91ce3087ebd6","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:23:03.461Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:23:03.461Z","startDate":"2015-11-03T07:23:03.461Z","status":"2015-11-03T07:23:03.461Z","outPatient":"2015-11-03T07:23:03.461Z","endDate":"2015-11-03T07:23:03.461Z","location":"2015-11-03T07:23:03.461Z","examiner":"2015-11-03T07:23:03.461Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_1800A65C-861C-CCA5-85C5-16950322C7E0","_rev":"1-a67e8d8a018844ef176184947055b683","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:40:08.177Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:40:08.177Z","startDate":"2015-11-03T07:40:08.177Z","status":"2015-11-03T07:40:08.177Z","outPatient":"2015-11-03T07:40:08.177Z","endDate":"2015-11-03T07:40:08.177Z","location":"2015-11-03T07:40:08.177Z","examiner":"2015-11-03T07:40:08.177Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_1EBA7E42-F96D-C5E2-923C-2F842FDFE714","_rev":"1-8fd6cfa23288f7394ce94970c4b3a8c2","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:19:45.676Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:19:45.676Z","startDate":"2015-11-03T07:19:45.676Z","status":"2015-11-03T07:19:45.676Z","outPatient":"2015-11-03T07:19:45.676Z","endDate":"2015-11-03T07:19:45.676Z","location":"2015-11-03T07:19:45.676Z","examiner":"2015-11-03T07:19:45.676Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_2D795EA3-DAEF-AA15-8846-607A873AD1AF","_rev":"1-4c665c9221069fe72f9d66ac458e92df","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:28:51.490Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:28:51.490Z","startDate":"2015-11-03T07:28:51.490Z","status":"2015-11-03T07:28:51.490Z","outPatient":"2015-11-03T07:28:51.490Z","endDate":"2015-11-03T07:28:51.490Z","location":"2015-11-03T07:28:51.490Z","examiner":"2015-11-03T07:28:51.490Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_377AA288-AAD4-F60B-ABD1-B5A0B9C75D50","_rev":"2-ee5b0686e20e1011d11b3051b93e7a93","data":{"dischargeInfo":null,"endDate":"2015-10-15T09:39:37.940Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-15T09:39:37.940Z","status":null,"visitType":"Imaging","lastModified":"2015-10-15T09:39:37.948Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-15T09:39:37.948Z","endDate":"2015-10-15T09:39:37.948Z","outPatient":"2015-10-15T09:39:37.948Z","visitType":"2015-10-15T09:39:37.948Z"},"charges":[],"imaging":["07CC6746-C7D9-A410-9B8C-C4B4E095A96D"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["ee5b0686e20e1011d11b3051b93e7a93","5fee255cf57220ddf1c19977118a540e"]}},{"_id":"visit_2_3A8FE46D-2CE6-C74E-98BB-ECFECB8F4AB9","_rev":"1-4c2559b35790501b6fae26a031a59cad","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:42:11.759Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:42:11.759Z","startDate":"2015-11-03T07:42:11.759Z","status":"2015-11-03T07:42:11.759Z","outPatient":"2015-11-03T07:42:11.759Z","endDate":"2015-11-03T07:42:11.759Z","location":"2015-11-03T07:42:11.759Z","examiner":"2015-11-03T07:42:11.759Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_50FD1C68-0889-0867-99D1-CFFDB3223154","_rev":"1-85d776e0088793e80073525cf6b7a501","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:47:59.399Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:47:59.399Z","startDate":"2015-11-03T07:47:59.399Z","status":"2015-11-03T07:47:59.399Z","outPatient":"2015-11-03T07:47:59.399Z","endDate":"2015-11-03T07:47:59.399Z","location":"2015-11-03T07:47:59.399Z","examiner":"2015-11-03T07:47:59.399Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}}]}\n{"seq":124}\n{"docs":[{"_id":"visit_2_5108DC53-4E2D-53C8-A506-E55E554A3643","_rev":"2-884c940bde0d28898a94bb3d118fe89f","data":{"dischargeInfo":null,"endDate":"2015-11-09T10:09:25.619Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-09T10:09:25.619Z","status":null,"visitType":"Pharmacy","lastModified":"2015-11-09T10:09:25.628Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-11-09T10:09:25.628Z","endDate":"2015-11-09T10:09:25.628Z","outPatient":"2015-11-09T10:09:25.628Z","visitType":"2015-11-09T10:09:25.628Z"},"charges":[],"imaging":[],"labs":[],"medication":["35DC84B9-C25B-4C83-A287-D1DEC2FC6028"],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["884c940bde0d28898a94bb3d118fe89f","d84c4b4dda04554d6e41ca7e6368cc3d"]}},{"_id":"visit_2_53E986EB-4C23-9B3B-B8D7-2C7A7ECDBC33","_rev":"1-fb5ce8d11793c3da21e06d1f88e48d00","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:23:24.134Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:23:24.134Z","startDate":"2015-11-03T07:23:24.134Z","status":"2015-11-03T07:23:24.134Z","outPatient":"2015-11-03T07:23:24.134Z","endDate":"2015-11-03T07:23:24.134Z","location":"2015-11-03T07:23:24.134Z","examiner":"2015-11-03T07:23:24.134Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_542BB0F0-27BB-7C5C-99BC-28B013DDB837","_rev":"1-6e3af7515e9b2d7fbcec6264b9194a17","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:32:40.937Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:32:40.937Z","startDate":"2015-11-03T07:32:40.937Z","status":"2015-11-03T07:32:40.937Z","outPatient":"2015-11-03T07:32:40.937Z","endDate":"2015-11-03T07:32:40.937Z","location":"2015-11-03T07:32:40.937Z","examiner":"2015-11-03T07:32:40.937Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_560E25D9-9736-BA05-B2A6-4555A93B2628","_rev":"2-04c2d6343f6d2a10ad1f891718cecab5","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:08:13.698Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:08:13.698Z","startDate":"2015-11-03T07:08:13.698Z","status":"2015-11-03T07:08:13.698Z","outPatient":"2015-11-03T07:08:13.698Z","endDate":"2015-11-03T07:08:13.698Z","location":"2015-11-03T07:08:13.698Z","examiner":"2015-11-03T07:08:13.698Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["04c2d6343f6d2a10ad1f891718cecab5","6bbe45974af0b60410ea29026a38e2ec"]}},{"_id":"visit_2_59F8FB60-9956-E93F-826D-11618BC95E13","_rev":"1-8489694a221cd2c43e7c39fdcaa89700","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:41:35.597Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:41:35.597Z","startDate":"2015-11-03T07:41:35.597Z","status":"2015-11-03T07:41:35.597Z","outPatient":"2015-11-03T07:41:35.597Z","endDate":"2015-11-03T07:41:35.597Z","location":"2015-11-03T07:41:35.597Z","examiner":"2015-11-03T07:41:35.597Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_5F404B11-D8B6-CE18-9557-2B563BCFD2F8","_rev":"1-2637dc1d6c95364743de0c97c7fb443d","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:34:38.929Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:34:38.929Z","startDate":"2015-11-03T07:34:38.929Z","status":"2015-11-03T07:34:38.929Z","outPatient":"2015-11-03T07:34:38.929Z","endDate":"2015-11-03T07:34:38.929Z","location":"2015-11-03T07:34:38.929Z","examiner":"2015-11-03T07:34:38.929Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_6AD00ED1-670A-2C3F-BC10-0742B1F99264","_rev":"2-9bf9856192b6c8ef34d2fcdb27296593","data":{"dischargeInfo":null,"endDate":"2015-10-28T07:39:18.257Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-28T07:39:18.257Z","status":null,"visitType":"Imaging","lastModified":"2015-10-28T07:39:18.275Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-28T07:39:18.275Z","endDate":"2015-10-28T07:39:18.275Z","outPatient":"2015-10-28T07:39:18.275Z","visitType":"2015-10-28T07:39:18.275Z"},"charges":[],"imaging":["91B061E9-2986-D539-90C8-CD14EC2010B0"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["9bf9856192b6c8ef34d2fcdb27296593","e50477b58f5edd257b9ce20ea65b1bca"]}},{"_id":"visit_2_6D126583-2852-25C2-A352-E5BA4CBBD106","_rev":"1-222d722266f5d407204eb411f68ab4f0","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:20:56.778Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:20:56.778Z","startDate":"2015-11-03T07:20:56.778Z","status":"2015-11-03T07:20:56.778Z","outPatient":"2015-11-03T07:20:56.778Z","endDate":"2015-11-03T07:20:56.778Z","location":"2015-11-03T07:20:56.778Z","examiner":"2015-11-03T07:20:56.778Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_74A4EF68-5D8D-BDF6-940F-33E50E50DDEA","_rev":"2-c24a52b04610b293fff293b18dd0bb15","data":{"dischargeInfo":null,"endDate":"2015-10-28T07:27:44.394Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-28T07:27:44.394Z","status":null,"visitType":"Imaging","lastModified":"2015-10-28T07:27:44.406Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-28T07:27:44.406Z","endDate":"2015-10-28T07:27:44.406Z","outPatient":"2015-10-28T07:27:44.406Z","visitType":"2015-10-28T07:27:44.406Z"},"charges":[],"imaging":["EA6B989C-90B7-2E08-9D8F-CE4339BB9B4B"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["c24a52b04610b293fff293b18dd0bb15","5a6ae8f033eb99448ad898f164d822e8"]}},{"_id":"visit_2_7916D533-54AE-55EB-8DE7-E4B83A4BBAB2","_rev":"1-269d23778ac6f89244ff93d17c73352c","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:46:45.358Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:46:45.358Z","startDate":"2015-11-03T07:46:45.358Z","status":"2015-11-03T07:46:45.358Z","outPatient":"2015-11-03T07:46:45.358Z","endDate":"2015-11-03T07:46:45.358Z","location":"2015-11-03T07:46:45.358Z","examiner":"2015-11-03T07:46:45.358Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_817CE5FB-FF79-B05D-8296-2FCE91B125CD","_rev":"1-410079742e88e59e0598107fd9ef40c1","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:33:16.393Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:33:16.393Z","startDate":"2015-11-03T07:33:16.393Z","status":"2015-11-03T07:33:16.393Z","outPatient":"2015-11-03T07:33:16.393Z","endDate":"2015-11-03T07:33:16.393Z","location":"2015-11-03T07:33:16.393Z","examiner":"2015-11-03T07:33:16.393Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_90FCADB8-7109-3906-94A3-269F29CFAB69","_rev":"1-7a8189c07dde6b9bf498545cdaa3e621","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:31:49.176Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:31:49.176Z","startDate":"2015-11-03T07:31:49.176Z","status":"2015-11-03T07:31:49.176Z","outPatient":"2015-11-03T07:31:49.176Z","endDate":"2015-11-03T07:31:49.176Z","location":"2015-11-03T07:31:49.176Z","examiner":"2015-11-03T07:31:49.176Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_9C962DF7-E239-966B-A47B-15F405899B62","_rev":"1-d5bc412bfa629333e6cd79c978ea8218","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:25:27.802Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:25:27.802Z","startDate":"2015-11-03T07:25:27.802Z","status":"2015-11-03T07:25:27.802Z","outPatient":"2015-11-03T07:25:27.802Z","endDate":"2015-11-03T07:25:27.802Z","location":"2015-11-03T07:25:27.802Z","examiner":"2015-11-03T07:25:27.802Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_9E627361-BA73-210A-8E76-2FA13B559DB9","_rev":"1-30a87dbc678b99d42b1a90bebff97834","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:21:48.053Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:21:48.053Z","startDate":"2015-11-03T07:21:48.053Z","status":"2015-11-03T07:21:48.053Z","outPatient":"2015-11-03T07:21:48.053Z","endDate":"2015-11-03T07:21:48.053Z","location":"2015-11-03T07:21:48.053Z","examiner":"2015-11-03T07:21:48.053Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_9F1A65ED-683F-056E-8D50-A8AF63201CE2","_rev":"2-e19734a8deff62722e6e023af4b8e130","data":{"dischargeInfo":null,"endDate":"2015-10-22T07:08:38.175Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-22T07:08:38.175Z","status":null,"visitType":"Imaging","lastModified":"2015-10-22T07:08:38.189Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-22T07:08:38.189Z","endDate":"2015-10-22T07:08:38.189Z","outPatient":"2015-10-22T07:08:38.189Z","visitType":"2015-10-22T07:08:38.189Z"},"charges":[],"imaging":["D0F299E4-CD8D-557D-8C23-216FD23EF844"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["e19734a8deff62722e6e023af4b8e130","bd81a41820526c8c0450ee544867c6fa"]}},{"_id":"visit_2_A6E37F8D-F740-8B01-93C9-D476A886E030","_rev":"1-d094eb56a680b4a8a6a354bd48d6bfe2","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:42:53.782Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:42:53.782Z","startDate":"2015-11-03T07:42:53.782Z","status":"2015-11-03T07:42:53.782Z","outPatient":"2015-11-03T07:42:53.782Z","endDate":"2015-11-03T07:42:53.782Z","location":"2015-11-03T07:42:53.782Z","examiner":"2015-11-03T07:42:53.782Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_AAB85ADA-7058-DF7A-9244-C6B60A2EF743","_rev":"1-1bd78b61646023aacce18b1efaa27646","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:39:09.272Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:39:09.272Z","startDate":"2015-11-03T07:39:09.272Z","status":"2015-11-03T07:39:09.272Z","outPatient":"2015-11-03T07:39:09.272Z","endDate":"2015-11-03T07:39:09.272Z","location":"2015-11-03T07:39:09.272Z","examiner":"2015-11-03T07:39:09.272Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_C15054D2-D062-DB01-A96D-80ED1B8F8CBD","_rev":"1-5a9a0e7eafe911586556666ad1a2bd27","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:46:09.735Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:46:09.735Z","startDate":"2015-11-03T07:46:09.735Z","status":"2015-11-03T07:46:09.735Z","outPatient":"2015-11-03T07:46:09.735Z","endDate":"2015-11-03T07:46:09.735Z","location":"2015-11-03T07:46:09.735Z","examiner":"2015-11-03T07:46:09.735Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_C5C296AC-E238-CBA5-8DD8-99942843BC5A","_rev":"2-57e6740d8dac593d790cd7f76c4ad0c3","data":{"dischargeInfo":null,"endDate":"2015-10-26T11:49:08.277Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-26T11:49:08.277Z","status":null,"visitType":"Imaging","lastModified":"2015-10-26T11:49:08.282Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-26T11:49:08.282Z","endDate":"2015-10-26T11:49:08.282Z","outPatient":"2015-10-26T11:49:08.282Z","visitType":"2015-10-26T11:49:08.282Z"},"charges":[],"imaging":["4A7FC838-0B37-E151-AFD8-8DBAC9DE9D99"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["57e6740d8dac593d790cd7f76c4ad0c3","253e8d9f8c0865cb3e9ffd1f6849bcde"]}},{"_id":"visit_2_CBFA5C2C-191D-FC9C-AD19-14D26D5A3003","_rev":"2-f781f118fd87b036d8cbfbf7771cda99","data":{"dischargeInfo":null,"endDate":"2015-10-28T07:23:34.906Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-28T07:23:34.906Z","status":null,"visitType":"Imaging","lastModified":"2015-10-28T07:23:34.914Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-28T07:23:34.914Z","endDate":"2015-10-28T07:23:34.914Z","outPatient":"2015-10-28T07:23:34.914Z","visitType":"2015-10-28T07:23:34.914Z"},"charges":[],"imaging":["51D8DC28-78EB-62B1-942A-1158F5862F34"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["f781f118fd87b036d8cbfbf7771cda99","e2b8bf1f76ea01c32b414c184905511e"]}},{"_id":"visit_2_D6938BD3-6346-F62B-8B19-5207B2E5A6AF","_rev":"2-631f62b5121ccfcd1a8de2bc9d3d252f","data":{"dischargeInfo":null,"endDate":"2015-10-28T07:31:20.941Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-10-28T07:31:20.941Z","status":null,"visitType":"Imaging","lastModified":"2015-10-28T07:31:20.953Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-10-28T07:31:20.953Z","endDate":"2015-10-28T07:31:20.953Z","outPatient":"2015-10-28T07:31:20.953Z","visitType":"2015-10-28T07:31:20.953Z"},"charges":[],"imaging":["DBE152F6-9508-2E12-81AC-39BC2CAFE08C"],"labs":[],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["631f62b5121ccfcd1a8de2bc9d3d252f","8b46887d52e3043d742262fc03ff48b8"]}},{"_id":"visit_2_D845EA6E-C4CD-3657-A6F6-3E40FE02B069","_rev":"1-16657f6b4014bf268d63323ed8832a56","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:50:55.344Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:50:55.344Z","startDate":"2015-11-03T07:50:55.344Z","status":"2015-11-03T07:50:55.344Z","outPatient":"2015-11-03T07:50:55.344Z","endDate":"2015-11-03T07:50:55.344Z","location":"2015-11-03T07:50:55.344Z","examiner":"2015-11-03T07:50:55.344Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_DA661CAB-1BB5-3119-B9DD-0A92D7C3913B","_rev":"1-ecb23bc4c60a32dd627969637f85d1fb","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:19:15.689Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:19:15.689Z","startDate":"2015-11-03T07:19:15.689Z","status":"2015-11-03T07:19:15.689Z","outPatient":"2015-11-03T07:19:15.689Z","endDate":"2015-11-03T07:19:15.689Z","location":"2015-11-03T07:19:15.689Z","examiner":"2015-11-03T07:19:15.689Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_E66983BC-BFB9-E361-A59F-AAC966A0FD3B","_rev":"1-8d0f4af9593120f2dfd0371303239e2b","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:15:24.456Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:15:24.456Z","startDate":"2015-11-03T07:15:24.456Z","status":"2015-11-03T07:15:24.456Z","outPatient":"2015-11-03T07:15:24.456Z","endDate":"2015-11-03T07:15:24.456Z","location":"2015-11-03T07:15:24.456Z","examiner":"2015-11-03T07:15:24.456Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_E8E7BD06-13EB-AA68-BBE2-51B9EEE85257","_rev":"1-c54a6aea31c6c3805edc706b4ed64d40","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:30:31.501Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:30:31.501Z","startDate":"2015-11-03T07:30:31.501Z","status":"2015-11-03T07:30:31.501Z","outPatient":"2015-11-03T07:30:31.501Z","endDate":"2015-11-03T07:30:31.501Z","location":"2015-11-03T07:30:31.501Z","examiner":"2015-11-03T07:30:31.501Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_E90C9A07-74D2-0589-8DDC-C94B09E0F238","_rev":"1-7a3d4f0d4056960dabad849d1da9bd7c","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:22:15.702Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:22:15.702Z","startDate":"2015-11-03T07:22:15.702Z","status":"2015-11-03T07:22:15.702Z","outPatient":"2015-11-03T07:22:15.702Z","endDate":"2015-11-03T07:22:15.702Z","location":"2015-11-03T07:22:15.702Z","examiner":"2015-11-03T07:22:15.702Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_EC9C09F9-676F-AD32-AB61-DDAD615F2632","_rev":"2-8ce10f08748bebcd2df0267258ec2433","data":{"dischargeInfo":null,"endDate":"2015-11-03T14:39:16.671Z","examiner":null,"history":null,"historySince":null,"location":null,"notes":null,"outPatient":true,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-03T14:39:16.671Z","status":null,"visitType":"Lab","lastModified":"2015-11-03T14:39:16.679Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"startDate":"2015-11-03T14:39:16.679Z","endDate":"2015-11-03T14:39:16.679Z","outPatient":"2015-11-03T14:39:16.679Z","visitType":"2015-11-03T14:39:16.679Z"},"charges":[],"imaging":[],"labs":["8F1C615D-8E59-5090-BC4A-BFA41C57FABE"],"medication":[],"procedures":[],"vitals":[]},"_revisions":{"start":2,"ids":["8ce10f08748bebcd2df0267258ec2433","4a113155a529e6200ba18813cd922ad0"]}},{"_id":"visit_2_EF0D793D-346D-242A-8F4D-589448DA49A6","_rev":"1-413ff66d683c532d2be4cfa04632343c","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:26:35.010Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:26:35.010Z","startDate":"2015-11-03T07:26:35.010Z","status":"2015-11-03T07:26:35.010Z","outPatient":"2015-11-03T07:26:35.010Z","endDate":"2015-11-03T07:26:35.010Z","location":"2015-11-03T07:26:35.010Z","examiner":"2015-11-03T07:26:35.010Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}},{"_id":"visit_2_F9D51E3F-E938-1F24-9B19-D76F03E56892","_rev":"1-9e4fb077c716ccd6b149953e4c005aae","data":{"dischargeInfo":null,"endDate":"2015-11-02T22:00:00.000Z","examiner":"Dr Test","history":null,"historySince":null,"location":"Harare","notes":null,"outPatient":false,"primaryDiagnosis":null,"primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-11-02T22:00:00.000Z","status":"Admitted","visitType":"Admission","lastModified":"2015-11-03T07:17:22.667Z","modifiedBy":"hradmin","patient":"B4D3E9EE-6EC0-6F1E-A397-87D9A8F8C13D","modifiedFields":{"visitType":"2015-11-03T07:17:22.667Z","startDate":"2015-11-03T07:17:22.667Z","status":"2015-11-03T07:17:22.667Z","outPatient":"2015-11-03T07:17:22.667Z","endDate":"2015-11-03T07:17:22.667Z","location":"2015-11-03T07:17:22.667Z","examiner":"2015-11-03T07:17:22.667Z"},"charges":[],"imaging":[],"labs":[],"medication":[],"procedures":[],"vitals":[]}}]}\n{"seq":153}\n';});
define('hospitalrun/tests/fixtures/operative', ['exports'], function (exports) {
  exports['default'] = '{"version":"1.2.5","db_type":"http","start_time":"2017-03-16T14:45:48.979Z","db_info":{"db_name":"main","doc_count":34,"doc_del_count":0,"update_seq":35,"purge_seq":0,"compact_running":false,"disk_size":77928,"data_size":23437,"instance_start_time":"1489675508563860","disk_format_version":6,"committed_update_seq":35,"host":"http://localhost:5984/main/","auto_compaction":false,"adapter":"http"}}\n{"docs":[{"_id":"_design/appointments_by_date","_rev":"1-5df29f1d7dbd39d6b3a2145923ab73cf","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}}]}\n{"seq":2}\n{"docs":[{"_id":"_design/custom_form_by_type","_rev":"1-ddf0ee75c1e8e859d821a9f5c1ec43b6","version":1,"views":{"custom_form_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'customForm\') {\\n        emit(doc.data.formType);\\n      }\\n    }\\n  }"}}}]}\n{"seq":3}\n{"docs":[{"_id":"_design/appointments_by_patient","_rev":"1-9a97acd5b8fd071ad81afc9e730721c5","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate,doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/closed_incidents_by_user","_rev":"1-bf16176c13be57af9a4f1a0980710190","version":1,"views":{"closed_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status === \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}}},{"_id":"_design/imaging_by_status","_rev":"1-1a3bab3d2d1403299a9e4ad8dffe5fa1","version":4,"views":{"imaging_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'imaging\') {\\n        var imagingDate = doc.data.imagingDate;\\n    if (imagingDate && imagingDate !== \\"\\") {\\n      imagingDate = new Date(imagingDate);\\n      if (imagingDate.getTime) {\\n        imagingDate = imagingDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, imagingDate, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/incident_by_date","_rev":"1-59fa59734ee129cff0560b20a95d2d4e","version":1,"views":{"incident_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        var dateOfIncident = doc.data.dateOfIncident;\\n    if (dateOfIncident && dateOfIncident !== \\"\\") {\\n      dateOfIncident = new Date(dateOfIncident);\\n      if (dateOfIncident.getTime) {\\n        dateOfIncident = dateOfIncident.getTime();\\n      }\\n    }\\n    emit([dateOfIncident, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/incident_by_friendly_id","_rev":"1-885a12b67da47e956bc190fe1fe0d4e6","version":1,"views":{"incident_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_by_friendly_id","_rev":"1-82e24378f074a284cae14da4db5431ed","version":1,"views":{"inventory_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_by_name","_rev":"1-91f55ae6bd30f766d9da95bffe054bcb","version":5,"views":{"inventory_by_name":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.name, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/inventory_by_type","_rev":"1-18455500e1e86544edceaab01bb511bc","version":5,"views":{"inventory_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit(doc.data.inventoryType);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-0d7b597aeae746589980b12903768252","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invPurchase\') {\\n        var dateReceived = doc.data.dateReceived;\\n    if (dateReceived && dateReceived !== \\"\\") {\\n      dateReceived = new Date(dateReceived);\\n      if (dateReceived.getTime) {\\n        dateReceived = dateReceived.getTime();\\n      }\\n    }\\n    emit([dateReceived, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-1f41dd6d030c58884d7013ef9436decb","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invPurchase\') {\\n        var expirationDate = doc.data.expirationDate;\\n    if (expirationDate && expirationDate !== \\"\\") {\\n      expirationDate = new Date(expirationDate);\\n      if (expirationDate.getTime) {\\n        expirationDate = expirationDate.getTime();\\n      }\\n    }\\n    emit([expirationDate, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_request_by_item","_rev":"1-021f4c24b5b6202594f610cf5d4c63a4","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invRequest\') {\\n        var dateCompleted = doc.data.dateCompleted;\\n    if (dateCompleted && dateCompleted !== \\"\\") {\\n      dateCompleted = new Date(dateCompleted);\\n      if (dateCompleted.getTime) {\\n        dateCompleted = dateCompleted.getTime();\\n      }\\n    }\\n    emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_request_by_status","_rev":"1-cc0c1e0e01060aa62456d6ea768d8ec7","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invRequest\') {\\n        var dateCompleted = doc.data.dateCompleted;\\n    if (dateCompleted && dateCompleted !== \\"\\") {\\n      dateCompleted = new Date(dateCompleted);\\n      if (dateCompleted.getTime) {\\n        dateCompleted = dateCompleted.getTime();\\n      }\\n    }\\n    emit([doc.data.status, dateCompleted, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/invoice_by_patient","_rev":"1-9f67a58d4e428614844ac82cb2548268","version":1,"views":{"invoice_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invoice\') {\\n        emit(doc.data.patient);\\n      }\\n    }\\n  }"}}},{"_id":"_design/invoice_by_status","_rev":"1-d411e6f66f897f0b9b985dc6e5188d85","version":4,"views":{"invoice_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invoice\') {\\n        var billDate = doc.data.billDate;\\n    if (billDate && billDate !== \\"\\") {\\n      billDate = new Date(billDate);\\n      if (billDate.getTime) {\\n        billDate = billDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, billDate, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/lab_by_status","_rev":"1-7d4de6e219b482171b7ecd485ef72238","version":4,"views":{"lab_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'lab\') {\\n        var labDate = doc.data.labDate;\\n    if (labDate && labDate !== \\"\\") {\\n      labDate = new Date(labDate);\\n      if (labDate.getTime) {\\n        labDate = labDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, labDate, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/medication_by_status","_rev":"1-a6403c53b2db46905b3b1861120c6601","version":4,"views":{"medication_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'medication\') {\\n        var prescriptionDate = doc.data.prescriptionDate;\\n    if (prescriptionDate && prescriptionDate !== \\"\\") {\\n      prescriptionDate = new Date(prescriptionDate);\\n      if (prescriptionDate.getTime) {\\n        prescriptionDate = prescriptionDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/open_incidents_by_user","_rev":"1-34770efd210920a30c96d3787521e8a5","version":1,"views":{"open_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status !== \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      }\\n      return 0; // Don\'t sort\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/patient_by_admission","_rev":"1-3c2da4380d257c95ebf4430afa48de3b","version":4,"views":{"patient_by_admission":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.admitted === true) {\\n      if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/patient_by_display_id","_rev":"1-8a6930002af6d588ecdedd5f07da0230","version":7,"views":{"patient_by_display_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/patient_by_status","_rev":"1-54bc74ff93db4aedff83bc649f766596","version":3,"views":{"patient_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        emit(doc.data.status);\\n      }\\n    }\\n  }"}}},{"_id":"_design/photo_by_patient","_rev":"1-6a4fad4fa682efbbd058e858c328574f","version":4,"views":{"photo_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'photo\') {\\n        emit(doc.data.patient);\\n      }\\n    }\\n  }"}}},{"_id":"_design/pricing_by_category","_rev":"1-3d703b5f240ae5838d1f20a8ad0471de","version":5,"views":{"pricing_by_category":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'pricing\') {\\n        emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/procedure_by_date","_rev":"1-a44decd8f14d01c615cf3f5b8e70f10b","version":4,"views":{"procedure_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'procedure\') {\\n        var procedureDate = doc.data.procedureDate;\\n    if (procedureDate && procedureDate !== \\"\\") {\\n      procedureDate = new Date(procedureDate);\\n      if (procedureDate.getTime) {\\n        procedureDate = procedureDate.getTime();\\n      }\\n    }\\n    emit([procedureDate, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/report_by_visit","_rev":"1-1295cef10df82554859efdb4c38c1c1e","version":1,"views":{"report_by_visit":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'report\') {\\n        emit(doc.data.visit);\\n      }\\n    }\\n  }"}}},{"_id":"_design/sequence_by_prefix","_rev":"1-10f81c9287f2db782b8e293e7d9b1cde","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'sequence\') {\\n        emit(doc.data.prefix);\\n      }\\n    }\\n  }"}}},{"_id":"_design/surgical_appointments_by_date","_rev":"1-90d8de834de1fe0e154d1cdab8889984","version":1,"views":{"surgical_appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType === \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/visit_by_date","_rev":"1-db61f993a1e1699c8205fee3434fc4c8","version":4,"views":{"visit_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([startDate, endDate, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/visit_by_discharge_date","_rev":"1-b4baca85d54e727966aeb2e8ad172136","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    emit([endDate, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/visit_by_patient","_rev":"1-f2865c74eefee716937492db914f2ccd","version":4,"views":{"visit_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"diagnosis_2_56dd3bf6-b39e-4778-b6dd-7f8673ad568e","_rev":"1-5fd319c5141754bf5e6c9cb172bb0d92","data":{"active":true,"date":"2017-03-13T04:00:00.000Z","diagnosis":"Tennis Elbow","secondaryDiagnosis":true,"archived":false,"lastModified":"2017-03-13T17:53:33.294Z","modifiedBy":"Admin User","modifiedFields":{"date":"2017-03-13T17:53:33.294Z","diagnosis":"2017-03-13T17:53:33.294Z","secondaryDiagnosis":"2017-03-13T17:53:33.294Z"}}},{"_id":"diagnosis_2_594cbc26-362a-4b8c-9072-7a01a8473a8f","_rev":"1-8d260e0152865090683362581f62ee1c","data":{"active":true,"date":"2017-03-13T04:00:00.000Z","diagnosis":"Broken Arm","secondaryDiagnosis":false,"archived":false,"lastModified":"2017-03-13T17:53:09.252Z","modifiedBy":"Admin User","modifiedFields":{"date":"2017-03-13T17:53:09.252Z","diagnosis":"2017-03-13T17:53:09.252Z"}}},{"_id":"patient_2_cd572865-dcc0-441e-a2ad-be400dc256da","_rev":"4-23a240576e87d23821b5364dc557a1dd","data":{"admitted":false,"address":null,"address2":null,"address3":null,"address4":null,"bloodType":null,"clinic":null,"country":null,"checkedIn":false,"customForms":{},"dateOfBirth":null,"economicClassification":null,"email":null,"externalPatientId":null,"familySupport1":null,"familySupport2":null,"familySupport3":null,"familySupport4":null,"familySupport5":null,"friendlyId":"P00001","firstName":"Joe","sex":"Male","occupation":null,"history":null,"insurance":null,"lastName":"Bagadonuts","livingArrangement":null,"middleName":"","notes":null,"otherIncome":null,"patientType":null,"parent":null,"phone":null,"placeOfBirth":null,"referredDate":null,"referredBy":null,"religion":null,"socialActionTaken":null,"socialRecommendation":null,"status":null,"archived":false,"lastModified":"2017-03-13T17:52:51.958Z","modifiedBy":"Admin User","paymentProfile":null,"payments":[],"operativePlans":[],"operationReports":[],"diagnoses":["594cbc26-362a-4b8c-9072-7a01a8473a8f","56dd3bf6-b39e-4778-b6dd-7f8673ad568e"],"allergies":[],"modifiedFields":{"customForms":"2017-03-13T17:52:51.958Z","firstName":"2017-03-13T17:52:51.958Z","middleName":"2017-03-13T17:52:51.958Z","lastName":"2017-03-13T17:52:51.958Z","sex":"2017-03-13T17:52:51.958Z","friendlyId":"2017-03-13T17:52:51.958Z"}},"_revisions":{"start":4,"ids":["23a240576e87d23821b5364dc557a1dd","c5b245740fbcb79be7d7483cd86ec4b2","3f976abe4ecc5911b9dbfaf3099e4419","199c75172e78cce74f87350865b5560a"]}}]}\n{"seq":35}\n';
});
define('hospitalrun/tests/fixtures/patient',['exports'],function(exports){exports['default'] = '{"version":"1.2.5","db_type":"http","start_time":"2017-03-16T14:47:40.838Z","db_info":{"db_name":"main","doc_count":76,"doc_del_count":0,"update_seq":100,"purge_seq":0,"compact_running":false,"disk_size":122984,"data_size":73938,"instance_start_time":"1489675617586537","disk_format_version":6,"committed_update_seq":100,"host":"http://localhost:5984/main/","auto_compaction":false,"adapter":"http"}}\n{"docs":[{"_id":"_design/custom_form_by_type","_rev":"1-ddf0ee75c1e8e859d821a9f5c1ec43b6","version":1,"views":{"custom_form_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'customForm\') {\\n        emit(doc.data.formType);\\n      }\\n    }\\n  }"}}}]}\n{"seq":4}\n{"docs":[{"_id":"_design/incident_by_friendly_id","_rev":"1-885a12b67da47e956bc190fe1fe0d4e6","version":1,"views":{"incident_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}}]}\n{"seq":6}\n{"docs":[{"_id":"_design/appointments_by_date","_rev":"1-5df29f1d7dbd39d6b3a2145923ab73cf","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["5df29f1d7dbd39d6b3a2145923ab73cf"]}},{"_id":"_design/appointments_by_date","_rev":"1-178add045be11a7fd6aa7fdf97c8f3f0","version":6,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([startDate, endDate, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n      var filterBy = null;\\n      var includeRow = true;\\n      if (req.query && req.query.filterBy) {\\n        filterBy = JSON.parse(req.query.filterBy);\\n      }\\n      if (!filterBy) {\\n        return true;\\n      }\\n      for (var i = 0; i < filterBy.length; i++) {\\n        var currentValue = row.doc.data[filterBy[i].name];\\n        if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n          currentValue = \'Scheduled\';\\n        }\\n        if (currentValue !== filterBy[i].value) {\\n          includeRow = false;\\n          break;\\n        }\\n      }\\n      return includeRow;\\n    });rows.sort(function (a, b) {\\n      function defaultStatus(value) {\\n        if (!value || value === \'\') {\\n          return \'Scheduled\';\\n        } else {\\n          return value;\\n        }\\n      }\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'appointmentType\':\\n        case \'location\':\\n        case \'provider\':\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        case \'date\':\\n          {\\n            var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n            if (startDiff === 0) {\\n              return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n            } else {\\n              return startDiff;\\n            }\\n          }\\n        case \'status\':\\n          {\\n            var aStatus = defaultStatus(a.doc.data[sortBy]);\\n            var bStatus = defaultStatus(b.doc.data[sortBy]);\\n            return compareStrings(aStatus, bStatus);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["178add045be11a7fd6aa7fdf97c8f3f0"]}},{"_id":"_design/appointments_by_date","_rev":"1-03951858f9232df2e774548b0f5fd068","version":4,"views":{"appointments_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n      var i,\\n          filterBy = null,\\n          includeRow = true;\\n      if (req.query && req.query.filterBy) {\\n        filterBy = JSON.parse(req.query.filterBy);\\n      }\\n      if (!filterBy) {\\n        return true;\\n      }\\n      for (i = 0; i < filterBy.length; i++) {\\n        var currentValue = row.doc.data[filterBy[i].name];\\n        if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n          currentValue = \'Scheduled\';\\n        }\\n        if (currentValue !== filterBy[i].value) {\\n          includeRow = false;\\n          break;\\n        }\\n      }\\n      return includeRow;\\n    });rows.sort(function (a, b) {\\n      function defaultStatus(value) {\\n        if (!value || value === \'\') {\\n          return \'Scheduled\';\\n        } else {\\n          return value;\\n        }\\n      }\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'appointmentType\':\\n        case \'location\':\\n        case \'provider\':\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        case \'date\':\\n          {\\n            var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n            if (startDiff === 0) {\\n              return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n            } else {\\n              return startDiff;\\n            }\\n            break;\\n          }\\n        case \'status\':\\n          {\\n            var aStatus = defaultStatus(a.doc.data[sortBy]),\\n                bStatus = defaultStatus(b.doc.data[sortBy]);\\n            return compareStrings(aStatus, bStatus);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["03951858f9232df2e774548b0f5fd068"]}},{"_id":"_design/appointments_by_date","_rev":"3-461875fa3e8aa582009473a4ebccf3bb","version":7,"views":{"appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType !== \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":3,"ids":["461875fa3e8aa582009473a4ebccf3bb","2e78ab0f6da3881df4871d0b028148b9","4c8dd95ad6d36b9b4d86136d5e417f5c"]}},{"_id":"_design/appointments_by_patient","_rev":"1-7232d3292344540b2511e709422e2cbf","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate,doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7232d3292344540b2511e709422e2cbf"]}},{"_id":"_design/appointments_by_patient","_rev":"1-9a97acd5b8fd071ad81afc9e730721c5","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate,doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["9a97acd5b8fd071ad81afc9e730721c5"]}},{"_id":"_design/appointments_by_patient","_rev":"2-a8bb26daf0329c069a18ec0ce64532cb","version":4,"views":{"appointments_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"appointment\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate,doc._id]);}}}"}},"_revisions":{"start":2,"ids":["a8bb26daf0329c069a18ec0ce64532cb","9868b6586898a48c3fd68722ca3fe1d4"]}},{"_id":"_design/closed_incidents_by_user","_rev":"1-bf16176c13be57af9a4f1a0980710190","version":1,"views":{"closed_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status === \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}}},{"_id":"_design/imaging_by_status","_rev":"1-2feb5103c3f6d149bf98f0adeaa76b38","version":4,"views":{"imaging_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"imaging\\") {var imagingDate = doc.data.imagingDate;if (imagingDate && imagingDate !== \\"\\") {imagingDate = new Date(imagingDate);if (imagingDate.getTime) {imagingDate = imagingDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, imagingDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["2feb5103c3f6d149bf98f0adeaa76b38"]}},{"_id":"_design/imaging_by_status","_rev":"1-1a3bab3d2d1403299a9e4ad8dffe5fa1","version":4,"views":{"imaging_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'imaging\') {\\n        var imagingDate = doc.data.imagingDate;\\n    if (imagingDate && imagingDate !== \\"\\") {\\n      imagingDate = new Date(imagingDate);\\n      if (imagingDate.getTime) {\\n        imagingDate = imagingDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, imagingDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["1a3bab3d2d1403299a9e4ad8dffe5fa1"]}},{"_id":"_design/imaging_by_status","_rev":"2-57660077d48a8a4a0c1a3dd6ae214aac","version":4,"views":{"imaging_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"imaging\\") {var imagingDate = doc.data.imagingDate;if (imagingDate && imagingDate !== \\"\\") {imagingDate = new Date(imagingDate);if (imagingDate.getTime) {imagingDate = imagingDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, imagingDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["57660077d48a8a4a0c1a3dd6ae214aac","9236042e1fb9f567d1d527bbb429cd8e"]}},{"_id":"_design/incident_by_date","_rev":"1-59fa59734ee129cff0560b20a95d2d4e","version":1,"views":{"incident_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        var dateOfIncident = doc.data.dateOfIncident;\\n    if (dateOfIncident && dateOfIncident !== \\"\\") {\\n      dateOfIncident = new Date(dateOfIncident);\\n      if (dateOfIncident.getTime) {\\n        dateOfIncident = dateOfIncident.getTime();\\n      }\\n    }\\n    emit([dateOfIncident, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_by_friendly_id","_rev":"1-82e24378f074a284cae14da4db5431ed","version":1,"views":{"inventory_by_friendly_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.friendlyId, doc._id]);\\n      }\\n    }\\n  }"}}},{"_id":"_design/inventory_by_name","_rev":"1-304304d63beaffd8d1ae4ae1cddf4b2b","version":3,"views":{"inventory_by_name":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit([doc.data.name, doc._id]);}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["304304d63beaffd8d1ae4ae1cddf4b2b"]}},{"_id":"_design/inventory_by_name","_rev":"1-91f55ae6bd30f766d9da95bffe054bcb","version":5,"views":{"inventory_by_name":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.name, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["91f55ae6bd30f766d9da95bffe054bcb"]}},{"_id":"_design/inventory_by_name","_rev":"2-6993fbc5ef18283f83c6afe5be9a9351","version":5,"views":{"inventory_by_name":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit([doc.data.name, doc._id]);\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'crossReference\':\\n        case \'description\':\\n        case \'friendlyId\':\\n        case \'name\':\\n        case \'price\':\\n        case \'quantity\':\\n        case \'inventoryType\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["6993fbc5ef18283f83c6afe5be9a9351","c12e4467c9c3ecc8021b660934257f25"]}},{"_id":"_design/inventory_by_type","_rev":"1-003ef699ab0f2b8628c0bf613fabf7a2","version":4,"views":{"inventory_by_type":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit(doc.data.inventoryType);}}}"}},"_revisions":{"start":1,"ids":["003ef699ab0f2b8628c0bf613fabf7a2"]}},{"_id":"_design/inventory_by_type","_rev":"1-18455500e1e86544edceaab01bb511bc","version":5,"views":{"inventory_by_type":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'inventory\') {\\n        emit(doc.data.inventoryType);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["18455500e1e86544edceaab01bb511bc"]}},{"_id":"_design/inventory_by_type","_rev":"1-65423cfcd4b0acd93b58aa2003907c92","version":5,"views":{"inventory_by_type":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"inventory\\") {emit(doc.data.inventoryType);}}}"}},"_revisions":{"start":1,"ids":["65423cfcd4b0acd93b58aa2003907c92"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-78939ec45bef330bbfa87763dbbfce37","version":4,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var dateReceived = doc.data.dateReceived;if (dateReceived && dateReceived !== \\"\\") {dateReceived = new Date(dateReceived);if (dateReceived.getTime) {dateReceived = dateReceived.getTime();}}emit([dateReceived, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["78939ec45bef330bbfa87763dbbfce37"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-0d7b597aeae746589980b12903768252","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invPurchase\') {\\n        var dateReceived = doc.data.dateReceived;\\n    if (dateReceived && dateReceived !== \\"\\") {\\n      dateReceived = new Date(dateReceived);\\n      if (dateReceived.getTime) {\\n        dateReceived = dateReceived.getTime();\\n      }\\n    }\\n    emit([dateReceived, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["0d7b597aeae746589980b12903768252"]}},{"_id":"_design/inventory_purchase_by_date_received","_rev":"1-823be94576112c800022b256ccd9b725","version":5,"views":{"inventory_purchase_by_date_received":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var dateReceived = doc.data.dateReceived;if (dateReceived && dateReceived !== \\"\\") {dateReceived = new Date(dateReceived);if (dateReceived.getTime) {dateReceived = dateReceived.getTime();}}emit([dateReceived, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["823be94576112c800022b256ccd9b725"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-17bd9d3619ae03155d9929d3ebcd5023","version":4,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var expirationDate = doc.data.expirationDate;if (expirationDate && expirationDate !== \\"\\") {expirationDate = new Date(expirationDate);if (expirationDate.getTime) {expirationDate = expirationDate.getTime();}}emit([expirationDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["17bd9d3619ae03155d9929d3ebcd5023"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-7aea58304996ccb168865141592a024f","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invPurchase\\") {var expirationDate = doc.data.expirationDate;if (expirationDate && expirationDate !== \\"\\") {expirationDate = new Date(expirationDate);if (expirationDate.getTime) {expirationDate = expirationDate.getTime();}}emit([expirationDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7aea58304996ccb168865141592a024f"]}},{"_id":"_design/inventory_purchase_by_expiration_date","_rev":"1-1f41dd6d030c58884d7013ef9436decb","version":5,"views":{"inventory_purchase_by_expiration_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invPurchase\') {\\n        var expirationDate = doc.data.expirationDate;\\n    if (expirationDate && expirationDate !== \\"\\") {\\n      expirationDate = new Date(expirationDate);\\n      if (expirationDate.getTime) {\\n        expirationDate = expirationDate.getTime();\\n      }\\n    }\\n    emit([expirationDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["1f41dd6d030c58884d7013ef9436decb"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-e9eb2d7f1e35296646399c7414525c33","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);}}}"}},"_revisions":{"start":1,"ids":["e9eb2d7f1e35296646399c7414525c33"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-021f4c24b5b6202594f610cf5d4c63a4","version":5,"views":{"inventory_request_by_item":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invRequest\') {\\n        var dateCompleted = doc.data.dateCompleted;\\n    if (dateCompleted && dateCompleted !== \\"\\") {\\n      dateCompleted = new Date(dateCompleted);\\n      if (dateCompleted.getTime) {\\n        dateCompleted = dateCompleted.getTime();\\n      }\\n    }\\n    emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["021f4c24b5b6202594f610cf5d4c63a4"]}},{"_id":"_design/inventory_request_by_item","_rev":"1-7e7ef275a9fc15f2b5f328b1479c6097","version":4,"views":{"inventory_request_by_item":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);}}}"}},"_revisions":{"start":1,"ids":["7e7ef275a9fc15f2b5f328b1479c6097"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-cc0c1e0e01060aa62456d6ea768d8ec7","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invRequest\') {\\n        var dateCompleted = doc.data.dateCompleted;\\n    if (dateCompleted && dateCompleted !== \\"\\") {\\n      dateCompleted = new Date(dateCompleted);\\n      if (dateCompleted.getTime) {\\n        dateCompleted = dateCompleted.getTime();\\n      }\\n    }\\n    emit([doc.data.status, dateCompleted, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["cc0c1e0e01060aa62456d6ea768d8ec7"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-187394c79d3206e11e112891f0d63550","version":4,"views":{"inventory_request_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.status, dateCompleted, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["187394c79d3206e11e112891f0d63550"]}},{"_id":"_design/inventory_request_by_status","_rev":"1-f4a7252ebf2802c53a572bf150eae05c","version":5,"views":{"inventory_request_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invRequest\\") {var dateCompleted = doc.data.dateCompleted;if (dateCompleted && dateCompleted !== \\"\\") {dateCompleted = new Date(dateCompleted);if (dateCompleted.getTime) {dateCompleted = dateCompleted.getTime();}}emit([doc.data.status, dateCompleted, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["f4a7252ebf2802c53a572bf150eae05c"]}},{"_id":"_design/invoice_by_patient","_rev":"1-9f67a58d4e428614844ac82cb2548268","version":1,"views":{"invoice_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invoice\') {\\n        emit(doc.data.patient);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["9f67a58d4e428614844ac82cb2548268"]}},{"_id":"_design/invoice_by_patient","_rev":"1-a491390f74ce432d9cfab78291e0753b","version":1,"views":{"invoice_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":1,"ids":["a491390f74ce432d9cfab78291e0753b"]}},{"_id":"_design/invoice_by_status","_rev":"1-25a58e1cec7f01d0a7e8da1293f59b69","version":4,"views":{"invoice_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {var billDate = doc.data.billDate;if (billDate && billDate !== \\"\\") {billDate = new Date(billDate);if (billDate.getTime) {billDate = billDate.getTime();}}emit([doc.data.status, billDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["25a58e1cec7f01d0a7e8da1293f59b69"]}},{"_id":"_design/invoice_by_status","_rev":"1-d411e6f66f897f0b9b985dc6e5188d85","version":4,"views":{"invoice_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'invoice\') {\\n        var billDate = doc.data.billDate;\\n    if (billDate && billDate !== \\"\\") {\\n      billDate = new Date(billDate);\\n      if (billDate.getTime) {\\n        billDate = billDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, billDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["d411e6f66f897f0b9b985dc6e5188d85"]}},{"_id":"_design/invoice_by_status","_rev":"2-072e2f7f1519a12260fe98c90f794b06","version":4,"views":{"invoice_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"invoice\\") {var billDate = doc.data.billDate;if (billDate && billDate !== \\"\\") {billDate = new Date(billDate);if (billDate.getTime) {billDate = billDate.getTime();}}emit([doc.data.status, billDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["072e2f7f1519a12260fe98c90f794b06","73e3e45673ed0c4f4ae1cee855f216f0"]}},{"_id":"_design/lab_by_status","_rev":"1-7d4de6e219b482171b7ecd485ef72238","version":4,"views":{"lab_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'lab\') {\\n        var labDate = doc.data.labDate;\\n    if (labDate && labDate !== \\"\\") {\\n      labDate = new Date(labDate);\\n      if (labDate.getTime) {\\n        labDate = labDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, labDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["7d4de6e219b482171b7ecd485ef72238"]}},{"_id":"_design/lab_by_status","_rev":"1-16b2c13356e8dac3b3594018f91cccfb","version":4,"views":{"lab_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"lab\\") {var labDate = doc.data.labDate;if (labDate && labDate !== \\"\\") {labDate = new Date(labDate);if (labDate.getTime) {labDate = labDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, labDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["16b2c13356e8dac3b3594018f91cccfb"]}},{"_id":"_design/lab_by_status","_rev":"2-ef5e8b51b3704c0cb1e525a63c81bd80","version":4,"views":{"lab_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"lab\\") {var labDate = doc.data.labDate;if (labDate && labDate !== \\"\\") {labDate = new Date(labDate);if (labDate.getTime) {labDate = labDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, labDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["ef5e8b51b3704c0cb1e525a63c81bd80","db4393c6856b98a40afd6ceef31db2a7"]}},{"_id":"_design/medication_by_status","_rev":"1-a6403c53b2db46905b3b1861120c6601","version":4,"views":{"medication_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'medication\') {\\n        var prescriptionDate = doc.data.prescriptionDate;\\n    if (prescriptionDate && prescriptionDate !== \\"\\") {\\n      prescriptionDate = new Date(prescriptionDate);\\n      if (prescriptionDate.getTime) {\\n        prescriptionDate = prescriptionDate.getTime();\\n      }\\n    }\\n    var requestedDate = doc.data.requestedDate;\\n    if (requestedDate && requestedDate !== \\"\\") {\\n      requestedDate = new Date(requestedDate);\\n      if (requestedDate.getTime) {\\n        requestedDate = requestedDate.getTime();\\n      }\\n    }\\n    emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["a6403c53b2db46905b3b1861120c6601"]}},{"_id":"_design/medication_by_status","_rev":"1-09e1d1c201823532161ef48ba23200be","version":4,"views":{"medication_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"medication\\") {var prescriptionDate = doc.data.prescriptionDate;if (prescriptionDate && prescriptionDate !== \\"\\") {prescriptionDate = new Date(prescriptionDate);if (prescriptionDate.getTime) {prescriptionDate = prescriptionDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["09e1d1c201823532161ef48ba23200be"]}},{"_id":"_design/medication_by_status","_rev":"2-9dec70f4b5aeaf7d9b8d70719125c41c","version":4,"views":{"medication_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"medication\\") {var prescriptionDate = doc.data.prescriptionDate;if (prescriptionDate && prescriptionDate !== \\"\\") {prescriptionDate = new Date(prescriptionDate);if (prescriptionDate.getTime) {prescriptionDate = prescriptionDate.getTime();}}var requestedDate = doc.data.requestedDate;if (requestedDate && requestedDate !== \\"\\") {requestedDate = new Date(requestedDate);if (requestedDate.getTime) {requestedDate = requestedDate.getTime();}}emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["9dec70f4b5aeaf7d9b8d70719125c41c","36ce9e9853552f5eb646ed26de7184dc"]}},{"_id":"_design/open_incidents_by_user","_rev":"1-34770efd210920a30c96d3787521e8a5","version":1,"views":{"open_incidents_by_user":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'incident\') {\\n        if (doc.data.status !== \\"Closed\\") {\\n      emit([doc.data.reportedBy, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      }\\n      return 0; // Don\'t sort\\n    });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/patient_by_admission","_rev":"1-3c2da4380d257c95ebf4430afa48de3b","version":4,"views":{"patient_by_admission":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.admitted === true) {\\n      if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["3c2da4380d257c95ebf4430afa48de3b"]}},{"_id":"_design/patient_by_admission","_rev":"2-cb3270a3d44a370d50128b93179d3503","version":4,"views":{"patient_by_admission":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.admitted === true) {\\n      if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["cb3270a3d44a370d50128b93179d3503","ee7b6ead26ac6b8b3f106c6d85dc175b"]}},{"_id":"_design/patient_by_display_id","_rev":"1-8a6930002af6d588ecdedd5f07da0230","version":7,"views":{"patient_by_display_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["8a6930002af6d588ecdedd5f07da0230"]}},{"_id":"_design/patient_by_display_id","_rev":"1-0b75ee7c82a1aadebd0bc0fd403622fb","version":5,"views":{"patient_by_display_id":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {if (doc.data.friendlyId) {emit([doc.data.friendlyId, doc._id]);} else if (doc.data.externalPatientId) {emit([doc.data.externalPatientId, doc._id]);} else {emit([doc._id, doc._id]);}}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'firstName\':\\n        case \'sex\':\\n        case \'lastName\':\\n        case \'status\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        case \'dateOfBirth\':\\n          {\\n            return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["0b75ee7c82a1aadebd0bc0fd403622fb"]}},{"_id":"_design/patient_by_display_id","_rev":"1-6f596cec9eb82609308fd9d25a9f9df2","version":4,"views":{"patient_by_display_id":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {if (doc.data.friendlyId) {emit([doc.data.friendlyId, doc._id]);} else if (doc.data.externalPatientId) {emit([doc.data.externalPatientId, doc._id]);} else {emit([doc._id, doc._id]);}}}}"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n      var sortBy = \'\';\\n      if (req.query && req.query.sortKey) {\\n        sortBy = req.query.sortKey;\\n      }\\n      switch (sortBy) {\\n        case \'firstName\':\\n        case \'gender\':\\n        case \'lastName\':\\n        case \'status\':\\n          {\\n            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n          }\\n        case \'dateOfBirth\':\\n          {\\n            return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n          }\\n        default:\\n          {\\n            return 0; // Don\'t sort\\n          }\\n      }\\n    });if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":1,"ids":["6f596cec9eb82609308fd9d25a9f9df2"]}},{"_id":"_design/patient_by_display_id","_rev":"2-88a46c350d8994362cc0e5910f15d726","version":7,"views":{"patient_by_display_id":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        if (doc.data.friendlyId) {\\n    emit([doc.data.friendlyId, doc._id]);\\n  } else if (doc.data.externalPatientId) {\\n    emit([doc.data.externalPatientId, doc._id]);\\n  } else {\\n    emit([doc._id, doc._id]);\\n }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows.sort(function (a, b) {\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'firstName\':\\n      case \'sex\':\\n      case \'lastName\':\\n      case \'status\':\\n        {\\n          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n        }\\n      case \'dateOfBirth\':\\n        {\\n          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"},"_revisions":{"start":2,"ids":["88a46c350d8994362cc0e5910f15d726","c619a041bccecc7e83b05015cc92706e"]}},{"_id":"_design/patient_by_status","_rev":"1-54bc74ff93db4aedff83bc649f766596","version":3,"views":{"patient_by_status":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'patient\') {\\n        emit(doc.data.status);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["54bc74ff93db4aedff83bc649f766596"]}},{"_id":"_design/patient_by_status","_rev":"1-49f3f7f86891fb7d60f0ee1b2db1220b","version":3,"views":{"patient_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {emit(doc.data.status);}}}"}},"_revisions":{"start":1,"ids":["49f3f7f86891fb7d60f0ee1b2db1220b"]}},{"_id":"_design/patient_by_status","_rev":"2-b56763993297cda52343d99f7fdd1b03","version":3,"views":{"patient_by_status":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"patient\\") {emit(doc.data.status);}}}"}},"_revisions":{"start":2,"ids":["b56763993297cda52343d99f7fdd1b03","ff26a12cdb8747aae5bf26f9af3a1953"]}},{"_id":"_design/photo_by_patient","_rev":"1-6a4fad4fa682efbbd058e858c328574f","version":4,"views":{"photo_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'photo\') {\\n        emit(doc.data.patient);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["6a4fad4fa682efbbd058e858c328574f"]}},{"_id":"_design/photo_by_patient","_rev":"1-727ba2a3d1a106196746643395a859d0","version":4,"views":{"photo_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"photo\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":1,"ids":["727ba2a3d1a106196746643395a859d0"]}},{"_id":"_design/photo_by_patient","_rev":"2-0ea32da890536de0910ea412a3fa015c","version":4,"views":{"photo_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"photo\\") {emit(doc.data.patient);}}}"}},"_revisions":{"start":2,"ids":["0ea32da890536de0910ea412a3fa015c","e3dc5506f7f370535b85be0adc59c7cc"]}},{"_id":"_design/pricing_by_category","_rev":"1-b34429f4f8aff13ed218f70f039b3591","version":5,"views":{"pricing_by_category":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"pricing\\") {emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["b34429f4f8aff13ed218f70f039b3591"]}},{"_id":"_design/pricing_by_category","_rev":"1-3d703b5f240ae5838d1f20a8ad0471de","version":5,"views":{"pricing_by_category":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'pricing\') {\\n        emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["3d703b5f240ae5838d1f20a8ad0471de"]}},{"_id":"_design/pricing_by_category","_rev":"1-23d44e44019170eadd086734c87e3976","version":4,"views":{"pricing_by_category":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"pricing\\") {emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["23d44e44019170eadd086734c87e3976"]}},{"_id":"_design/procedure_by_date","_rev":"1-25ccef2a9dff3addd8c0d15cc79c363c","version":3,"views":{"procedure_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"procedure\\") {var procedureDate = doc.data.procedureDate;if (procedureDate && procedureDate !== \\"\\") {procedureDate = new Date(procedureDate);if (procedureDate.getTime) {procedureDate = procedureDate.getTime();}}emit([procedureDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["25ccef2a9dff3addd8c0d15cc79c363c"]}},{"_id":"_design/procedure_by_date","_rev":"1-a44decd8f14d01c615cf3f5b8e70f10b","version":4,"views":{"procedure_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'procedure\') {\\n        var procedureDate = doc.data.procedureDate;\\n    if (procedureDate && procedureDate !== \\"\\") {\\n      procedureDate = new Date(procedureDate);\\n      if (procedureDate.getTime) {\\n        procedureDate = procedureDate.getTime();\\n      }\\n    }\\n    emit([procedureDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["a44decd8f14d01c615cf3f5b8e70f10b"]}},{"_id":"_design/procedure_by_date","_rev":"1-7c23f1d0feaff1358bee1ddea760daac","version":4,"views":{"procedure_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"procedure\\") {var procedureDate = doc.data.procedureDate;if (procedureDate && procedureDate !== \\"\\") {procedureDate = new Date(procedureDate);if (procedureDate.getTime) {procedureDate = procedureDate.getTime();}}emit([procedureDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["7c23f1d0feaff1358bee1ddea760daac"]}},{"_id":"_design/report_by_visit","_rev":"1-1295cef10df82554859efdb4c38c1c1e","version":1,"views":{"report_by_visit":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'report\') {\\n        emit(doc.data.visit);\\n      }\\n    }\\n  }"}}},{"_id":"_design/sequence_by_prefix","_rev":"1-10f81c9287f2db782b8e293e7d9b1cde","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'sequence\') {\\n        emit(doc.data.prefix);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["10f81c9287f2db782b8e293e7d9b1cde"]}},{"_id":"_design/sequence_by_prefix","_rev":"1-4a47589314718c2d8add1266b64b5ea6","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"sequence\\") {emit(doc.data.prefix);}}}"}},"_revisions":{"start":1,"ids":["4a47589314718c2d8add1266b64b5ea6"]}},{"_id":"_design/sequence_by_prefix","_rev":"2-73756debd255ca93fb25eab24ed9e12a","version":4,"views":{"sequence_by_prefix":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"sequence\\") {emit(doc.data.prefix);}}}"}},"_revisions":{"start":2,"ids":["73756debd255ca93fb25eab24ed9e12a","8ac3a62b4c0b624ebed3b68b27cd197e"]}},{"_id":"_design/surgical_appointments_by_date","_rev":"1-90d8de834de1fe0e154d1cdab8889984","version":1,"views":{"surgical_appointments_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'appointment\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    if (doc.data.appointmentType === \'Surgery\') {\\n      emit([startDate, endDate, doc._id]);\\n    }\\n      }\\n    }\\n  }"}},"lists":{"sort":"function(head, req) {function keysEqual(keyA, keyB) {for (var i= 0; i < keyA.length; i++) {if (keyA[i] !== keyB[i]) {return false;}}return true;}function getCompareDate(dateString) {if (!dateString || dateString === \\"\\") {return 0;}return new Date(dateString).getTime();}function compareStrings(aString, bString) {if (!aString) {aString = \\"\\";}if (!bString) {bString = \\"\\";}if (aString < bString) {return -1;} else if (aString > bString) {return 1;} else {return 0;}}var row,rows=[],startingPosition = 0;while(row = getRow()) {rows.push(row);}rows = rows.filter(function (row) {\\n    var filterBy = null;\\n    var includeRow = true;\\n    if (req.query && req.query.filterBy) {\\n      filterBy = JSON.parse(req.query.filterBy);\\n    }\\n    if (!filterBy) {\\n      return true;\\n    }\\n    for (var i = 0; i < filterBy.length; i++) {\\n      var currentValue = row.doc.data[filterBy[i].name];\\n      if (filterBy[i].name === \'status\' && (!currentValue || currentValue === \'\')) {\\n        currentValue = \'Scheduled\';\\n      }\\n      if (currentValue !== filterBy[i].value) {\\n        includeRow = false;\\n        break;\\n      }\\n    }\\n    return includeRow;\\n  });rows.sort(function (a, b) {\\n    function defaultStatus(value) {\\n      if (!value || value === \'\') {\\n        return \'Scheduled\';\\n      } else {\\n        return value;\\n      }\\n    }\\n    var sortBy = \'\';\\n    if (req.query && req.query.sortKey) {\\n      sortBy = req.query.sortKey;\\n    }\\n    switch (sortBy) {\\n      case \'appointmentType\':\\n      case \'location\':\\n      case \'provider\':\\n        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);\\n      case \'date\':\\n        {\\n          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);\\n          if (startDiff === 0) {\\n            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);\\n          } else {\\n            return startDiff;\\n          }\\n        }\\n      case \'status\':\\n        {\\n          var aStatus = defaultStatus(a.doc.data[sortBy]);\\n          var bStatus = defaultStatus(b.doc.data[sortBy]);\\n          return compareStrings(aStatus, bStatus);\\n        }\\n      default:\\n        {\\n          return 0; // Don\'t sort\\n        }\\n    }\\n  });if (req.query.sortDesc) {rows = rows.reverse();}if (req.query.sortStartKey) {var startKey = JSON.parse(req.query.sortStartKey);for (var i=0; i<rows.length; i++) {if (keysEqual(startKey, rows[i].key)) {startingPosition = i;break;}}}if (req.query.sortLimit) {rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);} else if (startingPosition > 0) {rows = rows.slice(startingPosition);}send(JSON.stringify({\\"rows\\" : rows}));}"}},{"_id":"_design/visit_by_date","_rev":"1-367a7fa42f1067f645190d560f83ef5e","version":3,"views":{"visit_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["367a7fa42f1067f645190d560f83ef5e"]}},{"_id":"_design/visit_by_date","_rev":"1-db61f993a1e1699c8205fee3434fc4c8","version":4,"views":{"visit_by_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([startDate, endDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["db61f993a1e1699c8205fee3434fc4c8"]}},{"_id":"_design/visit_by_date","_rev":"1-fd0a50125860ba3c17844c0567a70d65","version":4,"views":{"visit_by_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([startDate, endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["fd0a50125860ba3c17844c0567a70d65"]}},{"_id":"_design/visit_by_discharge_date","_rev":"1-57a0b69b2792963e5112bbdd53bbba2d","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}emit([endDate, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["57a0b69b2792963e5112bbdd53bbba2d"]}},{"_id":"_design/visit_by_discharge_date","_rev":"1-b4baca85d54e727966aeb2e8ad172136","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    emit([endDate, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["b4baca85d54e727966aeb2e8ad172136"]}},{"_id":"_design/visit_by_discharge_date","_rev":"2-76f05f3060660ab74749fa0def9cea07","version":2,"views":{"visit_by_discharge_date":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}emit([endDate, doc._id]);}}}"}},"_revisions":{"start":2,"ids":["76f05f3060660ab74749fa0def9cea07","e53c95160dacaf007fe01c01215729ce"]}},{"_id":"_design/visit_by_patient","_rev":"1-bf45f0e7e8e9123a59095b609570a4ea","version":4,"views":{"visit_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0 && !doc.data.archived) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["bf45f0e7e8e9123a59095b609570a4ea"]}},{"_id":"_design/visit_by_patient","_rev":"1-f2865c74eefee716937492db914f2ccd","version":4,"views":{"visit_by_patient":{"map":"function(doc) {\\n    var doctype, uidx;\\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\\n      doctype = doc._id.substring(0, uidx);\\n      if (doctype === \'visit\') {\\n        var endDate = doc.data.endDate;\\n    if (endDate && endDate !== \\"\\") {\\n      endDate = new Date(endDate);\\n      if (endDate.getTime) {\\n        endDate = endDate.getTime();\\n      }\\n    }\\n    var startDate = doc.data.startDate;\\n    if (startDate && startDate !== \\"\\") {\\n      startDate = new Date(startDate);\\n      if (startDate.getTime) {\\n        startDate = startDate.getTime();\\n      }\\n    }\\n    emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);\\n      }\\n    }\\n  }"}},"_revisions":{"start":1,"ids":["f2865c74eefee716937492db914f2ccd"]}},{"_id":"_design/visit_by_patient","_rev":"1-412252178488867e2350dcd13da779ea","version":3,"views":{"visit_by_patient":{"map":"function(doc) {var doctype,uidx;if (doc._id && (uidx = doc._id.indexOf(\\"_\\")) > 0) {doctype = doc._id.substring(0, uidx);if(doctype === \\"visit\\") {var endDate = doc.data.endDate;if (endDate && endDate !== \\"\\") {endDate = new Date(endDate);if (endDate.getTime) {endDate = endDate.getTime();}}var startDate = doc.data.startDate;if (startDate && startDate !== \\"\\") {startDate = new Date(startDate);if (startDate.getTime) {startDate = startDate.getTime();}}emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);}}}"}},"_revisions":{"start":1,"ids":["412252178488867e2350dcd13da779ea"]}},{"_id":"appointment_2_C47BE127-E509-6322-BB33-2E6ABE03D0F0","_rev":"2-44597ea8b1cdd20dc8d2c0ad9b2edbb6","data":{"allDay":true,"provider":"Dr Nick","location":"Hospital","appointmentType":"Followup","startDate":"2015-12-30T06:00:00.000Z","endDate":"2015-12-30T06:00:00.000Z","notes":null,"status":"Scheduled","lastModified":"2015-12-29T04:14:36.585Z","modifiedBy":"Admin User","patient":"C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","modifiedFields":{"appointmentType":"2015-12-29T04:14:21.124Z","allDay":"2015-12-29T04:14:21.124Z","startDate":"2015-12-29T04:14:36.585Z","endDate":"2015-12-29T04:14:36.585Z","location":"2015-12-29T04:14:21.124Z","provider":"2015-12-29T04:14:21.124Z"}},"_revisions":{"start":2,"ids":["44597ea8b1cdd20dc8d2c0ad9b2edbb6","953a11c67a694ef2daa469bd8c0f40ec"]}},{"_id":"imaging_2_12DEDA58-4670-7A74-BA8B-9CC5E5CA82E7","_rev":"1-3237f1a60f7ef9869553893a25e91e87","data":{"imagingDate":null,"notes":null,"radiologist":"","requestedBy":"Admin User","requestedDate":"2015-12-29T04:15:41.380Z","result":null,"status":"Requested","lastModified":"2015-12-29T04:15:41.382Z","modifiedBy":"Admin User","imagingType":"B93625F1-3C41-2D3E-94B9-3A8BAF87EBE8","patient":"C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","visit":"03C7BF8B-04E0-DD9E-9469-96A5604F5340","charges":[],"modifiedFields":{"radiologist":"2015-12-29T04:15:41.382Z","status":"2015-12-29T04:15:41.382Z","requestedBy":"2015-12-29T04:15:41.382Z","requestedDate":"2015-12-29T04:15:41.382Z"}}},{"_id":"imaging_2_51AFF85A-69C0-97C1-B22C-716A1BA7B80B","_rev":"1-3e1a5d957291144f7ba1e9c0c7c2cb12","data":{"imagingDate":"2015-12-29T04:07:03.693Z","notes":null,"radiologist":"Dr Xray","requestedBy":"Admin User","requestedDate":"2015-12-29T04:07:03.694Z","result":null,"status":"Completed","lastModified":"2015-12-29T04:07:03.744Z","modifiedBy":"Admin User","imagingType":"B93625F1-3C41-2D3E-94B9-3A8BAF87EBE8","patient":"C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","visit":"03C7BF8B-04E0-DD9E-9469-96A5604F5340","charges":[],"modifiedFields":{"radiologist":"2015-12-29T04:07:03.744Z","status":"2015-12-29T04:07:03.744Z","imagingDate":"2015-12-29T04:07:03.744Z","requestedBy":"2015-12-29T04:07:03.744Z","requestedDate":"2015-12-29T04:07:03.744Z"}}},{"_id":"invLocation_2_0323721B-EDD0-6C91-BB34-52FBEACBA7DE","_rev":"3-f43e02982eff2b35453b4dcf537fec3f","data":{"quantity":0,"location":null,"aisleLocation":null,"lastModified":"2015-12-29T03:13:47.396Z","modifiedBy":"Admin User","modifiedFields":{"quantity":"2015-12-29T03:13:47.396Z"}},"_revisions":{"start":3,"ids":["f43e02982eff2b35453b4dcf537fec3f","e8c15241efd7bb6c8bf891c28558d83b","c2e397e9ebd1266da5de2e1a3033fcc6"]}},{"_id":"invLocation_2_24BB235E-B271-AF61-9A3D-9ACD77CE25AF","_rev":"3-b8964e3b548efa84d5602224e88a1126","data":{"quantity":0,"location":null,"aisleLocation":null,"lastModified":"2015-12-29T03:08:57.289Z","modifiedBy":"Admin User","modifiedFields":{"quantity":"2015-12-29T03:08:57.289Z"}},"_revisions":{"start":3,"ids":["b8964e3b548efa84d5602224e88a1126","dff7e3f8434279a562a3d4ffc0106c6e","2d8c410350e7ecfffd6e496f6f05ca30"]}},{"_id":"invLocation_2_32BCC947-E272-1564-90E1-C6E2ECE14881","_rev":"2-74b9d0e13f10a766c8e02a411b21bc9e","data":{"quantity":12,"location":"Warehouse","aisleLocation":"A1","lastModified":"2015-12-29T03:47:25.988Z","modifiedBy":"Admin User","modifiedFields":{"aisleLocation":"2015-12-29T03:47:25.919Z","location":"2015-12-29T03:47:25.919Z","quantity":"2015-12-29T03:47:25.988Z"}},"_revisions":{"start":2,"ids":["74b9d0e13f10a766c8e02a411b21bc9e","8adc0c9f4543aebccdfce691b8c1199d"]}},{"_id":"invLocation_2_7FD0F94A-6D4E-6365-A4EF-F7B4F8D35C22","_rev":"3-85e5ea976718b1331eade5d9f567654b","data":{"quantity":0,"location":"Warehouse","aisleLocation":null,"lastModified":"2015-12-29T03:46:41.557Z","modifiedBy":"Admin User","modifiedFields":{"location":"2015-12-29T03:13:47.288Z","quantity":"2015-12-29T03:46:41.557Z"}},"_revisions":{"start":3,"ids":["85e5ea976718b1331eade5d9f567654b","eb663365f6944558113da9820789b8fd","ac3af5754777c65209c3d9c7cc03dfb2"]}},{"_id":"invLocation_2_DBCF3E06-B812-B6C7-930E-74F9372D384A","_rev":"3-a15f0e36baae0abfa52ae68b42e3ad0e","data":{"quantity":999998,"location":"Pharmacy","aisleLocation":null,"lastModified":"2015-12-29T04:01:16.092Z","modifiedBy":"Admin User","modifiedFields":{"location":"2015-12-29T03:08:57.191Z","quantity":"2015-12-29T04:01:16.092Z"}},"_revisions":{"start":3,"ids":["a15f0e36baae0abfa52ae68b42e3ad0e","d365a641356ccd999cf5f91ec842f5a9","e8dfec40fbf6418583392d73b24a9b32"]}},{"_id":"invPurchase_2_05760051-8BD1-ACC0-8013-0C59A545FB8D","_rev":"2-d7477df9559ec794be0e3084f09c310b","data":{"purchaseCost":12,"lotNumber":"","dateReceived":"2015-11-01T05:00:00.000Z","originalQuantity":25,"currentQuantity":0,"expirationDate":null,"expired":false,"location":null,"aisleLocation":null,"giftInKind":false,"inventoryItem":"iiqtim0c_ex","vendor":"ACME INC","vendorItemNo":"","distributionUnit":null,"invoiceNo":null,"lastModified":"2015-12-29T03:46:41.558Z","modifiedBy":"Admin User","modifiedFields":{"dateReceived":"2015-12-29T03:12:56.853Z","purchaseCost":"2015-12-29T03:12:56.853Z","lotNumber":"2015-12-29T03:12:56.853Z","vendor":"2015-12-29T03:12:56.853Z","vendorItemNo":"2015-12-29T03:12:56.853Z","originalQuantity":"2015-12-29T03:12:56.853Z","currentQuantity":"2015-12-29T03:46:41.558Z","inventoryItem":"2015-12-29T03:12:56.853Z"}},"_revisions":{"start":2,"ids":["d7477df9559ec794be0e3084f09c310b","2b41a3edbfe25818058eca69712b2033"]}},{"_id":"invPurchase_2_155B2B94-6C47-E6B5-BD1E-11F375CB2C29","_rev":"1-8308be24f6677a3a6aefc7cdde9b1c13","data":{"purchaseCost":6,"lotNumber":null,"dateReceived":"2015-12-03T06:00:00.000Z","originalQuantity":12,"currentQuantity":12,"expirationDate":null,"expired":false,"location":"Warehouse","aisleLocation":"A1","giftInKind":false,"inventoryItem":"iiqtim0c_ex","vendor":"ACME INC","vendorItemNo":"","distributionUnit":"pcs","invoiceNo":"","lastModified":"2015-12-29T03:47:25.866Z","modifiedBy":"Admin User","modifiedFields":{"dateReceived":"2015-12-29T03:47:25.866Z","distributionUnit":"2015-12-29T03:47:25.866Z","inventoryItem":"2015-12-29T03:47:25.866Z","invoiceNo":"2015-12-29T03:47:25.866Z","originalQuantity":"2015-12-29T03:47:25.866Z","quantityGroups":"2015-12-29T03:47:25.866Z","purchaseCost":"2015-12-29T03:47:25.866Z","vendor":"2015-12-29T03:47:25.866Z","vendorItemNo":"2015-12-29T03:47:25.866Z","location":"2015-12-29T03:47:25.866Z","aisleLocation":"2015-12-29T03:47:25.866Z","currentQuantity":"2015-12-29T03:47:25.866Z"},"quantityGroups":[{"index":0,"unit":"pcs","firstQuantity":true,"quantity":"12"}]}},{"_id":"invPurchase_2_E3B2184F-4ECA-3B76-92C8-437846C2E3DC","_rev":"2-846e30db369e739e0603938b12776d45","data":{"purchaseCost":12345,"lotNumber":null,"dateReceived":"2015-12-01T06:00:00.000Z","originalQuantity":1000000,"currentQuantity":999998,"expirationDate":null,"expired":false,"location":null,"aisleLocation":null,"giftInKind":false,"inventoryItem":"iiqtc6w3_31","vendor":"ACME INC","vendorItemNo":null,"distributionUnit":null,"invoiceNo":null,"lastModified":"2015-12-29T04:01:16.093Z","modifiedBy":"Admin User","modifiedFields":{"dateReceived":"2015-12-29T03:08:23.921Z","purchaseCost":"2015-12-29T03:08:23.921Z","vendor":"2015-12-29T03:08:23.921Z","originalQuantity":"2015-12-29T03:08:23.921Z","currentQuantity":"2015-12-29T04:01:16.093Z","inventoryItem":"2015-12-29T03:08:23.921Z"}},"_revisions":{"start":2,"ids":["846e30db369e739e0603938b12776d45","03ddad7882d9ed7041637de509902109"]}},{"_id":"invRequest_2_2A5251B5-1919-CB55-8757-A53DC057A77E","_rev":"1-222c0c115dc924e7d90cbde2b6023ebd","data":{"adjustPurchases":false,"completedBy":"Admin User","costPerUnit":null,"dateCompleted":"2015-12-01T06:00:00.000Z","dateRequested":null,"deliveryAisle":null,"deliveryLocation":"Pharmacy","expenseAccount":null,"markAsConsumed":true,"quantity":1000000,"quantityAtCompletion":null,"reason":null,"requestedBy":null,"status":"Completed","transactionType":"Transfer","lastModified":"2015-12-29T03:08:57.351Z","modifiedBy":"Admin User","inventoryItem":"iiqtc6w3_31","patient":null,"visit":null,"modifiedFields":{"adjustPurchases":"2015-12-29T03:08:57.351Z","dateCompleted":"2015-12-29T03:08:57.351Z","quantity":"2015-12-29T03:08:57.351Z","deliveryLocation":"2015-12-29T03:08:57.351Z","transactionType":"2015-12-29T03:08:57.351Z","locationsAffected":"2015-12-29T03:08:57.351Z","status":"2015-12-29T03:08:57.351Z","completedBy":"2015-12-29T03:08:57.351Z"},"locationsAffected":[{"name":"No Location","quantity":"1000000"}]}},{"_id":"invRequest_2_6F095231-0D58-E48D-B59F-8D4CB3965802","_rev":"1-f709e83b929a4ac8e25c39de04bb36d9","data":{"adjustPurchases":true,"completedBy":"Admin User","costPerUnit":0.01,"dateCompleted":"2015-12-29T04:01:16.080Z","dateRequested":null,"deliveryAisle":null,"deliveryLocation":null,"expenseAccount":null,"markAsConsumed":true,"quantity":2,"quantityAtCompletion":1000000,"reason":null,"requestedBy":null,"status":"Completed","transactionType":"Fulfillment","lastModified":"2015-12-29T04:01:16.251Z","modifiedBy":"Admin User","inventoryItem":"iiqtc6w3_31","patient":"C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","visit":null,"modifiedFields":{"dateCompleted":"2015-12-29T04:01:16.251Z","quantity":"2015-12-29T04:01:16.251Z","transactionType":"2015-12-29T04:01:16.251Z","markAsConsumed":"2015-12-29T04:01:16.251Z","adjustPurchases":"2015-12-29T04:01:16.251Z","costPerUnit":"2015-12-29T04:01:16.251Z","quantityAtCompletion":"2015-12-29T04:01:16.251Z","purchasesAffected":"2015-12-29T04:01:16.251Z","locationsAffected":"2015-12-29T04:01:16.251Z","status":"2015-12-29T04:01:16.251Z","completedBy":"2015-12-29T04:01:16.251Z"},"purchasesAffected":[{"id":"E3B2184F-4ECA-3B76-92C8-437846C2E3DC","quantity":2}],"locationsAffected":[{"name":"Pharmacy","quantity":2}]}},{"_id":"invRequest_2_91481B28-0A00-9C72-9094-E34D6B70442D","_rev":"1-c1b1d2ef55725427ea6f31fafd43a776","data":{"adjustPurchases":false,"completedBy":null,"costPerUnit":null,"dateCompleted":null,"dateRequested":"2015-12-29T03:47:47.911Z","deliveryAisle":null,"deliveryLocation":"Pharmacy","expenseAccount":"Pharmacy","markAsConsumed":true,"quantity":2,"quantityAtCompletion":null,"reason":null,"requestedBy":"Admin User","status":"Requested","transactionType":"Request","lastModified":"2015-12-29T03:47:47.912Z","modifiedBy":"Admin User","inventoryItem":"iiqtim0c_ex","patient":null,"visit":null,"modifiedFields":{"transactionType":"2015-12-29T03:47:47.912Z","quantity":"2015-12-29T03:47:47.912Z","deliveryLocation":"2015-12-29T03:47:47.912Z","expenseAccount":"2015-12-29T03:47:47.912Z","dateRequested":"2015-12-29T03:47:47.912Z","requestedBy":"2015-12-29T03:47:47.912Z","status":"2015-12-29T03:47:47.912Z"}}},{"_id":"invRequest_2_B419E42C-87A8-1AFC-BDEF-3145ED774BE7","_rev":"1-a61eb2eac18550ed06ae528db3de51f0","data":{"adjustPurchases":false,"completedBy":"Admin User","costPerUnit":null,"dateCompleted":"2015-12-01T06:00:00.000Z","dateRequested":null,"deliveryAisle":null,"deliveryLocation":"Warehouse","expenseAccount":null,"markAsConsumed":true,"quantity":25,"quantityAtCompletion":null,"reason":null,"requestedBy":null,"status":"Completed","transactionType":"Transfer","lastModified":"2015-12-29T03:13:47.447Z","modifiedBy":"Admin User","inventoryItem":"iiqtim0c_ex","patient":null,"visit":null,"modifiedFields":{"adjustPurchases":"2015-12-29T03:13:47.447Z","dateCompleted":"2015-12-29T03:13:47.447Z","quantity":"2015-12-29T03:13:47.447Z","deliveryLocation":"2015-12-29T03:13:47.447Z","transactionType":"2015-12-29T03:13:47.447Z","locationsAffected":"2015-12-29T03:13:47.447Z","status":"2015-12-29T03:13:47.447Z","completedBy":"2015-12-29T03:13:47.447Z"},"locationsAffected":[{"name":"No Location","quantity":"25"}]}},{"_id":"invRequest_2_CA5F4301-1600-1230-B276-0B3C98402C13","_rev":"1-9c9872e5caf5f80fe4cf434e014fcfe3","data":{"adjustPurchases":true,"completedBy":"Admin User","costPerUnit":0.48,"dateCompleted":"2015-12-28T06:00:00.000Z","dateRequested":"2015-12-29T03:46:41.543Z","deliveryAisle":null,"deliveryLocation":"Ward 1","expenseAccount":"Ward","markAsConsumed":true,"quantity":25,"quantityAtCompletion":25,"reason":null,"requestedBy":"Admin User","status":"Completed","transactionType":"Fulfillment","lastModified":"2015-12-29T03:46:41.732Z","modifiedBy":"Admin User","inventoryItem":"iiqtim0c_ex","patient":null,"visit":null,"modifiedFields":{"transactionType":"2015-12-29T03:46:41.732Z","quantity":"2015-12-29T03:46:41.732Z","dateCompleted":"2015-12-29T03:46:41.732Z","deliveryLocation":"2015-12-29T03:46:41.732Z","expenseAccount":"2015-12-29T03:46:41.732Z","dateRequested":"2015-12-29T03:46:41.732Z","requestedBy":"2015-12-29T03:46:41.732Z","adjustPurchases":"2015-12-29T03:46:41.732Z","costPerUnit":"2015-12-29T03:46:41.732Z","quantityAtCompletion":"2015-12-29T03:46:41.732Z","purchasesAffected":"2015-12-29T03:46:41.732Z","locationsAffected":"2015-12-29T03:46:41.732Z","status":"2015-12-29T03:46:41.732Z","completedBy":"2015-12-29T03:46:41.732Z"},"purchasesAffected":[{"id":"05760051-8BD1-ACC0-8013-0C59A545FB8D","quantity":25}],"locationsAffected":[{"name":"Warehouse","quantity":25}]}},{"_id":"inventory_2_iiqtc6w3_31","_rev":"3-0c0a71f273bf0633cafce271b0f35007","data":{"description":null,"friendlyId":"m00001","name":"Cefazolin 500mg vial (Hazolin)","quantity":999998,"crossReference":null,"inventoryType":"Medication","price":null,"reorderPoint":null,"distributionUnit":"vial","rank":null,"lastModified":"2015-12-29T04:01:16.249Z","modifiedBy":"Admin User","locations":["24BB235E-B271-AF61-9A3D-9ACD77CE25AF","DBCF3E06-B812-B6C7-930E-74F9372D384A"],"purchases":["E3B2184F-4ECA-3B76-92C8-437846C2E3DC"],"modifiedFields":{"name":"2015-12-29T03:08:24.053Z","inventoryType":"2015-12-29T03:08:24.053Z","distributionUnit":"2015-12-29T03:08:24.053Z","quantity":"2015-12-29T04:01:16.249Z","friendlyId":"2015-12-29T03:08:24.053Z"}},"_revisions":{"start":3,"ids":["0c0a71f273bf0633cafce271b0f35007","42bc38c66d9a87103c7871aa9aadb6b5","295e3c0d1de3d7a7d384ae5090d82125"]}},{"_id":"inventory_2_iiqtim0c_ex","_rev":"4-6900f25cb0aa33334fb6c69e4a828718","data":{"description":null,"friendlyId":"s00001","name":"Pumpset Kangaroo 1000ml","quantity":12,"crossReference":null,"inventoryType":"Supply","price":null,"reorderPoint":null,"distributionUnit":"pcs","rank":null,"lastModified":"2015-12-29T03:47:26.017Z","modifiedBy":"Admin User","locations":["0323721B-EDD0-6C91-BB34-52FBEACBA7DE","7FD0F94A-6D4E-6365-A4EF-F7B4F8D35C22","32BCC947-E272-1564-90E1-C6E2ECE14881"],"purchases":["05760051-8BD1-ACC0-8013-0C59A545FB8D","155B2B94-6C47-E6B5-BD1E-11F375CB2C29"],"modifiedFields":{"name":"2015-12-29T03:12:56.959Z","inventoryType":"2015-12-29T03:12:56.959Z","distributionUnit":"2015-12-29T03:12:56.959Z","quantity":"2015-12-29T03:47:26.017Z","friendlyId":"2015-12-29T03:12:56.959Z"}},"_revisions":{"start":4,"ids":["6900f25cb0aa33334fb6c69e4a828718","03eb3fc36799eb0e78c1d4f5b45e50a0","064996d833372bc743ccd60baa1174b9","1622cc9c6428d24950f02c88112840f4"]}},{"_id":"lab_2_C9274C34-248C-FF7C-9E8B-F3110467C941","_rev":"2-78aaf934410f626a7dc64c8ce640ad17","data":{"labDate":"2015-12-29T04:07:25.725Z","notes":null,"requestedBy":"Admin User","requestedDate":"2015-12-29T04:03:22.879Z","result":"Normal","status":"Completed","lastModified":"2015-12-29T04:07:25.725Z","modifiedBy":"Admin User","labType":"A33BFA09-AFBB-CA35-A01C-702B568FFAE8","patient":"C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","visit":"03C7BF8B-04E0-DD9E-9469-96A5604F5340","charges":[],"modifiedFields":{"status":"2015-12-29T04:07:25.725Z","requestedBy":"2015-12-29T04:03:22.927Z","requestedDate":"2015-12-29T04:03:22.927Z","result":"2015-12-29T04:07:25.725Z","labDate":"2015-12-29T04:07:25.725Z"}},"_revisions":{"start":2,"ids":["78aaf934410f626a7dc64c8ce640ad17","0e55563ae178ae5b340c29a50f168925"]}}]}\n{"seq":74}\n{"docs":[{"_id":"lab_2_EE3063E6-832D-930D-AD4E-D27341709886","_rev":"1-b0364bd6b060df4a2084ca292de1ad71","data":{"labDate":null,"notes":null,"requestedBy":"Admin User","requestedDate":"2015-12-29T04:18:34.699Z","result":null,"status":"Requested","lastModified":"2015-12-29T04:18:34.731Z","modifiedBy":"Admin User","labType":"4C0FA251-6FEA-8DDA-9DEB-83993EAB25F2","patient":"C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","visit":"03C7BF8B-04E0-DD9E-9469-96A5604F5340","charges":[],"modifiedFields":{"status":"2015-12-29T04:18:34.731Z","requestedBy":"2015-12-29T04:18:34.731Z","requestedDate":"2015-12-29T04:18:34.731Z"}}},{"_id":"lookup_2_aisle_location_list","_rev":"1-255c62c74fb06e5c13664e9e70aebef5","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["A1"]}},{"_id":"lookup_2_cpt_code_list","_rev":"1-499cca90fccff759c62b2fc781010226","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["27001"]}},{"_id":"lookup_2_diagnosis_list","_rev":"1-889e0d198f50d28df33bf522106b9438","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Fall from in-line roller-skates, initial encounter"]}},{"_id":"lookup_2_expense_account_list","_rev":"2-3404736b154767f3fe30e297704480be","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Pharmacy","Ward"]},"_revisions":{"start":2,"ids":["3404736b154767f3fe30e297704480be","36426f839aa10324a85e92d34fcf2c26"]}},{"_id":"lookup_2_patient_status_list","_rev":"1-01d7dfb8ec77de492bf913c5c763578c","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Scheduled for surgery"]}},{"_id":"lookup_2_physician_list","_rev":"1-99c8212cef905d552ab95fc88b8c3d5b","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Dr Nick"]}},{"_id":"lookup_2_procedure_list","_rev":"1-d48989bf01a1ae70a26e397c43266278","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["hip adductor release"]}},{"_id":"lookup_2_radiologists","_rev":"1-f029e944b51dcc7fd6f980d72c7027c7","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Dr Xray"]}},{"_id":"lookup_2_sex","_rev":"2-215b9ef2d7091253f179116902ee61ae","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Female","Male"]},"_revisions":{"start":2,"ids":["215b9ef2d7091253f179116902ee61ae","0cb12aaddee831fd798fd248e108f946"]}},{"_id":"lookup_2_vendor_list","_rev":"1-a2760a7c86532da3f92ac75899b37e06","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["ACME INC"]}},{"_id":"lookup_2_visit_location_list","_rev":"1-d373d65b719c266173d92d3bb8f14e9f","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Hospital"]}},{"_id":"lookup_2_warehouse_list","_rev":"3-86923622f95bb3f49a906cb7cbacdc85","data":{"importFile":false,"organizeByType":false,"userCanAdd":true,"value":["Pharmacy","Ward 1","Warehouse"]},"_revisions":{"start":3,"ids":["86923622f95bb3f49a906cb7cbacdc85","64a1b3813d337c7000044dbc2de21892","4f316909ed8500d0f80cf20a684ce343"]}},{"_id":"medication_2_7B63E873-D056-CCC5-A69C-60064472A16E","_rev":"1-1ebd1e9a0f4dd4d90b52eb37db7fb493","data":{"notes":null,"prescription":"Twice a day for two days","prescriptionDate":"2015-12-28T06:00:00.000Z","quantity":4,"refills":null,"requestedDate":"2015-12-29T04:16:44.877Z","requestedBy":"Admin User","status":"Requested","lastModified":"2015-12-29T04:16:44.879Z","modifiedBy":"Admin User","inventoryItem":"iiqtc6w3_31","patient":"C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","visit":"03C7BF8B-04E0-DD9E-9469-96A5604F5340","modifiedFields":{"prescriptionDate":"2015-12-29T04:16:44.879Z","prescription":"2015-12-29T04:16:44.879Z","quantity":"2015-12-29T04:16:44.879Z","status":"2015-12-29T04:16:44.879Z","requestedBy":"2015-12-29T04:16:44.879Z","requestedDate":"2015-12-29T04:16:44.879Z"}}},{"_id":"medication_2_9187CEE0-13EC-1816-A2A4-95E9797999BF","_rev":"1-271cd0960f61b322d66b57a994141733","data":{"notes":null,"prescription":"Once a day for 2 days","prescriptionDate":"2015-12-01T06:00:00.000Z","quantity":2,"refills":null,"requestedDate":"2015-12-29T04:01:16.079Z","requestedBy":"Admin User","status":"Fulfilled","lastModified":"2015-12-29T04:01:16.096Z","modifiedBy":"Admin User","inventoryItem":"iiqtc6w3_31","patient":"C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","visit":"03C7BF8B-04E0-DD9E-9469-96A5604F5340","modifiedFields":{"prescriptionDate":"2015-12-29T04:01:16.096Z","prescription":"2015-12-29T04:01:16.096Z","quantity":"2015-12-29T04:01:16.096Z","status":"2015-12-29T04:01:16.096Z","requestedBy":"2015-12-29T04:01:16.096Z","requestedDate":"2015-12-29T04:01:16.096Z"}}},{"_id":"patient_2_C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","_rev":"4-1c58ffef18d0e8a6cf67f5af11541f71","data":{"admitted":true,"address":null,"address2":null,"address3":null,"address4":null,"bloodType":null,"clinic":null,"country":null,"dateOfBirth":"2013-08-06T05:00:00.000Z","economicClassification":null,"email":null,"externalPatientId":null,"familySupport1":null,"familySupport2":null,"familySupport3":null,"familySupport4":null,"familySupport5":null,"friendlyId":"P00001","firstName":"Joe","sex":"Male","history":null,"insurance":null,"lastName":"Bagadonuts","livingArrangement":null,"middleName":"","notes":null,"otherIncome":null,"patientType":null,"parent":null,"phone":null,"placeOfBirth":null,"referredDate":null,"referredBy":null,"religion":null,"socialActionTaken":null,"socialRecommendation":null,"status":"Scheduled for surgery","lastModified":"2015-12-29T03:53:58.574Z","modifiedBy":"Admin User","paymentProfile":null,"payments":[],"modifiedFields":{"friendlyId":"2015-12-29T03:51:02.781Z","firstName":"2015-12-29T03:51:02.781Z","middleName":"2015-12-29T03:51:02.781Z","lastName":"2015-12-29T03:51:02.781Z","gender":"2015-12-29T03:51:02.781Z","dateOfBirth":"2015-12-29T03:51:02.781Z","status":"2015-12-29T03:53:17.032Z","admitted":"2015-12-29T03:53:58.574Z"}},"_revisions":{"start":4,"ids":["1c58ffef18d0e8a6cf67f5af11541f71","1351af326b99acc03278830f30192916","105429e78d710023d6d490e880a3132a","fa6de36be0214f08f09477729bdfb339"]}},{"_id":"pricing_2_4C0FA251-6FEA-8DDA-9DEB-83993EAB25F2","_rev":"1-410ff865070244eac14c5cad5db0ad80","data":{"category":"Lab","expenseAccount":null,"name":"Fasting Blood Sugar (FBS)","price":null,"pricingType":"Lab Procedure","lastModified":"2015-12-29T04:18:34.703Z","modifiedBy":"Admin User","pricingOverrides":[],"modifiedFields":{"name":"2015-12-29T04:18:34.703Z","category":"2015-12-29T04:18:34.703Z","pricingType":"2015-12-29T04:18:34.703Z"}}},{"_id":"pricing_2_A33BFA09-AFBB-CA35-A01C-702B568FFAE8","_rev":"1-70ff211de7621293ffbd91df901f6d0f","data":{"category":"Lab","expenseAccount":null,"name":"Bleeding Time","price":null,"pricingType":"Lab Procedure","lastModified":"2015-12-29T04:03:22.884Z","modifiedBy":"Admin User","pricingOverrides":[],"modifiedFields":{"name":"2015-12-29T04:03:22.884Z","category":"2015-12-29T04:03:22.884Z","pricingType":"2015-12-29T04:03:22.884Z"}}},{"_id":"pricing_2_B93625F1-3C41-2D3E-94B9-3A8BAF87EBE8","_rev":"1-30c9df5437c85bb21539024c7222d307","data":{"category":"Imaging","expenseAccount":null,"name":"Ankle (Any Single View)","price":null,"pricingType":"Imaging Procedure","lastModified":"2015-12-29T04:07:03.700Z","modifiedBy":"Admin User","pricingOverrides":[],"modifiedFields":{"name":"2015-12-29T04:07:03.700Z","category":"2015-12-29T04:07:03.700Z","pricingType":"2015-12-29T04:07:03.700Z"}}},{"_id":"procCharge_2_0AD46995-188B-EFB9-8A33-E47B3980476C","_rev":"1-3f577e28daa86e12c2ad71799e383c3b","data":{"quantity":1,"dateCharged":"2015-12-29T04:00:00.093Z","lastModified":"2015-12-29T04:00:08.611Z","modifiedBy":"Admin User","medication":"iiqtc6w3_31","pricingItem":null,"modifiedFields":{"dateCharged":"2015-12-29T04:00:08.611Z","quantity":"2015-12-29T04:00:08.611Z"}}},{"_id":"procedure_2_398B4F58-152F-1476-8ED1-329C4D85E25F","_rev":"5-979bd8081e0ae3ccebf595c28bafd145","data":{"anesthesiaType":"","anesthesiologist":null,"assistant":null,"description":"hip adductor release","cptCode":"27001","location":null,"notes":null,"physician":"Dr Nick","procedureDate":"2015-12-01T06:00:00.000Z","timeStarted":null,"timeEnded":null,"lastModified":"2015-12-29T04:00:33.229Z","modifiedBy":"Admin User","visit":"03C7BF8B-04E0-DD9E-9469-96A5604F5340","charges":["0AD46995-188B-EFB9-8A33-E47B3980476C"],"modifiedFields":{"procedureDate":"2015-12-29T03:59:55.401Z","description":"2015-12-29T03:59:37.244Z","physician":"2015-12-29T03:59:37.244Z","anesthesiaType":"2015-12-29T03:59:37.244Z","cptCode":"2015-12-29T04:00:33.229Z"}},"_revisions":{"start":5,"ids":["979bd8081e0ae3ccebf595c28bafd145","561ab91abdd5e0f240a3ec30c9a3e09c","0a938774f0f0e600f15dd29d08b98b50","5570e1e8726f29f430a5de6e81a36e60","6c0abd3cf72cb182b05caa21150fb113"]}},{"_id":"sequence_2_inventory_Medication","_rev":"1-1acccea88a50973cbe8840a31911aa7c","data":{"prefix":"m","value":1}},{"_id":"sequence_2_inventory_Supply","_rev":"1-538fc2bf7cd4745eea01fcf24ced6164","data":{"prefix":"s","value":1}},{"_id":"sequence_2_patient","_rev":"5-f6fd8c9cb7b07567399a04a72f02822a","data":{"prefix":null,"value":1},"_revisions":{"start":5,"ids":["f6fd8c9cb7b07567399a04a72f02822a","79dabe4ed5c7897e103171a7bf8bf1b6","945c072575a32fca103968a3cd425c31","f9a8fd6c55cd4e5fb0064b7767586e05","5bc31ffefa482f2e66299cf0704623c8"]}},{"_id":"visit_2_03C7BF8B-04E0-DD9E-9469-96A5604F5340","_rev":"14-09b2a3ac1ac8c343d0f6a6d667bc5357","data":{"dischargeInfo":null,"endDate":"2015-12-29T04:11:00.724Z","examiner":"Dr Nick","history":null,"historySince":null,"location":null,"notes":null,"outPatient":false,"paymentState":"pending","primaryDiagnosis":"Fall from in-line roller-skates, initial encounter","primaryBillingDiagnosis":null,"primaryBillingDiagnosisId":null,"startDate":"2015-12-01T15:53:00.000Z","status":"Admitted","visitType":"Admission","archived":false,"lastModified":"2016-11-02T13:40:50.466Z","modifiedBy":"Admin User","patient":"C87BFCB2-F772-7A7B-8FC7-AD00C018C32A","vitals":["B9FDB59B-BA3F-40A2-9D42-2A9B0E7270FC"],"procedures":["398B4F58-152F-1476-8ED1-329C4D85E25F"],"patientNotes":[],"medication":["9187CEE0-13EC-1816-A2A4-95E9797999BF","7B63E873-D056-CCC5-A69C-60064472A16E"],"labs":["C9274C34-248C-FF7C-9E8B-F3110467C941","EE3063E6-832D-930D-AD4E-D27341709886"],"imaging":["51AFF85A-69C0-97C1-B22C-716A1BA7B80B","12DEDA58-4670-7A74-BA8B-9CC5E5CA82E7"],"charges":[],"modifiedFields":{"visitType":"2015-12-29T03:53:58.543Z","startDate":"2015-12-29T04:11:47.272Z","status":"2016-11-02T13:40:50.466Z","outPatient":"2015-12-29T03:53:58.543Z","primaryDiagnosis":"2015-12-29T03:59:37.312Z","examiner":"2015-12-29T04:06:19.274Z","endDate":"2015-12-29T04:11:47.272Z"}},"_revisions":{"start":14,"ids":["09b2a3ac1ac8c343d0f6a6d667bc5357","c5db061eca43852a9082628407227388","48973daa88a2567931f70586aa5f4b6e","0baeb91a16dad77c0d8e55e6b38e6c8e","e26c621939e57cdf40fe92362f5dac3a","7315d0ff5e6eac570c2b47fd6e9d9406","d1be40a55f4329d18cc6c8f8b8b2d55a","e8567f5b5576aa5d4141f2776b24ab58","d54e63df97dd964288c6dd66d049dae9","210c948fb309be4793ca14cec7f3a335","29e6bb7a6732517b79f8c90fbcebdedd","a83b26f6b056f7c54d917160b366a75b","ebed6471bdd978af39c5acfc3f1f34b7","284cb8e69ca4b392156fe1d22866fcfb"]}},{"_id":"vital_2_B9FDB59B-BA3F-40A2-9D42-2A9B0E7270FC","_rev":"1-62233a35020adba2b7d65fd09e5e3cba","data":{"dateRecorded":"2015-12-04T04:08:00.000Z","temperature":36.67,"weight":"57lb","height":"3\'6\\"","sbp":117,"dbp":76,"heartRate":60,"respiratoryRate":12,"lastModified":"2015-12-29T04:11:11.942Z","modifiedBy":"Admin User","modifiedFields":{"dateRecorded":"2015-12-29T04:11:11.942Z","temperature":"2015-12-29T04:11:11.942Z","weight":"2015-12-29T04:11:11.942Z","height":"2015-12-29T04:11:11.942Z","sbp":"2015-12-29T04:11:11.942Z","dbp":"2015-12-29T04:11:11.942Z","heartRate":"2015-12-29T04:11:11.942Z","respiratoryRate":"2015-12-29T04:11:11.942Z"}}}]}\n{"seq":100}\n';});
define('hospitalrun/transforms/attachment', ['exports', 'ember-pouch/transforms/attachment'], function (exports, _emberPouchTransformsAttachment) {
  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _emberPouchTransformsAttachment['default'];
    }
  });
});
define('hospitalrun/transforms/attachments', ['exports', 'ember-pouch/transforms/attachments'], function (exports, _emberPouchTransformsAttachments) {
  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _emberPouchTransformsAttachments['default'];
    }
  });
});
define('hospitalrun/transforms/custom-fields', ['exports', 'ember-data', 'ember', 'npm:uuid'], function (exports, _emberData, _ember, _npmUuid) {
  var get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _emberData['default'].Transform.extend({
    store: _ember['default'].inject.service(),

    deserialize: function deserialize(serialized) {
      var _this = this;

      if (isEmpty(serialized)) {
        return serialized;
      }
      return serialized.map(function (customField) {
        var store = _this.get('store');
        var record = store.push({
          data: {
            id: _npmUuid['default'].v4(),
            type: 'custom-field',
            attributes: customField
          }
        });
        return record;
      });
    },

    serialize: function serialize(deserialized) {
      if (isEmpty(deserialized)) {
        return deserialized;
      }
      var serializedField = deserialized.map(function (customField) {
        var serializedValue = customField.serialize();
        var deserializedValues = customField.get('values');
        if (!isEmpty(deserializedValues)) {
          var serializedValues = deserializedValues.map(function (value) {
            var property = get(value, 'property');
            var serializedValue = {
              label: get(value, 'label')
            };
            if (!isEmpty(property)) {
              serializedValue.property = property;
            }
            return serializedValue;
          });
          serializedValue.values = serializedValues;
        }
        return serializedValue;
      });
      return serializedField;
    }
  });
});
define('hospitalrun/transforms/custom-forms', ['exports', 'ember-data', 'ember'], function (exports, _emberData, _ember) {
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _emberData['default'].Transform.extend({
    store: _ember['default'].inject.service(),

    deserialize: function deserialize(serialized) {
      if (isEmpty(serialized)) {
        return serialized;
      }
      var customFormKeys = Object.keys(serialized);
      var deserialized = _ember['default'].Object.create();
      customFormKeys.forEach(function (customFormId) {
        deserialized.set(customFormId, _ember['default'].Object.create(serialized[customFormId]));
      });
      return deserialized;
    },

    serialize: function serialize(deserialized) {
      return deserialized;
    }
  });
});
define('hospitalrun/transforms/operative-procedures', ['exports', 'ember-data', 'ember'], function (exports, _emberData, _ember) {
  var get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _emberData['default'].Transform.extend({

    deserialize: function deserialize(serialized) {
      if (isEmpty(serialized)) {
        return [];
      }
      return serialized.map(function (description) {
        return {
          description: description
        };
      });
    },

    serialize: function serialize(deserialized) {
      if (isEmpty(deserialized)) {
        return [];
      }
      return deserialized.map(function (procedure) {
        return get(procedure, 'description');
      });
    }

  });
});
define('hospitalrun/users/delete/controller', ['exports', 'hospitalrun/controllers/abstract-delete-controller', 'ember-i18n'], function (exports, _hospitalrunControllersAbstractDeleteController, _emberI18n) {
  exports['default'] = _hospitalrunControllersAbstractDeleteController['default'].extend({
    title: (0, _emberI18n.translationMacro)('labels.deleteUser'),

    actions: {
      'delete': function _delete() {
        var _this = this;

        var recordToDelete = this.get('model');
        this.get('model').destroyRecord().then(function () {
          _this.send('closeModal', recordToDelete);
        });
      }
    }
  });
});
define("hospitalrun/users/delete/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "9Ip3z8+p", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-warning-sign\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"t\"],[\"messages.delete\"],null],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/users/delete/template.hbs" } });
});
define('hospitalrun/users/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember', 'hospitalrun/mixins/user-roles', 'npm:uuid'], function (exports, _hospitalrunControllersAbstractEditController, _ember, _hospitalrunMixinsUserRoles, _npmUuid) {
  var get = _ember['default'].get;
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsUserRoles['default'], {
    config: _ember['default'].inject.service(),
    usersController: _ember['default'].inject.controller('users/index'),
    updateCapability: 'add_user',

    users: null,

    actions: {
      update: function update() {
        var _this = this;

        var updateModel = this.get('model');
        var users = this.get('users');

        if (updateModel.get('isNew')) {
          var newData = updateModel.getProperties('password', 'email', 'roles', 'displayName');
          newData.name = newData.email;
          newData.id = 'org.couchdb.user:' + newData.email;
          if (_ember['default'].isEmpty(newData.password)) {
            newData.password = _npmUuid['default'].v4() + _npmUuid['default'].v4();
          }
          updateModel.deleteRecord();
          updateModel = this.get('store').createRecord('user', newData);
          this.set('model', updateModel);
        }

        if (_ember['default'].isEmpty(updateModel.get('userPrefix'))) {
          var counter = 1;
          var prefix = 'p';
          var userPrefix = prefix + 0;
          var usedPrefix = users.findBy('userPrefix', prefix);

          while (!_ember['default'].isEmpty(usedPrefix)) {
            prefix = userPrefix + counter++;
            usedPrefix = users.findBy('userPrefix', prefix);
          }
          updateModel.set('userPrefix', prefix);
        }
        updateModel.save().then(function () {
          _this.displayAlert(get(_this, 'i18n').t('messages.userSaved'), get(_this, 'i18n').t('messages.userHasBeenSaved'));
          var editTitle = get(_this, 'i18n').t('labels.editUser');
          var sectionDetails = {};
          sectionDetails.currentScreenTitle = editTitle;
          _this.send('setSectionHeader', sectionDetails);
          get(_this, 'config').markUserSetupComplete();
        })['catch'](function (error) {
          _this._handleError(error);
        });
      }
    }
  });
});
define('hospitalrun/users/edit/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'ember', 'ember-i18n'], function (exports, _hospitalrunRoutesAbstractEditRoute, _ember, _emberI18n) {
  var set = _ember['default'].set;
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend({
    editTitle: (0, _emberI18n.translationMacro)('labels.editUser'),
    modelName: 'user',
    newTitle: (0, _emberI18n.translationMacro)('labels.newUser'),

    getNewData: function getNewData() {
      return _ember['default'].RSVP.resolve({
        roles: ['Data Entry', 'user']
      });
    },

    setupController: function setupController(controller, model) {
      var _this = this;

      this._super(controller, model);
      this.store.findAll('user').then(function (users) {
        set(controller, 'users', users);
      })['catch'](function (err) {
        return _this.send('error', err);
      });
    }
  });
});
define("hospitalrun/users/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "aosRecDl", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],2]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group has-success\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.username\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-control\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"unknown\",[\"model\",\"name\"]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"unless\"],[[\"get\",[\"model\",\"isNew\"]]],null,0],[\"text\",\"    \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"displayName\",[\"helper\",[\"t\"],[\"labels.displayName\"],null],\"user-display-name\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"type\",\"label\",\"class\"],[\"email\",\"email\",[\"helper\",[\"t\"],[\"labels.email\"],null],\"user-email\"]]],false],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"type\",\"label\",\"class\"],[\"password\",\"password\",[\"helper\",[\"t\"],[\"labels.password\"],null],\"user-password\"]]],false],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group has-success\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.role\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"role-select\"],null,[[\"selection\",\"content\",\"action\",\"class\"],[[\"get\",[\"model\",\"roles\"]],[\"get\",[\"userRoles\"]],[\"helper\",[\"action\"],[[\"get\",[null]],[\"helper\",[\"mut\"],[[\"get\",[\"model\",\"roles\"]]],null]],null],\"user-role\"]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],1]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/users/edit/template.hbs" } });
});
define('hospitalrun/users/index/controller', ['exports', 'hospitalrun/controllers/abstract-paged-controller', 'hospitalrun/mixins/user-session'], function (exports, _hospitalrunControllersAbstractPagedController, _hospitalrunMixinsUserSession) {
  exports['default'] = _hospitalrunControllersAbstractPagedController['default'].extend(_hospitalrunMixinsUserSession['default'], {
    addPermission: 'add_user',
    deletePermission: 'delete_user',
    sortProperties: ['displayName']
  });
});
define('hospitalrun/users/index/route', ['exports', 'hospitalrun/routes/abstract-index-route', 'hospitalrun/mixins/user-session', 'ember-i18n', 'ember'], function (exports, _hospitalrunRoutesAbstractIndexRoute, _hospitalrunMixinsUserSession, _emberI18n, _ember) {
  var inject = _ember['default'].inject;
  exports['default'] = _hospitalrunRoutesAbstractIndexRoute['default'].extend(_hospitalrunMixinsUserSession['default'], {
    config: inject.service(),
    newButtonAction: (function () {
      if (this.currentUserCan('add_user')) {
        return 'newItem';
      } else {
        return null;
      }
    }).property(),
    newButtonText: (0, _emberI18n.translationMacro)('user.plusNewUser'),
    pageTitle: (0, _emberI18n.translationMacro)('user.usersPageTile'),
    model: function model() {
      return this.store.findAll('user');
    }
  });
});
define("hospitalrun/users/index/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "pWAe2sUe", "block": "{\"statements\":[[\"block\",[\"item-listing\"],null,[[\"paginationProps\"],[[\"get\",[\"paginationProps\"]]]],9]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"        \"],[\"open-element\",\"em\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"messages.createNewUser\"],null],false],[\"close-element\"],[\"text\",\" \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newItem\"]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.newUser\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-info\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"em\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"messages.noUsersFound\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAdd\"]]],null,0],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"deleteItem\",[\"get\",[\"user\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"user\"]]],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAdd\"]]],null,3],[\"block\",[\"if\"],[[\"get\",[\"canDelete\"]]],null,2],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"clickable\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"editItem\",[\"get\",[\"user\"]]]],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"user-name\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"user\",\"name\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"user-display-name\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"user\",\"displayName\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"user-email\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"user\",\"email\"]],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"td\",[]],[\"static-attr\",\"class\",\"user-role\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"user\",\"displayRole\"]],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,4],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"unless\"],[[\"get\",[\"user\",\"deleted\"]]],null,5]],\"locals\":[\"user\"]},{\"statements\":[[\"text\",\"          \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.username\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.name\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.email\"],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.role\"],null],false],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"showActions\"]]],null,7],[\"text\",\"      \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\"]]],null,6],[\"text\",\"    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"hasRecords\"]]],null,8,1]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/users/index/template.hbs" } });
});
define('hospitalrun/users/route', ['exports', 'ember-simple-auth/mixins/authenticated-route-mixin', 'ember'], function (exports, _emberSimpleAuthMixinsAuthenticatedRouteMixin, _ember) {
  exports['default'] = _ember['default'].Route.extend(_emberSimpleAuthMixinsAuthenticatedRouteMixin['default'], {
    actions: {
      allItems: function allItems() {
        this.transitionTo('users.index');
      }
    }
  });
});
define('hospitalrun/utils/date-sort', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = {
    sortByDate: function sortByDate(firstItem, secondItem, compareAttribute) {
      var firstDate = firstItem.get(compareAttribute);
      var secondDate = secondItem.get(compareAttribute);
      return _ember['default'].compare(firstDate.getTime(), secondDate.getTime());
    }
  };
});
define("hospitalrun/utils/email-validation", ["exports"], function (exports) {
  exports["default"] = {
    emailRegex: /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
  };
});
define('hospitalrun/utils/get-cmd-key', ['exports', 'ember-keyboard/utils/get-cmd-key'], function (exports, _emberKeyboardUtilsGetCmdKey) {
  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _emberKeyboardUtilsGetCmdKey['default'];
    }
  });
});
define('hospitalrun/utils/i18n/compile-template', ['exports', 'ember-i18n/utils/i18n/compile-template'], function (exports, _emberI18nUtilsI18nCompileTemplate) {
  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _emberI18nUtilsI18nCompileTemplate['default'];
    }
  });
});
define('hospitalrun/utils/i18n/missing-message', ['exports', 'ember-i18n/utils/i18n/missing-message'], function (exports, _emberI18nUtilsI18nMissingMessage) {
  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _emberI18nUtilsI18nMissingMessage['default'];
    }
  });
});
define('hospitalrun/utils/item-condition', ['exports', 'ember'], function (exports, _ember) {
  exports.rankToMultiplier = rankToMultiplier;
  exports.getCondition = getCondition;

  var rankMultiplierValues = [{
    rank: 'A',
    value: 0.5
  }, {
    rank: 'B',
    value: 1
  }, {
    rank: 'C',
    value: 2
  }];

  function rankToMultiplier() {
    var rank = arguments.length <= 0 || arguments[0] === undefined ? 'B' : arguments[0];

    var rankModel = _ember['default'].A(rankMultiplierValues).findBy('rank', rank);
    return rankModel.value;
  }

  function getCondition(estimatedDaysOfStock) {
    var multiplier = arguments.length <= 1 || arguments[1] === undefined ? 1 : arguments[1];

    estimatedDaysOfStock *= multiplier;

    if (estimatedDaysOfStock >= 14) {
      return 'good';
    } else if (estimatedDaysOfStock < 7) {
      return 'bad';
    } else {
      return 'average';
    }
  }
});
define('hospitalrun/utils/listener-name', ['exports', 'ember-keyboard/utils/listener-name'], function (exports, _emberKeyboardUtilsListenerName) {
  Object.defineProperty(exports, 'default', {
    enumerable: true,
    get: function get() {
      return _emberKeyboardUtilsListenerName['default'];
    }
  });
});
define('hospitalrun/utils/patient-validation', ['exports', 'ember'], function (exports, _ember) {
  exports['default'] = {
    patientTypeAhead: {
      acceptance: {
        accept: true,
        'if': function _if(object) {
          if (!object.get('selectPatient')) {
            return false;
          }
          if (!object.get('hasDirtyAttributes')) {
            return false;
          }
          var patientName = object.get('patient.displayName');
          var patientTypeAhead = object.get('patientTypeAhead');
          if (_ember['default'].isEmpty(patientName) || _ember['default'].isEmpty(patientTypeAhead)) {
            // force validation to fail
            return true;
          } else {
            var typeAheadName = patientTypeAhead.substr(0, patientName.length).toLowerCase();
            if (patientName.toLowerCase().indexOf(typeAheadName) !== 0) {
              return true;
            }
          }
          // patient is properly selected; don't do any further validation
          return false;
        },
        message: 'Please select a patient'
      }
    }
  };
});
define('hospitalrun/utils/pouch-views', ['exports', 'ember'], function (exports, _ember) {
  /* global req */
  /* global compareStrings */
  /* global getCompareDate */

  function buildIndex(indexName, db) {
    return db.query(indexName, {
      limit: 0
    })['catch'](function (err) {
      console.log('index error: ' + JSON.stringify(err, null, 2));
    });
  }

  function createDesignDoc(item, rev) {
    var ddoc = {
      _id: '_design/' + item.name,
      version: item.version,
      views: {}
    };
    if (rev) {
      ddoc._rev = rev;
    }
    ddoc.views[item.name] = { map: item['function'].toString() };
    if (item.sort) {
      ddoc.lists = {
        sort: item.sort
      };
    }
    return ddoc;
  }

  function checkForUpdate(view, db, runningTest, testDumpFile) {
    return db.get('_design/' + view.name).then(function (doc) {
      if (doc.version !== view.version) {
        return updateDesignDoc(view, db, doc._rev, runningTest, testDumpFile);
      } else {
        if (runningTest) {
          // Indexes need to be built when running tests
          return buildIndex(view.name, db);
        } else {
          return _ember['default'].RSVP.resolve();
        }
      }
    }, function () {
      return updateDesignDoc(view, db, null, runningTest, testDumpFile);
    });
  }

  function generateSortFunction(sortFunction, includeCompareDate, filterFunction) {
    var generatedFunction = 'function(head, req) {' + 'function keysEqual(keyA, keyB) {' + 'for (var i= 0; i < keyA.length; i++) {' + 'if (keyA[i] !== keyB[i]) {' + 'return false;' + '}' + '}' + 'return true;' + '}';
    if (includeCompareDate) {
      generatedFunction += 'function getCompareDate(dateString) {' + 'if (!dateString || dateString === "") {' + 'return 0;' + '}' + 'return new Date(dateString).getTime();' + '}';
    }
    generatedFunction += 'function compareStrings(aString, bString) {' + 'if (!aString) {' + 'aString = "";' + '}' + 'if (!bString) {' + 'bString = "";' + '}' + 'if (aString < bString) {' + 'return -1;' + '} else if (aString > bString) {' + 'return 1;' + '} else {' + 'return 0;' + '}' + '}' + 'var row,' + 'rows=[],' + 'startingPosition = 0;' + 'while(row = getRow()) {' + 'rows.push(row);' + '}';
    if (filterFunction) {
      generatedFunction += 'rows = rows.filter(' + filterFunction + ');';
    }
    generatedFunction += 'rows.sort(' + sortFunction + ');' + 'if (req.query.sortDesc) {' + 'rows = rows.reverse();' + '}' + 'if (req.query.sortStartKey) {' + 'var startKey = JSON.parse(req.query.sortStartKey);' + 'for (var i=0; i<rows.length; i++) {' + 'if (keysEqual(startKey, rows[i].key)) {' + 'startingPosition = i;' + 'break;' + '}' + '}' + '}' + 'if (req.query.sortLimit) {' + 'rows = rows.slice(startingPosition, parseInt(req.query.sortLimit)+startingPosition);' + '} else if (startingPosition > 0) {' + 'rows = rows.slice(startingPosition);' + '}' + 'send(JSON.stringify({"rows" : rows}));' + '}';
    return generatedFunction;
  }

  function generateView(viewDocType, viewBody) {
    return 'function(doc) {\n    var doctype, uidx;\n    if (doc._id && (uidx = doc._id.indexOf(\'_\')) > 0 && !doc.data.archived) {\n      doctype = doc._id.substring(0, uidx);\n      if (doctype === \'' + viewDocType + '\') {\n        ' + viewBody + '\n      }\n    }\n  }';
  }

  function updateDesignDoc(item, db, rev, runningTest, testDumpFile) {
    var designDoc = createDesignDoc(item, rev);
    if (runningTest) {
      console.log('WARNING: The view ' + item.name + ' is out of date. Please update the pouch dump ' + testDumpFile + ' to the latest version of ' + item.name);
    }
    return db.put(designDoc).then(function () {
      // Update index
      return buildIndex(item.name, db);
    }, function (err) {
      console.log('ERR updating design doc:', JSON.stringify(err, null, 2));
      // ignored, design doc already exists
    });
  }

  function generateDateForView(date1) {
    return 'var ' + date1 + ' = doc.data.' + date1 + ';\n    if (' + date1 + ' && ' + date1 + ' !== "") {\n      ' + date1 + ' = new Date(' + date1 + ');\n      if (' + date1 + '.getTime) {\n        ' + date1 + ' = ' + date1 + '.getTime();\n      }\n    }';
  }

  var appointmentSearch = generateSortFunction((function (a, b) {
    function defaultStatus(value) {
      if (!value || value === '') {
        return 'Scheduled';
      } else {
        return value;
      }
    }
    var sortBy = '';
    if (req.query && req.query.sortKey) {
      sortBy = req.query.sortKey;
    }
    switch (sortBy) {
      case 'appointmentType':
      case 'location':
      case 'provider':
        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);
      case 'date':
        {
          var startDiff = getCompareDate(a.doc.data.startDate) - getCompareDate(b.doc.data.startDate);
          if (startDiff === 0) {
            return getCompareDate(a.doc.data.endDate) - getCompareDate(b.doc.data.endDate);
          } else {
            return startDiff;
          }
        }
      case 'status':
        {
          var aStatus = defaultStatus(a.doc.data[sortBy]);
          var bStatus = defaultStatus(b.doc.data[sortBy]);
          return compareStrings(aStatus, bStatus);
        }
      default:
        {
          return 0; // Don't sort
        }
    }
  }).toString(), true, (function (row) {
    var filterBy = null;
    var includeRow = true;
    if (req.query && req.query.filterBy) {
      filterBy = JSON.parse(req.query.filterBy);
    }
    if (!filterBy) {
      return true;
    }
    for (var i = 0; i < filterBy.length; i++) {
      var currentValue = row.doc.data[filterBy[i].name];
      if (filterBy[i].name === 'status' && (!currentValue || currentValue === '')) {
        currentValue = 'Scheduled';
      }
      if (currentValue !== filterBy[i].value) {
        includeRow = false;
        break;
      }
    }
    return includeRow;
  }).toString());

  var patientListingKey = 'if (doc.data.friendlyId) {\n    emit([doc.data.friendlyId, doc._id]);\n  } else if (doc.data.externalPatientId) {\n    emit([doc.data.externalPatientId, doc._id]);\n  } else {\n    emit([doc._id, doc._id]);\n }';

  var patientListingSearch = generateSortFunction((function (a, b) {
    var sortBy = '';
    if (req.query && req.query.sortKey) {
      sortBy = req.query.sortKey;
    }
    switch (sortBy) {
      case 'firstName':
      case 'sex':
      case 'lastName':
      case 'status':
        {
          return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);
        }
      case 'dateOfBirth':
        {
          return getCompareDate(a.doc.data.dateOfBirth) - getCompareDate(b.doc.data.dateOfBirth);
        }
      default:
        {
          return 0; // Don't sort
        }
    }
  }).toString(), true);

  var designDocs = [{
    name: 'appointments_by_date',
    'function': generateView('appointment', generateDateForView('endDate') + '\n    ' + generateDateForView('startDate') + '\n    if (doc.data.appointmentType !== \'Surgery\') {\n      emit([startDate, endDate, doc._id]);\n    }'),
    sort: appointmentSearch,
    version: 7
  }, {
    name: 'appointments_by_patient',
    'function': generateView('appointment', generateDateForView('endDate') + '\n    ' + generateDateForView('startDate') + '\n    emit([doc.data.patient, startDate, endDate,doc._id]);'),
    version: 4
  }, {
    name: 'custom_form_by_type',
    'function': generateView('customForm', 'emit(doc.data.formType);'),
    version: 1
  }, {
    name: 'imaging_by_status',
    'function': generateView('imaging', generateDateForView('imagingDate') + '\n    ' + generateDateForView('requestedDate') + '\n    emit([doc.data.status, requestedDate, imagingDate, doc._id]);'),
    version: 4
  }, {
    name: 'inventory_by_friendly_id',
    'function': generateView('inventory', 'emit([doc.data.friendlyId, doc._id]);'),
    version: 1
  }, {
    name: 'inventory_by_name',
    'function': generateView('inventory', 'emit([doc.data.name, doc._id]);'),
    sort: generateSortFunction((function (a, b) {
      var sortBy = '';
      if (req.query && req.query.sortKey) {
        sortBy = req.query.sortKey;
      }
      switch (sortBy) {
        case 'crossReference':
        case 'description':
        case 'friendlyId':
        case 'name':
        case 'price':
        case 'quantity':
        case 'inventoryType':
          {
            return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);
          }
        default:
          {
            return 0; // Don't sort
          }
      }
    }).toString()),
    version: 5
  }, {
    name: 'incident_by_friendly_id',
    'function': generateView('incident', 'emit([doc.data.friendlyId, doc._id]);'),
    version: 1
  }, {
    name: 'incident_by_date',
    'function': generateView('incident', generateDateForView('dateOfIncident') + '\n    emit([dateOfIncident, doc._id]);'),
    version: 1
  }, {
    name: 'open_incidents_by_user',
    'function': generateView('incident', 'if (doc.data.status !== "Closed") {\n      emit([doc.data.reportedBy, doc._id]);\n    }'),
    sort: generateSortFunction((function (a, b) {
      var sortBy = '';
      if (req.query && req.query.sortKey) {
        sortBy = req.query.sortKey;
        return compareStrings(a.doc.data[sortBy], b.doc.data[sortBy]);
      }
      return 0; // Don't sort
    }).toString()),
    version: 1
  }, {
    name: 'closed_incidents_by_user',
    'function': generateView('incident', 'if (doc.data.status === "Closed") {\n      emit([doc.data.reportedBy, doc._id]);\n    }'),
    version: 1
  }, {
    name: 'inventory_by_type',
    'function': generateView('inventory', 'emit(doc.data.inventoryType);'),
    version: 5
  }, {
    name: 'inventory_purchase_by_date_received',
    'function': generateView('invPurchase', generateDateForView('dateReceived') + '\n    emit([dateReceived, doc._id]);'),
    version: 5
  }, {
    name: 'inventory_purchase_by_expiration_date',
    'function': generateView('invPurchase', generateDateForView('expirationDate') + '\n    emit([expirationDate, doc._id]);'),
    version: 5
  }, {
    name: 'inventory_request_by_item',
    'function': generateView('invRequest', generateDateForView('dateCompleted') + '\n    emit([doc.data.inventoryItem, doc.data.status, dateCompleted]);'),
    version: 5
  }, {
    name: 'inventory_request_by_status',
    'function': generateView('invRequest', generateDateForView('dateCompleted') + '\n    emit([doc.data.status, dateCompleted, doc._id]);'),
    version: 5
  }, {
    name: 'invoice_by_patient',
    'function': generateView('invoice', 'emit(doc.data.patient);'),
    version: 1
  }, {
    name: 'invoice_by_status',
    'function': generateView('invoice', generateDateForView('billDate') + '\n    emit([doc.data.status, billDate, doc._id]);'),
    version: 4
  }, {
    name: 'lab_by_status',
    'function': generateView('lab', generateDateForView('labDate') + '\n    ' + generateDateForView('requestedDate') + '\n    emit([doc.data.status, requestedDate, labDate, doc._id]);'),
    version: 4
  }, {
    name: 'medication_by_status',
    'function': generateView('medication', generateDateForView('prescriptionDate') + '\n    ' + generateDateForView('requestedDate') + '\n    emit([doc.data.status, requestedDate, prescriptionDate, doc._id]);'),
    version: 4
  }, {
    name: 'patient_by_display_id',
    'function': generateView('patient', patientListingKey),
    sort: patientListingSearch,
    version: 7
  }, {
    name: 'patient_by_status',
    'function': generateView('patient', 'emit(doc.data.status);'),
    version: 3
  }, {
    name: 'patient_by_admission',
    'function': generateView('patient', 'if (doc.data.admitted === true) {\n      ' + patientListingKey + '\n    }'),
    sort: patientListingSearch,
    version: 4
  }, {
    name: 'photo_by_patient',
    'function': generateView('photo', 'emit(doc.data.patient);'),
    version: 4
  }, {
    name: 'procedure_by_date',
    'function': generateView('procedure', generateDateForView('procedureDate') + '\n    emit([procedureDate, doc._id]);'),
    version: 4
  }, {
    name: 'pricing_by_category',
    'function': generateView('pricing', 'emit([doc.data.category, doc.data.name, doc.data.pricingType, doc._id]);'),
    version: 5
  }, {
    name: 'sequence_by_prefix',
    'function': generateView('sequence', 'emit(doc.data.prefix);'),
    version: 4
  }, {
    name: 'surgical_appointments_by_date',
    'function': generateView('appointment', generateDateForView('endDate') + '\n    ' + generateDateForView('startDate') + '\n    if (doc.data.appointmentType === \'Surgery\') {\n      emit([startDate, endDate, doc._id]);\n    }'),
    sort: appointmentSearch,
    version: 1
  }, {
    name: 'visit_by_date',
    'function': generateView('visit', generateDateForView('endDate') + '\n    ' + generateDateForView('startDate') + '\n    emit([startDate, endDate, doc._id]);'),
    version: 4
  }, {
    name: 'visit_by_discharge_date',
    'function': generateView('visit', generateDateForView('endDate') + '\n    emit([endDate, doc._id]);'),
    version: 2
  }, {
    name: 'visit_by_patient',
    'function': generateView('visit', generateDateForView('endDate') + '\n    ' + generateDateForView('startDate') + '\n    emit([doc.data.patient, startDate, endDate, doc.data.visitType, doc._id]);'),
    version: 4
  }, {
    name: 'report_by_visit',
    'function': generateView('report', 'emit(doc.data.visit);'),
    version: 1
  }];

  exports['default'] = function (db, runningTest, testDumpFile) {
    var viewUpdates = [];
    designDocs.forEach(function (item) {
      viewUpdates.push(checkForUpdate(item, db, runningTest, testDumpFile));
    });
    return _ember['default'].RSVP.all(viewUpdates);
  };
});
define('hospitalrun/utils/select-values', ['exports', 'ember'], function (exports, _ember) {
  function selectValuesMap(value) {
    return {
      id: value,
      value: value
    };
  }

  exports['default'] = {
    /**
     * Map an objects into a format so that selects can use object as value for select
     * @param {object} object the object to map
     * @returns {object} the mapped object
     */
    selectObjectMap: function selectObjectMap(selectValue) {
      return _ember['default'].Object.create({
        selectObject: selectValue
      });
    },

    selectValuesMap: selectValuesMap,

    /** Map an array of strings to objects with id and value set to the string values
     * so that the array can be used for em-select
     * @param {Array} array to map.
     * @param {boolean} includeEmpty if there should be an empty item added to the select list
     */
    selectValues: function selectValues(array, includeEmpty) {
      if (_ember['default'].isArray(array)) {
        var arrayToMap = new Array(array);
        if (includeEmpty) {
          arrayToMap = [''];
          arrayToMap.addObjects(array);
        } else {
          arrayToMap = array;
        }
        return arrayToMap.map(selectValuesMap);
      }
    }
  };
});
define("hospitalrun/utils/text-expansion", ["exports"], function (exports) {
  exports["default"] = {
    // Find words with expansion prefix
    // '#abc abc #cd' -> ['#abc', '#cd']
    findExpansionSubjects: function findExpansionSubjects(text) {
      var search = /(^|\s+)(#\S+)/g;
      var match = true;

      var subjects = [];
      while (match != null) {

        match = search.exec(text);
        if (match && match.length > 2) {
          subjects.push(match[2]);
        }
      }

      return subjects.filter(onlyUnique);
    },

    // Find all detected expandable sites by index
    // 'abc #abc cd', ['#abc'] -> [{ index: 4, match: '#abc', term: 'abc'}]
    findExpansionSites: function findExpansionSites(text, subjects) {

      return subjects.map(findAllIndices(text)).reduce(function (a, b) {
        // flatmap
        return a.concat(b);
      }, []);
    }
  };

  function findAllIndices(text) {
    return function (value) {
      var result = [];
      var keepMatching = true;
      var matchPoint = 0;
      while (keepMatching) {
        matchPoint = text.indexOf(value, matchPoint);
        if (matchPoint > -1) {
          result.push({
            index: matchPoint,
            match: value,
            term: value.slice(1)
          });
        } else {
          keepMatching = false;
        }

        matchPoint += 1;
      }

      return result;
    };
  }

  function onlyUnique(value, index, self) {
    return self.indexOf(value) === index;
  }
});
define('hospitalrun/utils/unauthorized-error', ['exports', 'ember-data'], function (exports, _emberData) {
  var AdapterError = _emberData['default'].AdapterError;

  var UnauthorizedError = function UnauthorizedError(errors) {
    var message = arguments.length <= 1 || arguments[1] === undefined ? 'The adapter operation is unauthorized' : arguments[1];

    AdapterError.call(this, errors, message);
  };

  UnauthorizedError.prototype = Object.create(AdapterError.prototype);

  exports['default'] = UnauthorizedError;
});
define('hospitalrun/utils/visit-statuses', ['exports'], function (exports) {
  var ADMITTED = 'Admitted';
  exports.ADMITTED = ADMITTED;
  var DISCHARGED = 'Discharged';
  exports.DISCHARGED = DISCHARGED;
  var CHECKED_IN = 'CheckedIn';
  exports.CHECKED_IN = CHECKED_IN;
  var CHECKED_OUT = 'CheckedOut';
  exports.CHECKED_OUT = CHECKED_OUT;
});
define('hospitalrun/visits/charge/controller', ['exports', 'hospitalrun/procedures/charge/controller', 'ember'], function (exports, _hospitalrunProceduresChargeController, _ember) {
  exports['default'] = _hospitalrunProceduresChargeController['default'].extend({
    cancelAction: 'closeModal',
    newPricingItem: false,
    requestingController: _ember['default'].inject.controller('visits/edit')
  });
});
define("hospitalrun/visits/charge/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "mClLNmTf", "block": "{\"statements\":[[\"partial\",\"procedures/charge\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/visits/charge/template.hbs" } });
});
define('hospitalrun/visits/delete/controller', ['exports', 'hospitalrun/controllers/abstract-delete-controller'], function (exports, _hospitalrunControllersAbstractDeleteController) {
  exports['default'] = _hospitalrunControllersAbstractDeleteController['default'].extend({
    title: 'Delete Visit',

    afterDeleteAction: (function () {
      var deleteFromPatient = this.get('model.deleteFromPatient');
      if (deleteFromPatient) {
        return 'visitDeleted';
      } else {
        return 'closeModal';
      }
    }).property('model.deleteFromPatient')
  });
});
define("hospitalrun/visits/delete/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "+96MoF6C", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-warning-sign\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"t\"],[\"messages.delete_singular\"],[[\"name\"],[[\"helper\",[\"t\"],[\"models.visit.names.singular\"],null]]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"form\",[]],[\"static-attr\",\"role\",\"form\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.startDate\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"model\",\"startDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.endDate\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"model\",\"endDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"visits.labels.examiner\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"examiner\"]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.location\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"location\"]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.type\"],null],false],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"visitType\"]],false],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/visits/delete/template.hbs" } });
});
define('hospitalrun/visits/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'hospitalrun/mixins/add-new-patient', 'hospitalrun/mixins/allergy-actions', 'hospitalrun/mixins/charge-actions', 'hospitalrun/mixins/diagnosis-actions', 'ember', 'moment', 'hospitalrun/mixins/patient-notes', 'hospitalrun/mixins/patient-submodule', 'hospitalrun/mixins/user-session', 'hospitalrun/utils/visit-statuses', 'hospitalrun/mixins/visit-types'], function (exports, _hospitalrunControllersAbstractEditController, _hospitalrunMixinsAddNewPatient, _hospitalrunMixinsAllergyActions, _hospitalrunMixinsChargeActions, _hospitalrunMixinsDiagnosisActions, _ember, _moment, _hospitalrunMixinsPatientNotes, _hospitalrunMixinsPatientSubmodule, _hospitalrunMixinsUserSession, _hospitalrunUtilsVisitStatuses, _hospitalrunMixinsVisitTypes) {
  var computed = _ember['default'].computed;
  var get = _ember['default'].get;
  var isEmpty = _ember['default'].isEmpty;
  var set = _ember['default'].set;
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsAddNewPatient['default'], _hospitalrunMixinsAllergyActions['default'], _hospitalrunMixinsChargeActions['default'], _hospitalrunMixinsDiagnosisActions['default'], _hospitalrunMixinsPatientSubmodule['default'], _hospitalrunMixinsPatientNotes['default'], _hospitalrunMixinsUserSession['default'], _hospitalrunMixinsVisitTypes['default'], {
    visitsController: _ember['default'].inject.controller('visits'),
    additionalButtons: computed('model.status', function () {
      var buttonProps = {
        buttonIcon: 'glyphicon glyphicon-log-out',
        'class': 'btn btn-primary on-white'
      };
      var i18n = this.get('i18n');
      var status = this.get('model.status');
      if (status === _hospitalrunUtilsVisitStatuses['default'].ADMITTED) {
        buttonProps.buttonAction = 'discharge';
        buttonProps.buttonText = i18n.t('visits.buttons.discharge');
        return [buttonProps];
      } else if (status === _hospitalrunUtilsVisitStatuses['default'].CHECKED_IN) {
        buttonProps.buttonAction = 'checkout';
        buttonProps.buttonText = i18n.t('visits.buttons.checkOut');
        return [buttonProps];
      }
    }),

    noReport: false,

    canAddAppointment: computed('model.isNew', function () {
      return !this.get('model.isNew') && this.currentUserCan('add_appointment');
    }),

    canAddBillingDiagnosis: computed('model.isNew', function () {
      return !this.get('model.isNew') && this.currentUserCan('add_billing_diagnosis');
    }),

    canAddImaging: (function () {
      return this.currentUserCan('add_imaging');
    }).property(),

    canAddLab: (function () {
      return this.currentUserCan('add_lab');
    }).property(),

    canAddMedication: (function () {
      return this.currentUserCan('add_medication');
    }).property(),

    canAddProcedure: (function () {
      return this.currentUserCan('add_procedure');
    }).property(),

    canAddVitals: (function () {
      return this.currentUserCan('add_vitals');
    }).property(),

    canAddReport: computed('hasReport', function () {
      return this.currentUserCan('add_report') && !this.get('hasReport');
    }),

    canDeleteImaging: (function () {
      return this.currentUserCan('delete_imaging');
    }).property(),

    canDeleteLab: (function () {
      return this.currentUserCan('delete_lab');
    }).property(),

    canDeleteMedication: (function () {
      return this.currentUserCan('delete_medication');
    }).property(),

    canDeleteProcedure: (function () {
      return this.currentUserCan('delete_procedure');
    }).property(),

    canDeleteVitals: (function () {
      return this.currentUserCan('delete_vitals');
    }).property(),

    canDeleteReport: (function () {
      return this.currentUserCan('delete_report');
    }).property(),

    isAdmissionVisit: (function () {
      var visitType = this.get('model.visitType');
      var isAdmission = visitType === 'Admission';
      return isAdmission;
    }).property('model.visitType'),

    cancelAction: (function () {
      var returnTo = this.get('model.returnTo');
      if (!isEmpty(returnTo)) {
        return 'returnTo';
      } else if (!isEmpty(this.get('model.returnToPatient'))) {
        return 'returnToPatient';
      } else {
        return this._super();
      }
    }).property('model.returnTo', 'model.returnToPatient'),

    allowAddAllergy: computed.not('model.isNew'),
    allowAddDiagnosis: computed.not('model.isNew'),
    allowAddOperativePlan: computed.not('model.isNew'),
    chargePricingCategory: 'Ward',
    chargeRoute: 'visits.charge',
    diagnosisList: _ember['default'].computed.alias('visitsController.diagnosisList'),
    findPatientVisits: false,
    hideChargeHeader: true,
    patientImaging: _ember['default'].computed.alias('model.imaging'),
    patientLabs: _ember['default'].computed.alias('model.labs'),
    patientMedications: _ember['default'].computed.alias('model.medication'),
    pricingList: null, // This gets filled in by the route
    pricingTypes: _ember['default'].computed.alias('visitsController.wardPricingTypes'),
    physicianList: _ember['default'].computed.alias('visitsController.physicianList'),
    locationList: _ember['default'].computed.alias('visitsController.locationList'),
    sexList: computed.alias('visitsController.sexList'),
    visitTypesList: _ember['default'].computed.alias('visitsController.visitTypesList'),
    lookupListsToUpdate: [{
      name: 'physicianList',
      property: 'model.examiner',
      id: 'physician_list'
    }, {
      name: 'locationList',
      property: 'model.location',
      id: 'visit_location_list'
    }],

    updateCapability: 'add_visit',

    showPatientSelection: computed('model.checkIn', 'model.hidePatientSelection', function () {
      return this.get('model.checkIn') && !this.get('model.hidePatientSelection');
    }),

    updateButtonIcon: computed('model.checkIn', function () {
      if (this.get('model.checkIn')) {
        return 'glyphicon glyphicon-log-in';
      }
    }),

    updateButtonText: computed('model.{checkIn,isNew}', function () {
      var i18n = this.get('i18n');
      if (this.get('model.checkIn')) {
        return i18n.t('visits.buttons.checkIn');
      } else {
        return this._super();
      }
    }),

    validVisitTypes: (function () {
      var outPatient = this.get('model.outPatient');
      var visitTypes = this.get('visitTypes');
      if (outPatient === true) {
        visitTypes = visitTypes.filter(function (visitType) {
          return visitType.id !== 'Admission';
        });
      }
      return visitTypes;
    }).property('visitTypes', 'model.outPatient'),

    _addChildObject: function _addChildObject(route, afterTransition) {
      var options = {
        queryParams: {
          forVisitId: this.get('model.id')
        }
      };
      this.transitionToRoute(route, 'new', options).then(function (newRoute) {
        if (afterTransition) {
          afterTransition(newRoute);
        }
      });
    },

    _finishAfterUpdate: function _finishAfterUpdate() {
      var addedNewPatient = this.get('addedNewPatient');
      var checkIn = this.get('model.checkIn');
      var i18n = this.get('i18n');
      var updateMesage = i18n.t('visits.messages.visitSaved');
      var updateTitle = i18n.t('visits.titles.visitSaved');
      if (checkIn === true) {
        var model = this.get('model');
        model.set('checkIn');
        this.send('setSectionHeader', {
          currentScreenTitle: i18n.t('visits.titles.editVisit')
        });
      }

      if (checkIn) {
        updateTitle = i18n.t('visits.titles.checkedIn');
        var patientDetails = {
          patientName: this.get('model.patient.displayName')
        };
        if (addedNewPatient === true) {
          this.set('addedNewPatient');
          updateMesage = i18n.t('visits.messages.patientCreatedAndCheckedIn', patientDetails);
        } else {
          updateMesage = i18n.t('visits.messages.patientCheckedIn', patientDetails);
        }
      }
      this.displayAlert(updateTitle, updateMesage);
    },

    _findAssociatedAppointment: function _findAssociatedAppointment(newVisit) {
      var appointment = newVisit.get('appointment');
      var beginningOfToday = (0, _moment['default'])().startOf('day').valueOf();
      var database = this.get('database');
      var endOfToday = (0, _moment['default'])().endOf('day').valueOf();
      var maxId = database.getMaxPouchId('appointment');
      var minId = database.getMinPouchId('appointment');
      var patientId = newVisit.get('patient.id');
      if (!isEmpty(appointment)) {
        return _ember['default'].RSVP.resolve(appointment);
      } else {
        return this.store.query('appointment', {
          options: {
            startkey: [patientId, beginningOfToday, beginningOfToday, minId],
            endkey: [patientId, endOfToday, endOfToday, maxId]
          },
          mapReduce: 'appointments_by_patient'
        }).then(function (appointments) {
          if (isEmpty(appointments)) {
            return;
          } else {
            return appointments.get('firstObject');
          }
        });
      }
    },

    _saveAssociatedAppointment: function _saveAssociatedAppointment(newVisit) {
      return this._findAssociatedAppointment(newVisit).then(function (appointment) {
        if (isEmpty(appointment)) {
          newVisit.set('hasAppointment', false);
          return _ember['default'].RSVP.resolve();
        } else {
          newVisit.set('hasAppointment', true);
          appointment.set('status', 'Attended');
          return appointment.save();
        }
      });
    },

    haveAdditionalDiagnoses: (function () {
      return !isEmpty(this.get('model.additionalDiagnoses'));
    }).property('model.additionalDiagnoses.[]'),

    afterUpdate: function afterUpdate(visit) {
      this.updatePatientVisitFlags(visit).then(this._finishAfterUpdate.bind(this));
    },

    beforeUpdate: function beforeUpdate() {
      var _this = this;

      var isNew = this.get('model.isNew');
      if (isNew) {
        return new _ember['default'].RSVP.Promise(function (resolve, reject) {
          var newVisit = _this.get('model');
          return newVisit.validate().then(function () {
            if (newVisit.get('isValid')) {
              var patient = newVisit.get('patient');
              if (isEmpty(patient)) {
                _this.addNewPatient();
                return reject({
                  ignore: true,
                  message: 'creating new patient first'
                });
              }
              var outPatient = false;
              var visitType = newVisit.get('visitType');
              var visitStatus = undefined;
              if (visitType === 'Admission') {
                visitStatus = _hospitalrunUtilsVisitStatuses['default'].ADMITTED;
              } else {
                outPatient = true;
                visitStatus = _hospitalrunUtilsVisitStatuses['default'].CHECKED_IN;
              }
              newVisit.setProperties({
                outPatient: outPatient,
                status: visitStatus
              });
              if (_this.get('model.checkIn')) {
                _this._saveAssociatedAppointment(newVisit).then(function () {
                  _this.saveNewDiagnoses().then(resolve, reject);
                });
              } else {
                _this.saveNewDiagnoses().then(resolve, reject);
              }
            }
          });
        });
      } else {
        return this.updateCharges();
      }
    },

    checkoutPatient: function checkoutPatient(status) {
      var visit = this.get('model');
      this.checkoutVisit(visit, status);
    },

    patientSelected: function patientSelected(patient) {
      if (isEmpty(patient)) {
        set(this, 'model.createNewPatient', true);
      } else {
        set(this, 'model.createNewPatient', false);
        this.getPatientDiagnoses(patient, get(this, 'model'));
      }
    },

    /**
     * Adds or removes the specified object from the specified list.
     * @param {String} listName The name of the list to operate on.
     * @param {Object} listObject The object to add or removed from the
     * specified list.
     * @param {boolean} removeObject If true remove the object from the list;
     * otherwise add the specified object to the list.
     */
    updateList: function updateList(listName, listObject, removeObject) {
      var model = this.get('model');
      model.get(listName).then((function (list) {
        if (removeObject) {
          list.removeObject(listObject);
        } else {
          list.addObject(listObject);
        }
        this.send('update', true);
        this.send('closeModal');
      }).bind(this));
    },

    actions: {
      addAllergy: function addAllergy(newAllergy) {
        var patient = get(this, 'model.patient');
        this.savePatientAllergy(patient, newAllergy);
      },

      addDiagnosis: function addDiagnosis(newDiagnosis) {
        this.addDiagnosisToModelAndPatient(newDiagnosis);
      },

      addVitals: function addVitals(newVitals) {
        this.updateList('vitals', newVitals);
      },

      cancel: function cancel() {
        var cancelledItem = this.get('model');
        if (this.get('model.isNew')) {
          cancelledItem.deleteRecord();
        } else {
          cancelledItem.rollbackAttributes();
        }
        this.send(this.get('cancelAction'));
      },

      checkout: function checkout() {
        this.checkoutPatient(_hospitalrunUtilsVisitStatuses['default'].CHECKED_OUT);
      },

      deleteAllergy: function deleteAllergy(allergy) {
        var patient = get(this, 'model.patient');
        this.deletePatientAllergy(patient, allergy);
      },

      deleteProcedure: function deleteProcedure(procedure) {
        this.updateList('procedures', procedure, true);
      },

      deleteVitals: function deleteVitals(vitals) {
        this.updateList('vitals', vitals, true);
      },

      discharge: function discharge() {
        this.checkoutPatient(_hospitalrunUtilsVisitStatuses['default'].DISCHARGED);
      },

      editImaging: function editImaging(imaging) {
        if (imaging.get('canEdit')) {
          imaging.setProperties('returnToVisit', this.get('model.id'));
        }
        this.transitionToRoute('imaging.edit', imaging);
      },

      editLab: function editLab(lab) {
        if (lab.get('canEdit')) {
          lab.setProperties('returnToVisit', this.get('model.id'));
          this.transitionToRoute('labs.edit', lab);
        }
      },

      editMedication: function editMedication(medication) {
        if (medication.get('canEdit')) {
          medication.set('returnToVisit', this.get('model.id'));
          this.transitionToRoute('medication.edit', medication);
        }
      },

      editOperativePlan: function editOperativePlan(operativePlan) {
        var _this2 = this;

        var model = operativePlan;
        if (isEmpty(model)) {
          this._addChildObject('patients.operative-plan', function (route) {
            route.controller.getPatientDiagnoses(_this2.get('model.patient'), route.currentModel);
          });
        } else {
          model.set('returnToVisit', this.get('model.id'));
          this.transitionToRoute('patients.operative-plan', model);
        }
      },

      newPatientChanged: function newPatientChanged(createNewPatient) {
        set(this, 'model.createNewPatient', createNewPatient);
        var model = this.get('model');
        var patient = model.get('patient');
        if (createNewPatient && !isEmpty(patient)) {
          model.set('patientTypeAhead', patient.get('displayName'));
          model.set('patient');
        }
      },

      showAddVitals: function showAddVitals() {
        var newVitals = this.get('store').createRecord('vital', {
          dateRecorded: new Date()
        });
        this.send('openModal', 'visits.vitals.edit', newVitals);
      },

      showAddPatientNote: function showAddPatientNote(model) {
        if (isEmpty(model)) {
          model = this.get('store').createRecord('patient-note', {
            visit: this.get('model'),
            createdBy: this.getUserName(),
            patient: this.get('model').get('patient'),
            noteType: this._computeNoteType(this.get('model'))
          });
        }
        this.send('openModal', 'patients.notes', model);
      },

      newAppointment: function newAppointment() {
        this._addChildObject('appointments.edit');
      },

      newImaging: function newImaging() {
        this._addChildObject('imaging.edit');
      },

      newLab: function newLab() {
        this._addChildObject('labs.edit');
      },

      newMedication: function newMedication() {
        this._addChildObject('medication.edit');
      },

      newReport: function newReport() {
        this._addChildObject('visits.reports.edit');
      },

      showAddProcedure: function showAddProcedure() {
        this._addChildObject('procedures.edit');
      },

      showDeleteImaging: function showDeleteImaging(imaging) {
        this.send('openModal', 'imaging.delete', imaging);
      },

      showDeleteLab: function showDeleteLab(lab) {
        this.send('openModal', 'labs.delete', lab);
      },

      showDeleteMedication: function showDeleteMedication(medication) {
        this.send('openModal', 'medication.delete', medication);
      },

      showDeleteProcedure: function showDeleteProcedure(procedure) {
        this.send('openModal', 'visits.procedures.delete', procedure);
      },

      showDeleteVitals: function showDeleteVitals(vitals) {
        this.send('openModal', 'visits.vitals.delete', vitals);
      },

      showEditProcedure: function showEditProcedure(procedure) {
        if (isEmpty(procedure.get('visit'))) {
          procedure.set('visit', this.get('model'));
        }
        procedure.set('returnToVisit', this.get('model.id'));
        procedure.set('returnToPatient');
        this.transitionToRoute('procedures.edit', procedure);
      },

      showEditVitals: function showEditVitals(vitals) {
        this.send('openModal', 'visits.vitals.edit', vitals);
      },

      showDeletePatientNote: function showDeletePatientNote(note) {
        this.send('openModal', 'dialog', _ember['default'].Object.create({
          confirmAction: 'deletePatientNote',
          title: 'Delete Note',
          message: 'Are you sure you want to delete this note?',
          noteToDelete: note,
          updateButtonAction: 'confirm',
          updateButtonText: this.get('i18n').t('buttons.ok')
        }));
      },

      deletePatientNote: function deletePatientNote(model) {
        var note = model.get('noteToDelete');
        var patientNotes = this.get('model.patientNotes');
        patientNotes.removeObject(note);
        this.send('update', true);
      },

      startDateChanged: function startDateChanged(startDate) {
        var isAdmissionVisit = this.get('isAdmissionVisit');
        var visit = this.get('model');
        if (!isAdmissionVisit) {
          visit.set('endDate', startDate);
        }
      },

      printReport: function printReport(report) {
        set(report, 'returnToVisit', get(this, 'model.id'));
        this.transitionToRoute('visits.reports.edit', report, { queryParams: { print: true } });
      },

      viewReport: function viewReport(report) {
        set(report, 'returnToVisit', get(this, 'model.id'));
        this.transitionToRoute('visits.reports.edit', report, { queryParams: { print: null } });
      }

    }
  });
});
define('hospitalrun/visits/edit/route', ['exports', 'ember-i18n', 'hospitalrun/routes/abstract-edit-route', 'hospitalrun/mixins/charge-route', 'ember', 'hospitalrun/mixins/patient-list-route', 'hospitalrun/mixins/patient-visits', 'ember-data'], function (exports, _emberI18n, _hospitalrunRoutesAbstractEditRoute, _hospitalrunMixinsChargeRoute, _ember, _hospitalrunMixinsPatientListRoute, _hospitalrunMixinsPatientVisits, _emberData) {
  var get = _ember['default'].get;
  var set = _ember['default'].set;
  var isEmpty = _ember['default'].isEmpty;
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend(_hospitalrunMixinsChargeRoute['default'], _hospitalrunMixinsPatientListRoute['default'], _hospitalrunMixinsPatientVisits['default'], {
    customForms: _ember['default'].inject.service(),
    editTitle: (0, _emberI18n.translationMacro)('visits.titles.editVisit'),
    modelName: 'visit',
    newTitle: (0, _emberI18n.translationMacro)('visits.titles.newVisit'),
    pricingCategory: 'Ward',

    model: function model(params) {
      var _this = this;

      var idParam = get(this, 'idParam');
      if (!isEmpty(idParam) && params[idParam] === 'checkin') {
        return this.getNewData().then(function (newData) {
          newData.checkIn = true;
          var newVisit = get(_this, 'store').createRecord('visit', newData);
          return newVisit;
        });
      } else {
        return this._super(params);
      }
    },

    getNewData: function getNewData() {
      var newVisitData = {
        startDate: new Date(),
        visitType: 'Admission',
        customForms: _ember['default'].Object.create()
      };
      var customForms = this.get('customForms');
      return customForms.setDefaultCustomForms(['visit'], newVisitData);
    },

    getScreenTitle: function getScreenTitle(model) {
      if (model.get('checkIn')) {
        return this.get('i18n').t('visits.titles.patientCheckIn');
      } else {
        return this._super(model);
      }
    },

    setupController: function setupController(controller, model) {
      var promise = this.store.query('report', {
        options: {
          key: get(model, 'id')
        },
        mapReduce: 'report_by_visit'
      }).then(function (reports) {
        set(controller, 'noReport', isEmpty(reports));
        return isEmpty(reports) ? '' : get(reports, 'firstObject');
      });
      set(controller, 'report', _emberData['default'].PromiseObject.create({ promise: promise }));
      this._super(controller, model);
    },

    actions: {
      updateNote: function updateNote() {
        this.controller.send('update', true);
      },
      deletePatientNote: function deletePatientNote(model) {
        this.controller.send('deletePatientNote', model);
      }
    }
  });
});
define("hospitalrun/visits/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "EcK/Filv", "block": "{\"statements\":[[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],32]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"\\n              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.date\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"visits.labels.authoredBy\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"visits.labels.reportType\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\\n                  \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"report\",\"reportDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"report\",\"modifiedBy\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"report\",\"reportType\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"static-attr\",\"data-test-selector\",\"view-report-btn\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"viewReport\",[\"get\",[\"report\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.view\"],null],false],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"static-attr\",\"data-test-selector\",\"print-report-btn\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"printReport\",[\"get\",[\"report\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.print\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"close-element\"],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                      \"],[\"append\",[\"helper\",[\"t\"],[\"visits.buttons.newDischargeReport\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                      \"],[\"append\",[\"helper\",[\"t\"],[\"visits.buttons.newOPDReport\"],null],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"static-attr\",\"data-test-selector\",\"report-btn\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newReport\"]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"model\",\"outPatient\"]]],null,2,1],[\"text\",\"                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"\\n              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddReport\"]]],null,3],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"partial\",\"item-charges\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddVitals\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"visits.buttons.newVitals\"],null],false],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteVitals\",[\"get\",[\"vital\"]]]],[\"flush-element\"],[\"text\",\"\\n                        \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"text\",\"\\n                        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showEditVitals\",[\"get\",[\"vital\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"vital\",\"modifiedBy\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"vital\",\"dateRecorded\"]]],[[\"format\"],[\"l h:mm A\"]]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"vital\",\"temperature\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"vital\",\"weight\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"vital\",\"height\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"vital\",\"sbp\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"vital\",\"dbp\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"vital\",\"heartRate\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"vital\",\"respiratoryRate\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddVitals\"]]],null,8],[\"block\",[\"if\"],[[\"get\",[\"canDeleteVitals\"]]],null,7],[\"text\",\"                    \"],[\"close-element\"],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"vital\"]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"static-attr\",\"data-test-selector\",\"new-procedure-btn\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddProcedure\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"visits.buttons.newProcedure\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeleteProcedure\",[\"get\",[\"procedure\"]]]],[\"flush-element\"],[\"text\",\"\\n                          \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"text\",\"\\n                        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showEditProcedure\",[\"get\",[\"procedure\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"procedure\",\"procedureDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"procedure\",\"description\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddProcedure\"]]],null,12],[\"block\",[\"if\"],[[\"get\",[\"canDeleteProcedure\"]]],null,11],[\"text\",\"                    \"],[\"close-element\"],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"procedure\"]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"static-attr\",\"data-test-selector\",\"new-note-btn\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddPatientNote\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.newNote\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default warning\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showDeletePatientNote\",[\"get\",[\"note\"]]]],[\"flush-element\"],[\"text\",\"\\n                          \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-x\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"buttons.delete\"],null],false],[\"text\",\"\\n                        \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                        \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"class\",\"btn btn-default neutral\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"showAddPatientNote\",[\"get\",[\"note\"]]]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"buttons.edit\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"tr\",[]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"note\",\"date\"]]],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"note\",\"authoredBy\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"note\",\"noteType\"]],false],[\"text\",\": \"],[\"append\",[\"unknown\",[\"note\",\"content\"]],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"td\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddNote\"]]],null,16],[\"block\",[\"if\"],[[\"get\",[\"canDeleteNote\"]]],null,15],[\"text\",\"                    \"],[\"close-element\"],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"note\"]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"ul\",[]],[\"static-attr\",\"class\",\"nav nav-pills tab-nav\"],[\"static-attr\",\"role\",\"tablist\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"static-attr\",\"class\",\"active\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#orders\"],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"static-attr\",\"data-test-selector\",\"orders-tab\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"t\"],[\"visits.navigation.orders\"],null],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#visit-vitals\"],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"static-attr\",\"data-test-selector\",\"vitals-tab\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"t\"],[\"visits.navigation.vitals\"],null],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#visit-notes\"],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"static-attr\",\"data-test-selector\",\"notes-tab\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"t\"],[\"visits.navigation.notes\"],null],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#visit-procedures\"],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"static-attr\",\"data-test-selector\",\"procedures-tab\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"t\"],[\"visits.navigation.procedures\"],null],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#charges\"],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"static-attr\",\"data-test-selector\",\"charges-tab\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"t\"],[\"visits.navigation.charges\"],null],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"role\",\"presentation\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"href\",\"#reports\"],[\"static-attr\",\"role\",\"tab\"],[\"static-attr\",\"data-toggle\",\"pill\"],[\"static-attr\",\"data-test-selector\",\"reports-tab\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"t\"],[\"visits.navigation.reports\"],null],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"tab-content\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"role\",\"tabpanel\"],[\"static-attr\",\"class\",\"tab-pane\"],[\"static-attr\",\"id\",\"visit-notes\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel detail-section\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.date\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"visits.labels.authoredBy\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.note\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"patientNotes\"]]],null,17],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddNote\"]]],null,14],[\"text\",\"            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"role\",\"tabpanel\"],[\"static-attr\",\"class\",\"tab-pane\"],[\"static-attr\",\"id\",\"visit-procedures\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel detail-section\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.date\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"visits.labels.procedure\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.actions\"],null],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"procedures\"]]],null,13],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddProcedure\"]]],null,10],[\"text\",\"            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"role\",\"tabpanel\"],[\"static-attr\",\"class\",\"tab-pane active\"],[\"static-attr\",\"id\",\"orders\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"patient-orders\"],null,[[\"visit\"],[[\"get\",[\"model\"]]]]],false],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"role\",\"tabpanel\"],[\"static-attr\",\"class\",\"tab-pane\"],[\"static-attr\",\"id\",\"visit-vitals\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel detail-section\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"table\",[]],[\"static-attr\",\"class\",\"table\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"tr\",[]],[\"static-attr\",\"class\",\"table-header\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.takenBy\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.date\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"vitals.labels.temperature\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"vitals.labels.weight\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"vitals.labels.height\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"vitals.labels.sbp\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"vitals.labels.dbp\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"vitals.labels.heartRate\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"vitals.labels.respiratoryRate\"],null],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"th\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"labels.delete\"],null],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"model\",\"vitals\"]]],null,9],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-footer\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddVitals\"]]],null,6],[\"text\",\"            \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"role\",\"tabpanel\"],[\"static-attr\",\"class\",\"tab-pane\"],[\"static-attr\",\"id\",\"charges\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[null]],false]],5],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"role\",\"tabpanel\"],[\"static-attr\",\"class\",\"tab-pane\"],[\"static-attr\",\"id\",\"reports\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel detail-section\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"noReport\"]]],null,4,0],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\",\"hint\"],[\"col-sm-5\",\"primaryBillingDiagnosis\",[\"helper\",[\"t\"],[\"visits.labels.finalDiagnosis\"],null],[\"get\",[\"diagnosisList\"]],[\"get\",[\"model\",\"primaryBillingDiagnosis\"]],false]]],false],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-sm-4\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"visits.labels.status\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[[\"helper\",[\"concat\"],[\"visits.labels.status\",[\"get\",[\"model\",\"status\"]]],null]],null],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"form-group col-sm-4\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"control-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"visits.labels.visitType\"],null],false],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"p\",[]],[\"static-attr\",\"class\",\"form-control-static\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"model\",\"visitType\"]],false],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"append\",[\"helper\",[\"em-select\"],null,[[\"class\",\"label\",\"property\",\"content\",\"prompt\"],[\"col-sm-4 required form-input-group visit-type\",[\"helper\",[\"t\"],[\"visits.labels.visitType\"],null],\"visitType\",[\"get\",[\"validVisitTypes\"]],\" \"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"showTime\",\"class\"],[\"endDate\",[\"helper\",[\"t\"],[\"visits.labels.checkOutTime\"],null],true,\"col-sm-4 checkout-date\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"showTime\",\"class\"],[\"startDate\",[\"helper\",[\"t\"],[\"visits.labels.checkInTime\"],null],true,\"col-sm-4 required checkin-date\"]]],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"helper\",[\"eq\"],[[\"get\",[\"model\",\"status\"]],\"CheckedOut\"],null]],null,23]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"showTime\",\"class\"],[\"startDate\",[\"helper\",[\"t\"],[\"patients.labels.admissionDate\"],null],true,\"col-sm-4 required\"]]],false],[\"text\",\"\\n                \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"showTime\",\"class\"],[\"endDate\",[\"helper\",[\"t\"],[\"patients.labels.dischargeDate\"],null],true,\"col-sm-4\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"append\",[\"helper\",[\"patient-typeahead\"],null,[[\"property\",\"label\",\"content\",\"selection\",\"class\"],[\"patientTypeAhead\",[\"helper\",[\"t\"],[\"visits.labels.patientToCheckIn\"],null],[\"get\",[\"patientList\"]],[\"get\",[\"selectedPatient\"]],\"required patient-name col-sm-9\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"property\",\"label\",\"class\"],[\"patientTypeAhead\",[\"helper\",[\"t\"],[\"visits.labels.patientToCheckIn\"],null],\"required patient-name col-sm-9\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"model\",\"createNewPatient\"]]],null,27,26],[\"text\",\"                \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"checkbox col-sm-3 new-patient-checkbox\"],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"label\",[]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"input\",[]],[\"static-attr\",\"type\",\"checkbox\"],[\"dynamic-attr\",\"checked\",[\"unknown\",[\"model\",\"createNewPatient\"]],null],[\"dynamic-attr\",\"onchange\",[\"helper\",[\"action\"],[[\"get\",[null]],\"newPatientChanged\"],[[\"value\"],[\"target.checked\"]]],null],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"append\",[\"helper\",[\"t\"],[\"visits.labels.createNewPatient\"],null],false],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n              \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"append\",[\"helper\",[\"patient-summary\"],null,[[\"patient\",\"diagnosisContainer\",\"returnTo\",\"returnToContext\",\"disablePatientLink\",\"allowAddAllergy\",\"allowAddDiagnosis\",\"allowAddOperativePlan\",\"diagnosisList\"],[[\"get\",[\"model\",\"patient\"]],[\"get\",[\"model\"]],\"visits.edit\",[\"get\",[\"model\",\"id\"]],[\"get\",[\"model\",\"isNew\"]],true,true,true,[\"get\",[\"diagnosisList\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"model\",\"patient\"]]],null,29],[\"block\",[\"if\"],[[\"get\",[\"showPatientSelection\"]]],null,28],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"isAdmissionVisit\"]]],null,25,24],[\"text\",\"              \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\"],[\"col-sm-4 visit-location\",\"location\",[\"helper\",[\"t\"],[\"labels.location\"],null],[\"get\",[\"locationList\"]],[\"get\",[\"model\",\"location\"]]]]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"model\",\"isNew\"]]],null,22,21],[\"block\",[\"if\"],[[\"get\",[\"model\",\"status\"]]],null,20],[\"text\",\"              \"],[\"append\",[\"helper\",[\"select-or-typeahead\"],null,[[\"className\",\"property\",\"label\",\"list\",\"selection\"],[\"col-sm-4 visit-examiner\",\"examiner\",[\"helper\",[\"t\"],[\"visits.labels.examiner\"],null],[\"get\",[\"physicianList\"]],[\"get\",[\"model\",\"examiner\"]]]]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"expand-text\"],null,[[\"property\",\"label\",\"rows\"],[\"reasonForVisit\",[\"helper\",[\"t\"],[\"visits.labels.reasonForVisit\"],null],3]]],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddBillingDiagnosis\"]]],null,19],[\"text\",\"            \"],[\"append\",[\"helper\",[\"custom-form-manager\"],null,[[\"model\",\"formType\"],[[\"get\",[\"model\"]],\"visit\"]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"button\",[]],[\"static-attr\",\"type\",\"button\"],[\"static-attr\",\"class\",\"btn btn-primary align-right\"],[\"modifier\",[\"action\"],[[\"get\",[null]],\"newAppointment\"],[[\"bubbles\"],[false]]],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"octicon octicon-plus\"],[\"flush-element\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"t\"],[\"visits.buttons.newAppointment\"],null],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-group\"],[\"static-attr\",\"id\",\"visit-accordion\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-heading\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"h3\",[]],[\"static-attr\",\"class\",\"panel-title\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"a\",[]],[\"static-attr\",\"data-toggle\",\"collapse\"],[\"static-attr\",\"data-parent\",\"#visit-accordion\"],[\"static-attr\",\"href\",\"#visit-info\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"append\",[\"helper\",[\"t\"],[\"visits.labels.visitInformation\"],null],false],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"canAddAppointment\"]]],null,31],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"id\",\"visit-info\"],[\"static-attr\",\"class\",\"panel-collapse collapse in\"],[\"flush-element\"],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"panel-body\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],30],[\"text\",\"        \"],[\"close-element\"],[\"text\",\"\\n      \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"],[\"block\",[\"unless\"],[[\"get\",[\"model\",\"isNew\"]]],null,18],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":true}", "meta": { "moduleName": "hospitalrun/visits/edit/template.hbs" } });
});
define('hospitalrun/visits/procedures/delete/controller', ['exports', 'hospitalrun/controllers/abstract-delete-controller', 'ember'], function (exports, _hospitalrunControllersAbstractDeleteController, _ember) {
  exports['default'] = _hospitalrunControllersAbstractDeleteController['default'].extend({
    afterDeleteAction: 'notifyProcedureDelete',
    editController: _ember['default'].inject.controller('visits/edit'),
    title: 'Delete Procedure',

    actions: {
      notifyProcedureDelete: function notifyProcedureDelete() {
        this.send('closeModal');
        this.get('editController').send('deleteProcedure', this.get('model'));
      }
    }
  });
});
define("hospitalrun/visits/procedures/delete/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "70SYoaUF", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-warning-sign\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"t\"],[\"messages.delete_singular\"],[[\"name\"],[[\"helper\",[\"t\"],[\"models.procedure.names.singular\"],null]]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/visits/procedures/delete/template.hbs" } });
});
define('hospitalrun/visits/reports/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember', 'hospitalrun/mixins/patient-submodule', 'hospitalrun/mixins/patient-diagnosis', 'hospitalrun/mixins/pouchdb'], function (exports, _hospitalrunControllersAbstractEditController, _ember, _hospitalrunMixinsPatientSubmodule, _hospitalrunMixinsPatientDiagnosis, _hospitalrunMixinsPouchdb) {
  var get = _ember['default'].get;
  var set = _ember['default'].set;
  var computed = _ember['default'].computed;
  var alias = _ember['default'].computed.alias;
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend(_hospitalrunMixinsPatientSubmodule['default'], _hospitalrunMixinsPatientDiagnosis['default'], _hospitalrunMixinsPouchdb['default'], {
    queryParams: ['print'],
    print: null,

    visitsController: _ember['default'].inject.controller('visits'),

    physicianList: alias('visitsController.physicianList'),

    logoURL: alias('visitsController.printHeader.value.logoURL'),
    facilityName: alias('visitsController.printHeader.value.facilityName'),
    headerLine1: alias('visitsController.printHeader.value.headerLine1'),
    headerLine2: alias('visitsController.printHeader.value.headerLine2'),
    headerLine3: alias('visitsController.printHeader.value.headerLine3'),

    diagnosisList: alias('visitsController.diagnosisList'),

    additionalButtons: computed('model.isNew', function () {
      var isNew = get(this, 'model.isNew');
      var i18n = get(this, 'i18n');
      if (!isNew) {
        return [{
          'class': 'btn btn-primary on-white',
          buttonAction: 'printReport',
          buttonIcon: 'octicon octicon-check',
          buttonText: i18n.t('labels.print')
        }];
      }
    }),

    updateCapability: 'add_report',

    beforeUpdate: function beforeUpdate() {
      var _this = this;

      return new _ember['default'].RSVP.Promise(function (resolve) {
        var model = get(_this, 'model');
        if (get(model, 'isNew')) {
          if (get(_this, 'model.visit.outPatient')) {
            set(model, 'reportType', 'OPD Report');
          } else {
            set(model, 'reportType', 'Discharge Report');
          }
        }
        resolve();
      });
    },

    afterUpdate: function afterUpdate() {
      var alertTitle = get(this, 'i18n').t('reports.titles.saved');
      var alertMessage = get(this, 'i18n').t('reports.messages.saved');
      this.saveVisitIfNeeded(alertTitle, alertMessage);
      var opdTitle = get(this, 'i18n').t('reports.titles.opdReport');
      var dischargeTitle = get(this, 'i18n').t('reports.titles.dischargeReport');
      var editTitle = get(this, 'model.visit.outPatient') ? opdTitle : dischargeTitle;
      var sectionDetails = {};
      sectionDetails.currentScreenTitle = editTitle;
      this.send('setSectionHeader', sectionDetails);
    },

    actions: {
      printReport: function printReport() {
        window.print();
      }
    }

  });
});
define('hospitalrun/visits/reports/edit/route', ['exports', 'hospitalrun/routes/abstract-edit-route', 'hospitalrun/mixins/add-to-patient-route', 'ember', 'ember-i18n', 'hospitalrun/mixins/patient-visits'], function (exports, _hospitalrunRoutesAbstractEditRoute, _hospitalrunMixinsAddToPatientRoute, _ember, _emberI18n, _hospitalrunMixinsPatientVisits) {
  var get = _ember['default'].get;
  var set = _ember['default'].set;
  exports['default'] = _hospitalrunRoutesAbstractEditRoute['default'].extend(_hospitalrunMixinsAddToPatientRoute['default'], _hospitalrunMixinsPatientVisits['default'], {
    modelName: 'report',
    customForms: _ember['default'].inject.service(),

    getNewData: function getNewData() {
      var newReportData = {
        reportDate: new Date(),
        customForms: _ember['default'].Object.create()
      };
      var customForms = get(this, 'customForms');
      return customForms.setDefaultCustomForms(['opdReport', 'dischargeReport'], newReportData);
    },

    getScreenTitle: function getScreenTitle(model) {
      var isNew = get(model, 'isNew');
      var title = null;
      if (get(model, 'visit.outPatient')) {
        title = isNew ? 'newOPDReport' : 'opdReport';
      } else {
        title = isNew ? 'newDischargeReport' : 'dischargeReport';
      }
      return (0, _emberI18n.translationMacro)('reports.titles.' + title);
    },

    getDiagnosisContainer: function getDiagnosisContainer(visit) {
      if (get(visit, 'outPatient')) {
        return visit;
      }
      return null;
    },

    getCurrentOperativePlan: function getCurrentOperativePlan(patient) {
      var operativePlans = get(patient, 'operativePlans');
      return operativePlans.findBy('isPlanned', true);
    },

    afterModel: function afterModel(model) {
      if (!get(model, 'isNew')) {
        var patient = get(model, 'visit.patient');
        set(model, 'patient', patient);
      }
      if (!get(model, 'visit')) {
        return this.transitionTo('patients');
      }
    },

    setupController: function setupController(controller, model) {
      this._super(controller, model);
      var visit = get(model, 'visit');
      var patient = get(model, 'patient');
      var isOutPatient = get(visit, 'outPatient');
      set(controller, 'visit', visit);
      set(controller, 'isOutPatient', isOutPatient);
      set(controller, 'diagnosisContainer', this.getDiagnosisContainer(visit));
      set(controller, 'currentOperativePlan', this.getCurrentOperativePlan(patient));
      if (isOutPatient) {
        set(controller, 'nextAppointments', this.getPatientFutureAppointment(visit, true));
      } else {
        set(controller, 'nextAppointment', this.getPatientFutureAppointment(visit));
      }
    }
  });
});
define("hospitalrun/visits/reports/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "t4rcuah2", "block": "{\"statements\":[[\"block\",[\"print-this\"],null,[[\"print\",\"delay\"],[[\"get\",[\"print\"]],1000]],43]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.completedBy\"],null],false],[\"text\",\":\"],[\"close-element\"],[\"text\",\"\\n              \"],[\"append\",[\"unknown\",[\"model\",\"modifiedBy\"]],false],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                (\"],[\"append\",[\"unknown\",[\"nextAppointment\",\"location\"]],false],[\"text\",\")\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.nextAppointment\"],null],false],[\"text\",\":\"],[\"close-element\"],[\"text\",\"\\n              \"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"nextAppointment\",\"startDate\"]]],null],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"nextAppointment\",\"location\"]]],null,1],[\"text\",\"            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"class\",\"test-notes-data\"],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"b\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.notes.date\"],null],false],[\"text\",\":\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"note\",\"date\"]]],null],false],[\"open-element\",\"br\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"b\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.notes.author\"],null],false],[\"text\",\":\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"unknown\",[\"note\",\"authoredBy\"]],false],[\"open-element\",\"br\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"b\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"note\",\"noteType\"]],false],[\"text\",\": \"],[\"append\",[\"unknown\",[\"note\",\"content\"]],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"note\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group test-notes\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label test-notes-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.notes.title\"],null],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"ul\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"visit\",\"patientNotes\"]]],null,3],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                    \"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"procedure\",\"procedureDate\"]]],null],false],[\"text\",\"\\n                  \"]],\"locals\":[]},{\"statements\":[[\"text\",\"                \"],[\"open-element\",\"li\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"procedure\",\"description\"]],false],[\"text\",\" -\\n\"],[\"block\",[\"if\"],[[\"get\",[\"procedure\",\"procedureDate\"]]],null,5],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"procedure\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.allProcedures\"],null],false],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"ul\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"patientProcedures\"]]],null,6],[\"text\",\"            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group test-examiner\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"open-element\",\"b\",[]],[\"static-attr\",\"class\",\"test-examiner-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.examiner\"],null],false],[\"text\",\":\"],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"test-examiner-data\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"visit\",\"examiner\"]],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"\\n          \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group test-visit-date\"],[\"flush-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label test-visit-discharge-date-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.dischargeDate\"],null],false],[\"text\",\": \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"test-visit-discharge-date-data\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"model\",\"reportDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n          \"],[\"close-element\"],[\"text\",\"\\n\\n\"],[\"block\",[\"if\"],[[\"get\",[\"visit\",\"examiner\"]]],null,8],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"patientProcedures\"]]],null,7],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"visit\",\"patientNotes\"]]],null,4],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"nextAppointment\"]]],null,2],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"custom-form-manager\"],null,[[\"model\",\"formType\"],[[\"get\",[\"model\"]],\"dischargeReport\"]]],false],[\"text\",\"\\n\\n\"],[\"block\",[\"if\"],[[\"get\",[\"model\",\"modifiedBy\"]]],null,0],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"class\",\"test-notes-data\"],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"b\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.notes.date\"],null],false],[\"text\",\":\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"note\",\"date\"]]],null],false],[\"open-element\",\"br\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"b\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.notes.author\"],null],false],[\"text\",\":\"],[\"close-element\"],[\"text\",\" \"],[\"append\",[\"unknown\",[\"note\",\"authoredBy\"]],false],[\"open-element\",\"br\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"b\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"note\",\"noteType\"]],false],[\"text\",\": \"],[\"append\",[\"unknown\",[\"note\",\"content\"]],false],[\"close-element\"],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"note\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group test-notes\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label test-notes-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.notes.title\"],null],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"ul\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"visit\",\"patientNotes\"]]],null,10],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"li\",[]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"open-element\",\"b\",[]],[\"static-attr\",\"class\",\"test-operative-plan-instructions-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.operativePlan.instructions\"],null],false],[\"text\",\":\"],[\"close-element\"],[\"open-element\",\"br\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"test-operative-plan-instructions-data\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"currentOperativePlan\",\"admissionInstructions\"]],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                      \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"class\",\"test-operative-plan-procedures-description\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"procedure\",\"description\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"procedure\"]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"li\",[]],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"open-element\",\"b\",[]],[\"static-attr\",\"class\",\"test-operative-plan-description-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.operativePlan.description\"],null],false],[\"text\",\":\"],[\"close-element\"],[\"open-element\",\"br\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n                      \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"test-operative-plan-description-data\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"currentOperativePlan\",\"operationDescription\"]],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group test-operative-plan\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label test-operative-plan-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.operativePlan.title\"],null],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"ul\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"currentOperativePlan\",\"operationDescription\"]]],null,14],[\"text\",\"\\n                \"],[\"open-element\",\"li\",[]],[\"flush-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"open-element\",\"b\",[]],[\"static-attr\",\"class\",\"test-operative-plan-procedures-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.operativePlan.procedures\"],null],false],[\"text\",\":\"],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n                  \"],[\"open-element\",\"ul\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"currentOperativePlan\",\"procedures\"]]],null,13],[\"text\",\"                  \"],[\"close-element\"],[\"text\",\"\\n                \"],[\"close-element\"],[\"text\",\"\\n\\n\"],[\"block\",[\"if\"],[[\"get\",[\"currentOperativePlan\",\"admissionInstructions\"]]],null,12],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                      (\"],[\"open-element\",\"b\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"appointment\",\"appointmentType\"]],false],[\"close-element\"],[\"text\",\")\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"class\",\"test-appointment-data\"],[\"flush-element\"],[\"text\",\"\\n                    \"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"appointment\",\"startDate\"]]],null],false],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"appointment\",\"appointmentType\"]]],null,16],[\"text\",\"                  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"appointment\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group test-appointment\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label test-appointment-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.nextAppointments\"],null],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"ul\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"nextAppointments\"]]],null,17],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"class\",\"test-medication-data\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"medication\",\"medicationName\"]],false],[\"text\",\" - \"],[\"append\",[\"unknown\",[\"medication\",\"prescription\"]],false],[\"text\",\" (\"],[\"append\",[\"unknown\",[\"medication\",\"status\"]],false],[\"text\",\")\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"medication\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group test-medication\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label test-medication-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.medications\"],null],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"ul\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"visit\",\"medication\"]]],null,19],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"class\",\"test-images-data\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"item\",\"imagingType\",\"name\"]],false],[\"text\",\"-\"],[\"append\",[\"unknown\",[\"item\",\"result\"]],false],[\"text\",\" (\"],[\"append\",[\"unknown\",[\"item\",\"status\"]],false],[\"text\",\")\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"item\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group test-images\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label test-images-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.images\"],null],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"ul\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"visit\",\"imaging\"]]],null,21],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"class\",\"test-labs-data\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"item\",\"labType\",\"name\"]],false],[\"text\",\"-\"],[\"append\",[\"unknown\",[\"item\",\"result\"]],false],[\"text\",\" (\"],[\"append\",[\"unknown\",[\"item\",\"status\"]],false],[\"text\",\")\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"item\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group test-labs\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label test-labs-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.labs\"],null],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"ul\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"visit\",\"labs\"]]],null,23],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"                  \"],[\"open-element\",\"li\",[]],[\"static-attr\",\"class\",\"test-opd-procedure-data\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"item\",\"description\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[\"item\"]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group test-opd-procedure\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label test-opd-procedure-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.procedures\"],null],false],[\"close-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"ul\",[]],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"each\"],[[\"get\",[\"visit\",\"procedures\"]]],null,25],[\"text\",\"              \"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group test-location\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"open-element\",\"b\",[]],[\"static-attr\",\"class\",\"test-location-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.location\"],null],false],[\"text\",\":\"],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"test-location-data\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"visit\",\"location\"]],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group test-examiner\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"open-element\",\"b\",[]],[\"static-attr\",\"class\",\"test-examiner-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.examiner\"],null],false],[\"text\",\":\"],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"test-examiner-data\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"visit\",\"examiner\"]],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"            \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group test-visit-type\"],[\"flush-element\"],[\"text\",\"\\n              \"],[\"open-element\",\"p\",[]],[\"flush-element\"],[\"open-element\",\"b\",[]],[\"static-attr\",\"class\",\"test-visit-type-label\"],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.visitType\"],null],false],[\"text\",\":\"],[\"close-element\"],[\"text\",\"\\n                \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"test-visit-type-data\"],[\"flush-element\"],[\"append\",[\"unknown\",[\"visit\",\"visitType\"]],false],[\"close-element\"],[\"close-element\"],[\"text\",\"\\n            \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"visit\",\"visitType\"]]],null,29],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"visit\",\"examiner\"]]],null,28],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"visit\",\"location\"]]],null,27],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"visit\",\"procedures\"]]],null,26],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"visit\",\"labs\"]]],null,24],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"visit\",\"imaging\"]]],null,22],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"visit\",\"medication\"]]],null,20],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"nextAppointments\"]]],null,18],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"currentOperativePlan\"]]],null,15],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"visit\",\"patientNotes\"]]],null,11],[\"text\",\"\\n          \"],[\"append\",[\"helper\",[\"custom-form-manager\"],null,[[\"model\",\"formType\"],[[\"get\",[\"model\"]],\"opdReport\"]]],false],[\"text\",\"\\n\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.admissionDate\"],null],false],[\"text\",\":\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"              \"],[\"append\",[\"helper\",[\"t\"],[\"reports.labels.visitDate\"],null],false],[\"text\",\":\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"          \"],[\"append\",[\"helper\",[\"patient-summary\"],null,[[\"patient\",\"disablePatientLink\",\"diagnosisContainer\",\"diagnosisList\"],[[\"get\",[\"model\",\"patient\"]],true,[\"get\",[\"diagnosisContainer\"]],[\"get\",[\"diagnosisList\"]]]]],false],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"model\",\"patient\"]]],null,33],[\"text\",\"\\n        \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"ps-info-group test-visit-date\"],[\"flush-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"label\",[]],[\"static-attr\",\"class\",\"ps-info-label test-visit-date-label\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"isOutPatient\"]]],null,32,31],[\"text\",\"          \"],[\"close-element\"],[\"text\",\"\\n          \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"test-visit-date-data\"],[\"flush-element\"],[\"append\",[\"helper\",[\"date-format\"],[[\"get\",[\"visit\",\"startDate\"]]],null],false],[\"close-element\"],[\"text\",\"\\n        \"],[\"close-element\"],[\"text\",\"\\n\\n\"],[\"block\",[\"if\"],[[\"get\",[\"isOutPatient\"]]],null,30,9]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],34]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"h3\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.titles.dischargeReport\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"h3\",[]],[\"flush-element\"],[\"append\",[\"helper\",[\"t\"],[\"reports.titles.opdReport\"],null],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"span\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"headerLine3\"]],false],[\"close-element\"],[\"open-element\",\"br\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"span\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"headerLine2\"]],false],[\"close-element\"],[\"open-element\",\"br\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"span\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"headerLine1\"]],false],[\"close-element\"],[\"open-element\",\"br\",[]],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"h3\",[]],[\"flush-element\"],[\"append\",[\"unknown\",[\"facilityName\"]],false],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"      \"],[\"open-element\",\"img\",[]],[\"dynamic-attr\",\"src\",[\"unknown\",[\"logoURL\"]],null],[\"static-attr\",\"class\",\"report-logo\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"report-header\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"if\"],[[\"get\",[\"logoURL\"]]],null,42],[\"block\",[\"if\"],[[\"get\",[\"facilityName\"]]],null,41],[\"block\",[\"if\"],[[\"get\",[\"headerLine1\"]]],null,40],[\"block\",[\"if\"],[[\"get\",[\"headerLine2\"]]],null,39],[\"block\",[\"if\"],[[\"get\",[\"headerLine3\"]]],null,38],[\"block\",[\"if\"],[[\"get\",[\"isOutPatient\"]]],null,37,36],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"report\"],[\"flush-element\"],[\"text\",\"\\n\"],[\"block\",[\"edit-panel\"],null,[[\"editPanelProps\"],[[\"get\",[\"editPanelProps\"]]]],35],[\"text\",\"  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/visits/reports/edit/template.hbs" } });
});
define('hospitalrun/visits/route', ['exports', 'hospitalrun/routes/abstract-module-route'], function (exports, _hospitalrunRoutesAbstractModuleRoute) {
  exports['default'] = _hospitalrunRoutesAbstractModuleRoute['default'].extend({
    addCapability: 'add_visit',
    additionalModels: [{
      name: 'anesthesiaTypes',
      findArgs: ['lookup', 'anesthesia_types']
    }, {
      name: 'anesthesiologistList',
      findArgs: ['lookup', 'anesthesiologists']
    }, {
      name: 'diagnosisList',
      findArgs: ['lookup', 'diagnosis_list']
    }, {
      name: 'cptCodeList',
      findArgs: ['lookup', 'cpt_code_list']
    }, {
      name: 'physicianList',
      findArgs: ['lookup', 'physician_list']
    }, {
      name: 'locationList',
      findArgs: ['lookup', 'visit_location_list']
    }, {
      name: 'procedureList',
      findArgs: ['lookup', 'procedure_list']
    }, {
      name: 'procedureLocations',
      findArgs: ['lookup', 'procedure_locations']
    }, {
      name: 'procedurePricingTypes',
      findArgs: ['lookup', 'procedure_pricing_types']
    }, {
      name: 'sexList',
      findArgs: ['lookup', 'sex']
    }, {
      name: 'visitTypesList',
      findArgs: ['lookup', 'visit_types']
    }, {
      name: 'wardPricingTypes',
      findArgs: ['lookup', 'ward_pricing_types']
    }, {
      name: 'printHeader',
      findArgs: ['option', 'print_header']
    }],
    moduleName: 'visits',
    newButtonAction: null, // No new button
    sectionTitle: 'Visits',

    actions: {
      allItems: function allItems() {
        this.transitionTo('patients.index');
      }
    }

  });
});
define('hospitalrun/visits/vitals/delete/controller', ['exports', 'hospitalrun/controllers/abstract-delete-controller', 'ember'], function (exports, _hospitalrunControllersAbstractDeleteController, _ember) {
  exports['default'] = _hospitalrunControllersAbstractDeleteController['default'].extend({
    afterDeleteAction: 'notifyVitalsDelete',
    editController: _ember['default'].inject.controller('visits/edit'),
    title: 'Delete Vitals',

    actions: {
      notifyVitalsDelete: function notifyVitalsDelete() {
        this.send('closeModal');
        this.get('editController').send('deleteVitals', this.get('model'));
      }
    }
  });
});
define("hospitalrun/visits/vitals/delete/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "pcS8QYDZ", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],0]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"  \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"alert alert-danger\"],[\"flush-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"span\",[]],[\"static-attr\",\"class\",\"glyphicon glyphicon-warning-sign\"],[\"flush-element\"],[\"close-element\"],[\"text\",\"\\n    \"],[\"append\",[\"helper\",[\"t\"],[\"messages.delete_plural\"],[[\"name\"],[[\"helper\",[\"t\"],[\"models.vital.names.plural\"],null]]]],false],[\"text\",\"\\n  \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/visits/vitals/delete/template.hbs" } });
});
define('hospitalrun/visits/vitals/edit/controller', ['exports', 'hospitalrun/controllers/abstract-edit-controller', 'ember'], function (exports, _hospitalrunControllersAbstractEditController, _ember) {
  exports['default'] = _hospitalrunControllersAbstractEditController['default'].extend({
    cancelAction: 'closeModal',

    editController: _ember['default'].inject.controller('visits/edit'),

    newVitals: false,

    temperatureLabel: 'Temperature (\xb0C)',

    title: (function () {
      var isNew = this.get('model.isNew');
      if (isNew) {
        return 'Add Vitals';
      }
      return 'Edit Vitals';
    }).property('model.isNew'),

    updateCapability: 'add_vitals',

    beforeUpdate: function beforeUpdate() {
      if (this.get('model.isNew')) {
        this.set('newVitals', true);
      }
      return _ember['default'].RSVP.Promise.resolve();
    },

    afterUpdate: function afterUpdate(vitals) {
      if (this.get('newVitals')) {
        this.get('editController').send('addVitals', vitals);
      } else {
        this.send('closeModal');
      }
    }
  });
});
define("hospitalrun/visits/vitals/edit/template", ["exports"], function (exports) {
  exports["default"] = Ember.HTMLBars.template({ "id": "OAomDrTd", "block": "{\"statements\":[[\"block\",[\"modal-dialog\"],null,[[\"hideCancelButton\",\"isUpdateDisabled\",\"title\",\"updateButtonAction\",\"updateButtonText\"],[[\"get\",[\"hideCancelButton\"]],[\"get\",[\"isUpdateDisabled\"]],[\"get\",[\"title\"]],[\"get\",[\"updateButtonAction\"]],[\"get\",[\"updateButtonText\"]]]],1]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"date-picker\"],null,[[\"property\",\"label\",\"class\",\"format\",\"showTime\"],[\"dateRecorded\",[\"helper\",[\"t\"],[\"vitals.labels.dateRecorded\"],null],\"col-sm-6\",\"l h:mm A\",true]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"class\",\"property\",\"label\"],[\"col-sm-3 required temperature-text\",\"temperature\",[\"get\",[\"temperatureLabel\"]]]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"class\",\"property\",\"label\"],[\"col-sm-3 weight-text\",\"weight\",[\"helper\",[\"t\"],[\"vitals.labels.weight\"],null]]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"class\",\"property\",\"label\"],[\"col-sm-3 height-text\",\"height\",[\"helper\",[\"t\"],[\"vitals.labels.height\"],null]]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"class\",\"property\",\"label\"],[\"col-sm-3 required sbp-text\",\"sbp\",[\"helper\",[\"t\"],[\"vitals.labels.sbp\"],null]]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"em-input\"],null,[[\"class\",\"property\",\"label\"],[\"col-sm-3 required dbp-text\",\"dbp\",[\"helper\",[\"t\"],[\"vitals.labels.dbp\"],null]]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n    \"],[\"open-element\",\"div\",[]],[\"static-attr\",\"class\",\"row\"],[\"flush-element\"],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"class\",\"property\",\"label\"],[\"col-sm-3 required heart-rate-text\",\"heartRate\",[\"helper\",[\"t\"],[\"vitals.labels.heartRate\"],null]]]],false],[\"text\",\"\\n      \"],[\"append\",[\"helper\",[\"number-input\"],null,[[\"class\",\"property\",\"label\"],[\"col-sm-3 required respiratory-rate-text\",\"respiratoryRate\",[\"helper\",[\"t\"],[\"vitals.labels.respiratoryRate\"],null]]]],false],[\"text\",\"\\n    \"],[\"close-element\"],[\"text\",\"\\n\"]],\"locals\":[]},{\"statements\":[[\"block\",[\"em-form\"],null,[[\"model\",\"submitButton\"],[[\"get\",[\"model\"]],false]],0]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "hospitalrun/visits/vitals/edit/template.hbs" } });
});
/* jshint ignore:start */



/* jshint ignore:end */

/* jshint ignore:start */

define('hospitalrun/config/environment', ['ember'], function(Ember) {
  var prefix = 'hospitalrun';
/* jshint ignore:start */

try {
  var metaName = prefix + '/config/environment';
  var rawConfig = document.querySelector('meta[name="' + metaName + '"]').getAttribute('content');
  var config = JSON.parse(unescape(rawConfig));

  var exports = { 'default': config };

  Object.defineProperty(exports, '__esModule', { value: true });

  return exports;
}
catch(err) {
  throw new Error('Could not read config from meta tag with name "' + metaName + '".');
}

/* jshint ignore:end */

});

/* jshint ignore:end */

/* jshint ignore:start */

if (!runningTests) {
  require("hospitalrun/app")["default"].create({"name":"hospitalrun","version":"1.0.0-beta+30ccd205"});
}

/* jshint ignore:end */
//# sourceMappingURL=hospitalrun.map
