예제 #1
0
$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)
 */
$recordQ = new Query_Page_Record();
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();
    $formVar["children_complaint"] = $history->getChildrenComplaint();
    $formVar["venereal_disease"] = $history->getVenerealDisease();
    $formVar["accident_surgical_operation"] = $history->getAccidentSurgicalOperation();
    $formVar["medicinal_intolerance"] = $history->getMedicinalIntolerance();
    $formVar["mental_illness"] = $history->getMentalIllness();
} else {
    Error::fetch($historyQ, false);