From e2cc472be81cfd7987f3c5cbd98bfd8d3b0b3424 Mon Sep 17 00:00:00 2001 From: Agnibho Mondal Date: Sun, 16 May 2021 15:53:02 +0530 Subject: [PATCH] Added nursing note --- forms/nursing.schema.json | 48 +++++++++++++++++++ ...ical.schema.json => physician.schema.json} | 0 lib/db.php | 35 ++++++++++---- clinical.php => nursing.php | 10 ++-- physician.php | 42 ++++++++++++++++ schema.sql | 16 +++++-- view.php | 28 +++++++---- 7 files changed, 153 insertions(+), 26 deletions(-) create mode 100644 forms/nursing.schema.json rename forms/{clinical.schema.json => physician.schema.json} (100%) rename clinical.php => nursing.php (71%) create mode 100644 physician.php diff --git a/forms/nursing.schema.json b/forms/nursing.schema.json new file mode 100644 index 0000000..f2687f4 --- /dev/null +++ b/forms/nursing.schema.json @@ -0,0 +1,48 @@ +{ + "$schema": "http://json-schema.org/draft/2020-12/schema", + "title": "Clinical Notes", + "description": "Clinical Notes", + "type": "object", + + "properties": { + "date": { + "description": "Date", + "type": "string", + "format": "date" + }, + "time": { + "description": "Time", + "type": "string", + "format": "time" + }, + "status": { + "description": "Status", + "type": "string" + }, + "intake": { + "description": "Intake", + "type": "string" + }, + "output": { + "description": "Output", + "type": "string" + }, + "bp": { + "description": "Blood Pressure", + "type": "string" + }, + "pr": { + "description": "Pulse", + "type": "integer" + }, + "rr": { + "description": "Respiratory Rate", + "type": "integer" + }, + "spo2": { + "description": "SpO2", + "type": "integer" + } + }, + "required": ["date","time"] +} diff --git a/forms/clinical.schema.json b/forms/physician.schema.json similarity index 100% rename from forms/clinical.schema.json rename to forms/physician.schema.json diff --git a/lib/db.php b/lib/db.php index 67482ab..5c438b8 100644 --- a/lib/db.php +++ b/lib/db.php @@ -43,15 +43,30 @@ class DB extends SQLite3 { $stmt->bindValue(":pid", $pid); $stmt->execute(); } - function addClinical($post, $pid){ - $stmt=$this->prepare("INSERT INTO clinical (pid, time, data) VALUES (:pid, :time, :data);"); + 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 editClinical($post, $pid, $id){ - $stmt=$this->prepare("UPDATE clinical SET time=:time,data=:data WHERE pid=:pid AND rowid=:id;"); + 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"])); @@ -203,8 +218,10 @@ class DB extends SQLite3 { return($result); } function getData($pid, $id, $cat){ - if($cat=="clinical"){ - $stmt=$this->prepare("SELECT data FROM clinical WHERE pid=:pid AND rowid=:id;"); + 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{ @@ -216,8 +233,10 @@ class DB extends SQLite3 { return($result); } function getAllData($pid, $cat){ - if($cat=="clinical"){ - $stmt=$this->prepare("SELECT rowid,data FROM clinical WHERE pid=:pid;"); + 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"){ diff --git a/clinical.php b/nursing.php similarity index 71% rename from clinical.php rename to nursing.php index 1e580d6..8955a19 100644 --- a/clinical.php +++ b/nursing.php @@ -10,19 +10,19 @@ if(!empty($_GET["pid"])){ $pid=$_GET["pid"]; if(!empty($_POST["date"]) && !empty($_POST["time"])){ if(!empty($_GET["id"])){ - $db->editClinical($_POST, $pid, $_GET["id"]); + $db->editNursing($_POST, $pid, $_GET["id"]); } else{ - $db->addClinical($_POST, $pid); + $db->addNursing($_POST, $pid); } //header("Location: view.php?id=".$_GET["id"]); //exit(); } if(isSet($_GET["id"])){ - $form=schema2form("forms/clinical.schema.json", $pid, $_GET["id"], "clinical"); + $form=schema2form("forms/nursing.schema.json", $pid, $_GET["id"], "clinical"); } else{ - $form=schema2form("forms/clinical.schema.json"); + $form=schema2form("forms/nursing.schema.json"); } } ?> @@ -30,7 +30,7 @@ if(!empty($_GET["pid"])){ - Clinical Notes + Nursing Notes
diff --git a/physician.php b/physician.php new file mode 100644 index 0000000..941c16d --- /dev/null +++ b/physician.php @@ -0,0 +1,42 @@ +editPhysician($_POST, $pid, $_GET["id"]); + } + else{ + $db->addPhysician($_POST, $pid); + } + //header("Location: view.php?id=".$_GET["id"]); + //exit(); + } + if(isSet($_GET["id"])){ + $form=schema2form("forms/physician.schema.json", $pid, $_GET["id"], "clinical"); + } + else{ + $form=schema2form("forms/physician.schema.json"); + } +} +?> + + + + + Physician Notes + + +
+ + +
+ + + diff --git a/schema.sql b/schema.sql index bf3dc2e..b745a8c 100644 --- a/schema.sql +++ b/schema.sql @@ -1,8 +1,4 @@ -CREATE TABLE clinical( -pid int, -time int, -data text -); + CREATE TABLE death( pid int, time int, @@ -17,6 +13,11 @@ frequency text, duration text, addl text ); +CREATE TABLE nursing( +pid int, +time int, +data text +); CREATE TABLE patients( pid int unique, name text, @@ -32,6 +33,11 @@ bed int, data text, history text ); +CREATE TABLE physician( +pid int, +time int, +data text +); CREATE TABLE reports( pid int, time int, diff --git a/view.php b/view.php index 1d26146..a107381 100644 --- a/view.php +++ b/view.php @@ -7,16 +7,21 @@ if(empty($_SESSION["user"])){ exit(); } $info=""; -$clinical=[]; +$physician=[]; +$nursing=[]; $reports=[]; if(isSet($_GET["pid"])){ $pid=$_GET["pid"]; $status=$db->getStatus($pid)->fetchArray()["status"]; $info=viewData($db->getAdmission($pid)->fetchArray()["data"]); $history=viewData($db->getHistory($pid)->fetchArray()["history"]); - $clinicalArray=$db->getAllData($pid, "clinical"); - while($c=$clinicalArray->fetchArray()){ - array_push($clinical, viewData($c["data"], "clinical.php?pid=".$pid."&id=".$c["rowid"])); + $physicianArray=$db->getAllData($pid, "physician"); + while($c=$physicianArray->fetchArray()){ + array_push($physician, viewData($c["data"], "physician.php?pid=".$pid."&id=".$c["rowid"])); + } + $nursingArray=$db->getAllData($pid, "nursing"); + while($c=$nursingArray->fetchArray()){ + array_push($nursing, viewData($c["data"], "nursing.php?pid=".$pid."&id=".$c["rowid"])); } $reportsArray=$db->getAllData($pid, "reports"); while($r=$reportsArray->fetchArray()){ @@ -37,7 +42,8 @@ if(isSet($_GET["pid"])){
@@ -50,7 +56,10 @@ if(isSet($_GET["pid"])){ History +