]> Softwares of Agnibho - simpleipd.git/commitdiff
Added vitek reports
authorAgnibho Mondal <mondal@agnibho.com>
Wed, 19 May 2021 14:03:50 +0000 (19:33 +0530)
committerAgnibho Mondal <mondal@agnibho.com>
Wed, 19 May 2021 14:03:50 +0000 (19:33 +0530)
39 files changed:
access.json
data.schema.sql
lib/db.php
lib/functions.php
require.php
www/antibiogram.php [new file with mode: 0644]
www/attachments.php
www/autocomplete/investigation.json
www/autocomplete/vitek.json [new file with mode: 0644]
www/discharge.php
www/forms/report-abg.schema.json
www/forms/report-blood-cs.schema.json [deleted file]
www/forms/report-ch.schema.json
www/forms/report-crp.schema.json
www/forms/report-cs.schema.json [new file with mode: 0644]
www/forms/report-ddimer.schema.json
www/forms/report-fluid-ascitic.schema.json
www/forms/report-fluid-csf.schema.json [deleted file]
www/forms/report-fluid-pleural.schema.json [deleted file]
www/forms/report-fluid-synovial.schema.json [deleted file]
www/forms/report-glycemic.schema.json
www/forms/report-ldh.schema.json
www/forms/report-lft.schema.json
www/forms/report-lipid.schema.json
www/forms/report-other.schema.json
www/forms/report-rft.schema.json
www/forms/report-sputum-cs.schema.json [deleted file]
www/forms/report-sputum-me.schema.json
www/forms/report-stool-ova.schema.json
www/forms/report-stool-re.schema.json
www/forms/report-urine-cs.schema.json [deleted file]
www/forms/report-urine-re.schema.json
www/index.php
www/laboratory.php
www/report.php
www/requisition.php
www/res/script.js
www/view.php
www/vitek.php [new file with mode: 0644]

index 8cab72608f538e0f5f20c2c507f25316fd6c6135..569c3a5c46906a6224ae1eba18074863a638361e 100644 (file)
         "nursing": "all",
         "lab": "all",
         "clerk": "view"
+    },
+    "vitek": {
+        "admin": "all",
+        "visiting": "all",
+        "resident": "all",
+        "nursing": "all",
+        "lab": "all",
+        "clerk": "view"
+    },
+
+    "antibiogram": {
+        "admin": "all",
+        "visiting": "all",
+        "resident": "all",
+        "nursing": "view",
+        "lab": "all",
+        "clerk": "view"
     }
 }
