Exemplo n.º 1
0
 public function calculateIndicators($id, $idSpec)
 {
     $hospitalIndicators = Divisions::find()->where(['id' => $id])->one();
     $indicatorDefinitions = IndicatorNames::find()->all();
     foreach ($indicatorDefinitions as $indicator) {
         $numeratorName = $indicator->basicNumerator->name;
         if ($indicator->denominator != 0) {
             $denominatorName = $indicator->basicDenominator->name;
         }
         if ($indicator->denominator != 0 && $hospitalIndicators->{$denominatorName} != 0) {
             $indicatorValue = ($hospitalIndicators->{$numeratorName} - $hospitalIndicators->{$denominatorName}) / $hospitalIndicators->{$denominatorName};
         } elseif ($indicator->denominator_dec != 0) {
             $indicatorValue = ($hospitalIndicators->{$numeratorName} - $indicator->denominator_dec) / $indicator->denominator_dec;
         } else {
             $indicatorValue = $hospitalIndicators->{$numeratorName};
         }
         $this->indicatorsArray[$indicator->indicator] = Indicators::_getRank($indicator->indicator, $indicatorValue, $id, $idSpec);
     }
 }
Exemplo n.º 2
0
 /**
  * Generates insights for given hospital.
  * @param integer $id
  * @return mixed
  */
 public function actionInsights($id)
 {
     $model = $this->findModel($id);
     $indicators = new Indicators();
     $indicators->calculateIndicators($id);
     $insights = new Insights();
     $insights->prepareInsights($indicators->getIndicatorsArray());
     return $this->render('insights', ['model' => $model, 'insights' => $insights]);
 }