49 lines
1.0 KiB
PHP
49 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Sigtap;
|
|
|
|
use App\Models\ProntoAtendimento\Atendimento\RaatParecerMedico;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class Cid extends Model
|
|
{
|
|
protected $connection = 'sigtap';
|
|
|
|
protected $table = 'cid';
|
|
|
|
protected $casts = [
|
|
'is_ativo' => 'boolean'
|
|
];
|
|
|
|
protected $fillable = [
|
|
'codigo',
|
|
'nome',
|
|
'agravo',
|
|
'sexo',
|
|
'estado',
|
|
'campos_irradiados',
|
|
'is_ativo'
|
|
];
|
|
|
|
protected $hidden = [
|
|
'created_at',
|
|
'updated_at'
|
|
];
|
|
|
|
public function __construct() {
|
|
$this->table = DB::connection($this->connection)->getDatabaseName() . '.' . $this->table;
|
|
}
|
|
|
|
public function pareceresMedico()
|
|
{
|
|
return $this->hasMany(RaatParecerMedico::class);
|
|
}
|
|
|
|
public function procedimentos()
|
|
{
|
|
return $this->belongsToMany(Procedimento::class, 'procedimento_cid')->as('procedimentoCid')
|
|
->withPivot('principal', 'competencia_id')->withTimestamps();
|
|
}
|
|
}
|