[WIP] Encounter
This commit is contained in:
@@ -19,6 +19,15 @@ class ClaimDiagnosis extends Model
|
||||
'description',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'deleted_by',
|
||||
];
|
||||
|
||||
public function icd()
|
||||
{
|
||||
return $this->belongsTo(Icd::class, 'diagnosis_id', 'id');
|
||||
|
||||
31
app/Models/Encounter.php
Normal file
31
app/Models/Encounter.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Encounter extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $fillable = [
|
||||
'part_of',
|
||||
'status',
|
||||
'class',
|
||||
'type',
|
||||
'patient_id',
|
||||
'start',
|
||||
'end',
|
||||
];
|
||||
|
||||
public function participants()
|
||||
{
|
||||
return $this->hasMany(EncounterParticipant::class, 'encounter_id');
|
||||
}
|
||||
|
||||
public function diagnoses()
|
||||
{
|
||||
return $this->hasMany(EncounterDiagnosis::class, 'encounter_id');
|
||||
}
|
||||
}
|
||||
29
app/Models/EncounterDiagnosis.php
Normal file
29
app/Models/EncounterDiagnosis.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EncounterDiagnosis extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $fillable = [
|
||||
'encounter_id',
|
||||
'diagnosis_id',
|
||||
'use',
|
||||
'source',
|
||||
'description',
|
||||
];
|
||||
|
||||
public static $use_enums = [
|
||||
'working' => 'Working',
|
||||
'final' => 'Final'
|
||||
];
|
||||
|
||||
public function encounter()
|
||||
{
|
||||
return $this->belongsTo(Encounter::class, 'encounter_id');
|
||||
}
|
||||
}
|
||||
27
app/Models/EncounterParticipant.php
Normal file
27
app/Models/EncounterParticipant.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EncounterParticipant extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $fillable = [
|
||||
'encounter_id',
|
||||
'type',
|
||||
];
|
||||
|
||||
|
||||
public function encounter()
|
||||
{
|
||||
return $this->belongsTo(Encounter::class, 'encounter_id');
|
||||
}
|
||||
|
||||
public function participantable()
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,8 @@ class Practitioner extends Model
|
||||
];
|
||||
|
||||
public $appends = [
|
||||
'meta'
|
||||
'meta',
|
||||
'code'
|
||||
];
|
||||
|
||||
public function getMetaAttribute()
|
||||
@@ -27,6 +28,11 @@ class Practitioner extends Model
|
||||
return (object) $orgMeta;
|
||||
}
|
||||
|
||||
public function getCodeAttribute()
|
||||
{
|
||||
return 'DOC'.str_pad($this->id, 4, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
public function person()
|
||||
{
|
||||
return $this->belongsTo(Person::class, 'person_id');
|
||||
|
||||
Reference in New Issue
Block a user