Ejemplo n.º 1
0
    /**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = Procedures::find();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        $query->andFilterWhere([
            'id' => $this->id,
        ]);

        $query->andFilterWhere(['ilike', 'place', $this->place])
            ->andFilterWhere(['ilike', 'descr', $this->descr])
            ->andFilterWhere(['ilike', 'procedure', $this->procedure]);

        return $dataProvider;
    }
Ejemplo n.º 2
0
 /**
  * есть ли ретикулоциты
  * @param type $factors1
  * @param type $factors2
  * @return boolean
  */
 protected function defineProc($factors1, $factors2, $proc_cond_arr)
 {
     $proc_cond = "and name not like '%*%'";
     foreach ($proc_cond_arr as $el) {
         if (is_array($el)) {
             $el_str = implode("' or name like '", $el);
             $proc_cond .= " and ( name like '{$el_str}' )";
         } else {
             $proc_cond .= " and name like '{$el}'";
         }
     }
     foreach ($factors1 as $factor) {
         $factor_model = Factors1::find()->where(['code' => $factor])->one();
         if ($factor_model) {
             $proc = Procedures1::find()->where("factor={$factor_model->id}" . $proc_cond)->one();
             if ($proc) {
                 $procedure = Procedures::find()->where(['procedure' => $proc->name])->one();
                 if ($procedure && $procedure->place) {
                     return $procedure->place;
                 }
                 return 'каб.';
             }
         }
     }
     foreach ($factors2 as $factor) {
         $factor_model = Factors2::find()->where(['code' => $factor])->one();
         if ($factor_model) {
             $proc = Procedures2::find()->where("factor={$factor_model->id}" . $proc_cond)->one();
             if ($proc) {
                 $procedure = Procedures::find()->where(['procedure' => $proc->name])->one();
                 if ($procedure && $procedure->place) {
                     return $procedure->place;
                 }
                 return 'каб.';
             }
         }
     }
     return false;
 }