forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fee_sheet_ajax.php
111 lines (107 loc) · 3.13 KB
/
fee_sheet_ajax.php
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
<?php
/**
* Controller for fee sheet related AJAX requests
*
* Copyright (C) 2013 Kevin Yeh <[email protected]> and OEMR <www.oemr.org>
*
* 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 3
* 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, see <http:https://opensource.org/licenses/gpl-license.php>;.
*
* @package OpenEMR
* @author Kevin Yeh <[email protected]>
* @link http:https://www.open-emr.org
*/
$fake_register_globals=false;
$sanitize_all_escapes=true;
require_once("../../../globals.php");
require_once("fee_sheet_queries.php");
if(!acl_check('acct', 'bill'))
{
header("HTTP/1.0 403 Forbidden");
echo "Not authorized for billing";
return false;
}
if(isset($_REQUEST['pid']))
{
$req_pid=$_REQUEST['pid'];
}
if(isset($_REQUEST['encounter']))
{
$req_encounter=$_REQUEST['encounter'];
}
if(isset($_REQUEST['task']))
{
$task=$_REQUEST['task'];
}
if($task=='retrieve')
{
$retval=array();
if($_REQUEST['mode']=='encounters')
{
$encounters=select_encounters($req_pid,$req_encounter);
if(isset($_REQUEST['prev_encounter']))
{
$prev_enc=$_REQUEST['prev_encounter'];
}
else
{
if(count($encounters)>0)
{
$prev_enc=$encounters[0]->getID();
}
}
$issues=array();
$procedures=array();
fee_sheet_items($req_pid,$prev_enc,$issues,$procedures);
$retval['prev_encounter']=$prev_enc;
$retval['encounters']=$encounters;
$retval['procedures']=$procedures;
}
if($_REQUEST['mode']=='issues')
{
$issues=issue_diagnoses($req_pid,$req_encounter);
}
if($_REQUEST['mode']=='common')
{
$issues=common_diagnoses();
}
$retval['issues']=$issues;
echo json_encode($retval);
return;
}
if($task=='add_diags')
{
if(isset($_REQUEST['diags']))
{
$json_diags=json_decode($_REQUEST['diags']);
}
$diags=array();
foreach($json_diags as $diag)
{
$diags[]=new code_info($diag->{'code'},$diag->{'code_type'},$diag->{'description'});
}
$procs=array();
if(isset($_REQUEST['procs']))
{
$json_procs=json_decode($_REQUEST['procs']);
}
foreach($json_procs as $proc)
{
$procs[]=new procedure($proc->{'code'},$proc->{'code_type'},$proc->{'description'},$proc->{'fee'},$proc->{'justify'},$proc->{'modifiers'},$proc->{'units'},0);
}
$database->StartTrans();
create_diags($req_pid,$req_encounter,$diags);
update_issues($req_pid,$req_encounter,$diags);
create_procs($req_pid,$req_encounter,$procs);
$database->CompleteTrans();
return;
}
?>