$numRows = $relQ->select($idPatient); $rel = array(); for ($i = 0; $i < $numRows; $i++) { $rel[] = $relQ->fetch(); } $relQ->freeResult(); while ($aux = array_shift($rel)) { $relQ->delete($idPatient, $aux[1]); } $relQ->close(); unset($relQ); unset($rel); /** * Delete patient */ $patQ = new Query_Page_Patient(); if (defined("OPEN_DEMO") && !OPEN_DEMO) { if (!$patQ->select($idPatient)) { $patQ->close(); FlashMsg::add(_("That patient does not exist."), OPEN_MSG_ERROR); header("Location: " . $returnLocation); exit; } $patient = $patQ->fetch(); if (!$patient) { $patQ->close(); Error::fetch($patQ); } $historyQ = new Query_History(); $historyQ->selectPersonal($idPatient); $historyP = $historyQ->fetch();
/** * mixed Patient(int $id = 0) * * Constructor * * @param int $id (optional) * @return mixed void if not argument, null if not exists patient, object otherwise * @access public */ public function Patient($id = 0) { $this->_trans = array_flip(get_html_translation_table(HTML_SPECIALCHARS)); if ($id) { $_patQ = new Query_Page_Patient(); if (!$_patQ->select($id)) { return null; } foreach (get_object_vars($_patQ->fetch()) as $key => $value) { $this->{$key} = $value; } $_patQ->freeResult(); $_patQ->close(); } }
require_once "../medical/patient_validate_post.php"; //$returnLocation = "../medical/patient_view.php?id_patient=" . $idPatient; // controlling var $returnLocation = "../medical/patient_view.php"; // controlling var /** * Destroy form values and errors */ Form::unsetSession(); /** * Prevent user from aborting script */ $oldAbort = ignore_user_abort(true); /** * Update patient */ $patQ = new Query_Page_Patient(); if ($patQ->existName($pat->getFirstName(), $pat->getSurname1(), $pat->getSurname2(), $pat->getIdPatient())) { $patQ->close(); FlashMsg::add(sprintf(_("O nome do beneficiário, %s, está em uso. As mudanças não terão efeito."), $patName), OPEN_MSG_WARNING); header("Location: " . $returnLocation); exit; } $patQ->update($pat); $patQ->close(); unset($patQ); unset($pat); /** * Record log process */ $recordQ = new Query_Page_Record(); $recordQ->log("Query_Page_Patient", "UPDATE", array($idPatient));
* Retrieving vars (PGS) and scrubbing the data */ $currentPage = Check::postGetSessionInt('page', 1); $searchType = Check::postGetSessionInt('search_type'); $logical = Check::postGetSessionString('logical'); $limit = Check::postGetSessionInt('limit'); // remove slashes added by form post $searchText = stripslashes(Check::postGetSessionString('search_text')); // remove redundant whitespace $searchText = preg_replace("/[[:space:]]+/i", " ", $searchText); // transform string in array of strings $arraySearch = Search::explodeQuoted($searchText); /** * Search database */ $patQ = new Query_Page_Patient(); $patQ->setItemsPerPage(OPEN_ITEMS_PER_PAGE); $patQ->search($searchType, $arraySearch, $currentPage, $logical, $limit); /** * No results message if no results returned from search. */ if ($patQ->getRowCount() == 0) { $patQ->close(); FlashMsg::add(sprintf(_("No results found for '%s'."), $searchText)); header("Location: ../medical/patient_search_form.php"); exit; } /** * Show patient view screen if only one result from query */ if ($patQ->getRowCount() == 1) {
*/ $pat = new Patient(); require_once "../medical/patient_validate_post.php"; $patName = $pat->getFirstName() . ' ' . $pat->getSurname1() . ' ' . $pat->getSurname2(); /** * Destroy form values and errors */ Form::unsetSession(); /** * Prevent user from aborting script */ $oldAbort = ignore_user_abort(true); /** * Insert new patient */ $patQ = new Query_Page_Patient(); if ($patQ->existName($pat->getFirstName(), $pat->getSurname1(), $pat->getSurname2())) { $patQ->close(); FlashMsg::add(sprintf(_("Beneficiário %s, está em uso. As mudanças não serão realizadas."), $patName), OPEN_MSG_WARNING); header("Location: ../medical/patient_new_form.php"); exit; } $patQ->insert($pat); $idPatient = $patQ->getLastId(); $patQ->close(); unset($patQ); unset($pat); /** * Record log process */ $recordQ = new Query_Page_Record();
$thead = array(sprintf(_("Search Results From Query: %s"), $query) => array('colspan' => 2)); $options = array(0 => array('align' => 'right')); $recordset = null; while ($problem = $problemQ->fetch()) { $row = $problemQ->getCurrentRow(); eval("\$aux = {$val};"); $recordset[$row] = $row . OPEN_SEPARATOR . $problem->getIdProblem() . OPEN_SEPARATOR . $problem->getIdPatient() . OPEN_SEPARATOR . $aux . OPEN_SEPARATOR . I18n::localDate($problem->getOpeningDate()) . OPEN_SEPARATOR . I18n::localDate($problem->getClosingDate()); } // end while $problemQ->freeResult(); $problemQ->close(); unset($problemQ); $tbody = array(); foreach ($recordset as $arrKey => $arrValue) { $array = explode(OPEN_SEPARATOR, $arrValue, 6); $patQ = new Query_Page_Patient(); if ($patQ->select($array[2])) { $pat = $patQ->fetch(); if (!$pat) { $patQ->close(); Error::fetch($patQ); } $row = $array[0] . '.'; $row .= OPEN_SEPARATOR; $row .= HTML::link($pat->getSurname1() . " " . $pat->getSurname2() . ", " . $pat->getFirstName(), '../medical/problem_view.php', array('id_problem' => $array[1], 'id_patient' => $array[2])); $row .= "<br />" . PHP_EOL . $key . " " . $array[3] . "<br />" . PHP_EOL; $row .= _("Opening Date") . ": " . $array[4]; if ($array[5] != "") { $row .= "<br />" . _("Closing Date") . ": " . $array[5]; } $tbody[] = explode(OPEN_SEPARATOR, $row);
echo Form::hidden("id_patient", $idPatient); require_once "../medical/patient_search_fields.php"; echo HTML::end('form'); echo Msg::hint('* ' . _("Note: Empty search to see all results.")); } // end if if (count($relArray) == 0) { echo Msg::info(_("No relatives defined for this patient.")); include_once "../layout/footer.php"; exit; } echo HTML::rule(); echo HTML::section(2, _("Relatives List:")); $thead = array(_("#"), _("Function") => array('colspan' => $_SESSION['auth']['is_administrative'] ? 2 : 1), _("Surname 1"), _("Surname 2"), _("First Name")); $options = array(0 => array('align' => 'right')); $patQ = new Query_Page_Patient(); $patQ->captureError(true); $tbody = array(); for ($i = 0; $i < count($relArray); $i++) { $patQ->select($relArray[$i]); if ($patQ->isError()) { Error::query($patQ, false); continue; } $pat = $patQ->fetch(); if (!$pat) { $patQ->close(); Error::fetch($patQ); } $relName = $pat->getFirstName() . " " . $pat->getSurname1() . " " . $pat->getSurname2(); $row = $i + 1 . '.';
// remove redundant whitespace $searchText = preg_replace("/[[:space:]]+/i", " ", $searchText); // secure data $searchText = urlencode($searchText); // explode data $arraySearch = explode("+", $searchText); $patient = new Patient($idPatient); if ($patient->getName() == '') { FlashMsg::add(_("That patient does not exist."), OPEN_MSG_ERROR); header("Location: ../medical/patient_search_form.php"); exit; } /** * Search database */ $patQ = new Query_Page_Patient(); $patQ->setItemsPerPage(OPEN_ITEMS_PER_PAGE); $patQ->search($searchType, $arraySearch, $currentPage, $logical, $limit); /** * No results message if no results returned from search. */ if ($patQ->getRowCount() == 0) { $patQ->close(); FlashMsg::add(sprintf(_("No results found for '%s'."), $searchText)); header("Location: " . $returnLocation); exit; } /** * Show page */ $title = _("Search Results");