Exemplo n.º 1
0
function create_patient(&$medics, &$errors)
{
    $alertmsg = "";
    $patient_pid = get_patientid($medics);
    $pubpid = trim($medics->pubpid);
    // ID must be valid or 'NEWPATIENT'
    if (empty($pubpid)) {
        array_push($errors, "Patient ID '{$pubpid}' missing, patient skipped! ");
        return $alertmsg;
    }
    if ($pubpid != 'NEWPATIENT') {
        // 1. validate patient
        $patient_pid = 0;
        $query = "SELECT pid FROM patient_data WHERE pubpid LIKE '{$pubpid}'";
        $res = sqlStatement($query);
        $row = sqlFetchArray($res);
        if ($row) {
            $patient_pid = $row['pid'];
            if (sqlFetchArray($res)) {
                array_push($errors, "Patient ID '{$pubpid}' is ambiguous, patient skipped! ");
                return $alertmsg;
            } else {
                // array_push( $errors, "Patient ID '$pubpid' exists, updates/new encounters only. ");
            }
        }
    }
    // 2. validate insurance provider - REMOVED
    // 3. validate billing provider
    $tmp = array();
    $tmp = fetchProviderInfo($medics);
    if (!array($tmp)) {
        array_push($errors, "Provider '{$tmp}' not found, patient skipped!");
        return $alertmsg;
    }
    $patient_provider_id = $tmp['id'];
    $patient_provider_name = $tmp['username'];
    $patient_provider_facility = $tmp['facility_id'];
    // 4. get facility from  // Move to function
    $row = sqlQuery("SELECT id, name, pos_code FROM facility WHERE id = '{$patient_provider_facility}'");
    if (!$row['id']) {
        array_push($errors, "Facility '{$tmp}' not found, patient skipped! ");
        return $alertmsg;
    }
    $patient_facility_id = $row['id'];
    $patient_facility_name = $row['name'];
    $patient_facility_pos = $row['pos_code'];
    // 5. insert patient data
    if (!$patient_pid) {
        // Insert into patient_data.
        //
        $row = sqlQuery("SELECT max(pid)+1 AS pid FROM patient_data");
        $patient_pid = $row['pid'] ? $row['pid'] : 1;
        // Combine street lines
        $patient_street = $medics->street . ' ' . $medics->street2;
        // Build array
        newPatientData('', '', form2db($medics->fname), form2db($medics->lname), form2db($medics->mname), sex($medics->sex), form2db($medics->dob), form2db($patient_street), '', '', '', form2db($medics->zip), form2db($medics->city), form2db($medics->state), '', '', '', form2db($medics->phone_home), form2db($medics->phone_alternate), '', '', '', '', '', '', '', form2db($medics->ethnicity), '', '', '', '', '', '0000-00-00 00:00:00', $patient_pid, $patient_pid, '', '', '', '', '', '', form2db($medics->hippa_notice), form2db($medics->hippa_notice), '', '', '', form2db($medics->hippa_notice), '', $dos = fixDate($medics->fromdate));
        // Insert dummy row for employer_data.
        newEmployerData($patient_pid);
        // Update or Instest subscriber ins data
        if ($medics->pubpid == 'NEWPATIENT' || !empty($medics->policy_id)) {
            newInsuranceData($patient_pid, 'primary', $insurance_company_id, form2db($medics->policy_id), '', '', form2db($medics->lname), form2db($medics->mname), form2db($medics->fname), 'self', '', fixDate($medics->dob), form2db($medics->street), form2db($medics->zip), form2db($medics->city), form2db($medics->state), '', form2db($medics->phone_home), '', '', '', '', '', '', '', sex($medics->sex), fixDate($medics->eff_date));
        }
        $tmp = $medics->lname . ',' . $medics->fname;
        $alertmsg .= "New Patient Added: '{$patient_pid}' / '{$tmp}' <br>\n";
    }
    $medics->pid = $patient_pid;
    $history = array('history_father' => form2db($medics->familyinformation->father), 'history_mother' => form2db($medics->familyinformation->mother), 'history_spouse' => form2db($medics->familyinformation->spouse), 'history_siblings' => form2db($medics->familyinformation->siblings), 'history_offspring' => form2db($medics->familyinformation->offspring), 'relatives_cancer' => form2db($medics->medical->relativesexperience->cancer), 'relatives_tuberculosis' => form2db($medics->medical->relativesexperience->tuberculosis), 'relatives_diabetes' => form2db($medics->medical->relativesexperience->diabetes), 'relatives_high_blood_pressure' => form2db($medics->medical->relativesexperience->highbloodpressure), 'relatives_heart_problems' => form2db($medics->medical->relativesexperience->heartproblems), 'relatives_stroke' => form2db($medics->medical->relativesexperience->stroke), 'relatives_epilepsy' => form2db($medics->medical->relativesexperience->epilepsy), 'relatives_mental_illness' => form2db($medics->medical->relativesexperience->mentalillness), 'relatives_suicide' => form2db($medics->medical->relativesexperience->suicide), 'usertext12' => form2db($medics->medical->relativesexperience->other), 'coffee' => form2db($medics->medical->lifestyleusage->coffee), 'tobacco' => form2db($medics->medical->lifestyleusage->tobacco), 'alcohol' => form2db($medics->medical->lifestyleusage->alcohol), 'sleep_patterns' => form2db($medics->medical->lifestyleusage->sleep), 'exercise_patterns' => form2db($medics->medical->lifestyleusage->exercise), 'seatbelt_use' => form2db($medics->medical->lifestyleusage->seatbelt), 'counseling' => form2db($medics->medical->lifestyleusage->counseling), 'hazardous_activities' => form2db($medics->medical->lifestyleusage->hazardactivities), 'usertext13' => form2db($medics->medical->lifestyleusage->urinaryincontinence), 'usertext14' => form2db($medics->medical->lifestyleusage->fallhistory), 'additional_history' => form2db($medics->medical->lifestyleusage->other) . " " . form2db($medics->medical->lifestyleusage->generalnotes));
    // Insert/Update into history_data.
    if ($medics->pubpid == 'NEWPATIENT') {
        newHistoryData($patient_pid, $history);
    } else {
        updateHistoryData($patient_pid, $history);
    }
    // Add or Update History data
    add_update_history($medics, $patient_pid, $errors);
    // Create or update an issue for each historical medication.
    //
    foreach ($medics->medical->medications->medication as $medication) {
        if (isempty($medication->name)) {
            continue;
        }
        $meds = array();
        $meds['title'] = form2db($medication->name);
        $meds['dosage'] = form2db($medication->dosage);
        $meds['frequency'] = form2db($medication->frequency);
        $meds['duration'] = form2db($medication->duration);
        // TBD does not exsist in MEDICS
        $meds['id'] = form2db($medication->id);
        if (!isempty($meds['id'])) {
            $row = sqlQuery("SELECT id FROM lists WHERE id = " . $meds['id']);
            if (!$row) {
                create_issue($patient_pid, 'medication', $meds);
            } else {
                update_issue($patient_pid, 'medication', $meds);
            }
        } else {
            create_issue($patient_pid, 'medication', $meds);
        }
    }
    return $alertmsg;
}
Exemplo n.º 2
0
                    if (time() - $lastupdate < 60 * 24 * 24 * 3) {
                        echo "<font color='" . $color72h . "'>" . $timestring . "</font>";
                    } else {
                        echo "<font color='" . $colorOther . "'>" . $timestring . "</font>";
                    }
                }
            }
        } else {
            echo "-";
        }
        echo '</td><td><input type="text" id="fixversion' . $groupid . '" name="fixversion" size="20" maxlength="20" value="' . $fix . '"/></td><td><textarea id="description' . $groupid . '" cols="50" rows="2" name="description" class="description">' . $description . '</textarea></td><td>';
        echo "<a href=\"javascript:updateGroupMeta(" . $groupid . ",'" . $bundleidentifier . "')\" class='button'>Update</a> ";
        echo "<a href='actionapi.php?action=downloadcrashid&groupid=" . $groupid . "' class='button'>Download</a> ";
        $issuelink = currentPageURL();
        $issuelink = substr($issuelink, 0, strrpos($issuelink, "/") + 1);
        echo create_issue($bundleidentifier, $issuelink . 'crashes.php?groupid=' . $groupid . '&bundleidentifier=' . $bundleidentifier . '&version=' . $version);
        echo " <a href='javascript:deleteGroupID(" . $groupid . ")' class='button redButton' onclick='return confirm(\"Do you really want to delete this item?\");'>Delete</a></td></tr>";
        echo '</table>';
        echo '</form>';
    }
    mysql_free_result($result);
}
// get all bugs not assigned to groups
$query = "SELECT count(*) FROM " . $dbcrashtable . " WHERE groupid = 0 and bundleidentifier = '" . $bundleidentifier . "' AND version = '" . $version . "'";
$result = mysql_query($query) or die(end_with_result('Error in SQL ' . $dbcrashtable));
$numrows = mysql_num_rows($result);
if ($numrows > 0) {
    $row = mysql_fetch_row($result);
    $amount = $row[0];
    if ($amount > 0) {
        echo '<table>' . $cols;
Exemplo n.º 3
0
            echo '<input type="hidden" name="bundleidentifier" value="' . $bundleidentifier . '"/>';
            echo '<input type="hidden" name="groupid" value="' . $groupid . '"/>';
            if ($search != "") {
                echo '<input type="hidden" name="search" value="' . $search . '"/>';
            }
            if ($type != "") {
                echo '<input type="hidden" name="type" value="' . $type . '"/>';
            }
            if ($version != "") {
                echo '<input type="hidden" name="version" value="' . $version . '"/>';
            }
            echo '<table>' . $cols2 . '<tr><th>Assigned Fix Version</th><th>Description</th><th>Actions</th></tr>';
            echo '<tr><td><input type="text" name="fixversion" size="20" maxlength="20" value="' . $fix . '"/></td>';
            echo '<td><textarea cols="50" rows="2" name="description" class="description">' . $description . '</textarea></td>';
            echo '<td><button type="submit" class="button">Update</button>';
            echo create_issue($bundleidentifier, currentPageURL());
            echo '</td></tr>';
            echo '</table></form>';
        }
    }
    mysql_free_result($result);
}
echo '<table>' . $cols;
echo "<tr><th>System</th><th>Timestamp / Description</th><th>Log</th><th>Action</th></tr>";
echo '</table>';
// get all groups
$query = "SELECT userid, contact, systemversion, description, log, timestamp, id FROM " . $dbcrashtable . $whereclause . " ORDER BY systemversion desc, timestamp desc";
if (!$all) {
    $query .= " limit " . $default_amount_crashes;
}
$result = mysql_query($query) or die(end_with_result('Error in SQL ' . $query));
Exemplo n.º 4
0
<?php 
define('JIRA_URL', 'https://jira.pocketgems.com');
define('USERNAME', 'hammad');
define('PASSWORD', 'khanz89');
function post_to($resource, $data)
{
    $jdata = json_encode($data);
    $ch = curl_init();
    curl_setopt_array($ch, array(CURLOPT_POST => 1, CURLOPT_URL => JIRA_URL . '/rest/api/latest/' . $resource, CURLOPT_USERPWD => USERNAME . ':' . PASSWORD, CURLOPT_POSTFIELDS => $jdata, CURLOPT_HTTPHEADER => array('Content-type: application/json'), CURLOPT_RETURNTRANSFER => true));
    $result = curl_exec($ch);
    curl_close($ch);
    return json_decode($result);
}
function create_issue($issue)
{
    return post_to('issue', $issue);
}
$new_issue = array('fields' => array('project' => array('key' => 'CLI'), 'summary' => 'Test via REST', 'description' => 'Description of issue goes here.', 'issuetype' => array('name' => 'Story')));
$result = create_issue($new_issue);
if (property_exists($result, 'errors')) {
    echo "Error(s) creating issue:\n";
    var_dump($result);
} else {
    echo "New issue created at " . JIRA_URL . "/browse/{$result->key}\n";
}