Beispiel #1
0
        echo LangUtil::$generalTerms['GENDER'] . "/" . LangUtil::$generalTerms['AGE'] . ": {$patient->sex} /" . $patient->getAgeNumber() . "<br>";
    }
    ?>
	<br><a href='specimen_info.php?sid=<?php 
    echo $specimen->specimenId;
    ?>
'> <?php 
    echo LangUtil::$generalTerms['DETAILS'];
    ?>
 &raquo;</a>
	</div>
	<?php 
    return;
}
# Print HTML results form
$test_list = get_tests_by_specimen_id($specimen->specimenId);
$patient = get_patient_by_id($specimen->patientId);
?>
<div class='pretty_box'>

<?php 
if (0) {
    if ($_SESSION['sid'] != 0) {
        echo LangUtil::$generalTerms['SPECIMEN_ID'] . ": ";
        $specimen->getAuxId();
        echo "<br>";
    }
    if ($_SESSION['pid'] != 0) {
        echo LangUtil::$generalTerms['PATIENT_ID'] . ": " . $patient->surrogateId . "<br>";
    }
    if ($_SESSION['dnum'] != 0) {
Beispiel #2
0
function update_specimen_status($specimen_id)
{
    global $con;
    $specimen_id = mysql_real_escape_string($specimen_id, $con);
    # Checks if all test results for the specimen have been entered,
    # and updates specimen status accordingly
    $test_list = get_tests_by_specimen_id($specimen_id);
    foreach ($test_list as $test) {
        if ($test->isPending() === true) {
            # This test result is pending
            return;
        }
    }
    # Update specimen status to complete
    $status_code = Specimen::$STATUS_DONE;
    set_specimen_status($specimen_id, $status_code);
}
Beispiel #3
0
	public function getReportResultsForm($form_name, $form_id)
	{
		$specimen_list = Specimen::getUnreported();
		if($specimen_list == null || count($specimen_list) == 0)
			return;
		?>
		<table class='tablesorter'>
			<thead>
				<tr valign='top'>
					<?php
					if($_SESSION['pid'] != 0)
					{
						?>
						<th><?php echo LangUtil::$generalTerms['PATIENT_ID']; ?></th>
						<?php
					}
					if($_SESSION['dnum'] != 0)
					{
						?>
						<th><?php echo LangUtil::$generalTerms['PATIENT_DAILYNUM']; ?></th>
						<?php
					}
					if($_SESSION['s_addl'] != 0)
					{
						?>
						<th><?php echo LangUtil::$generalTerms['SPECIMEN_ID']; ?></th>
						<?php
					}
					?>
					<th><?php echo LangUtil::$generalTerms['PATIENT_NAME']; ?></th>
					<th><?php echo LangUtil::$generalTerms['SPECIMEN_TYPE']; ?></th>
					<th><?php echo LangUtil::$generalTerms['C_DATE']; ?></th>
					<th><?php echo LangUtil::$generalTerms['TESTS']; ?></th>
					<th><?php echo LangUtil::$generalTerms['REPORT_TO']; ?></th>
					<th>
						<?php echo LangUtil::$generalTerms['REPORTED']; ?>?
						<input type='checkbox' name='check_all' id='check_all' onclick='checkoruncheckall();'>
						</input>
					</th>
				</tr>
			</thead>
			<tbody>
			<?php
			foreach($specimen_list as $specimen)
			{
				$test_list = get_tests_by_specimen_id($specimen->specimenId);
				$patient = Patient::getById($specimen->patientId);
				?>
				<tr valign='top'>
					<input type='hidden' name='sid[]' value='<?php echo $specimen->specimenId; ?>'></input>
					<?php
					if($_SESSION['pid'] != 0)
					{
						?>
						<td><?php echo $specimen->getSurrogateId(); ?></td>
						<?php
					}
					if($_SESSION['dnum'] != 0)
					{
						?>
						<td><?php $specimen->getDailyNum(); ?></td>
						<?php
					}
					if($_SESSION['s_addl'] != 0)
					{
						?>
						<td><?php $specimen->getAuxId(); ?></td>
						<?php
					}
					?>
					<td><?php echo $patient->getName(); ?></td>
					<td><?php echo get_specimen_name_by_id($specimen->specimenTypeId); ?></td>
					<td><?php echo DateLib::mysqlToString($specimen->dateCollected)." ".$specimen->timeCollected; ?></td>
					<td>
						<?php 
						foreach($test_list as $test)
						{
							echo get_test_name_by_id($test->testTypeId);
							echo "<br>";
						}
						?>
					</td>
					<td><?php echo $specimen->getReportTo(); ?></td>
					<td>
						<center>
							<input type='checkbox' class='report_flag' name='mark_<?php echo $specimen->specimenId; ?>'></input>
						</center>
					</td>
				</tr>
				<?php
			}
			?>
			</tbody>
		</table>
		<?php
	}
Beispiel #4
0
 public function get_tests($specimen_id)
 {
     $test_list = get_tests_by_specimen_id($specimen_id);
     if (count($test_list) > 0) {
         $ret = $test_list;
     } else {
         $ret = 0;
     }
     return $ret;
 }
Beispiel #5
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++;
    }
}
Beispiel #6
0
<?php

include "redirect.php";
include "../includes/db_lib.php";
/*
echo "<pre>";
print_r($_POST);
echo "</pre>";
*/
putUILog('rem_tests', 'X', basename($_SERVER['REQUEST_URI'], ".php"), 'X', 'X', 'X');
$lid = $_SESSION['lab_config_id'];
$sp = $_POST['sp'];
$remarks = $_POST['remarks'];
$count = count($sp);
for ($i = 0; $i < $count; $i++) {
    if (isset($_POST['category'])) {
        remove_specimens($lid, $sp[$i], $remarks[$i], $_POST['category']);
        $testsList = get_tests_by_specimen_id($sp[$i]);
        delete_tests_by_test_id($testsList);
    } else {
        remove_specimens($lid, $sp[$i], $remarks[$i]);
    }
}
$url = "Location:../" . $_POST['url'];
header($url);