isCurrentMedication() public method

Is the medication current.
public isCurrentMedication ( ) : boolean
return boolean
Example #1
0
 /**
  * Gets the current medications linked with items from the prescription events.
  *
  * @return array
  */
 public function get_medications()
 {
     $medicationCriteria = new CDbCriteria(array('order' => 'created_date DESC'));
     $medicationCriteria->addCondition('end_date is null or end_date > NOW()');
     $medications = $this->patientMedications($medicationCriteria);
     $medicationsFromPrescriptions = $this->prescriptionMedicationIds();
     $prescriptionItems = $this->prescriptionItems($medicationsFromPrescriptions);
     if ($prescriptionItems) {
         foreach ($prescriptionItems as $item) {
             $medication = new Medication();
             $medication->createFromPrescriptionItem($item);
             if ($medication->isCurrentMedication()) {
                 $medications[] = $medication;
             }
         }
     }
     usort($medications, array($this, 'sortMedications'));
     return $medications;
 }