From 730a9514238e781a231c43e5e35ea71227a9d1d8 Mon Sep 17 00:00:00 2001 From: Agnibho Mondal Date: Wed, 19 May 2021 19:33:50 +0530 Subject: [PATCH] Added vitek reports --- access.json | 17 +++ data.schema.sql | 4 +- lib/db.php | 25 ++-- lib/functions.php | 39 +++++- require.php | 10 +- www/antibiogram.php | 111 ++++++++++++++++++ www/attachments.php | 8 +- www/autocomplete/investigation.json | 12 +- www/autocomplete/vitek.json | 55 +++++++++ www/discharge.php | 1 - www/forms/report-abg.schema.json | 4 + www/forms/report-ch.schema.json | 5 +- www/forms/report-crp.schema.json | 5 +- ...d-cs.schema.json => report-cs.schema.json} | 13 +- www/forms/report-ddimer.schema.json | 5 +- www/forms/report-fluid-ascitic.schema.json | 8 +- www/forms/report-fluid-csf.schema.json | 60 ---------- www/forms/report-fluid-pleural.schema.json | 60 ---------- www/forms/report-fluid-synovial.schema.json | 60 ---------- www/forms/report-glycemic.schema.json | 5 +- www/forms/report-ldh.schema.json | 5 +- www/forms/report-lft.schema.json | 5 +- www/forms/report-lipid.schema.json | 5 +- www/forms/report-other.schema.json | 4 + www/forms/report-rft.schema.json | 5 +- www/forms/report-sputum-cs.schema.json | 24 ---- www/forms/report-sputum-me.schema.json | 4 + www/forms/report-stool-ova.schema.json | 4 + www/forms/report-stool-re.schema.json | 4 + www/forms/report-urine-cs.schema.json | 24 ---- www/forms/report-urine-re.schema.json | 4 + www/index.php | 13 +- www/laboratory.php | 6 +- www/report.php | 10 +- www/requisition.php | 29 +++-- www/res/script.js | 16 +++ www/view.php | 7 +- www/vitek.php | 38 ++++++ 38 files changed, 436 insertions(+), 278 deletions(-) create mode 100644 www/antibiogram.php create mode 100644 www/autocomplete/vitek.json rename www/forms/{report-blood-cs.schema.json => report-cs.schema.json} (61%) delete mode 100644 www/forms/report-fluid-csf.schema.json delete mode 100644 www/forms/report-fluid-pleural.schema.json delete mode 100644 www/forms/report-fluid-synovial.schema.json delete mode 100644 www/forms/report-sputum-cs.schema.json delete mode 100644 www/forms/report-urine-cs.schema.json create mode 100644 www/vitek.php diff --git a/access.json b/access.json index 8cab726..569c3a5 100644 --- a/access.json +++ b/access.json @@ -126,5 +126,22 @@ "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" } } diff --git a/data.schema.sql b/data.schema.sql index 51883e5..579ec18 100644 --- a/data.schema.sql +++ b/data.schema.sql @@ -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 ); diff --git a/lib/db.php b/lib/db.php index c3228d7..2d2e5b4 100644 --- a/lib/db.php +++ b/lib/db.php @@ -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;"); diff --git a/lib/functions.php b/lib/functions.php index ea2ff2d..2ee182a 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -91,8 +91,24 @@ function viewData($data, $edit=null){ } unset($data->cat); $view=""; + 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.""; 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.""; } @@ -105,7 +121,7 @@ function viewData($data, $edit=null){ } } if(!empty($edit)){ - $view=$view."
".$description."".$date."
".$schema->properties->$field->description."".$value."
Edit"; + $view=$view."
Edit"; } $view=$view."
"; return $view; @@ -115,6 +131,25 @@ function viewData($data, $edit=null){ } } +function viewAntibiogram($data, $edit){ + $data=json_decode($data); + $view=""; + $view=$view.""; + $view=$view.""; + $view=$view.""; + foreach($data as $k=>$v){ + if(is_object($v)){ + $view=$view.""; + } + } + if(!empty($data->note)){ + $view=$view.""; + } + $view=$view.""; + $view=$view."
Vitek Report".$data->date."
Sample".$data->sample."
AntibioticMICInterpretation
".$v->name."".$v->mic."".$v->interpretation."
Note".$data->note."
Edit
"; + return $view; +} + function view_drug($file){ if(is_file($file)){ $druglist=json_decode(file_get_contents($file)); diff --git a/require.php b/require.php index a179af7..629b5ca 100644 --- a/require.php +++ b/require.php @@ -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 index 0000000..418acd0 --- /dev/null +++ b/www/antibiogram.php @@ -0,0 +1,111 @@ +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=$form.""; + 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.""; + $form=$form.""; + $form=$form.""; + $form=$form.""; + foreach($list as $k=>$v){ + if(!empty($data)){ + $mic="value='".$data->$k->mic."'"; + $interpretation="value='".$data->$k->interpretation."'"; + } + else{ + $mic=""; + $interpretation=""; + } + $form=$form.""; + } + if(!empty($data)){ + $name="value='".$data->other->name."'"; + $mic="value='".$data->other->mic."'"; + $interpretation="value='".$data->other->interpretation."'"; + } + else{ + $name=""; + $mic=""; + $interpretation=""; + } + $form=$form.""; + if(!empty($data)){ + $note=$data->note; + } + else{ + $note=""; + } + $form=$form.""; + $form=$form.""; + $form=$form."
Date
Sample
Organism
AntibioticMICInterpretation
"; +} +?> + + + + + Antibiogram + + +
+
+
+

