Exemple #1
0
 * 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();
    $historyQ->selectFamily($idPatient);
    $historyF = $historyQ->fetch();
    //Error::debug($patient); Error::debug($historyP); Error::debug($historyF, "", true);
    $delPatientQ = new Query_DelPatient();
    $delPatientQ->insert($patient, $historyP, $historyF, $_SESSION['auth']['user_id'], $_SESSION['auth']['login_session']);
    unset($delPatientQ);
    unset($patient);
    unset($historyQ);
    unset($historyP);
    unset($historyF);
}
/**
 * Record log process (before deleting process)
require_once "../model/Query/History.php";
require_once "../model/Patient.php";
/**
 * Retrieving var (PGS)
 */
$idPatient = Check::postGetSessionInt('id_patient');
$patient = new Patient($idPatient);
if ($patient->getName() == '') {
    FlashMsg::add(_("Beneficiário não cadastrado."), OPEN_MSG_ERROR);
    header("Location: ../medical/patient_search_form.php");
    exit;
}
/**
 * Search database
 */
$historyQ = new Query_History();
if (!$historyQ->selectPersonal($idPatient)) {
    $historyQ->close();
    FlashMsg::add(_("Beneficiário não cadastrado."), OPEN_MSG_ERROR);
    header("Location: ../medical/patient_search_form.php");
    exit;
}
$history = $historyQ->fetch();
if ($history) {
    $formVar["id_patient"] = $history->getIdPatient();
    $formVar["birth_growth"] = $history->getBirthGrowth();
    $formVar["growth_sexuality"] = $history->getGrowthSexuality();
    $formVar["feed"] = $history->getFeed();
    $formVar["habits"] = $history->getHabits();
    $formVar["peristaltic_conditions"] = $history->getPeristalticConditions();
    $formVar["psychological"] = $history->getPsychological();
require_once "../model/Query/History.php";
require_once "../model/Patient.php";
/**
 * Retrieving var (PGS)
 */
$idPatient = Check::postGetSessionInt('id_patient');
$patient = new Patient($idPatient);
if ($patient->getName() == '') {
    FlashMsg::add(_("Beneficiário não cadastrado."), OPEN_MSG_ERROR);
    header("Location: ../medical/patient_search_form.php");
    exit;
}
/**
 * Search database for problem
 */
$historyQ = new Query_History();
if (!$historyQ->selectFamily($idPatient)) {
    $historyQ->close();
    FlashMsg::add(_("Beneficiário não cadastrado."), OPEN_MSG_ERROR);
    header("Location: ../medical/patient_search_form.php");
    exit;
}
$history = $historyQ->fetch();
if (!$history) {
    $historyQ->close();
    Error::fetch($historyQ);
}
$historyQ->freeResult();
$historyQ->close();
unset($historyQ);
/**
    }
    if ($problem->getPrescription()) {
        echo HTML::section(3, _("Prescription"));
        echo HTML::para(nl2br($problem->getPrescription()));
    }
    echo HTML::rule();
}
// end while
$problemQ->freeResult();
$problemQ->close();
unset($problemQ);
unset($problem);
/**
 * Show personal antecedents
 */
$historyQ = new Query_History();
$historyQ->selectPersonal($idPatient);
$history = $historyQ->fetch();
if (!$history) {
    Error::fetch($historyQ);
}
echo HTML::section(2, _("Personal Antecedents"));
if ($history->getBirthGrowth()) {
    echo HTML::section(3, _("Birth and Growth"));
    echo HTML::para(nl2br($history->getBirthGrowth()));
}
if ($history->getGrowthSexuality()) {
    echo HTML::section(3, _("Growth and Sexuality"));
    echo HTML::para(nl2br($history->getGrowthSexuality()));
}
if ($history->getFeed()) {
    //header("Location: ../medical/history_personal_edit_form.php?id_patient=" . $idPatient);
    header("Location: ../medical/history_personal_edit_form.php");
    exit;
}
/**
 * Destroy form values and errors
 */
Form::unsetSession();
/**
 * Prevent user from aborting script
 */
$oldAbort = ignore_user_abort(true);
/**
 * Update personal antecedents
 */
$historyQ = new Query_History();
$historyQ->updatePersonal($history);
$historyQ->close();
unset($historyQ);
/**
 * Record log process
 */
$recordQ = new Query_Page_Record();
$recordQ->log("Query_History", "UPDATE", array($idPatient), "selectPersonal");
$recordQ->close();
unset($recordQ);
/**
 * Reset abort setting
 */
ignore_user_abort($oldAbort);
/**
    //header("Location: ../medical/history_family_edit_form.php?id_patient=" . $idPatient);
    header("Location: ../medical/history_family_edit_form.php");
    exit;
}
/**
 * Destroy form values and errors
 */
Form::unsetSession();
/**
 * Prevent user from aborting script
 */
$oldAbort = ignore_user_abort(true);
/**
 * Update family antecedents
 */
$historyQ = new Query_History();
$historyQ->updateFamily($history);
$historyQ->close();
unset($historyQ);
/**
 * Record log process
 */
$recordQ = new Query_Page_Record();
$recordQ->log("Query_History", "UPDATE", array($idPatient), "selectFamily");
$recordQ->close();
unset($recordQ);
/**
 * Reset abort setting
 */
ignore_user_abort($oldAbort);
/**