<?php

namespace admin\action\doctor;

/**
 * Class elementAction
 * @package admin\action
 */
class toolAction  extends \action
{
	public function __construct()
    {
		
	}
    
	public function measureReport()
    {
        $req = \mvc::$req;
        $cates = (new \model\element('dt_measure_type'))->getRowsAll();
        $devices = (new \model\element('dt_measure_device'))->getRowsAll();
        foreach($cates as $k=>$cate){
            $cate['fullname'] = $cate['meat_name'];
            if(!empty($cate['meat_small'])) $cate['fullname'] .= '-' . $cate['meat_small'];
            $cates[$k] = $cate;
        }
        $bigCates = [];
        foreach($cates as $k=>$cate){
            $bigCates[] = $cate['meat_name'];
        }
        $bigCates = array_unique($bigCates);
		\view::set('bigCates',$bigCates);
		\view::set('devices',$devices);
		\view::put();
	}
    
	public function getMeasureReport()
    {
        $req = \mvc::$req;
        $data = (new \model\doctor\tool())->getMeasureReport($req['bigCate'],$req['device']);
        $this->successJson($data);
	}

	
	
}