Skip to content

Commit

Permalink
Automated Push
Browse files Browse the repository at this point in the history
  • Loading branch information
Samshal committed Aug 21, 2017
1 parent 9f2751d commit bf32ceb
Show file tree
Hide file tree
Showing 28 changed files with 894 additions and 29 deletions.
18 changes: 15 additions & 3 deletions assets/angular/core/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,19 @@ angular.module("EmmetBlue")
services.serverRequest = function(url, requestType, data={}){
var deferred = $q.defer();

return $http({
var _req = {
"url":services.restServer+url,
"method":requestType,
"data":data
}).then(function(result){
}

if (typeof $cookies.getObject(CONSTANTS.USER_COOKIE_IDENTIFIER) !== "undefined"){
_req.headers = {
"Authorization":$cookies.getObject(CONSTANTS.USER_COOKIE_IDENTIFIER).token
}
}

return $http(_req).then(function(result){
deferred.resolve(result.data.contentData);
return deferred.promise;
}, function(result){
Expand Down Expand Up @@ -166,13 +174,17 @@ angular.module("EmmetBlue")
case 500:
case 501:
case 400:{
services.notify('Unable To Process Request', 'This is usually due to making request for a missing resource or sending improperly formatted data to the server. Please contact an administrator if this error persists. Error Code: AB0'+errorObject.status, "error");
services.notify('Unable To Process Request', 'This is usually due to making request for a missing resource or sending improperly formatted data to the server. Please contact an administrator if this error persists. Error Code: AB0'+errorObject.status+' Server Message: '+errorObject.data.errorMessage, "error");
break;
}
case 503:{
services.notify('The Server Refused To Process Your Request', 'This is usally due to the creation of duplicate data. This resource does not allow you to create data of the same exact type, please contact an administrator if this error persists. Error Code: AB0'+errorObject.status, 'warning');
break;
}
case 401:{
console.log("Request Denied");
break;
}
default:
{
if (typeof errorObject.data != "undefined" && errorObject.data != null){
Expand Down
Binary file added assets/images/giltooe/logo-black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/giltooe/logo-orange-full.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/giltooe/logo-orange-small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/giltooe/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function getConstants(){
var server = "https://emmetblue.org.ng:700/";
var client = {
short_name: "Harmony Hospital",
name: "Harmony Hospital & Specialists Clinic",
name: "Harmony Hospital and Specialists Clinic",
_style:{
accounts:{
billing:{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,28 @@ angular.module("EmmetBlue")

$("#accept_new_payment").modal("hide");
$("#payment_receipt").modal("show");

var form = $("#main_payment_receipt").get(0);
domtoimage.toPng(form)
.then(function (dataUrl) {
var img = new Image();

var req = utils.serverRequest("/emmetblue-cloud/receipt/upload", "POST", {
patient: $scope.receiptData.invoiceData.patient,
description: "Invoice No.: #"+$scope.receiptData.transactionId,
staff: utils.userSession.getID(),
receipt: dataUrl
});

req.then(function(response){

}, function(error){

});
})
.catch(function (error) {
console.error('oops, something went wrong!', error);
});
}

$scope.loadInvoice = function(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ angular.module("EmmetBlue")
utils.DT.columnBuilder.newColumn('GeneralJournalTotalAmount').withTitle("Amount (<ng-currency currency-symbol='naira'></ng-currency>)"),
utils.DT.columnBuilder.newColumn(null).withTitle('').renderWith(function(data, full, meta){
var viewButtonAction = "manageJournal('view', "+data.GeneralJournalID+")";
var delButtonAction = "manageJournal('delete', "+data.GeneralJournalID+")";
var begBalButtonAction = "manageJournal('beginningBalances', "+data.GeneralJournalID+")";
var viewMetadataButtonAction = "manageJournal('viewmetadata', "+data.GeneralJournalID+")";

Expand All @@ -109,6 +110,7 @@ angular.module("EmmetBlue")
" <li><a href='#' class='account-btn' ng-click=\""+viewButtonAction+"\" "+dataOpt+"><i class='icon-file-eye'></i> View</a></li>"+
" <li><a href='#' class='account-btn text-danger' ng-click=\""+begBalButtonAction+"\" "+dataOpt+"><i class='icon-pencil7'></i> <strike>Adjust Entry</strike></a></li>"+
" <li class='divider'></li>"+
" <li><a href='#' class='account-btn text-danger' ng-click=\""+delButtonAction+"\" "+dataOpt+"><i class='fa fa-times'></i> Delete</a></li>"+
" <li><a href='#' class='account-btn' ng-click=\""+viewMetadataButtonAction+"\" "+dataOpt+"><i class='icon-database-diff'></i> View Metadata</a></li>"+
"</ul>"+
"</div>";
Expand Down Expand Up @@ -208,6 +210,27 @@ angular.module("EmmetBlue")
$("#view-current-journal-metadata").modal("show");
break;
}
case "delete":{
var title = "Please Confirm";
var text = "Do you really want to delete this transaction. Please note that you have to manually balance any affected account(s)"
var close = true;
var type = "warning";
var btnText = "Yes, please continue";

var process = function(){
var req = utils.serverRequest("/financial-accounts/general-journal/delete?resourceId="+id, "DELETE");

req.then(function(response){
utils.notify("Operation successful", "The selected transaction has been deleted successfully", "success");
$scope.reloadTable();
}, function(error){
utils.errorHandler(error);
})
}

utils.confirm(title, text, close, process, type, btnText);
break;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ angular.module("EmmetBlue")
}
}

$scope.$on("prepareNewAdmission", function(e, data){
var uuid = data;
$("#patientNumber").val(uuid);
$scope.loadInfo();
});

var showBigSpace = function(){
$(".bigSpace").addClass("col-md-8").removeClass("col-md-12");
$scope.showInfo = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ angular.module("EmmetBlue")
templateUrl: "plugins/consultancy/assets/includes/lab-request-form-template.html",
controller: function($scope, utils, $rootScope){
$scope.showSubmitLoader = false;
$scope.investigationLists = {};
$scope.today = utils.today()+ " " + (new Date()).toLocaleTimeString();

var table = $(".lab-table tr");
Expand All @@ -34,6 +35,7 @@ angular.module("EmmetBlue")
loadRegisteredInvestigationTypes: function(lab){
utils.serverRequest('/lab/investigation-type/view-by-lab?resourceId='+lab, 'GET').then(function(response){
$scope.module.registeredInvestigationTypes = response;
$scope.investigationLists = {};
}, function(error){
utils.errorHandler(error);
})
Expand All @@ -45,6 +47,85 @@ angular.module("EmmetBlue")
$scope.module.loadRegisteredInvestigationTypes(nv);
})

var showLabForwarder = function(response){
console.log(response, $scope.investigationLists, $scope.module.lab);
$scope.pushToLab = {
investigations: []
};
if ($scope.investigationLists.length !== 0){
$scope.requestId = response.lastInsertId;
$("#labForwarderModal").modal("show");
var req = utils.serverRequest("/patients/patient/view/"+$scope.patientInfo.patientid, "GET");
req.then(function(response){
$scope.pushToLab.gender = response["_source"].gender;
$scope.pushToLab.picture = response["_source"].patientpicture;
$scope.pushToLab.phoneNumber = response["_source"]["phone number"];
$scope.pushToLab.firstName = response["_source"]["first name"];
$scope.pushToLab.lastName = response["_source"]["last name"];
$scope.pushToLab.address = response["_source"]["home address"];
$scope.pushToLab.dateOfBirth = response["_source"]["date of birth"];


var req = utils.serverRequest("/lab/lab-request/view/"+$scope.requestId, "GET");
req.then(function(response){
$scope.pushToLab.clinicalDiagnosis = response.ClinicalDiagnosis;
$scope.pushToLab.dateRequested = response.RequestDate;
$scope.pushToLab.investigationRequired = response.InvestigationRequired;
$scope.pushToLab.request = response.RequestID;
$scope.pushToLab.requestedBy = response.RequestedBy;
$scope.pushToLab.patientID = response.PatientID;

angular.forEach($scope.investigationLists, function(value, key){
if (value){
var req = utils.serverRequest("/lab/investigation-type/view/"+key, "GET");
req.then(function(response){
response = response[0];
$scope.pushToLab.investigations.push({
iName: response.InvestigationTypeName,
investigation: response.InvestigationTypeID,
lName: response.LabName,
lab: response.LabID
});
}, function(error){
utils.errorHandler(error);
})
}
});
}, function(error){
utils.errorHandler(error);
});

}, function(error){
utils.errorHandler(error);
})
}
}

$scope.forwardPushToLab = function(){
var req = utils.serverRequest("/lab/patient/new", "POST", $scope.pushToLab);
req.then(function(response){
if (response){
utils.notify("Operation successful", "This patient can go to the lab", "success");
$("#labForwarderModal").modal("hide");
utils.serverRequest("/lab/lab-request/close-request", "POST", {"request": $scope.pushToLab.request, "staff": utils.userSession.getID()})
.then(function(response){
$rootScope.$broadcast("ReloadQueue");
utils.serverRequest("/lab/lab-request/close-request", "POST", {"request": $scope.pushToLab.request, "staff": utils.userSession.getID()})
.then(function(response){
$rootScope.$broadcast("ReloadQueue");
$rootScope.$broadcast("reloadLabPatients", {});
}, function(error){
utils.errorHandler(error);
});
}, function(error){
utils.errorHandler(error);
});
}
}, function(error){
utils.errorHandler(error);
});
}

$scope.submit = function(){
$scope.showSubmitLoader = true;
var reqs = [];
Expand Down Expand Up @@ -109,6 +190,7 @@ angular.module("EmmetBlue")
utils.notify("Operation Successful", "Request sent successfully", "success");
$scope.investigations = "";
reqs = [];
showLabForwarder(response);
}, function(error){
utils.errorHandler(error);
})
Expand Down
35 changes: 32 additions & 3 deletions plugins/consultancy/assets/controllers/new-diagnosis-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ angular.module("EmmetBlue")
$scope.patient.isProfileReady = true;
modules.allergies.loadPatientAllergies($scope.patient.profile.patientid);
utils.notify("Profile loaded successfully", "", "info");
modules.globals.loadSavedDiagnosis();
modules.globals.loadAllSavedDiagnosis();
$scope.patient.history.displayPage='profile';

if (typeof $scope.patient.profile.auditflags !== "undefined" && $scope.patient.profile.auditflags.length > 0){
Expand Down Expand Up @@ -612,9 +612,27 @@ angular.module("EmmetBlue")

utils.serverRequest("/patients/patient-diagnosis/new", "POST", data).then(successCallback, errorCallback);
},
loadSavedDiagnosis: function(){
loadAllSavedDiagnosis: function(){
var patient = $scope.patient.profile.patientid;
var consultant = utils.userSession.getID();
var errorCallback = function(error){
utils.errorHandler(error);
}
utils.serverRequest("/consultancy/saved-diagnosis/view-all-saved-diagnosis?resourceId="+patient, "GET").then(function(response){
if (response.length == 0){
//continue;
}
else if (response.length == 1 && response[0].Consultant == utils.userSession.getID()){
modules.globals.loadSavedDiagnosis();
}
else {
$scope.allSavedDiagnoses = response;
$("#show-saved-diag-selector").modal("show");
}
}, errorCallback);
},
loadSavedDiagnosis: function(patient=0, consultant=0){
var patient = (patient == 0) ? $scope.patient.profile.patientid : patient;
var consultant = (consultant == 0) ? utils.userSession.getID() : consultant;

var successCallback = function(response){
if (response.length > 0){
Expand Down Expand Up @@ -925,4 +943,15 @@ angular.module("EmmetBlue")
$scope.$watch(function(){ return $scope.conclusion.diagnosis.title; }, function(nv, ov){
$rootScope.$broadcast("currentDiagnosis", nv);
})

$scope.loadSavedDiagnosis = function(patient, consultant){
$("#show-saved-diag-selector").modal("hide");
modules.globals.loadSavedDiagnosis(patient, consultant);
}

$scope.admit = function(){
var patient = $scope.patient.profile.patientuuid;
$rootScope.$broadcast("prepareNewAdmission", patient);
$("#_patient-admission-form").modal("show");
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ angular.module("EmmetBlue")
},
addPrescriptionToList: function(item, duration = ""){
if (item !== ""){
utils.serverRequest("/pharmacy/pharmacy-request/smartify?prescription="+item, "GET").then(function(response){
utils.serverRequest("/pharmacy/pharmacy-request/smartify", "POST", {prescription: item}).then(function(response){
if (!response.valid){
utils.notify("Last entered prescription is not smart", "Reason: "+response.reason, "info");
$scope.isSmart = false;
Expand Down Expand Up @@ -186,6 +186,7 @@ angular.module("EmmetBlue")
},
catchSearchDrugEnterPress: function(e){
if (e.which == 13){
e.preventDefault();
modules.conclusion.searchDrug();
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ <h4 class="text-center"><u>LABORATORY/IMAGING INVESTIGATION REQUEST</u></h4>
<div class="col-md-12">
<div class="form-group col-md-4" ng-repeat="type in module.registeredInvestigationTypes">
<label class="checkbox-inline text-semibold">
<input type="checkbox" style="width: 20px; height: 20px" class="invCheck">
<input type="checkbox" style="width: 20px; height: 20px" class="invCheck" ng-model="investigationLists[type.InvestigationTypeID]">
{{type.InvestigationTypeName}}
</label>
</div>
Expand All @@ -792,4 +792,42 @@ <h4 class="text-center"><u>LABORATORY/IMAGING INVESTIGATION REQUEST</u></h4>

<div class="row">
<button type="button" class="pull-right btn btn-primary" ng-click="submit()"><i class="fa fa-spinner fa-pulse fa-spin" ng-show="showSubmitLoader"></i> Send to lab</button>
</div>

<div class="modal fade" id="labForwarderModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-info">
<h6 class="modal-title">Forward Request The Lab</h6>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<h1 class="text-center"><u>{{patientInfo.patienttypename}}, {{patientInfo.categoryname}}</u></h1>
<div class="table-responsive">
<table class="table table-hover table-condensed table-bordered">
<thead class="active">
<th>S/N</th>
<th>Investigation</th>
<th>Lab</th>
</thead>
<tbody>
<tr ng-repeat="inv in pushToLab.investigations">
<td>{{$index + 1}}</td>
<td>{{inv.iName}}</td>
<td>{{inv.lName}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-warning" ng-click="forwardPushToLab()"> Forward Request</button>
<button type="button" class="btn btn-default" data-dismiss="modal"> Cancel</button>
</div>
</div>
</div>
</div>
Loading

0 comments on commit bf32ceb

Please sign in to comment.