From 0886eaca4bbf48bab84d79c3a21e1437023f4fe2 Mon Sep 17 00:00:00 2001 From: Bruce Mbayo Date: Wed, 25 May 2016 16:28:57 -0700 Subject: [PATCH 1/2] Use of component for patient documents major component implementation Use of documents component in the patient module Fix and enhancement of patient document component and module --- client/src/i18n/en.json | 24 ++- client/src/i18n/fr.json | 22 ++- client/src/js/app.js | 12 +- client/src/js/components/bhFindDocument.js | 117 ++++++++++++ client/src/js/filters/bytes.js | 23 +++ .../partials/patients/documents/documents.css | 63 ++++-- .../patients/documents/documents.html | 49 +++-- .../partials/patients/documents/documents.js | 28 ++- .../documents/modals/documents.modal.html | 2 +- .../patients/record/patient_record.html | 25 ++- .../patients/record/patient_record.js | 11 +- .../templates/bhFindDocument.tmpl.html | 179 ++++++++++++++++++ .../controllers/medical/patients/documents.js | 11 +- server/models/schema.sql | 6 +- server/models/test/data.sql | 4 +- server/test/api/patientDocuments.js | 2 +- 16 files changed, 494 insertions(+), 84 deletions(-) create mode 100644 client/src/js/components/bhFindDocument.js create mode 100644 client/src/js/filters/bytes.js create mode 100644 client/src/partials/templates/bhFindDocument.tmpl.html diff --git a/client/src/i18n/en.json b/client/src/i18n/en.json index 20c9a6a886..8b5c1fb0bd 100644 --- a/client/src/i18n/en.json +++ b/client/src/i18n/en.json @@ -287,6 +287,7 @@ "BANK" : "Bank", "BANK_ACCOUNT" : "Bank Account", "BILLING_SERVICES" : "Billing Services Applied", + "BY" : "By", "BY_ID" : "By Id", "BY_NAME" : "By Name", "CANCELED" : "Canceled", @@ -407,6 +408,12 @@ "SERVICE" : "Service", "SET_DATE" : "Change Date", "SEX" : "Sex", + "SIZE_BYTES" : "Bytes", + "SIZE_KB" : "Kb", + "SIZE_MB" : "Mb", + "SIZE_GB" : "Gb", + "SIZE_TB" : "Tb", + "SIZE_PB" : "Pb", "SPOUSE" : "Spouse's Name", "SPOUSE_EMPLOYER" : "Spouse's Employer", "SPOUSE_PROFESSION" : "Spouse's Occupation", @@ -444,6 +451,7 @@ "ENTER_CREDITOR" : "Enter Creditor", "ENTER_DEBTOR" : "Enter Debtor", "ENTER_DESCRIPTION" : "Enter description", + "ENTER_DOCUMENT_NAME": "Enter Document Name", "ENTER_EMAIL" : "Enter email", "ENTER_MAX_CREDIT" : "Enter max credit", "ENTER_NAME" : "Enter Name", @@ -542,10 +550,14 @@ "TITLE" : "Authentication" }, "PATIENT_DOCUMENT" : { - "ADD" : "Add", + "ADD" : "Add documents", + "DISPLAY_LIST" : "Display as list", + "DISPLAY_THUMBNAIL" : "Display as thumbnail", "DOCUMENT_TITLE" : "Document Title", "DOCUMENT_LIST" : "Documents List", + "DOCUMENTS" : "Patient's Documents", "DOWNLOAD" : "Download", + "NO_DOCUMENT" : "No Document Found", "OVERVIEW" : "Overview", "POSTED_BY" : "Posted by", "SEARCH" : "Search documents", @@ -582,6 +594,11 @@ "PAGE_TITLE" : "Patient Invoice", "SUCCESS" : "Patient invoice successfully recorded." }, + "PATIENT_RECORDS": { + "TITLE" : "Patients", + "UPLOAD_PICTURE" : "Upload Patient Photo", + "NOT_FOUND" : "Unable to find patient with that ID. Please check with your system administrator." + }, "PATIENT_REG": { "FIND_PATIENT" : "Find a Patient", "PAGE_TITLE" : "Patient Registration", @@ -591,11 +608,6 @@ "VIEW_PATIENT_RECORDS" : "View Patient Records", "SUCCEESS" : "Patient record successfully written" }, - "PATIENT_RECORDS": { - "TITLE" : "Patients", - "UPLOAD_PICTURE" : "Upload Patient Photo", - "NOT_FOUND" : "Unable to find patient with that ID. Please check with your system administrator." - }, "PATIENT_REGISTRY" : { "DAY" : "day", "DAYS" : "days", diff --git a/client/src/i18n/fr.json b/client/src/i18n/fr.json index cc049bca86..dc7ece401f 100644 --- a/client/src/i18n/fr.json +++ b/client/src/i18n/fr.json @@ -284,6 +284,7 @@ "BANK" : "Banque", "BANK_ACCOUNT" : "Compte Bancaire", "BILLING_SERVICES" : "Les services de facturation appliquée", + "BY" : "Par", "BY_ID" : "Par id", "BY_NAME" : "Par nom", "CANCELED" : "Annulee", @@ -404,6 +405,12 @@ "SERVICE" : "Service", "SET_DATE" : "Changer la Date", "SEX" : "Sexe", + "SIZE_BYTES" : "Octets", + "SIZE_KB" : "Ko", + "SIZE_MB" : "Mo", + "SIZE_GB" : "Go", + "SIZE_TB" : "To", + "SIZE_PB" : "Po", "SPOUSE" : "Nom de l'époux(se)", "SPOUSE_EMPLOYER" : "Employeur(époux(se))", "SPOUSE_PROFESSION" : "Profession (époux(se))", @@ -441,6 +448,7 @@ "ENTER_CREDITOR" : "Entrer un crediteur", "ENTER_DEBTOR" : "Entrer un debiteur", "ENTER_DESCRIPTION" : "Entrer une description", + "ENTER_DOCUMENT_NAME": "Entrer le nom du document", "ENTER_EMAIL" : "Entrer l'adresse e-mail", "ENTER_MAX_CREDIT" : "Entrer le crédit maximale", "ENTER_NAME" : "Entrer le nom", @@ -539,10 +547,14 @@ "TITLE" : "Authentification" }, "PATIENT_DOCUMENT" : { - "ADD" : "Ajouter", + "ADD" : "Ajouter documents", + "DISPLAY_LIST" : "Affichage en list", + "DISPLAY_THUMBNAIL" : "Affichage en miniature", "DOCUMENT_TITLE" : "Titre du document", "DOCUMENT_LIST" : "Liste des documents", + "DOCUMENTS" : "Documents du patient", "DOWNLOAD" : "Telecharger", + "NO_DOCUMENT" : "Aucun document trouvé", "OVERVIEW" : "Aperçu", "POSTED_BY" : "Posté par", "SEARCH" : "Chercher documents", @@ -556,7 +568,8 @@ "PAGE_TITLE" : "Modifier Patient", "RECORD_SAME" : "Aucun changement n'a été apporté sur le formulaire. Mettez à jour les détails de patients et appuyez sur soumettre.", "REGISTERED" : "Patient Enregistré", - "WARN" : "Aucun groupes de patients n'a été trouvée. Les groupes de patients doivent être enregistrés dans le système avant l'affectation des patients" + "WARN" : "Aucun groupes de patients n'a été trouvée. Les groupes de patients doivent être enregistrés dans le système avant l'affectation des patients", + "EDIT_DETAILS" : "Modifier les details" }, "PATIENT_GROUP": { "ADD_PATIENT_GROUP" : "Nouveau Groupe de Patients", @@ -577,6 +590,11 @@ "INVALID_ITEMS" : "Cette facture contient des articles invalides", "PAGE_TITLE" : "Facture des patients" }, + "PATIENT_RECORDS": { + "TITLE" : "Patients", + "UPLOAD_PICTURE" : "Telecharger Photo Patient", + "NOT_FOUND" : "Impossible de trouver le patient ayant ce ID. Veuillez contacter votre administrateur systeme" + }, "PATIENT_REG": { "FIND_PATIENT" : "Trouver Patient", "PAGE_TITLE" : "Enregistrement des Patients", diff --git a/client/src/js/app.js b/client/src/js/app.js index a585bd8958..7b249fa44a 100644 --- a/client/src/js/app.js +++ b/client/src/js/app.js @@ -528,21 +528,11 @@ function bhimaConfig($stateProvider, $urlRouterProvider, $urlMatcherFactoryProvi }) .state('patientDocuments', { - url : '/patients/documents', + url : '/patients/:patient_uuid/documents', controller : 'PatientDocumentsController as PatientDocCtrl', templateUrl : 'partials/patients/documents/documents.html' }) - .state('patientDocuments.view', { - params : { patient_uuid: null }, - views : { - 'document@patientDocuments' : { - controller : 'DocumentViewController as DocViewCtrl', - templateUrl : 'partials/patients/documents/views/documentView.html' - } - } - }) - /* Patient Invoicing */ .state('patientInvoice', { url : '/invoices/patient', diff --git a/client/src/js/components/bhFindDocument.js b/client/src/js/components/bhFindDocument.js new file mode 100644 index 0000000000..696dc38b41 --- /dev/null +++ b/client/src/js/components/bhFindDocument.js @@ -0,0 +1,117 @@ +angular.module('bhima.components') +.component('bhFindDocument', { + controller : FindDocumentComponent, + controllerAs : '$ctrl', + templateUrl : 'partials/templates/bhFindDocument.tmpl.html', + bindings: { + enablePatientDetails : '<', // bind boolean (true|false) : Enable patient details option + enableOptionBar : '<', // bind boolean (true|false) : Enable option for add, display list or display thumbnail in a bar + enableSearch : '<', // bind boolean (true|false) : Enable search bar option + display : '@', // bind (list|thumbnail) : Display either in list or thumbnail mode + patientUuid : '<' // Required patient uuid + } +}); + +FindDocumentComponent.$inject = [ + 'PatientService', 'ModalService', 'DocumentService', + 'NotifyService', 'UserService', '$translate' +]; + +/** + * Find Document Component + * This component is responsible for displaying documents for specific patient given + */ +function FindDocumentComponent(Patient, Modal, Document, Notify, User, $translate) { + var vm = this; + + /** global variables */ + vm.session = { + patientUuid : this.patientUuid, + enablePatientDetails : Boolean(this.enablePatientDetails), + enableOptionBar : Boolean(this.enableOptionBar), + enableSearch : Boolean(this.enableSearch), + display : this.display, + showAction : false + }; + + /** expose to the view */ + vm.switchDisplay = switchDisplay; + vm.toggleAction = toggleAction; + vm.addDocument = addDocument; + vm.deleteDocument = deleteDocument; + vm.mimeIcon = mimeIcon; + + // startup the component + startup(); + + /** function switchDisplay */ + function switchDisplay(mode) { + vm.session.display = mode; + } + + /** toggle document actions */ + function toggleAction(index) { + vm.selectedIndex = index; + vm.session.showAction = vm.session.showAction === true ? false : true; + } + + /** function add documents modal */ + function addDocument() { + Modal.openUploadDocument({ patient_uuid: vm.session.patientUuid }) + .then(startup); + } + + /** delete document */ + function deleteDocument(uuid) { + Modal.confirm($translate.instant('FORM.DIALOGS.CONFIRM_DELETE')) + .then(function (ans) { + if (!ans) { return; } + + return Document.remove(vm.session.patientUuid, uuid) + .then(function () { + Notify.success('FORM.INFOS.DELETE_SUCCESS'); + startup(); + }); + + }) + .catch(Notify.handleError); + } + + /** getting patient document */ + function startup() { + if (!vm.session.patientUuid) { return; } + + Patient.read(vm.session.patientUuid) + .then(function (patient) { + vm.session.patient = patient; + }) + .catch(Notify.handleError); + + Document.read(vm.session.patientUuid) + .then(function (documents) { + vm.session.patientDocuments = documents; + }) + .catch(Notify.handleError); + } + + /** format the image type */ + function mimeIcon(mimetype) { + var result = {}; + + if (mimetype.indexOf('image') > -1) { + result = { icon : 'fa-file-image-o', label : 'Image' }; + } else if (mimetype.indexOf('pdf') > -1) { + result = { icon : 'fa-file-pdf-o', label : 'PDF' }; + } else if (mimetype.indexOf('word') > -1) { + result = { icon : 'fa-file-word-o', label : 'MS WORD' }; + } else if (mimetype.indexOf('sheet') > -1) { + result = { icon : 'fa-file-excel-o', label : 'MS EXCEL' }; + } else if (mimetype.indexOf('presentation') > -1) { + result = { icon : 'fa-file-powerpoint-o', label : 'MS Power Point' }; + } else { + result = { icon : 'fa-file-o', label : 'Fichier' }; + }; + + return result; + } +} diff --git a/client/src/js/filters/bytes.js b/client/src/js/filters/bytes.js new file mode 100644 index 0000000000..8c7e2ae1e5 --- /dev/null +++ b/client/src/js/filters/bytes.js @@ -0,0 +1,23 @@ +angular.module('bhima.filters') +.filter('bytes', BytesFilter); + +BytesFilter.$inject = ['$translate']; + +/** + * Bytes Filter + * Format bytes size to human readable format + */ +function BytesFilter($translate) { + return function(bytes, precision) { + if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) { return '-'; } + if (typeof precision === 'undefined') { precision = 1; } + var units = ['SIZE_BYTES', 'SIZE_KB', 'SIZE_MB', 'SIZE_GB', 'SIZE_TB', 'SIZE_TB'], + number = Math.floor(Math.log(bytes) / Math.log(1024)); + + units = units.map(function (unit) { + return $translate.instant('FORM.LABELS.' + unit); + }); + + return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number]; + } +} diff --git a/client/src/partials/patients/documents/documents.css b/client/src/partials/patients/documents/documents.css index 3737348fdf..fb25a2bf3f 100644 --- a/client/src/partials/patients/documents/documents.css +++ b/client/src/partials/patients/documents/documents.css @@ -1,32 +1,26 @@ .document { - border: 1px solid #efefef; + border: 1px solid #ddd; padding: 5px; margin-bottom: 15px; cursor: pointer; - border-top: 5px solid #efefef; } .document:hover { - border-top: 5px solid blue; - background-color: #eaeafe; + background-color: #eee; } - .document h4 { margin: 2px; } - -.document .document-actions { +.document-actions { text-align: center; width: 100%; margin: auto; margin-top: 5px; } - .document .crop { width: 100%; height: 150px; overflow: hidden; } - .document .crop img.document-thumbnail { display: block; width: 100%; @@ -38,18 +32,55 @@ -webkit-transition: margin-top 1s; transition: margin-top 1s; } - .document:hover .crop img.document-thumbnail { -webkit-filter: grayscale(0%); filter: grayscale(0%); - margin-top: -50px; + -webkit-filter: grayscale(0%); + filter: grayscale(0%); + margin-top: -25px; +} +.document .crop .document-icon { + text-align: center; + font-size: 10rem; + color: #337ab7; +} +.patient-document .pd-patient { + padding: 7px; + margin-bottom: 5px; + border: 1px solid green; + color: green; + background-color: #e4f9ec; +} +.patient-document .pd-search { + margin-bottom: 5px; +} + +/* patient document heading */ +.patient-document .pd-documents .heading { + display: flex; + justify-content: space-between; + background-color: #337ab7; + color: #fff; + padding: 5px; + margin-bottom: 5px; +} +.patient-document .pd-documents .heading > .left { + margin: 5px 10px; } +/* patient list thumbanil */ +.patient-document .display-thumbnail { + display: flex; + align-items: flex-start; + align-content: flex-start; + justify-content: flex-start; + flex-wrap: wrap; +} +.patient-document .display-thumbnail > .document { + width: 50%; +} + +/* document upload thumbnail */ .document-upload-thumbnail { - display: block; width: 100%; - margin: auto; - margin-bottom: 10px; - -webkit-filter: grayscale(75%); - filter: grayscale(75%); } diff --git a/client/src/partials/patients/documents/documents.html b/client/src/partials/patients/documents/documents.html index df4790bdfd..b5f32b909e 100644 --- a/client/src/partials/patients/documents/documents.html +++ b/client/src/partials/patients/documents/documents.html @@ -1,20 +1,43 @@ - - - +
+
+ +
    +
  1. {{ "TREE.HOSPITAL" | translate }}
  2. +
  3. + + {{ "PATIENT_RECORDS.TITLE" | translate }} + +
  4. +
  5. + + {{ PatientDocCtrl.formatedPatientName }} + +
  6. +
+ + + + {{ "FORM.LABELS.DOCUMENT" | translate }} + + +
+
- - - - - -
+ + + +
diff --git a/client/src/partials/patients/documents/documents.js b/client/src/partials/patients/documents/documents.js index 2bfbd8e77b..d2e505ae22 100644 --- a/client/src/partials/patients/documents/documents.js +++ b/client/src/partials/patients/documents/documents.js @@ -2,28 +2,22 @@ angular.module('bhima.controllers') .controller('PatientDocumentsController', PatientDocumentsController); PatientDocumentsController.$inject = [ - '$translate', '$state' + '$state', 'PatientService', 'NotifyService' ]; -function PatientDocumentsController($translate, $state) { +function PatientDocumentsController($state, Patients, Notify) { var vm = this; - /** breadcrumb definitions */ - vm.paths = [{ - label : $translate.instant('PATIENT_DOCUMENT.TITLE'), - current: true - }]; - /** global objects */ - vm.patient = {}; - - /** expose to the view */ - vm.setPatient = setPatient; + vm.patientUuid = $state.params.patient_uuid; - /** functions definition */ - function setPatient(patient) { - vm.patient = patient; - $state.go('patientDocuments.view', { patient_uuid: patient.uuid }); - } + /** getting patient details */ + Patients.read(vm.patientUuid) + .then(function (patient) { + vm.formatedPatientName = patient.first_name.concat( + ' ', patient.middle_name, + ' ', patient.last_name); + }) + .catch(Notify.handleError); } diff --git a/client/src/partials/patients/documents/modals/documents.modal.html b/client/src/partials/patients/documents/modals/documents.modal.html index b3be66cee4..4bc24ea57f 100644 --- a/client/src/partials/patients/documents/modals/documents.modal.html +++ b/client/src/partials/patients/documents/modals/documents.modal.html @@ -41,7 +41,7 @@
diff --git a/client/src/partials/patients/record/patient_record.html b/client/src/partials/patients/record/patient_record.html index bc9355a626..4021c334b2 100644 --- a/client/src/partials/patients/record/patient_record.html +++ b/client/src/partials/patients/record/patient_record.html @@ -41,7 +41,7 @@
-

{{::PatientRecordCtrl.patient.abbr}} {{::PatientRecordCtrl.patient.reference}}

+

{{::PatientRecordCtrl.patient.reference}}

@@ -88,6 +88,13 @@ {{ "PATIENT_EDIT.EDIT_DETAILS" | translate }} + + + {{ "PATIENT_DOCUMENT.DOCUMENTS" | translate }} +
@@ -136,12 +143,18 @@
Patient Documents
-
+
+ + + + + - -
- Not Implemented -
diff --git a/client/src/partials/patients/record/patient_record.js b/client/src/partials/patients/record/patient_record.js index 87aa97900f..bedb2e0abe 100644 --- a/client/src/partials/patients/record/patient_record.js +++ b/client/src/partials/patients/record/patient_record.js @@ -6,20 +6,21 @@ PatientRecordController.$inject = ['$stateParams', 'PatientService', 'NotifyServ function PatientRecordController($stateParams, Patients, Notify, moment) { var vm = this; var patientID = $stateParams.patientID; - + vm.loading = true; /** @fixme if no uuid is provided this will download all the patients through the base url '/' */ Patients.read(patientID) .then(function (result) { vm.patient = result; vm.loading = false; - + /** @todo move to service or mysql query */ vm.patient.name = [vm.patient.first_name, vm.patient.middle_name, vm.patient.last_name].join(' '); vm.patient.age = moment().diff(vm.patient.dob, 'years'); }) - .catch(function (error) { - vm.loading = false; + .catch(function (error) { + vm.loading = false; Notify.handleError(error); - }) + }); + } diff --git a/client/src/partials/templates/bhFindDocument.tmpl.html b/client/src/partials/templates/bhFindDocument.tmpl.html new file mode 100644 index 0000000000..efcbd74780 --- /dev/null +++ b/client/src/partials/templates/bhFindDocument.tmpl.html @@ -0,0 +1,179 @@ +
+ + +
+ {{ $ctrl.session.patient.reference }} / + {{ $ctrl.session.patient.first_name + ' ' + $ctrl.session.patient.last_name + ' ' + $ctrl.session.patient.middle_name }} +
+ + + + + +
+ + +
+
+ {{ $ctrl.session.patient.reference }} / + {{ $ctrl.session.patient.first_name + ' ' + $ctrl.session.patient.last_name + ' ' + $ctrl.session.patient.middle_name }} + ({{ $ctrl.session.patientDocuments.length }}) +
+ +
+ + + + + +
+
+ + + + +
+
    +
  • + + + +
    + + + + + +

    {{ doc.label }}

    + +
    + + {{ $ctrl.mimeIcon(doc.mimetype).label }} (~{{ doc.size | bytes }}) +
    + + + {{ doc.timestamp | date }}, {{ 'FORM.LABELS.BY' | translate }} + {{ doc.first + ' ' + doc.last }} + +
    + + + + + + + +
    +
    +
  • +
+
+ + +
+
+
+
+ + +
+
+
+ + + + + +

{{ doc.label }}

+ +
+ + {{ $ctrl.mimeIcon(doc.mimetype).label }} (~{{ doc.size | bytes }}) +
+ + + {{ doc.timestamp | date }}, {{ 'FORM.LABELS.BY' | translate }} + {{ doc.first + ' ' + doc.last }} +
+
+ + + + + + + +
+
+
+
+ + +
+ {{ 'PATIENT_DOCUMENT.NO_DOCUMENT' | translate }} +
+ +
+ +
diff --git a/server/controllers/medical/patients/documents.js b/server/controllers/medical/patients/documents.js index 5045e76498..a02a43d2a6 100644 --- a/server/controllers/medical/patients/documents.js +++ b/server/controllers/medical/patients/documents.js @@ -50,7 +50,7 @@ function create(req, res, next) { } const sql = - 'INSERT INTO patient_document (uuid, patient_uuid, label, link) VALUES ?;'; + 'INSERT INTO patient_document (uuid, patient_uuid, label, link, mimetype, size, user_id) VALUES ?;'; // make sure the records are properly formatted let records = req.files.map(file => { @@ -58,7 +58,10 @@ function create(req, res, next) { db.bid(file.filename), db.bid(req.params.uuid), file.originalname, - file.link + file.link, + file.mimetype, + file.size, + req.session.user.id ]; }); @@ -87,7 +90,9 @@ function list(req, res, next) { const dir = process.env.UPLOAD_DIR; let sql = ` - SELECT BUID(uuid) AS uuid, label, link FROM patient_document + SELECT BUID(d.uuid) AS uuid, d.label, d.link, d.timestamp, d.mimetype, d.size, + u.id AS user_id, u.first, u.last + FROM patient_document d JOIN user u ON u.id = d.user_id WHERE patient_uuid = ?; `; diff --git a/server/models/schema.sql b/server/models/schema.sql index a1343ab116..bac7bd086f 100644 --- a/server/models/schema.sql +++ b/server/models/schema.sql @@ -1217,8 +1217,12 @@ CREATE TABLE `patient_document` ( `label` TEXT NOT NULL, `link` TEXT NOT NULL, `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + `mimetype` TEXT NOT NULL, + `size` INTEGER unsigned NOT NULL, + `user_id` SMALLINT(5) unsigned NOT NULL, KEY `patient_uuid` (`patient_uuid`), - FOREIGN KEY (`patient_uuid`) REFERENCES `patient` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE + FOREIGN KEY (`patient_uuid`) REFERENCES `patient` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE, + FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `patient_group`; diff --git a/server/models/test/data.sql b/server/models/test/data.sql index 46507064a9..0f1011e2e4 100644 --- a/server/models/test/data.sql +++ b/server/models/test/data.sql @@ -39,7 +39,7 @@ INSERT INTO unit VALUES (112, 'Reference','TREE.REFERENCE','References',30,'/partials/references','/references'), (134, 'Simple Journal Vouchers', 'TREE.SIMPLE_VOUCHER', 'Creates a simple transfer slip between two accounts', 30, '/partials/vouchers/simple', '/vouchers/simple'), (135, 'Billing Services', 'TREE.BILLING_SERVICES', 'Configures billing services for bhima', 1, '/partials/billing_services', '/admin/billing_services'), - (136, 'Patient Documents', 'TREE.PATIENT_DOCUMENT', 'Patient Document Module', 12, '/partials/patients/documents', '/patients/documents'), + -- (136, 'Patient Documents', 'TREE.PATIENT_DOCUMENT', 'Patient Document Module', 12, '/partials/patients/documents', '/patients/documents'), (137, 'complex Journal Vouchers', 'TREE.COMPLEX_JOURNAL_VOUCHER', 'Complex Journal vouchers module', 30, '/partials/vouchers/complex', '/vouchers/complex'); INSERT INTO `account_type` VALUES (1,'income/expense'),(2,'balance'); @@ -200,7 +200,7 @@ INSERT INTO permission (unit_id, user_id) VALUES (29, 1), -- Patient documents -(136, 1), +-- (136, 1), -- complex Journal Vouchers (137, 1); diff --git a/server/test/api/patientDocuments.js b/server/test/api/patientDocuments.js index 46f87560b0..de3765bbb4 100644 --- a/server/test/api/patientDocuments.js +++ b/server/test/api/patientDocuments.js @@ -65,7 +65,7 @@ describe('(patients/:uuid/documents) Patient Documents', () => { return agent.get(`/patients/${patientUuid}/documents`) .then(function (res) { helpers.api.listed(res, 4); - expect(res.body[0]).to.have.keys('uuid', 'label', 'link'); + expect(res.body[0]).to.have.keys('uuid', 'label', 'link', 'timestamp', 'mimetype', 'size', 'user_id', 'first', 'last'); }) .catch(helpers.api.handler); }); From 7fedfdb00c5db41a215b12e4c521e376a427a9ba Mon Sep 17 00:00:00 2001 From: Bruce Mbayo Date: Mon, 30 May 2016 14:22:40 -0700 Subject: [PATCH 2/2] Fix e2e test faillure --- client/test/e2e/patient/record.spec.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/client/test/e2e/patient/record.spec.js b/client/test/e2e/patient/record.spec.js index 638a5b2d69..489633ba96 100644 --- a/client/test/e2e/patient/record.spec.js +++ b/client/test/e2e/patient/record.spec.js @@ -14,7 +14,7 @@ describe('Patient Record', function () { const patient = { name : 'Test Patient 2', - id : 'TPA TPA1', + id : 'TPA1', hospital_no : '110', age : '25', gender : 'M' @@ -39,4 +39,3 @@ describe('Patient Record', function () { }); }); -