<?php
require("lib/functions.php");
-if(isSet($_POST["id"])){
- $data=json_encode($_POST);
- if(!is_dir("data/".$_POST["id"])){
- mkdir("data/".$_POST["id"]);
- }
- file_put_contents("data/".$_POST["id"]."/info.json", $data);
- header("Location: view.php?id=".$_POST["id"]);
- exit();
-}
-if(isSet($_GET["id"])){
- $form=schema2form("forms/admission.schema.json", "data/".$_GET["id"]."/info.json");
-}
-else{
- $form=schema2form("forms/admission.schema.json");
+require("lib/db.php");
+if(!empty($_POST["pid"]) && !empty($_POST["name"]) && !empty($_POST["age"]) && !empty($_POST["sex"])){
+ $db->admit($_POST);
+ //header("Location: view.php?pid=".$_POST["pid"]);
+ //exit();
}
+$form=schema2form("forms/admission.schema.json");
?>
<!DOCTYPE html>
<html>
<?php
+require("lib/db.php");
require("lib/functions.php");
-if(isSet($_GET["id"]) && isSet($_POST["date"]) && isSet($_POST["time"])){
- $data=json_encode($_POST);
- if(!is_dir("data/".$_GET["id"]."/clinical")){
- mkdir("data/".$_GET["id"]."/clinical");
+if(!empty($_GET["pid"])){
+ $pid=$_GET["pid"];
+ if(!empty($_POST["date"]) && !empty($_POST["time"])){
+ if(!empty($_GET["id"])){
+ $db->editClinical($_POST, $pid, $_GET["id"]);
+ }
+ else{
+ $db->addClinical($_POST, $pid);
+ }
+ //header("Location: view.php?id=".$_GET["id"]);
+ //exit();
+ }
+ if(isSet($_GET["id"])){
+ $form=schema2form("forms/clinical.schema.json", $pid, $_GET["id"], "clinical");
+ }
+ else{
+ $form=schema2form("forms/clinical.schema.json");
}
- file_put_contents("data/".$_GET["id"]."/clinical/".$_POST["stamp"].".json", $data);
- header("Location: view.php?id=".$_GET["id"]);
- exit();
-}
-if(isSet($_GET["stamp"])){
- $form=schema2form("forms/clinical.schema.json", $_GET["stamp"], "data/".$_GET["id"]."/clinical/".$_GET["stamp"].".json");
-}
-else{
- $form=schema2form("forms/clinical.schema.json");
}
?>
<!DOCTYPE html>
</head>
<body>
<div class="container">
+ <?php echo getInfo($pid);?>
<?php echo $form;?>
</div>
</body>
"type": "object",
"properties": {
- "id": {
+ "pid": {
"description": "Admission ID",
"type": "string"
},
"format": "date"
},
"ward": {
- "description": "Ward Number",
+ "description": "Ward",
"type": "string"
},
"bed": {
"enum": ["admitted","discharged","expired"]
}
},
- "required": ["id"]
+ "required": ["pid", "name", "age", "sex", "date", "ward", "bed", "status"]
}
--- /dev/null
+{
+ "$schema": "http://json-schema.org/draft/2020-12/schema",
+ "title": "History",
+ "description": "History",
+ "type": "object",
+
+ "properties": {
+ "date": {
+ "description": "Date",
+ "type": "string",
+ "format": "date"
+ },
+ "time": {
+ "description": "Time",
+ "type": "string",
+ "format": "time"
+ },
+ "cc": {
+ "description": "Chief complaint",
+ "type": "string"
+ },
+ "history": {
+ "description": "History",
+ "type": "string"
+ },
+ "comorb": {
+ "description": "Comorbidities",
+ "type": "string"
+ },
+ "oe": {
+ "description": "General Examination",
+ "type": "string"
+ },
+ "bp": {
+ "description": "Blood Pressure",
+ "type": "string"
+ },
+ "pr": {
+ "description": "Pulse",
+ "type": "integer"
+ },
+ "rr": {
+ "description": "Respiratory Rate",
+ "type": "integer"
+ },
+ "spo2": {
+ "description": "SpO2",
+ "type": "integer"
+ },
+ "chest": {
+ "description": "Chest Examination",
+ "type": "string"
+ },
+ "abdomen": {
+ "description": "Abdominal Examination",
+ "type": "string"
+ }
+ },
+ "required": ["date","time", "cc"]
+}
"type": "number"
}
},
- "required": []
+ "required": ["date"]
}
"type": "number"
}
},
- "required": []
+ "required": ["date"]
}
"type": "number"
}
},
- "required": []
+ "required": ["date"]
}
--- /dev/null
+<?php
+require("lib/db.php");
+require("lib/functions.php");
+if(!empty($_GET["pid"])){
+ $pid=$_GET["pid"];
+ if(!empty($_POST["cc"])){
+ $db->history($_POST, $pid);
+ //header("Location: view.php?pid=".$pid);
+ //exit();
+ }
+}
+if(isSet($_GET["stamp"])){
+ $form=schema2form("forms/clinical.schema.json", $_GET["stamp"], "data/".$_GET["id"]."/clinical/".$_GET["stamp"].".json");
+}
+else{
+ $form=schema2form("forms/history.schema.json");
+}
+?>
+<!DOCTYPE html>
+<html>
+ <head>
+ <?php include("lib/head.php");?>
+ <title>History</title>
+ </head>
+ <body>
+ <div class="container">
+ <?php echo getInfo($pid);?>
+ <?php echo $form;?>
+ </div>
+ </body>
+</html>
<?php
+require("lib/db.php");
require("lib/functions.php");
-$list="";
-foreach(glob("data/*") as $id){
- $data=json_decode(file_get_contents($id."/info.json"));
- $id=str_replace("data/", "", $id);
- $list=$list."<tr><td><a href='view.php?id=".$id."'>".$id."</a></td><td>".$data->name."</td><td>".$data->ward." ".$data->bed."</td></tr>";
+$list=$db->getList();
+$show="";
+if(!empty($list)){
+ while($arr=$list->fetchArray()){
+ $pid=$arr["pid"];
+ $name=$db->getName($pid)->fetchArray()["name"];
+ $show=$show."<tr><td><a href='view.php?pid=".$pid."'>".$pid."</a></td><td>".$name."</td><td> </td></tr>";
+ }
}
?>
<!DOCTYPE html>
<h4 class="card-title">Patient List</h4>
<table class="table">
<tr><th>Patient ID</th><th>Name</th><th>Bed Number</th></tr>
- <?php echo $list;?>
+ <?php echo $show;?>
</table>
<a class="btn btn-primary btn-lg" href="admission.php">Add New Patient</a>
</div>
<?php
require("lib/functions.php");
$list="";
-if(isSet($_GET["id"])){
+if(isSet($_GET["pid"])){
foreach(glob("forms/report*.json") as $file){
$form=json_decode(file_get_contents($file));
- $list=$list."<li class='list-group-item'><a href='report.php?id=".$_GET["id"]."&form=".str_replace(["forms/",".schema.json"], "", $file)."'>".$form->description."</a></li>";
+ $list=$list."<li class='list-group-item'><a href='report.php?pid=".$_GET["pid"]."&form=".str_replace(["forms/",".schema.json"], "", $file)."'>".$form->description."</a></li>";
}
}
?>
--- /dev/null
+<?php
+class DB extends SQLite3 {
+ function __construct(){
+ $this->open("data/data.db");
+ }
+ function admit($post){
+ $stmt=$this->prepare("INSERT INTO patients (pid, name, age, sex, addl) VALUES (:pid, :name, :age, :sex, :addl);");
+ $stmt->bindValue(":pid", $post["pid"]);
+ $stmt->bindValue(":name", $post["name"]);
+ $stmt->bindValue(":age", $post["age"]);
+ $stmt->bindValue(":sex", $post["sex"]);
+ $stmt->bindValue(":addl", json_encode($post));
+ $stmt->execute();
+ }
+ function updateHistory($post, $pid){
+ $stmt=$this->prepare("UPDATE patients SET data=:history WHERE pid=:pid;");
+ $stmt->bindValue(":history", json_encode($post));
+ $stmt->bindValue(":pid", $pid);
+ $stmt->execute();
+ }
+ function addClinical($post, $pid){
+ $stmt=$this->prepare("INSERT INTO clinical (pid, time, data) VALUES (:pid, :time, :data);");
+ $stmt->bindValue(":pid", $pid);
+ $stmt->bindValue(":time", strtotime($post["date"].$post["time"]));
+ $stmt->bindValue(":data", json_encode($post));
+ $stmt->execute();
+ }
+ function editClinical($post, $pid, $id){
+ $stmt=$this->prepare("UPDATE clinical SET time=:time,data=:data WHERE pid=:pid AND rowid=:id;");
+ $stmt->bindValue(":pid", $pid);
+ $stmt->bindValue(":id", $id);
+ $stmt->bindValue(":time", strtotime($post["date"].$post["time"]));
+ $stmt->bindValue(":data", json_encode($post));
+ $stmt->execute();
+ }
+ function addReport($post, $pid, $form){
+ $stmt=$this->prepare("INSERT INTO reports (pid, time, form, data) VALUES (:pid, :time, :form, :data);");
+ $stmt->bindValue(":pid", $pid);
+ $stmt->bindValue(":time", strtotime($post["date"].$post["time"]));
+ $stmt->bindValue(":form", $post["form"]);
+ $stmt->bindValue(":data", json_encode($post));
+ $stmt->execute();
+ }
+ function editReport($post, $pid, $id, $form){
+ $stmt=$this->prepare("UPDATE reports SET time=:time,data=:data WHERE pid=:pid AND rowid=:id;");
+ $stmt->bindValue(":pid", $pid);
+ $stmt->bindValue(":id", $id);
+ $stmt->bindValue(":time", strtotime($post["date"].$post["time"]));
+ $stmt->bindValue(":data", json_encode($post));
+ $stmt->execute();
+ }
+ function addDrug($pid, $name, $dose, $route, $frequency, $start, $duration, $addl){
+ $stmt=$this->prepare("INSERT INTO drugs (pid, name, dose, route, frequency, start, duration, omit, addl) VALUES (:pid, :name, :dose, :route, :frequency, :start, :duration, :omit, :addl);");
+ $stmt->bindValue(":pid", $pid);
+ $stmt->bindValue(":name", $name);
+ $stmt->bindValue(":dose", $dose);
+ $stmt->bindValue(":route", $route);
+ $stmt->bindValue(":frequency", $frequency);
+ $stmt->bindValue(":start", $start);
+ $stmt->bindValue(":duration", $duration);
+ $stmt->bindValue(":addl", $addl);
+ $stmt->bindValue(":omit", false);
+ $stmt->execute();
+ }
+ function omitDrug($id){
+ $stmt=$this->prepare("UPDATE drugs SET omit=:omit WHERE rowid=:id;");
+ $stmt->bindValue(":omit", true);
+ $stmt->bindValue(":id", $id);
+ $stmt->execute();
+ }
+ function getDrugs($pid){
+ $stmt=$this->prepare("SELECT rowid,* FROM drugs WHERE pid=:pid;");
+ $stmt->bindValue(":pid", $pid);
+ $result=$stmt->execute();
+ return($result);
+ }
+ function getName($pid){
+ $stmt=$this->prepare("SELECT name FROM patients WHERE pid=:pid;");
+ $stmt->bindValue(":pid", $pid);
+ $result=$stmt->execute();
+ return($result);
+ }
+ function getAge($pid){
+ $stmt=$this->prepare("SELECT age FROM patients WHERE pid=:pid;");
+ $stmt->bindValue(":pid", $pid);
+ $result=$stmt->execute();
+ return($result);
+ }
+ function getSex($pid){
+ $stmt=$this->prepare("SELECT sex FROM patients WHERE pid=:pid;");
+ $stmt->bindValue(":pid", $pid);
+ $result=$stmt->execute();
+ return($result);
+ }
+ function getList(){
+ $stmt=$this->prepare("SELECT pid FROM patients;");
+ $result=$stmt->execute();
+ return($result);
+ }
+ function getForm($id){
+ $stmt=$this->prepare("SELECT form FROM reports WHERE rowid=:id;");
+ $stmt->bindValue(":id", $id);
+ $result=$stmt->execute();
+ return($result);
+ }
+ function getData($pid, $id, $cat){
+ if($cat=="clinical"){
+ $stmt=$this->prepare("SELECT data FROM clinical WHERE pid=:pid AND rowid=:id;");
+ } elseif($cat=="reports"){
+ $stmt=$this->prepare("SELECT data FROM reports WHERE pid=:pid AND rowid=:id;");
+ } elseif($cat=="history"){
+ $stmt=$this->prepare("SELECT data FROM patients WHERE pid=:pid AND rowid=:id;");
+ }
+ $stmt->bindValue(":pid", $pid);
+ $stmt->bindValue(":id", $id);
+ $result=$stmt->execute();
+ return($result);
+ }
+ function getAllData($pid, $cat){
+ if($cat=="clinical"){
+ $stmt=$this->prepare("SELECT rowid,data FROM clinical WHERE pid=:pid;");
+ } elseif($cat=="reports"){
+ $stmt=$this->prepare("SELECT rowid,data FROM reports WHERE pid=:pid;");
+ } elseif($cat=="history"){
+ $stmt=$this->prepare("SELECT rowid,data FROM patients WHERE pid=:pid;");
+ }
+ $stmt->bindValue(":pid", $pid);
+ $result=$stmt->execute();
+ return($result);
+ }
+}
+$db = new DB();
+?>
<?php
-function schema2form($file, $stamp=false, $fill=false){
+function schema2form($file, $pid=null, $id=null, $cat=null){
+ global $db;
$schema=json_decode(file_get_contents($file));
- if($fill!==false){
- $data=json_decode(file_get_contents($fill));
+ if(!empty($pid) && !empty($id) && !empty($cat)){
+ $data=json_decode($db->getData($pid, $id, $cat)->fetchArray()["data"]);
}
- if($stamp===false){
- $stamp=time()."-".rand(1000,9999);
+ else{
+ $data=null;
}
$form="<form method='post'>";
- $form=$form."<input type='hidden' name='stamp' value='".$stamp."'>";
- $form=$form."<input type='hidden' name='form' value='".str_replace(["forms/", ".schema.json"], "", $file)."'>";
+ $form=$form."<input type='hidden' name='form' value='".str_replace(["forms/",".schema.json"], "", $file)."'>";
foreach($schema->properties as $field=>$prop){
if($prop->type == "integer") $prop->type="number";
if($prop->type == "string") $prop->type="text";
- if($fill!==false){
+ if(!empty($data)){
$value="value='".$data->$field."'";
}
else{
return $form;
}
-function view_data($file, $edit=false){
- if(is_file($file)){
- $data=json_decode(file_get_contents($file));
- }
- else{
- return "";
- }
+function getInfo($pid){
+ global $db;
+ $info="<table class='table'>";
+ $info=$info."<tr><td>ID</td><td>".$pid."</td></tr>";
+ $info=$info."<tr><td>Name</td><td>".$db->getName($pid)->fetchArray()["name"]."</td></tr>";
+ $info=$info."<tr><td>Age</td><td>".$db->getAge($pid)->fetchArray()["age"]."</td></tr>";
+ $info=$info."<tr><td>Sex</td><td>".$db->getSex($pid)->fetchArray()["sex"]."</td></tr>";
+ $info=$info."</table>";
+ return $info;
+}
+
+function viewData($data, $edit=null){
+ $data=json_decode($data);
+ unset($data->cat);
$view="<table class='table'>";
foreach($data as $field=>$value){
$view=$view."<tr><td>".$field."</td><td>".$value."</td></tr>";
}
- if($edit!==false){
- $view=$view."<tr><td><a href='".$edit."&form=".$data->form."&stamp=".$data->stamp."'>Edit</a>";
+ if(!empty($edit)){
+ $view=$view."<tr><td><a href='".$edit."'>Edit</a>";
}
$view=$view."</table>";
return $view;
}
-function add_drug($file, $drug){
- if(is_file($file)){
- $druglist=json_decode(file_get_contents($file));
- }
- else{
- $druglist=[];
- }
- $drug["omit"]=false;
- array_push($druglist, $drug);
- file_put_contents($file, json_encode($druglist));
-}
-
-function omit_drug($file, $id){
- if(is_file($file)){
- $druglist=json_decode(file_get_contents($file));
- var_dump($druglist);
- $druglist[$id]->omit=true;
- file_put_contents($file, json_encode($druglist));
- }
- else{
- echo "boo";
- }
-}
-
function view_drug($file){
if(is_file($file)){
$druglist=json_decode(file_get_contents($file));
<?php
+require("lib/db.php");
require("lib/functions.php");
-if(isSet($_GET["id"]) && isSet($_GET["form"])){
- if(isSet($_GET["stamp"])){
- $form=schema2form("forms/".$_GET["form"].".schema.json", $_GET["stamp"], "data/".$_GET["id"]."/report/".$_GET["stamp"].".json");
+if(!empty($_GET["pid"]) && !empty($_GET["form"])){
+ $pid=$_GET["pid"];
+ if(!empty($_POST["date"])){
+ if(!empty($_GET["id"])){
+ $db->editReport($_POST, $pid, $_GET["id"], $_POST["form"]);
+ }
+ else{
+ $db->addReport($_POST, $pid, $_POST["form"]);
+ }
+ //header("Location: view.php?id=".$_GET["id"]);
+ //exit();
+ }
+ if(isSet($_GET["id"])){
+ $form=schema2form("forms/".$_GET["form"].".schema.json", $pid, $_GET["id"], "reports");
}
else{
$form=schema2form("forms/".$_GET["form"].".schema.json");
}
}
-else{
- $form="";
-}
-if(isSet($_GET["id"]) && isSet($_POST["date"])){
- $data=json_encode($_POST);
- if(!is_dir("data/".$_GET["id"]."/report")){
- mkdir("data/".$_GET["id"]."/report");
- }
- file_put_contents("data/".$_GET["id"]."/report/".$_POST["stamp"].".json", $data);
- header("Location: view.php?id=".$_GET["id"]);
- exit();
-}
?>
<!DOCTYPE html>
<html>
--- /dev/null
+CREATE TABLE clinical(
+pid int,
+time int,
+data text
+);
+CREATE TABLE drugs(
+pid int,
+name text,
+dose text,
+route text,
+frequency text,
+start int,
+duration text,
+omit boolean,
+addl text
+);
+CREATE TABLE patients(
+pid int unique,
+name text,
+age int,
+sex text,
+status text,
+addl text,
+data text
+);
+CREATE TABLE reports(
+pid int,
+time int,
+form text,
+data text
+);
<?php
+require("lib/db.php");
require("lib/functions.php");
-if(isSet($_GET["id"]) && isSet($_POST["omit"])){
- if(filter_var($_POST["omit"], FILTER_VALIDATE_INT)!==false){
- omit_drug("data/".$_GET["id"]."/treatment.json", $_POST["omit"]);
+if(!empty($_GET["pid"])){
+ $pid=$_GET["pid"];
+ if(!empty($_POST["omit"])){
+ $db->omitDrug($_POST["omit"]);
}
-}
-if(isSet($_GET["id"]) && isSet($_POST["drug"])){
- if($_POST["drug"]!==""){
- add_drug("data/".$_GET["id"]."/treatment.json", $_POST);
+ elseif(!empty($_POST["name"])){
+ $db->addDrug($pid, $_POST["name"], $_POST["dose"], $_POST["route"], $_POST["frequency"], $_POST["start"], $_POST["duration"], $_POST["note"]);
+ }
+ $list=$db->getDrugs($pid);
+ $view="<form method='post' id='omitter'></form>";
+ $view=$view."<table class='table'>";
+ $view=$view."<tr><th>Drug</th><th>Dose</th><th>Route</th><th>Frequency</th><th>Start</th><th>Duration</th><th>Note</th></tr>";
+ while($drug=$list->fetchArray()){
+ if($drug["omit"]){
+ $omit="style='display:none'";
+ }
+ else{
+ $omit="";
+ }
+ $view=$view."<tr><td>".$drug["name"]."</td><td>".$drug["dose"]."</td><td>".$drug["route"]."</td><td>".$drug["frequency"]."</td><td>".$drug["start"]."</td><td>".$drug["duration"]."</td><td>".$drug["addl"]."</td><td><button class='btn btn-warning' name='omit' value='".$drug["rowid"]."' form='omitter' ".$omit.">Omit</button></td></tr>";
}
+ $view=$view."</table>";
+
}
-$list=view_drug("data/".$_GET["id"]."/treatment.json");
?>
<!DOCTYPE html>
<html>
</head>
<body>
<div class="container">
- <div class="card">
+ <div class="card mb-4">
<div class="card-body">
<h4 class="card-title">Medicine List</h4>
- <?php echo $list;?>
+ <?php echo $view;?>
</div>
</div>
<form method="post">
<div>
- <label class="form-label" for="drug">Add Drug</label>
+ <label class="form-label h4" for="drug">Add Drug</label>
<div class="row">
- <div class="col-sm-4">
- <input class="form-control" type="text" name="drug" id="drug" placeholder="Drug">
+ <div class="col-sm-6 mb-3">
+ <input class="form-control" type="text" name="name" id="drug" placeholder="Drug" required>
</div>
- <div class="col-sm-2">
- <input class="form-control" type="number" name="dose" id="dose" placeholder="Dose">
+ <div class="col-sm-2 mb-3">
+ <input class="form-control" type="text" name="dose" id="dose" placeholder="Dose">
</div>
- <div class="col-sm-2">
+ <div class="col-sm-2 mb-3">
<select class="form-control" name="route" id="route">
<option value="oral">Oral</option>
<option value="im">IM</option>
<option value="pr">Per Rectal</option>
</select>
</div>
- <div class="col-sm-2">
- <input class="form-control" type="text" name="freq" id="freq" placeholder="Frequency">
+ <div class="col-sm-2 mb-3">
+ <input class="form-control" type="text" name="frequency" id="frequency" placeholder="Frequency">
</div>
- <div class="col-sm-2">
+ <div class="col-sm-2 mb-3">
+ <input class="form-control" type="text" name="start" id="start" placeholder="Start">
+ </div>
+ <div class="col-sm-2 mb-3">
<input class="form-control" type="text" name="duration" id="duration" placeholder="Duration">
</div>
+ <div class="col-sm-8 mb-3">
+ <input class="form-control" type="text" name="note" id="note" placeholder="Notes">
+ </div>
</div>
- <input class="form-control" type="text" name="note" id="note" placeholder="Notes">
<button class="btn btn-primary" type="submit">Update</button>
</div>
</form>
<?php
+require("lib/db.php");
require("lib/functions.php");
-if(isSet($_GET["id"])){
- $id=$_GET["id"];
-}
-else{
- $id=false;
-}
-$info=view_data("data/".$id."/info.json");
+$info="";
$clinical=[];
-foreach(glob("data/".$id."/clinical/*.json") as $f){
- array_push($clinical, view_data($f, "clinical.php?id=".$_GET["id"]));
-}
-$report=[];
-foreach(glob("data/".$id."/report/*.json") as $f){
- array_push($report, view_data($f, "report.php?id=".$_GET["id"]));
+$reports=[];
+if(isSet($_GET["pid"])){
+ $pid=$_GET["pid"];
+ $info=getInfo($pid);
+ $clinicalArray=$db->getAllData($pid, "clinical");
+ while($c=$clinicalArray->fetchArray()){
+ array_push($clinical, viewData($c["data"], "clinical.php?pid=".$pid."&id=".$c["rowid"]));
+ }
+ $reportsArray=$db->getAllData($pid, "reports");
+ while($r=$reportsArray->fetchArray()){
+ var_dump($r);
+ array_push($reports, viewData($r["data"], "report.php?pid=".$pid."&id=".$r["rowid"]."&form=".$db->getForm($r["rowid"])->fetchArray()["form"]));
+ }
}
?>
<!DOCTYPE html>
<body>
<div class="container">
<h1>Patient Data</h1>
- <ul class="nav nav-tabs">
- <li class="nav-item">
- <a class="nav-link active" aria-current="page" href="#info">Info</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="#clinical">Clinical Notes</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="#report">Lab Reports</a>
- </li>
- </ul>
- <div id="info">
- <?php echo $info;?>
- <a class="mb-3 btn btn-primary" href="admission.php?id=<?php echo $id;?>">Edit Information</a>
- <div id="clinical">
- <?php foreach($clinical as $c) echo $c;?>
- <a class="mb-3 btn btn-primary" href="clinical.php?id=<?php echo $id;?>">Add Clinical Note</a>
- </div>
- <div id="report">
- <?php foreach($report as $r) echo $r;?>
- <a class="mb-3 btn btn-primary" href="laboratory.php?id=<?php echo $id;?>">Add Laboratory Report</a>
- </div>
- <div id="treatment" <?php if($info=="") echo "style='display:none'";?>>
- <a class="btn btn-success btn-lg" href="treatment.php?id=<?php echo $id;?>">Treatment</a>
- </div>
- <div <?php if($info!="") echo "style='display:none'";?>>
- <h1>Please enter a valid patient ID</h1>
- <form>
- <input name="id">
- <button type="submit">View</button>
- </form>
+ <div <?php if(empty($pid)) echo "style='display:none'";?>>
+ <ul class="nav nav-tabs">
+ <li class="nav-item">
+ <a class="nav-link active" aria-current="page" href="#info">Info</a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="#clinical">Clinical Notes</a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="#report">Lab Reports</a>
+ </li>
+ </ul>
+ <div id="info">
+ <?php echo $info;?>
+ <a class="mb-3 btn btn-primary" href="admission.php?pid=<?php echo $pid;?>">Edit Information</a>
+ <div id="clinical">
+ <?php foreach($clinical as $c) echo $c;?>
+ <a class="mb-3 btn btn-primary" href="clinical.php?pid=<?php echo $pid;?>">Add Clinical Note</a>
+ </div>
+ <div id="report">
+ <?php foreach($reports as $r) echo $r;?>
+ <a class="mb-3 btn btn-primary" href="laboratory.php?pid=<?php echo $pid;?>">Add Laboratory Report</a>
+ </div>
+ <div id="treatment" <?php if($info=="") echo "style='display:none'";?>>
+ <a class="btn btn-success btn-lg" href="treatment.php?pid=<?php echo $pid;?>">Treatment</a>
+ </div>
</div>
</div>
+ <div <?php if(!empty($pid)) echo "style='display:none'";?>>
+ <h1>Please enter a valid patient ID</h1>
+ <form>
+ <input class="form-control" name="pid">
+ <button class="form-control" type="submit">View</button>
+ </form>
+ </div>
</div>
</body>
</html>