12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- class ClientPrimaryCoverage extends Model
- {
- protected $table = 'client_primary_coverage';
- public function getStatus() {
- $status = 'NO';
- // if medicare, check is_partbprimary
- if($this->plan_type === 'MEDICARE') {
- $status = $this->is_partbprimary;
- }
- else {
- if(!$this->is_manually_determined) {
- // AUTO determination of non-medicare not yet supported
- $status = 'NO';
- }
- else {
- switch($this->manual_determination_category) {
- case 'COVERED':
- $status = 'YES';
- break;
- case 'NOT_COVERED':
- case 'INVALID':
- $status = 'NO';
- break;
- default:
- $status = $this->manual_determination_category;
- break;
- }
- }
- }
- return $status;
- }
- public function toString() {
- $parts = [];
- $parts[] = $this->plan_type;
- if($this->plan_type === 'MEDICARE') {
- if($this->is_partbprimary === 'YES') {
- $parts[] = 'Part B';
- }
- }
- else {
- if(@$this->plan_name) $parts[] = ' / ' . $this->plan_name;
- if(@$this->plan_identifier) $parts[] = ' / ' . $this->plan_identifier;
- }
- return implode(" ", $parts);
- }
- }
|