Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadbk committed Sep 7, 2016
0 parents commit 4ad44c9
Show file tree
Hide file tree
Showing 25 changed files with 1,265 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/www.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions AddAllergy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
require "conn.php";
$tag_id = $_POST["tag_id"];
$type = $_POST["type"];

$mysql_qry1 = "SELECT `patient_id` FROM `patient` WHERE tag_id='$tag_id'";

if ($result1=mysqli_query($conn,$mysql_qry1))
{
while($row1=mysqli_fetch_row($result1))
{
$patient_id = $row1[0];
}
}

$mysql_qry = "INSERT INTO `hospital`.`allergies` (`allergy_id`, `patient_id`, `type`) VALUES (NULL, '$patient_id', '$type')";

if ($result=mysqli_query($conn,$mysql_qry))
{
echo "success";
}
mysqli_close($conn);
?>
39 changes: 39 additions & 0 deletions AddDiagnostic.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
require "conn.php";
$tag_id = $_POST["tag_id"];
$doctor_tag = $_POST["doctor_tag"];
$description = $_POST["description"];

$patient_id = "";
$doctor_id = "";

$mysql_qry1 = "SELECT `patient_id` FROM `patient` WHERE tag_id='$tag_id'";

if ($result1=mysqli_query($conn,$mysql_qry1))
{
while($row1=mysqli_fetch_row($result1))
{
$patient_id = $row1[0];
}
}

$mysql_qry2 = "SELECT `doctor_id` FROM `doctor` WHERE tag_id='$doctor_tag'";

if ($result2=mysqli_query($conn,$mysql_qry2))
{
while($row2=mysqli_fetch_row($result2))
{
$doctor_id = $row2[0];
}
}

$curr_date = date("Y-m-d");

$mysql_qry = "INSERT INTO `hospital`.`diagnostics` (`diagnostic_id`, `date`, `doctor_id`, `patient_id`, `description`) VALUES (NULL, '$curr_date', '$doctor_id', '$patient_id', '$description')";

if ($result=mysqli_query($conn,$mysql_qry))
{
echo "success";
}
mysqli_close($conn);
?>
53 changes: 53 additions & 0 deletions AddLocation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
require "conn.php";
$tag_id = $_POST["tag_id"];
$reader_id = $_POST["reader_id"];

$mysql_qry = "select * from login where tag_id like '$tag_id'";
$result = mysqli_query($conn,$mysql_qry);
if(mysqli_num_rows($result)>0)
{
}
else
{
echo "not success";
}

$mysql_qry1 = "SELECT `patient_id` FROM `patient` WHERE tag_id='$tag_id'";

if ($result1=mysqli_query($conn,$mysql_qry1))
{
while($row1=mysqli_fetch_row($result1))
{
$patient_id = $row1[0];
}
}
else
{
echo "not success";

}

$mysql_qry2 = "SELECT `ward_id` FROM `ward` WHERE reader_id='$reader_id'";
if ($result2=mysqli_query($conn,$mysql_qry2))
{
while($row2=mysqli_fetch_row($result2))
{
$ward_id = $row2[0];
}
}
else
{
echo "not success";

}

$mysql_qry3 = "INSERT INTO `hospital`.`location` (`location_id`, `patient_id`, `time`,`ward_id`) VALUES (NULL, '$patient_id', CURRENT_TIMESTAMP,'$ward_id')";
if ($result3=mysqli_query($conn,$mysql_qry3))
{
echo "success";
}

mysqli_close($conn);

?>
6 changes: 6 additions & 0 deletions AddNurse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
require "conn.php"
$mysql_qry = "INSERT";
?>
41 changes: 41 additions & 0 deletions AddObservation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
require "conn.php";
$tag_id = $_POST["tag_id"];
$doctor_tag = $_POST["doctor_tag"];
$bpn = $_POST["bpn"];
$bpd = $_POST["bpd"];
$temperature = $_POST["temperature"];
$pulse = $_POST["pulse"];
$weight = $_POST["weight"];

$patient_id = "";
$doctor_id = "";

$mysql_qry1 = "SELECT `patient_id` FROM `patient` WHERE tag_id='$tag_id'";

if ($result1=mysqli_query($conn,$mysql_qry1))
{
while($row1=mysqli_fetch_row($result1))
{
$patient_id = $row1[0];
}
}

$mysql_qry2 = "SELECT `doctor_id` FROM `doctor` WHERE tag_id='$doctor_tag'";

if ($result2=mysqli_query($conn,$mysql_qry2))
{
while($row2=mysqli_fetch_row($result2))
{
$doctor_id = $row2[0];
}
}

$mysql_qry = "INSERT INTO `hospital`.`observation` (`observation_id`, `patient_id`, `doctor_id`, `date`, `bpn`, `bpd`, `temperature`, `pulse`, `weight`) VALUES (NULL, '$patient_id', '$doctor_id', CURRENT_TIMESTAMP, '$bpn', '$bpd', '$temperature', '$pulse', '$weight')";

if ($result=mysqli_query($conn,$mysql_qry))
{
echo "success";
}
mysqli_close($conn);
?>
55 changes: 55 additions & 0 deletions AddPrescription.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
require "conn.php";
$tag_id = $_POST["tag_id"];
$doctor_tag = $_POST["doctor_tag"];
$medicine_name = $_POST["medicine_name"];
$quantity_per_day = $_POST["quantity_per_day"];
$frequency_per_day = $_POST["frequency_per_day"];
$end_date = $_POST["end_date"];

