Exemple #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $ponteiro = fopen("public/cid.txt", "r");
     while (!feof($ponteiro)) {
         $linha = fgets($ponteiro, 4096);
         $d = explode(';;', $linha);
         if (!empty($d[0])) {
             $cid = new FarmaciaCid();
             $cid->cod_cid = $d[0];
             $cid->descricao = substr(utf8_encode($d[1]), 0, 255);
             $cid->save();
         }
     }
     fclose($ponteiro);
 }
Exemple #2
0
 public function getCidDescricaoAttribute()
 {
     if (empty($this->attributes['cid']) or $this->attributes['cid'] == 0) {
         return 'CID nao encontrado!';
     } else {
         $cid = FarmaciaCid::where('cod_cid', '=', $this->attributes['cid'])->first();
         return $cid->descricao;
     }
 }
Exemple #3
0
/**
 *
 *	Ordem Interna
 *
 **/
Route::group(['before' => 'auth'], function () {
    Route::get('/setors/find/{id}/postoTrabalho', function ($setor_id) {
        $setor = Setor::find($setor_id);
        return Response::json($setor->postoTrabalhos);
    });
    Route::get('/setors/find/{id}/funcao', function ($setor_id) {
        $setor = Setor::find($setor_id);
        return Response::json($setor->funcaos);
    });
    Route::get('/farmacia/{cod}/cid', function ($cod) {
        $cid = FarmaciaCid::where('cod_cid', '=', $cod)->get();
        if ($cid->count() == 0) {
            return 0;
        } else {
            return $cid;
        }
    });
    Route::get('/fichas/find/{rg}/rg', function ($rg) {
        $ficha = Ficha::where('rg', $rg)->where('situacao', '<>', 0)->get();
        if (count($ficha)) {
            return $ficha;
        }
    });
    Route::get('/colaboradors/find/{matricula}', function ($matricula) {
        $colaborador = Colaborador::where('codigo_interno', $matricula)->first();
        if (!empty($colaborador)) {