[WIP] Change Check Coverage Appointment
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Helpers\Helper;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Icd;
|
||||
use App\Models\Member;
|
||||
use App\Models\Speciality;
|
||||
use App\Services\ClaimService;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -16,19 +17,23 @@ class ClaimController extends Controller
|
||||
$request->validate([
|
||||
'member_id' => 'required',
|
||||
'user_id' => 'required',
|
||||
'type' => 'required|in:consultation-gp,consultation-specialist,medicine',
|
||||
'type' => 'required|in:consultation,teleconsultation,medicine',
|
||||
'speciality_code' => 'required',
|
||||
'total_claim' => 'required',
|
||||
'detail' => 'required',
|
||||
]);
|
||||
|
||||
$currentSpeciality = Speciality::where('code', $request->speciality_code)->first();
|
||||
|
||||
if ($request->type == 'consultation-gp') {
|
||||
$benefitCode = 'OPCONS1';
|
||||
}
|
||||
if ($request->type == 'consultation-specialist') {
|
||||
$benefitCode = 'OPCONS2';
|
||||
}
|
||||
$gpSpecialityName = config('aso.general_practitioner_speciality_name', 'Umum');
|
||||
$isGp = $gpSpecialityName == ($currentSpeciality ? $currentSpeciality->name : false);
|
||||
|
||||
if ($request->type == 'medicine') {
|
||||
$benefitCode = 'OPMEDI1';
|
||||
} else if ($isGp) {
|
||||
$benefitCode = 'OPCONS1';
|
||||
} else {
|
||||
$benefitCode = 'OPCONS2';
|
||||
}
|
||||
|
||||
$member = Member::query()
|
||||
@@ -38,8 +43,7 @@ class ClaimController extends Controller
|
||||
])
|
||||
->firstOrFail();
|
||||
$benefit = $member->currentPlan->benefits()->where('code', $benefitCode)->first();
|
||||
// $diagnosis = Icd::first();
|
||||
|
||||
|
||||
$claim = ClaimService::storeClaim($member, null, $request->total_claim, $benefit, 'requested');
|
||||
$claim->status = 'approved';
|
||||
$claim->save();
|
||||
|
||||
Reference in New Issue
Block a user