Exemplo n.º 1
0
    /**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = Factors2::find()->orderBy('id');

        $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', 'code', $this->code])
            ->andFilterWhere(['ilike', 'name', $this->name])
            ->andFilterWhere(['ilike', 'period', $this->period]);

        return $dataProvider;
    }
Exemplo n.º 2
0
 /**
  * check factors in file
  * @param type $factors_str
  * @return type
  */
 public static function checkFactors($factors_str,$pril)
 {
     $factors_arr=explode(',',$factors_str);
     foreach($factors_arr as $code) {
         if($pril==1) {
             $factor=Factors1::find()->where(['code'=>$code])->one();
         } else {
             $factor=Factors2::find()->where(['code'=>$code])->one();
         }
         return self::checkFactor($factor,$code,$pril);
     }
 }
Exemplo n.º 3
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;
 }