-
Notifications
You must be signed in to change notification settings - Fork 23
/
inbox.js
202 lines (168 loc) · 6.18 KB
/
inbox.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/*
Copyright (c) 2001-2002. Department of Family Medicine, McMaster University. All Rights Reserved.
This software is published under the GPL GNU General Public License.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
This software was written for the
Department of Family Medicine
McMaster University
Hamilton
Ontario, Canada
*/
function popupPage(vheight,vwidth,varpage) { //open a new popup window
var page = "" + varpage;
windowprops = "height="+vheight+",width="+vwidth+",location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes,screenX=0,screenY=0,top=0,left=0";//360,680
var popup=window.open(page, "groupno", windowprops);
if (popup != null) {
if (popup.opener == null) {
popup.opener = self;
}
popup.focus();
}
}
function openPatient(demographicNo) {
popupPage(700,1200,'../demographic/demographiccontrol.jsp?demographic_no='+demographicNo+'&displaymode=edit&dboperation=search_detail');
}
function openReport(id) {
popupPage(700,1200,'Display.do?id='+id+'&duplicateLabIds=');
}
$(document).ready( function() {
getHrmStatus();
setInterval(function(){
getHrmStatus();
}, 5000);
// table sorting
$('#libraryTable').DataTable({
serverSide : true,
ajax : {
"url" : "../hospitalReportManager/hrm.do",
"data": function ( d ) {
d.providerNo = $("#providerNo").val();
d.providerUnmatched = $("#providerUnmatched").is(":checked");
d.noSignOff = $("#noSignOff").is(":checked");
d.demographicUnmatched = $("#demographicUnmatched").is(":checked");
}
},
searching: false,
"dom": '<"top"i>rt<"bottom"lp><"clear">',
"columns": [
{render: function(data, type, full, meta) {
var r = "<a href='javascript:void(0)' onClick=\"openReport("+full.id+");return false;\" ><img src='../images/details2.gif' border='0'/></a>";
return r;
}
},
{ "data": "recipient_name" , render: function(data,type,full,meta){
if(full.provider_no != null && full.provider_no.length>0) {
return "<a href='javascript:void(0)' title='This recipient has been linked to a provider record'>"+full.recipient_name+"</a>";
} else {
return full.recipient_name;
}
}},
{ "data": "patient_name", render: function(data, type, full, meta) {
var r = data;
if(full.demographic_no != null && full.demographic_no.length>0) {
r = '<a href="javascript:void(0);" onClick="openPatient('+full.demographic_no+');return false;">'+data+'</a>';
}
return r;
}},
{ "data": "patient_dob" , "visible" : false},
{ "data": "patient_hcn", "visible" : false },
{ "data": "patient_gender", "visible" : false },
{ "data": "report_date" },
{ "data": "received_date" },
{ "data": "sending_facility" },
{ "data": "class_subclass" },
{ "data": "category" , "visible" : false},
{ "data": "description"}
],
"order":[[6,"desc"]]
});
$("#uploadHRM").on('click',function(){
$("#uploadHRMDialog").modal();
});
$("#providerUnmatched").on('change',function(){
updateProviderFilter();
});
$("#providerNo").on('change',function(){
updateProviderFilter();
});
$("#noSignOff").on('change',function(){
reloadTable();
});
$("#demographicUnmatched").on('change',function(){
reloadTable();
});
$("#showAddlPatientInfo").on('change',function(){
$("#libraryTable").DataTable().column(3).visible($(this).is(":checked"));
$("#libraryTable").DataTable().column(4).visible($(this).is(":checked"));
$("#libraryTable").DataTable().column(5).visible($(this).is(":checked"));
});
$("#showCategoryInfo").on('change',function(){
$("#libraryTable").DataTable().column(10).visible($(this).is(":checked"));
});
$('#hrm_file').fileupload({
dataType: 'json',
done: function (e, data) {
$("#uploadHRMDialog").modal('hide');
$("#libraryTable").DataTable().ajax.reload();
}, fail: function(e,data) {
alert('Error uploading file. See log for more information');
}
});
});
function updateProviderFilter() {
var providerNoVal = $("#providerNo").val();
var providerUnmatchedVal = $("#providerUnmatched").is(':checked');
if(providerUnmatchedVal) {
$("#providerNo").prop('disabled',true);
$("#noSignOff").prop('checked',false);
$("#noSignOff").prop('disabled',true);
} else {
$("#providerNo").prop('disabled',false);
$("#noSignOff").prop('disabled',false);
$("#noSignOff").prop('checked',true);
}
$("#libraryTable").DataTable().ajax.reload();
//alert(providerNoVal + "\n" + providerUnmatchedVal);
}
function reloadTable() {
$("#libraryTable").DataTable().ajax.reload();
}
function fetchNewData() {
$.ajax({
type:"GET",
url:'../hospitalReportManager/hrm.do?method=fetch',
dataType:'json',
async:true,
success:function(data) {
if(data && data.error) {
alert('An error occured. Please check the HRM log for more information\n' + data.error);
}
$("#libraryTable").DataTable().ajax.reload();
}
});
}
function getHrmStatus() {
$.ajax({
type:"GET",
url:'../hospitalReportManager/hrm.do?method=getHrmStatus',
dataType:'json',
async:true,
success:function(data) {
if(data.running != null && data.running == true) {
$("#hrm_status").html("Fetching data from HRM");
} else {
$("#hrm_status").html("Idle");
}
}
});
}