isPreviousMedication() public method

Is the preview current.
public isPreviousMedication ( ) : boolean
return boolean
Example #1
0
 /**
  * Gets the previous medications linked with items from the prescription events.
  *
  * @return array
  */
 public function get_previous_medications()
 {
     $medicationCriteria = new CDbCriteria(array('order' => 'created_date DESC'));
     $medicationCriteria->addCondition('end_date is not null and 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->isPreviousMedication()) {
                 $medications[] = $medication;
             }
         }
     }
     usort($medications, array($this, 'sortMedications'));
     return $medications;
 }