Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/irp/icure/doctor/
Upload File :
Current File : /var/www/html/mmishra/irp/icure/doctor/patients.inc.bak

<h3 align='left'>Patient Status</h3>

<?php

$tbl = 'registrations';

$patid = $_REQUEST["patid"];
$regno = $_REQUEST["regno"];

?>

Patient ID <input type='text' name='patid' value='<?php echo $patid; ?>' size='15'>
<input type='submit' name='submit' value='FIND'>
<br>

<?php  

if ($patid) {
        $sql = "select reg_no,reg_datetime as date_time,concat(pat_group,'-',pat_id,' (',pat_co,')') as patient,dr_id as doctor,login_id as staff 
	from $tbl where pat_id like '$patid%'";

	$rs = mysql_query($sql);
	if (mysql_num_rows($rs)) {
        	$colHeads = mysql_num_fields($rs);

        	echo "<table border='1' width='90%'><tr><th>Sr</th>";
        	for ($i=0; $i < $colHeads; $i++) { // Header
               		$fld = ucwords(str_replace("_"," ",mysql_field_name($rs, $i)));
               		echo "<th>$fld</th>";
        	}
        	echo "</tr>";
        	while ($row = mysql_fetch_row($rs)) { //data
               		$j++;
               		echo "<tr><td><a href='doctor/?pg=$pg&patid=$patid&regno=".$row[0]."'>$j</a></td><td>".implode($row,'</td><td>')."</td></tr>";
        	}
        	echo "</table>";
	} 

	$heads = array('Prescriptions','Admissions','Medications');
	if ($regno) {
		echo "<h3 align='center'>Medical History of Registration No.- $regno</h3>";

	        $sqls = array("select concat(medicine,'- ',dose,', ',frequency,' times, ',course_days,' days') as prescription,login_id as staff from prescriptions where reg_no=$regno order by pres_id",
        	"select adm_datetime as ADT,diagnosis,referral,dis_datetime as DDT,login_id as staff from admissions where reg_no=$regno",
        	"select dis_datetime as date_time,concat(med_name,' ',specification,' (',med_type ,')') as medicine,qty,a.login_id as staff from medications as a, medicines as b where a.med_id=b.med_id and reg_no=$regno");

	        $no = 0;
	
        	foreach ($sqls as $sql) {
                	echo "<p align='left'><b>".$heads[$no]."</b></p>";
                	$no++;

                	echo list_tabledata($sql);
        	}
	}
} else {
	$pgno = $_REQUEST["pgno"];
	if (!$pgno) $pgno = 0;

	$pgsz = 10;


	$sql = "select reg_no,reg_datetime as date_time,concat(pat_group,'-',pat_id,' (',pat_co,')') as patient,dr_id as doctor,login_id as staff 
	from $tbl order by reg_no desc limit $pgno,$pgsz";

	$rs = mysql_query($sql);
	if (mysql_num_rows($rs)) {
        	$colHeads = mysql_num_fields($rs);

        	echo "<table border='1' width='90%'><tr><th>Sr</th>";
        
		for ($i=0; $i < $colHeads; $i++) { // Header
                	$fld = ucwords(str_replace("_"," ",mysql_field_name($rs, $i)));
                	echo "<th>$fld</th>";
        	}
        	echo "</tr>";
        	
		$j = $pgno;	
		while ($row = mysql_fetch_row($rs)) { //data
                	$j++;
                	echo "<tr><td>$j</td><td>".implode($row,'</td><td>')."</td></tr>";
        	}
        	echo "</table>";

        	if ($pgno) {
                	$pgno = $pgno - $pgsz;
                	echo "[ <a href='doctor/?pg=$pg&pgno=$pgno'>Previous</a> ] ";
                	$pgno = $pgno + $pgsz;
        	}
        	if ($j % $pgsz == 0) {
                	$pgno = $pgno + $pgsz;
                	echo " [ <a href='doctor/?pg=$pg&pgno=$pgno'>Next</a> ]";
        	}
	} else {
        	echo "---";
	}
}

?>