(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 0) _viewPatient.additional.nhsNumberUnknown = false; if (!_viewPatient.additional.nhsNumberUnknown) { if (_viewPatient.additional.nhsNumber.value === "" || _viewPatient.additional.nhsNumber.value === null || _viewPatient.additional.nhsNumber.value === undefined) cbNotify.addFormError('nhsNumberUnknown', 'Please tick NHS Number Unknown or enter an NHS Number'); else { _viewPatient.additional.nhsNumber.value = _viewPatient.additional.nhsNumber.value.replace(/\s/g, ''); if (!_viewPatient.validateNHSNumber()) cbNotify.addFormError('nhsNumberUnknown', 'NHS Number Invalid'); } } cbNotify.isFieldEmpty('familyName', _viewPatient.data.patient.familyName, 'Family Name required'); cbNotify.isFieldEmpty('genderId', _viewPatient.data.patient.genderId, 'Please select the gender'); _viewPatient.data.patient.dateOfBirth = cbCommonTools.convertToDbDate('dateOfBirth', _viewPatient.data.patient.dateOfBirth); if (cbNotify.hasError()) cbNotify.displayError(); else { cbPatientData.saveView(_viewPatient.data, 'Demographics').then(function (result) { if (_viewPatient.isNew) $state.go('^.patient.patient', { notifyInfo: 'Patient Added', section: 'top', patientId: _viewPatient.data.patient.id, showSelect: _viewPatient.showSelect }, { reload: true }); else $state.go('^.patient', { notifyInfo: 'Demographics Saved', section: 'top', showSelect: _viewPatient.showSelect }, { reload: true }); }); } } catch (e) { cbNotify.addException(e); } }; // End saveDemographics _viewPatient.clearNHSNumber = function () { if (_viewPatient.additional.nhsNumberUnknown) _viewPatient.additional.nhsNumber.value = ""; }; _viewPatient.validateNHSNumber = function () { //if (_viewPatient.additional.nhsNumberUnknown) // return false; var isValid = false; //!_viewPatient.additional.nhsNumberUnknown && if (_viewPatient.additional.nhsNumber.value.length !== 10) { return isValid; } if (_viewPatient.additional.nhsNumber.value.length === 10) { var number = parseInt(_viewPatient.additional.nhsNumber.value.substr(0, 9)); //Exclude Northern Ireland Numbers or NHS Scotland CHI Numbers //if (number > 320000000 && number < 400000000) // return isValid; //NHS England if (number > 499999999 && number < 600000000) //|| number > 708800001 (not correct) return isValid; var total = 0; var i = 0; for (i = 0; i <= 8; i++) { var digit = _viewPatient.additional.nhsNumber.value.substr(i, 1); var factor = 10 - i; total += (digit * factor); } var checkDigit = (11 - (total % 11)); if (checkDigit === 11) checkDigit = 0; if (checkDigit === parseInt(_viewPatient.additional.nhsNumber.value.substr(9, 1))) isValid = true; return isValid; } }; deferred.resolve(_viewPatient); } catch (e) { cbNotify.addException(e); deferred.reject(e); } return deferred.promise; } }; return _service; }; },{}],5:[function(require,module,exports){ 'use strict'; module.exports = /*@ngInject*/ function ($scope, $state, cbCommonTools, cbNotify, cbAdditionalFieldsService, cbPatientData) { try { cbCommonTools.goToSection('top'); $scope.patientView.contactDetails.homeTel = cbAdditionalFieldsService.initContactDetail('Home Telephone', $scope.patientView.data.contactDetails, $scope.patientView.data.references.contactTypes); $scope.patientView.contactDetails.workTel = cbAdditionalFieldsService.initContactDetail('Work Telephone', $scope.patientView.data.contactDetails, $scope.patientView.data.references.contactTypes); $scope.patientView.contactDetails.mobileTel = cbAdditionalFieldsService.initContactDetail('Mobile Telephone', $scope.patientView.data.contactDetails, $scope.patientView.data.references.contactTypes); $scope.patientView.contactDetails.emailAddress = cbAdditionalFieldsService.initContactDetail('Email Address', $scope.patientView.data.contactDetails, $scope.patientView.data.references.contactTypes); $scope.save = function () { cbNotify.clear(); if (cbNotify.hasError()) cbNotify.displayError(); else { cbPatientData.saveView($scope.patientView.data, 'Contact Details').then(function () { $state.go('^.patient', { notifyInfo: 'Contact Details Saved Successfully', section: 'contactDetails' }, { reload: true }); }); } }; } catch (e) { cbNotify.addException(e); } }; },{}],6:[function(require,module,exports){ 'use strict'; var _modName = 'cbPatient'; var app = angular.module(_modName); app.controller(_modName + '.controllers.patient.contactDetails', require('./contactDetails')); app.controller(_modName + '.controllers.patient.note', require('./note')); require('./nhsNumber/'); },{"./contactDetails":5,"./nhsNumber/":9,"./note":12}],7:[function(require,module,exports){ 'use strict'; module.exports = /*@ngInject*/ function ($scope, cbCommonTools, patientView) { cbCommonTools.goToSection('top'); patientView.data.patient.genderId = null; patientView.additional.nhsNumberUnknown = null; $scope.patientView = patientView; }; },{}],8:[function(require,module,exports){ 'use strict'; module.exports = /*@ngInject*/ function (cbCommonTools) { cbCommonTools.goToSection('top'); //Do not remove, required for customoisation by property name }; },{}],9:[function(require,module,exports){ 'use strict'; var _modName = 'cbPatient'; var app = angular.module(_modName); app.controller(_modName + '.controllers.patient.nhsNumber.add', require('./add')); app.controller(_modName + '.controllers.patient.nhsNumber.demographics', require('./demographics')); app.controller(_modName + '.controllers.patient.nhsNumber.view', require('./view')); app.controller(_modName + '.controllers.patient.nhsNumber.search', require('./search')); },{"./add":7,"./demographics":8,"./search":10,"./view":11}],10:[function(require,module,exports){ 'use strict'; module.exports = /*@ngInject*/ function ($scope, $stateParams, cbNotify, cbCommonTools, cbPatientData, cbPatientSearchService, cbPatientSearchResultList) { try { cbCommonTools.goToSection('top'); $scope.searchView = cbPatientSearchService; if ($stateParams.clear === true) $scope.searchView.clear(); $scope.setActiveTab = function (tab) { $scope.searchView.activeTab = tab; if ($scope.searchView.activeTab === 'nhsNumber') $("#txt_nhsNumber").focus(); if ($scope.searchView.activeTab === 'simple') $("#txt_familyName").focus(); }; $scope.nhsNumberSearch = function () { try { cbNotify.clear(); if ($scope.searchView.nhsNumberParameters.nhsNumber !== null) $scope.searchView.nhsNumberParameters.nhsNumber = $scope.searchView.nhsNumberParameters.nhsNumber.replace(/\s/g, ''); cbNotify.isFieldEmpty('nhsNumber', $scope.searchView.nhsNumberParameters.nhsNumber, 'NHS Number required'); if ($scope.searchView.nhsNumberParameters.nhsNumber !== null && $scope.searchView.nhsNumberParameters.nhsNumber.length !== 10) cbNotify.addFormError('nhsNumber', 'Please enter a valid NHS Number'); if (cbNotify.hasError()) cbNotify.displayError(); else { cbPatientData.searchIdentifier('NHS Number', $scope.searchView.nhsNumberParameters.nhsNumber).then(function (result) { $scope.searchView.searched = true; $scope.searchView.searchResults = cbPatientSearchResultList.grid(result); }); } } catch (e) { cbNotify.addException(e); } }; $scope.simpleSearch = function () { try { cbNotify.clear(); if ($scope.searchView.simpleParameters.data.familyName === null && $scope.searchView.simpleParameters.data.firstName === null && $scope.searchView.simpleParameters.dateOfBirth === null && $scope.searchView.simpleParameters.data.genderId === null) cbNotify.addFormError('familyName', 'Please enter a search parameter'); if ($scope.searchView.simpleParameters.dateOfBirth !== null) $scope.searchView.simpleParameters.data.dateOfBirth = cbCommonTools.convertToDbDate('dateOfBirth', $scope.searchView.simpleParameters.dateOfBirth); if (cbNotify.hasError()) cbNotify.displayError(); else { cbPatientData.searchSimple($scope.searchView.simpleParameters.data).then(function (result) { $scope.searchView.searched = true; $scope.searchView.searchResults = cbPatientSearchResultList.grid(result); }); } } catch (e) { cbNotify.addException(e); } }; } catch (e) { cbNotify.addException(e); } }; },{}],11:[function(require,module,exports){ 'use strict'; module.exports = /*@ngInject*/ function ($scope, $stateParams, cbCommonTools, cbNotify, cbPatientAssociateList, patientView) { try { if ($stateParams.section !== null) cbCommonTools.goToSection($stateParams.section); $scope.addressBackState = '^.patient'; $scope.lvAssociates = cbPatientAssociateList.grid(patientView.data.associates); $scope.lvAssociates.showOnlyActive(true); if ($stateParams.gpSearchResult !== null) { $scope.patientView.data.registeredGP = $stateParams.gpSearchResult; $scope.patientView.data.patient.registeredGPCode = $scope.patientView.data.registeredGP.gp.id; if ($scope.patientView.data.registeredGP.branch !== null) $scope.patientView.data.patient.registeredGPBranchCode = $scope.patientView.data.registeredGP.branch.id; $scope.patientView.saveRegisteredGP(); } } catch (e) { cbNotify.addException(e); } }; },{}],12:[function(require,module,exports){ 'use strict'; module.exports = /*@ngInject*/ function ($scope, $state, cbCommonTools, cbNotify, cbAdditionalFieldsService, cbPatientData) { try { cbCommonTools.goToSection('top'); $scope.patientView.additional.note = cbAdditionalFieldsService.initString('Contact Note', $scope.patientView.data.strings, $scope.patientView.data.references.stringTypes); $scope.save = function () { cbNotify.clear(); if (cbNotify.hasError()) cbNotify.displayError(); else { cbPatientData.saveView($scope.patientView.data, 'Notes').then(function () { $state.go('^.patient', { notifyInfo: 'Note Saved Successfully', section: 'notes' }, { reload: true }); }); } }; } catch (e) { cbNotify.addException(e); } }; },{}],13:[function(require,module,exports){ 'use strict'; var _modName = 'cbPatient'; var app = angular.module(_modName); app.factory(_modName + 'Data', require('./patientData')); app.factory(_modName + 'AssociateData', require('./patientAssociateData')); },{"./patientAssociateData":14,"./patientData":15}],14:[function(require,module,exports){ module.exports = /*@ngInject*/ function (cbSystem, cbHttp) { var _rootUrl = cbSystem.getSystemUrl() + '/api/patient/associate/v1/'; var _service = { getView: function (id) { return cbHttp.get(_rootUrl + 'getView?id=' + id); }, getViewByType: function (patientId, typeId) { return cbHttp.get(_rootUrl + 'getViewByType?patientId=' + patientId + '&typeId=' + typeId); }, saveView: function (vm) { return cbHttp.post(_rootUrl + 'saveView', vm ); } }; return _service; }; },{}],15:[function(require,module,exports){ module.exports = /*@ngInject*/ function (cbSystem, cbHttp) { var _rootUrl = cbSystem.getSystemUrl() + '/api/patient/v1/'; var _service = { getView: function (id) { return cbHttp.get(_rootUrl + 'getView?id=' + id + '&warningChecks=NHSNumber'); }, searchIdentifier: function (name, value) { return cbHttp.post(_rootUrl + 'searchIdentifier', { name: name, value: value }); }, searchSimple: function (vm) { return cbHttp.post(_rootUrl + 'searchSimple', vm); }, newView: function () { return cbHttp.get(_rootUrl + 'newView'); }, saveView: function (vm, type) { return cbHttp.post(_rootUrl + 'saveView', { type: type, view: vm} ); } }; return _service; }; },{}],16:[function(require,module,exports){ module.exports = /*@ngInject*/ function ($filter) { var _service = { grid: function (data) { return { title: 'Associates', position: 'relative', enablePaginationControls: false, enablePagination: false, enableSorting: true, enableFiltering: false , enableColumnMenus: false, autoHeight: true, enableHorizontalScrollbar: 2, enableVerticalScrollbar: 2 , enableRowHeaderSelection: false, enableRowSelection: false , headerClass: 'bg-olive fg-white' , showHeader: true, showSearch: false, showChevronRight: true, chevronRightSize: 16 , columnDefs: [ { field: 'type.fullName', displayName: 'Type', pinnedLeft: false, width: '120' } , { field: 'associate.name', displayName: 'Name', pinnedLeft: false, width: '200' } , { field: 'associate.additionalInformation', displayName: 'Additional Info', pinnedLeft: false, width: '200', cellTemplate: '
' } , { field: 'tel', displayName: 'Home Tel', width: '120', cellTemplate: '
' } , { field: 'mobile', displayName: 'Mobile', width: '120', cellTemplate: '
' } , { field: 'email', displayName: 'Email', width: '200', cellTemplate: '
' } , { field: 'associate.isActive', pinnedRight: true, displayName: 'Is Active', width: '120', cellTemplate: '
YesNo
' } , { field: 'id', pinnedRight: true, displayName: ' ', width: '120', headerCellTemplate: '
', cellTemplate: '
View
' } ] , mobileColumnDefs: [ { display: '', type: 'title' } , { display: 'Type: ', type: 'detail' } , { display: 'Info: ', type: 'detail' } , { display: 'Home: ', display2: 'Mobile: ', type: 'detail_2column' } ] , mobileLink: '^.patient-associate({ associateId: row.associate.id })' , showOptions: true , optionsMenu: [ { template: '
  • Show Only Active
  • ' } , { template: '
  • Show All
  • ' } ] , onlyActive: true , showOnlyActive: function (isActive) { var grid = this; grid.onlyActive = isActive; if (grid.onlyActive) grid.data = $filter('filter')(data, function (item) { return item.associate.isActive === true; }); else grid.data = data; } }; } }; return _service; }; },{}],17:[function(require,module,exports){ 'use strict'; var _modName = 'cbPatient'; var app = angular.module(_modName); app.factory(_modName + 'AssociateList', require('./associateList')); app.factory(_modName + 'SearchResultList', require('./searchResultList')); },{"./associateList":16,"./searchResultList":18}],18:[function(require,module,exports){ module.exports = /*@ngInject*/ function () { var _service = { grid: function (data) { return { title: 'Search Results', position: 'relative', enablePaginationControls: false, enablePagination: false, enableSorting: true, enableFiltering: false , enableColumnMenus: false, autoHeight: true, enableHorizontalScrollbar: 2, enableVerticalScrollbar: 2 , enableRowHeaderSelection: false, enableRowSelection: false , headerClass: 'bg-green fg-white' , showHeader: true, showSearch: false, showChevronRight: true, chevronRightSize: 16 , columnDefs: [ { field: 'patient.familyName', displayName: 'Family Name', pinnedLeft: false, width: '200', cellTemplate: '
    ' } , { field: 'patient.firstName', displayName: 'First Name', pinnedLeft: false, width: '*' } , { field: 'patient.namePrefix.fullName', displayName: 'Prefix', pinnedLeft: false, width: '200', cellTemplate: '
    ' } , { field: 'patient.nhsNumber', displayName: 'NHS Number', pinnedLeft: false, width: '200', cellTemplate: '
    ' } , { field: 'patient.gender.fullName', displayName: 'Gender', pinnedLeft: false, width: '200', cellTemplate: '
    ' } , { field: 'patient.dateOfBirth', displayName: 'Date of Birth', pinnedLeft: false, width: '200', cellTemplate: '
    ' } , { field: 'id', pinnedRight: true, displayName: ' ', width: '120', headerCellTemplate: '
    ', cellTemplate: '
    View
    ' } ] , mobileColumnDefs: [ { display: ', ()', type: 'title' } , { display: 'NHS Number: ', type: 'detail' } , { display: 'Gender: ', type: 'detail' } , { display: 'Date of Birth: ', type: 'detail' } ] , mobileLink: '^.patient.patient({ patientId: row.patient.id, showSelect: true, section: \'top\', saveStateName: \'patient_back\' })' , showOptions: false , showData: true , data: data }; } }; return _service; }; },{}],19:[function(require,module,exports){ 'use strict'; var _modName = 'cbPatient'; var app = angular.module(_modName); app.provider(_modName + 'Template', require('./patientTemplate')); },{"./patientTemplate":20}],20:[function(require,module,exports){ module.exports = /*@ngInject*/ function (cbTemplateProvider) { var _modName = 'cbPatient'; return { getAddNHSNumberState: function (property) { return { url: '/patient-add' , params: { showSelect: null, section: null, saveToHistoryName: null, saveStateName: null, notifyInfo: null, notifyWarning: null, notifyError: null } , templateProvider: cbTemplateProvider.getTemplateByInstanceProperty(_modName, 'forms/add_nhsnumber', property) , controllerProvider: cbTemplateProvider.getControllerByInstanceProperty(_modName, '.controllers.patient.nhsNumber.add', property) , resolve: { patient: /*@ngInject*/ function (cbPatientData) { return cbPatientData.newView(); }, patientView: /*@ngInject*/ function ($stateParams, cbPatientBinder, patient) { return cbPatientBinder.init(patient, $stateParams.showSelect, true); } } }; }, getSearchNHSNumberState: function (property) { return { url: '/patient-search' , params: { clear: null, section: null, saveToHistoryName: null, saveStateName: null, notifyInfo: null, notifyWarning: null, notifyError: null } , templateProvider: cbTemplateProvider.getTemplateByInstanceProperty(_modName, 'nhsNumber/search', property) , controllerProvider: cbTemplateProvider.getControllerByInstanceProperty(_modName, '.controllers.patient.nhsNumber.search', property) }; }, getRootViewNHSNumberState: function (property) { return { url: '/patient/:patientId/:showSelect' , params: { fixedHeader: true } , resolve: { patient: /*@ngInject*/ function ($stateParams, cbPatientData) { return cbPatientData.getView($stateParams.patientId); }, patientView: /*@ngInject*/ function ($stateParams, cbPatientBinder, patient) { return cbPatientBinder.init(patient, $stateParams.showSelect); } }, views: { 'fixedPageHeader@': { templateProvider: /*@ngInject*/ function ($stateParams, cbTemplateHelper) { if ($stateParams.fixedHeader) return cbTemplateHelper.getByState(_modName, 'nhsNumber/_header'); }, controller: /*@ngInject*/ function ($scope, patientView) { $scope.patientView = patientView; } } , 'pageHeader@': { templateProvider: /*@ngInject*/ function ($stateParams, cbTemplateHelper) { if (!$stateParams.fixedHeader) return cbTemplateHelper.getByState(_modName, 'nhsNumber/_header'); }, controller: /*@ngInject*/ function ($scope, patientView) { $scope.patientView = patientView; } } , '@': { templateProvider: cbTemplateProvider.getTemplateByInstanceProperty(_modName, 'index', property), controller: /*@ngInject*/ function ($scope, patientView) { $scope.patientView = patientView; } } } }; }, getPatientViewNHSNumberState: function (property) { return { url: '/patient' , params: { gpSearchResult: null, section: null, saveToHistoryName: null, saveStateName: null, notifyInfo: null, notifyWarning: null, notifyError: null } , templateProvider: cbTemplateProvider.getTemplateByInstanceProperty(_modName, 'nhsNumber/summary', property) , controllerProvider: cbTemplateProvider.getControllerByInstanceProperty(_modName, '.controllers.patient.nhsNumber.view', property) }; }, getPatientDemographicsNHSNumberState: function (property) { return { url: '/demographics' , params: { section: null, saveToHistoryName: null, saveStateName: null, notifyInfo: null, notifyWarning: null, notifyError: null } , templateProvider: cbTemplateProvider.getTemplateByInstanceProperty(_modName, 'forms/demographics_nhsnumber', property) , controllerProvider: cbTemplateProvider.getControllerByInstanceProperty(_modName, '.controllers.patient.nhsNumber.demographics', property) }; }, getPatientContactDetailsState: function () { return { url: '/patient-contact-details' , params: { section: null, saveToHistoryName: null, saveStateName: null, notifyInfo: null, notifyWarning: null, notifyError: null } , templateProvider: cbTemplateProvider.getTemplate(_modName, 'forms/contactDetails') , controller: _modName + '.controllers.patient.contactDetails' }; }, getPatientAssociateState: function () { return { url: '/patient-associate/:associateId' , params: { section: null, saveToHistoryName: null, rememberState: false, notifyInfo: null, notifyWarning: null, notifyError: null } , resolve: { associate: /*@ngInject*/ function ($stateParams, cbPatientAssociateData) { if ($stateParams.associateId !== '0') return cbPatientAssociateData.getView($stateParams.associateId); else return null; }, contactTypes: /*@ngInject*/ function (cbCoreLookupData) { return cbCoreLookupData.all(null, 'Contact Type', true); }, associateView: /*@ngInject*/ function ($stateParams, cbPatientAssociateBinder, associate, contactTypes) { return cbPatientAssociateBinder.init(associate, contactTypes, $stateParams.patientId); } } , templateProvider: cbTemplateProvider.getTemplate(_modName, 'forms/associate') , controller: /*@ngInject*/ function ($scope, cbCommonTools, associateView) { cbCommonTools.goToSection('top'); $scope.associateView = associateView; } }; }, getPatientNoteState: function () { return { url: '/patient-note' , params: { section: null, saveToHistoryName: null, saveStateName: null, notifyInfo: null, notifyWarning: null, notifyError: null } , templateProvider: cbTemplateProvider.getTemplate(_modName, 'forms/note') , controller: _modName + '.controllers.patient.note' }; }, $get: function () { return {}; } }; }; },{}],21:[function(require,module,exports){ 'use strict'; var _modName = 'cbPatient'; var app = angular.module(_modName); app.factory(_modName + 'SearchService', require('./search')); },{"./search":22}],22:[function(require,module,exports){ module.exports = /*@ngInject*/ function (cbNotify, cbPatientSearchResultList) { return { clear: function () { cbNotify.clear(); this.searched = false; this.searchResults = cbPatientSearchResultList.grid(null); this.activeTab = null; this.nhsNumberParameters = { nhsNumber: null }; this.simpleParameters = { gender: null, dateOfBirth: null, data: { familyName: null, firstName: null, dateOfBirth: null, genderId: null } }; }, searched: false, searchResults: cbPatientSearchResultList.grid(null), activeTab: null, nhsNumberParameters: { nhsNumber: null }, simpleParameters: { gender: null, dateOfBirth: null, data: { familyName: null, firstName: null, dateOfBirth: null, genderId: null } } }; }; },{}]},{},[1]);