[WIP] Claims
This commit is contained in:
@@ -5,6 +5,7 @@ namespace Modules\Internal\Http\Controllers\Api;
|
||||
use App\Exceptions\ImportRowException;
|
||||
use App\Imports\PlansImport;
|
||||
use App\Models\Benefit;
|
||||
use App\Models\Claim;
|
||||
use App\Models\Corporate;
|
||||
use App\Models\Plan;
|
||||
use App\Services\ImportService;
|
||||
@@ -34,6 +35,7 @@ class CorporateController extends Controller
|
||||
->withCount([
|
||||
'employees',
|
||||
'corporateBenefits',
|
||||
// 'claims'
|
||||
])
|
||||
->where('type', 'corporate')
|
||||
->paginate(10);
|
||||
|
||||
47
app/Http/Controllers/Api/OLDLMS/ClaimController.php
Normal file
47
app/Http/Controllers/Api/OLDLMS/ClaimController.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\OLDLMS;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Icd;
|
||||
use App\Models\Member;
|
||||
use App\Services\ClaimService;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ClaimController extends Controller
|
||||
{
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'member_id' => 'required',
|
||||
'user_id' => 'required',
|
||||
'type' => 'required|in:consultation-gp,consultation-specialist,medicine',
|
||||
'total_claim' => 'required',
|
||||
'detail' => 'required',
|
||||
]);
|
||||
|
||||
if ($request->type == 'consultation-gp') {
|
||||
$benefitCode = 'OPCONS1';
|
||||
}
|
||||
if ($request->type == 'consultation-specialist') {
|
||||
$benefitCode = 'OPCONS2';
|
||||
}
|
||||
if ($request->type == 'medicine') {
|
||||
$benefitCode = 'OPMEDI1';
|
||||
}
|
||||
|
||||
$member = Member::query()
|
||||
->where('member_id', $request->member_id)
|
||||
->with([
|
||||
'currentPlan',
|
||||
])
|
||||
->firstOrFail();
|
||||
$benefit = $member->currentPlan->benefits()->where('benefit_code', $benefitCode)->first();
|
||||
// $diagnosis = Icd::first();
|
||||
|
||||
$claim = ClaimService::storeClaim($member, null, $request->total_claim, $benefit, 'approved');
|
||||
|
||||
return Helper::responseJson($claim);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
namespace App\Http\Controllers\Api\OLDLMS;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Http\Controllers\Controller;
|
||||
@@ -94,6 +94,11 @@ class Corporate extends Model
|
||||
return $this->hasManyThrough(CorporateService::class, Service::class, 'corporate_id', 'service_code', 'id', 'service_code');
|
||||
}
|
||||
|
||||
// public function claims()
|
||||
// {
|
||||
// return $this->hasManyThrough()
|
||||
// }
|
||||
|
||||
public function corporateServices()
|
||||
{
|
||||
return $this->hasMany(CorporateService::class, 'corporate_id');
|
||||
|
||||
25
app/Models/OLDLMS/Appointment.php
Normal file
25
app/Models/OLDLMS/Appointment.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\OLDLMS;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Appointment extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
const CREATED_AT = 'dCreateOn';
|
||||
const UPDATED_AT = 'dUpdateOn';
|
||||
const DELETED_AT = 'dDeleteOn';
|
||||
|
||||
protected $connection = 'oldlms';
|
||||
|
||||
protected $table = 'tx_appointment';
|
||||
|
||||
public function detail()
|
||||
{
|
||||
return $this->hasOne(AppointmentDetail::class, '');
|
||||
}
|
||||
}
|
||||
11
app/Models/OLDLMS/AppointmentDetail.php
Normal file
11
app/Models/OLDLMS/AppointmentDetail.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\OLDLMS;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AppointmentDetail extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
11
app/Models/OLDLMS/Healthcare.php
Normal file
11
app/Models/OLDLMS/Healthcare.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\OLDLMS;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Healthcare extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
11
app/Models/OLDLMS/Insurance.php
Normal file
11
app/Models/OLDLMS/Insurance.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\OLDLMS;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Insurance extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
11
app/Models/OLDLMS/User.php
Normal file
11
app/Models/OLDLMS/User.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\OLDLMS;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
11
app/Models/OLDLMS/UserDetail.php
Normal file
11
app/Models/OLDLMS/UserDetail.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\OLDLMS;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UserDetail extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
11
app/Models/OLDLMS/UserInsurance.php
Normal file
11
app/Models/OLDLMS/UserInsurance.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\OLDLMS;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UserInsurance extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
11
app/Models/OLDLMS/UserInsuranceDetail.php
Normal file
11
app/Models/OLDLMS/UserInsuranceDetail.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\OLDLMS;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UserInsuranceDetail extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
@@ -6,6 +6,7 @@ use App\Models\Claim;
|
||||
use App\Models\Icd;
|
||||
use App\Models\Member;
|
||||
use Carbon\Carbon;
|
||||
use DB;
|
||||
use Str;
|
||||
|
||||
class ClaimService{
|
||||
@@ -162,7 +163,7 @@ class ClaimService{
|
||||
|
||||
$claimData = [
|
||||
'member_id' => $member->id,
|
||||
'diagnosis_id' => $diagnosis->id,
|
||||
'diagnosis_id' => $diagnosis->id ?? null,
|
||||
'total_claim' => $totalClaim,
|
||||
'currency' => 'IDR',
|
||||
'plan_id' => $member->currentPlan->id,
|
||||
|
||||
@@ -63,6 +63,26 @@ return [
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'oldlms' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('OLDLMS_DATABASE_URL'),
|
||||
'host' => env('OLDLMS_DB_HOST', '127.0.0.1'),
|
||||
'port' => env('OLDLMS_DB_PORT', '3306'),
|
||||
'database' => env('OLDLMS_DB_DATABASE', 'forge'),
|
||||
'username' => env('OLDLMS_DB_USERNAME', 'forge'),
|
||||
'password' => env('OLDLMS_DB_PASSWORD', ''),
|
||||
'unix_socket' => env('OLDLMS_DB_SOCKET', ''),
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_unicode_ci',
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'url' => env('DATABASE_URL'),
|
||||
|
||||
@@ -17,11 +17,11 @@ return new class extends Migration
|
||||
$table->id();
|
||||
$table->string('code')->index();
|
||||
$table->foreignId('member_id')->index();
|
||||
$table->foreignId('diagnosis_id')->index();
|
||||
$table->string('total_claim');
|
||||
$table->foreignId('diagnosis_id')->index()->nullable();
|
||||
$table->string('total_claim')->nullable();
|
||||
$table->string('currency');
|
||||
$table->foreignId('plan_id')->index();
|
||||
$table->foreignId('benefit_id')->index();
|
||||
$table->foreignId('plan_id')->index()->nullable();
|
||||
$table->foreignId('benefit_id')->index()->nullable();
|
||||
|
||||
$table->string('status');
|
||||
|
||||
@@ -31,6 +31,9 @@ return new class extends Migration
|
||||
$table->dateTime('received_at')->nullable();
|
||||
$table->unsignedBigInteger('received_by')->nullable()->index();
|
||||
|
||||
$table->dateTime('approved_at')->nullable();
|
||||
$table->unsignedBigInteger('approved_by')->nullable()->index();
|
||||
|
||||
$table->dateTime('declined')->nullable();
|
||||
$table->unsignedBigInteger('declined_by')->nullable()->index();
|
||||
|
||||
|
||||
@@ -414,7 +414,7 @@ export default function ClaimForm({ isEdit, currentClaim }: Props) {
|
||||
}}
|
||||
>
|
||||
{/* Not Eligible */}
|
||||
<Typography sx={{ typography: 'caption', display: 'flex', alignItems: 'center' }}>
|
||||
{/* <Typography sx={{ typography: 'caption', display: 'flex', alignItems: 'center' }}>
|
||||
<Iconify
|
||||
icon="bxs:lock-alt"
|
||||
width={12}
|
||||
@@ -427,7 +427,7 @@ export default function ClaimForm({ isEdit, currentClaim }: Props) {
|
||||
</Typography>
|
||||
<Typography sx={{ typography: 'caption', color: '#637381' }}>
|
||||
125.000.000 / 125.000.000
|
||||
</Typography>
|
||||
</Typography> */}
|
||||
</Stack>
|
||||
)}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\Api\AuthController;
|
||||
use App\Http\Controllers\Api\MembershipController;
|
||||
use App\Http\Controllers\Api\OLDLMS\ClaimController;
|
||||
use App\Http\Controllers\Api\OLDLMS\MembershipController;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
@@ -19,4 +20,6 @@ use Illuminate\Support\Facades\Route;
|
||||
Route::middleware('linksehat.old.auth')->group(function() {
|
||||
Route::post('check-membership', [MembershipController::class, 'check']);
|
||||
Route::post('check-limit', [MembershipController::class, 'checkLimit']);
|
||||
|
||||
Route::post('claim-create', [ClaimController::class, 'store']);
|
||||
});
|
||||
Reference in New Issue
Block a user