コード例 #1
0
        $status_list[] = "<font color='red'>" . LangUtil::$generalTerms['ERROR'] . "</font>";
    } else {
        if ($test->isPending() == false) {
            # Error: Results already entered
            $status_list[] = "<font color='red'>" . LangUtil::$generalTerms['ERROR'] . "</font>: " . LangUtil::$pageTerms['MSG_ALREADYENTERED'];
        } else {
            if ($empty_result_field == true) {
                # Error: Result value missing
                $status_list[] = "<font color='red'>" . LangUtil::$generalTerms['ERROR'] . "</font>: " . LangUtil::$pageTerms['MSG_RESULTMISSING'];
            } else {
                # Add result values
                $test_id = $test->testId;
                $test->result = $result_csv;
                $specimen = Specimen::getById($specimen_id);
                $patient = Patient::getById($specimen->patientId);
                add_test_result($test_id, $result_csv, $comments, $specimen_id, $user_id, "", $patient->hashValue);
                $status_list[] = "<font color='green'>" . LangUtil::$generalTerms['MSG_ADDED'] . "</font>";
            }
        }
    }
    $specimen_done_list[] = $specimen_id;
    $test_list[] = $test;
}
?>
<br>
<b><?php 
echo LangUtil::$pageTerms['MENU_BATCHRESULTS'];
?>
</b>: <?php 
echo $test_name;
?>
コード例 #2
0
ファイル: result_add.php プロジェクト: caseyi/BLIS
        echo LangUtil::$generalTerms['CMD_VIEW'];
        ?>
 &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>";
}
コード例 #3
0
ファイル: random.php プロジェクト: caseyi/BLIS
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++;
    }
}