<?php
include('../config/config.php');
include("../classes/classPatient.php");
include("../classes/classImages.php");

/*echo '<pre>';
print_r($_SESSION);
echo '</pre>';*/

if(isset($_GET['pid'])&&$_GET['pid']!='')
{
	$patient_auto_id = base64_decode($_GET['pid']); 
	try
	{
		$retrievePatientOb = new classPatient;
		$retrievePatientOb->setPatientAutoID($patient_auto_id);
		$patient_array = $retrievePatientOb->retrievePatientByPatientID();
		
		$imageRetrieveOb = new classImages;
		$imageRetrieveOb->setPatientAutoID($patient_array[0]['patient_auto_id']);
		$image_id = $imageRetrieveOb->fetchImageOfPatient();
	}
	catch (MyException $e)
	{
		$error_message = $e->getUserMsg();
	}
}





/*echo '<pre>';
print_r($patient_array);
echo '</pre>';
exit;*/

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/print.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <link rel="shortcut icon" href="../images/favicon.png">
    <title>Med2TEC Hospital Management Information System</title> 
    <link href="../css/print.css" rel="stylesheet">
    <link href="../datepicker/jquery-ui.css" rel="stylesheet" >  
    <script type="text/javascript" src="../datepicker/jquery-1.9.1.js"></script>
	<script type="text/javascript" src="../datepicker/jquery-ui.js"></script> 
</head>

<body> 
<div align="right"> 
 <SCRIPT LANGUAGE="JavaScript">  
if (window.print) {
document.write('<form class="no-print"><input type=button name=print value="Print" onClick="window.print()"></form>');
}
</script></div>

<section class="wrapper">
<div style="background:#FFF; padding:0px 0px 0; height:auto;">
  <table cellspacing="0" cellpadding="0" width="100%" border="0" style="font-size:11px;">
    <tbody>
      <tr>
        <td align="left" style="background:#fff;"><img alt="" src="../images/org_print_logos/<?php echo $_SESSION['security']['org_id']?>.png" style="width:100%;"></td>
      </tr>
    </tbody>
  </table>
  
</br>

</div>

<div class="row">
          <section class="panel">
            <header class="panel-heading">
              <h2><!-- InstanceBeginEditable name="title" -->PATIENT REGISTRATION FORM<!-- InstanceEndEditable --></h2>
            </header>

  <br />
  
<!-- InstanceBeginEditable name="main" -->
  <!-- page start-->
  
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td valign="top">
        <table border="0" cellpadding="0" cellspacing="0" width="100%">
          <tr>
            <td width="70%" rowspan="3" valign="top">
            <?php
			if(isset($image_id))
					{
						
						?>
                    	<img style="height:78px; width:70px;" src="../images/patient_images/<?php echo $image_id;?>.jpg">
                        <?php
					}
                    else
                    {
                    	?>
                    	<img src="../images/photo.png" style="height:78px; width:70px;">
                        <?php
                    }
			?>
            </p></td>
            <td width="30%" style="border-bottom:1px solid #999;">Registration ID: <?php if(isset($patient_array[0]['patient_id'])){echo $patient_array[0]['patient_id'];}?></td>
          </tr>
          <tr>
            <td style="border-bottom:1px solid #999;">Registration Date: <?php if(isset($patient_array[0]['reg_date'])){echo date('d M Y',$patient_array[0]['reg_date']);}else{echo date('d M Y',time());}?></td>
          </tr>
          <tr>
            <td style="border-bottom:1px solid #999;">Doctor to Consult:</td>
          </tr>
        </table><p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
  normal'></p></td>
    </tr>
    <tr>
      <td valign='middle' height="30" bgcolor="#CCCCCC" style="border:1px solid #999;"><strong>PERSONAL INFORMATION</strong></td>
    </tr>
    <tr>
      <td valign='top'>
      	<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-bottom:1px solid #999;">
          <tr>
            <td width="40%" valign='middle' height="30" style="border-right:1px solid #999;">First Name:<?php if(isset($patient_array[0]['patient_fname'])){echo ucwords($patient_array[0]['patient_fname']);}?></td>
            <td width="60%" valign='middle' height="30">Last Name:<?php if(isset($patient_array[0]['patient_lname'])){echo ucwords($patient_array[0]['patient_lname']);}?></td>
          </tr>
        </table>
        
        <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-bottom:1px solid #999;">
          <tr>
            <td width="20%" valign='middle' height="30" style="border-right:1px solid #999;">Birth Date: <?php if(isset($patient_array[0]['dob'])){echo $patient_array[0]['dob'];}?></td>
            <td width="15%" valign='middle' height="30" style="border-right:1px solid #999;">Age: </td>
            <td width="15%" valign='middle' height="30" style="border-right:1px solid #999;">Gender: <?php if(isset($patient_array[0]['gender'])){echo $patient_array[0]['gender'];}?></td>
            <td width="50%" valign='middle' height="30">NIC No, if age more than 18 years: <?php if(isset($patient_array[0]['nic'])){echo $patient_array[0]['nic'];}?></td>
          </tr>
        </table>
       
        <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-bottom:1px solid #999;">
          <tr>
            <td width="50%" valign='middle' height="30" style="border-right:1px solid #999;">Address: <?php if(isset($patient_array[0]['address'])){echo ucwords($patient_array[0]['address']);}?></td>
            <td width="20%" valign='middle' height="30" style="border-right:1px solid #999;">City: <?php if(isset($patient_array[0]['city'])){echo ucwords($patient_array[0]['city']);}?></td>
            <td width="30%" valign='middle' height="30">Phone No: <?php if(isset($patient_array[0]['phone'])){echo $patient_array[0]['phone'];}?></td>
          </tr>
        </table><p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
  normal'></p>
        </td>
    </tr>
    <tr>
      <td valign='middle' height="30" bgcolor="#CCCCCC" style="border:1px solid #999;"><strong>PARENT/ATTENDANT INFORMATION</strong></td>
    </tr>
    <tr>
      <td valign='top'>
        <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-bottom:1px solid #999;">
          <tr>
            <td width="60%" valign='middle' height="30" style="border-right:1px solid #999;">Son/Daughter/Wife of: <?php if(isset($patient_array[0]['parent_name'])){echo ucwords($patient_array[0]['parent_name']);}?></td>
            <td width="40%">Phone No: <?php if(isset($patient_array[0]['parent_phone'])){echo $patient_array[0]['parent_phone'];}?></td>
          </tr>
        </table><p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
  normal'></p></td>
    </tr>
    <tr>
      <td valign='middle' height="30" bgcolor="#CCCCCC" style="border:1px solid #999;"><strong>MEDICAL HISTORY</strong></td>
    </tr>
    <tr>
      <td valign='top'>
  <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-bottom:1px solid #999;">
          <tr>
            <td width="55%" valign='middle' height="30" style="border-bottom:1px solid #999; border-right:1px solid #999;">Referred by: <?php if(isset($patient_array[0]['ref_doctor'])){echo $patient_array[0]['ref_doctor'];}?></td>
            <td width="45%" valign='middle' height="30" style="border-bottom:1px solid #999;">Blood Group: <?php if(isset($patient_array[0]['blood_group'])){echo $patient_array[0]['blood_group'];}?></td>
          </tr>
          <tr>
            <td valign='middle' height="30" style="border-right:1px solid #999;">Medical Issues: <?php if(isset($patient_array[0]['med_history'])){echo $patient_array[0]['med_history'];}?><br>