Add New Report

+ + Attach a PDF copy of report +
+
+
+ + + diff --git a/www/attachments.php b/www/attachments.php index 067a6e8..c65a449 100644 --- a/www/attachments.php +++ b/www/attachments.php @@ -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"]); diff --git a/www/autocomplete/investigation.json b/www/autocomplete/investigation.json index 30e9bec..2e4928c 100644 --- a/www/autocomplete/investigation.json +++ b/www/autocomplete/investigation.json @@ -12,5 +12,15 @@ "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 index 0000000..c61eb8a --- /dev/null +++ b/www/autocomplete/vitek.json @@ -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", + "+": "+" + } +} diff --git a/www/discharge.php b/www/discharge.php index 45c1b91..ed03ca3 100644 --- a/www/discharge.php +++ b/www/discharge.php @@ -13,7 +13,6 @@ if(!empty($_GET["pid"])){ $view=$view.""; $view=$view.""; while($drug=$list->fetchArray()){ - var_dump($drug); $view=$view.""; } $view=$view."
DrugDoseRouteFrequencyDurationNote
".$drug["drug"]."".$drug["dose"]."".$drug["route"]."".$drug["frequency"]."".$drug["duration"]."".$drug["addl"]."
"; diff --git a/www/forms/report-abg.schema.json b/www/forms/report-abg.schema.json index 1c01577..f768ba5 100644 --- a/www/forms/report-abg.schema.json +++ b/www/forms/report-abg.schema.json @@ -15,6 +15,10 @@ "type": "string", "format": "time" }, + "sample": { + "description": "Sample", + "type": "string" + }, "ph": { "description": "pH", "type": "number" diff --git a/www/forms/report-ch.schema.json b/www/forms/report-ch.schema.json index 7fcec71..a1a2c4a 100644 --- a/www/forms/report-ch.schema.json +++ b/www/forms/report-ch.schema.json @@ -15,7 +15,10 @@ "type": "string", "format": "time" }, - + "sample": { + "description": "Sample", + "type": "string" + }, "hb": { "description": "Hemoglobin", "type": "number" diff --git a/www/forms/report-crp.schema.json b/www/forms/report-crp.schema.json index c996b50..6b030bd 100644 --- a/www/forms/report-crp.schema.json +++ b/www/forms/report-crp.schema.json @@ -15,7 +15,10 @@ "type": "string", "format": "time" }, - + "sample": { + "description": "Sample", + "type": "string" + }, "ldh": { "description": "CRP", "type": "number" diff --git a/www/forms/report-blood-cs.schema.json b/www/forms/report-cs.schema.json similarity index 61% rename from www/forms/report-blood-cs.schema.json rename to www/forms/report-cs.schema.json index ed9fe1f..296f09c 100644 --- a/www/forms/report-blood-cs.schema.json +++ b/www/forms/report-cs.schema.json @@ -1,7 +1,7 @@ { "$schema": "http://json-schema.org/draft/2020-12/schema", - "title": "blood_cs", - "description": "Blood CS", + "title": "culture_sensitivity", + "description": "Culture Sensitivity", "type": "object", "properties": { @@ -15,9 +15,14 @@ "type": "string", "format": "time" }, - "organism": { - "description": "Organism", + "sample": { + "description": "Sample", "type": "string" + }, + "report": { + "description": "Report", + "type": "string", + "format": "textarea" } }, "required": ["date"] diff --git a/www/forms/report-ddimer.schema.json b/www/forms/report-ddimer.schema.json index 8e26f79..79b7c57 100644 --- a/www/forms/report-ddimer.schema.json +++ b/www/forms/report-ddimer.schema.json @@ -15,7 +15,10 @@ "type": "string", "format": "time" }, - + "sample": { + "description": "Sample", + "type": "string" + }, "ddimer": { "description": "D-Dimer", "type": "number" diff --git a/www/forms/report-fluid-ascitic.schema.json b/www/forms/report-fluid-ascitic.schema.json index 5f8f798..26daa33 100644 --- a/www/forms/report-fluid-ascitic.schema.json +++ b/www/forms/report-fluid-ascitic.schema.json @@ -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": { @@ -15,6 +15,10 @@ "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 index 794ab86..0000000 --- a/www/forms/report-fluid-csf.schema.json +++ /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 index b82821f..0000000 --- a/www/forms/report-fluid-pleural.schema.json +++ /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 index f4f1b6c..0000000 --- a/www/forms/report-fluid-synovial.schema.json +++ /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"] -} diff --git a/www/forms/report-glycemic.schema.json b/www/forms/report-glycemic.schema.json index 6109d78..87debd9 100644 --- a/www/forms/report-glycemic.schema.json +++ b/www/forms/report-glycemic.schema.json @@ -15,7 +15,10 @@ "type": "string", "format": "time" }, - + "sample": { + "description": "Sample", + "type": "string" + }, "fbs": { "description": "FBS", "type": "number" diff --git a/www/forms/report-ldh.schema.json b/www/forms/report-ldh.schema.json index e22f810..1f11b32 100644 --- a/www/forms/report-ldh.schema.json +++ b/www/forms/report-ldh.schema.json @@ -15,7 +15,10 @@ "type": "string", "format": "time" }, - + "sample": { + "description": "Sample", + "type": "string" + }, "ldh": { "description": "LDH", "type": "number" diff --git a/www/forms/report-lft.schema.json b/www/forms/report-lft.schema.json index 6401cad..0ea6c6c 100644 --- a/www/forms/report-lft.schema.json +++ b/www/forms/report-lft.schema.json @@ -15,7 +15,10 @@ "type": "string", "format": "time" }, - + "sample": { + "description": "Sample", + "type": "string" + }, "tbr": { "description": "Total Bilirubin", "type": "number" diff --git a/www/forms/report-lipid.schema.json b/www/forms/report-lipid.schema.json index d9052c4..43dffaf 100644 --- a/www/forms/report-lipid.schema.json +++ b/www/forms/report-lipid.schema.json @@ -15,7 +15,10 @@ "type": "string", "format": "time" }, - + "sample": { + "description": "Sample", + "type": "string" + }, "ldl": { "description": "LDL", "type": "number" diff --git a/www/forms/report-other.schema.json b/www/forms/report-other.schema.json index c790698..b642a0b 100644 --- a/www/forms/report-other.schema.json +++ b/www/forms/report-other.schema.json @@ -15,6 +15,10 @@ "type": "string", "format": "time" }, + "sample": { + "description": "Sample", + "type": "string" + }, "report": { "description": "Report", "type": "string", diff --git a/www/forms/report-rft.schema.json b/www/forms/report-rft.schema.json index 874f8f2..4dde029 100644 --- a/www/forms/report-rft.schema.json +++ b/www/forms/report-rft.schema.json @@ -15,7 +15,10 @@ "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 index 65d115f..0000000 --- a/www/forms/report-sputum-cs.schema.json +++ /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"] -} diff --git a/www/forms/report-sputum-me.schema.json b/www/forms/report-sputum-me.schema.json index 5883911..462a746 100644 --- a/www/forms/report-sputum-me.schema.json +++ b/www/forms/report-sputum-me.schema.json @@ -15,6 +15,10 @@ "type": "string", "format": "time" }, + "sample": { + "description": "Sample", + "type": "string" + }, "description": { "description": "Description", "type": "string" diff --git a/www/forms/report-stool-ova.schema.json b/www/forms/report-stool-ova.schema.json index 8e2cd78..35ef4dc 100644 --- a/www/forms/report-stool-ova.schema.json +++ b/www/forms/report-stool-ova.schema.json @@ -15,6 +15,10 @@ "type": "string", "format": "time" }, + "sample": { + "description": "Sample", + "type": "string" + }, "description": { "description": "Description", "type": "string" diff --git a/www/forms/report-stool-re.schema.json b/www/forms/report-stool-re.schema.json index 9db09db..c773452 100644 --- a/www/forms/report-stool-re.schema.json +++ b/www/forms/report-stool-re.schema.json @@ -15,6 +15,10 @@ "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 index 16af87c..0000000 --- a/www/forms/report-urine-cs.schema.json +++ /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"] -} diff --git a/www/forms/report-urine-re.schema.json b/www/forms/report-urine-re.schema.json index 80a2e0a..b4f9b25 100644 --- a/www/forms/report-urine-re.schema.json +++ b/www/forms/report-urine-re.schema.json @@ -15,6 +15,10 @@ "type": "string", "format": "time" }, + "sample": { + "description": "Sample", + "type": "string" + }, "description": { "description": "Description", "type": "string" diff --git a/www/index.php b/www/index.php index e84aa2a..1cda66f 100644 --- a/www/index.php +++ b/www/index.php @@ -11,12 +11,17 @@ $showReqs=""; while($arr=$reqs->fetchArray()){ $pid=$arr["pid"]; if(!empty($arr["form"])){ - $test="".$arr["test"].""; + if($arr["form"]=="report-cs"){ + $test="".$arr["test"].""; + } + else{ + $test="".$arr["test"].""; + } } else{ - $test="".$arr["test"].""; + $test="".$arr["test"].""; } - $showReqs=$showReqs."".$test."".$arr["room"]."".date("M j, Y", $arr["time"])."".$pid.""; + $showReqs=$showReqs."".$test."".$arr["sample"]."".$arr["room"]."".date("M j, Y", $arr["time"])."".$pid.""; } ?> @@ -42,7 +47,7 @@ while($arr=$reqs->fetchArray()){

