From: Agnibho Mondal Date: Thu, 10 Jun 2021 21:14:19 +0000 (+0530) Subject: Fixed departure X-Git-Url: https://code.agnibho.com/repo?a=commitdiff_plain;h=cd2da89b1e0ec372b8764d97b41757db0a90688c;p=simpleipd.git Fixed departure --- diff --git a/lib/db.php b/lib/db.php index 9cdffbc..86e3760 100644 --- a/lib/db.php +++ b/lib/db.php @@ -267,9 +267,10 @@ class DB extends SQLite3 { function setDischarged($pid){ global $log; if(!checkAccess("discharge", "dbSet")) return false; - $stmt=$this->prepare("UPDATE patients SET status=:discharged WHERE pid=:pid;"); + $stmt=$this->prepare("UPDATE patients SET status=:discharged,departure=:time WHERE pid=:pid;"); $stmt->bindValue(":pid", $pid); $stmt->bindValue(":discharged", "discharged"); + $stmt->bindValue(":time", time()); $stmt->execute(); $log->log($pid, "discharged", null); } @@ -281,8 +282,10 @@ class DB extends SQLite3 { $stmt->bindValue(":time", strtotime($post["date"].$post["time"])); $stmt->bindValue(":data", json_encode($post)); $stmt->execute(); - $stmt=$this->prepare("UPDATE patients SET status='expired' WHERE pid=:pid;"); + $stmt=$this->prepare("UPDATE patients SET status=:expired,departure=:time WHERE pid=:pid;"); $stmt->bindValue(":pid", $pid); + $stmt->bindValue(":expired", "expired"); + $stmt->bindValue(":time", time()); $stmt->execute(); $log->log($pid, "death_declare", json_encode($post)); } diff --git a/www/printdata.php b/www/printdata.php index 60178f2..2e2bf64 100644 --- a/www/printdata.php +++ b/www/printdata.php @@ -9,6 +9,7 @@ $death="

Medical Cause of Death

"; if($_GET["pid"]){ $pid=$_GET["pid"]; $status=$db->getStatus($pid)->fetchArray()["status"]; + $departure=$db->getDeparture($pid)->fetchArray()["departure"]; $info=getInfo($pid); $history=viewData($db->getHistory($pid)->fetchArray()["history"]); $physicianArray=$db->getAllData($pid, "physician"); @@ -78,7 +79,8 @@ $discharge=$discharge."";

- Status: ".$status."

";?> + Status: ".$status."
";?> + "; ?> diff --git a/www/view.php b/www/view.php index 8267a4d..8e63acc 100644 --- a/www/view.php +++ b/www/view.php @@ -24,9 +24,11 @@ if(isSet($_GET["pid"])){ $status=$db->getStatus($pid)->fetchArray()["status"]; if($status!="admitted"){ $archive="disabled"; + $departure=$db->getDeparture($pid)->fetchArray()["departure"]; } else{ $archive=""; + $departure=""; } $info=viewData($db->getAdmissionData($pid)->fetchArray()["data"]); $history=$db->getHistory($pid)->fetchArray()["history"]; @@ -128,7 +130,7 @@ if(isSet($_GET["pid"])){
-
Status:
+
Status: