/**
  * [resultRequestDownload description]
  * @param  [type] $req_id [description]
  * @return [type]         [description]
  */
 public function resultRequestDownload($req_id)
 {
     $download_paht = Config::get('nhc/site.download_paht');
     // /Library/WebServer/Documents/lv_nhc/sites/app/downlad/
     $data = QueryData::queryDataNHCAll($req_id);
     $req_info = RequestData::find($req_id);
     $filename = Carbon::createFromTimeStamp(strtotime($req_info['updated_at']))->format('Y_m_d');
     $path = $download_paht . $req_info['agency_code'];
     $full_path_file = $path . '/' . $req_info['agency_code'] . '_' . $filename . '.csv';
     if (!file_exists($full_path_file)) {
         system('mkdir -p ' . $path);
         //echo $path;exit; //
     }
     if (file_exists($full_path_file)) {
         //$full_path_file = $path.'/'.$req_info['agency_code'].'_'.$filename.'.csv';
         $req_info->downloaded = true;
         $req_info->save();
         return Response::download($full_path_file, $req_info['agency_code'] . '_' . $filename . '.csv', array('content-type' => 'text/csv'));
     } else {
         $file = fopen($full_path_file, 'w');
         foreach ($data as $row) {
             fputcsv($file, (array) $row);
         }
         fclose($file);
         $req_info->downloaded = true;
         $req_info->save();
         return Response::download($full_path_file, $req_info['agency_code'] . '_' . $filename . '.csv', array('content-type' => 'text/csv'));
     }
 }