Mr.Fn4ticHz Shell
Server IP : 162.240.98.243  /  Your IP : 18.221.254.61
Web Server : Apache
System : Linux server.bti.yaw.mybluehostin.me 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : btiyawmy ( 1003)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/btiyawmy/public_html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/btiyawmy/public_html/patientmanager_opd.php
<?php 
require_once("LoginManager.php");
class PatientManager
{	
public static $userhomepage="welcome.php",$loginpage="login.php",$adminhomepage="price.php",$drhomepage="drprofile.php",$patienthomepage="patient_basic.php";


public static function opdslip($prescriptionid,$patientid,$significate,$Admission_diagnosis,$other_Admission_diagnosis,$tratment,$Nutritional_Diagnosis,$eyetype,$note,$entered_by,$casetype,$typevisit,$DrName)
{
	echo "";
	$link=DBManager::connect();
		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
		$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
		PatientManager::setActivityLog($patientid,"$prescriptionid","Opd Slip<br>Initial Diagnosis","showpage_Diagnosis.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
		  PatientManager::diagnosistimiline("$prescriptionid","$patientid","$Admission_diagnosis","$tratment","$entered_by");
$sql="INSERT INTO opdslip(Srno,prescriptionid,patientid,significate,Admission_diagnosis,other_Admission_diagnosis,tratment,Nutritional_Diagnosis,eyetype,note,entered_by,created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$significate','$Admission_diagnosis','$other_Admission_diagnosis','$tratment','$Nutritional_Diagnosis','$eyetype','$note','$entered_by','$created_at','$updated_at')";

	$result=mysqli_query($link,$sql);
	
		$tat=$link->query("INSERT INTO `tat`(`tatid`, `patientid`, `prescriptionid`, `discription`,`type`, `pagetype`, `hospital_id`, `start_date`, `stop_date`, `start_time`, `stop_time`, `solution`, `entered_by`, `reported_at`, `currenctive_at`, `currenctive_by`, `updated_at`) VALUES (NULL,'$patientid','$prescriptionid','Null','$typevisit','drinvace.php?prescriptionid=$prescriptionid&patientid=$patientid','$entered_by','".date('Y-m-d')."','0','".date('H:i:s')."','0','solution','$entered_by','$DrName','$created_at','$Admitted_Under','')");
if($result)
echo "<script>window.location='testopdslip1.php?prescriptionid=$prescriptionid&patientid=$patientid';</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}

public static function diagnosistimiline($prescriptionid,$patientid,$diagnosis,$Surgery,$entered_by)
{
    $updated_at=date("Y-m-d");
$created_at=date("F d, Y / h:i:s A");
	echo "";
	$link=DBManager::connect();
	  $narayan=LoginManager::currentUser();
$harilal=LoginManager::getUserTypeByuname("$narayan");
$entered_by=$harilal;
$admissiondate=date("Y-m-d");
		  	$sql="INSERT INTO diagnosis_timiline(id,prescriptionid,patientid,diagnosis,Surgery,entered_by,created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$diagnosis','$Surgery','$entered_by','$created_at','$updated_at')";
		$result=mysqli_query($link,$sql);
if($result)
	$link=DBManager::close($link);
}

public static function nayainvestigation($prescriptionid,$patientid,$hospital_id,$Raised_at,$Investigation_type,$Category,$Sub_Category,$Priority_slip,$Investigation,$ivid,$Result,$Evidence,$entered_by)
{

	$link=DBManager::connect();
		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
	include("dbconnection.php");
$sql1 ="SELECT * FROM create_inhouse WHERE ivid='$ivid' AND hospitalid='$hospital_id' OR ivid='$Investigation' AND hospitalid='$hospital_id'";
		$qsql1 = mysqli_query($con,$sql1);
		if($rh1 = mysqli_fetch_array($qsql1))
		    	$pricetotal=$rh1[rate];
		    	$ivname=$rh1[ivid];
		    		PatientManager::billingLog("$patientid","$prescriptionid","Investigation_charge","$ivid$Investigation","patient_investigation_invoice.php?prescriptionid=$prescriptionid&patientid=$patientid","$pricetotal","","","$paymentmode","$status","$entered_by");
		    	
$DisplayForm=True;
$sql1 ="SELECT * FROM investigation WHERE prescriptionid='$_GET[prescriptionid]'";
		$qsql1 = mysqli_query($con,$sql1);
		while($rh1 = mysqli_fetch_array($qsql1))
		{
	$DisplayForm=False;
echo "";
}
if($DisplayForm)
{
PatientManager::setActivityLog($patientid,"$prescriptionid","Opd Slip<br>Request for investigation","showpage_investigation.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
} else{
  
}
$updated_at=date("Y-m-d");
$created_at=date("F d, Y / h:i:s A");


$Admitted= date("Y-m-d");
$Time= date('H:i:s');


$sql="INSERT INTO investigation(id,prescriptionid,patientid,hospital_id,Raised_at,Investigation_type,Category,Sub_Category,Priority_slip,Investigation,ivid,Result,Evidence,AdmittedDate, TimeIn,entered_by,created_at,updated_at) VALUES (NULL,'$prescriptionid', '$patientid','$hospital_id','$Raised_at','$Investigation_type','$Category','$Sub_Category','$Priority_slip','$Investigation','$ivid','$Result','$Evidence','$Admitted','$Time','$entered_by','$created_at','$updated_at')";
$result=mysqli_query($link,$sql);
if(!$result)
	return false;
$sql ="select last_insert_id() from investigation";
$result=mysqli_query($link,$sql);
if(!$result)
	return false;
$row=mysqli_fetch_row($result);
$id=$row[0];
	$result=mysqli_query($link,$sql);
		
if($result)
echo "<script>alert('$Investigation add successfully..');</script><script>window.location='testopdslip2.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}


public static function NutritionRecommendation($prescriptionid,$patientid,$weight,$Present_Nutritional,$Nutritional_Status,$Maintain_BP,$Blood_Sugar,$Reduce_Cholesterol,$Energy,$Protein,$Fat,$note,$enteredby)
{
	echo "";
	$link=DBManager::connect();
		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
		$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
	PatientManager::setActivityLog($patientid,"$prescriptionid","Opd Slip<br>Nutrition Recommendation","showpage_Nutrition_Recommendation.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
$sql="INSERT INTO Nutrition_Recommendation(id,prescriptionid,patientid,weight,Present_Nutritional,Nutritional_Status,Maintain_BP,Blood_Sugar,Reduce_Cholesterol,Energy,Protein,Fat,note,entered_by,created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$weight','$Present_Nutritional','$Nutritional_Status','$Maintain_BP','$Blood_Sugar','$Reduce_Cholesterol','$Energy','$Protein','$Fat','$note','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('Add successfully..');</script><script>window.location='test_Nutrition_Recommendation.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}


public static function Medicalvitals($prescriptionid,$patientid,$Bmi,$Wt,$SPo2,$RBS,$Temp,$Pulse,$BP,$BP2,$stopid,$entered_by)
{
	echo "";
	$link=DBManager::connect();
			$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
		$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
	PatientManager::setActivityLog($patientid,"$prescriptionid","Intial Assessment<br>Vitals","showpage_vitals.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
			PatientManager::vilalslog("$prescriptionid","$patientid","$Wt","$Bmi","$BP","$BP2","$Temp","$RBS","$SPo2","unknown","$Pulse","Medical Assessment","$entered_by");
				PatientManager::updatetatLogvitals("$patientid","$prescriptionid","Consultant_fees","$casetype","drinvace.php?prescriptionid=$prescriptionid&patientid=$patientid","$rh1[ipd_visit_fee]","grand_total","q","w","ee","$Admitted_Under",""); 
	$sql="INSERT INTO Medical_vitals(id,prescriptionid,patientid,Bmi,Wt,SPo2,RBS,Temp,Pulse,BP,BP2,stopid,entered_by, created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$Bmi','$Wt','$SPo2','$RBS','$Temp','$Pulse','$BP','$BP2','$stopid','$entered_by','$created_at','$updated_at')";
	$sql1 ="UPDATE patient SET Weight='$Wt' WHERE patientid='$patientid'";
$result=mysqli_query($link,$sql1);
	$result=mysqli_query($link,$sql);
	
if($result)

echo "<script>alert('Vitals add successfully..');</script><script>window.location='RequestforAdmissionset.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}

public static function updatetatLogvitals($patientid,$prescriptionid,$discription,$pagetype,$hospital_id,$start_date,$stop_date,$start_time,$stop_time,$solution,$entered_by,$currenctive_by)
{
	$link=DBManager::connect();
	 date_default_timezone_set('Asia/Kolkata');
$timeva=time();
$pavam=date( "H:i:s","$timeva");
$sjdjs=date('Y/m/d H:i:s');
$sql ="UPDATE tat SET stop_date='$sjdjs',stop_time='$pavam'  WHERE prescriptionid='$_GET[prescriptionid]' AND 	pagetype='Vitals'";
$result=mysqli_query($link,$sql);
if($result)
echo "";
else 
	echo "";
	$link=DBManager::close($link);
}

public static function vilalslog($prescriptionid,$patientid,$Wt,$bmi,$BP,$BP2,$Temp,$RBS,$Spo2,$HR,$Pulse,$poa,$entered_by)
{
   $updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
	$sql="INSERT INTO vitals_final(id,prescriptionid,patientid,Wt,bmi,BP,BP2,Temp,RBS,Spo2,HR,Pulse,poa,entered_by,created_at,updated_at) VALUES (NULL, '$prescriptionid','$patientid','$Wt','$bmi','$BP','$BP2','$Temp','$RBS','$Spo2','$HR','$Pulse','$poa','$entered_by','$created_at','$updated_at')";
	$link=DBManager::connect();
	$sql1 ="UPDATE patient SET Weight='$Wt' WHERE patientid='$patientid'";
$result=mysqli_query($link,$sql1);
	$result=mysqli_query($link,$sql);

if($result)



	if($result)
		echo "<div class='alert alert-success'>
  <strong>Success!</strong> Add vital a successful.
</div>";
	else 
		echo "Fail";
		$link=DBManager::close($link);
	}


public static function ObstetricHistory($prescriptionid,$patientid,$hs_years,$hs_of,$mode,$outcome,$incident,$Gender,$wt,$conducted,$complication,$entered_by)
{
	$link=DBManager::connect();
	    $narayan=LoginManager::currentUser();
$harilal=LoginManager::getUserTypeByuname("$narayan");
$entered_by=$harilal;
$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
	$sql="INSERT INTO Obstetric_History(id,prescriptionid,patientid,hs_years,hs_of,mode,outcome,incident,Gender,wt,conducted,complication,entered_by,created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$hs_years','$hs_of','$mode','$outcome','$incident','$Gender','$wt','$conducted','$complication','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('Obstetric History add successfully..');</script><script>window.location='RequestforAdmissionset.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}

public static function Vulnerability($prescriptionid,$patientid,$Insulin_dependent,$Insulin_specify,$Last_menstrual_period,$Gravida,$Para,$Abortion,$Cesarean,$Child_alive,$Death,$Level_Consciousness,$Eye_Opening_Response,$Best_Verbal_Response,$Best_Motor_Response,$Dependency,$Modn,$Vulnevilty_Assessment,$Pain_Assessment,$Pain_Location,$Pain_Location1,$Pain_Location2,$Pain_Location3,$Pain_Location4,$Pain_Location5,$other_pain_location,$fall_risk,$low_fall_risk,$high_fall_risk,$implement_low,$Complete_paralysis,$History_more,$Patient_experienced,$deemed_high,$entered_by)
{

	$link=DBManager::connect();
			$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
		$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
	PatientManager::setActivityLog($patientid,"$prescriptionid","Intial Assessment<br>Vulnerability Assessment","showpage_Vulnerability_Assessment.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
	$sql="INSERT INTO Vulnerability(id,prescriptionid,patientid,Insulin_dependent,Insulin_specify,Last_menstrual_period,Gravida,Para,Abortion,Cesarean,Child_alive,Death,Level_Consciousness,Eye_Opening_Response,Best_Verbal_Response,Best_Motor_Response,Dependency,Modn,Vulnevilty_Assessment,Pain_Assessment,Pain_Location,Pain_Location1,Pain_Location2,Pain_Location3,Pain_Location4,Pain_Location5,other_pain_location,fall_risk,low_fall_risk,high_fall_risk,implement_low,Complete_paralysis,History_more,Patient_experienced,deemed_high,entered_by, created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$Insulin_dependent','$Insulin_specify','$Last_menstrual_period','$Gravida','$Para','$Abortion','$Cesarean','$Child_alive','$Death','$Level_Consciousness','$Eye_Opening_Response','$Best_Verbal_Response','$Best_Motor_Response','$Dependency','$Modn','$Vulnevilty_Assessment','$Pain_Assessment','$Pain_Location','$Pain_Location1','$Pain_Location2','$Pain_Location3','$Pain_Location4','$Pain_Location5','$other_pain_location','$fall_risk','$low_fall_risk','$high_fall_risk','$implement_low','$Complete_paralysis','$History_more','$Patient_experienced','$deemed_high','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('Vulnerability Assessment add successfully..');</script><script>window.location='RequestforAdmissionset.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}

public static function Medicalsurgical($prescriptionid,$patientid,$Information_Obtained_from,$specify,$relation,$Addiction,$Alcohol,$Smoking,$Tobacco,$entered_by)
{

	$link=DBManager::connect();
			$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
		$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
	PatientManager::setActivityLog($patientid,"$prescriptionid","Intial Assessment<br>Medical and surgical History","showpage_Medical_surgical_History.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
	$sql="INSERT INTO Medical_surgical(id,prescriptionid,patientid,Information_Obtained_from,specify,relation,Addiction,Alcohol,Smoking,Tobacco,entered_by, created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$Information_Obtained_from','$specify','$relation','$Addiction','$Alcohol','$Smoking','$Tobacco','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('Medical and surgical History add successfully..');</script><script>window.location='RequestforAdmissionset.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}




public static function Requesttraumachecklist($prescriptionid,$patientid,$further,$Pneumo_Haemothorax,$Fluids_Started,$iv_fluids_started,$Full_Survey,$Perineum,$Back,$Pelvic_Fracture,$Internal_Bleeding,$Ultrasound,$CT,$Peritoneal,$Spinal_Immobilization,$Neurovascular_Status,$Hypothermic,$contraindication,$Nasogastric_Tube,$Chest_Drain,$None_Indicated,$leaves_patient,$Analgesics,$Antibiotics,$None_Indicated2,$tests_imaging,$Examinations,$Abdominal,$vascular,$care_discussed,$Receiving_Unit,$Primary_team,$Other_Specialists,$Trauma_Chart,$Trauma_Slip,$entered_by)
{

	$link=DBManager::connect();
			$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
		$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
	PatientManager::setActivityLog($patientid,"$prescriptionid","Intial Assessment<br>Trauma Checklist","showpage_traumachecklist.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
	$sql="INSERT INTO trauma_checklist(id,prescriptionid,patientid,further,Pneumo_Haemothorax,Fluids_Started,iv_fluids_started,Full_Survey,Perineum,Back,Pelvic_Fracture,Internal_Bleeding,Ultrasound,CT,Peritoneal,Spinal_Immobilization,Neurovascular_Status,Hypothermic,contraindication,Nasogastric_Tube,Chest_Drain,None_Indicated,leaves_patient,Analgesics,Antibiotics,None_Indicated2,tests_imaging,Examinations,Abdominal,vascular,care_discussed,Receiving_Unit,Primary_team,Other_Specialists,Trauma_Chart,Trauma_Slip,entered_by, created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$further','$Pneumo_Haemothorax','$Fluids_Started','$iv_fluids_started','$Full_Survey','$Perineum','$Back','$Pelvic_Fracture','$Internal_Bleeding','$Ultrasound','$CT','$Peritoneal','$Spinal_Immobilization','$Neurovascular_Status','$Hypothermic','$contraindication','$Nasogastric_Tube','$Chest_Drain','$None_Indicated','$leaves_patient','$Analgesics','$Antibiotics','$None_Indicated2','$tests_imaging','$Examinations','$Abdominal','$vascular','$care_discussed','$Receiving_Unit','$Primary_team','$Other_Specialists','$Trauma_Chart','$Trauma_Slip','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('Trauma Checklist add successfully..');</script><script>window.location='RequestforAdmissionset.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}




public static function dischargetry($prescriptionid,$patientid,$hospital_id,$typevisit,$status,$COdischarge,$Advice_Discharge,$admissiondate,$created_by,$entered_by)
{
	echo "";
	$link=DBManager::connect();
	  $narayan=LoginManager::currentUser();
$harilal=LoginManager::getUserTypeByuname("$narayan");
$entered_by=$harilal;
$admissiondate=date("Y-m-d");
$updated_at=date("Y-m-d");
$created_at=date("F d, Y / h:i:s A");
$time=date("H:i:s");


		  	$sql="INSERT INTO discharge(id,prescriptionid,patientid,hospital_id,typevisit,status,COdischarge,Advice_Discharge,created_by,admissiondate,TimeIn,entered_by,created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$hospital_id','$typevisit','$status','$COdischarge','$Advice_Discharge','$created_by','$admissiondate','$time','$entered_by','$created_at','$updated_at')";
		$result=mysqli_query($link,$sql);
if($result)
	$link=DBManager::close($link);
}


//START TAT LOG//
public static function tatLog($patientid,$prescriptionid,$discription,$pagetype,$hospital_id,$start_date,$stop_date,$start_time,$stop_time,$solution,$entered_by,$currenctive_by)
{
 date_default_timezone_set('Asia/Kolkata');
$timeva=time();
$pavam=date( "H:i:s","$timeva");
$start_date=date('Y/m/d H:i:s');

$narayan=LoginManager::currentUser();
$harilal=LoginManager::getUserTypeByuname("$narayan");
$entered_by=$harilal;

$sql1 ="SELECT * FROM site_users WHERE userno='$entered_by'";
		$qsql1 = mysqli_query($link,$sql1);
		if($rh1 = mysqli_fetch_array($qsql1))
		

	$sql="INSERT INTO tat(tatid,patientid,prescriptionid,discription,pagetype,hospital_id,start_date,stop_date,start_time,stop_time,solution,entered_by,reported_at,currenctive_at,currenctive_by,updated_at) VALUES (NULL, '$patientid','$prescriptionid','$discription','$pagetype','$rh1[entered_by]','$start_date','$stop_date','$pavam','$stop_time','$solution','$entered_by',now(),'$currenctive_at','$currenctive_by',now())";
	$link=DBManager::connect();
	$result=mysqli_query($link,$sql);
	if($result)
		$link=DBManager::close($link);
	}


public static function transferbedpatient($prescriptionid,$towords,$datetime)
{
   $datetime=date("Y-m-d H:i:s");
	$sql="INSERT INTO transferbed(srno,prescriptionid,towords,datetime) VALUES (NULL, '$prescriptionid','$towords','$datetime')";
	$link=DBManager::connect();

	$result=mysqli_query($link,$sql);
	if($result)
		$insid= mysqli_insert_id($link);
			$srid= $insid;
		$link=DBManager::close($link);
	}


public static function updatebedindex($wardid,$bedname,$price,$status,$prescriptionid)
{

	$link=DBManager::connect();
	$sql ="UPDATE bedindex SET status='Inactive',prescriptionid='$prescriptionid'  WHERE  bedid='$_POST[Bed]'";
	$result=mysqli_query($link,$sql);
if($result)
{
}
else 
{
	echo "Fail";
	$link=DBManager::close($link);
}
}




//Start Patient Information //



public static function billingLog($patientid,$prescriptionid,$discription,$pagetype,$link,$pricetotal,$discount,$grand_total,$paymentmode,$status,$enteredby)
{
    $updated_at=date("Y-m-d");
    $created_at=date("F d, Y / h:i:s A");
	$sql="INSERT INTO patient_invace(invaceid,patientid,prescriptionid,discription,pagetype,link,pricetotal,discount,grand_total,paymentmode,status,entered_by,created_at,updated_at) VALUES (NULL, '$patientid','$prescriptionid','$discription','$pagetype','$link','$pricetotal','$discount','$grand_total','$paymentmode','$status','$enteredby','$created_at','$updated_at')";
	$link=DBManager::connect();
	$result=mysqli_query($link,$sql);
	if($result)
		$link=DBManager::close($link);
	}




public static function setActivityLog($userno,$prescriptionid,$discription,$link,$enteredby)
{
	$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
	$sql="INSERT INTO save_activity(srno,userno,prescriptionid,discription,entered_by,link,created_at,updated_at) VALUES (NULL, '$userno','$prescriptionid','$discription<br>Doc.no-','$enteredby','$link',' $created_at','$updated_at')";
	$link=DBManager::connect();

	$result=mysqli_query($link,$sql);
	if($result){
		$insid= mysqli_insert_id($link);
			$srid= $insid;
		$link=DBManager::close($link);
	}

}





//START NEW  ADD AS PATIENT//

public static function testpatientfinal26MARC($patientid,$hospitalid,$typevisit,$casetype,$Admitted_Under,$triage,$P_Mode,$entered_by)
{
	echo "";
	$link=DBManager::connect();
	
$sql1 ="SELECT * FROM dr WHERE drid='$Admitted_Under'";
		$qsql1 = mysqli_query($link,$sql1);
		if($rh1 = mysqli_fetch_array($qsql1))
		
		
		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
			$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
	$admintedDate=date('Y-m-d');
	$time=date("H:i:s");
	
	 $CheckPatient = $link->query("SELECT * FROM addaspatient WHERE admintedDate = '$admintedDate' AND patientid = '$patientid' AND hospitalid='$hospitalid' AND Admitted_Under='$Admitted_Under' AND typevisit='$typevisit'");
$numSU=mysqli_num_rows($CheckPatient);
if($numSU > 0){
        echo "<script>alert('Already Exists');</script>";
    }else{ 
	
	
	$sql="INSERT INTO addaspatient(prescriptionid,patientid,hospitalid,typevisit,casetype,Admitted_Under,triage,P_Mode,entered_by, created_at,updated_at,admintedDate,TimeIn) VALUES (NULL,'$patientid','$hospitalid','$typevisit','$casetype','$Admitted_Under','$triage','$P_Mode','$entered_by','$created_at','$updated_at','$admintedDate','$time')";
		if($qsql = mysqli_query($link,$sql))
		{
			$insid= mysqli_insert_id($link);
			$prescriptionid= $insid;
			
		
		   PatientManager::dischargetry($prescriptionid,"$patientid","$hospitalid","$typevisit","Admission","","","","$admissiondate","$entered_by");
		   if($typevisit == 'OPD'){
  PatientManager::billingLog("$patientid","$prescriptionid","Consultant_fees","$casetype","drinvace.php?prescriptionid=$prescriptionid&patientid=$patientid","$rh1[Visit_fee]","discount","grand_total","paymentmode","status","$Admitted_Under");
	PatientManager::tatLog("$patientid","$prescriptionid","$casetype","OPD_Consultation","showtatlog.php?prescriptionid=$prescriptionid&patientid=$patientid","$rh1[ipd_visit_fee]","discount","grand_total","","","","$Admitted_Under");
	
	$opd_feedback="INSERT INTO `opd_feedback`(`prescriptionid`, `patientid`, `hospital_id`, `FO_id`, `Acc_id`, `Nurse_id`, `Pharma_Id`, `Doc_Id`, `FO_Accessibility`, `FO_Behavior`, `FO_Knowledge`, `Acc_Accessibility`, `Acc_Behavior`, `Acc_Knowledge`, `Bill_Consultation`, `Bill_Investigation`, `Bill_Medicine`, `Nurse_Accessibility`, `Nurse_Behavior`, `Nurse_Knowledge`, `WaitingPeriod`, `DocKnowledgeable`, `PharmaCheck`, `PharmaPolicy`, `CleannessWaitingArea`, `CleannessToilet`, `HosEnvironment`,`Counseling`, `EnteredBy`, `CreatedTime`,`CreateDate`, `Crated_At`,`Status`) VALUES ('$prescriptionid','$patientid','$hospitalid','null','null','null','null','null','null','null', 'null', 'null', 'null', 'null', 'null', 'null', 'null', 'null', 'null', 'null', 'null', 'null', 'null','null', 'null', 'null', 'null','', '$entered_by', '$time','$admintedDate','$created_at','0')";
			$OFB = mysqli_query($link,$opd_feedback);
			
			
            $opd_follow_up="INSERT INTO `opd_follow_up`(`prescriptionid`, `patientid`, `hospital_id`, `Outcome`, `ReactionInvestigation`, `SpecifyInvestigation`, `ReactionTreatment`, `SpecifyTreatment`, `Entered_By`, `CreatedTime`, `CreatedDate`, `CreatedAt`, `Status`) VALUES ('$prescriptionid','$patientid','$hospitalid','null','null','null','null','null','$entered_by','$time','$admintedDate','$created_at','0')";
			$OFU = mysqli_query($link,$opd_follow_up);
} elseif($typevisit == 'Opd_Emergency'){
   PatientManager::billingLog("$patientid","$prescriptionid","Consultant_fees","$casetype","drinvace.php?prescriptionid=$prescriptionid&patientid=$patientid","$rh1[opd_EMG_fee]","discount","grand_total","paymentmode","status","$Admitted_Under");
  
	PatientManager::tatLog("$patientid","$prescriptionid","$casetype","OPD_Consultation","showtatlog.php?prescriptionid=$prescriptionid&patientid=$patientid","$rh1[ipd_visit_fee]","discount","grand_total","","","","$Admitted_Under");
	$opd_feedback="INSERT INTO `opd_feedback`(`prescriptionid`, `patientid`, `hospital_id`, `FO_id`, `Acc_id`, `Nurse_id`, `Pharma_Id`, `Doc_Id`, `FO_Accessibility`, `FO_Behavior`, `FO_Knowledge`, `Acc_Accessibility`, `Acc_Behavior`, `Acc_Knowledge`, `Bill_Consultation`, `Bill_Investigation`, `Bill_Medicine`, `Nurse_Accessibility`, `Nurse_Behavior`, `Nurse_Knowledge`, `WaitingPeriod`, `DocKnowledgeable`, `PharmaCheck`, `PharmaPolicy`, `CleannessWaitingArea`, `CleannessToilet`, `HosEnvironment`,`Counseling`, `EnteredBy`, `CreatedTime`,`CreateDate`, `Crated_At`,`Status`) VALUES ('$prescriptionid','$patientid','$hospitalid','null','null','null','null','null','null','null', 'null', 'null', 'null', 'null', 'null', 'null', 'null', 'null', 'null', 'null', 'null', 'null', 'null','null', 'null', 'null', 'null','', '$entered_by', '$time','$admintedDate','$created_at','0')";
			$OFB = mysqli_query($link,$opd_feedback);
			
			
            $opd_follow_up="INSERT INTO `opd_follow_up`(`prescriptionid`, `patientid`, `hospital_id`, `Outcome`, `ReactionInvestigation`, `SpecifyInvestigation`, `ReactionTreatment`, `SpecifyTreatment`, `Entered_By`, `CreatedTime`, `CreatedDate`, `CreatedAt`, `Status`) VALUES ('$prescriptionid','$patientid','$hospitalid','null','null','null','null','null','$entered_by','$time','$admintedDate','$created_at','0')";
			$OFU = mysqli_query($link,$opd_follow_up);
}
elseif($typevisit == 'OPD_Routine'){
   PatientManager::billingLog("$patientid","$prescriptionid","Consultant_fees","$casetype","drinvace.php?prescriptionid=$prescriptionid&patientid=$patientid","$rh1[routin_fee]","discount","grand_total","paymentmode","status","$Admitted_Under");
  
	PatientManager::tatLog("$patientid","$prescriptionid","$casetype","OPD_Consultation","showtatlog.php?prescriptionid=$prescriptionid&patientid=$patientid","$rh1[ipd_visit_fee]","discount","grand_total","","","","$Admitted_Under");
	$opd_feedback="INSERT INTO `opd_feedback`(`prescriptionid`, `patientid`, `hospital_id`, `FO_id`, `Acc_id`, `Nurse_id`, `Pharma_Id`, `Doc_Id`, `FO_Accessibility`, `FO_Behavior`, `FO_Knowledge`, `Acc_Accessibility`, `Acc_Behavior`, `Acc_Knowledge`, `Bill_Consultation`, `Bill_Investigation`, `Bill_Medicine`, `Nurse_Accessibility`, `Nurse_Behavior`, `Nurse_Knowledge`, `WaitingPeriod`, `DocKnowledgeable`, `PharmaCheck`, `PharmaPolicy`, `CleannessWaitingArea`, `CleannessToilet`, `HosEnvironment`,`Counseling`, `EnteredBy`, `CreatedTime`,`CreateDate`, `Crated_At`,`Status`) VALUES ('$prescriptionid','$patientid','$hospitalid','null','null','null','null','null','null','null', 'null', 'null', 'null', 'null', 'null', 'null', 'null', 'null', 'null', 'null', 'null', 'null', 'null','null', 'null', 'null', 'null','', '$entered_by', '$time','$admintedDate','$created_at','0')";
			$OFB = mysqli_query($link,$opd_feedback);
			
			
            $opd_follow_up="INSERT INTO `opd_follow_up`(`prescriptionid`, `patientid`, `hospital_id`, `Outcome`, `ReactionInvestigation`, `SpecifyInvestigation`, `ReactionTreatment`, `SpecifyTreatment`, `Entered_By`, `CreatedTime`, `CreatedDate`, `CreatedAt`, `Status`) VALUES ('$prescriptionid','$patientid','$hospitalid','null','null','null','null','null','$entered_by','$time','$admintedDate','$created_at','0')";
			$OFU = mysqli_query($link,$opd_follow_up);
}
elseif($typevisit == 'Ipd_Emergency'){
 //elseif($typevisit == 'IPD'){   
   PatientManager::billingLog("$patientid","$prescriptionid","Consultant_fees","$casetype","drinvace.php?prescriptionid=$prescriptionid&patientid=$patientid","$rh1[ipd_EMG_fee]","discount","grand_total","paymentmode","status","$Admitted_Under");
	PatientManager::tatLog("$patientid","$prescriptionid","$casetype","Emergency_care","showtatlog.php?prescriptionid=$prescriptionid&patientid=$patientid","$rh1[ipd_visit_fee]","discount","grand_total","","","","$Admitted_Under");
		PatientManager::tatLog("$patientid","$prescriptionid","$casetype","Bed_Allotment","showtatlog.php?prescriptionid=$prescriptionid&patientid=$patientid","$rh1[ipd_visit_fee]","discount","grand_total","","","","$Admitted_Under");
$ipd_feedback="INSERT INTO `ipd_feedback`(`prescriptionid`, `patientid`, `hospital_id`,`type`, `FO_id`, `MO_id`, `Nurse_id`, `All_Nurse_Id`, `Doc_Id`, `FO_Accessibility`, `FO_Behavior`, `FO_Knowledge`, `MO_Accessibility`, `MO_Behavior`, `MO_Knowledge`, `hos_Consultation`, `hos_Investigation`, `hos_Medicine`, `Nurse_Accessibility`, `Nurse_Behavior`, `Nurse_Knowledge`, `All_Nurse_Accessibility`, `All_Nurse_Behavior`, `All_Nurse_Knowledge`, `doctor`, `Dietician`, `counselor`, `EnteredBy`, `CreatedTime`, `CreateDate`, `Crated_At`, `Status`) VALUES ('$prescriptionid','$patientid','$hospitalid','IPD','null','null','null','null','null','null','null','null','null','null','null','null','null','null','null','null','null','null','null','null','null','null','null','$entered_by','$time','$admintedDate','$created_at','0')";
$IFB = mysqli_query($link,$ipd_feedback);



			
}
else{
   PatientManager::billingLog("$patientid","$prescriptionid","Consultant_fees","$casetype","drinvace.php?prescriptionid=$prescriptionid&patientid=$patientid","$rh1[ipd_visit_fee]","discount","grand_total","paymentmode","status","$Admitted_Under");
   PatientManager::tatLog("$patientid","$prescriptionid","$casetype","Bed_Allotment","showtatlog.php?prescriptionid=$prescriptionid&patientid=$patientid","$rh1[ipd_visit_fee]","discount","grand_total","","","","$Admitted_Under");
   $ipd_feedback="INSERT INTO `ipd_feedback`(`prescriptionid`, `patientid`, `hospital_id`,`type`, `FO_id`, `MO_id`, `Nurse_id`, `All_Nurse_Id`, `Doc_Id`, `FO_Accessibility`, `FO_Behavior`, `FO_Knowledge`, `MO_Accessibility`, `MO_Behavior`, `MO_Knowledge`, `hos_Consultation`, `hos_Investigation`, `hos_Medicine`, `Nurse_Accessibility`, `Nurse_Behavior`, `Nurse_Knowledge`, `All_Nurse_Accessibility`, `All_Nurse_Behavior`, `All_Nurse_Knowledge`, `doctor`, `Dietician`, `counselor`, `EnteredBy`, `CreatedTime`, `CreateDate`, `Crated_At`, `Status`) VALUES ('$prescriptionid','$patientid','$hospitalid','IPD','null','null','null','null','null','null','null','null','null','null','null','null','null','null','null','null','null','null','null','null','null','null','null','$entered_by','$time','$admintedDate','$created_at','0')";
$IFB = mysqli_query($link,$ipd_feedback);
}
 	PatientManager::tatLog("$patientid","$prescriptionid","$casetype","Add_As_Patient_Page","showtatlog.php?prescriptionid=$prescriptionid&patientid=$patientid","$rh1[ipd_visit_fee]","discount","grand_total","","","","$Admitted_Under");
	PatientManager::tatLog("$patientid","$prescriptionid","$casetype","Vitals","showtatlog.php?prescriptionid=$prescriptionid&patientid=$patientid","$rh1[ipd_visit_fee]","discount","grand_total","","","","$Admitted_Under");

		
		   
		   
		   		echo "<script>window.location='document_verify.php?prescriptionid=" . $insid . "&patientid=$_GET[patientid]';</script>";
		}
    
		else
		{
			echo mysqli_error($link);
		}
	$link=DBManager::close($link);
}
}
// END TRIAE FINAL//




// Start Final Discharge//

public static function discharge($prescriptionid,$patientid,$hospital_id,$status,$COdischarge,$Advice_Discharge,$created_by,$entered_by)
{
	echo "";
	$link=DBManager::connect();
	  $narayan=LoginManager::currentUser();
$harilal=LoginManager::getUserTypeByuname("$narayan");
$entered_by=$harilal;
$Todaydate= date('Y-m-d');
		   PatientManager::setActivityLog($patientid,"$prescriptionid","Discharge","showinvestigation.php?prescriptionid=$prescriptionid&patientid=$patientid","$entered_by");
		  		 PatientManager::updatebedindexdext("$wardid","$bedname","$price","$status","$prescriptionid");
$sql ="UPDATE discharge SET status='$status',  COdischarge='$COdischarge', Advice_Discharge='$Advice_Discharge',DurationDate='$Todaydate', created_by='$created_by' WHERE prescriptionid=$_GET[prescriptionid] AND patientid='$_GET[patientid]'";
		$result=mysqli_query($link,$sql);
if($result)
// echo "<script>window.location='patient_basic.php?patientid=$patientid';</script>;</script>";
echo "<script>window.location='show_discharge_summery.php?prescriptionid=$prescriptionid&patientid=$patientid';</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}


// Start Final Discharge//

//start bed index //
public static function updatebedindexdext($wardid,$bedname,$price,$status,$prescriptionid)
{

	$link=DBManager::connect();
	$sql ="UPDATE bedindex SET status='Active',prescriptionid='' WHERE  prescriptionid='$prescriptionid'";
	$result=mysqli_query($link,$sql);
if($result)
{
}
else 
{
	echo "Fail";
	$link=DBManager::close($link);
}
}
//end bed index//

//Start Covid Chekclist //

public static function covidchecklist($prescriptionid,$patientid,$symptoms_fever,$difficulty_breathing,$country_days,$other_cities,$two_weeks,$health_facility,$entered_by)
{

	$link=DBManager::connect();
		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
  $updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
   date_default_timezone_set('Asia/Calcutta'); 
$date =date("Y-m-d"); // time in India
$time=date("H:i:s");
	$sql="INSERT INTO CovidChecklist(id,prescriptionid,patientid,symptoms_fever,difficulty_breathing,country_days,other_cities,two_weeks,health_facility,addmited_date,TimeIn,entered_by, created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$symptoms_fever','$difficulty_breathing','$country_days','$other_cities','$two_weeks','$health_facility','$date','$time','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
{
	$insid= mysqli_insert_id($link);
			$docid= $insid;
	PatientManager::setActivityLog($patientid,"$prescriptionid","Intial Assessment<br>Covid 19 Checklist","showpage_CovidChecklist.php?prescriptionid=$prescriptionid&patientid=$patientid","$entered_by");
echo "<script>alert('Covid 19 Checklist add successfully..');</script><script>window.location='RequestforAdmissionset.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
}
else 
{
	echo "Fail";
	$link=DBManager::close($link);
}
}


//END COVID CHECKLIST//
//Patient Request for Admission//

public static function RequestConsultation($prescriptionid,$patientid,$pagetype,$typepage,$Ward,$Bed,$Type_of_Admission,$Reason_for_Admission,$MLC,$MLC_No,$Upload_MLC_Slip,$Trauma,$further,$Pneumo_Haemothorax,$Fluids_Started,$iv_fluids_started,$Full_Survey,$Perineum,$Back,$Pelvic_Fracture,$Internal_Bleeding,$Ultrasound,$CT,$Peritoneal,$Spinal_Immobilization,$Neurovascular_Status,$Hypothermic,$contraindication,$Nasogastric_Tube,$Chest_Drain,$None_Indicated,$leaves_patient,$Analgesics,$Antibiotics,$None_Indicated2,$tests_imaging,$Examinations,$Abdominal,$vascular,$care_discussed,$Receiving_Unit,$Primary_team,$Other_Specialists,$Trauma_Chart,$Trauma_Slip,$Code_Blue,$Subjective,$First_Responder,$Establishes_unresponsiveness,$Drills_code,$Lower_Bed,$Universal_Precautions,$initiate_compressions,$Airway_Assess,$Carotid_femoral,$Breathing_Bag,$Airway_placement,$Second_Responder,$Crash_cart,$Sick_board,$Applies_multifunction,$Monitor_PROMPTS,$Proceed_defibrillation,$ACLS_qualified,$Interprets_rhythm,$Third_Responder_BLS,$suction_equipment,$intubation_tray,$Establishes_Access,$Contain_patient,$med_tray,$Fourth_fifth_responders,$Verbalizes_Method,$Communicates_Family,$Complete_CodeBlue,$Secure_codestatement,$cov,$symptoms_fever,$difficulty_breathing,$country_days,$other_cities,$two_weeks,$health_facility,$Safe_childbirth_checklist,$mother_need_referral,$Partograph_started,$start_Antibiotics,$antihypertensive_treatment,$vaginal_exam,$present_at_birth,$labour_needed,$Information_Obtained_from,$General_Consent_Signed,$Upload_Consent,$referred_by,$ID_Band_tied,$Rights_Responsibilities,$surroundings_safety,$entered_by)
{

	$link=DBManager::connect();
		include("dbconnection.php");
   $narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
		$sql1 ="SELECT * FROM site_users WHERE userno='$anilka'";
		$qsql1 = mysqli_query($con,$sql1);
		if($re = mysqli_fetch_array($qsql1))

	$sql212 ="SELECT * FROM tarifrate WHERE tarifid='5' AND hospitalid='$re[entered_by]' AND (wardid='$Ward' OR wardid!='$Ward')";
$qsql212 = mysqli_query($con,$sql212);
if($rs112 = mysqli_fetch_array($qsql212))

	$updated_at=date("F d, Y / h:i:s A");
   $created_at=date("F d, Y / h:i:s A");
	PatientManager::tatLog("$patientid","$prescriptionid","$casetype","opd_Consultation","drinvace.php?prescriptionid=$prescriptionid&patientid=$patientid","$rh1[ipd_visit_fee]","discount","grand_total","","","","$Admitted_Under"); 
	PatientManager::setActivityLog($patientid,"$prescriptionid","Intial Assessment<br>Request for Consultation","showpage_Request_for_Consultation.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
	 if(is_numeric($Bed))
	 {
	 PatientManager::billingLog("$patientid","$prescriptionid","Admission_fees","$casetype","admissioninvoice.php?prescriptionid=$prescriptionid&patientid=$patientid","$rs112[rate]","discount","grand_total","paymentmode","status","$entered_by");
	 PatientManager::updatebedindex("$wardid","$bedname","$price","$status","$prescriptionid");
	 }
	 if(is_numeric($Bed))
	 {
	 PatientManager::transferbedpatient("$prescriptionid","$Bed","$datetime");
	 }



$AllotedDate= date('Y-m-d');
	$sql="INSERT INTO request_for_admission(id,prescriptionid,patientid,pagetype,typepage,Ward,Bed,Type_of_Admission,Reason_for_Admission,MLC,MLC_No,Upload_MLC_Slip,Trauma,further,Pneumo_Haemothorax,Fluids_Started,iv_fluids_started,Full_Survey,Perineum,Back,Pelvic_Fracture,Internal_Bleeding,Ultrasound,CT,Peritoneal,Spinal_Immobilization,Neurovascular_Status,Hypothermic,contraindication,Nasogastric_Tube,Chest_Drain,None_Indicated,leaves_patient,Analgesics,Antibiotics,None_Indicated2,tests_imaging,Examinations,Abdominal,vascular,care_discussed,Receiving_Unit,Primary_team,Other_Specialists,Trauma_Chart,Trauma_Slip,Code_Blue,Subjective,First_Responder,Establishes_unresponsiveness,Drills_code,Lower_Bed,Universal_Precautions,initiate_compressions,Airway_Assess,Carotid_femoral,Breathing_Bag,Airway_placement,Second_Responder,Crash_cart,Sick_board,Applies_multifunction,Monitor_PROMPTS,Proceed_defibrillation,ACLS_qualified,Interprets_rhythm,Third_Responder_BLS,suction_equipment,intubation_tray,Establishes_Access,Contain_patient,med_tray,Fourth_fifth_responders,Verbalizes_Method,Communicates_Family,Complete_CodeBlue,Secure_codestatement,cov,symptoms_fever,difficulty_breathing,country_days,other_cities,two_weeks,health_facility,Safe_childbirth_checklist,mother_need_referral,Partograph_started,start_Antibiotics,antihypertensive_treatment,vaginal_exam,present_at_birth,labour_needed,Information_Obtained_from,General_Consent_Signed,Upload_Consent,referred_by,ID_Band_tied,Rights_Responsibilities,surroundings_safety,hospitalId,entered_by, created_at,updated_at,rate,AllotedDate) VALUES (NULL,'$prescriptionid','$patientid','$pagetype','$typepage','$Ward','$Bed','$Type_of_Admission','$Reason_for_Admission','$MLC','$MLC_No','$Upload_MLC_Slip','$Trauma','$further','$Pneumo_Haemothorax','$Fluids_Started','$iv_fluids_started','$Full_Survey','$Perineum','$Back','$Pelvic_Fracture','$Internal_Bleeding','$Ultrasound','$CT','$Peritoneal','$Spinal_Immobilization','$Neurovascular_Status','$Hypothermic','$contraindication','$Nasogastric_Tube','$Chest_Drain','$None_Indicated','$leaves_patient','$Analgesics','$Antibiotics','$None_Indicated2','$tests_imaging','$Examinations','$Abdominal','$vascular','$care_discussed','$Receiving_Unit','$Primary_team','$Other_Specialists','$Trauma_Chart','$Trauma_Slip','$Code_Blue','$Subjective','$First_Responder','$Establishes_unresponsiveness','$Drills_code','$Lower_Bed','$Universal_Precautions','$initiate_compressions','$Airway_Assess','$Carotid_femoral','$Breathing_Bag','$Airway_placement','$Second_Responder','$Crash_cart','$Sick_board','$Applies_multifunction','$Monitor_PROMPTS','$Proceed_defibrillation','$ACLS_qualified','$Interprets_rhythm','$Third_Responder_BLS','$suction_equipment','$intubation_tray','$Establishes_Access','$Contain_patient','$med_tray','$Fourth_fifth_responders','$Verbalizes_Method','$Communicates_Family','$Complete_CodeBlue','$Secure_codestatement','$cov','$symptoms_fever','$difficulty_breathing','$country_days','$other_cities','$two_weeks','$health_facility','$Safe_childbirth_checklist','$mother_need_referral','$Partograph_started','$start_Antibiotics','$antihypertensive_treatment','$vaginal_exam','$present_at_birth','$labour_needed','$Information_Obtained_from','$General_Consent_Signed','$Upload_Consent','$referred_by','$ID_Band_tied','$Rights_Responsibilities','$surroundings_safety','$re[entered_by]','$entered_by','$created_at','$updated_at','$rs112[rate]','$AllotedDate')";
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('Request for Consultation add successfully..');</script><script>window.location='RequestforAdmissionset.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}

//Star mlc//
public static function Requestmlc($prescriptionid,$patientid,$MLC_No,$Upload_MLC_Slip,$entered_by)
{

	$link=DBManager::connect();
		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
		$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
	PatientManager::setActivityLog($patientid,"$prescriptionid","Intial Assessment<br>MLC Checklist","showpage_mlc.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
	$sql="INSERT INTO mlc(id,prescriptionid,patientid,MLC_No,Upload_MLC_Slip,entered_by, created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$MLC_No','$Upload_MLC_Slip','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('MLC Records add successfully..');</script><script>window.location='RequestforAdmissionset.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}
//end Mlc//

public static function AdmissionConsent($prescriptionid,$patientid,$towords,$Upload_Consent,$entered_by)
{

	$link=DBManager::connect();
		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
	$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
	PatientManager::setActivityLog($patientid,"$prescriptionid","Intial Assessment<br>Admission Consent","show_AdmissionConsent.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
	$sql="INSERT INTO AdmissionConsent(id,prescriptionid,patientid,towords,Upload_Consent,entered_by, created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','Null','$Upload_Consent','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('Admission Consent Upload  successfully..');</script><script>window.location='RequestforAdmissionset.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}

//Transfer TO IPD//
public static function tripd($prescriptionid,$patientid,$hospital_id,$status,$COdischarge,$Advice_Discharge,$created_by,$entered_by)
{
	echo "";
	$link=DBManager::connect();
	  $narayan=LoginManager::currentUser();
$harilal=LoginManager::getUserTypeByuname("$narayan");
$entered_by=$harilal;
		   PatientManager::setActivityLog($patientid,"$prescriptionid","Discharge","showinvestigation.php?prescriptionid=$prescriptionid&patientid=$patientid","$entered_by");
$sql ="UPDATE discharge SET status='$status',  COdischarge='$COdischarge', Advice_Discharge='$Advice_Discharge', created_by='$created_by' WHERE patientid='$_GET[patientid]'";
		$result=mysqli_query($link,$sql);
if($result)
echo "<script>window.location='addpatientrecodsipd.php?patientid=$patientid';</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}

//Transfer to IPD//
// Start Patient Refferal//


public static function patientreferral($prescriptionid,$patientid,$hs_referral,$location,$Phone,$Email,$Accompanied,$Primary_Diagnosis,$Treatments_initiated,$Types_Patient,$Transportation_needs,$Follow_up_requirements,$Mobility,$Self_care,$Cognitive_impairment,$Assistive_devices_provide,$Assistive_required,$Nurse_Name,$entered_by)
{

	$link=DBManager::connect();
		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
//   $updated_at=date("Y-m-d");
//   $created_at=date("F d, Y / h:i:s A");
   $updated_at = date("Y-m-d");
   $created_at = date("Y-m-d");
	$sql="INSERT INTO patient_referral(id,prescriptionid,patientid,hs_referral,location,Phone,Email,Accompanied,Primary_Diagnosis,Treatments_initiated,Types_Patient,Transportation_needs,Follow_up_requirements,Mobility,Self_care,Cognitive_impairment,Assistive_devices_provide,Assistive_required,Nurse_Name,entered_by,created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$hs_referral','$location','$Phone','$Email','$Accompanied','$Primary_Diagnosis','$Treatments_initiated','$Types_Patient','$Transportation_needs','$Follow_up_requirements','$Mobility','$Self_care','$Cognitive_impairment','$Assistive_devices_provide','$Assistive_required','$Nurse_Name','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
{
	$insid= mysqli_insert_id($link);
			$docid= $insid;
	PatientManager::setActivityLog($patientid,"$prescriptionid","Patient Referral","showpage_patient_referral.php?prescriptionid=$prescriptionid&patientid=$patientid&id=$insid&srno=","$entered_by");
echo "<script>alert('Patient Referral add successfully..');</script><script>window.location='showpage_patient_referral.php?prescriptionid=$prescriptionid&patientid=$patientid&id=$insid'</script>;</script>";
}
else 
{
	echo "Fail";
	$link=DBManager::close($link);
}
}




//End Patient Refferal//

//Start TRANSFER And Referal //

public static function transferreferal($prescriptionid,$patientid,$Transfer_IPD,$Word,$Bed,$Referred_To,$Name_Hospital,$Name_of_Consultant,$followup,$followup_date,$enteredby)
{
    $updated_at=date("Y-m-d");
$created_at=date("F d, Y / h:i:s A");
	echo "";
	$link=DBManager::connect();
		   PatientManager::setActivityLog($patientid,"$prescriptionid","Transfer Referal","showtransferandreferal.php?prescriptionid=$prescriptionid&patientid=$patientid","$entered_by");
	$sql="INSERT INTO transferreferal(srno,prescriptionid,patientid,Transfer_IPD,Word,Bed,Referred_To,Name_Hospital,Name_of_Consultant,followup,followup_date,entered_by,created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$Transfer_IPD','$Word','$Bed','$Referred_To','$Name_Hospital','$Name_of_Consultant','$followup','$followup_date','$enteredby','$created_at','$updated_at')";
		$result=mysqli_query($link,$sql);
			PatientManager::appoimentbook("$patientid","$Name_Hospital","$patientname","$VisitConsultant","$Specialty","$Selectstate","$Selectdistrict","$hospitalname","$Name_of_Consultant","$Payment","$followup_date","$SelectTime","new");
if($result)

echo "<script>window.location='treatment_timline.php?prescriptionid=$prescriptionid&patientid=$patientid';</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}

//End Transfer And Referal//
//END MEDICATION BILLING//
public static function appoimentbook($patientid,$adminid,$patientname,$VisitConsultant,$Specialty,$Selectstate,$Selectdistrict,$hospitalname,$drid,$Payment,$selectdate,$SelectTime,$statusva)
{
	$sql="INSERT INTO bookap(srno,patientid,adminid,patientname,VisitConsultant,Specialty,Selectstate,Selectdistrict,hospitalname,drid,Payment,selectdate,SelectTime,statusva) VALUES (NULL, '$patientid','$adminid','$patientname','$VisitConsultant','$Specialty','$Selectstate','$Selectdistrict','$hospitalname','$drid','$Payment','$selectdate','$SelectTime','$statusva')";
	$link=DBManager::connect();
	
	$result=mysqli_query($link,$sql);
	if($result)
		echo "OK";
	else 
		echo "Fail";
		$link=DBManager::close($link);
	}

//END BOOK APPOIMNET//
public static function AllConsent($prescriptionid,$patientid,$consent,$Upload_Consent,$entered_by)
{

	$link=DBManager::connect();
		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
	$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
	PatientManager::setActivityLog($patientid,"$prescriptionid","Intial Assessment<br>$consent","showpage_consent.php?prescriptionid=$prescriptionid&patientid=$patientid&type=$consent&srno=","$entered_by");
	$sql="INSERT INTO GeneralConsent(id,prescriptionid,patientid,towords,Upload_Consent,entered_by, created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$consent','$Upload_Consent','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('$consent Upload  successfully..');</script><script>window.location='concent.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}

//Start Routine Information//
public static function RoutineInformation($prescriptionid,$patientid,$surgeryid,$Information_Obtained_from,$Date_of_Operative_procedure,$Time_of_Operative_procedure,$name_Surgeon,$Name_of_Anesthetist,$Pre_Operative_Diagnosis,$Systemic_Disease,$Systemic_Disease_note,$Anesthesia_Events,$Anesthesia_Events_note,$ho_Operations,$ho_Operations_note,$Adverse_Drugs_Reaction,$Adverse_Drugs_Reaction_note,$DRUG_THERAPY,$DRUG_THERAPY_note,$Duration_Surgery,$WRITTEN_CONSENT,$Ward,$Bed,$entered_by)
{
	echo "";
	$link=DBManager::connect();
	  $narayan=LoginManager::currentUser();
$harilal=LoginManager::getUserTypeByuname("$narayan");
$entered_by=$harilal;
$updated_at=date("Y-m-d");
$created_at=date("F d, Y / h:i:s A");

$timeIn= date('H:i:s');
	  PatientManager::setActivityLog($patientid,"$prescriptionid","Pre-Assessment Sheet<br>Routine Information","showpage_Routine_Information.php?prescriptionid=$prescriptionid&patientid=$patientid&surgeryid=$surgeryid&srno=","$entered_by");
	 PatientManager::transferbedpatient("$prescriptionid","$Bed","$datetime");
	$sql="INSERT INTO Routine_Information(srno,prescriptionid,patientid,surgeryid,Information_Obtained_from,Date_of_Operative_procedure, Time_of_Operative_procedure,name_Surgeon,Name_of_Anesthetist, Pre_Operative_Diagnosis,Systemic_Disease,Systemic_Disease_note,Anesthesia_Events,Anesthesia_Events_note,ho_Operations,ho_Operations_note,Adverse_Drugs_Reaction,Adverse_Drugs_Reaction_note,DRUG_THERAPY,DRUG_THERAPY_note,Duration_Surgery,WRITTEN_CONSENT,Ward,Bed,TimeIn,entered_by,created_at,updated_at) VALUES (NULL,'$prescriptionid', '$patientid','$surgeryid', '$Information_Obtained_from', '$Date_of_Operative_procedure', '$Time_of_Operative_procedure','$name_Surgeon', '$Name_of_Anesthetist','$Pre_Operative_Diagnosis','$Systemic_Disease','$Systemic_Disease_note','$Anesthesia_Events','$Anesthesia_Events_note','$ho_Operations','$ho_Operations_note','$Adverse_Drugs_Reaction','$Adverse_Drugs_Reaction_note','$DRUG_THERAPY','$DRUG_THERAPY_note','$Duration_Surgery','$WRITTEN_CONSENT','$Ward','$Bed','$timeIn','$entered_by','$created_at','$updated_at')";
	
		$result=mysqli_query($link,$sql);
	//	echo "$sql";
if($result)
//echo "save";
echo "<script>alert('Routine Information Add successfully');</script><script>window.location='PreOperativeAssessmentSheet.php?prescriptionid=$prescriptionid&patientid=$patientid&surgeryid=$surgeryid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}
//End Routine Information //

public static function MedicalAssessment($prescriptionid,$patientid,$Chief_Complain,$Covid,$Fever,$Fever_note,$smell,$smell_note,$Diarrhoea,$Diarrhoea_note,$Deformity,$Deformity_note,$Cough,$Cough_note,$Taste,$Taste_note,$Weakness,$Weakness_note,$Breathlessness,$Breathlessness_note,$Appetite,$Appetite_note,$Limbs,$Limbs_note,$Throat,$Throat_note,$Vomitting,$Vomitting_note,$Slurred_Voice,$Slurred_Voice_note,$Nausea,$Nausea_note,$Loss_Appetite,$Loss_Appetite_note,$Delusion,$Delusion_note,$Fits_Anger,$Fits_Anger_note,$Depression,$Depression_note,$Memory_Loss,$Memory_Loss_note,$Bleeding_Disorder,$Bleeding_Disorder_note,$Migraine,$Migraine_note,$Frequent_Urination,$Frequent_Urination_note,$Swollen_Join,$Swollen_Join_note,$Weight_Gain,$Weight_Gain_note,$weight_loss,$weight_loss_note,$Body_pain,$Body_pain_note,$Physical_Injury,$Physical_Injury_note,$Other_Symptoms,$Other_Symptoms_note,$RED_EYE,$RED_EYE_note,$Swollen_Eye,$Swollen_Eye_note,$Conjunctiva,$Conjunctiva_note,$Itchiness,$Itchiness_note,$Dislocated,$Dislocated_note,$Blur_Vision,$Blur_Vision_note,$Partial_Blindness,$Partial_Blindness_note,$Blindness,$Blindness_note,$entered_by,$start_time,$Head,$rating,$Forehead,$Forehead_rating,$Eyes,$Eyes_rating,$Ear,$Ear_rating,$Nose,$Nose_rating,$Mouth,$Mouth_rating,$Cheek,$Cheek_rating,$Chin,$Chin_rating,$Jaw,$Jaw_rating,$Neck,$Neck_rating,$Shoulder,$Shoulder_rating,$Arm,$Arm_rating,$Elbow,$Elbow_rating,$Forearm,$Forearm_rating,$Wrist,$Wrist_rating,$Hand,$Hand_rating,$Nape,$Nape_rating,$ShoulderBlade,$ShoulderBlade_rating,$Armpit,$Armpit_rating,$Back,$Back_rating,$Chest,$Chest_rating,$Breast,$Breast_rating,$UpperAbdomen,$UpperAbdomen_rating,$Umbilical,$Umbilical_rating,$LowerAbdomen,$LowerAbdomen_rating,$Vulva,$Vulva_rating,$Penis,$Penis_rating,$Scrotum,$Scrotum_rating,$Buttock,$Buttock_rating,$Hip,$Hip_rating,$Thigh,$Thigh_rating,$Knee,$Knee_rating,$Calf,$Calf_rating,$Leg,$Leg_rating,$Ankle,$Ankle_rating,$Foot,$Foot_rating,$Heel,$Heel_rating)
{
	echo "";
	$link=DBManager::connect();
			$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
		$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
   
    $datetime_1 = $start_time; 
$datetime_2 = date('H:i:s'); 
 
$from_time = strtotime($datetime_1); 
$to_time = strtotime($datetime_2); 
$diff_minutes = round(abs($from_time - $to_time) / 60,2). " minutes";
 
	PatientManager::setActivityLog($patientid,"$prescriptionid","Intial Assessment<br>Medical Assessment","showpage_Medical_Assessment.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
		
	$sql="INSERT INTO Medical_Assessment(id,prescriptionid,patientid,Chief_Complain,covid,Fever,Fever_note,smell,smell_note,Diarrhoea,Diarrhoea_note,Deformity,Deformity_note,Cough,Cough_note,Taste,Taste_note,Weakness,Weakness_note,Breathlessness,Breathlessness_note,Appetite,Appetite_note,Limbs,Limbs_note,Throat,Throat_note,Vomitting,Vomitting_note,Slurred_Voice,Slurred_Voice_note,Nausea,Nausea_note,Loss_Appetite,Loss_Appetite_note,Delusion,Delusion_note,Fits_Anger,Fits_Anger_note,Depression,Depression_note,Memory_Loss,Memory_Loss_note,Bleeding_Disorder,Bleeding_Disorder_note,Migraine,Migraine_note,Frequent_Urination,Frequent_Urination_note,Swollen_Join,Swollen_Join_note,Weight_Gain,Weight_Gain_note,weight_loss,weight_loss_note,Body_pain,Body_pain_note,Physical_Injury,Physical_Injury_note,Other_Symptoms,Other_Symptoms_note,RED_EYE,RED_EYE_note,Swollen_Eye,Swollen_Eye_note,Conjunctiva,Conjunctiva_note,Itchiness,Itchiness_note,Dislocated,Dislocated_note,Blur_Vision,Blur_Vision_note,Partial_Blindness,Partial_Blindness_note,Blindness,Blindness_note,entered_by, created_at,updated_at, head, head_pa, fore_head,fore_head_pa,eye,eye_pa,ear, ear_pa,nose,nose_pa,mouth, mouth_pa,cheek,cheek_pa,chine,chine_pa,jaw,jaw_pa,adamApple, adamApple_pa, sholder,sholder_pa,arm,arm_pa,elbow,elbow_pa,foreArm, foreArm_pa,wrist,wrist_pa,hand,hand_pa,nape,nape_pa,sholderPlade, sholderPlade_pa,armPite,armPite_pa,back,back_pa,chest,chest_pa, breast, breast_pa, upper_Abdomen,upper_Abdomen_pa,umbilical,umbilical_pa, lowerAbdomen, lowerAbdomen_pa, vulva, vulva_pa,penis, penis_pa, scrotum, scrotum_pa, buttock, buttock_pa, hip, hip_pa, thigh, thigh_pa, knee, knee_pa, calf, calf_pa, leg, leg_pa, ankle, ankle_pa, foot, foot_pa, heel, heel_pa) VALUES (NULL,'$prescriptionid','$patientid','$Chief_Complain','$covid','$Fever','$Fever_note','$smell','$smell_note','$Diarrhoea','$Diarrhoea_note','$Deformity','$Deformity_note','$Cough','$Cough_note','$Taste','$Taste_note','$Weakness','$Weakness_note','$Breathlessness','$Breathlessness_note','$Appetite','$Appetite_note','$Limbs','$Limbs_note','$Throat','$Throat_note','$Vomitting','$Vomitting_note','$Slurred_Voice','$Slurred_Voice_note','$Nausea','$Nausea_note','$Loss_Appetite','$Loss_Appetite_note','$Delusion','$Delusion_note','$Fits_Anger','$Fits_Anger_note','$Depression','$Depression_note','$Memory_Loss','$Memory_Loss_note','$Bleeding_Disorder','$Bleeding_Disorder_note','$Migraine','$Migraine_note','$Frequent_Urination','$Frequent_Urination_note','$Swollen_Join','$Swollen_Join_note','$Weight_Gain','$Weight_Gain_note','$weight_loss','$weight_loss_note','$Body_pain','$Body_pain_note','$Physical_Injury','$Physical_Injury_note','$Other_Symptoms','$Other_Symptoms_note','$RED_EYE','$RED_EYE_note','$Swollen_Eye','$Swollen_Eye_note','$Conjunctiva','$Conjunctiva_note','$Itchiness','$Itchiness_note','$Dislocated','$Dislocated_note','$Blur_Vision','$Blur_Vision_note','$Partial_Blindness','$Partial_Blindness_note','$Blindness','$Blindness_note','$entered_by','$created_at','$updated_at','$Head','$rating','$Forehead','$Forehead_rating','$Eyes','$Eyes_rating','$Ear','$Ear_rating','$Nose','$Nose_rating','$Mouth','$Mouth_rating','$Cheek','$Cheek_rating','$Chin','$Chin_rating','$Jaw','$Jaw_rating','$Neck','$Neck_rating','$Shoulder','$Shoulder_rating','$Arm','$Arm_rating','$Elbow','$Elbow_rating','$Forearm','$Forearm_rating','$Wrist','$Wrist_rating','$Hand','$Hand_rating','$Nape','$Nape_rating','$ShoulderBlade','$ShoulderBlade_rating','$Armpit','$Armpit_rating','$Back','$Back_rating','$Chest','$Chest_rating','$Breast','$Breast_rating','$UpperAbdomen','$UpperAbdomen_rating','$Umbilical','$Umbilical_rating','$LowerAbdomen','$LowerAbdomen_rating','$Vulva','$Vulva_rating','$Penis','$Penis_rating','$Scrotum','$Scrotum_rating','$Buttock','$Buttock_rating','$Hip','$Hip_rating','$Thigh','$Thigh_rating','$Knee','$Knee_rating','$Calf','$Calf_rating','$Leg','$Leg_rating','$Ankle','$Ankle_rating','$Foot','$Foot_rating','$Heel','$Heel_rating')";
	$result=mysqli_query($link,$sql);
	$tat=$link->query("UPDATE `tat` SET `stop_date`='".date('Y-m-d')."',`stop_time`='".date('H:i:s')."',`duration`='".$diff_minutes."',`updated_at`='$updated_at' WHERE `patientid`='$patientid' AND `prescriptionid`='$prescriptionid' AND `hospital_id`='$entered_by'");
	
if($result)
echo "<script>alert('Medical Assessment add successfully..');</script><script>window.location='RequestforAdmissionset.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}

public static function NutritionalScreening($prescriptionid,$patientid,$weight_loss,$BMI,$patient_look,$last_2_weeks,$enteral_tube,$parenteral_tube,$Pattern_Followed,$Appetite,$entered_by)
{

	$link=DBManager::connect();
			$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
		$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
	PatientManager::setActivityLog($patientid,"$prescriptionid","Intial Assessment<br>Nutritional Screening","showpage_NutritionalScreening.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
	$sql="INSERT INTO Nutritional_Screening(id,prescriptionid,patientid,weight_loss,BMI,patient_look,last_2_weeks,enteral_tube,parenteral_tube,Pattern_Followed,Appetite,entered_by, created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$weight_loss','$BMI','$patient_look','$last_2_weeks','$enteral_tube','$parenteral_tube','$Pattern_Followed','$Appetite','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('Nutritional Screening add successfully..');</script><script>window.location='RequestforAdmissionset.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}


// New
public static function GeneralConsent($prescriptionid,$patientid,$towords,$Upload_Consent,$entered_by)
{

	$link=DBManager::connect();
		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
	$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
	PatientManager::setActivityLog($patientid,"$prescriptionid","Intial Assessment<br>GENERAL CONSENT","showpage_GeneralConsentSigned.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
	$sql="INSERT INTO GeneralConsent(id,prescriptionid,patientid,towords,Upload_Consent,entered_by, created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$towords','$Upload_Consent','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('General Consent Signed Upload  successfully..');</script><script>window.location='RequestforAdmissionset.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}
// end new
///////////////////////Counselar ////////////////////////
public static function SharedDecisionAid($prescriptionid,$patientid,$Investigation,$Pros,$Cons,$entered_by)
{
    	$link=DBManager::connect();
    		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
    	include("dbconnection.php");

$DisplayForm=True;
$sql1 ="SELECT * FROM SharedDecision WHERE prescriptionid='$_GET[prescriptionid]'";
		$qsql1 = mysqli_query($con,$sql1);
		while($rh1 = mysqli_fetch_array($qsql1))
		{
	$DisplayForm=False;
echo "";
}
if($DisplayForm)
{
PatientManager::setActivityLog($patientid,"$prescriptionid","Counselor Sheet<br>Shared Decision Aid","showpage_SharedDecisionAid.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
} else{
  
}

$updated_at=date("Y-m-d");
$created_at=date("F d, Y / h:i:s A");
	
 $sql="INSERT INTO SharedDecision(id,prescriptionid,patientid,Investigation,Pros,Cons,entered_by, created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$Investigation','$Pros','$Cons','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)

echo "<script>alert('Shared Decision add successfully..');</script><script>window.location='CounselorSheet.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";

else 
	echo "Fail";
	$link=DBManager::close($link);
}

public static function PatientInformation($prescriptionid,$patientid,$Diagnosis,$Investigation,$Duration_hospital,$Estimatedexpenses,$Possible_outcome,$Invited_patient,$Explained_importance,$Discussed_essential,$entered_by)
{
    $updated_at=date("Y-m-d");
    $created_at=date("F d, Y / h:i:s A");
	$link=DBManager::connect();
		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
	PatientManager::setActivityLog($patientid,"$prescriptionid","Counselor Sheet<br>Patient Information","showpage_PatientInformation.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
	$sql="INSERT INTO PatientInformation(id,prescriptionid,patientid,Diagnosis,Investigation,Duration_hospital,Estimatedexpenses,Possible_outcome,Invited_patient,Explained_importance,Discussed_essential,entered_by, created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$Diagnosis','$Investigation','$Duration_hospital','$Estimatedexpenses','$Possible_outcome','$Invited_patient','$Explained_importance','$Discussed_essential','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('Patient Information add successfully..');</script><script>window.location='CounselorSheet.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}


public static function Decisionmaking($prescriptionid,$patientid,$Presented_all,$Discussed_risks,$Asked_patient,$patient_teach,$Patient_demonstrated,$Encouraged_patient,$Listened_actively,$decision_might,$Acknowledged,$preferred,$additional,$consult,$Treating_Doctor,$entered_by)
{
    $updated_at=date("Y-m-d");
     $created_at=date("F d, Y / h:i:s A");

	$link=DBManager::connect();
		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
	PatientManager::setActivityLog($patientid,"$prescriptionid","Counselor Sheet<br>Decision Making","showpage_Decision_making.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
	$sql="INSERT INTO Decision_making(id,prescriptionid,patientid,Presented_all,Discussed_risks,Asked_patient,patient_teach,Patient_demonstrated,Encouraged_patient,Listened_actively,decision_might,Acknowledged,preferred,additional,consult,Treating_Doctor,entered_by,created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$Presented_all','$Discussed_risks','$Asked_patient','$patient_teach','$Patient_demonstrated','$Encouraged_patient','$Listened_actively','$decision_might','$Acknowledged','$preferred','$additional','$consult','$Treating_Doctor','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('Patient Information add successfully..');</script><script>window.location='CounselorSheet.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}

public static function Evaluatepatient($prescriptionid,$patientid,$Hospital_plans,$implementing_decision,$entered_by)
{
     $updated_at=date("Y-m-d");
     $created_at=date("F d, Y / h:i:s A");


	$link=DBManager::connect();
		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
PatientManager::setActivityLog($patientid,"$prescriptionid","Counselor Sheet<br>Evaluate Patient","showpage_Evaluate_patient.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
	$sql="INSERT INTO Evaluate_patient(id,prescriptionid,patientid,Hospital_plans,implementing_decision,entered_by,created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$Hospital_plans','$implementing_decision','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('Evaluate Patient add successfully..');</script><script>window.location='CounselorSheet.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}


////////////////////////End Counselar//////////////////////////////////
public static function MedicineOPD($prescriptionid,$patientid,$DRUGS,$Dose,$Route,$Frequency,$duration,$potential,$poa,$status,$Action_med,$availability,$batchno,$st0,$st1,$st2,$st3,$st4,$st5,$drid,$treatmentid,$entered_by)
{
	echo "";
	$link=DBManager::connect();
	$narayan=LoginManager::currentUser();
$harilal=LoginManager::getUserTypeByuname("$narayan");
$entered_by=$harilal;
include("dbconnection.php");

$DisplayForm=True;
$sql1 ="SELECT * FROM medicinede WHERE prescriptionid='$_GET[prescriptionid]'";
		$qsql1 = mysqli_query($con,$sql1);
		while($rh1 = mysqli_fetch_array($qsql1))
		{
	$DisplayForm=False;
echo "";
}
if($DisplayForm)
{
PatientManager::setActivityLog($patientid,"$prescriptionid","Opd Slip<br>Medicine Prescription","showmedicine.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
} else{
  
}


$sql1 ="SELECT * FROM site_users WHERE userno='$entered_by'";
		$qsql1 = mysqli_query($con,$sql1);
		while($re = mysqli_fetch_array($qsql1))
		$admin_id=$re[entered_by];
   $sql="SELECT  count('id') FROM medicinede WHERE prescriptionid='$_GET[prescriptionid]'";
$result=mysqli_query($con,$sql);
$row=mysqli_fetch_array($result);
    $slot=$row[0]+1;
    $durationselect='1';
		     $x=$durationselect; $y=$duration; $w=$Frequency; 
		  $a=$x*$y;
		  $z=$a*$w;
$sql2 ="SELECT * FROM medicine_stok WHERE medicine_id='$DRUGS'";
$qsql2 = mysqli_query($con,$sql2);
while($re2 = mysqli_fetch_array($qsql2))
  $price=$re2[mrp]/$re2[size];
           $price = number_format($price, 2, '.', ''); 
           $product=$price;
            $product1=$price*$z;
if (is_numeric($DRUGS))
{
$availability='Available';
PatientManager::medicineslotgive("$prescriptionid","$patientid","$DRUGS","$admin_id","medicinein","$z","$slot","$product","$product1","discount","process","batchno","paymentmode","$entered_by");
}
else
{
$availability='Not Available';
PatientManager::medicineslotgive("$prescriptionid","$patientid","$DRUGS","$admin_id","medicinein","$z","$slot","$product","$product1","discount","process","batchno","paymentmode","$entered_by");
}
$updated_at=date("Y-m-d");
$created_at=date("F d, Y / h:i:s A");
$Action_med='process';
	$sql="INSERT INTO medicinede(id,prescriptionid,patientid,DRUGS,Dose,Route,Frequency,duration,potential,poa,status,Action_med,availability,batchno,st0,st1,st2,st3,st4,st5,drid,treatmentid,entered_by,created_at,updated_at) VALUES (NULL, '$prescriptionid','$patientid','$DRUGS','$Dose','$Route','$Frequency','$duration','$potential','$poa','$status','$Action_med','$availability','$batchno','$st0','$st1','$st2','$st3','$st4','$st5','$drid','$treatmentid','$entered_by','$created_at','$updated_at')";
    $result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('Medicine add successfully..');</script><script>window.location='testopdslip3.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
	
}
public static function medicineslotgive($prescriptionid,$patientid,$medicine_id	,$admin_id,$linkfor,$quantitygiven,$slot_id,$price,$pricetotal,$discount,$paymentmode,$action,$batchno,$entered_by)
{
$narayan=LoginManager::currentUser();
$harilal=LoginManager::getUserTypeByuname("$narayan");
$entered_by=$harilal;
	$link=DBManager::connect();
		$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
	$sql="INSERT INTO medicine_slot(srno,prescriptionid,patientid,medicine_id,admin_id,linkfor,quantitygiven,upgradeQty,slot_id,price,pricetotal,UpgradeAmt,discount,paymentmode,action,batchno,entered_by,created_at,updated_at) VALUES (NULL, '$prescriptionid','$patientid','$medicine_id','$admin_id','$linkfor','$quantitygiven','$quantitygiven','$slot_id','$price','$pricetotal','$pricetotal','$discount','$paymentmode','$action','$batchno','$entered_by','$created_at','$updated_at')";
	
 $link=DBManager::connect();
	$result=mysqli_query($link,$sql);
	if($result)
		$link=DBManager::close($link);
	}

public static function potential($prescriptionid,$patientid,$operative_date,$Mode_Treatment,$Plan_Of_Care,$Follow_Up_Care,$treatment_Facility,$enteredby)
{
	echo "";
	$link=DBManager::connect();
		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
		$updated_at=date("F d, Y / h:i:s A");
   $created_at=date("F d, Y / h:i:s A");
		PatientManager::updatetatLog("$patientid","$prescriptionid","Consultant_fees","$casetype","drinvace.php?prescriptionid=$prescriptionid&patientid=$patientid","$rh1[ipd_visit_fee]","grand_total","q","w","ee","$Admitted_Under",""); 
	PatientManager::setActivityLog($patientid,"$prescriptionid","Opd Slip<br>Assessment","opdslip5.php?prescriptionid=$prescriptionid&patientid=$patientid&srno=","$entered_by");
	   PatientManager::dischargetry($prescriptionid,"$patientid","$hospitalid","","Opdslip","","","","","$entered_by");
	   	PatientManager::updatetatLogopd("$patientid","$prescriptionid","Consultant_fees","$casetype","drinvace.php?prescriptionid=$prescriptionid&patientid=$patientid","$rh1[ipd_visit_fee]","grand_total","q","w","ee","$Admitted_Under",""); 
$sql="INSERT INTO potential(id,prescriptionid,patientid,operative_date,Mode_Treatment,Plan_Of_Care,Follow_Up_Care,treatment_Facility,entered_by,created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$operative_date','$Mode_Treatment','$Plan_Of_Care','$Follow_Up_Care','$treatment_Facility','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('Add successfully..');</script><script>window.location='opdslip5.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}

public static function updatetatLog($patientid,$prescriptionid,$discription,$pagetype,$hospital_id,$start_date,$stop_date,$start_time,$stop_time,$solution,$entered_by,$currenctive_by)
{
	$link=DBManager::connect();
	 date_default_timezone_set('Asia/Kolkata');
$timeva=time();
$pavam=date( "H:i:s","$timeva");
$sjdjs=date('Y/m/d H:i:s');
$sql ="UPDATE tat SET stop_date='$sjdjs',stop_time='$pavam'  WHERE prescriptionid='$_GET[prescriptionid]' AND 	pagetype='Add_As_Patient_Page'";
$result=mysqli_query($link,$sql);
if($result)
echo "";
else 
	echo "";
	$link=DBManager::close($link);
}

public static function updatetatLogopd($patientid,$prescriptionid,$discription,$pagetype,$hospital_id,$start_date,$stop_date,$start_time,$stop_time,$solution,$entered_by,$currenctive_by)
{
	$link=DBManager::connect();
	 date_default_timezone_set('Asia/Kolkata');
$timeva=time();
$pavam=date( "H:i:s","$timeva");
$sjdjs=date('Y/m/d H:i:s');
$sql ="UPDATE tat SET stop_date='$sjdjs',stop_time='$pavam'  WHERE prescriptionid='$_GET[prescriptionid]' AND 	pagetype='OPD_Consultation'";
$result=mysqli_query($link,$sql);
if($result)
echo "";
else 
	echo "";
	$link=DBManager::close($link);
}
// START on visual acuity test //
public static function opdonevisualexam($prescriptionid,$patientid,$occuid,$Un_right,$Un_left,$Aided_right,$Aided_left,$entered_by)
{
	echo "";
		$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
	$link=DBManager::connect();
		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
	PatientManager::setActivityLog($patientid,"$prescriptionid","Examination <br> Visual Acuity Test","show_Visual_Acuity_Test.php?prescriptionid=$prescriptionid&patientid=$patientid&occuid=$occuid&srno=","$entered_by");
$sql="INSERT INTO visual(id,prescriptionid,patientid,occuid,Un_right,Un_left,Aided_right,Aided_left,entered_by,created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$occuid','$Un_right','$Un_left','$Aided_right','$Aided_left','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('Visual Acuity Test add successfully..');</script><script>window.location='OcularExamination.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}

// END ON visual acuity test//

// START ON Glass Advices -Distance//
public static function opdGlassAdvices($prescriptionid,$patientid,$occuid,$Examination_type,$SPH,$SPH_right,$SPH_left,$CYL,$CYL_right,$CYL_left,$AXIS,$AXIS_right,$AXIS_left,$VISION,$VISION_right,$VISION_left,$entered_by)
{
	echo "Patient admission new";
	$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
	$link=DBManager::connect();
		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
	PatientManager::setActivityLog($patientid,"$prescriptionid","Examination <br>Glass Advices $Examination_type","show_GlassAdvices.php?prescriptionid=$prescriptionid&patientid=$patientid&occuid=$occuid&srno=","$entered_by");
$sql="INSERT INTO Glass_Advices(id,prescriptionid,patientid,occuid,Examination_type,SPH,SPH_right,SPH_left,CYL,CYL_right,CYL_left,AXIS,AXIS_right,AXIS_left,VISION,VISION_right,VISION_left,entered_by,created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$occuid','$Examination_type','$SPH','$SPH_right','$SPH_left','$CYL','$CYL_right','$CYL_left','$AXIS','$AXIS_right','$AXIS_left','$VISION','$VISION_right','$VISION_left','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('Glass Advices-Distance add successfully..');</script><script>window.location='OcularExamination.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}

// END ON Glass Advices -Distance//
//Start on Glass Advices -Near//


public static function opdGlassnear($prescriptionid,$patientid,$occuid,$Examination_type,$SPH,$SPH_right,$SPH_left,$CYL,$CYL_right,$CYL_left,$AXIS,$AXIS_right,$AXIS_left,$VISION,$VISION_right,$VISION_left,$entered_by)
{
	echo "Patient admission new";
		$updated_at=date("Y-m-d");
   $created_at=date("F d, Y / h:i:s A");
	$link=DBManager::connect();
		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
	PatientManager::setActivityLog($patientid,"$prescriptionid","Examination <br>Glass Advices $Examination_type","show_GlassAdvices_near.php?prescriptionid=$prescriptionid&patientid=$patientid&occuid=$occuid&srno=","$entered_by");
$sql="INSERT INTO Glass_Advices(id,prescriptionid,patientid,occuid,Examination_type,SPH,SPH_right,SPH_left,CYL,CYL_right,CYL_left,AXIS,AXIS_right,AXIS_left,VISION,VISION_right,VISION_left,entered_by,created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$occuid','$Examination_type','$SPH','$SPH_right','$SPH_left','$CYL','$CYL_right','$CYL_left','$AXIS','$AXIS_right','$AXIS_left','$VISION','$VISION_right','$VISION_left','$entered_by','$created_at','$updated_at')";
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('Glass Advices-Near add successfully..');</script><script>window.location='OcularExamination.php?prescriptionid=$prescriptionid&patientid=$patientid'</script>;</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}
//End on Glass Advices -near//

// START ON EXAMNATION//
public static function oneexamnation($prescriptionid,$patientid,$occuid,$Examination,$eye,$Result,$left_result,$entered_by)
{
    $updated_at=date("Y-m-d");
$created_at=date("F d, Y / h:i:s A");
	echo "Eye Examination";
	$link=DBManager::connect();
		$narayan=LoginManager::currentUser();
	$anilka=LoginManager::getUserTypeByuname("$narayan");
	$entered_by="$anilka";
	PatientManager::setActivityLog($patientid,"$prescriptionid","Examination <br>Eye Examination","show_oneexamnation.php?prescriptionid=$prescriptionid&patientid=$patientid&occuid=$occuid&srno=","$entered_by");
$sql="INSERT INTO onexamnation(id,prescriptionid,patientid,occuid,Examination,eye,Result,left_result,entered_by,created_at,updated_at) VALUES (NULL,'$prescriptionid','$patientid','$occuid','$Examination','$eye','$Result','$left_result','$entered_by','$created_at','$updated_at')";
//echo $sql;
	$result=mysqli_query($link,$sql);
if($result)
echo "<script>alert('Eye Examination add successfully..');</script>";
else 
	echo "Fail";
	$link=DBManager::close($link);
}

// END ON EXAMNATION//












}
?>

Anon7 - 2022
AnonSec Team