Esempio n. 1
0
 $user = getUsername($userId);
 $acl_allow = acl_check('patients', 'med', $user);
 if ($acl_allow) {
     $provider_username = getProviderUsername($provider_id);
     $strQuery = "UPDATE `prescriptions` set\n                                        provider_id = " . add_escape_custom($provider_id) . ", \n                                        start_date = '" . add_escape_custom($startDate) . "',\n                                        form = '" . add_escape_custom($drug_form) . "',\n                                        drug = '" . add_escape_custom($drug) . "', \n                                        dosage = '" . add_escape_custom($dosage) . "', \n                                        unit = '" . add_escape_custom($drug_units) . "', \n                                        route = '" . add_escape_custom($drug_route) . "', \n                                        `interval` = '" . add_escape_custom($drug_interval) . "', \n                                        substitute = '" . add_escape_custom($substitute) . "',\n                                        quantity = '" . add_escape_custom($quantity) . "',  \n                                        refills = '" . add_escape_custom($per_refill) . "', \n                                        medication = '" . add_escape_custom($medication) . "',\n                                        date_modified = '" . date('Y-m-d') . "',\n                                        size = '" . add_escape_custom($size) . "', \n                                        per_refill = '" . add_escape_custom($p_refill) . "',\n                                        note = '" . add_escape_custom($note) . "'\n                             WHERE id = ?";
     $result = sqlStatement($strQuery, array($id));
     $list_result = 1;
     if ($medication) {
         $select_medication = "SELECT * FROM  `lists` \n                                    WHERE  `type` LIKE  'medication'\n                                            AND  `title` LIKE  ? \n                                            AND  `pid` = ?";
         $result1 = sqlQuery($select_medication, array($drug, $patient_id));
         if (!$result1) {
             $list_query = "insert into lists(date,begdate,type,activity,pid,user,groupname,title) \n                            values (now(),cast(now() as date),'medication',1," . add_escape_custom($patientId) . ",'" . add_escape_custom($user) . "','','" . add_escape_custom($drug) . "')";
             $list_result = sqlStatement($list_query);
         }
     }
     $device_token_badge = getDeviceTokenBadge($provider_username, 'prescription');
     $badge = $device_token_badge['badge'];
     $deviceToken = $device_token_badge['device_token'];
     if ($deviceToken) {
         $notification_res = notification($deviceToken, $badge, $msg_count = 0, $apt_count = 0, $message = 'Update Prescription Notification!');
     }
     if ($result !== FALSE && $list_result !== FALSE) {
         $xml_string .= "<status>0</status>";
         $xml_string .= "<reason>The Patient prescription has been updated</reason>";
         if ($notification_res) {
             $xml_array['notification'] = 'Update Appointment Notification(' . $notification_res . ')';
         } else {
             $xml_array['notification'] = 'Notificaiotn Failed.';
         }
     } else {
         $xml_string .= "<status>-1</status>";
 $type = "file_url";
 $size = '';
 $date = date('Y-m-d H:i:s');
 $url = '';
 $hash = '';
 $image_path = $sitesDir . "{$site}/documents/{$patient_id}";
 if (!file_exists($image_path)) {
     mkdir($image_path);
 }
 $image_date = date('YmdHis');
 $image_root_path = $image_path . "/" . $image_date . "." . $ext;
 file_put_contents($image_root_path, $image_content);
 $res = addNewDocument($image_date . "." . $ext, 'image/png', $image_root_path, 0, filesize($image_root_path), $userId, $patient_id, $cat_id, $higher_level_path = '', $path_depth = '1');
 $lab_report_catid = document_category_to_id("Lab Report");
 if ($cat_id == $lab_report_catid) {
     $device_token_badge = getDeviceTokenBadge($provider_username, 'labreport');
     $badge = $device_token_badge['badge'];
     $deviceToken = $device_token_badge['device_token'];
     if ($deviceToken) {
         $notification_res = notification($deviceToken, $badge, $msg_count = 0, $apt_count = 0, $message = 'New Labreport Notification!');
     }
 }
 if ($res) {
     $xml_array['status'] = "0";
     $xml_array['reason'] = "Document added successfully";
     if ($notification_res) {
         $xml_array['notification'] = 'Add Patient document Notification(' . $notification_res . ')';
     } else {
         $xml_array['notification'] = 'Notificaiotn Failed.';
     }
 } else {
Esempio n. 3
0
$patientId = $_POST['patientId'];
$admin_id = $_POST['uprovider_id'];
$facility = $_POST['pc_facility'];
$pc_billing_location = $_POST['pc_billing_location'];
$pc_duration = $_POST['pc_duration'];
$app_status = $app_status == 'p' ? '+' : $app_status;
$endTime = date('H:i:s', strtotime($_POST['appointmentTime']) + $pc_duration);
if ($userId = validateToken($token)) {
    $user = getUsername($userId);
    $username = $user;
    $provider_username = getProviderUsername($admin_id);
    $acl_allow = acl_check('patients', 'appt', $username);
    if ($acl_allow) {
        $strQuery = "UPDATE openemr_postcalendar_events SET \n                        pc_title = '" . add_escape_custom($pc_title) . "', \n                        pc_hometext = '" . add_escape_custom($pc_hometext) . "' , \n                        pc_catid = '" . add_escape_custom($pc_catid) . "' , \n                        pc_eventDate = '" . add_escape_custom($appointmentDate) . "', \n                        pc_startTime = '" . add_escape_custom($appointmentTime) . "', \n                        pc_endTime = '" . add_escape_custom($endTime) . "', \n                        pc_aid = '" . add_escape_custom($admin_id) . "', \n                        pc_facility = '" . add_escape_custom($facility) . "',\n                        pc_billing_location = '" . add_escape_custom($pc_billing_location) . "',\n                        pc_duration = '" . add_escape_custom($pc_duration) . "',\n                        pc_pid = '" . add_escape_custom($patientId) . "',\n                        pc_apptstatus = '" . add_escape_custom($app_status) . "' \n                    WHERE pc_eid=?";
        $result = sqlStatement($strQuery, array($appointmentId));
        $device_token_badge = getDeviceTokenBadge($provider_username, 'appointment');
        $badge = $device_token_badge['badge'];
        $deviceToken = $device_token_badge['device_token'];
        if ($deviceToken) {
            $notification_res = notification($deviceToken, $badge, $msg_count = 0, $apt_count = 0, $message = 'Appointment Updated!');
        }
        if ($result !== FALSE) {
            $xml_array['status'] = 0;
            $xml_array['reason'] = 'The Appointment has been updated.';
            if ($notification_res) {
                $xml_array['notification'] = 'Update Appointment Notification(' . $notification_res . ')';
            } else {
                $xml_array['notification'] = 'Notificaiotn Failed.';
            }
        } else {
            $xml_array['status'] = -1;
Esempio n. 4
0
if ($userId = validateToken($token)) {
    $user = getUsername($userId);
    $acl_allow = acl_check('patients', 'notes', $user);
    if ($acl_allow) {
        $provider_id = $userId;
        $assigned_to_array = explode(',', $assigned_to);
        $_SESSION['authUser'] = $user;
        $_SESSION['authProvider'] = 'Default';
        foreach ($assigned_to_array as $assignee) {
            if ($message_status == 'Done' && !empty($message_id)) {
                updatePnoteMessageStatus($message_id, $message_status);
                $result = 1;
                break;
            } else {
                $result = addPnote($patientId, $newtext, $authorized, $activity, $title, $assignee, $datetime = '', $message_status);
                $device_token_badge = getDeviceTokenBadge($assignee, 'message');
                $badge = $device_token_badge['badge'];
                $deviceToken = $device_token_badge['device_token'];
                if ($deviceToken) {
                    $notification_res = notification($deviceToken, $badge, $msg_count = 0, $apt_count = 0, $message = 'New Message Notification!');
                }
            }
        }
        if ($result) {
            $xml_string .= "<status>0</status>";
            $xml_string .= "<reason>Message send successfully</reason>";
            if ($notification_res) {
                $xml_string .= "<notification>Notification({$notification_res}) Sent.</notification>";
            } else {
                $xml_string .= "<notification>Notification Failed.</notification>";
            }