Requisition List

- +
Test NeededPlaceDatePatient ID
Test NeededSamplePlaceDatePatient ID
diff --git a/www/laboratory.php b/www/laboratory.php index 640d238..3f8b55d 100644 --- a/www/laboratory.php +++ b/www/laboratory.php @@ -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."
  • ".$form->description."
  • "; + $list=$list."
  • ".$form->description."
  • "; } } ?> @@ -21,6 +22,9 @@ if(isSet($_GET["pid"])){

    List of Tests

    diff --git a/www/report.php b/www/report.php index d53f3ba..803d7d5 100644 --- a/www/report.php +++ b/www/report.php @@ -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"); diff --git a/www/requisition.php b/www/requisition.php index 247df45..3c9f7a8 100644 --- a/www/requisition.php +++ b/www/requisition.php @@ -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.""; } + $testList=$testList.""; $roomList=""; foreach($inv->rooms as $r){ $roomList=$roomList.""; @@ -34,7 +35,7 @@ if(isSet($_GET["pid"])){ $reqList=$db->getRequisitions($pid); $list=""; while($req=$reqList->fetchArray()){ - $list=$list."".$req["test"]."".$req["room"]."".date("M j, Y", $req["time"]).""; + $list=$list."".$req["test"]."".$req["sample"]."".$req["room"]."".date("M j, Y", $req["time"]).""; } } ?> @@ -51,34 +52,36 @@ if(isSet($_GET["pid"])){

    List of Requisitions

    - +
    Test NameDestinationDate
    Test NameSampleDestinationDate
    +
    >
    - +
    - +
    - +
    +
    - +
    +
    - - + diff --git a/www/res/script.js b/www/res/script.js index 7f88848..0e7abad 100644 --- a/www/res/script.js +++ b/www/res/script.js @@ -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); diff --git a/www/view.php b/www/view.php index c49027e..60b5f9b 100644 --- a/www/view.php +++ b/www/view.php @@ -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 index 0000000..641e234 --- /dev/null +++ b/www/vitek.php @@ -0,0 +1,38 @@ + + + + + + Culture/Sensitivity + + +
    + +
    + + + -- 2.39.5