function delete_patient($patient_id, $lab_config_id) { $retval = get_specimens_by_patient_id($patient_id); # Deletes a patient from DB $isSuccess = 1; global $con; $saved_db = DbUtil::switchToLabConfig($lab_config_id); if (sizeof($retval) > 0) { // Collect Specimen Related to patients // Delete the above collected specimen from the above specimen table // Collect the tests related to the above specimen // Delete the above collected tests from the appropriate table //$isSuccess = 0; delete_specimen_by_specimen_id($retval); } # Remove patient record //$query_string = "DELETE FROM patient WHERE patient_id=$patient_id"; //query_blind($query_string); $remarks = "Typo"; $category = "patient"; remove_specimens($lab_config_id, $patient_id, $remarks, $category); DbUtil::switchRestore($saved_db); return $isSuccess; }
<?php include "redirect.php"; include "../includes/db_lib.php"; /* echo "<pre>"; print_r($_POST); echo "</pre>"; */ putUILog('rem_tests', 'X', basename($_SERVER['REQUEST_URI'], ".php"), 'X', 'X', 'X'); $lid = $_SESSION['lab_config_id']; $sp = $_POST['sp']; $remarks = $_POST['remarks']; $count = count($sp); for ($i = 0; $i < $count; $i++) { if (isset($_POST['category'])) { remove_specimens($lid, $sp[$i], $remarks[$i], $_POST['category']); $testsList = get_tests_by_specimen_id($sp[$i]); delete_tests_by_test_id($testsList); } else { remove_specimens($lid, $sp[$i], $remarks[$i]); } } $url = "Location:../" . $_POST['url']; header($url);