getCurrentEpisodeByFirm() 공개 정적인 메소드

wrapper for getCurrentEpisodeBySubspecialtyId($patient_id, $subspecialty_id, $include_closed)
public static getCurrentEpisodeByFirm ( $patient_id, $firm, $include_closed = false )
 /**
  * Caching wrapper for the current episode lookup
  *
  * @return array|mixed|null|void
  * @throws Exception
  */
 public function getOwnerCurrentEpisode()
 {
     if (!$this->current_episode) {
         $this->current_episode = Episode::getCurrentEpisodeByFirm($this->owner->patient->id, $this->owner->firm);
     }
     return $this->current_episode;
 }
예제 #2
0
 public function run()
 {
     if ($this->element) {
         $this->class = CHTML::modelName($this->element);
     } else {
         $this->class = get_class($this);
     }
     if (empty($_POST) || !array_key_exists($this->class, $_POST)) {
         if (empty($this->element->event_id)) {
             if ($this->default) {
                 // It's a new event so fetch the most recent element_diagnosis
                 $firmId = Yii::app()->session['selected_firm_id'];
                 $firm = Firm::model()->findByPk($firmId);
                 if (isset(Yii::app()->getController()->patient)) {
                     $patientId = Yii::app()->getController()->patient->id;
                     $episode = Episode::getCurrentEpisodeByFirm($patientId, $firm, true);
                     if ($episode && ($disorder = $episode->diagnosis)) {
                         // There is a diagnosis for this episode
                         $this->value = $disorder->id;
                         $this->label = $disorder->term;
                     }
                 }
             }
         } else {
             if (isset($this->element->disorder)) {
                 $this->value = $this->element->disorder->id;
                 $this->label = $this->element->disorder->term;
             }
         }
     } elseif (array_key_exists($this->field, $_POST[$this->class])) {
         if (preg_match('/[^\\d]/', $_POST[$this->class][$this->field])) {
             if ($disorder = Disorder::model()->find('term=? and specialty_id is not null', array($_POST[$this->class][$this->field]))) {
                 $this->value = $disorder->id;
                 $this->label = $disorder->term;
             }
         } else {
             $this->value = $_POST[$this->class][$this->field];
             if ($disorder = Disorder::model()->findByPk($this->value)) {
                 $this->label = $disorder->term;
             }
         }
     }
     parent::run();
 }
예제 #3
0
echo $subspecialty ? $subspecialty->name : 'Support services';
?>
 episode:</strong>
</div>
<ul class="events">
	<?php 
foreach ($eventTypes as $eventType) {
    if ($subspecialty || $eventType->support_services) {
        if (file_exists(Yii::getPathOfAlias('application.modules.' . $eventType->class_name . '.assets.img'))) {
            $assetpath = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('application.modules.' . $eventType->class_name . '.assets.img') . '/') . '/';
        } else {
            $assetpath = '/assets/';
        }
        // temporary hack to ensure that we are checking the right operation name for the event.
        $oprn = 'OprnCreate' . ($eventType->class_name == 'OphDrPrescription' ? 'Prescription' : 'Event');
        if ($this->checkAccess($oprn, $this->firm, Episode::getCurrentEpisodeByFirm($this->patient->id, $this->firm), $eventType)) {
            ?>
				<li>
					<?php 
            echo CHtml::link('<img src="' . $assetpath . 'small.png" alt="operation" /> - <strong>' . $eventType->name . '</strong>', Yii::app()->createUrl($eventType->class_name . '/Default/create') . '?patient_id=' . $patient->id);
            ?>
				</li>
			<?php 
        } else {
            ?>
				<li id="<?php 
            echo $eventType->class_name;
            ?>
_disabled" class="add_event_disabled" title="<?php 
            echo $eventType->disabled ? $eventType->disabled_title : 'You do not have permission to add ' . $eventType->name;
            ?>
예제 #4
0
 /**
  * Get or create an episode for the patient under the given Firm (Note that an episode will be returned if there
  * is match on Firm Subspecialty rather than on Firm)
  *
  * @param $firm
  * @param bool $include_closed
  * @return CActiveRecord|Episode|null
  */
 public function getOrCreateEpisodeForFirm($firm, $include_closed = false)
 {
     if (!($episode = Episode::getCurrentEpisodeByFirm($this->id, $firm, $include_closed))) {
         $episode = $this->addEpisode($firm);
     }
     return $episode;
 }
 /**
  * Set default values for forms on create.
  */
 public function setDefaultOptions()
 {
     $patient_id = (int) $_REQUEST['patient_id'];
     $firm = Yii::app()->getController()->firm;
     $episode = Episode::getCurrentEpisodeByFirm($patient_id, $firm);
     if ($episode && $episode->diagnosis) {
         $this->eye_id = $episode->eye_id;
     }
     $this->site_id = Yii::app()->session['selected_site_id'];
     $this->senior_fellow_to_do = false;
     if ($patient = Patient::model()->findByPk($patient_id)) {
         $key = $patient->isChild() ? 'ophtroperationbooking_default_anaesthetic_child' : 'ophtroperationbooking_default_anaesthetic';
         if (isset(Yii::app()->params[$key])) {
             if ($at = AnaestheticType::model()->find('code=?', array(Yii::app()->params[$key]))) {
                 $this->anaesthetic_type_id = $at->id;
             }
         }
     }
     $this->fast_track = false;
     $this->special_equipment = false;
     $this->organising_admission_user_id = Yii::app()->user->id;
     if ($priority = OphTrOperationbooking_Operation_Priority::model()->notDeleted()->find('`default`=1')) {
         $this->priority_id = $priority->id;
     }
 }