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'});
} if (isset($_REQUEST['pid'])) { $req_pid = $_REQUEST['pid']; } if (isset($_REQUEST['encounter'])) { $req_encounter = $_REQUEST['encounter']; } if (isset($_REQUEST['task'])) { $task = $_REQUEST['task']; } if (isset($_REQUEST['billing_id'])) { $billing_id = $_REQUEST['billing_id']; } if ($task == 'retrieve') { $retval = array(); $patient = issue_diagnoses($req_pid, $req_encounter); $common = common_diagnoses(); $retval['patient'] = $patient; $retval['common'] = $common; $fee_sheet_diags = array(); $fee_sheet_procs = array(); fee_sheet_items($req_pid, $req_encounter, $fee_sheet_diags, $fee_sheet_procs); $retval['current'] = $fee_sheet_diags; echo json_encode($retval); return; } if ($task == 'update') { $skip_issues = false; if (isset($_REQUEST['skip_issues'])) { $skip_issues = $_REQUEST['skip_issues'] == 'true'; }