nanosanteservice/app/Models/NhHealthCareSheet.php

110 lines
2.8 KiB
PHP

<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class NhHealthCareSheet
*
* @property int $id
* @property string $health_care_sheet_id
* @property int $insurance_id
* @property int $beneficiary_id
* @property int $network_agent_id
* @property string $patient_lastname
* @property string|null $patient_firstname
* @property string $patient_situation
* @property string $practitioner_lastname
* @property string|null $practitioner_firstname
* @property string|null $practitioner_provider_class_id
* @property string $care_condition
* @property Carbon|null $accident_date
* @property Carbon|null $pregnancy_start_at
* @property Carbon|null $pregnancy_end_at
* @property string $type
* @property string $state
* @property int $prescription_sheet_id
* @property int $invoice_id
* @property Carbon $created_at
* @property Carbon $updated_at
*
* @package App\Models
*/
class NhHealthCareSheet extends Model
{
protected $table = 'nh_health_care_sheets';
protected $casts = [
'insurance_id' => 'int',
'beneficiary_id' => 'int',
'network_agent_id' => 'int',
'prescription_sheet_id' => 'int'
];
protected $dates = [
'accident_date',
'pregnancy_start_at',
'pregnancy_end_at'
];
protected $fillable = [
'health_care_sheet_id',
'insurance_id',
'beneficiary_id',
'network_agent_id',
'patient_lastname',
'patient_firstname',
'patient_situation',
'practitioner_lastname',
'practitioner_firstname',
'practitioner_provider_class_id',
'care_condition',
'accident_date',
'pregnancy_start_at',
'pregnancy_end_at',
'type',
'state',
'prescription_sheet_id',
'invoice_id'
];
public function institution()
{
return $this->belongsTo(AgentPlus::class, 'network_agent_id', 'network_agent_id');
}
public function insurance()
{
return $this->belongsTo(NhInsurance::class, 'insurance_id');
}
public function beneficiary()
{
return $this->belongsTo(NhHavingRight::class, 'beneficiary_id');
}
public function performances()
{
return $this->hasManyThrough(NhPerformance::class, NhHealthCareSheetsPerformance::class,
'sheet_id', 'id', 'id', 'performance_id');
}
public function exams()
{
return $this->hasManyThrough(NhExam::class, NhHealthCareSheetsExam::class,
'sheet_id', 'id', 'id', 'exam_id');
}
public function prescriptions()
{
return $this->hasManyThrough(NhMedicalPrescription::class, NhHealthCareSheetsPrescription::class,
'sheet_id', 'id', 'id', 'prescription_id');
}
}