]> Softwares of Agnibho - simpleipd.git/commitdiff
Fixed departure
authorAgnibho Mondal <mondal@agnibho.com>
Thu, 10 Jun 2021 21:14:19 +0000 (02:44 +0530)
committerAgnibho Mondal <mondal@agnibho.com>
Thu, 10 Jun 2021 21:14:19 +0000 (02:44 +0530)
lib/db.php
www/printdata.php
www/view.php

index 9cdffbcb3f5b315f82bc0a7d35a647d82e75e8df..86e37608ebe006bd7ca5e54046f9f7782914295a 100644 (file)
@@ -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));
   }
index 60178f25d17892e83807b66657e84eef532170f6..2e2bf646d9c3dd38a32b6acb6486b2114f09a043 100644 (file)
@@ -9,6 +9,7 @@ $death="<h4>Medical Cause of Death</h4>";
 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."</ol>";
       <h2><?php echo CONFIG_TITLE;?></h2>
       <h4><?php echo "Patient Record";?></h4>
       <?php echo $info;?>
-      <?php echo "<p><strong>Status: </strong>".$status."</p>";?>
+      <?php echo "<p><strong>Status: </strong>".$status."<br>";?>
+      <?php if(!empty($departure)) echo "(".date("M d, Y h:i a", $departure).")</p>"; ?>
       <?php echo $history;?>
       <?php foreach($physician as $p) echo $p;?>
       <?php foreach($nursing as $n) echo $n;?>
index 8267a4df498384004696d2906d977904b299f6c3..8e63accefc118382f5337cee2ff5c67098b6b52a 100644 (file)
@@ -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"])){
         </ul>
         <div class="tab-content" id="viewtabs">
           <div class="tab-pane fade show active" id="info" role="tabpanel" aria-labelledby="info-tab">
-            <div class='card'><div class='card-body'>Status: <?php echo $status;?></div></div>
+            <div class='card'><div class='card-body'>Status: <?php echo $status;?><?php if(!empty($departure)) echo " (".date("M d, Y h:i a", $departure).")"; ?></div></div>
             <div class="row">
               <div class="col-md-6">
                 <?php echo $info;?>