From: Agnibho Mondal
Date: Sun, 16 May 2021 16:24:38 +0000 (+0530)
Subject: Added requisition
X-Git-Url: https://code.agnibho.com/repo?a=commitdiff_plain;h=ca3d919de1a868c47998aff2364d1289c6b3c2e7;p=simpleipd.git
Added requisition
---
diff --git a/' b/'
new file mode 100644
index 0000000..380aab9
--- /dev/null
+++ b/'
@@ -0,0 +1,276 @@
+open("data/data.db");
+ }
+ function checkUser($username, $password){
+ $stmt=$this->prepare("SELECT hash FROM users WHERE user=:user");
+ $stmt->bindValue(":user", $username);
+ $result=$stmt->execute();
+ $hash=$result->fetchArray();
+ if($hash){
+ return(password_verify($password, $hash["hash"]));
+ }
+ else{
+ return(false);
+ }
+ }
+ function admit($post){
+ $quer=$this->prepare("SELECT count(rowid) FROM patients WHERE pid=:pid");
+ $quer->bindValue(":pid", $post["pid"]);
+ $exist=$quer->execute();
+ if($exist->fetchArray()[0]==0){
+ $stmt=$this->prepare("INSERT INTO patients (pid,name,age,sex,status,summary,ward,bed,diagnosis,data) VALUES (:pid,:name,:age,:sex,'admitted',:summary,:ward,:bed,:diagnosis,:data);");
+ }
+ else{
+ $stmt=$this->prepare("UPDATE patients SET name=:name,age=:age,sex=:sex,ward=:ward,bed=:bed,diagnosis=:diagnosis,summary=:summary,data=:data WHERE pid=:pid;");
+ }
+ $stmt->bindValue(":pid", $post["pid"]);
+ $stmt->bindValue(":name", $post["name"]);
+ $stmt->bindValue(":age", $post["age"]);
+ $stmt->bindValue(":sex", $post["sex"]);
+ $stmt->bindValue(":status", "admitted");
+ $stmt->bindValue(":ward", $post["ward"]);
+ $stmt->bindValue(":bed", $post["bed"]);
+ $stmt->bindValue(":diagnosis", $post["diagnosis"]);
+ $stmt->bindValue(":summary", $post["summary"]);
+ $stmt->bindValue(":data", json_encode($post));
+ $stmt->execute();
+ }
+ function updateHistory($post, $pid){
+ $stmt=$this->prepare("UPDATE patients SET history=:history WHERE pid=:pid;");
+ $stmt->bindValue(":history", json_encode($post));
+ $stmt->bindValue(":pid", $pid);
+ $stmt->execute();
+ }
+ function addPhysician($post, $pid){
+ $stmt=$this->prepare("INSERT INTO physician (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 editPhysician($post, $pid, $id){
+ $stmt=$this->prepare("UPDATE physician 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 addNursing($post, $pid){
+ $stmt=$this->prepare("INSERT INTO nursing (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 editNursing($post, $pid, $id){
+ $stmt=$this->prepare("UPDATE nursing 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, $drug, $dose, $route, $frequency, $date, $time, $duration, $addl){
+ $stmt=$this->prepare("INSERT INTO treatment (pid, drug, dose, route, frequency, start, duration, omit, addl) VALUES (:pid, :drug, :dose, :route, :frequency, :start, :duration, :omit, :addl);");
+ $stmt->bindValue(":pid", $pid);
+ $stmt->bindValue(":drug", $drug);
+ $stmt->bindValue(":dose", $dose);
+ $stmt->bindValue(":route", $route);
+ $stmt->bindValue(":frequency", $frequency);
+ $stmt->bindValue(":start", strtotime($date." ".$time));
+ $stmt->bindValue(":duration", $duration);
+ $stmt->bindValue(":addl", $addl);
+ $stmt->bindValue(":omit", false);
+ $stmt->execute();
+ }
+ function omitDrug($id){
+ $stmt=$this->prepare("UPDATE treatment SET end=:end,omit=:omit WHERE rowid=:id;");
+ $stmt->bindValue(":end", time());
+ $stmt->bindValue(":omit", true);
+ $stmt->bindValue(":id", $id);
+ $stmt->execute();
+ }
+ function addRequisition($pid, $test, $date, $time, $room){
+ $stmt=$this->prepare("INSERT INTO requisition (pid, test, time, room, sample, status) VALUES (:pid, :test, :time, :room, :sample, :status);");
+ $stmt->bindValue(":pid", $pid);
+ $stmt->bindValue(":test", $test);
+ $stmt->bindValue(":time", strtotime($date." ".$time));
+ $stmt->bindValue(":room", $room);
+ $stmt->bindValue(":status", "sent");
+ $stmt->execute();
+ }
+ function omitRequisition($id){
+ $stmt=$this->prepare("UPDATE requisition SET status=:status WHERE rowid=:id;");
+ $stmt->bindValue(":status", "done");
+ $stmt->bindValue(":id", $id);
+ $stmt->execute();
+ }
+ function addAdvice($pid, $name, $dose, $route, $frequency, $duration, $addl){
+ $stmt=$this->prepare("INSERT INTO discharge (pid, name, dose, route, frequency, duration, addl) VALUES (:pid, :name, :dose, :route, :frequency, :duration, :addl);");
+ $stmt->bindValue(":pid", $pid);
+ $stmt->bindValue(":name", $name);
+ $stmt->bindValue(":dose", $dose);
+ $stmt->bindValue(":route", $route);
+ $stmt->bindValue(":frequency", $frequency);
+ $stmt->bindValue(":duration", $duration);
+ $stmt->bindValue(":addl", $addl);
+ $stmt->execute();
+ }
+ function deleteAdvice($id){
+ $stmt=$this->prepare("DELETE FROM discharge WHERE rowid=:id;");
+ $stmt->bindValue(":id", $id);
+ $stmt->execute();
+ }
+ function setDischarged($pid){
+ $stmt=$this->prepare("UPDATE patients SET status=:discharged WHERE pid=:pid;");
+ $stmt->bindValue(":pid", $pid);
+ $stmt->execute();
+ }
+ function setDead($pid, $post){
+ $stmt=$this->prepare("INSERT INTO death (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();
+ $stmt=$this->prepare("UPDATE patients SET status='expired' WHERE pid=:pid;");
+ $stmt->bindValue(":pid", $pid);
+ $stmt->execute();
+ }
+ function getDrugs($pid){
+ $stmt=$this->prepare("SELECT rowid,* FROM treatment WHERE pid=:pid;");
+ $stmt->bindValue(":pid", $pid);
+ $result=$stmt->execute();
+ return($result);
+ }
+ function getRequisitions($pid){
+ $stmt=$this->prepare("SELECT rowid,* FROM requisition WHERE pid=:pid;");
+ $stmt->bindValue(":pid", $pid);
+ $result=$stmt->execute();
+ return($result);
+ }
+ function getAdvice($pid){
+ $stmt=$this->prepare("SELECT rowid,* FROM discharge 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 getWard($pid){
+ $stmt=$this->prepare("SELECT ward FROM patients WHERE pid=:pid;");
+ $stmt->bindValue(":pid", $pid);
+ $result=$stmt->execute();
+ return($result);
+ }
+ function getBed($pid){
+ $stmt=$this->prepare("SELECT bed FROM patients WHERE pid=:pid;");
+ $stmt->bindValue(":pid", $pid);
+ $result=$stmt->execute();
+ return($result);
+ }
+ function getStatus($pid){
+ $stmt=$this->prepare("SELECT status FROM patients WHERE pid=:pid;");
+ $stmt->bindValue(":pid", $pid);
+ $result=$stmt->execute();
+ return($result);
+ }
+ function getDiagnosis($pid){
+ $stmt=$this->prepare("SELECT diagnosis 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 getAdmission($pid){
+ $stmt=$this->prepare("SELECT data FROM patients WHERE pid=:pid;");
+ $stmt->bindValue(":pid", $pid);
+ $result=$stmt->execute();
+ return($result);
+ }
+ function getHistory($pid){
+ $stmt=$this->prepare("SELECT history FROM patients WHERE pid=:pid;");
+ $stmt->bindValue(":pid", $pid);
+ $result=$stmt->execute();
+ return($result);
+ }
+ function getData($pid, $id, $cat){
+ if($cat=="physician"){
+ $stmt=$this->prepare("SELECT data FROM physician WHERE pid=:pid AND rowid=:id;");
+ } elseif($cat=="nursing"){
+ $stmt=$this->prepare("SELECT data FROM nursing WHERE pid=:pid AND rowid=:id;");
+ } elseif($cat=="reports"){
+ $stmt=$this->prepare("SELECT data FROM reports WHERE pid=:pid AND rowid=:id;");
+ } else{
+ return(false);
+ }
+ $stmt->bindValue(":pid", $pid);
+ $stmt->bindValue(":id", $id);
+ $result=$stmt->execute();
+ return($result);
+ }
+ function getAllData($pid, $cat){
+ if($cat=="physician"){
+ $stmt=$this->prepare("SELECT rowid,data FROM physician WHERE pid=:pid;");
+ } elseif($cat=="nursing"){
+ $stmt=$this->prepare("SELECT rowid,data FROM nursing WHERE pid=:pid;");
+ } elseif($cat=="reports"){
+ $stmt=$this->prepare("SELECT rowid,data FROM reports WHERE pid=:pid;");
+ } elseif($cat=="info"){
+ $stmt=$this->prepare("SELECT rowid,data FROM patients WHERE pid=:pid;");
+ } elseif($cat=="history"){
+ $stmt=$this->prepare("SELECT rowid,history FROM patients WHERE pid=:pid;");
+ } else{
+ return(false);
+ }
+ $stmt->bindValue(":pid", $pid);
+ $result=$stmt->execute();
+ return($result);
+ }
+}
+$db = new DB();
+?>
diff --git a/autocomplete/investigation.json b/autocomplete/investigation.json
new file mode 100644
index 0000000..641450e
--- /dev/null
+++ b/autocomplete/investigation.json
@@ -0,0 +1,13 @@
+{
+ "tests": [
+ "Chest Xray",
+ "Straight Xray Abdomen",
+ "USG W/A"
+ ],
+ "rooms": [
+ "LabMed",
+ "R-4",
+ "R-19A",
+ "Other"
+ ]
+}
diff --git a/forms/admission.schema.json b/forms/admission.schema.json
index 2a58dd7..24a5bc0 100644
--- a/forms/admission.schema.json
+++ b/forms/admission.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "Admission Form",
+ "title": "admission",
"description": "Admission Form",
"type": "object",
diff --git a/forms/death.schema.json b/forms/death.schema.json
index a3dd706..dbdb9bb 100644
--- a/forms/death.schema.json
+++ b/forms/death.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "Death Note",
+ "title": "death",
"description": "Death Note",
"type": "object",
diff --git a/forms/drugs.schema.json b/forms/drugs.schema.json
index 8605693..f3be494 100644
--- a/forms/drugs.schema.json
+++ b/forms/drugs.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "Drugs",
+ "title": "drugs",
"description": "Treatment",
"type": "object",
diff --git a/forms/history.schema.json b/forms/history.schema.json
index 0647afa..1349c66 100644
--- a/forms/history.schema.json
+++ b/forms/history.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "History",
+ "title": "history",
"description": "History",
"type": "object",
diff --git a/forms/nursing.schema.json b/forms/nursing.schema.json
index f2687f4..03ddc37 100644
--- a/forms/nursing.schema.json
+++ b/forms/nursing.schema.json
@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "Clinical Notes",
- "description": "Clinical Notes",
+ "title": "nursing",
+ "description": "Nursing Notes",
"type": "object",
"properties": {
diff --git a/forms/physician.schema.json b/forms/physician.schema.json
index 6e91d7b..c4c1056 100644
--- a/forms/physician.schema.json
+++ b/forms/physician.schema.json
@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "Clinical Notes",
- "description": "Clinical Notes",
+ "title": "physician",
+ "description": "Physician Notes",
"type": "object",
"properties": {
diff --git a/forms/report-abg.schema.json b/forms/report-abg.schema.json
index 0ed6f56..1c01577 100644
--- a/forms/report-abg.schema.json
+++ b/forms/report-abg.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "ABG",
+ "title": "abg",
"description": "ABG",
"type": "object",
diff --git a/forms/report-blood-cs.schema.json b/forms/report-blood-cs.schema.json
index 51dfa1d..ed9fe1f 100644
--- a/forms/report-blood-cs.schema.json
+++ b/forms/report-blood-cs.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "Blood CS",
+ "title": "blood_cs",
"description": "Blood CS",
"type": "object",
diff --git a/forms/report-ch.schema.json b/forms/report-ch.schema.json
index 3c33b71..7fcec71 100644
--- a/forms/report-ch.schema.json
+++ b/forms/report-ch.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "Complete Hemogram",
+ "title": "ch",
"description": "Complete Hemogram",
"type": "object",
diff --git a/forms/report-crp.schema.json b/forms/report-crp.schema.json
index 08ce181..c996b50 100644
--- a/forms/report-crp.schema.json
+++ b/forms/report-crp.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "CRP",
+ "title": "crp",
"description": "CRP",
"type": "object",
diff --git a/forms/report-ddimer.schema.json b/forms/report-ddimer.schema.json
index f638073..8e26f79 100644
--- a/forms/report-ddimer.schema.json
+++ b/forms/report-ddimer.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "D-Dimer",
+ "title": "d_dimer",
"description": "D-Dimer",
"type": "object",
diff --git a/forms/report-fluid.schema.json b/forms/report-fluid.schema.json
index 62bd4dc..8b3f02d 100644
--- a/forms/report-fluid.schema.json
+++ b/forms/report-fluid.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "Fluid Study",
+ "title": "fluid_study",
"description": "Fluid Study",
"type": "object",
diff --git a/forms/report-glycemic.schema.json b/forms/report-glycemic.schema.json
index 0875fb0..6109d78 100644
--- a/forms/report-glycemic.schema.json
+++ b/forms/report-glycemic.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "Glycemic Status",
+ "title": "glycemic",
"description": "Glycemic Status",
"type": "object",
diff --git a/forms/report-ldh.schema.json b/forms/report-ldh.schema.json
index cce1e38..e22f810 100644
--- a/forms/report-ldh.schema.json
+++ b/forms/report-ldh.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "LDH",
+ "title": "ldh",
"description": "LDH",
"type": "object",
diff --git a/forms/report-lft.schema.json b/forms/report-lft.schema.json
index 2f89980..6401cad 100644
--- a/forms/report-lft.schema.json
+++ b/forms/report-lft.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "LFT",
+ "title": "lft",
"description": "Liver Function Test",
"type": "object",
diff --git a/forms/report-lipid.schema.json b/forms/report-lipid.schema.json
index a203b15..d9052c4 100644
--- a/forms/report-lipid.schema.json
+++ b/forms/report-lipid.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "Lipid Profile",
+ "title": "lipid",
"description": "Lipid Profile",
"type": "object",
diff --git a/forms/report-other.schema.json b/forms/report-other.schema.json
index ba613ec..57749cb 100644
--- a/forms/report-other.schema.json
+++ b/forms/report-other.schema.json
@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "Other Reports",
- "description": "Other Reports",
+ "title": "other",
+ "description": "Other Report",
"type": "object",
"properties": {
diff --git a/forms/report-rft.schema.json b/forms/report-rft.schema.json
index 65df1d7..874f8f2 100644
--- a/forms/report-rft.schema.json
+++ b/forms/report-rft.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "RFT",
+ "title": "rft",
"description": "Renal Function Test",
"type": "object",
diff --git a/forms/report-sputum-cs.schema.json b/forms/report-sputum-cs.schema.json
index 8ebf011..65d115f 100644
--- a/forms/report-sputum-cs.schema.json
+++ b/forms/report-sputum-cs.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "Sputum CS",
+ "title": "sputum_cs",
"description": "Sputum CS",
"type": "object",
diff --git a/forms/report-sputum-me.schema.json b/forms/report-sputum-me.schema.json
index 596507f..5883911 100644
--- a/forms/report-sputum-me.schema.json
+++ b/forms/report-sputum-me.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "Sputum ME",
+ "title": "sputum_me",
"description": "Sputum ME",
"type": "object",
diff --git a/forms/report-stool-ova.schema.json b/forms/report-stool-ova.schema.json
index 3551731..8e2cd78 100644
--- a/forms/report-stool-ova.schema.json
+++ b/forms/report-stool-ova.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "Stool for Ova",
+ "title": "stool_ova",
"description": "Stool for Ova",
"type": "object",
diff --git a/forms/report-stool-re.schema.json b/forms/report-stool-re.schema.json
index ab7ac56..9db09db 100644
--- a/forms/report-stool-re.schema.json
+++ b/forms/report-stool-re.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "Stool RE",
+ "title": "stool_re",
"description": "Stool RE",
"type": "object",
diff --git a/forms/report-urine-cs.schema.json b/forms/report-urine-cs.schema.json
index 93d8d5a..16af87c 100644
--- a/forms/report-urine-cs.schema.json
+++ b/forms/report-urine-cs.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "Urine CS",
+ "title": "urine_cs",
"description": "Urine CS",
"type": "object",
diff --git a/forms/report-urine-re.schema.json b/forms/report-urine-re.schema.json
index ac114f2..80a2e0a 100644
--- a/forms/report-urine-re.schema.json
+++ b/forms/report-urine-re.schema.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
- "title": "Urine RE",
+ "title": "urine_re",
"description": "Urine RE",
"type": "object",
diff --git a/index.php b/index.php
index 72bc484..94632b1 100644
--- a/index.php
+++ b/index.php
@@ -2,19 +2,28 @@
require("lib/db.php");
require("lib/functions.php");
session_start();
+var_dump($_SESSION);
if(empty($_SESSION["user"])){
header("Location: login.php");
exit();
}
-$list=$db->getList();
-$show="";
-if(!empty($list)){
- while($arr=$list->fetchArray()){
- $pid=$arr["pid"];
- $name=$db->getName($pid)->fetchArray()["name"];
- $bed=$db->getWard($pid)->fetchArray()["ward"]."-".$db->getBed($pid)->fetchArray()["bed"];
- $show=$show."".$pid." | ".$bed." | ".$name." |
";
+$list=$db->getPatientList();
+$showList="";
+while($arr=$list->fetchArray()){
+ $pid=$arr["pid"];
+ $showList=$showList."".$pid." | ".$arr["ward"]."-".$arr["bed"]." | ".$arr["name"]." | ".$arr["diagnosis"]." |
";
+}
+$reqs=$db->getRequisitionList();
+$showReqs="";
+while($arr=$reqs->fetchArray()){
+ $pid=$arr["pid"];
+ if(!empty($arr["form"])){
+ $test="".$arr["test"]."";
+ }
+ else{
+ $test="".$arr["test"]."";
}
+ $showReqs=$showReqs."".$test." | ".$arr["room"]." | ".date("M j, Y", $arr["time"])." | ".$pid." |
";
}
?>
@@ -30,12 +39,21 @@ if(!empty($list)){
Patient List
- Patient ID | Bed Number | Name |
-
+ Patient ID | Bed Number | Name | Diagnosis |
+
Add New Patient
+
+
+
Requisition List
+
+ Test Needed | Place | Date | Patient ID |
+
+
+
+
+
+
+
+
List of Requisitions
+
+
+ Test Name | Destination | Date | |
+
+
+
+
+
+
diff --git a/lib/db.php b/lib/db.php
index 5c438b8..a37bf66 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -109,6 +109,22 @@ class DB extends SQLite3 {
$stmt->bindValue(":id", $id);
$stmt->execute();
}
+ function addRequisition($pid, $test, $date, $time, $room, $form){
+ $stmt=$this->prepare("INSERT INTO requisition (pid, test, time, room, form, status) VALUES (:pid, :test, :time, :room, :form, :status);");
+ $stmt->bindValue(":pid", $pid);
+ $stmt->bindValue(":test", $test);
+ $stmt->bindValue(":time", strtotime($date." ".$time));
+ $stmt->bindValue(":room", $room);
+ $stmt->bindValue(":form", $form);
+ $stmt->bindValue(":status", "active");
+ $stmt->execute();
+ }
+ function omitRequisition($id){
+ $stmt=$this->prepare("UPDATE requisition SET status=:status WHERE rowid=:id;");
+ $stmt->bindValue(":status", "done");
+ $stmt->bindValue(":id", $id);
+ $stmt->execute();
+ }
function addAdvice($pid, $name, $dose, $route, $frequency, $duration, $addl){
$stmt=$this->prepare("INSERT INTO discharge (pid, name, dose, route, frequency, duration, addl) VALUES (:pid, :name, :dose, :route, :frequency, :duration, :addl);");
$stmt->bindValue(":pid", $pid);
@@ -146,6 +162,13 @@ class DB extends SQLite3 {
$result=$stmt->execute();
return($result);
}
+ function getRequisitions($pid){
+ $stmt=$this->prepare("SELECT rowid,* FROM requisition WHERE pid=:pid AND status=:status;");
+ $stmt->bindValue(":pid", $pid);
+ $stmt->bindValue(":status", "active");
+ $result=$stmt->execute();
+ return($result);
+ }
function getAdvice($pid){
$stmt=$this->prepare("SELECT rowid,* FROM discharge WHERE pid=:pid;");
$stmt->bindValue(":pid", $pid);
@@ -194,8 +217,14 @@ class DB extends SQLite3 {
$result=$stmt->execute();
return($result);
}
- function getList(){
- $stmt=$this->prepare("SELECT pid FROM patients;");
+ function getPatientList(){
+ $stmt=$this->prepare("SELECT pid,ward,bed,name,diagnosis FROM patients;");
+ $result=$stmt->execute();
+ return($result);
+ }
+ function getRequisitionList(){
+ $stmt=$this->prepare("SELECT rowid,pid,test,room,time,form FROM requisition WHERE status=:active;");
+ $stmt->bindValue(":active", "active");
$result=$stmt->execute();
return($result);
}
diff --git a/report.php b/report.php
index d21f96c..c791892 100644
--- a/report.php
+++ b/report.php
@@ -15,6 +15,9 @@ if(!empty($_GET["pid"]) && !empty($_GET["form"])){
else{
$db->addReport($_POST, $pid, $_POST["form"]);
}
+ if(!empty($_GET["req"])){
+ $db->omitRequisition($_GET["req"]);
+ }
//header("Location: view.php?id=".$_GET["id"]);
//exit();
}
diff --git a/requisition.php b/requisition.php
new file mode 100644
index 0000000..723059c
--- /dev/null
+++ b/requisition.php
@@ -0,0 +1,90 @@
+omitRequisition($_POST["del"]);
+ }
+ if(!empty($_POST["test"])){
+ if(file_exists($_POST["test"])){
+ $form=str_replace(["forms/",".schema.json"], "", $_POST["test"]);
+ $test=json_decode(file_get_contents("forms/".$form.".schema.json"))->description;
+ }
+ else{
+ $test=$_POST["test"];
+ $form="";
+ }
+ $db->addRequisition($pid, $test, $_POST["date"], $_POST["time"], $_POST["room"], $form);
+ }
+ $inv=json_decode(file_get_contents("autocomplete/investigation.json"));
+ $testList="";
+ foreach(glob("forms/report*.json") as $file){
+ $form=json_decode(file_get_contents($file));
+ $testList=$testList."";
+ }
+ foreach($inv->tests as $t){
+ $testList=$testList."";
+ }
+ $roomList="";
+ foreach($inv->rooms as $r){
+ $roomList=$roomList."";
+ }
+ $roomList=$roomList."";
+
+ $reqList=$db->getRequisitions($pid);
+ $list="";
+ while($req=$reqList->fetchArray()){
+ $list=$list."