tambah kolom provider di final log dan request log

This commit is contained in:
2024-01-09 09:15:16 +07:00
parent b5862650cb
commit e2be94f0d0
10 changed files with 115 additions and 13 deletions

View File

@@ -8,6 +8,9 @@ use App\Models\ClaimRequest;
use App\Models\CorporateService;
use App\Models\RequestLogBenefit;
use App\Models\RequestLogMedicine;
use App\Models\Organization;
use App\Models\MemberPlan;
use App\Models\Plan;
use App\Models\Exclusion;
use App\Models\Icd;
use App\Helpers\Helper;
@@ -25,10 +28,15 @@ class RequestLogShowResource extends JsonResource
{
$requestLog = parent::toArray($request);
$corporateId = $requestLog['member']['current_plan']['corporate_id'] ?? 0;
$benefit = CorporateBenefit::with('benefit')->where('plan_id', $corporateId)->get()->toArray();
$member_id = $requestLog['member_id'];
$planMember = MemberPlan::where('member_id', $member_id)->get('plan_id');
$planId = Plan::whereIn('id', $planMember)->where('service_code', $requestLog['service_code'])->first();
$benefit = CorporateBenefit::with('benefit')->where('plan_id', $planId->id)->get()->toArray();
$benefitDetailLog = RequestLogBenefit::with('benefit')->where('request_log_id', $requestLog['id'])->get()->toArray();
$medicineDetailLog = RequestLogMedicine::where('request_log_id', $requestLog['id'])->get()->toArray();
$provider = Organization::where('id', $requestLog['organization_id'])->first();
$benefitData = [];
if (count($benefit)){
foreach($benefit as $data){
array_push($benefitData, $data['benefit']);
@@ -84,11 +92,13 @@ class RequestLogShowResource extends JsonResource
'exclusion' => $exclusions,
'medicine' => $medicineData,
'files' => $requestLog['files'],
'provider' => $provider->name,
'no_identitas' => $requestLog['no_identitas'],
'keterangan' => $requestLog['keterangan'],
'hak_kamar_pasien' => $requestLog['hak_kamar_pasien'],
'penempatan_kamar' => $requestLog['penempatan_kamar'],
'catatan' => $requestLog['catatan'],
];