Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/icure/staff/
Upload File :
Current File : /var/www/html/mmishra/icure/staff/patients.inc

<h3 align='left'>Patient Status</h3>
<center>
<?php
/*
$tbl = 'registrations';

$regno = $_REQUEST["regno"];

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

	$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='?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 "<div align='left'><b>".$heads[$no]."</b></div>";
                        $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,' (',dependent,')') 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><a href='?pg=$pg&regno=".$row[0]."'>$j</a></td><td>".implode($row,'</td><td>')."</td></tr>";
       		}
       		echo "</table>";

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

$tbl = 'registrations';

$pgno = $_REQUEST["pgno"];
if (!$pgno) $pgno = 0;

$pgsz = 30;

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

$sql = "select pat_id,count(reg_no) as no from $tbl group by pat_id order by no desc limit $pgno,$pgsz";
$rs = mysql_query($sql);

echo "<table border='1' width='90%'>
<tr valign='top'><td width='30%'>";

while ($o = mysql_fetch_object($rs)) { //data
	$patid1 = strtoupper($o->pat_id);
	if ($patid == $patid1) {
        	echo "<font color='red' size=+1>- $patid ($o->no)</font>";
		$sr = mysql_query("select reg_no,reg_date from $tbl where pat_id='$patid' order by reg_no desc");
		echo "<dir>";
		while ($q = mysql_fetch_object($sr)) { //data
			if ($regno == $q->reg_no)
				echo "<font color='red' size=+1>- $q->reg_no ($q->reg_date)</font>";
			else
				echo "+ <a href='?pg=$pg&regno=$q->reg_no&patid=$patid&pgno=$pgno'>$q->reg_no</a> ($q->reg_date)";
			echo "<br>";
		}
		echo "</dir>";
        } else {
        	echo "+ <a href='?pg=$pg&patid=$patid1&pgno=$pgno'>$patid1</a> ($o->no)";
	}
	echo "<br>";
}
echo "</td><td>";

if ($regno) {
	$heads = array('Registrations','Medications');
        echo "<h3 align='center'>Treatment Record of Registration No.- $regno</h3>";

        $sqls = array("select reg_no,concat(reg_date,' ',reg_time) as dated,concat(dr_name,' (',specialization,')') as doctor,a.login_id as staff from registrations a, doctors b where a.dr_id=b.dr_id and reg_no=$regno",
        "select med_name,qty,a.login_id as staff from medications as a, medicines as b where a.med_id=b.med_id and reg_no=$regno");

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

                echo list_tabledata($sql);
        }
}
echo "</td></tr></table>";

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

?>
</center>