<br>
<br>
<br>
<br>
</td>
            <td valign='top'>Allergies: <?php if(isset($patient_array[0]['allergies'])){echo $patient_array[0]['allergies'];}?></p>
              <i>Medicine<br>
                Food<br>
                Other</i></td>
          </tr>
        </table>
        <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
  normal'></p></td>
    </tr>
    <tr>
      <td valign='middle' height="30" bgcolor="#CCCCCC" style="border:1px solid #999;"><strong>EMERGENCY INFORMATION</strong></td>
    </tr>
    <tr>
      <td valign='top'>
        <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-bottom:1px solid #999;">
          <tr>
            <td width="50%" valign='middle' height="30" style="border-right:1px solid #999;">Patient brought to the Hospital by:<?php if(isset($patient_array[0]['emer_name'])){echo ucwords($patient_array[0]['emer_name']);}?></td>
            <td width="20%" style="border-right:1px solid #999;">Phone No:<?php if(isset($patient_array[0]['emer_phone'])){echo $patient_array[0]['emer_phone'];}?></td>
            <td width="30%">NIC No:<?php if(isset($patient_array[0]['emer_nic'])){echo $patient_array[0]['emer_nic'];}?></td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td valign='top'><p style='font-size:8pt'>I hereby acknowledge and understand that by signing this Registration Form I consent to receiving the diagnosis, care, and/or treatment for the above mentioned patient by the <strong>Hospital </strong>and its healthcare professionals/workers. I agree that by receiving such treatment I am susceptible to medical reactions and consequences which may be beyond the control of any person and solely depend on Allah’s will.  Thus I absolve the <strong>Hospital</strong> and its healthcare professionals/workers from all liabilities, actions and legal claims resulting from the given treatment.</p>
        <p style='font-size:8pt'>I hereby confirm that I am the authorized person to give this consent statement on behalf of the above mentioned patient and will be responsible for all consequences resulting from the treatment given by the <strong>Hospital</strong> and its healthcare professionals/workers.</p></td>
    </tr>
    <tr>
      <td valign='top'><table width="100%" border=0 cellpadding="0" cellspacing="0">
      <tr>
            <td width="55%" >&nbsp;</td>
            <td width="10%" >&nbsp;</td>
            <td width="25%" >&nbsp;</td>
            <td width="10%" >&nbsp;</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td style="border-bottom:1px solid #999;">Patient/Guardian/Attendant signature</td>
            <td>&nbsp;</td>
            <td style="border-bottom:1px solid #999;">Date</td>
            <td>&nbsp;</td>
          </tr>
        </table></td>
    </tr>
  </table>
  <!-- page end-->
  
<!-- InstanceEndEditable -->
</section>
</div>

<!--<p align="center" style="font-size:12px; font-family:Arial, Helvetica, sans-serif; margin-top:260px;"><strong><!--317 A-1, Nursery Stop, Township, Lahore. 
Ph: 042-35151666</strong><br />
For Appointment call at 042-35151666 (bring your Patient ID Card) </p>-->

   <div class="sidepop" style="float:right;">
    <div class="sidepopbutton stemp"><div style="color: rgb(0, 0, 0); text-align: right; font-size: 10px; margin-top: 4px; position: absolute; right: 180px;">© Software by Softusion Inc. 0322 6155 219</div>   
    </div>
</div>

<!--<div class="sidepop" style="float:right;">
    <div class="sidepopbutton stemp"><div style="color:#000; text-align:right; font-size:9px;">© Software designed by Softusion Inc. Contact us at 0322 6155 219</div>   
    </div>
</div>-->


          
</body>
<!-- InstanceEnd --></html>