update final log

This commit is contained in:
2023-12-12 14:35:12 +07:00
parent 91b7a10f86
commit e76c480ce9
59 changed files with 5524 additions and 583 deletions

View File

@@ -8,24 +8,39 @@ use Illuminate\Http\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use PHPMailer\PHPMailer\PHPMailer;
use Illuminate\Support\Facades\DB;
use App\Models\Member;
use App\Models\Service;
class Helper
{
public static function genderNormalization($anyGenderCode)
{
if ($anyGenderCode == 'M') {
return 'male';
return 'Male';
} else if ($anyGenderCode == 'F') {
return 'female';
return 'Female';
} else if ($anyGenderCode == 'O') {
return 'others';
return 'Others';
} else if ($anyGenderCode == 'U') {
return 'unknown';
return 'Unknown';
} else {
return null;
}
}
public static function maritalNormalization($code)
{
if ($code == 'M') {
return 'Married';
} else if ($code == 'D') {
return 'Divorced';
} else if ($code == 'S') {
return 'Single';
} else {
return '-';
}
}
public static function genderPerson($anyGenderCode)
{
if ($anyGenderCode == 'M') {
@@ -41,6 +56,44 @@ class Helper
}
}
public static function memberType($code){
if ($code == 'P') {
return 'Principal';
} else if ($code == 'D') {
return 'Dependent';
} else {
'-';
}
}
public static function relationWithPrincipal($code){
if ($code == 'H') {
return 'Husbund';
}
else if ($code == 'W') {
return 'Wife';
}
else if ($code == 'S') {
return 'Son';
}
else if ($code == 'D') {
return 'Daughter';
}
else {
'-';
}
}
public static function principalName($code){
$principalName = Member::where('member_id', $code)->get()->first();
return $principalName->name;
}
public static function serviceName($code){
$serviceName = Service::where('code', $code)->get()->first();
return $serviceName->name;
}
public static function paginateResources($resource)
{
return [

View File

@@ -44,6 +44,9 @@ class File extends Model
'claim-diagnosis' => 'claim/',
'claim-kondisi' => 'claim/',
'claim-invoice' => 'claim/',
'final-log-result' => 'final-log/',
'final-log-diagnosis' => 'final-log/',
'final-log-kondisi' => 'final-log/',
'docs' => 'docs/',
];
@@ -54,7 +57,7 @@ class File extends Model
public static function getDirectory($type)
{
return self::$file_directories[$type] ?? 'any';
return self::$file_directories[$type] ?? 'any/';
}
public static function getFileName($type, $id)

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class OrganizationUser extends Model
{
use HasFactory;
protected $table = 'organization_user';
protected $connection = 'mysql';
protected $fillable = [
'organization_id',
];
public function organization(){
return $this->hasOne(Organization::class, 'id', 'organization_id');
}
}

View File

@@ -24,7 +24,9 @@ class RequestLog extends Model
'payment_type',
'service_code',
'policy_id',
'final_log',
'status',
'status_final_log',
'source',
'claim_id',
'organization_id',

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class RequestLogBenefit extends Model
{
use HasFactory;
protected $table = 'request_log_benefits';
public $fillable = [
'request_log_id',
'benefit_id',
'amount_incurred',
'amount_approved',
'amount_not_approved',
'excess_paid',
'keterangan',
];
public function benefit(){
return $this->belongsTo(Benefit::class, 'benefit_id', 'id');
}
}

View File

@@ -105,4 +105,9 @@ class User extends Authenticatable
{
return $this->morphMany(NotificationToken::class, 'notifiabletoken');
}
public function getOrganization()
{
return $this->hasOne(OrganizationUser::class, 'user_id');
}
}

View File

@@ -154,12 +154,16 @@ class RequestLogService{
}
// Update Request LOG Status & Link with Claim
$requestLog->update([
'status' => $row['status']
]);
$requestLog->save();
DB::beginTransaction();
$requestLog->update([
'status' => $row['status']
]);
$requestLog->save();
DB::commit();
return $requestLog;
} catch (\Exception $e) {
DB::rollBack();
throw $e;
}
}