$patient_id = "";
$doctor_id = "";
$medicine_id = "";

$mysql_qry1 = "SELECT `patient_id` FROM `patient` WHERE tag_id='$tag_id'";

if ($result1=mysqli_query($conn,$mysql_qry1))
{
while($row1=mysqli_fetch_row($result1))
{
$patient_id = $row1[0];
}
}

$mysql_qry2 = "SELECT `doctor_id` FROM `doctor` WHERE tag_id='$doctor_tag'";

if ($result2=mysqli_query($conn,$mysql_qry2))
{
while($row2=mysqli_fetch_row($result2))
{
$doctor_id = $row2[0];
}
}

$mysql_qry3 = "SELECT `medicine_id` FROM `medicine` WHERE medicine_name='$medicine_name'";

if ($result3=mysqli_query($conn,$mysql_qry3))
{
while($row3=mysqli_fetch_row($result3))
{
$medicine_id = $row3[0];
}
}

$curr_date = date("Y-m-d");

$status = "active";

$mysql_qry = "INSERT INTO `hospital`.`prescription` (`prescription_id`, `patient_id`, `doctor_id`, `medicine_id`, `quantity_per_day`, `frequency_per_day`, `start_date`, `end_date`, `status`) VALUES (NULL, '$patient_id', '$doctor_id','$medicine_id' ,'$quantity_per_day', '$frequency_per_day', '$curr_date', '$end_date', '$status')";

if ($result=mysqli_query($conn,$mysql_qry))
{
echo "success";
}
mysqli_close($conn);
?>
30 changes: 30 additions & 0 deletions Allergies.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
require "conn.php";
$tag_id = $_POST["tag_id"];

$mysql_qry1 = "SELECT `patient_id` FROM `patient` WHERE tag_id='$tag_id'";

if ($result1=mysqli_query($conn,$mysql_qry1))
{
while($row1=mysqli_fetch_row($result1))
{
$patient_id = $row1[0];
}
}

$mysql_qry2 = "SELECT `type` FROM `allergies` WHERE patient_id='$patient_id'";

$response = array();

if ($result2=mysqli_query($conn,$mysql_qry2))
{
while($row2=mysqli_fetch_row($result2))
{
array_push($response, array("type"=>$row2[0]));
}

}
echo json_encode(array("server_response"=>$response));

mysqli_close($conn);
?>
39 changes: 39 additions & 0 deletions Diagnostics.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
require "conn.php";
$tag_id = $_POST["tag_id"];

$mysql_qry1 = "SELECT `patient_id` FROM `patient` WHERE tag_id='$tag_id'";

if ($result1=mysqli_query($conn,$mysql_qry1))
{
while($row1=mysqli_fetch_row($result1))
{
$patient_id = $row1[0];
}
}

$mysql_qry2 = "SELECT `date`, `doctor_id`, `description` FROM `diagnostics` WHERE patient_id='$patient_id'";

$response = array();

if ($result2=mysqli_query($conn,$mysql_qry2))
{
while($row2=mysqli_fetch_row($result2))
{
$mysql_qry3 = "SELECT `first_name`, `last_name` FROM `doctor` WHERE doctor_id='$row2[1]'";
if ($result3=mysqli_query($conn,$mysql_qry3))
{
while($row3=mysqli_fetch_row($result3))
{
$docFName = $row3[0];
$docLName = $row3[1];
}
}
array_push($response, array("date"=>$row2[0], "doc_first_name"=>$docFName,"doc_last_name"=>$docLName,"description"=>$row2[2]));
}

}
echo json_encode(array("server_response"=>$response));

mysqli_close($conn);
?>
39 changes: 39 additions & 0 deletions Locations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
require "conn.php";
$tag_id = $_POST["tag_id"];

$mysql_qry1 = "SELECT `patient_id` FROM `patient` WHERE tag_id='$tag_id'";

if ($result1=mysqli_query($conn,$mysql_qry1))
{
while($row1=mysqli_fetch_row($result1))
{
$patient_id = $row1[0];
}
}

$mysql_qry2 = "SELECT `time`, `ward_id` FROM `location` WHERE patient_id='$patient_id'";

$response = array();

if ($result2=mysqli_query($conn,$mysql_qry2))
{
while($row2=mysqli_fetch_row($result2))
{
$mysql_qry3 = "SELECT `ward_name` FROM `ward` WHERE ward_id='$row2[1]'";
if ($result3=mysqli_query($conn,$mysql_qry3))
{
while($row3=mysqli_fetch_row($result3))
{
$ward_name = $row3[0];
}
}

array_push($response, array("time_stamp"=>$row2[0],"ward_name"=>$ward_name));
}

}
echo json_encode(array("server_response"=>$response));

mysqli_close($conn);
?>
19 changes: 19 additions & 0 deletions MedicineList.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
require "conn.php";

$response = array();

$mysql_qry = "SELECT `medicine_name` FROM `medicine`";

if ($result=mysqli_query($conn,$mysql_qry))
{
while($row=mysqli_fetch_row($result))
{
array_push($response, array("medicine_name"=>$row[0]));
}
}

echo json_encode(array("server_response"=>$response));

mysqli_close($conn);
?>
Loading

0 comments on commit 4ad44c9

Please sign in to comment.