<?php

require_once 'iosPushUniversal.php';
$obj = new iosPushUniversal();
$registatoin_ids = array('68141f71cbae1c493318f17b132215223655c27a2670a580dee074c4cdf96028');
$msg = "Hello testing 123";
$obj->sendIosPush($registatoin_ids, $msg);
session_start();
if (!isset($_SESSION['hospital_id_SESSION'])) {
    header("Location: hospital_login.php");
    die;
}
$hospital_id = $_SESSION['hospital_id_SESSION'];
$hospital_name = $_SESSION['hospital_name_SESSION'];
include 'db_conn.php';
include 'logger.php';
include 'GCM.php';
include 'Email_sender.php';
$logger = new Logger();
$gcm = new GCM();
include_once 'iosPushUniversal.php';
$ios_push = new iosPushUniversal();
$email_sender = new EMAIL_SENDER();
$logger->write("INFO :", "PHP Scritp Name =>" . $_SERVER['REQUEST_URI']);
$logger->write("INFO :", "Type of Request =>" . $_SERVER['REQUEST_METHOD']);
$logger->write("INFO :", "before post");
$pat_id = $_POST['pat_id'];
$name = $_POST['name'];
$age = $_POST['age'];
$mobile = $_POST['patientmobile'];
$gender = $_POST['patientgender'];
$location = $_POST['patientlocation'];
$patientnotes = $_POST['patientnotes'];
$logger->write("INFO :", "received post");
/*for sending SMS to refering doctor regarding the patient */
$query_pat_referring = "select tmp.*,sd.Doctor_mobile_number as Ref_mob_number,sd.Doctor_name as Ref_Title,sd.Doctor_name as Ref_name,sd.Doctor_email as Ref_email from doctor_stub sd inner join (SELECT ps.patient_thread_id,ps.Patient_Name ,ps.reg_by_doc,ps.doc_ref_id,ds.Doctor_Title as Reg_Title,ds.Doctor_name as Reg_name,ds.Doctor_mobile_number as Reg_mobnumber,ds.Doctor_email as Reg_email FROM `patient_stub` ps inner join doctor_stub ds on ps.reg_by_doc=ds.Doctor_serial_id where ps.patient_thread_id= '{$pat_id}')as tmp on tmp.doc_ref_id=sd.Doctor_serial_id";
$logger->write("INFO for query:", $query_pat_referring);