Example #1
0
 public function getDiseasesByCondition($param = [], $offset = 0, $length = 10)
 {
     $where = '';
     $bound = [];
     foreach ($param as $k => $v) {
         if (!empty($v)) {
             $where .= ' and ' . $k . ' = :' . $k;
             $bound[':' . $k] = $v;
         }
     }
     $where = substr($where, 5);
     $where = !empty($where) ? $where : '';
     return Disease::find()->select("id,name,class_level1,class_level2,source")->where($where, $bound)->offset($offset)->limit($length)->asArray()->all();
 }