Exemple #1
0
 public function addResult($hash_value)
 {
     # Enters results for this test
     # Adds results for a test entry
     $curent_ts = "";
     $current_ts = date("Y-m-d H:i:s");
     $result_field = $this->result . $hash_value;
     $query_string = "UPDATE `test` SET result='{$result_field}', " . "comments='{$this->comments}', " . "user_id={$this->userId}, " . "ts='{$current_ts}' " . "WHERE test_id={$this->testId} ";
     query_blind($query_string);
     # If specimen ID was passed, update its status
     $specimen_id = $this->specimenId;
     if ($specimen_id != "") {
         update_specimen_status($specimen_id);
     }
 }
Exemple #2
0
        ?>
 &raquo;</a>
		</div>
		<?php 
        return;
    }
}
$result_csv = implode(",", $result_values) . ",";
$user_id = $_SESSION['user_id'];
//NC3065
$unix_ts = mktime(0, 0, 0, $mm_to, $dd_to, $yyyy_to);
$ts = date("Y-m-d H:i:s", $unix_ts);
//-NC3065
//echo $result_csv;
add_test_result($test_id, $result_csv, $comments, "", $user_id, $ts, $patient->getHashValue());
update_specimen_status($specimen_id);
$test_list = get_tests_by_specimen_id($specimen_id);
# Show confirmation with details.
?>
<div class='sidetip_nopos' style='width:400px;'>
<?php 
echo LangUtil::$pageTerms['MSG_RESULTSUBMITTED'];
?>
. <br><br>
<?php 
if ($_SESSION['sid'] != 0) {
    echo LangUtil::$generalTerms['SPECIMEN_ID'] . ": ";
    $specimen->getAuxId();
    echo "<br>";
}
//if($_SESSION['pnamehide'] == 0)
Exemple #3
0
function add_results_sequential($user_list = array())
{
    # Adds random result entries for scheduled specimen
    global $NUM_SPECIMENS, $F_PENDING, $SPECIMEN_ID_START;
    $lab_config_id = $_SESSION['lab_config_id'];
    $saved_db = DbUtil::switchToLabConfig($lab_config_id);
    $num_specimens2 = query_num_rows("specimen");
    $specimens_to_handle = floor($num_specimens2 * (1 - $F_PENDING));
    $specimen_target_list = array();
    $query_string = "SELECT * FROM specimen ORDER BY date_collected LIMIT " . $specimens_to_handle;
    $resultset = query_associative_all($query_string, $row_count);
    foreach ($resultset as $record) {
        $specimen_entry = Specimen::getObject($record);
        $specimen_target_list[] = $specimen_entry;
    }
    DbUtil::switchRestore($saved_db);
    $count = 0;
    $specimen_id_count = $SPECIMEN_ID_START;
    foreach ($specimen_target_list as $specimen) {
        if ($specimen == null) {
            # TODO:
        }
        $result_entry_ts = get_random_ts($specimen->dateCollected);
        if ($specimen == null) {
            #  Specimen does not exist
            //echo "Specimen does not exist<br>";
            //$count++;
            $specimen_id_count++;
            continue;
        }
        $saved_db = DbUtil::switchToLabConfig($_SESSION['lab_config_id']);
        $specimen_id = $specimen->specimenId;
        $status_code = get_specimen_status($specimen_id);
        DbUtil::switchRestore($saved_db);
        if ($status_code == Specimen::$STATUS_DONE) {
            # Results already entered
            //echo "Results already entered<br>";
            $count++;
            $specimen_id_count++;
            continue;
        }
        $patientId = $specimen->patientId;
        $currentPatient = Patient::getById($patientId);
        $hashValue = $currentPatient->generateHashValue();
        # Fetch tests scheduled for this specimen
        $test_list = get_tests_by_specimen_id($specimen_id);
        # For each test, fetch test measures and range from catalog
        foreach ($test_list as $test) {
            $measure_list = get_test_type_measures($test->testTypeId);
            $result_entry = "";
            foreach ($measure_list as $measure) {
                $range = get_measure_range($measure);
                # Select random result value
                $result_val = get_random_range_value($range);
                csv_append($result_val, $result_entry);
            }
            $test_id = $test->testId;
            # Update result field in test entry
            $saved_db = DbUtil::switchToLabConfig($lab_config_id);
            # Select random technician as the one of entered this result
            $user_id = 0;
            if (count($user_list) != 0) {
                $random_user_index = rand(1, count($user_list));
                $random_user = $user_list[$random_user_index - 1];
                $user_id = $random_user->userId;
            }
            add_test_result($test_id, $result_entry, "", "", $user_id, $result_entry_ts, $hashValue);
            # Randomly this test result mark as verified or keep as unverified
            # null or 0 => not verified, non-zero => verified.
            if (with_probability(0.9)) {
                $is_verified = 2;
                $test->setVerifiedBy($is_verified);
            }
            DbUtil::switchRestore($saved_db);
        }
        $saved_db = DbUtil::switchToLabConfig($lab_config_id);
        # Mark specimen as 'all tests done'
        update_specimen_status($specimen_id);
        # Randomly mark this specimen as reported or keep as unreported
        if (with_probability(0.9)) {
            $date_reported = date("Y-m-d H:i:s");
            $specimen->setDateReported($date_reported);
        }
        DbUtil::switchRestore($saved_db);
        # Update counters
        $count++;
        $specimen_id_count++;
    }
}