index 51883e5773bf3413310696486c31b5a1fdd05e93..579ec1883916aae36153a15bac3124ef89cd2f07 100644 (file)
@@ -1,4 +1,3 @@
-
 CREATE TABLE death(
 pid int,
 time int,
@@ -42,15 +41,16 @@ data text
 CREATE TABLE reports(
 pid int,
 time int,
+sample text,
 form text,
 data text
 );
 CREATE TABLE requisition(
 pid int,
 test text,
+sample text,
 time int,
 room text,
-sample text,
 form text,
 status text
 );
index c3228d716591f32049d22531eee71204c8b48e5b..2d2e5b4b75c40b8335254777adf38f476ac74f6a 100644 (file)
@@ -120,7 +120,12 @@ class DB extends SQLite3 {
     if(!checkAccess("report", "dbSet")) return false;
     $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"]));
+    if(!empty($post["time"])){
+      $stmt->bindValue(":time", strtotime($post["date"].$post["time"]));
+    }
+    else{
+      $stmt->bindValue(":time", strtotime($post["date"]));
+    }
     $stmt->bindValue(":form", $post["form"]);
     $stmt->bindValue(":data", json_encode($post));
     $stmt->execute();
@@ -132,7 +137,12 @@ class DB extends SQLite3 {
     $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"]));
+    if(!empty($post["time"])){
+      $stmt->bindValue(":time", strtotime($post["date"].$post["time"]));
+    }
+    else{
+      $stmt->bindValue(":time", strtotime($post["date"]));
+    }
     $stmt->bindValue(":data", json_encode($post));
     $stmt->execute();
     $log->log($pid, "report_edited", json_encode($post));
@@ -163,12 +173,13 @@ class DB extends SQLite3 {
     $stmt->execute();
     $log->log(null, "drug_omitted", $id);
   }
-  function addRequisition($pid, $test, $date, $time, $room, $form){
+  function addRequisition($pid, $test, $sample, $date, $time, $room, $form){
     global $log;
     if(!checkAccess("requisition", "dbSet")) return false;
-    $stmt=$this->prepare("INSERT INTO requisition (pid, test, time, room, form, status) VALUES (:pid, :test, :time, :room, :form, :status);");
+    $stmt=$this->prepare("INSERT INTO requisition (pid, test, sample, time, room, form, status) VALUES (:pid, :test, :sample, :time, :room, :form, :status);");
     $stmt->bindValue(":pid", $pid);
     $stmt->bindValue(":test", $test);
+    $stmt->bindValue(":sample", $sample);
     $stmt->bindValue(":time", strtotime($date." ".$time));
     $stmt->bindValue(":room", $room);
     $stmt->bindValue(":form", $form);
@@ -318,7 +329,7 @@ class DB extends SQLite3 {
   function getRequisitionList(){
     global $log;
     if(!checkAccess("requisition", "dbGet")) return false;
-    $stmt=$this->prepare("SELECT rowid,pid,test,room,time,form FROM requisition WHERE status=:active;");
+    $stmt=$this->prepare("SELECT rowid,pid,test,sample,room,time,form FROM requisition WHERE status=:active;");
     $stmt->bindValue(":active", "active");
     $result=$stmt->execute();
     return($result);
@@ -381,7 +392,7 @@ class DB extends SQLite3 {
       $stmt=$this->prepare("SELECT data FROM nursing WHERE pid=:pid AND rowid=:id ORDER BY time DESC;");
     } elseif($cat=="reports"){
       if(!checkAccess("report", "dbGet")) return false;
-      $stmt=$this->prepare("SELECT data FROM reports WHERE pid=:pid AND rowid=:id ORDER BY time DESC;");
+      $stmt=$this->prepare("SELECT form,data FROM reports WHERE pid=:pid AND rowid=:id ORDER BY time DESC;");
     } else{
       return(false);
     }
@@ -400,7 +411,7 @@ class DB extends SQLite3 {
       $stmt=$this->prepare("SELECT rowid,data FROM nursing WHERE pid=:pid ORDER BY time DESC;");
     } elseif($cat=="reports"){
       if(!checkAccess("report", "dbGet")) return false;
-      $stmt=$this->prepare("SELECT rowid,data FROM reports WHERE pid=:pid ORDER BY time DESC;");
+      $stmt=$this->prepare("SELECT rowid,form,data FROM reports WHERE pid=:pid ORDER BY time DESC;");
     } elseif($cat=="info"){
       if(!checkAccess("info", "dbGet")) return false;
       $stmt=$this->prepare("SELECT rowid,data FROM patients WHERE pid=:pid ORDER BY time DESC;");
index ea2ff2d861ca01ae8194d24157d5921a25555243..2ee182aee48354a17c8f01a7b2b5bd63f25e4180 100644 (file)
@@ -91,8 +91,24 @@ function viewData($data, $edit=null){
     }
     unset($data->cat);
     $view="<table class='table'>";
+    if(!empty($schema->description)){
+      $description=$schema->description;
+    }
+    else{
+      $description="";
+    }
+    if(!empty($data->date)){
+      if(!empty($data->time)){
+        $date=$data->date." ".$data->time;
+      }
+      $date=$data->date;
+    }
+    else{
+      $date="";
+    }
+    $view=$view."<tr><th>".$description."</th><th>".$date."</th></tr>";
     foreach($data as $field=>$value){
-      if(!empty($value) && $field!="form"){
+      if(!empty($value) && $field!="form" && $field!="date" && $field!="time"){
         if(!empty($schema->properties->$field)){
           $view=$view."<tr><td>".$schema->properties->$field->description."</td><td>".$value."</td></tr>";
         }
@@ -105,7 +121,7 @@ function viewData($data, $edit=null){
       }
     }
     if(!empty($edit)){
-      $view=$view."<tr><td><a href='".$edit."'>Edit</a>";
+      $view=$view."<tr><td colspan='2'><a href='".$edit."'>Edit</a>";
     }
     $view=$view."</table>";
     return $view;
@@ -115,6 +131,25 @@ function viewData($data, $edit=null){
   }
 }
 
+function viewAntibiogram($data, $edit){
+  $data=json_decode($data);
+  $view="<table class='table table-striped'>";
+  $view=$view."<tr><th>Vitek Report</th><th colspan='2'>".$data->date."</th></tr>";
+  $view=$view."<tr><td>Sample</td><td colspan='2'>".$data->sample."</td></tr>";
+  $view=$view."<tr><th>Antibiotic</th><th>MIC</th><th>Interpretation</th>";
+  foreach($data as $k=>$v){
+    if(is_object($v)){
+      $view=$view."<tr><td>".$v->name."</td><td>".$v->mic."</td><td>".$v->interpretation."</td></tr>";
+    }
+  }
+  if(!empty($data->note)){
+    $view=$view."<tr><td>Note</td><td colspan='2'>".$data->note."</td></tr>";
+  }
+  $view=$view."<tr><td colspan='2'><a href='".$edit."'>Edit</a></td></tr>";
+  $view=$view."</table>";
+  return $view;
+}
+
 function view_drug($file){
   if(is_file($file)){
     $druglist=json_decode(file_get_contents($file));
index a179af70f3aa8048740f5eb162a7e1aede16a5fc..629b5caeadf4a26baa5aeeb5bad684690de90b75 100644 (file)
@@ -26,7 +26,15 @@ if(!empty($_GET)){
 }
 if(!empty($_POST)){
   foreach($_POST as $k=>$v){
-    $_POST[$k]=htmlspecialchars($v);
+    if(is_array($v)){
+      foreach($v as $k2=>$v2){
+        $v[$k2]=htmlspecialchars($v2);
+      }
+      $_POST["k"]=$v;
+    }
+    else{
+      $_POST[$k]=htmlspecialchars($v);
+    }
   }
 }
 ?>
diff --git a/www/antibiogram.php b/www/antibiogram.php
new file mode 100644 (file)
index 0000000..418acd0
--- /dev/null
@@ -0,0 +1,111 @@
+<?php
+require(dirname(__DIR__)."/require.php");
+if(checkAccess("report")!="all"){
+  header("Location: error.php");
+  exit();
+}
+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"]);
+    }
+    if(!empty($_GET["req"])){
+      $db->omitRequisition($_GET["req"]);
+    }
+    if(!empty($_GET["src"]) && $_GET["src"]=="index"){
+      header("Location: index.php");
+      exit();
+    }
+    else{
+      header("Location: view.php?pid=".$_GET["pid"]);
+      exit();
+    }
+  }
+  if(isSet($_GET["id"])){
+    $data=$db->getData($pid, $_GET["id"], "reports");
+    $data=json_decode($data->fetchArray()["data"]);
+  }
+  $abx=json_decode(file_get_contents(CONFIG_WWW."autocomplete/vitek.json"));
+  if($_GET["form"]=="report-as-grampos"){
+    $list=$abx->gram_positive;
+  }
+  elseif($_GET["form"]=="report-as-gramneg"){
+    $list=$abx->gram_negative;
+  }
+  elseif($_GET["form"]=="report-as-fungal"){
+    $list=$abx->fungal;
+  }
+  $form="<form method='post' id='antibiogram'><input type='hidden' name='form' value='".$_GET["form"]."'></form>";
+  $form=$form."<table class='table'>";
+  if(!empty($data)){
+    $date="value='".$data->date."'";
+    $sample="value'".$data->sample."'";
+  }
+  elseif(!empty($_GET["sample"])){
+    $date="";
+    $sample="value='".$_GET["sample"]."'";
+  }
+  else{
+    $date="";
+    $sample="";
+  }
+  $form=$form."<tr><td>Date</td><td colspan='3'><input type='date' class='form-control' name='date' ".$date." form='antibiogram'></td></tr>";
+  $form=$form."<tr><td>Sample</td><td colspan='3'><input type='text' class='form-control' name='sample' ".$sample." form='antibiogram' required></td></tr>";
+  $form=$form."<tr><td>Organism</td><td colspan='3'><input type='text' class='form-control' name='organism' ".$sample." form='antibiogram' required></td></tr>";
+  $form=$form."<tr><th>Antibiotic</th><th>MIC</th><th>Interpretation</th>";
+  foreach($list as $k=>$v){
+    if(!empty($data)){
+      $mic="value='".$data->$k->mic."'";
+      $interpretation="value='".$data->$k->interpretation."'";
+    }
+    else{
+      $mic="";
+      $interpretation="";
+    }
+    $form=$form."<tr><td><input type='hidden' name='".$k."[name]' value='".$v."' form='antibiogram'><input type='text' form='antibiogram' class='form-control' name='' value='".$v."' readonly></td><td><input type='text' form='antibiogram' class='form-control' name='".$k."[mic]' ".$mic."></td><td><input type='text' form='antibiogram' class='form-control abinter' name='".$k."[interpretation]' ".$interpretation." step='any'></td></tr>";
+  }
+  if(!empty($data)){
+    $name="value='".$data->other->name."'";
+    $mic="value='".$data->other->mic."'";
+    $interpretation="value='".$data->other->interpretation."'";
+  }
+  else{
+    $name="";
+    $mic="";
+    $interpretation="";
+  }
+  $form=$form."<tr><td><input type='text' form='antibiogram' class='form-control' placeholder='Any other' name='other[name]' ".$name."></td><td><input type='text' form='antibiogram' class='form-control' name='other[mic]' ".$mic."></td><td><input type='text' form='antibiogram' class='form-control abinter' step='any' name='other[interpretation]' ".$interpretation."></td></tr>";
+  if(!empty($data)){
+    $note=$data->note;
+  }
+  else{
+    $note="";
+  }
+  $form=$form."<tr><td colspan='3'><textarea class='w-100' name='note' form='antibiogram' placeholder='Notes' ".$note."></textarea></td></tr>";
+  $form=$form."<tr><td colspan='3'><button type='submit' form='antibiogram' class='btn btn-primary btn-lg'>Save</button></td></tr>";
+  $form=$form."</table>";
+}
+?>
+<!DOCTYPE html>
+<html>
+  <head>
+    <?php include(CONFIG_LIB."head.php");?>
+    <title>Antibiogram</title>
+  </head>
+  <body>
+    <div class="container">
+      <div class="card">
+        <div class="card-body">
+          <h4 class="card-title">Add New Report</h4>
+          <?php echo $form;?>
+          <a href="attachments.php?pid=<?php echo $pid;?>&name=vitek" target="_blank">Attach a PDF copy of report</a>
+        </div>
+      </div>
+    </div>
+    <?php include(CONFIG_LIB."foot.php");?>
+  </body>
+</html>
index 067a6e8ebcfc700543afbfa166b2b95b9903daba..c65a4494f6da8be2c30a3d1a1fefaa3fa056ef29 100644 (file)
@@ -7,7 +7,13 @@ if(!empty($_GET["pid"])){
   $pid=$_GET["pid"];
   if(!empty($_FILES)){
     if(in_array($_FILES["upload"]["type"], ["image/jpeg", "image/jpg", "image/png", "image/gif", "application/pdf"])){
-      $fname=str_replace("/", "", $pid)."-".time()."-".rand(1000,9999).".".pathinfo($_FILES["upload"]["name"], PATHINFO_EXTENSION);
+      if(!empty($_GET["name"])){
+        $name=$_GET["name"]."-";
+      }
+      else{
+        $name="";
+      }
+      $fname=str_replace("/", "", $pid)."-".$name.time()."-".rand(1000,9999).".".pathinfo($_FILES["upload"]["name"], PATHINFO_EXTENSION);
       move_uploaded_file($_FILES["upload"]["tmp_name"], "data/attachments/".$fname);
       if(!empty($_GET["req"])){
         $db->omitRequisition($_GET["req"]);
index 30e9becfc83bd6d737af14d65fdd9a9379993fff..2e4928ce7e2b6d599703f1bde012d110c1a3817e 100644 (file)
         "mycology",
         "parasitology",
         "pathology"
-    ]
+    ],
+    "sample": {
+        "blood": "blood",
+        "urine": "urine",
+        "sputum": "sputum",
+        "pus": "pus",
+        "discharge": "discharge",
+        "csf": "csf",
+        "ascitic_fluid": "ascitic_fluid",
+        "pleural_fluid": "pleural_fluid"
+    }
 }
diff --git a/www/autocomplete/vitek.json b/www/autocomplete/vitek.json
new file mode 100644 (file)
index 0000000..c61eb8a
--- /dev/null
@@ -0,0 +1,55 @@
+{
+    "gram_positive": {
+        "ampicillin": "Ampicillin",
+        "amoxicillin_clavulinc_acid": "Amoxicillin/Clavulinic Acid",
+        "piperacillin_tazobactum": "Piperacillin/tazobactum",
+        "cefuroxime": "Cefuroxime",
+        "cefuroxime_axetil": "Cefuroxime Axetil",
+        "ceftriaxone": "Ceftriaxone",
+        "cefoperazone_sulbactum": "Cefoperazone/Sulbactam",
+        "cefepime": "Cefepime",
+        "ertapenem": "Ertapenem",
+        "imipenem": "Imipenem",
+        "meropenem": "Meropenem",
+        "amikacin": "Amikacin",
+        "gentamicin": "Gentamicin",
+        "nalidixic_acid": "Nalidixic Acid",
+        "ciprofloxacin": "Ciprofloxacin",
+        "tigecycline": "Tigecycline",
+        "nitrofurantoin": "Nitrofurantoin",
+        "colistin": "Colistin",
+        "trimethoprim_sulphamethoxazole": "Trimethoprim/Sulfamethoxazole"
+    },
+    "gram_negative": {
+        "cefoxitin_screen": "Cefoxitin Screen",
+        "benzylpenicillin": "Benzylpenicillin",
+        "oxacillin": "Oxacillin",
+        "gentamicin_high_level": "Gentamicin High Level (synergy)",
+        "gentamicin": "Gentamicin",
+        "ciprofloxacin": "Ciprofloxacin",
+        "levofloxacin": "Levofloxacin",
+        "inducible_clindamycin": "Inducible Clindamycin Resistance",
+        "erythromycin": "Erythromycin",
+        "clindamycin": "Clindamycin",
+        "linezolid": "Linezolid",
+        "daptomycin": "Daptomycin",
+        "teicoplanin": "Teicoplanin",
+        "vancomycin": "Vancomycin",
+        "tetracycline": "Tetracycline",
+        "tigecycline": "Tigecycline",
+        "nitrofurantoin": "Nitrofurantoin",
+        "rifampicin": "Rifampicin",
+        "trimethoprim_sulphamethoxazole": "Trimethoprim/Sulfamethoxazole"
+    },
+    "fungal": {
+        "fluconazole": "Fluconazole",
+        "voriconazole": "Voriconazole",
+        "caspofungin": "Caspofungin"
+    },
+    "interpretation": {
+        "S": "S",
+        "I": "S",
+        "R": "R",
+        "+": "+"
+    }
+}
index 45c1b915d7cef1cafe14446d28d1d7561e729911..ed03ca35dd3422739ddf87e9db463ad0d522cb44 100644 (file)
@@ -13,7 +13,6 @@ if(!empty($_GET["pid"])){
   $view=$view."<table class='table'>";
   $view=$view."<tr><th>Drug</th><th>Dose</th><th>Route</th><th>Frequency</th><th>Duration</th><th>Note</th></tr>";
   while($drug=$list->fetchArray()){
-    var_dump($drug);
     $view=$view."<tr><td>".$drug["drug"]."</td><td>".$drug["dose"]."</td><td>".$drug["route"]."</td><td>".$drug["frequency"]."</td><td>".$drug["duration"]."</td><td>".$drug["addl"]."</td><td><button class='btn btn-warning' name='delete' value='".$drug["rowid"]."' form='delete'>Delete</button></td></tr>";
   }
   $view=$view."</table>";
index 1c015773d2da7134e382c75f6e4ac00d66817cd0..f768ba52835d7d93880073f692954a00539e8dca 100644 (file)
             "type": "string",
             "format": "time"
         },
+        "sample": {
+            "description": "Sample",
+            "type": "string"
+        },
         "ph": {
             "description": "pH",
             "type": "number"
diff --git a/www/forms/report-blood-cs.schema.json b/www/forms/report-blood-cs.schema.json
deleted file mode 100644 (file)
index ed9fe1f..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-{
-    "$schema": "http://json-schema.org/draft/2020-12/schema",
-    "title": "blood_cs",
-    "description": "Blood CS",
-    "type": "object",
-
-    "properties": {
-        "date": {
-            "description": "Date",
-            "type": "string",
-            "format": "date"
-        },
-        "time": {
-            "description": "Time",
-            "type": "string",
-            "format": "time"
-        },
-        "organism": {
-            "description": "Organism",
-            "type": "string"
-        }
-    },
-    "required": ["date"]
-}
index 7fcec71f54a511704194a09fbee57595a0bd167f..a1a2c4a52b34e9f2e4ef06cd749b3530b0e489db 100644 (file)
             "type": "string",
             "format": "time"
         },
-
+        "sample": {
+            "description": "Sample",
+            "type": "string"
+        },
         "hb": {
             "description": "Hemoglobin",
             "type": "number"
index c996b505c7d899e38c159a0d1e281ebf55f81247..6b030bd54e0ebef1f243ca6b050bee6e5324e301 100644 (file)
             "type": "string",
             "format": "time"
         },
-
+        "sample": {
+            "description": "Sample",
+            "type": "string"
+        },
         "ldh": {
             "description": "CRP",
             "type": "number"
diff --git a/www/forms/report-cs.schema.json b/www/forms/report-cs.schema.json
new file mode 100644 (file)
index 0000000..296f09c
--- /dev/null
@@ -0,0 +1,29 @@
+{
+    "$schema": "http://json-schema.org/draft/2020-12/schema",
+    "title": "culture_sensitivity",
+    "description": "Culture Sensitivity",
+    "type": "object",
+
+    "properties": {
+        "date": {
+            "description": "Date",
+            "type": "string",
+            "format": "date"
+        },
+        "time": {
+            "description": "Time",
+            "type": "string",
+            "format": "time"
+        },
+        "sample": {
+            "description": "Sample",
+            "type": "string"
+        },
+        "report": {
+            "description": "Report",
+            "type": "string",
+            "format": "textarea"
+        }
+    },
+    "required": ["date"]
+}
index 8e26f796174e6a3b3c581c76b79ab6ac39de2c47..79b7c57f792dab4e4c40800fa11302f722eeb023 100644 (file)
             "type": "string",
             "format": "time"
         },
-
+        "sample": {
+            "description": "Sample",
+            "type": "string"
+        },
         "ddimer": {
             "description": "D-Dimer",
             "type": "number"
index 5f8f7988b4f2fe9d882094037a2446f65d9d6184..26daa33049c64afcb583b69e51131c91f51ba2ae 100644 (file)
@@ -1,7 +1,7 @@
 {
     "$schema": "http://json-schema.org/draft/2020-12/schema",
-    "title": "ascitic_fluid_study",
-    "description": "Ascitic Fluid Study",
+    "title": "fluid_study",
+    "description": "Fluid Study",
     "type": "object",
 
     "properties": {
             "type": "string",
             "format": "time"
         },
+        "sample": {
+            "description": "Sample",
+            "type": "string"
+        },
         "cellCount": {
             "description": "Cell Count",
             "type": "integer"
diff --git a/www/forms/report-fluid-csf.schema.json b/www/forms/report-fluid-csf.schema.json
deleted file mode 100644 (file)
index 794ab86..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-{
-    "$schema": "http://json-schema.org/draft/2020-12/schema",
-    "title": "csf_fluid_study",
-    "description": "CSF Fluid Study",
-    "type": "object",
-
-    "properties": {
-        "date": {
-            "description": "Date",
-            "type": "string",
-            "format": "date"
-        },
-        "time": {
-            "description": "Time",
-            "type": "string",
-            "format": "time"
-        },
-        "cellCount": {
-            "description": "Cell Count",
-            "type": "integer"
-        },
-        "cellType": {
-            "description": "Cell Type",
-            "type": "string"
-        },
-        "protein": {
-            "description": "Protein",
-            "type": "integer"
-        },
-        "sugar": {
-            "description": "Sugar",
-            "type": "integer"
-        },
-        "ldh": {
-            "description": "LDH",
-            "type": "integer"
-        },
-        "gram": {
-            "description": "Gram Stain",
-            "type": "string"
-        },
-        "afb": {
-            "description": "AFB Stain",
-            "type": "string"
-        },
-        "fungal": {
-            "description": "Fungal Stain",
-            "type": "string"
-        },
-        "cs": {
-            "description": "Culture/Sensitivity",
-            "type": "string"
-        },
-        "cbnaat": {
-            "description": "CBNAAT",
-            "type": "string"
-        }
-    },
-    "required": ["date"]
-}
diff --git a/www/forms/report-fluid-pleural.schema.json b/www/forms/report-fluid-pleural.schema.json
deleted file mode 100644 (file)
index b82821f..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-{
-    "$schema": "http://json-schema.org/draft/2020-12/schema",
-    "title": "pleural_fluid_study",
-    "description": "Pleural Fluid Study",
-    "type": "object",
-
-    "properties": {
-        "date": {
-            "description": "Date",
-            "type": "string",
-            "format": "date"
-        },
-        "time": {
-            "description": "Time",
-            "type": "string",
-            "format": "time"
-        },
-        "cellCount": {
-            "description": "Cell Count",
-            "type": "integer"
-        },
-        "cellType": {
-            "description": "Cell Type",
-            "type": "string"
-        },
-        "protein": {
-            "description": "Protein",
-            "type": "integer"
-        },
-        "sugar": {
-            "description": "Sugar",
-            "type": "integer"
-        },
-        "ldh": {
-            "description": "LDH",
-            "type": "integer"
-        },
-        "gram": {
-            "description": "Gram Stain",
-            "type": "string"
-        },
-        "afb": {
-            "description": "AFB Stain",
-            "type": "string"
-        },
-        "fungal": {
-            "description": "Fungal Stain",
-            "type": "string"
-        },
-        "cs": {
-            "description": "Culture/Sensitivity",
-            "type": "string"
-        },
-        "cbnaat": {
-            "description": "CBNAAT",
-            "type": "string"
-        }
-    },
-    "required": ["date"]
-}
diff --git a/www/forms/report-fluid-synovial.schema.json b/www/forms/report-fluid-synovial.schema.json
deleted file mode 100644 (file)
index f4f1b6c..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-{
-    "$schema": "http://json-schema.org/draft/2020-12/schema",
-    "title": "synovial_fluid_study",
-    "description": "Synovial Fluid Study",
-    "type": "object",
-
-    "properties": {
-        "date": {
-            "description": "Date",
-            "type": "string",
-            "format": "date"
-        },
-        "time": {
-            "description": "Time",
-            "type": "string",
-            "format": "time"
-        },
-        "cellCount": {
-            "description": "Cell Count",
-            "type": "integer"
-        },
-        "cellType": {
-            "description": "Cell Type",
-            "type": "string"
-        },
-        "protein": {
-            "description": "Protein",
-            "type": "integer"
-        },
-        "sugar": {
-            "description": "Sugar",
-            "type": "integer"
-        },
-        "ldh": {
-            "description": "LDH",
-            "type": "integer"
-        },
-        "gram": {
-            "description": "Gram Stain",
-            "type": "string"
-        },
-        "afb": {
-            "description": "AFB Stain",
-            "type": "string"
-        },
-        "fungal": {
-            "description": "Fungal Stain",
-            "type": "string"
-        },
-        "cs": {
-            "description": "Culture/Sensitivity",
-            "type": "string"
-        },
-        "cbnaat": {
-            "description": "CBNAAT",
-            "type": "string"
-        }
-    },
-    "required": ["date"]
-}
index 6109d7862d6cf7a1f7a617773705d372ebd981af..87debd9b4d60d146656392b668eaeb7c23dbe394 100644 (file)
             "type": "string",
             "format": "time"
         },
-
+        "sample": {
+            "description": "Sample",
+            "type": "string"
+        },
         "fbs": {
             "description": "FBS",
             "type": "number"
index e22f810ab4a32edd70603cf9611d6a54447545e0..1f11b3238bf22801eba5a3edfc513f91689cd56c 100644 (file)
             "type": "string",
             "format": "time"
         },
-
+        "sample": {
+            "description": "Sample",
+            "type": "string"
+        },
         "ldh": {
             "description": "LDH",
             "type": "number"
index 6401cadd9136743a6a2944169cb1a8ae11343afc..0ea6c6c27793f34872da1a53be962be4db2bbfe2 100644 (file)
             "type": "string",
             "format": "time"
         },
-
+        "sample": {
+            "description": "Sample",
+            "type": "string"
+        },
         "tbr": {
             "description": "Total Bilirubin",
             "type": "number"
index d9052c4e6567efdc12f7df0be40539c7d7002e9f..43dffafa5d05dae7909841ed039a77515f2f6044 100644 (file)
             "type": "string",
             "format": "time"
         },
-
+        "sample": {
+            "description": "Sample",
+            "type": "string"
+        },
         "ldl": {
             "description": "LDL",
             "type": "number"
index c7906984f93c2c17b4106b204ec58b7425e2d601..b642a0be005482fdbd331a656e7509c6bcf5324f 100644 (file)
             "type": "string",
             "format": "time"
         },
+        "sample": {
+            "description": "Sample",
+            "type": "string"
+        },
         "report": {
             "description": "Report",
             "type": "string",
index 874f8f23776babe67456579ceb24d16622937b3b..4dde029557e9b7e6d729de45f3971d696a1640df 100644 (file)
             "type": "string",
             "format": "time"
         },
-
+        "sample": {
+            "description": "Sample",
+            "type": "string"
+        },
         "urea": {
             "description": "Urea",
             "type": "number"
diff --git a/www/forms/report-sputum-cs.schema.json b/www/forms/report-sputum-cs.schema.json
deleted file mode 100644 (file)
index 65d115f..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-{
-    "$schema": "http://json-schema.org/draft/2020-12/schema",
-    "title": "sputum_cs",
-    "description": "Sputum CS",
-    "type": "object",
-
-    "properties": {
-        "date": {
-            "description": "Date",
-            "type": "string",
-            "format": "date"
-        },
-        "time": {
-            "description": "Time",
-            "type": "string",
-            "format": "time"
-        },
-        "organism": {
-            "description": "Organism",
-            "type": "string"
-        }
-    },
-    "required": ["date"]
-}
index 5883911d83d3e6dda989c4c5254de809a1a55d49..462a7462d6f9fb285f45c307761aa5b0addb72b2 100644 (file)
             "type": "string",
             "format": "time"
         },
+        "sample": {
+            "description": "Sample",
+            "type": "string"
+        },
         "description": {
             "description": "Description",
             "type": "string"
index 8e2cd781cbdb8e7403a18f2fde6c2e63a200d4a3..35ef4dc33e367cf4cf74a4649e2fb6a27bc6cf54 100644 (file)
             "type": "string",
             "format": "time"
         },
+        "sample": {
+            "description": "Sample",
+            "type": "string"
+        },
         "description": {
             "description": "Description",
             "type": "string"
index 9db09db7763f20965a063abb15d97bc7df89144c..c773452e4fdb9691540320045bd12f6af7673936 100644 (file)
             "type": "string",
             "format": "time"
         },
+        "sample": {
+            "description": "Sample",
+            "type": "string"
+        },
         "description": {
             "description": "Description",
             "type": "string"
diff --git a/www/forms/report-urine-cs.schema.json b/www/forms/report-urine-cs.schema.json
deleted file mode 100644 (file)
index 16af87c..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-{
-    "$schema": "http://json-schema.org/draft/2020-12/schema",
-    "title": "urine_cs",
-    "description": "Urine CS",
-    "type": "object",
-
-    "properties": {
-        "date": {
-            "description": "Date",
-            "type": "string",
-            "format": "date"
-        },
-        "time": {
-            "description": "Time",
-            "type": "string",
-            "format": "time"
-        },
-        "organism": {
-            "description": "Organism",
-            "type": "string"
-        }
-    },
-    "required": ["date"]
-}
index 80a2e0a6fe24447a9e0b68460fdf1294ac74a6e1..b4f9b25fb4b0ba7aaf96456b38533365e7113a84 100644 (file)
             "type": "string",
             "format": "time"
         },
+        "sample": {
+            "description": "Sample",
+            "type": "string"
+        },
         "description": {
             "description": "Description",
             "type": "string"
index e84aa2a104b8b0744eaa809d6cb6f59b71f37475..1cda66fca9802ee64ad906ecd180ad44ef12ec63 100644 (file)
@@ -11,12 +11,17 @@ $showReqs="";
 while($arr=$reqs->fetchArray()){
   $pid=$arr["pid"];
   if(!empty($arr["form"])){
-    $test="<a href='report.php?pid=".$pid."&form=".$arr["form"]."&req=".$arr["rowid"]."'>".$arr["test"]."</a>";
+    if($arr["form"]=="report-cs"){
+      $test="<a href='vitek.php?pid=".$pid."&form=".$arr["form"]."&req=".$arr["rowid"]."&src=index'>".$arr["test"]."</a>";
+    }
+    else{
+      $test="<a href='report.php?pid=".$pid."&form=".$arr["form"]."&req=".$arr["rowid"]."&src=index'>".$arr["test"]."</a>";
+    }
   }
   else{
-    $test="<a href='report.php?pid=".$pid."&form=report-other&req=".$arr["rowid"]."'>".$arr["test"]."</a>";
+    $test="<a href='report.php?pid=".$pid."&form=report-other&req=".$arr["rowid"]."&src=index'>".$arr["test"]."</a>";
   }
-  $showReqs=$showReqs."<tr><td>".$test."</td><td>".$arr["room"]."</td><td>".date("M j, Y", $arr["time"])."</td><td><a href='view.php?pid=".$pid."'>".$pid."</a></td></tr>";
+  $showReqs=$showReqs."<tr><td>".$test."</td><td>".$arr["sample"]."</td><td>".$arr["room"]."</td><td>".date("M j, Y", $arr["time"])."</td><td><a href='view.php?pid=".$pid."' target='_blank'>".$pid."</a></td></tr>";
 }
 ?>
 <!DOCTYPE html>
@@ -42,7 +47,7 @@ while($arr=$reqs->fetchArray()){
         <div class="card-body">
           <h4 class="card-title">Requisition List</h4>
           <table class="table">
-            <tr><th>Test Needed</th><th>Place</th><th>Date</th><th>Patient ID</th></tr>
+            <tr><th>Test Needed</th><th>Sample</th><th>Place</th><th>Date</th><th>Patient ID</th></tr>
             <?php echo $showReqs;?>
           </table>
         </div>
index 640d2384efe55e441485c4fd1ec94a682f72ddaa..3f8b55d5c709fac3ccb1dff829ac163b08a31948 100644 (file)
@@ -3,8 +3,9 @@ require(dirname(__DIR__)."/require.php");
 $list="";
 if(isSet($_GET["pid"])){
   foreach(glob("forms/report*.json") as $file){
+    $pid=$_GET["pid"];
     $form=json_decode(file_get_contents($file));
-    $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>";
+    $list=$list."<li class='list-group-item'><a href='report.php?pid=".$pid."&form=".str_replace(["forms/",".schema.json"], "", $file)."'>".$form->description."</a></li>";
   }
 }
 ?>
@@ -21,6 +22,9 @@ if(isSet($_GET["pid"])){
           <h4 class="card-title">List of Tests</h4>
           <ul class="list-group">
             <?php echo $list;?>
+            <li class="list-group-item"><a href="antibiogram.php?pid=<?php echo $pid;?>&form=report-as-grampos">Vitek Report (Gram Positive)</a></li>
+            <li class="list-group-item"><a href="antibiogram.php?pid=<?php echo $pid;?>&form=report-as-gramneg">Vitek Report (Gram Negative)</a></li>
+            <li class="list-group-item"><a href="antibiogram.php?pid=<?php echo $pid;?>&form=report-as-fungal">Vitek Report (Fungal)</a></li>
           </ul>
         </div>
       </div>
index d53f3bae339b2661367532819e4231d4421fa266..803d7d575d71a052ac5cf3d7116bdb06c52cc8ac 100644 (file)
@@ -16,8 +16,14 @@ if(!empty($_GET["pid"]) && !empty($_GET["form"])){
     if(!empty($_GET["req"])){
       $db->omitRequisition($_GET["req"]);
     }
-    header("Location: view.php?pid=".$_GET["pid"]);
-    exit();
+    if(!empty($_GET["src"]) && $_GET["src"]=="index"){
+      header("Location: index.php");
+      exit();
+    }
+    else{
+      header("Location: view.php?pid=".$_GET["pid"]);
+      exit();
+    }
   }
   if(isSet($_GET["id"])){
     $form=schema2form("forms/".$_GET["form"].".schema.json", $pid, $_GET["id"], "reports");
index 247df454ffac7b4390ed9f5807220535e66eb80f..3c9f7a85fdf8ac95e6f90aebf686a4602a02559a 100644 (file)
@@ -14,7 +14,7 @@ if(isSet($_GET["pid"])){
       $test=$_POST["test"];
       $form="";
     }
-    $db->addRequisition($pid, $test, $_POST["date"], $_POST["time"], $_POST["room"], $form);
+    $db->addRequisition($pid, $test, $_POST["sample"], $_POST["date"], $_POST["time"], $_POST["room"], $form);
   }
   $inv=json_decode(file_get_contents("autocomplete/investigation.json"));
   $testList="";
@@ -25,6 +25,7 @@ if(isSet($_GET["pid"])){
   foreach($inv->tests as $t){
     $testList=$testList."<option>".$t."</option>";
   }
+  $testList=$testList."<option value='culture_sensitivity'>Culture/Sensitivity</option>";
   $roomList="";
   foreach($inv->rooms as $r){
     $roomList=$roomList."<option>".$r."</option>";
@@ -34,7 +35,7 @@ if(isSet($_GET["pid"])){
   $reqList=$db->getRequisitions($pid);
   $list="";
   while($req=$reqList->fetchArray()){
-    $list=$list."<tr><td>".$req["test"]."</td><td>".$req["room"]."</td><td>".date("M j, Y", $req["time"])."</td><td><button type='submit' class='btn btn-secondary' name='del' value='".$req["rowid"]."' form='delete' ".checkAccess("requisition","form").">Delete</button></td></tr>";
+    $list=$list."<tr><td>".$req["test"]."</td><td>".$req["sample"]."</td><td>".$req["room"]."</td><td>".date("M j, Y", $req["time"])."</td><td><button type='submit' class='btn btn-secondary' name='del' value='".$req["rowid"]."' form='delete' ".checkAccess("requisition","form").">Delete</button></td></tr>";
   }
 }
 ?>
@@ -51,34 +52,36 @@ if(isSet($_GET["pid"])){
           <h4 class="card-title">List of Requisitions</h4>
           <form method='post' id='delete'></form>
           <table class="table">
-            <tr><th>Test Name</th><th>Destination</th><th>Date</th><th></th></tr>
+            <tr><th>Test Name</th><th>Sample</th><th>Destination</th><th>Date</th><th></th></tr>
             <?php echo $list;?>
           </table>
+          <hr>
           <form method="post" <?php echo checkAccess("requisition", "form");?>>
             <div class="row">
               <div class="col">
-            <select name="test">
-              <?php echo $testList;?>
-            </select>
+                <select name="test">
+                  <?php echo $testList;?>
+                </select>
               </div>
               <div class="col">
-            <select name="room">
-              <?php echo $roomList;?>
-            </select>
+                <input type="text" class="form-control" name="sample" placeholder="Sample">
               </div>
               <div class="col">
-                <input type="date" name="date" class="form-control">
+                <select name="room">
+                  <?php echo $roomList;?>
+                </select>
               </div>
               <div class="col">
+                <input type="date" name="date" class="form-control">
                 <input type="time" name="time" class="form-control">
               </div>
               <div class="col">
-            <button class="btn btn-primary" type="submit">Submit Requisition</button>
+                <button class="btn btn-primary" type="submit">Submit Requisition</button>
               </div>
           </form>
+            </div>
         </div>
       </div>
-    </div>
-    <?php include(CONFIG_LIB."foot.php");?>
+      <?php include(CONFIG_LIB."foot.php");?>
   </body>
 </html>
index 7f888480c2d0dd47d6c24c459acb75f8d71578ac..0e7abad7ae61df438cdec1ec0cfb89ed4695addc 100644 (file)
@@ -45,6 +45,22 @@ $(document).ready(function(){
       });
     });
   };
+  if($("[name='sample']").length){
+    $(this).prop("autocomplete","off");
+    $.get("autocomplete/investigation.json", function(data){
+      $("[name='sample']").each(function(){
+        $(this).autocomplete({source:data.sample, highlightClass:'text-danger',treshold:1});
+      });
+    });
+  };
+  if($(".abinter").length){
+    $(this).prop("autocomplete","off");
+    $.get("autocomplete/vitek.json", function(data){
+      $(".abinter").each(function(){
+        $(this).autocomplete({source:data.interpretation, highlightClass:'text-danger',treshold:0});
+      });
+    });
+  };
   if($("#discharge-note").length){
     $.get("autocomplete/discharge.json", function(data){
       $("#discharge-note").val(data.note);
index c49027e47b2519298c42ccba36692e53e7f2221d..60b5f9b611aa1b33f7e2a6a3d0e1c1a1e869e194 100644 (file)
@@ -19,7 +19,12 @@ if(isSet($_GET["pid"])){
   }
   $reportsArray=$db->getAllData($pid, "reports");
   while($r=$reportsArray->fetchArray()){
-    array_push($reports, viewData($r["data"], "report.php?pid=".$pid."&id=".$r["rowid"]."&form=".$db->getForm($r["rowid"])->fetchArray()["form"]));
+    if(in_array($r["form"], ["report-as-grampos", "report-as-gramneg", "report-as-fungal"])){
+      array_push($reports, viewAntibiogram($r["data"], "antibiogram.php?pid=".$pid."&id=".$r["rowid"]."&form=".$r["form"]));
+    }
+    else{
+      array_push($reports, viewData($r["data"], "report.php?pid=".$pid."&id=".$r["rowid"]."&form=".$r["form"]));
+    }
   }
 }
 ?>
diff --git a/www/vitek.php b/www/vitek.php
new file mode 100644 (file)
index 0000000..641e234
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+require(dirname(__DIR__)."/require.php");
+$pid=$_GET["pid"];
+if($_GET["req"]){
+  $req="&req=".$_GET["req"];
+}
+else{
+  $req="";
+}
+if(!empty($_GET["src"]) && $_GET["src"]=="index"){
+  $src="&src=index";
+}
+else{
+  $src="";
+}
+?>
+<!DOCTYPE html>
+<html>
+  <head>
+    <?php include(CONFIG_LIB."head.php");?>
+    <title>Culture/Sensitivity</title>
+  </head>
+  <body>
+    <div class="container">
+      <div class="card">
+        <div class="card-body">
+          <h4 class="card-title">Type of Organism</h4>
+          <ul class="list-group">
+            <li class="list-group-item"><a href="antibiogram.php?pid=<?php echo $pid;?>&form=report-as-grampos<?php echo $req;?><?php echo $src;?>">Vitek Report (Gram Positive)</a></li>
+            <li class="list-group-item"><a href="antibiogram.php?pid=<?php echo $pid;?>&form=report-as-gramneg<?php echo $req;?><?php echo $src;?>">Vitek Report (Gram Negative)</a></li>
+            <li class="list-group-item"><a href="antibiogram.php?pid=<?php echo $pid;?>&form=report-as-fungal<?php echo $req;?><?php echo $src;?>">Vitek Report (Fungal)</a></li>
+          </ul>
+        </div>
+      </div>
+    </div>
+    <?php include(CONFIG_LIB."foot.php");?>
+  </body>
+</html>