This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see .
예제 #1
0
 public function addFamilyHistory($relative_id, $side_id, $condition_id, $comments)
 {
     if (!($fh = FamilyHistory::model()->find('patient_id=? and relative_id=? and side_id=? and condition_id=?', array($this->id, $relative_id, $side_id, $condition_id)))) {
         $fh = new FamilyHistory();
         $fh->patient_id = $this->id;
         $fh->relative_id = $relative_id;
         $fh->side_id = $side_id;
         $fh->condition_id = $condition_id;
     }
     $fh->comments = $comments;
     if (!$fh->save()) {
         throw new Exception("Unable to save family history: " . print_r($fh->getErrors(), true));
     }
 }
예제 #2
0
 public function actionRemoveFamilyHistory()
 {
     if (!($patient = Patient::model()->findByPk(@$_GET['patient_id']))) {
         throw new Exception("Patient not found: " . @$_GET['patient_id']);
     }
     if (!($m = FamilyHistory::model()->find('patient_id=? and id=?', array($patient->id, @$_GET['family_history_id'])))) {
         throw new Exception("Family history not found: " . @$_GET['family_history_id']);
     }
     if (!$m->delete()) {
         throw new Exception("Failed to remove family history: " . print_r($m->getErrors(), true));
     }
     echo 'success';
 }
예제 #3
0
 /**
  * Adds FamilyHistory entry to the patient if it's not a duplicate
  *
  * @param $relative_id
  * @param $other_relative
  * @param $side_id
  * @param $condition_id
  * @param $other_condition
  * @param $comments
  * @throws Exception
  */
 public function addFamilyHistory($relative_id, $other_relative, $side_id, $condition_id, $other_condition, $comments)
 {
     $check_sql = 'patient_id=? and relative_id=? and side_id=? and condition_id=?';
     $params = array($this->id, $relative_id, $side_id, $condition_id);
     if ($other_relative) {
         $check_sql .= ' and other_relative=?';
         $params[] = $other_relative;
     } else {
         $check_sql .= ' and other_relative is null';
     }
     if ($other_condition) {
         $check_sql .= ' and other_condition=?';
         $params[] = $other_condition;
     } else {
         $check_sql .= ' and other_condition is null';
     }
     if (!($fh = FamilyHistory::model()->find($check_sql, $params))) {
         $fh = new FamilyHistory();
         $fh->patient_id = $this->id;
         $fh->relative_id = $relative_id;
         $fh->side_id = $side_id;
         $fh->condition_id = $condition_id;
     }
     $fh->comments = $comments;
     if (!$fh->save()) {
         throw new Exception("Unable to save family history: " . print_r($fh->getErrors(), true));
     }
     if ($this->no_family_history_date) {
         $this->no_family_history_date = null;
         if (!$this->save()) {
             throw new Exception('Could not remove no family history flag: ' . print_r($this->getErrors(), true));
         }
     }
 }