finishing part 1
This commit is contained in:
61
app/Models/DailyMonitoring.php
Normal file
61
app/Models/DailyMonitoring.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use DB;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DailyMonitoring extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = "claim_daily_monitoring";
|
||||
|
||||
protected $fillable = [
|
||||
'claim_id',
|
||||
'subject',
|
||||
'body_temperature',
|
||||
'respiration_rate',
|
||||
'sistole',
|
||||
'diastole',
|
||||
'analysis',
|
||||
'complaints'
|
||||
];
|
||||
|
||||
protected $appends = ['medical_plan'];
|
||||
|
||||
public function getBodyTemperatureAttribute()
|
||||
{
|
||||
return round($this->attributes['body_temperature'], 0);
|
||||
}
|
||||
|
||||
public function getSistoleAttribute()
|
||||
{
|
||||
return round($this->attributes['sistole'], 0);
|
||||
}
|
||||
|
||||
public function getDiastoleAttribute()
|
||||
{
|
||||
return round($this->attributes['diastole'], 0);
|
||||
}
|
||||
|
||||
public function getRespirationRateAttribute()
|
||||
{
|
||||
return round($this->attributes['respiration_rate'], 0);
|
||||
}
|
||||
|
||||
public function getMedicalPlanAttribute()
|
||||
{
|
||||
$arr_medical_plan = [];
|
||||
$medical_plan = DB::table('medical_plan')->where('claim_daily_monitoring_id','=',$this->attributes['id'])->get();
|
||||
|
||||
foreach ($medical_plan as $row) {
|
||||
$arr_medical_plan[] = [
|
||||
'medical_plan_str' => $row->plan
|
||||
];
|
||||
}
|
||||
|
||||
return $arr_medical_plan;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user