]> Softwares of Agnibho - simpleipd.git/commitdiff
Added nursing note
authorAgnibho Mondal <mondal@agnibho.com>
Sun, 16 May 2021 10:23:02 +0000 (15:53 +0530)
committerAgnibho Mondal <mondal@agnibho.com>
Sun, 16 May 2021 10:23:02 +0000 (15:53 +0530)
clinical.php [deleted file]
forms/clinical.schema.json [deleted file]
forms/nursing.schema.json [new file with mode: 0644]
forms/physician.schema.json [new file with mode: 0644]
lib/db.php
nursing.php [new file with mode: 0644]
physician.php [new file with mode: 0644]
schema.sql
view.php

diff --git a/clinical.php b/clinical.php
deleted file mode 100644 (file)
index 1e580d6..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-require("lib/db.php");
-require("lib/functions.php");
-session_start();
-if(empty($_SESSION["user"])){
-  header("Location: login.php");
-  exit();
-}
-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");
-  }
-}
-?>
-<!DOCTYPE html>
-<html>
-  <head>
-    <?php include("lib/head.php");?>
-    <title>Clinical Notes</title>
-  </head>
-  <body>
-    <div class="container">
-      <?php echo getInfo($pid);?>
-      <?php echo $form;?>
-    </div>
-    <?php include("lib/foot.php");?>
-  </body>
-</html>
diff --git a/forms/clinical.schema.json b/forms/clinical.schema.json
deleted file mode 100644 (file)
index 6e91d7b..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-{
-    "$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"
-        },
-        "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 Findings",
-            "type": "string"
-        }
-    },
-    "required": ["date","time"]
-}
diff --git a/forms/nursing.schema.json b/forms/nursing.schema.json
new file mode 100644 (file)
index 0000000..f2687f4
--- /dev/null
@@ -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/physician.schema.json b/forms/physician.schema.json
new file mode 100644 (file)
index 0000000..6e91d7b
--- /dev/null
@@ -0,0 +1,44 @@
+{
+    "$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"
+        },
+        "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 Findings",
+            "type": "string"
+        }
+    },
+    "required": ["date","time"]
+}
index 67482ab02cd274d4f5efb0cf5be88eda099d89c5..5c438b8baa13083a840b50285caf53e163a88e6a 100644 (file)
@@ -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/nursing.php b/nursing.php
new file mode 100644 (file)
index 0000000..8955a19
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+require("lib/db.php");
+require("lib/functions.php");
+session_start();
+if(empty($_SESSION["user"])){
+  header("Location: login.php");
+  exit();
+}
+if(!empty($_GET["pid"])){
+  $pid=$_GET["pid"];
+  if(!empty($_POST["date"]) && !empty($_POST["time"])){
+    if(!empty($_GET["id"])){
+      $db->editNursing($_POST, $pid, $_GET["id"]);
+    }
+    else{
+      $db->addNursing($_POST, $pid);
+    }
+    //header("Location: view.php?id=".$_GET["id"]);
+    //exit();
+  }
+  if(isSet($_GET["id"])){
+    $form=schema2form("forms/nursing.schema.json", $pid, $_GET["id"], "clinical");
+  }
+  else{
+    $form=schema2form("forms/nursing.schema.json");
+  }
+}
+?>
+<!DOCTYPE html>
+<html>
+  <head>
+    <?php include("lib/head.php");?>
+    <title>Nursing Notes</title>
+  </head>
+  <body>
+    <div class="container">
+      <?php echo getInfo($pid);?>
+      <?php echo $form;?>
+    </div>
+    <?php include("lib/foot.php");?>
+  </body>
+</html>
diff --git a/physician.php b/physician.php
new file mode 100644 (file)
index 0000000..941c16d
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+require("lib/db.php");
+require("lib/functions.php");
+session_start();
+if(empty($_SESSION["user"])){
+  header("Location: login.php");
+  exit();
+}
+if(!empty($_GET["pid"])){
+  $pid=$_GET["pid"];
+  if(!empty($_POST["date"]) && !empty($_POST["time"])){
+    if(!empty($_GET["id"])){
+      $db->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");
+  }
+}
+?>
+<!DOCTYPE html>
+<html>
+  <head>
+    <?php include("lib/head.php");?>
+    <title>Physician Notes</title>
+  </head>
+  <body>
+    <div class="container">
+      <?php echo getInfo($pid);?>
+      <?php echo $form;?>
+    </div>
+    <?php include("lib/foot.php");?>
+  </body>
+</html>
index bf3dc2eaf7665b9c8db588f95946770499b5849f..b745a8cc62e6d44d433df151310f9c04da26268f 100644 (file)
@@ -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,
index 1d2614632fc22be8047ebce259a9c011ff0b15a9..a10738129bc4575eab264df0ffaef7ed173c4ae4 100644 (file)
--- 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"])){
         <div class="card-body">
             <a class="mb-3 btn btn-secondary" href="admission.php?pid=<?php echo $pid;?>">Edit Information</a>
             <a class="mb-3 btn btn-secondary" href="history.php?pid=<?php echo $pid;?>">Edit History</a>
-            <a class="mb-3 btn btn-secondary" href="clinical.php?pid=<?php echo $pid;?>">Add Clinical Note</a>
+            <a class="mb-3 btn btn-secondary" href="physician.php?pid=<?php echo $pid;?>">Add Physician Note</a>
+            <a class="mb-3 btn btn-secondary" href="nursing.php?pid=<?php echo $pid;?>">Add Nursing Note</a>
             <a class="mb-3 btn btn-secondary" href="laboratory.php?pid=<?php echo $pid;?>">Add Laboratory Report</a>
         </div>
       </div>
@@ -50,7 +56,10 @@ if(isSet($_GET["pid"])){
             <a class="nav-link" id="history-tab" data-toggle="tab" href="#history" role="tab" aria-controls="history" aria-selected="false">History</a>
           </li>
           <li class="nav-item" role="presentation">
-            <a class="nav-link" id="clinical-tab" data-toggle="tab" href="#clinical" role="tab" aria-controls="clinical" aria-selected="false">Clinical Notes</a>
+            <a class="nav-link" id="physician-tab" data-toggle="tab" href="#physician" role="tab" aria-controls="physician" aria-selected="false">Physician Notes</a>
+          </li>
+          <li class="nav-item" role="presentation">
+            <a class="nav-link" id="nursing-tab" data-toggle="tab" href="#nursing" role="tab" aria-controls="clinical" aria-selected="false">Nursing Notes</a>
           </li>
           <li class="nav-item" role="presentation">
             <a class="nav-link" id="report-tab" data-toggle="tab" href="#report" role="tab" aria-controls="report" aria-selected="false">Lab Reports</a>
@@ -64,8 +73,11 @@ if(isSet($_GET["pid"])){
           <div class="tab-pane fade" id="history" role="tabpanel" aria-labelledby="history-tab">
             <?php echo $history;?>
           </div>
-          <div class="tab-pane fade" id="clinical" role="tabpanel" aria-labelledby="clinical-tab">
-            <?php foreach($clinical as $c) echo $c;?>
+          <div class="tab-pane fade" id="physician" role="tabpanel" aria-labelledby="physician-tab">
+            <?php foreach($physician as $p) echo $p;?>
+          </div>
+          <div class="tab-pane fade" id="nursing" role="tabpanel" aria-labelledby="nursing-tab">
+            <?php foreach($nursing as $n) echo $n;?>
           </div>
           <div class="tab-pane fade" id="report" role="tabpanel" aria-labelledby="report-tab">
             <?php foreach($reports as $r) echo $r;?>