/** * bool insert(Patient $patient, History $historyP, History $historyF, int $idUser, string $login) * * Inserts a new deleted patient into the database. * * @param Patient $patient patient to insert * @param History $historyP patient's personal antecedents to insert * @param History $historyF patient's family antecedents to insert * @param int $idUser key of user that makes deletion * @param string $login login session of user that makes deletion * @return boolean returns false, if error occurs * @access public */ function insert($patient, $historyP, $historyF, $idUser, $login) { $sql = "INSERT INTO " . $this->_table; $sql .= " (id_patient, nif, first_name, surname1, surname2, address, phone_contact, "; $sql .= "sex, race, birth_date, birth_place, decease_date, nts, nss, "; $sql .= "family_situation, labour_situation, education, insurance_company, "; $sql .= "id_member, collegiate_number, birth_growth, growth_sexuality, feed, habits, "; $sql .= "peristaltic_conditions, psychological, children_complaint, venereal_disease, "; $sql .= "accident_surgical_operation, medicinal_intolerance, mental_illness, "; $sql .= "parents_status_health, brothers_status_health, spouse_childs_status_health, "; $sql .= "family_illness, create_date, id_user, login) VALUES ("; $sql .= "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "; $sql .= "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "; $sql .= "?, ?, ?, ?, NOW(), ?, ?);"; $params = array($patient->getIdPatient(), urlencode($patient->getNIF()), urlencode($patient->getFirstName()), urlencode($patient->getSurname1()), urlencode($patient->getSurname2()), urlencode($patient->getAddress()), urlencode($patient->getPhone()), $patient->getSex(), urlencode($patient->getRace()), $patient->getBirthDate(), urlencode($patient->getBirthPlace()), $patient->getDeceaseDate(), urlencode($patient->getNTS()), urlencode($patient->getNSS()), urlencode($patient->getFamilySituation()), urlencode($patient->getLabourSituation()), urlencode($patient->getEducation()), urlencode($patient->getInsuranceCompany()), $patient->getIdMember(), urlencode($patient->getCollegiateNumber()), urlencode($historyP->getBirthGrowth()), urlencode($historyP->getGrowthSexuality()), urlencode($historyP->getFeed()), urlencode($historyP->getHabits()), urlencode($historyP->getPeristalticConditions()), urlencode($historyP->getPsychological()), urlencode($historyP->getChildrenComplaint()), urlencode($historyP->getVenerealDisease()), urlencode($historyP->getAccidentSurgicalOperation()), urlencode($historyP->getMedicinalIntolerance()), urlencode($historyP->getMentalIllness()), urlencode($historyF->getParentsStatusHealth()), urlencode($historyF->getBrothersStatusHealth()), urlencode($historyF->getSpouseChildsStatusHealth()), urlencode($historyF->getFamilyIllness()), intval($idUser), urlencode($login)); return $this->exec($sql, $params); }
/** * bool updatePersonal(History $history) * * Update personal antecedents in the history table. * * @param History $history personal antecedents to update * @return boolean returns false, if error occurs * @access public */ function updatePersonal($history) { if (!$history instanceof History) { $this->_error = "Argument is an inappropriate object."; return false; } $sql = "UPDATE " . $this->_table . " SET " . "birth_growth=?, " . "growth_sexuality=?, " . "feed=?, " . "habits=?, " . "peristaltic_conditions=?, " . "psychological=?, " . "children_complaint=?, " . "venereal_disease=?, " . "accident_surgical_operation=?, " . "medicinal_intolerance=?, " . "mental_illness=? " . "WHERE id_patient=?;"; $params = array(urlencode($history->getBirthGrowth()), urlencode($history->getGrowthSexuality()), urlencode($history->getFeed()), urlencode($history->getHabits()), urlencode($history->getPeristalticConditions()), urlencode($history->getPsychological()), urlencode($history->getChildrenComplaint()), urlencode($history->getVenerealDisease()), urlencode($history->getAccidentSurgicalOperation()), urlencode($history->getMedicinalIntolerance()), urlencode($history->getMentalIllness()), $history->getIdPatient()); return $this->exec($sql, $params); }
* Validate data */ $history = new History(); $history->setIdPatient($_POST["id_patient"]); $history->setBirthGrowth($_POST["birth_growth"]); $_POST["birth_growth"] = $history->getBirthGrowth(); $history->setGrowthSexuality($_POST["growth_sexuality"]); $_POST["growth_sexuality"] = $history->getGrowthSexuality(); $history->setFeed($_POST["feed"]); $_POST["feed"] = $history->getFeed(); $history->setHabits($_POST["habits"]); $_POST["habits"] = $history->getHabits(); $history->setPeristalticConditions($_POST["peristaltic_conditions"]); $_POST["peristaltic_conditions"] = $history->getPeristalticConditions(); $history->setPsychological($_POST["psychological"]); $_POST["psychological"] = $history->getPsychological(); $history->setChildrenComplaint($_POST["children_complaint"]); $_POST["children_complaint"] = $history->getChildrenComplaint(); $history->setVenerealDisease($_POST["venereal_disease"]); $_POST["venereal_disease"] = $history->getVenerealDisease(); $history->setAccidentSurgicalOperation($_POST["accident_surgical_operation"]); $_POST["accident_surgical_operation"] = $history->getAccidentSurgicalOperation(); $history->setMedicinalIntolerance($_POST["medicinal_intolerance"]); $_POST["medicinal_intolerance"] = $history->getMedicinalIntolerance(); $history->setMentalIllness($_POST["mental_illness"]); $_POST["mental_illness"] = $history->getMentalIllness(); if (!$history->validateData()) { //$formError["???"] = $history->get???Error(); //$formError["???"] = $history->get???Error(); Form::setSession($_POST); //header("Location: ../medical/history_personal_edit_form.php?id_patient=" . $idPatient);