feat: initialize Dr-Panel project with patient file number support
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Casts\JalaliDatetime;
|
||||
use App\Traits\HasUserStamps;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
class Patient extends Model
|
||||
{
|
||||
use HasUserStamps;
|
||||
protected $fillable = [
|
||||
'icno',
|
||||
'first_name',
|
||||
'last_name',
|
||||
'father_name',
|
||||
'gender',
|
||||
'birth_date',
|
||||
'age',
|
||||
'marital_status',
|
||||
'education',
|
||||
'job',
|
||||
'hand_phone',
|
||||
'home_phone',
|
||||
'work_phone',
|
||||
'other_phone',
|
||||
'home_address',
|
||||
'work_address',
|
||||
'refered_by',
|
||||
'referal_reason',
|
||||
'doc_id',
|
||||
'insurance',
|
||||
'insurance_no',
|
||||
'blood_pressure',
|
||||
'blood_sugar',
|
||||
'current_illness_1',
|
||||
'current_illness_2',
|
||||
'is_undercare',
|
||||
'undercare_reason',
|
||||
'is_usingdrug',
|
||||
'underdrug_reason',
|
||||
'has_alergyto',
|
||||
'alergy_reason',
|
||||
'description',
|
||||
'surgery_before',
|
||||
'sergery_after',
|
||||
'photos_before',
|
||||
'photos_after',
|
||||
'videos',
|
||||
'audio_files',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'blood_pressure' => 'integer',
|
||||
'blood_sugar' => 'integer',
|
||||
'age' => 'integer',
|
||||
'current_illness_1' => 'array',
|
||||
'current_illness_2' => 'array',
|
||||
'has_alergyto' => 'array',
|
||||
'photos_before' => 'array',
|
||||
'photos_after' => 'array',
|
||||
'videos' => 'array',
|
||||
'audio_files' => 'array',
|
||||
'created_at' => JalaliDatetime::class,
|
||||
'updated_at' => JalaliDatetime::class,
|
||||
];
|
||||
}
|
||||
|
||||
public function getFullNameAttribute(): string
|
||||
{
|
||||
return trim($this->first_name . ' ' . $this->last_name);
|
||||
}
|
||||
|
||||
public function creator(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
}
|
||||
|
||||
public function updator(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'updated_by');
|
||||
}
|
||||
|
||||
public function surgeryAppointment(): HasOne
|
||||
{
|
||||
return $this->hasOne(SurgeryAppointment::class);
|
||||
}
|
||||
|
||||
public function prescriptions(): HasMany
|
||||
{
|
||||
return $this->hasMany(Prescription::class, 'patient');
|
||||
}
|
||||
|
||||
public function visits(): HasMany
|
||||
{
|
||||
return $this->hasMany(Visit::class, 'patient');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user