public function stat()
 {
     $department_id = request('department_id');
     if (!$department_id) {
         $this->error('缺少部门编号');
     }
     $where = "`department_id`='{$department_id}'";
     $logList = SurveylogModel::getList($where, 0, 0);
     if ($logList) {
         $count = count($logList);
         $statData = array();
         foreach ($logList as $item) {
             for ($i = 1; $i <= 8; $i++) {
                 $index = sprintf('r_%02d', $i);
                 if (!isset($statData[$index][$item[$index]])) {
                     $statData[$index][$item[$index]] = 0;
                 }
                 $statData[$index][$item[$index]]++;
             }
         }
         $data['department_id'] = $department_id;
         $data['data']['count'] = $count;
         $data['data']['detail'] = $statData;
         $data['stattime'] = time();
         if (SurveystatModel::add($data)) {
             $this->success($this->reffer());
         } else {
             $this->error();
         }
     } else {
         $this->error('没有找到数据');
     }
 }
 public function export()
 {
     if (isset($_REQUEST['department_id']) && $_REQUEST['department_id']) {
         $department_id = request('department_id');
         $where = "`department_id`='{$department_id}'";
         $logList = SurveylogModel::getList($where, 0, 0);
         $this->assign('logList', $logList);
         $this->display();
     } else {
         $this->display('surveylog_export_check');
     }
 }