Example #1
0
	public function getPatientHistory($pid)
	{
		# Returns HTML table displaying patient test history
                $admin = 0;
                $specimenBarcode = specimenBarcodeCheck();
                if(is_admin(get_user_by_id($_SESSION['user_id']))) {
                    $admin = 1;}
                $rem_recs = get_removed_specimens($_SESSION['lab_config_id']);
                $rem_specs = array();
                $rem_remarks = array();
                foreach($rem_recs as $rem_rec)
                {
                    $rem_specs[] = $rem_rec['r_id'];
                    $rem_remarks[] = $rem_rec['remarks'];
                }
            
		$specimen_list = get_specimens_by_patient_id($pid);
		if(count($specimen_list) == 0)
		{
			?>
			<br>
			<div class='sidetip_nopos'><?php echo LangUtil::$generalTerms['TESTS']." - ".LangUtil::$generalTerms['MSG_NOTFOUND']; ?></div>
			<?php
			return;
		}
		?>
		<script type='text/javascript'>
		$(document).ready(function(){
			$('#test_history_table').tablesorter();
		});
		
		function get_report(pid,sid)
		{ 
			var url_string = "report_onetesthistory.php?ppid="+pid+"&spid="+sid;
	window.open(url_string);
		}
		</script>
		<table class='tablesorter' id='test_history_table'>
			<thead>
				<tr valign='top'>
					<?php
					if($_SESSION['s_addl'] != 0)
					{
					?>
					<th><?php echo LangUtil::$generalTerms['SPECIMEN_ID']; ?></th>
					<?php
					}
					?>
					<th><?php echo LangUtil::$generalTerms['TYPE']; ?></th>
					<th><?php echo LangUtil::$generalTerms['R_DATE']; ?></th>
					<th><?php echo LangUtil::$generalTerms['SP_STATUS']; ?></th>
					<th></th>
					<th></th>
                                        <?php
                            if($specimenBarcode)
                            {
                            ?>
                                 <th></th>
                            <? 
                            }
                                
                        ?>
				</tr>
			</thead>
			<tbody>
			<?php
			foreach($specimen_list as $specimen)
			{
                            if($admin == 0)
                            {
                                if(in_array($specimen->specimenId, $rem_specs))
                                    continue;
                            }
				$this->getSpecimenInfoRow($specimen, $rem_specs, $admin); 
			}
			?>
			</tbody>
		</table>
		<?php
		# TODO: Add paging to this table
	}
Example #2
0
	public function getPatientHistory($pid)
	{
		# Returns HTML table displaying patient test history
                $admin = 0;
                $specimenBarcode = specimenBarcodeCheck();
                if(is_admin(get_user_by_id($_SESSION['user_id']))) {
                    $admin = 1;}
                $rem_recs = get_removed_specimens($_SESSION['lab_config_id'], "specimen");
                $rem_specs = array();
                $rem_remarks = array();
                foreach($rem_recs as $rem_rec)
                {
                    $rem_specs[] = $rem_rec['r_id'];
                    $rem_remarks[] = $rem_rec['remarks'];
                }

		$specimen_list = get_specimens_by_patient_id($pid);
		if(count($specimen_list) == 0)
		{
			?>
			<br>
			<div class='sidetip_nopos'><?php echo LangUtil::$generalTerms['TESTS']." - ".LangUtil::$generalTerms['MSG_NOTFOUND']; ?></div>
			<?php
			return;
		}
		?>
		<script type='text/javascript'>
		$(document).ready(function(){
			$('#test_history_table').tablesorter();
		});
		
		function get_report(pid,sid)
		{
			var url_string = "report_onetesthistory.php?ppid="+pid+"&spid="+sid;
			window.open(url_string);
		}

		function delete_specimen(sid){
			if(ConfirmDelete()){
				var params = "specimen_id="+sid;
				//alert("patient Id " + patient_id);
				$.ajax({
					type: "POST",
					url: "ajax/delete_specimen.php",
					data: params,
					success: function(msg) {
						if(msg.indexOf("1")> -1){
							// refresh the page with updated specimen details
							location.href = location.href + '&del=1';
						} else {
							$("#target_div_id_del").html("Specimen cannot be deleted");
						}
						
					}
				}); 
							
			}	
		}

		function update_specimen(sid){
			
		}

		function ConfirmDelete()
		{
		  var x = confirm("Are you sure you want to delete?");
		  if (x)
		      return true;
		  else
		    return false;
		}
		
		</script>
		<table class='tablesorter' id='test_history_table'>
			<thead>
				<tr valign='top'>
					<?php
					if($_SESSION['s_addl'] != 0)
					{
					?>
					<th><?php echo LangUtil::$generalTerms['SPECIMEN_ID']; ?></th>
					<?php
					}
					?>
					<th><?php echo LangUtil::$generalTerms['TYPE']; ?></th>
					<th><?php echo LangUtil::$generalTerms['R_DATE']; ?></th>
					<th><?php echo LangUtil::$generalTerms['SP_STATUS']; ?></th>
					<th></th>
					<th></th>
					<!-- Deleting the patient specimen -->
					<th></th>
                                        <?php
                            if($specimenBarcode)
                            {
                            ?>
                                 <th></th>
                            <? 
                            }
                                
                        ?>
				</tr>
			</thead>
			<tbody>
			<?php
			foreach($specimen_list as $specimen)
			{
				
                            if($admin == 0)
                            {
                                if(in_array($specimen->specimenId, $rem_specs))
                                    continue;
                            }
                            //echo $admin. " admin";
				$this->getSpecimenInfoRow($specimen, $rem_specs, $admin);
			}
			?>
			</tbody>
		</table>
		<?php
		# TODO: Add paging to this table
	}