]> Softwares of Agnibho - simpleipd.git/commitdiff
Removed LaTeX PDF generator
authorAgnibho Mondal <mondal@agnibho.com>
Sun, 23 May 2021 11:25:53 +0000 (16:55 +0530)
committerAgnibho Mondal <mondal@agnibho.com>
Sun, 23 May 2021 11:25:53 +0000 (16:55 +0530)
discharge.tex [deleted file]
www/discharge.php
www/print-discharge.php [deleted file]

diff --git a/discharge.tex b/discharge.tex
deleted file mode 100644 (file)
index 89ddf62..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-\documentclass{article}
-\usepackage[a4paper]{geometry}
-\usepackage{tabularx}
-\usepackage{fancyhdr}
-
-\begin{document}
-\pagenumbering{gobble}
-\begin{center}
-School of Tropical Medicine \\
-{\small 108, Chittaranjan Avenue, Kolkata-700073}
-\rule{\textwidth}{0.4pt}
-Discharge Certificate\\
-\rule{\textwidth}{0.4pt}
-\end{center}
-\flushright
-%[vp]% \\
-\vspace{3em}
-\begin{tabular}{r r}
-Date of admission & %[doa]% \\
-Date of discharge & %[dod]% \\
-\end{tabular}
-\flushleft
-\vspace{-5em}
-\begin{tabularx}{\textwidth}{l X}
-       Name & %[name]%\\
-       Age & %[age]% \\
-       Sex & %[sex]% \\
-       Admission ID & %[pid]% \\
-       Diagnosis & %[diagnosis]%\\
-\end{tabularx}
-\rule{\textwidth}{0.4pt}
-\paragraph{Summary}
-%[summary]%
-\rule{\textwidth}{0.4pt}
-\paragraph{Advice on Discharge}
-%[advice]%
-\paragraph{}
-%[advice]%
-\vspace{2em}
-%[note]%
-\vfill
-\flushright
-\rule{10em}{0.4pt}\\
-Signature of Physician
-
-\newpage
-\fancyhead[R]{%[name]%}
-\fancyhead[C]{%[pid]%}
-\fancyhead[L]{Investigations}
-\setlength{\topmargin}{-5em}
-\pagestyle{fancy}
-%[reports]%
-\end{document}
index 2c06977a4be46a7229048c17549a61e72c7112dd..aaec72191bc396bb21c8bd272006887ed2016b8d 100644 (file)
@@ -2,6 +2,11 @@
 require(dirname(__DIR__)."/require.php");
 if(!empty($_GET["pid"])){
   $pid=$_GET["pid"];
+  if(!empty($_POST["discharge"]) && $_POST["discharge"]=="discharge"){
+    $db->setDischarged($pid);
+    header("Location: view.php?pid=".$_GET["pid"]);
+    exit();
+  }
   if(!empty($_POST["delete"])){
     $db->deleteAdvice($_POST["delete"]);
   }
@@ -37,9 +42,9 @@ if(!empty($_GET["pid"])){
       <div <?php echo checkAccess("discharge", "form");?>>
         <?php echo $form;?>
       </div>
-      <form method="post" action="print-discharge.php?pid=<?php echo $pid;?>" class="mt-4" <?php echo checkAccess("discharge", "form");?>>
-        <textarea class="form-control mb-2" id="discharge-note" name="discharge-note"></textarea>
-        <button type="submit" class="btn btn-danger">Discharge Patient</button>
+      <form method="post" class="mt-4" <?php echo checkAccess("discharge", "form");?>>
+        <input type="hidden" name="discharge" value="discharge">
+        <button type="submit" class="btn btn-danger confirm">Discharge Patient</button>
       </form>
     </div>
     <?php include(CONFIG_LIB."foot.php");?>
diff --git a/www/print-discharge.php b/www/print-discharge.php
deleted file mode 100644 (file)
index 4b0e4bc..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-require(dirname(__DIR__)."/require.php");
-function json2tex($data){
-    $data=json_decode($data);
-    if(!empty($data->form)){
-      $schema=json_decode(file_get_contents("forms/".$data->form.".schema.json"));
-    }
-    unset($data->cat);
-    $view="\begin{tabularx}{\\textwidth}{l X}\n";
-    foreach($data as $field=>$value){
-      if($field!="form" && !empty($value)){
-        if(!empty($schema->properties->$field)){
-          $view=$view.$schema->properties->$field->description." & ".$value."\\\\\n";
-        }
-        else{
-          $view=$view.$field." & ".$value."\n";
-        }
-      }
-    }
-    $view=$view."\\end{tabularx}\n";
-    return $view;
-}
-if(!empty($_GET["pid"])){
-  $pid=$_GET["pid"];
-  $template=file_get_contents(CONFIG_ROOT."discharge.tex");
-  if(!empty($_POST["discharge-note"])){
-    $template=str_replace("%[note]%", $_POST["discharge-note"], $template);
-  }
-  $template=str_replace("%[name]%", $db->getName($pid)->fetcharray()["name"], $template);
-  $template=str_replace("%[age]%", $db->getAge($pid)->fetcharray()["age"], $template);
-  $template=str_replace("%[sex]%", $db->getSex($pid)->fetcharray()["sex"], $template);
-  $template=str_replace("%[pid]%", $pid, $template);
-  $template=str_replace("%[diagnosis]%", $db->getDiagnosis($pid)->fetcharray()["diagnosis"], $template);
-  $template=str_replace("%[doa]%", $db->getAdmission($pid)->fetcharray()["admission"], $template);
-  $template=str_replace("%[dod]%", $db->getDeparture($pid)->fetcharray()["departure"], $template);
-  $template=str_replace("%[summary]%", $db->getSummary($pid)->fetcharray()["summary"], $template);
-  $list=$db->getAdvice($pid);
-  $view="";
-  while($drug=$list->fetchArray()){
-    $view=$view."\item ".$drug["drug"]." ".$drug["dose"]." ".$drug["route"]." ".$drug["frequency"]." ".$drug["duration"]." ".$drug["addl"]."\n";
-  }
-  if($view){
-    $template=str_replace("%[advice]%", "\begin{enumerate}\n".$view."\\end{enumerate}", $template);
-  }
-  $reports=[];
-  $reportsArray=$db->getAllData($pid, "reports");
-  while($r=$reportsArray->fetchArray()){
-    $template=str_replace("%[reports]%", json2tex($r["data"]), $template);
-  }
-  //echo $template;
-  $f=str_replace("/", "", $pid)."-".time()."-".rand();
-  file_put_contents("data/discharge/".$f.".tex", $template);
-  exec("pdflatex --output-directory data/discharge/ data/discharge/".$f.".tex", $out, $ret);
-  //var_dump($out);
-  //var_dump($ret);
-  if($ret!=0){
-    header("Content-Type: text/plain");
-    echo "Failed to generate discharge certificate. Please check whether patient information, summary, reports, discharge advices are properly filled up.";
-  }
-  else{
-    $db->setDischarged($pid);
-    header("Content-Type: application/pdf");
-    readFile("data/discharge/".$f.".pdf");
-    exec(" rm data/discharge/".$f."*");
-  }
-}
-?>