Compare commits
98 Commits
feature/lm
...
feature/cl
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ee9293daf | |||
| 89cd2a9d37 | |||
| ce0fde18dc | |||
| acf9fa348e | |||
| 74dd65efde | |||
| edc5ba9822 | |||
| 8902718523 | |||
| 1c4f03ea83 | |||
| 627904abba | |||
| bd3f53b596 | |||
| 69919878fa | |||
| f3bdf12bc4 | |||
| eb1211cde7 | |||
|
|
b8ed27f2ff | ||
| 74cfcfa16b | |||
| 9f95e89a9a | |||
| e51068b0a6 | |||
| 5cd23ff343 | |||
| 615330bb46 | |||
| bcf6662db6 | |||
| be43f8a4a4 | |||
| dba421ad0b | |||
| c3a78f8a40 | |||
| 6c6a7c3919 | |||
| 5c71b556a0 | |||
| 63c53d18d1 | |||
| a5db01bd25 | |||
| 5d4033a9ca | |||
| 912edcdae7 | |||
| 5a7695b404 | |||
| 5f05f191c6 | |||
| 46af57b17c | |||
| 016bd3f605 | |||
| 093f8160d2 | |||
| d8f493103c | |||
| 7f77deb09e | |||
| d38bc8dbfc | |||
| b225084991 | |||
| d8a98f4648 | |||
| 27523b8cce | |||
| f6117743ad | |||
| 8c97df9fc4 | |||
| 4f2bb19d8a | |||
| 13764a3766 | |||
| ed273fdafa | |||
| d706bf0623 | |||
| 13542cd3c0 | |||
|
|
f309f4039c | ||
|
|
387658a992 | ||
| 6491f4d3e3 | |||
| 5028b2d82b | |||
| 5d56434aa2 | |||
| 8e05280b7d | |||
| e3de0a3c04 | |||
| c3a425c93d | |||
| 431070efc3 | |||
| e8c3decf85 | |||
| 99c488baf3 | |||
| 0b50e4c980 | |||
| ba310a21c1 | |||
| 5a0136acf8 | |||
| 75c9781a22 | |||
| 2a1f0c854a | |||
| f0c787fede | |||
|
|
a7e688a52c | ||
| 8d5f4bb0bd | |||
| 248047006e | |||
| 2c535b4021 | |||
| 59dd63a78f | |||
| 21282be7b3 | |||
|
|
8cbfb1929b | ||
| b8152e6b3f | |||
| cfbe108629 | |||
| a8821dfb3c | |||
|
|
1ce2655b65 | ||
|
|
335e24b17c | ||
|
|
4776eb5b0a | ||
| 17daf20167 | |||
| 18ace75fc7 | |||
| ad743de98d | |||
| 96a40842bd | |||
| 137fd07a28 | |||
| 21dc0b1fc1 | |||
| f56361de62 | |||
| 85f319878a | |||
| 23436164c2 | |||
| b19e0876e5 | |||
| 704c5ecc44 | |||
| 9087580138 | |||
| 7ff199a3c1 | |||
| 08a2502fb1 | |||
| 65c9153fee | |||
| 775f471a07 | |||
| f09eaef5ad | |||
| e116fb814a | |||
| 2f10f913c0 | |||
| 3a2dd84500 | |||
| 7d1872ef1e |
@@ -15,6 +15,13 @@ DB_DATABASE=laravel
|
|||||||
DB_USERNAME=root
|
DB_USERNAME=root
|
||||||
DB_PASSWORD=
|
DB_PASSWORD=
|
||||||
|
|
||||||
|
OLDLMS_DB_CONNECTION=mysql
|
||||||
|
OLDLMS_DB_HOST=127.0.0.1
|
||||||
|
OLDLMS_DB_PORT=3306
|
||||||
|
OLDLMS_DB_DATABASE=linksehat
|
||||||
|
OLDLMS_DB_USERNAME=mysql
|
||||||
|
OLDLMS_DB_PASSWORD=password
|
||||||
|
|
||||||
BROADCAST_DRIVER=log
|
BROADCAST_DRIVER=log
|
||||||
CACHE_DRIVER=file
|
CACHE_DRIVER=file
|
||||||
FILESYSTEM_DISK=local
|
FILESYSTEM_DISK=local
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -12,3 +12,6 @@ npm-debug.log
|
|||||||
yarn-error.log
|
yarn-error.log
|
||||||
/.idea
|
/.idea
|
||||||
/.vscode
|
/.vscode
|
||||||
|
|
||||||
|
/public/dashboard
|
||||||
|
/public/dashboard-staging
|
||||||
|
|||||||
@@ -35,13 +35,13 @@ class AuthController extends Controller
|
|||||||
if (filter_var($request->phoneOrEmail, FILTER_VALIDATE_EMAIL)) {
|
if (filter_var($request->phoneOrEmail, FILTER_VALIDATE_EMAIL)) {
|
||||||
User::query()->find($user->id)->update([
|
User::query()->find($user->id)->update([
|
||||||
'email' => $request->phoneOrEmail,
|
'email' => $request->phoneOrEmail,
|
||||||
'otp' => rand(1000, 9999),
|
'otp' => 4444, //rand(1000, 9999),
|
||||||
'otp_created_at' => now()
|
'otp_created_at' => now()
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
User::query()->find($user->id)->update([
|
User::query()->find($user->id)->update([
|
||||||
'phone' => $request->phoneOrEmail,
|
'phone' => $request->phoneOrEmail,
|
||||||
'otp' => rand(1000, 9999),
|
'otp' => 4444,//rand(1000, 9999),
|
||||||
'otp_created_at' => now()
|
'otp_created_at' => now()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class DashboardResources extends JsonResource
|
|||||||
'myLimit' => [
|
'myLimit' => [
|
||||||
'balance' => $myLimitBalance,
|
'balance' => $myLimitBalance,
|
||||||
'total' => $myLimitTotal,
|
'total' => $myLimitTotal,
|
||||||
'percentage' => ($myLimitBalance / $myLimitTotal) * 100,
|
'percentage' => $myLimitTotal ? (($myLimitBalance / $myLimitTotal) * 100) : 0,
|
||||||
],
|
],
|
||||||
'lockLimit' => [
|
'lockLimit' => [
|
||||||
'balance' => $lockBalance,
|
'balance' => $lockBalance,
|
||||||
|
|||||||
0
Modules/HospitalPortal/Config/.gitkeep
Normal file
0
Modules/HospitalPortal/Config/.gitkeep
Normal file
5
Modules/HospitalPortal/Config/config.php
Normal file
5
Modules/HospitalPortal/Config/config.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => 'HospitalPortal'
|
||||||
|
];
|
||||||
0
Modules/HospitalPortal/Console/.gitkeep
Normal file
0
Modules/HospitalPortal/Console/.gitkeep
Normal file
0
Modules/HospitalPortal/Database/Migrations/.gitkeep
Normal file
0
Modules/HospitalPortal/Database/Migrations/.gitkeep
Normal file
0
Modules/HospitalPortal/Database/Seeders/.gitkeep
Normal file
0
Modules/HospitalPortal/Database/Seeders/.gitkeep
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HospitalPortal\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class HospitalPortalDatabaseSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
Model::unguard();
|
||||||
|
|
||||||
|
// $this->call("OthersTableSeeder");
|
||||||
|
}
|
||||||
|
}
|
||||||
0
Modules/HospitalPortal/Database/factories/.gitkeep
Normal file
0
Modules/HospitalPortal/Database/factories/.gitkeep
Normal file
0
Modules/HospitalPortal/Entities/.gitkeep
Normal file
0
Modules/HospitalPortal/Entities/.gitkeep
Normal file
0
Modules/HospitalPortal/Http/Controllers/.gitkeep
Normal file
0
Modules/HospitalPortal/Http/Controllers/.gitkeep
Normal file
128
Modules/HospitalPortal/Http/Controllers/Api/AuthController.php
Executable file
128
Modules/HospitalPortal/Http/Controllers/Api/AuthController.php
Executable file
@@ -0,0 +1,128 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HospitalPortal\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use Crypt;
|
||||||
|
use Error;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use Modules\Internal\Emails\SendVerifyEmail;
|
||||||
|
use Modules\Internal\Events\ForgetPassword;
|
||||||
|
|
||||||
|
class AuthController extends Controller
|
||||||
|
{
|
||||||
|
public function login(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'email' => 'required|email',
|
||||||
|
'password' => 'required'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = User::query()
|
||||||
|
->where('email', $request->email)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
return response(['message' => 'User Tidak Ditemukan'], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Hash::check($request->password, $user->password)) {
|
||||||
|
return response(['message' => 'Password Salah'], 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response([
|
||||||
|
'message' => 'Selamat Datang',
|
||||||
|
'user' => $user,
|
||||||
|
'token' => $user->createToken('app')->plainTextToken
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function logout(Request $request)
|
||||||
|
{
|
||||||
|
$token = $request->bearerToken();
|
||||||
|
Auth::user()->tokens()->where('id', $token)->delete();
|
||||||
|
|
||||||
|
return response(['message' => 'Berhasil Logout.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resetPassword(Request $request)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'old_password' => 'required',
|
||||||
|
'new_password' => 'required',
|
||||||
|
'confirm_new_password' => 'required'
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (!Hash::check($request['old_password'], $user->password)) {
|
||||||
|
return response(['message' => 'Password Salah'], 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request["new_password"] != $request["confirm_new_password"]) {
|
||||||
|
return response([
|
||||||
|
'message' => "Password Tidak Sama"
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->update([
|
||||||
|
'password' => Hash::make($request->confirm_new_password),
|
||||||
|
]);
|
||||||
|
return response()->json($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function verifyEmail(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'email' => 'required|email',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = User::query()
|
||||||
|
->where('email', $request->email)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
return response(['message' => 'User Tidak Ditemukan'], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
Event(new ForgetPassword($user));
|
||||||
|
|
||||||
|
// Mail::to($user->email)->send(new SendVerifyEmail($user));
|
||||||
|
|
||||||
|
return response()->json($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function forgetPassword(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'new_password' => 'required',
|
||||||
|
'confirm_new_password' => 'required'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$token = Crypt::decryptString($request->token);
|
||||||
|
$email = explode('|', $token)[0];
|
||||||
|
|
||||||
|
$user = User::query()
|
||||||
|
->where('email', $email)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
return response(['message' => 'User Tidak Ditemukan'], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request["new_password"] != $request["confirm_new_password"]) {
|
||||||
|
return response([
|
||||||
|
'message' => "Password Tidak Sama"
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->update([
|
||||||
|
'password' => Hash::make($request->confirm_new_password),
|
||||||
|
]);
|
||||||
|
return response()->json($user);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,192 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HospitalPortal\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Events\ClaimRequested;
|
||||||
|
use App\Helpers\Helper;
|
||||||
|
use App\Models\ClaimRequest;
|
||||||
|
use App\Models\File;
|
||||||
|
use App\Models\Member;
|
||||||
|
use App\Services\ClaimRequestService;
|
||||||
|
use App\Services\ClaimService;
|
||||||
|
use Exception;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Routing\Controller;
|
||||||
|
use Modules\HospitalPortal\Transformers\ClaimRequestResource;
|
||||||
|
use Modules\HospitalPortal\Transformers\ClaimRequestShowResource;
|
||||||
|
use PDF;
|
||||||
|
|
||||||
|
class ClaimRequestController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function index(request $request)
|
||||||
|
{
|
||||||
|
$claimRequests = ClaimRequest::query()
|
||||||
|
->when($request->search, function ($q, $search) {
|
||||||
|
$q->where('code', 'LIKE', "%".$search."%");
|
||||||
|
})
|
||||||
|
->when($request->orderBy, function ($q, $orderBy) use ($request) {
|
||||||
|
if (in_array($orderBy, ['submission_date', 'code'])) {
|
||||||
|
$q->orderBy($orderBy, $request->order);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->when($request->status, function($q, $status) {
|
||||||
|
$q->where('status', $status);
|
||||||
|
})
|
||||||
|
->with(['member'])
|
||||||
|
->orderBy('created_at', 'DESC')
|
||||||
|
->paginate();
|
||||||
|
|
||||||
|
return Helper::responseJson($claimRequests);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('hospitalportal::create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'member_id' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$member = Member::find($request->member_id);
|
||||||
|
$newClaimRequest = ClaimRequestService::storeClaimRequest(member: $member);
|
||||||
|
|
||||||
|
ClaimRequested::dispatch($newClaimRequest);
|
||||||
|
|
||||||
|
// Log History
|
||||||
|
$newClaimRequest->histories()->create([
|
||||||
|
'title' => 'New Claim Requested',
|
||||||
|
'description' => "Claim Requested for Member : {$member->member_id} - ({$member->full_name})",
|
||||||
|
'type' => 'info',
|
||||||
|
'system_origin' => 'hospital-portal'
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($request->hasFile('result_files')) {
|
||||||
|
foreach ($request->result_files as $file) {
|
||||||
|
$pathFile = File::storeFile('claim-result', $newClaimRequest->id, $file);
|
||||||
|
$newClaimRequest->files()->updateOrCreate([
|
||||||
|
'type' => 'claim-result',
|
||||||
|
'name' => File::getFileName('claim-result', $newClaimRequest->id, $file),
|
||||||
|
'original_name' => $file->getClientOriginalName(),
|
||||||
|
'extension' => $file->getClientOriginalExtension(),
|
||||||
|
'path' => $pathFile,
|
||||||
|
'created_by' => auth()->user()->id,
|
||||||
|
'updated_by' => auth()->user()->id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->hasFile('diagnosa_files')) {
|
||||||
|
foreach ($request->diagnosa_files as $file) {
|
||||||
|
$pathFile = File::storeFile('claim-diagnosis', $newClaimRequest->id, $file);
|
||||||
|
$newClaimRequest->files()->updateOrCreate([
|
||||||
|
'type' => 'claim-diagnosis',
|
||||||
|
'name' => File::getFileName('claim-diagnosis', $newClaimRequest->id, $file),
|
||||||
|
'original_name' => $file->getClientOriginalName(),
|
||||||
|
'extension' => $file->getClientOriginalExtension(),
|
||||||
|
'path' => $pathFile,
|
||||||
|
'created_by' => auth()->user()->id,
|
||||||
|
'updated_by' => auth()->user()->id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->hasFile('result_files')) {
|
||||||
|
foreach ($request->result_files as $file) {
|
||||||
|
$pathFile = File::storeFile('claim-kondisi', $newClaimRequest->id, $file);
|
||||||
|
$newClaimRequest->files()->updateOrCreate([
|
||||||
|
'type' => 'claim-kondisi',
|
||||||
|
'name' => File::getFileName('claim-kondisi', $newClaimRequest->id, $file),
|
||||||
|
'original_name' => $file->getClientOriginalName(),
|
||||||
|
'extension' => $file->getClientOriginalExtension(),
|
||||||
|
'path' => $pathFile,
|
||||||
|
'created_by' => auth()->user()->id,
|
||||||
|
'updated_by' => auth()->user()->id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Helper::responseJson(data: $request->toArray(), message: 'Claim Request berhasil ajukan!');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$claimRequest = ClaimRequest::findOrFail($id);
|
||||||
|
$claimRequest->load([
|
||||||
|
'histories' => function ($history) {
|
||||||
|
$history->latest();
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
return Helper::responseJson(data: ClaimRequestShowResource::make($claimRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
return view('hospitalportal::edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generateLog($claim_request_id)
|
||||||
|
{
|
||||||
|
$claimRequest = ClaimRequest::findOrFail($claim_request_id);
|
||||||
|
|
||||||
|
if ($claimRequest->status != 'approved') {
|
||||||
|
throw new Exception("Belum Teverifikasi", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$member = Member::findOrFail($claimRequest->member_id)
|
||||||
|
->load(['currentPlan', 'currentPolicy', 'currentPlan.corporateBenefits', 'currentPlan.corporateBenefits.benefit']);
|
||||||
|
|
||||||
|
$pdf = PDF::loadView('pdf.guaranted_leter', compact('member', 'claimRequest'));
|
||||||
|
return $pdf->download('Guaranted Letter - '.$member->full_name.'.pdf');
|
||||||
|
|
||||||
|
return $claimRequest;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HospitalPortal\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Helpers\Helper;
|
||||||
|
use App\Models\Member;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Routing\Controller;
|
||||||
|
|
||||||
|
class MemberController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function search(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'no_polis' => 'required',
|
||||||
|
'birth_date' => 'required'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$member = Member::query()
|
||||||
|
->where('member_id', $request->no_polis)
|
||||||
|
->where('birth_date', $request->birth_date)
|
||||||
|
->with(['person', 'currentCorporate',
|
||||||
|
// 'currentCorporate.corporateServices' => function ($corporateService) {
|
||||||
|
// $corporateService->where('status', 'active');
|
||||||
|
// },
|
||||||
|
// 'currentCorporate.corporateServices.service'
|
||||||
|
// 'currentPlan.benefits',
|
||||||
|
// 'currentPlan.corporateBenefit.plan',
|
||||||
|
'currentPlan.corporateBenefits.benefit'
|
||||||
|
])
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
|
|
||||||
|
return Helper::responseJson($member);
|
||||||
|
}
|
||||||
|
}
|
||||||
83
Modules/HospitalPortal/Http/Controllers/ClaimController.php
Normal file
83
Modules/HospitalPortal/Http/Controllers/ClaimController.php
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HospitalPortal\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Helpers\Helper;
|
||||||
|
use App\Models\Claim;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Routing\Controller;
|
||||||
|
|
||||||
|
class ClaimController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$claims = Claim::where('deleted_at', 'ASD')->paginate(5);
|
||||||
|
|
||||||
|
return Helper::responseJson($claims);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('hospitalportal::create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
return view('hospitalportal::show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
return view('hospitalportal::edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HospitalPortal\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Routing\Controller;
|
||||||
|
|
||||||
|
class HospitalPortalController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('hospitalportal::index');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('hospitalportal::create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
return view('hospitalportal::show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
return view('hospitalportal::edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
0
Modules/HospitalPortal/Http/Middleware/.gitkeep
Normal file
0
Modules/HospitalPortal/Http/Middleware/.gitkeep
Normal file
0
Modules/HospitalPortal/Http/Requests/.gitkeep
Normal file
0
Modules/HospitalPortal/Http/Requests/.gitkeep
Normal file
0
Modules/HospitalPortal/Providers/.gitkeep
Normal file
0
Modules/HospitalPortal/Providers/.gitkeep
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HospitalPortal\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Illuminate\Database\Eloquent\Factory;
|
||||||
|
|
||||||
|
class HospitalPortalServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string $moduleName
|
||||||
|
*/
|
||||||
|
protected $moduleName = 'HospitalPortal';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $moduleNameLower
|
||||||
|
*/
|
||||||
|
protected $moduleNameLower = 'hospitalportal';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boot the application events.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
$this->registerTranslations();
|
||||||
|
$this->registerConfig();
|
||||||
|
$this->registerViews();
|
||||||
|
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the service provider.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
$this->app->register(RouteServiceProvider::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register config.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function registerConfig()
|
||||||
|
{
|
||||||
|
$this->publishes([
|
||||||
|
module_path($this->moduleName, 'Config/config.php') => config_path($this->moduleNameLower . '.php'),
|
||||||
|
], 'config');
|
||||||
|
$this->mergeConfigFrom(
|
||||||
|
module_path($this->moduleName, 'Config/config.php'), $this->moduleNameLower
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register views.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function registerViews()
|
||||||
|
{
|
||||||
|
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
|
||||||
|
|
||||||
|
$sourcePath = module_path($this->moduleName, 'Resources/views');
|
||||||
|
|
||||||
|
$this->publishes([
|
||||||
|
$sourcePath => $viewPath
|
||||||
|
], ['views', $this->moduleNameLower . '-module-views']);
|
||||||
|
|
||||||
|
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register translations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function registerTranslations()
|
||||||
|
{
|
||||||
|
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
||||||
|
|
||||||
|
if (is_dir($langPath)) {
|
||||||
|
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||||
|
} else {
|
||||||
|
$this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the services provided by the provider.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function provides()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getPublishableViewPaths(): array
|
||||||
|
{
|
||||||
|
$paths = [];
|
||||||
|
foreach (\Config::get('view.paths') as $path) {
|
||||||
|
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
|
||||||
|
$paths[] = $path . '/modules/' . $this->moduleNameLower;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $paths;
|
||||||
|
}
|
||||||
|
}
|
||||||
69
Modules/HospitalPortal/Providers/RouteServiceProvider.php
Normal file
69
Modules/HospitalPortal/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HospitalPortal\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
|
class RouteServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The module namespace to assume when generating URLs to actions.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $moduleNamespace = 'Modules\HospitalPortal\Http\Controllers';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called before routes are registered.
|
||||||
|
*
|
||||||
|
* Register any model bindings or pattern based filters.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the routes for the application.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function map()
|
||||||
|
{
|
||||||
|
$this->mapApiRoutes();
|
||||||
|
|
||||||
|
$this->mapWebRoutes();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the "web" routes for the application.
|
||||||
|
*
|
||||||
|
* These routes all receive session state, CSRF protection, etc.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function mapWebRoutes()
|
||||||
|
{
|
||||||
|
Route::middleware('web')
|
||||||
|
->namespace($this->moduleNamespace)
|
||||||
|
->group(module_path('HospitalPortal', '/Routes/web.php'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the "api" routes for the application.
|
||||||
|
*
|
||||||
|
* These routes are typically stateless.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function mapApiRoutes()
|
||||||
|
{
|
||||||
|
Route::prefix('api')
|
||||||
|
->middleware('api')
|
||||||
|
->namespace($this->moduleNamespace)
|
||||||
|
->group(module_path('HospitalPortal', '/Routes/api.php'));
|
||||||
|
}
|
||||||
|
}
|
||||||
0
Modules/HospitalPortal/Resources/assets/.gitkeep
Normal file
0
Modules/HospitalPortal/Resources/assets/.gitkeep
Normal file
0
Modules/HospitalPortal/Resources/assets/js/app.js
Normal file
0
Modules/HospitalPortal/Resources/assets/js/app.js
Normal file
0
Modules/HospitalPortal/Resources/lang/.gitkeep
Normal file
0
Modules/HospitalPortal/Resources/lang/.gitkeep
Normal file
0
Modules/HospitalPortal/Resources/views/.gitkeep
Normal file
0
Modules/HospitalPortal/Resources/views/.gitkeep
Normal file
9
Modules/HospitalPortal/Resources/views/index.blade.php
Normal file
9
Modules/HospitalPortal/Resources/views/index.blade.php
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
@extends('hospitalportal::layouts.master')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<h1>Hello World</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This view is loaded from module: {!! config('hospitalportal.name') !!}
|
||||||
|
</p>
|
||||||
|
@endsection
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>Module HospitalPortal</title>
|
||||||
|
|
||||||
|
{{-- Laravel Mix - CSS File --}}
|
||||||
|
{{-- <link rel="stylesheet" href="{{ mix('css/hospitalportal.css') }}"> --}}
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
@yield('content')
|
||||||
|
|
||||||
|
{{-- Laravel Mix - JS File --}}
|
||||||
|
{{-- <script src="{{ mix('js/hospitalportal.js') }}"></script> --}}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
0
Modules/HospitalPortal/Routes/.gitkeep
Normal file
0
Modules/HospitalPortal/Routes/.gitkeep
Normal file
44
Modules/HospitalPortal/Routes/api.php
Normal file
44
Modules/HospitalPortal/Routes/api.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Modules\HospitalPortal\Http\Controllers\Api\AuthController;
|
||||||
|
use Modules\HospitalPortal\Http\Controllers\Api\ClaimRequestController;
|
||||||
|
use Modules\HospitalPortal\Http\Controllers\Api\MemberController;
|
||||||
|
use Modules\HospitalPortal\Http\Controllers\ClaimController;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| API Routes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here is where you can register API routes for your application. These
|
||||||
|
| routes are loaded by the RouteServiceProvider within a group which
|
||||||
|
| is assigned the "api" middleware group. Enjoy building your API!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
Route::prefix('hospitalportal')->group(function () {
|
||||||
|
|
||||||
|
Route::post('login', [AuthController::class, 'login'])->name('login');
|
||||||
|
Route::post('forget-password', [AuthController::class, 'forgetPassword'])->name('forget-password');
|
||||||
|
Route::post('verify-email', [AuthController::class, 'verifyEmail'])->name('verify-email');
|
||||||
|
|
||||||
|
|
||||||
|
Route::middleware('auth:sanctum')->group(function () {
|
||||||
|
|
||||||
|
Route::post('logout', [AuthController::class, 'logout'])->name('logout');
|
||||||
|
Route::get('/user', function (Request $request) {
|
||||||
|
return $request->user();
|
||||||
|
});
|
||||||
|
Route::put('reset-password', [AuthController::class, 'resetPassword'])->name('resetPassword');
|
||||||
|
|
||||||
|
Route::get('claims', [ClaimController::class, 'index']);
|
||||||
|
|
||||||
|
Route::post('search-member', [MemberController::class, 'search']);
|
||||||
|
|
||||||
|
Route::get('claim-requests', [ClaimRequestController::class, 'index'])->name('claim-requests.index');
|
||||||
|
Route::post('claim-requests', [ClaimRequestController::class, 'store'])->name('claim-requests.store');
|
||||||
|
Route::get('claim-requests/{claim_request_id}/log', [ClaimRequestController::class, 'generateLog'])->name('claim-requests.generate-log');
|
||||||
|
Route::get('claim-requests/{id}', [ClaimRequestController::class, 'show'])->name('claim-requests.show');
|
||||||
|
});
|
||||||
|
});
|
||||||
16
Modules/HospitalPortal/Routes/web.php
Normal file
16
Modules/HospitalPortal/Routes/web.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Web Routes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here is where you can register web routes for your application. These
|
||||||
|
| routes are loaded by the RouteServiceProvider within a group which
|
||||||
|
| contains the "web" middleware group. Now create something great!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
Route::prefix('hospitalportal')->group(function() {
|
||||||
|
Route::get('/', 'HospitalPortalController@index');
|
||||||
|
});
|
||||||
0
Modules/HospitalPortal/Tests/Feature/.gitkeep
Normal file
0
Modules/HospitalPortal/Tests/Feature/.gitkeep
Normal file
0
Modules/HospitalPortal/Tests/Unit/.gitkeep
Normal file
0
Modules/HospitalPortal/Tests/Unit/.gitkeep
Normal file
31
Modules/HospitalPortal/Transformers/ClaimRequestResource.php
Normal file
31
Modules/HospitalPortal/Transformers/ClaimRequestResource.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HospitalPortal\Transformers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
class ClaimRequestResource extends JsonResource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Transform the resource into an array.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray($request)
|
||||||
|
{
|
||||||
|
$data = parent::toArray($request);
|
||||||
|
$historiesGroupByDate = $this->histories->mapToGroups(function($history) {
|
||||||
|
return [$history->created_at->format('Y-m-d') => $history];
|
||||||
|
});
|
||||||
|
$data['histories_by_date'] = [];
|
||||||
|
foreach ($historiesGroupByDate as $date => $histories) {
|
||||||
|
$data['histories_by_date'][] = [
|
||||||
|
'date' => $date,
|
||||||
|
'histories' => $histories
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data; //parent::toArray($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\HospitalPortal\Transformers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
class ClaimRequestShowResource extends JsonResource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Transform the resource into an array.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray($request)
|
||||||
|
{
|
||||||
|
$data = parent::toArray($request);
|
||||||
|
$historiesGroupByDate = $this->histories->mapToGroups(function($history) {
|
||||||
|
return [$history->created_at->format('Y-m-d') => $history];
|
||||||
|
});
|
||||||
|
$data['histories_by_date'] = [];
|
||||||
|
foreach ($historiesGroupByDate as $date => $histories) {
|
||||||
|
$data['histories_by_date'][] = [
|
||||||
|
'date' => $date,
|
||||||
|
'histories' => $histories
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
23
Modules/HospitalPortal/composer.json
Normal file
23
Modules/HospitalPortal/composer.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"name": "nwidart/hospitalportal",
|
||||||
|
"description": "",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Widart",
|
||||||
|
"email": "n.widart@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [],
|
||||||
|
"aliases": {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Modules\\HospitalPortal\\": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
Modules/HospitalPortal/module.json
Normal file
13
Modules/HospitalPortal/module.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "HospitalPortal",
|
||||||
|
"alias": "hospitalportal",
|
||||||
|
"description": "",
|
||||||
|
"keywords": [],
|
||||||
|
"priority": 0,
|
||||||
|
"providers": [
|
||||||
|
"Modules\\HospitalPortal\\Providers\\HospitalPortalServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {},
|
||||||
|
"files": [],
|
||||||
|
"requires": []
|
||||||
|
}
|
||||||
21
Modules/HospitalPortal/package.json
Normal file
21
Modules/HospitalPortal/package.json
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "npm run development",
|
||||||
|
"development": "mix",
|
||||||
|
"watch": "mix watch",
|
||||||
|
"watch-poll": "mix watch -- --watch-options-poll=1000",
|
||||||
|
"hot": "mix watch --hot",
|
||||||
|
"prod": "npm run production",
|
||||||
|
"production": "mix --production"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"axios": "^0.21.4",
|
||||||
|
"dotenv": "^10.0.0",
|
||||||
|
"dotenv-expand": "^5.1.0",
|
||||||
|
"laravel-mix": "^6.0.31",
|
||||||
|
"laravel-mix-merge-manifest": "^2.0.0",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"postcss": "^8.3.7"
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Modules/HospitalPortal/webpack.mix.js
Normal file
14
Modules/HospitalPortal/webpack.mix.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
const dotenvExpand = require('dotenv-expand');
|
||||||
|
dotenvExpand(require('dotenv').config({ path: '../../.env'/*, debug: true*/}));
|
||||||
|
|
||||||
|
const mix = require('laravel-mix');
|
||||||
|
require('laravel-mix-merge-manifest');
|
||||||
|
|
||||||
|
mix.setPublicPath('../../public').mergeManifest();
|
||||||
|
|
||||||
|
mix.js(__dirname + '/Resources/assets/js/app.js', 'js/hospitalportal.js')
|
||||||
|
.sass( __dirname + '/Resources/assets/sass/app.scss', 'css/hospitalportal.css');
|
||||||
|
|
||||||
|
if (mix.inProduction()) {
|
||||||
|
mix.version();
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Internal\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Helpers\Helper;
|
||||||
|
use App\Models\OLDLMS\Appointment;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Routing\Controller;
|
||||||
|
use Modules\Internal\Transformers\AppointmentResource;
|
||||||
|
|
||||||
|
class AppointmentController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$appointments = Appointment::query()
|
||||||
|
->with('doctor.user', 'doctor.speciality', 'appointmentDetail', 'healthCare', 'user', 'user.detail')
|
||||||
|
->latest()
|
||||||
|
->paginate(15);
|
||||||
|
return response()->json(Helper::paginateResources(AppointmentResource::collection($appointments)));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('internal::create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$appointments = Appointment::query()
|
||||||
|
->with('doctor.user', 'doctor.speciality', 'appointmentDetail', 'healthCare')
|
||||||
|
->where('nID', $id)
|
||||||
|
->first();
|
||||||
|
return response()->json(new AppointmentResource($appointments));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
return view('internal::edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
86
Modules/Internal/Http/Controllers/Api/CityController.php
Normal file
86
Modules/Internal/Http/Controllers/Api/CityController.php
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Internal\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Models\City;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Routing\Controller;
|
||||||
|
|
||||||
|
class CityController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$city = City::where('province_id', $request->province_id)->orderBy('name', 'asc')->get();
|
||||||
|
|
||||||
|
if (!$city) {
|
||||||
|
return response(['message' => 'Tidak ada data'], 404);
|
||||||
|
} else {
|
||||||
|
return response(['message' => 'Data ditemukan', 'data' => $city]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('internal::create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
return view('internal::show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
return view('internal::edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
133
Modules/Internal/Http/Controllers/Api/ClaimRequestController.php
Normal file
133
Modules/Internal/Http/Controllers/Api/ClaimRequestController.php
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Internal\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Helpers\Helper;
|
||||||
|
use App\Models\ClaimRequest;
|
||||||
|
use App\Models\Member;
|
||||||
|
use Exception;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Routing\Controller;
|
||||||
|
use Knp\Snappy\Pdf;
|
||||||
|
use Modules\Internal\Transformers\ClaimRequestResource;
|
||||||
|
use Modules\Internal\Transformers\ClaimRequestShowResource;
|
||||||
|
|
||||||
|
class ClaimRequestController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$claimRequests = ClaimRequest::query()
|
||||||
|
->when($request->search, function ($q, $search) {
|
||||||
|
$q->where('code', 'LIKE', "%".$search."%");
|
||||||
|
})
|
||||||
|
->when($request->orderBy, function ($q, $orderBy) use ($request) {
|
||||||
|
if (in_array($orderBy, ['submission_date', 'code'])) {
|
||||||
|
$q->orderBy($orderBy, $request->order);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->when(empty($request->orderBy), function ($q) {
|
||||||
|
$q->orderBy('created_at', 'desc');
|
||||||
|
})
|
||||||
|
->when($request->status, function($q, $status) {
|
||||||
|
$q->where('status', $status);
|
||||||
|
})
|
||||||
|
->with(['member', 'files'])
|
||||||
|
->paginate();
|
||||||
|
|
||||||
|
return Helper::paginateResources(ClaimRequestResource::collection($claimRequests));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('internal::create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$claimRequest = ClaimRequest::findOrFail($id);
|
||||||
|
$claimRequest->load([
|
||||||
|
'histories' => function ($history) {
|
||||||
|
$history->latest();
|
||||||
|
},
|
||||||
|
'files'
|
||||||
|
]);
|
||||||
|
|
||||||
|
return Helper::responseJson(data: ClaimRequestShowResource::make($claimRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
return view('internal::edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function approve($id)
|
||||||
|
{
|
||||||
|
$claimRequest = ClaimRequest::findOrFail($id);
|
||||||
|
$member = $claimRequest->member;
|
||||||
|
|
||||||
|
$claimRequest->status = 'approved';
|
||||||
|
$claimRequest->save();
|
||||||
|
|
||||||
|
// Store Generated Documents
|
||||||
|
$logContent = view('pdf.guaranted_leter', compact('member', 'claimRequest'));
|
||||||
|
$claimRequest->generatedDocuments()->create([
|
||||||
|
'type' => 'guarantee_letter',
|
||||||
|
'title' => 'Guarantee Letter for '. $member->full_name,
|
||||||
|
'document_type' => 'type',
|
||||||
|
'html_content' => $logContent,
|
||||||
|
'system_origin' => 'primecenter'
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $claimRequest;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace Modules\Internal\Http\Controllers\Api;
|
namespace Modules\Internal\Http\Controllers\Api;
|
||||||
|
|
||||||
use App\Exceptions\ImportRowException;
|
use App\Exceptions\ImportRowException;
|
||||||
|
use App\Helpers\Helper;
|
||||||
use App\Imports\PlansImport;
|
use App\Imports\PlansImport;
|
||||||
use App\Models\Benefit;
|
use App\Models\Benefit;
|
||||||
use App\Models\Claim;
|
use App\Models\Claim;
|
||||||
@@ -19,7 +20,8 @@ use Illuminate\Routing\Controller;
|
|||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
use Box\Spout\Reader\Common\Creator\ReaderEntityFactory;
|
use Box\Spout\Reader\Common\Creator\ReaderEntityFactory;
|
||||||
use App\Models\File;
|
use App\Models\File;
|
||||||
|
use Illuminate\Support\Facades\File as FacadesFile;
|
||||||
|
use Illuminate\Support\Facades\Response;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Modules\Internal\Services\CorporateService;
|
use Modules\Internal\Services\CorporateService;
|
||||||
|
|
||||||
@@ -76,7 +78,7 @@ class CorporateController extends Controller
|
|||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'code' => 'required',
|
'code' => 'required|regex:/^[a-zA-Z0-9]+$/',
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
// 'logo' => 'required',
|
// 'logo' => 'required',
|
||||||
'policy_code' => 'required_with:policy_id',
|
'policy_code' => 'required_with:policy_id',
|
||||||
@@ -144,6 +146,12 @@ class CorporateController extends Controller
|
|||||||
'code' => 'OPT',
|
'code' => 'OPT',
|
||||||
'description' => 'Optical',
|
'description' => 'Optical',
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'id' => 6,
|
||||||
|
'name' => 'Medical Check Up',
|
||||||
|
'code' => 'MCU',
|
||||||
|
'description' => 'Medical Check Up',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($services as $service) {
|
foreach ($services as $service) {
|
||||||
@@ -293,7 +301,7 @@ class CorporateController extends Controller
|
|||||||
public function update(Request $request, $id)
|
public function update(Request $request, $id)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'code' => 'required',
|
'code' => 'required|regex:/^[a-zA-Z0-9]+$/',
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
'policy_code' => 'required_with:policy_id',
|
'policy_code' => 'required_with:policy_id',
|
||||||
'policy_total_premi' => 'required_with:policy_code',
|
'policy_total_premi' => 'required_with:policy_code',
|
||||||
@@ -486,4 +494,31 @@ class CorporateController extends Controller
|
|||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function importDocumentExample($document_type)
|
||||||
|
{
|
||||||
|
switch ($document_type) {
|
||||||
|
case 'plan-benefit':
|
||||||
|
return Helper::responseJson([
|
||||||
|
'file_name' => "Corporate Plan & Benefit Import.xlsx",
|
||||||
|
"file_url" => url('files/Corporate Plan & Benefit Import.xlsx')
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
case 'member':
|
||||||
|
return Helper::responseJson([
|
||||||
|
'file_name' => "Corporate Membership Import.xlsx",
|
||||||
|
"file_url" => url('files/Corporate Membership Import.xlsx')
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
case 'diagnosis-exclusion':
|
||||||
|
return Helper::responseJson([
|
||||||
|
'file_name' => "Corporate Exclusion Import.xlsx",
|
||||||
|
"file_url" => url('files/Corporate Exclusion Import.xlsx')
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return Helper::responseJson([], 'error', 404);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ use App\Models\Member;
|
|||||||
use Box\Spout\Reader\Common\Creator\ReaderEntityFactory;
|
use Box\Spout\Reader\Common\Creator\ReaderEntityFactory;
|
||||||
use Box\Spout\Writer\Common\Creator\WriterEntityFactory;
|
use Box\Spout\Writer\Common\Creator\WriterEntityFactory;
|
||||||
use Box\Spout\Common\Entity\Row;
|
use Box\Spout\Common\Entity\Row;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Contracts\Support\Renderable;
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Routing\Controller;
|
use Illuminate\Routing\Controller;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Modules\Internal\Services\MemberEnrollmentService;
|
use Modules\Internal\Services\MemberEnrollmentService;
|
||||||
|
use PDF;
|
||||||
|
|
||||||
class CorporateMemberController extends Controller
|
class CorporateMemberController extends Controller
|
||||||
{
|
{
|
||||||
@@ -41,10 +43,10 @@ class CorporateMemberController extends Controller
|
|||||||
'claims' => function ($claim) {
|
'claims' => function ($claim) {
|
||||||
// return $claim->whereBetween('requested_at', [now()->startOfYear(), now()->endOfYear()]);
|
// return $claim->whereBetween('requested_at', [now()->startOfYear(), now()->endOfYear()]);
|
||||||
// return $claim->used(now()->startOfYear(), now()->endOfYear());
|
// return $claim->used(now()->startOfYear(), now()->endOfYear());
|
||||||
}
|
},
|
||||||
|
'currentPlan',
|
||||||
|
'currentPlan.benefits'
|
||||||
])
|
])
|
||||||
->with('currentPlan')
|
|
||||||
// ->with
|
|
||||||
->paginate()
|
->paginate()
|
||||||
->appends($request->all());
|
->appends($request->all());
|
||||||
|
|
||||||
@@ -192,9 +194,12 @@ class CorporateMemberController extends Controller
|
|||||||
'ingestion_code' => $e->getCode(),
|
'ingestion_code' => $e->getCode(),
|
||||||
'ingestion_status' => $e->getMessage(),
|
'ingestion_status' => $e->getMessage(),
|
||||||
]);
|
]);
|
||||||
$singleRow = WriterEntityFactory::createRow($this->memberEnrollmentService->makeResultRowWithResultFormat($new_member_data));
|
// try {
|
||||||
$writer->addRow($singleRow);
|
$singleRow = WriterEntityFactory::createRow($this->memberEnrollmentService->makeResultRowWithResultFormat($new_member_data));
|
||||||
$failed_member_data[] = ['row_number' => $index, 'error' => $e->getMessage()];
|
$writer->addRow($singleRow);
|
||||||
|
// } catch (\Exception $e) {
|
||||||
|
$failed_member_data[] = ['row_number' => $index, 'error' => $e->getMessage(), 'data' => $new_member_data];
|
||||||
|
// }
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// Write Server Error to File
|
// Write Server Error to File
|
||||||
$new_member_data = array_merge($new_member_data, [
|
$new_member_data = array_merge($new_member_data, [
|
||||||
@@ -225,4 +230,25 @@ class CorporateMemberController extends Controller
|
|||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function generateLog(Request $request, $member_id)
|
||||||
|
{
|
||||||
|
$member = Member::findOrFail($member_id)
|
||||||
|
->load([
|
||||||
|
'currentPlan',
|
||||||
|
'currentPolicy',
|
||||||
|
'currentPlan.corporateBenefits' => function ($benefit) use ($request) {
|
||||||
|
return $benefit->when($request->benefit_ids, function ($q, $ids) {
|
||||||
|
return $q->whereIn('benefit_id', $ids);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
'currentPlan.corporateBenefits.benefit']);
|
||||||
|
|
||||||
|
$dateOfAdmission = $request->date_of_admission ? Carbon::parse($request->date_of_admission) : now();
|
||||||
|
|
||||||
|
// return view('pdf.guaranted_leter', compact('member'));
|
||||||
|
$pdf = PDF::loadView('pdf.guaranted_leter', compact(['member', 'dateOfAdmission']));
|
||||||
|
return $pdf->download('Guaranted Letter - '.$member->full_name.'.pdf');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
85
Modules/Internal/Http/Controllers/Api/DistrictController.php
Normal file
85
Modules/Internal/Http/Controllers/Api/DistrictController.php
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Internal\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Models\District;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Routing\Controller;
|
||||||
|
|
||||||
|
class DistrictController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$district = District::where('city_id', $request->city_id)->orderBy('name', 'asc')->get();
|
||||||
|
|
||||||
|
if (!$district) {
|
||||||
|
return response(['message' => 'Tidak ada data'], 404);
|
||||||
|
} else {
|
||||||
|
return response(['message' => 'Data ditemukan', 'data' => $district]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('internal::create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
return view('internal::show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
return view('internal::edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace Modules\Internal\Http\Controllers\Api;
|
namespace Modules\Internal\Http\Controllers\Api;
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
|
use App\Models\Person;
|
||||||
use App\Models\Practitioner;
|
use App\Models\Practitioner;
|
||||||
use App\Models\PractitionerRole;
|
use App\Models\PractitionerRole;
|
||||||
use Illuminate\Contracts\Support\Renderable;
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
@@ -18,12 +19,6 @@ class DoctorController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
// $doctors = PractitionerRole::active()->with('practitioner.person', 'organization')
|
|
||||||
// ->when($request->search ?? null, function ($query, $search) {
|
|
||||||
// $query->whereHas('practitioner.person', function ($person) use ($search) {
|
|
||||||
// $person->where('name', 'LIKE', '%' . $search . '%');
|
|
||||||
// });
|
|
||||||
// })->paginate();
|
|
||||||
|
|
||||||
$doctors = Practitioner::with('person', 'practitionerRoles.organization', 'practitionerRoles.speciality')
|
$doctors = Practitioner::with('person', 'practitionerRoles.organization', 'practitionerRoles.speciality')
|
||||||
->when($request->search ?? null, function ($query, $search) {
|
->when($request->search ?? null, function ($query, $search) {
|
||||||
@@ -31,6 +26,9 @@ class DoctorController extends Controller
|
|||||||
$person->where('name', 'LIKE', '%' . $search . '%');
|
$person->where('name', 'LIKE', '%' . $search . '%');
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
->when($request->id ?? null, function ($query, $id) {
|
||||||
|
$query->where('id', $id);
|
||||||
|
})
|
||||||
->when($request->organization_id ?? null, function ($query, $organization_id) {
|
->when($request->organization_id ?? null, function ($query, $organization_id) {
|
||||||
$query->whereHas('practitionerRoles', function ($practitionerRole) use ($organization_id) {
|
$query->whereHas('practitionerRoles', function ($practitionerRole) use ($organization_id) {
|
||||||
$practitionerRole->where('organization_id', $organization_id);
|
$practitionerRole->where('organization_id', $organization_id);
|
||||||
@@ -65,7 +63,58 @@ class DoctorController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
//
|
$data_person = [
|
||||||
|
'name' => $request->name,
|
||||||
|
'gender' => $request->gender,
|
||||||
|
'address' => $request->address,
|
||||||
|
'phone' => $request->phone,
|
||||||
|
'email' => $request->email,
|
||||||
|
'birth_date' => date('Y-m-d', strtotime($request->birth_date)),
|
||||||
|
'birth_place' => $request->birth_place,
|
||||||
|
];
|
||||||
|
|
||||||
|
$person = Person::create($data_person);
|
||||||
|
$address = $person->addresses()->create([
|
||||||
|
'use' => 'both',
|
||||||
|
'type' => 'physical',
|
||||||
|
'text' => $request->address,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$person->main_address_id = $address->id;
|
||||||
|
$person->save();
|
||||||
|
|
||||||
|
$practitioner = $person->practitioner()->create();
|
||||||
|
|
||||||
|
$practices = $request->practices;
|
||||||
|
if ($practices[0]['organization_id'] !== null) {
|
||||||
|
foreach ($practices as $key => $practice) {
|
||||||
|
if (isset($practice['specialities'])) {
|
||||||
|
//jika input spesialis
|
||||||
|
foreach ($practice['specialities'] as $key => $speciality) {
|
||||||
|
$speciality_id = $speciality['speciality_id'];
|
||||||
|
$organization_id = $practice['organization_id'];
|
||||||
|
$practitionerRole = $practitioner->practitionerRoles()->create([
|
||||||
|
'organization_id' => $organization_id,
|
||||||
|
'speciality_id' => $speciality_id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//jika tidak input spesialis
|
||||||
|
$speciality_id = null;
|
||||||
|
$organization_id = $practice['organization_id'];
|
||||||
|
|
||||||
|
$practitionerRole = $practitioner->practitionerRoles()->create([
|
||||||
|
'organization_id' => $organization_id,
|
||||||
|
'speciality_id' => $speciality_id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'Data berhasil disimpan',
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,7 +124,8 @@ class DoctorController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
return view('internal::show');
|
$practitioner = Practitioner::with('person', 'practitionerRoles.organization', 'practitionerRoles.speciality')->find($id);
|
||||||
|
return response()->json(DoctorResource::make($practitioner));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,7 +135,8 @@ class DoctorController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
return view('internal::edit');
|
$practitioner = Practitioner::with('person', 'practitionerRoles.organization', 'practitionerRoles.speciality')->find($id);
|
||||||
|
return response()->json(DoctorResource::make($practitioner));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,7 +147,81 @@ class DoctorController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function update(Request $request, $id)
|
public function update(Request $request, $id)
|
||||||
{
|
{
|
||||||
//
|
$practitioner = Practitioner::find($id);
|
||||||
|
$data_person = [
|
||||||
|
'name' => $request->name,
|
||||||
|
'gender' => $request->gender,
|
||||||
|
'address' => $request->address,
|
||||||
|
'phone' => $request->phone,
|
||||||
|
'email' => $request->email,
|
||||||
|
'birth_date' => date('Y-m-d', strtotime($request->birth_date)),
|
||||||
|
'birth_place' => $request->birth_place,
|
||||||
|
];
|
||||||
|
|
||||||
|
$person = $practitioner->person;
|
||||||
|
$person->update($data_person);
|
||||||
|
$address = $practitioner->person->addresses()->updateOrCreate([
|
||||||
|
'use' => 'both',
|
||||||
|
'type' => 'physical',
|
||||||
|
'text' => $request->address,
|
||||||
|
]);
|
||||||
|
$practitioner->person->main_address_id = $address->id;
|
||||||
|
$practitioner->person->save();
|
||||||
|
|
||||||
|
$practices = $request->practices;
|
||||||
|
$practitionerRole = $practitioner->practitionerRoles()->get() ?? null;
|
||||||
|
|
||||||
|
foreach ($practices as $practice) {
|
||||||
|
$organization_id = $practice['organization_id'];
|
||||||
|
foreach ($practice['specialities'] as $speciality) {
|
||||||
|
$speciality_id = $speciality['speciality_id'];
|
||||||
|
$cek = $practitionerRole->where('organization_id', $organization_id)
|
||||||
|
->where('speciality_id', $speciality_id)->first() ?? null;
|
||||||
|
if (!$cek || $practitionerRole->isEmpty()) {
|
||||||
|
// Create new practitioner role if not found
|
||||||
|
$practitioner->practitionerRoles()->create([
|
||||||
|
'organization_id' => $organization_id,
|
||||||
|
'speciality_id' => $speciality_id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($practitionerRole) {
|
||||||
|
// Remove practitioner roles that are no longer exists
|
||||||
|
$currentRoleIds = $practitionerRole->pluck('id')->toArray();
|
||||||
|
$newRoleIds = [];
|
||||||
|
|
||||||
|
foreach ($practices as $practice) {
|
||||||
|
$organization_id = $practice['organization_id'];
|
||||||
|
foreach ($practice['specialities'] as $speciality) {
|
||||||
|
$speciality_id = $speciality['speciality_id'];
|
||||||
|
$newPractitionerRole = $practitionerRole->where('organization_id', $organization_id)
|
||||||
|
->where('speciality_id', $speciality_id)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($newPractitionerRole) {
|
||||||
|
$newRoleIds[] = $newPractitionerRole->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$deletedRoleIds = array_diff($currentRoleIds, $newRoleIds);
|
||||||
|
|
||||||
|
if (count($deletedRoleIds) > 0) {
|
||||||
|
// Delete practitioner roles that are no longer exists
|
||||||
|
$data = $practitionerRole->whereIn('id', $deletedRoleIds);
|
||||||
|
$data->each(function ($item) {
|
||||||
|
$item->delete();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'Data berhasil disimpan',
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -106,6 +231,14 @@ class DoctorController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
//
|
$practitioner = Practitioner::find($id);
|
||||||
|
$person = $practitioner->person->delete();
|
||||||
|
$address = $practitioner->person->addresses()->delete();
|
||||||
|
$practitionerRole = $practitioner->practitionerRoles()->delete();
|
||||||
|
$practitioner->delete();
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'Data berhasil dihapus',
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
90
Modules/Internal/Http/Controllers/Api/LivechatController.php
Normal file
90
Modules/Internal/Http/Controllers/Api/LivechatController.php
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Internal\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Helpers\Helper;
|
||||||
|
use App\Models\OLDLMS\Livechat;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Routing\Controller;
|
||||||
|
use Modules\Internal\Transformers\LivechatResource;
|
||||||
|
|
||||||
|
class LivechatController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$livechat = Livechat::with('doctor.user', 'doctor.speciality', 'appointment.appointmentDetail', 'healthCare')
|
||||||
|
->where('nIDAppointment', '!=', null)->where('nIDAppointment', '!=', '')
|
||||||
|
->latest()
|
||||||
|
->paginate(15);
|
||||||
|
|
||||||
|
return response()->json(Helper::paginateResources(LivechatResource::collection($livechat)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('internal::create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$livechat = Livechat::with('doctor.user', 'doctor.speciality', 'appointment.appointmentDetail', 'healthCare')
|
||||||
|
->where('nIDAppointment', '!=', null)->where('nIDAppointment', '!=', '')
|
||||||
|
->where('nID', $id)
|
||||||
|
->first();
|
||||||
|
return response()->json(new LivechatResource($livechat));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
return view('internal::edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -47,7 +47,44 @@ class OrganizationController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
//
|
$organization = [
|
||||||
|
'code' => $request->code,
|
||||||
|
'name' => $request->name,
|
||||||
|
'type' => 'hospital',
|
||||||
|
'status' => $request->active == 1 ? 'active' : 'inactive',
|
||||||
|
'description' => $request->description,
|
||||||
|
];
|
||||||
|
|
||||||
|
$create_organization = Organization::create($organization);
|
||||||
|
|
||||||
|
if ($request->phone != null) {
|
||||||
|
$create_organization->metas()->create([
|
||||||
|
'system' => 'default',
|
||||||
|
'type' => 'phone',
|
||||||
|
'value' => $request->phone,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$address = $create_organization->addresses()->create([
|
||||||
|
'use' => 'both',
|
||||||
|
'type' => 'physical',
|
||||||
|
'text' => $request->address,
|
||||||
|
'province_id' => $request->province_id,
|
||||||
|
'city_id' => $request->city_id,
|
||||||
|
'district_id' => $request->district_id,
|
||||||
|
'village_id' => $request->village_id,
|
||||||
|
'postal_code' => $request->postal_code,
|
||||||
|
'lat' => $request->lat,
|
||||||
|
'lng' => $request->lng,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$create_organization->main_address_id = $address->id;
|
||||||
|
$create_organization->save();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Data berhasil disimpan',
|
||||||
|
'data' => new OrganizationResource($create_organization)
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,7 +94,7 @@ class OrganizationController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
return view('internal::show');
|
return response()->json(OrganizationResource::make(Organization::find($id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,7 +104,7 @@ class OrganizationController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
return view('internal::edit');
|
return response()->json(OrganizationResource::make(Organization::find($id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,7 +115,46 @@ class OrganizationController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function update(Request $request, $id)
|
public function update(Request $request, $id)
|
||||||
{
|
{
|
||||||
//
|
$update_organization = Organization::find($id);
|
||||||
|
|
||||||
|
$update_organization->update([
|
||||||
|
'code' => $request->code,
|
||||||
|
'name' => $request->name,
|
||||||
|
'type' => 'hospital',
|
||||||
|
'status' => $request->active == 1 ? 'active' : 'inactive',
|
||||||
|
'description' => $request->description,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($request->phone != null) {
|
||||||
|
$update_organization->metas()->updateOrCreate([
|
||||||
|
'system' => 'default',
|
||||||
|
'type' => 'phone',
|
||||||
|
], [
|
||||||
|
'system' => 'default',
|
||||||
|
'type' => 'phone',
|
||||||
|
'value' => $request->phone,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$update_organization->addresses()->updateOrCreate([
|
||||||
|
'id' => $update_organization->main_address_id
|
||||||
|
], [
|
||||||
|
'use' => 'both',
|
||||||
|
'type' => 'physical',
|
||||||
|
'text' => $request->address,
|
||||||
|
'province_id' => $request->province_id,
|
||||||
|
'city_id' => $request->city_id,
|
||||||
|
'district_id' => $request->district_id,
|
||||||
|
'village_id' => $request->village_id,
|
||||||
|
'postal_code' => $request->postal_code,
|
||||||
|
'lat' => $request->lat,
|
||||||
|
'lng' => $request->lng,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Data berhasil diubah',
|
||||||
|
'data' => new OrganizationResource($update_organization)
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,6 +164,12 @@ class OrganizationController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
//
|
$delete_organization = Organization::find($id);
|
||||||
|
$delete_organization->addresses()->delete();
|
||||||
|
$delete_organization->delete();
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Data berhasil dihapus',
|
||||||
|
'data' => new OrganizationResource($delete_organization)
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
86
Modules/Internal/Http/Controllers/Api/ProvinceController.php
Normal file
86
Modules/Internal/Http/Controllers/Api/ProvinceController.php
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Internal\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Models\Province;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Routing\Controller;
|
||||||
|
|
||||||
|
class ProvinceController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$province = Province::orderBy('name', 'ASC')->get();
|
||||||
|
|
||||||
|
if (empty($province)) {
|
||||||
|
return response(['message' => 'Tidak ada data'], 404);
|
||||||
|
} else {
|
||||||
|
return response(['message' => 'Data ditemukan', 'data' => $province]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('internal::create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
return view('internal::show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
return view('internal::edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
86
Modules/Internal/Http/Controllers/Api/VillageController.php
Normal file
86
Modules/Internal/Http/Controllers/Api/VillageController.php
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Internal\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Models\Village;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Routing\Controller;
|
||||||
|
|
||||||
|
class VillageController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$villages = Village::where('district_id', $request->district_id)->orderBy('name', 'asc')->get();
|
||||||
|
|
||||||
|
if (!$villages) {
|
||||||
|
return response(['message' => 'Tidak ada data'], 404);
|
||||||
|
} else {
|
||||||
|
return response(['message' => 'Data ditemukan', 'data' => $villages]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('internal::create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
return view('internal::show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
return view('internal::edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
* @param int $id
|
||||||
|
* @return Renderable
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,8 +3,11 @@
|
|||||||
use App\Http\Controllers\Api\MemberController as ApiMemberController;
|
use App\Http\Controllers\Api\MemberController as ApiMemberController;
|
||||||
use Modules\Internal\Http\Controllers\Api\AuthController;
|
use Modules\Internal\Http\Controllers\Api\AuthController;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Modules\Internal\Http\Controllers\Api\AppointmentController;
|
||||||
use Modules\Internal\Http\Controllers\Api\BenefitController;
|
use Modules\Internal\Http\Controllers\Api\BenefitController;
|
||||||
|
use Modules\Internal\Http\Controllers\Api\CityController;
|
||||||
use Modules\Internal\Http\Controllers\Api\ClaimController;
|
use Modules\Internal\Http\Controllers\Api\ClaimController;
|
||||||
|
use Modules\Internal\Http\Controllers\Api\ClaimRequestController;
|
||||||
use Modules\Internal\Http\Controllers\Api\CorporateBenefitController;
|
use Modules\Internal\Http\Controllers\Api\CorporateBenefitController;
|
||||||
use Modules\Internal\Http\Controllers\Api\CorporateController;
|
use Modules\Internal\Http\Controllers\Api\CorporateController;
|
||||||
use Modules\Internal\Http\Controllers\Api\CorporateFormulariumController;
|
use Modules\Internal\Http\Controllers\Api\CorporateFormulariumController;
|
||||||
@@ -13,14 +16,18 @@ use Modules\Internal\Http\Controllers\Api\CorporatePlanController;
|
|||||||
use Modules\Internal\Http\Controllers\Api\CorporateServiceController;
|
use Modules\Internal\Http\Controllers\Api\CorporateServiceController;
|
||||||
use Modules\Internal\Http\Controllers\Api\DiagnosisController;
|
use Modules\Internal\Http\Controllers\Api\DiagnosisController;
|
||||||
use Modules\Internal\Http\Controllers\Api\DiagnosisExclusionController;
|
use Modules\Internal\Http\Controllers\Api\DiagnosisExclusionController;
|
||||||
|
use Modules\Internal\Http\Controllers\Api\DistrictController;
|
||||||
use Modules\Internal\Http\Controllers\Api\DivisionController;
|
use Modules\Internal\Http\Controllers\Api\DivisionController;
|
||||||
use Modules\Internal\Http\Controllers\Api\DoctorController;
|
use Modules\Internal\Http\Controllers\Api\DoctorController;
|
||||||
use Modules\Internal\Http\Controllers\Api\DrugController;
|
use Modules\Internal\Http\Controllers\Api\DrugController;
|
||||||
use Modules\Internal\Http\Controllers\Api\FormulariumController;
|
use Modules\Internal\Http\Controllers\Api\FormulariumController;
|
||||||
|
use Modules\Internal\Http\Controllers\Api\LivechatController;
|
||||||
use Modules\Internal\Http\Controllers\Api\MemberController;
|
use Modules\Internal\Http\Controllers\Api\MemberController;
|
||||||
use Modules\Internal\Http\Controllers\Api\OrganizationController;
|
use Modules\Internal\Http\Controllers\Api\OrganizationController;
|
||||||
use Modules\Internal\Http\Controllers\Api\PlanController;
|
use Modules\Internal\Http\Controllers\Api\PlanController;
|
||||||
|
use Modules\Internal\Http\Controllers\Api\ProvinceController;
|
||||||
use Modules\Internal\Http\Controllers\Api\SpecialityController;
|
use Modules\Internal\Http\Controllers\Api\SpecialityController;
|
||||||
|
use Modules\Internal\Http\Controllers\Api\VillageController;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -51,6 +58,7 @@ Route::prefix('internal')->group(function () {
|
|||||||
|
|
||||||
|
|
||||||
Route::resource('corporates', CorporateController::class);
|
Route::resource('corporates', CorporateController::class);
|
||||||
|
Route::get('corporates/import-document-example/{document_type}', [CorporateController::class, 'importDocumentExample']);
|
||||||
Route::put('corporates/{corporate_id}/activation', [CorporateController::class, 'activation']);
|
Route::put('corporates/{corporate_id}/activation', [CorporateController::class, 'activation']);
|
||||||
Route::post('corporates/{corporate_id}/import-plan-benefit', [CorporateController::class, 'importPlanBenefit']);
|
Route::post('corporates/{corporate_id}/import-plan-benefit', [CorporateController::class, 'importPlanBenefit']);
|
||||||
|
|
||||||
@@ -118,11 +126,20 @@ Route::prefix('internal')->group(function () {
|
|||||||
Route::get('search-organizations', [OrganizationController::class, 'searchOrganization']);
|
Route::get('search-organizations', [OrganizationController::class, 'searchOrganization']);
|
||||||
Route::get('search-specialities', [SpecialityController::class, 'searchSpeciality']);
|
Route::get('search-specialities', [SpecialityController::class, 'searchSpeciality']);
|
||||||
Route::resource('organizations', OrganizationController::class);
|
Route::resource('organizations', OrganizationController::class);
|
||||||
|
Route::resource('appointments', AppointmentController::class);
|
||||||
|
Route::resource('live-chat', LivechatController::class);
|
||||||
|
|
||||||
Route::resource('doctors', DoctorController::class);
|
Route::resource('doctors', DoctorController::class);
|
||||||
|
|
||||||
|
Route::post('generate-log/{member_id}', [CorporateMemberController::class, 'generateLog']);
|
||||||
|
|
||||||
|
Route::get('claim-requests', [ClaimRequestController::class, 'index'])->name('claim-requests.index');
|
||||||
|
Route::post('claim-requests/{id}/approve', [ClaimRequestController::class, 'approve'])->name('claim-requests.approve');
|
||||||
|
Route::get('claim-requests/{id}', [ClaimRequestController::class, 'show'])->name('claim-requests.show');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Route::resource('organizations', OrganizationController::class);
|
Route::get('province', [ProvinceController::class, 'index']);
|
||||||
// Route::resource('doctors', DoctorController::class);
|
Route::get('city', [CityController::class, 'index']);
|
||||||
|
Route::get('district', [DistrictController::class, 'index']);
|
||||||
// Route::get('something', [DiagnosisExclusionController::class, 'index']);
|
Route::get('village', [VillageController::class, 'index']);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Modules\Internal\Http\Controllers\Api\CorporateMemberController;
|
||||||
|
|
||||||
Route::prefix('internal')->group(function() {
|
Route::prefix('internal')->group(function() {
|
||||||
Route::get('/', 'InternalController@index');
|
Route::get('/', 'InternalController@index');
|
||||||
});
|
});
|
||||||
@@ -42,10 +42,8 @@ class CorporateService
|
|||||||
|
|
||||||
$this->validatePlanRow($plan_data);
|
$this->validatePlanRow($plan_data);
|
||||||
|
|
||||||
$plan = Plan::updateOrCreate([
|
$plan = $corporate->plans()->updateOrCreate([
|
||||||
'service_code' => $plan_data['service_code'],
|
'service_code' => $plan_data['service_code'],
|
||||||
'corporate_id' => $corporate->id,
|
|
||||||
'code' => $plan_data['code'],
|
|
||||||
], $plan_data);
|
], $plan_data);
|
||||||
|
|
||||||
return $plan;
|
return $plan;
|
||||||
@@ -91,7 +89,9 @@ class CorporateService
|
|||||||
$this->validateBenefitRow($benefit_data);
|
$this->validateBenefitRow($benefit_data);
|
||||||
|
|
||||||
|
|
||||||
$plan = Plan::where('corporate_plan_id', $benefit_data['plan_code'])->first();
|
$plan = $corporate->plans()
|
||||||
|
->where('corporate_plan_id', $benefit_data['plan_code'])
|
||||||
|
->first();
|
||||||
|
|
||||||
// $corporate->plans->where('corporate_plan_id', $benefit_data['plan_code'])->first();
|
// $corporate->plans->where('corporate_plan_id', $benefit_data['plan_code'])->first();
|
||||||
$benefit_data['plan_code'] = $plan->id;
|
$benefit_data['plan_code'] = $plan->id;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ use App\Models\Plan;
|
|||||||
use Box\Spout\Writer\Common\Creator\WriterEntityFactory;
|
use Box\Spout\Writer\Common\Creator\WriterEntityFactory;
|
||||||
use Box\Spout\Common\Entity\Row;
|
use Box\Spout\Common\Entity\Row;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use DateTime;
|
||||||
use DB;
|
use DB;
|
||||||
|
|
||||||
class MemberEnrollmentService
|
class MemberEnrollmentService
|
||||||
@@ -45,6 +46,7 @@ class MemberEnrollmentService
|
|||||||
"The Right Classes Room of BPJS Participants" => "bpjs_class",
|
"The Right Classes Room of BPJS Participants" => "bpjs_class",
|
||||||
"Name of Faskes" => "faskes_name",
|
"Name of Faskes" => "faskes_name",
|
||||||
"Rule_BPJSK ('Y' or 'N')" => "bpjsk",
|
"Rule_BPJSK ('Y' or 'N')" => "bpjsk",
|
||||||
|
"Rule BPJSK" => "bpjsk",
|
||||||
"Agent Code / intermediary code" => "agent_code",
|
"Agent Code / intermediary code" => "agent_code",
|
||||||
"Member Name" => "name",
|
"Member Name" => "name",
|
||||||
"Address1" => "address1",
|
"Address1" => "address1",
|
||||||
@@ -123,7 +125,7 @@ class MemberEnrollmentService
|
|||||||
"faskes_fkrtl" => "Faskes FKRTL (Next Level Provider) or Individual group preferred provider",
|
"faskes_fkrtl" => "Faskes FKRTL (Next Level Provider) or Individual group preferred provider",
|
||||||
"bpjs_class" => "The Right Classes Room of BPJS Participants",
|
"bpjs_class" => "The Right Classes Room of BPJS Participants",
|
||||||
"faskes_name" => "Name of Faskes",
|
"faskes_name" => "Name of Faskes",
|
||||||
"bpjsk" => "Rule_BPJSK ('Y' or 'N')",
|
"bpjsk" => "Rule BPJSK",
|
||||||
"agent_code" => "Agent Code / intermediary code",
|
"agent_code" => "Agent Code / intermediary code",
|
||||||
"name" => "Member Name",
|
"name" => "Member Name",
|
||||||
"address1" => "Address1",
|
"address1" => "Address1",
|
||||||
@@ -195,8 +197,8 @@ class MemberEnrollmentService
|
|||||||
"Faskes FKRTL (Next Level Provider) or Individual group preferred provider",
|
"Faskes FKRTL (Next Level Provider) or Individual group preferred provider",
|
||||||
"The Right Classes Room of BPJS Participants",
|
"The Right Classes Room of BPJS Participants",
|
||||||
"Name of Faskes",
|
"Name of Faskes",
|
||||||
"Rule_BPJSK ('Y' or 'N')",
|
"Rule BPJSK",
|
||||||
"Agent Code / intermediary code",
|
"Internal Use",
|
||||||
"Member Name",
|
"Member Name",
|
||||||
"Address1",
|
"Address1",
|
||||||
"Address 1",
|
"Address 1",
|
||||||
@@ -247,6 +249,10 @@ class MemberEnrollmentService
|
|||||||
$this->member = $member;
|
$this->member = $member;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function dateParser($date_from_row) {
|
||||||
|
return is_string($date_from_row) ? Carbon::parse(strtotime($date_from_row)) : Carbon::parse($date_from_row);
|
||||||
|
}
|
||||||
|
|
||||||
protected function validateRow($row)
|
protected function validateRow($row)
|
||||||
{
|
{
|
||||||
if (empty($row['record_type'])) {
|
if (empty($row['record_type'])) {
|
||||||
@@ -360,7 +366,7 @@ class MemberEnrollmentService
|
|||||||
"member_id" => $row['member_id'] ?? null,
|
"member_id" => $row['member_id'] ?? null,
|
||||||
"payor_id" => $row['payor_id'] ?? null,
|
"payor_id" => $row['payor_id'] ?? null,
|
||||||
"nik" => $row['nik'] ?? null,
|
"nik" => $row['nik'] ?? null,
|
||||||
"birth_date" => Carbon::parse(strtotime($row['date_of_birth'])),
|
"birth_date" => $this->dateParser($row['date_of_birth']),
|
||||||
"gender" => Helper::genderNormalization($row['sex']),
|
"gender" => Helper::genderNormalization($row['sex']),
|
||||||
// "language" => $row['language'] ?? null,
|
// "language" => $row['language'] ?? null,
|
||||||
// "race" => $row['race'] ?? null,
|
// "race" => $row['race'] ?? null,
|
||||||
@@ -415,7 +421,7 @@ class MemberEnrollmentService
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => $row['name'] ?? null,
|
'name' => $row['name'] ?? null,
|
||||||
'birth_date' => Carbon::parse(strtotime($row['date_of_birth'])),
|
'birth_date' => $this->dateParser($row['date_of_birth']),
|
||||||
'gender' => Helper::genderPerson($row['sex']),
|
'gender' => Helper::genderPerson($row['sex']),
|
||||||
'language' => $row['language'] ?? null,
|
'language' => $row['language'] ?? null,
|
||||||
'race' => $row['race'] ?? null,
|
'race' => $row['race'] ?? null,
|
||||||
@@ -462,7 +468,7 @@ class MemberEnrollmentService
|
|||||||
|
|
||||||
$person = Person::create([
|
$person = Person::create([
|
||||||
'name' => $row['name'],
|
'name' => $row['name'],
|
||||||
'birth_date' => Carbon::parse(strtotime($row['date_of_birth'])),
|
'birth_date' => $this->dateParser($row['date_of_birth']),
|
||||||
'gender' => Helper::genderPerson($row['sex']),
|
'gender' => Helper::genderPerson($row['sex']),
|
||||||
'language' => $row['language'] ?? null,
|
'language' => $row['language'] ?? null,
|
||||||
'race' => $row['race'] ?? null,
|
'race' => $row['race'] ?? null,
|
||||||
@@ -474,8 +480,8 @@ class MemberEnrollmentService
|
|||||||
$memberPolicy->fill([
|
$memberPolicy->fill([
|
||||||
'member_id' => $member->member_id,
|
'member_id' => $member->member_id,
|
||||||
'policy_id' => $row['policy_number'],
|
'policy_id' => $row['policy_number'],
|
||||||
'start' => Carbon::parse(strtotime($row['member_effective_date'])),
|
'start' => $this->dateParser($row['member_effective_date']),
|
||||||
'end' => Carbon::parse(strtotime($row['member_expiry_date'])),
|
'end' => $this->dateParser($row['member_expiry_date']),
|
||||||
'status' => 'active'
|
'status' => 'active'
|
||||||
]);
|
]);
|
||||||
$memberPolicy->save();
|
$memberPolicy->save();
|
||||||
@@ -505,8 +511,8 @@ class MemberEnrollmentService
|
|||||||
$member->memberPlans()->create([
|
$member->memberPlans()->create([
|
||||||
'plan_id' => $plan->id,
|
'plan_id' => $plan->id,
|
||||||
'status' => 'active',
|
'status' => 'active',
|
||||||
'start' => Carbon::parse(strtotime($row['member_effective_date'])),
|
'start' => $this->dateParser($row['member_effective_date']),
|
||||||
'end' => Carbon::parse(strtotime($row['member_expiry_date'])),
|
'end' => $this->dateParser($row['member_expiry_date']),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
DB::commit();
|
DB::commit();
|
||||||
@@ -620,13 +626,13 @@ class MemberEnrollmentService
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Carbon::parse(strtotime($row['member_effective_date'])) > Carbon::parse(strtotime($row['member_expiry_date']))) {
|
if ($this->dateParser($row['member_effective_date']) > $this->dateParser($row['member_expiry_date'])) {
|
||||||
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_DATE_INVALID'), 0, null, $row);
|
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_DATE_INVALID'), 0, null, $row);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
Carbon::parse($memberPolicy->end) > Carbon::parse(strtotime($row['member_expiry_date']))
|
Carbon::parse($memberPolicy->end) > $this->dateParser($row['member_expiry_date'])
|
||||||
|| $memberPolicy->end > Carbon::parse(strtotime($row['member_expiry_date']))
|
|| $memberPolicy->end > $this->dateParser($row['member_expiry_date'])
|
||||||
) {
|
) {
|
||||||
throw new ImportRowException(__('enrollment.MEMBER_RENEWAL_STILL_ACTIVE'), 0, null, $row);
|
throw new ImportRowException(__('enrollment.MEMBER_RENEWAL_STILL_ACTIVE'), 0, null, $row);
|
||||||
}
|
}
|
||||||
@@ -663,13 +669,13 @@ class MemberEnrollmentService
|
|||||||
]), 0, null, $row);
|
]), 0, null, $row);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Carbon::parse(strtotime($row['member_effective_date'])) > Carbon::parse(strtotime($row['member_expiry_date']))) {
|
if ($this->dateParser($row['member_effective_date']) > $this->dateParser($row['member_expiry_date'])) {
|
||||||
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_DATE_INVALID'), 0, null, $row);
|
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_DATE_INVALID'), 0, null, $row);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
Carbon::parse($memberPolicy->end) > Carbon::parse(strtotime($row['member_expiry_date']))
|
Carbon::parse($memberPolicy->end) > $this->dateParser($row['member_expiry_date'])
|
||||||
|| $memberPolicy->end > Carbon::parse(strtotime($row['member_expiry_date']))
|
|| $memberPolicy->end > $this->dateParser($row['member_expiry_date'])
|
||||||
) {
|
) {
|
||||||
throw new ImportRowException(__('enrollment.MEMBER_RENEWAL_STILL_ACTIVE'), 0, null, $row);
|
throw new ImportRowException(__('enrollment.MEMBER_RENEWAL_STILL_ACTIVE'), 0, null, $row);
|
||||||
}
|
}
|
||||||
@@ -850,11 +856,11 @@ class MemberEnrollmentService
|
|||||||
]), 0, null, $row);
|
]), 0, null, $row);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Carbon::parse(strtotime($row['member_effective_date'])) < now() || Carbon::parse(strtotime($row['member_expiry_date'])) < now()) {
|
if ($this->dateParser($row['member_effective_date']) < now() || $this->dateParser($row['member_expiry_date']) < now()) {
|
||||||
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_MUST_BE_AFTER_TODAY'), 0, null, $row);
|
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_MUST_BE_AFTER_TODAY'), 0, null, $row);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Carbon::parse(strtotime($row['member_effective_date'])) > Carbon::parse(strtotime($row['member_expiry_date']))) {
|
if ($this->dateParser($row['member_effective_date']) > $this->dateParser($row['member_expiry_date'])) {
|
||||||
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_DATE_INVALID'), 0, null, $row);
|
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_DATE_INVALID'), 0, null, $row);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -889,8 +895,8 @@ class MemberEnrollmentService
|
|||||||
$newMemberPolicy->fill([
|
$newMemberPolicy->fill([
|
||||||
'member_id' => $row['member_id'],
|
'member_id' => $row['member_id'],
|
||||||
'policy_id' => $row['policy_number'],
|
'policy_id' => $row['policy_number'],
|
||||||
'start' => Carbon::parse(strtotime($row['member_effective_date'])),
|
'start' => $this->dateParser($row['member_effective_date']),
|
||||||
'end' => Carbon::parse(strtotime($row['member_expiry_date'])),
|
'end' => $this->dateParser($row['member_expiry_date']),
|
||||||
'status' => 'active'
|
'status' => 'active'
|
||||||
]);
|
]);
|
||||||
$newMemberPolicy->save();
|
$newMemberPolicy->save();
|
||||||
@@ -931,7 +937,7 @@ class MemberEnrollmentService
|
|||||||
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_DATE_NO_CHANGE'), 0, null, $row);
|
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_DATE_NO_CHANGE'), 0, null, $row);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Carbon::parse(strtotime($row['member_effective_date'])) > Carbon::parse(strtotime($row['member_expiry_date']))) {
|
if ($this->dateParser($row['member_effective_date']) > $this->dateParser($row['member_expiry_date'])) {
|
||||||
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_DATE_INVALID'), 0, null, $row);
|
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_DATE_INVALID'), 0, null, $row);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1016,7 +1022,15 @@ class MemberEnrollmentService
|
|||||||
$cells = [];
|
$cells = [];
|
||||||
foreach ($this->result_doc_headers as $header) {
|
foreach ($this->result_doc_headers as $header) {
|
||||||
$value = $row_data[$this->doc_headers_to_field_map[$header]] ?? null;
|
$value = $row_data[$this->doc_headers_to_field_map[$header]] ?? null;
|
||||||
$cells[] = WriterEntityFactory::createCell($value);
|
if (is_string($value)) {
|
||||||
|
$cells[] = WriterEntityFactory::createCell($value);
|
||||||
|
}
|
||||||
|
else if ($value instanceof DateTime) {
|
||||||
|
$cells[] = WriterEntityFactory::createCell(Carbon::parse($value)->format('Ymd'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$cells[] = WriterEntityFactory::createCell(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $cells;
|
return $cells;
|
||||||
|
|||||||
53
Modules/Internal/Transformers/AppointmentResource.php
Normal file
53
Modules/Internal/Transformers/AppointmentResource.php
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Internal\Transformers;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
class AppointmentResource extends JsonResource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Transform the resource into an array.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray($request)
|
||||||
|
{
|
||||||
|
$appointment = [
|
||||||
|
'id' => $this->nID,
|
||||||
|
'patient_name' => $this->user ? $this->user->full_name : '',
|
||||||
|
'doctor_name' => $this->doctor ? $this->doctor->user?->full_name : '',
|
||||||
|
'speciality' => $this->doctor->speciality->sKeterangan,
|
||||||
|
'date_appointment' => Carbon::parse($this->appointmentDetail->dTanggalAppointment)->format('d-m-Y') . ' ' . $this->appointmentDetail->tTimeAppointment,
|
||||||
|
'date_created' => Carbon::parse($this->dCreateOn)->format('d-m-Y H:i:s') ?? null,
|
||||||
|
'appointment_media' => $this->sMedia,
|
||||||
|
'status' => $this->status_name,
|
||||||
|
'health_care' => $this->healthCare->sHealthCare ?? null,
|
||||||
|
'payment_method' => $this->payment_method ?? null,
|
||||||
|
'patient' => $this->user,
|
||||||
|
'booking_code' => $this->sBookingCode,
|
||||||
|
'his_detail' => [
|
||||||
|
'RegID' => $this->sRegID,
|
||||||
|
'Medrec' => $this->sNomorRekamMedis
|
||||||
|
],
|
||||||
|
'type' => $this->type
|
||||||
|
];
|
||||||
|
|
||||||
|
$payment_detail = null;
|
||||||
|
if ($this->appointmentDetail->sPaymentDetails != null) {
|
||||||
|
$payment_detail = [
|
||||||
|
'payment_type' => $this->appointmentDetail->sPaymentDetails['payment_type'] ?? '',
|
||||||
|
'transaction_time' => $this->appointmentDetail->sPaymentDetails['transaction_time'] ?? '',
|
||||||
|
'gross_amount' => $this->appointmentDetail->sPaymentDetails['gross_amount'] ?? '',
|
||||||
|
'currency' => $this->appointmentDetail->sPaymentDetails['currency'] ?? '',
|
||||||
|
'status_message' => $this->appointmentDetail->sPaymentDetails['status_message'] ?? '',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$appointment['payment_detail'] = $payment_detail;
|
||||||
|
|
||||||
|
return $appointment;
|
||||||
|
}
|
||||||
|
}
|
||||||
33
Modules/Internal/Transformers/ClaimRequestResource.php
Normal file
33
Modules/Internal/Transformers/ClaimRequestResource.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Internal\Transformers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
class ClaimRequestResource extends JsonResource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Transform the resource into an array.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray($request)
|
||||||
|
{
|
||||||
|
$filesGroupByType = $this->files->mapToGroups(function($file) {
|
||||||
|
return [$file->type => $file];
|
||||||
|
});
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'id' => $this->id,
|
||||||
|
'code' => $this->code,
|
||||||
|
'submission_date' => $this->submission_date,
|
||||||
|
'member' => $this->member,
|
||||||
|
'status' => $this->status ?? 'unknown',
|
||||||
|
'service_type' => $this->service_type,
|
||||||
|
'files_by_type' => $filesGroupByType
|
||||||
|
];
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
40
Modules/Internal/Transformers/ClaimRequestShowResource.php
Normal file
40
Modules/Internal/Transformers/ClaimRequestShowResource.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Internal\Transformers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
class ClaimRequestShowResource extends JsonResource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Transform the resource into an array.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray($request)
|
||||||
|
{
|
||||||
|
$data = parent::toArray($request);
|
||||||
|
|
||||||
|
// Map Histories to Group by Dates
|
||||||
|
$historiesGroupByDate = $this->histories->mapToGroups(function($history) {
|
||||||
|
return [$history->created_at->format('Y-m-d') => $history];
|
||||||
|
});
|
||||||
|
$data['histories_by_date'] = [];
|
||||||
|
foreach ($historiesGroupByDate as $date => $histories) {
|
||||||
|
$data['histories_by_date'][] = [
|
||||||
|
'date' => $date,
|
||||||
|
'histories' => $histories
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Map Files by type
|
||||||
|
$filesGroupByType = $this->files->mapToGroups(function($file) {
|
||||||
|
return [Str::slug($file->type, '_') => $file];
|
||||||
|
});
|
||||||
|
$data['files_by_type'] = $filesGroupByType;
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,8 +20,8 @@ class CorporateServiceConfigResource extends JsonResource
|
|||||||
'corporate_id' => $this->corporate_id,
|
'corporate_id' => $this->corporate_id,
|
||||||
'service_code' => $this->service_code,
|
'service_code' => $this->service_code,
|
||||||
'status' => $this->status,
|
'status' => $this->status,
|
||||||
'name' => $this->service->name,
|
'name' => $this->service->name ?? '-',
|
||||||
'description' => $this->service->description,
|
'description' => $this->service->description ?? '-',
|
||||||
'configurations' => $this->configs->pluck('value', 'name'),
|
'configurations' => $this->configs->pluck('value', 'name'),
|
||||||
'selected_specialities' => $this->corporateServiceSpecialities->where('active', true)->pluck('speciality.name', 'speciality_id'),
|
'selected_specialities' => $this->corporateServiceSpecialities->where('active', true)->pluck('speciality.name', 'speciality_id'),
|
||||||
'exclusions' => $this->corporateServiceSpecialities->map(function ($speciality) {
|
'exclusions' => $this->corporateServiceSpecialities->map(function ($speciality) {
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ namespace Modules\Internal\Transformers;
|
|||||||
|
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
use function PHPSTORM_META\map;
|
||||||
|
|
||||||
class DoctorResource extends JsonResource
|
class DoctorResource extends JsonResource
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -19,35 +21,51 @@ class DoctorResource extends JsonResource
|
|||||||
// 'his_dokter_id' => $this->practitionerRoles->meta,
|
// 'his_dokter_id' => $this->practitionerRoles->meta,
|
||||||
'name' => $this->person->name,
|
'name' => $this->person->name,
|
||||||
'person_id' => $this->person->id,
|
'person_id' => $this->person->id,
|
||||||
'phone' => $this->person->phone,
|
'phone' => $this->person->phone ?? null,
|
||||||
'email' => $this->person->email,
|
'email' => $this->person->email ?? null,
|
||||||
'gender' => $this->person->gender == "L" ? 'Laki-laki' : 'Perempuan',
|
'birth_date' => $this->person->birth_date ?? null,
|
||||||
'address' => $this->person->currentAddress->text,
|
'birth_place' => $this->person->birth_place ?? null,
|
||||||
|
'gender' => $this->person->gender == "L" || $this->person->gender == "male" ? 'male' : 'female',
|
||||||
|
'address' => $this->person->currentAddress->text ?? null,
|
||||||
'organizations' => $this->practitionerRoles->unique('organization_id')->map(function ($practitionerRole) {
|
'organizations' => $this->practitionerRoles->unique('organization_id')->map(function ($practitionerRole) {
|
||||||
return [
|
return [
|
||||||
'organization_id' => $practitionerRole->organization->id,
|
'organization_id' => $practitionerRole->organization->id,
|
||||||
'organization_name' => $practitionerRole->organization->name,
|
'organization_name' => $practitionerRole->organization->name,
|
||||||
];
|
];
|
||||||
}),
|
})->values(),
|
||||||
"specialties" => $this->practitionerRoles->unique('speciality_id')->map(function ($practitionerRole) {
|
"specialties" => $this->practitionerRoles->unique('speciality_id')->map(function ($practitionerRole) {
|
||||||
return [
|
return [
|
||||||
'specialty_id' => $practitionerRole->speciality->id,
|
'specialty_id' => $practitionerRole->speciality->id,
|
||||||
'specialty_name' => $practitionerRole->speciality->name,
|
'specialty_name' => $practitionerRole->speciality->name,
|
||||||
];
|
];
|
||||||
}),
|
}),
|
||||||
"departemen" => $this->practitionerRoles->map(function ($practitionerRole) {
|
// "departemen" => $this->practitionerRoles->map(function ($practitionerRole) {
|
||||||
return [
|
// return [
|
||||||
'departemen_id' => $practitionerRole->meta->DepartemenID,
|
// 'departemen_id' => $practitionerRole->meta->DepartemenID ?? null,
|
||||||
];
|
// ];
|
||||||
}),
|
// }) ?? null,
|
||||||
'education' => $this->meta->education,
|
'education' => $this->meta->education ?? null,
|
||||||
'experience' => $this->meta->work_experience,
|
'experience' => $this->meta->work_experience ?? null,
|
||||||
'award' => $this->meta->award,
|
'award' => $this->meta->award ?? null,
|
||||||
'keilmuan' => $this->meta->Keilmuan,
|
'keilmuan' => $this->meta->Keilmuan ?? null,
|
||||||
'tipe_dokter' => $this->meta->tipeDokter,
|
'tipe_dokter' => $this->meta->tipeDokter ?? null,
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$grouped = $this->collection($this->practitionerRoles)->groupBy('organization_id');
|
||||||
|
$grouped->transform(function ($items, $key) {
|
||||||
|
return [
|
||||||
|
'organization_id' => $key,
|
||||||
|
'specialities' => $items->map(function ($item) {
|
||||||
|
return [
|
||||||
|
'speciality_id' => $item->speciality->id,
|
||||||
|
];
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
$doctor['practices'] = $grouped->toArray();
|
||||||
|
|
||||||
return $doctor;
|
return $doctor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
62
Modules/Internal/Transformers/LivechatResource.php
Normal file
62
Modules/Internal/Transformers/LivechatResource.php
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Internal\Transformers;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
class LivechatResource extends JsonResource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Transform the resource into an array.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray($request)
|
||||||
|
{
|
||||||
|
$livechat = [
|
||||||
|
'id' => $this->nID,
|
||||||
|
'doctor_name' => isset($this->doctor->user->sFirstName) ? $this->doctor->user->sFirstName . ' ' . $this->doctor->user->sLastName : null,
|
||||||
|
'speciality' => $this->doctor->speciality->sKeterangan ?? null,
|
||||||
|
'health_care' => $this->healthCare->sHealthCare ?? null,
|
||||||
|
'date_appointment' => Carbon::parse($this->appointment->appointmentDetail->dTanggalAppointment)->format('d-m-Y')
|
||||||
|
. ' ' . $this->appointment->appointmentDetail->tTimeAppointment ?? null,
|
||||||
|
'status_appointment' => $this->appointment->status_name ?? null,
|
||||||
|
'date_created' => Carbon::parse($this->appointment->dCreateOn)->format('d-m-Y H:i:s') ?? null,
|
||||||
|
'patient_media' => $this->sMedia ?? null,
|
||||||
|
'doctor_media' => $this->sMediaDokter ?? null,
|
||||||
|
'appointment_media' => $this->appointment->sMedia ?? null,
|
||||||
|
'status_chat' => $this->status_name ?? null,
|
||||||
|
'payment_method' => $this->appointment->payment_method ?? null,
|
||||||
|
];
|
||||||
|
|
||||||
|
$start_time = $this->dStartTime;
|
||||||
|
$end_time = $this->dEndTime;
|
||||||
|
$data_duration = 0 . ' jam ' . 0 . ' menit ' . 0 . ' detik';
|
||||||
|
if ($start_time != null && $end_time != null) {
|
||||||
|
$duration = Carbon::parse($start_time)->diffInMinutes(Carbon::parse($end_time));
|
||||||
|
$hours = floor($duration / 60);
|
||||||
|
$minutes = $duration % 60;
|
||||||
|
$seconds = ($duration - ($hours * 60) - $minutes) * 60;
|
||||||
|
|
||||||
|
$data_duration = $hours . ' jam ' . $minutes . ' menit ' . $seconds . ' detik';
|
||||||
|
}
|
||||||
|
|
||||||
|
$livechat['duration'] = $data_duration;
|
||||||
|
|
||||||
|
$payment_detail = null;
|
||||||
|
if ($this->appointment->appointmentDetail->sPaymentDetails != null) {
|
||||||
|
$payment_detail = [
|
||||||
|
'payment_type' => $this->appointment->appointmentDetail->sPaymentDetails['payment_type'],
|
||||||
|
'transaction_time' => $this->appointment->appointmentDetail->sPaymentDetails['transaction_time'],
|
||||||
|
'gross_amount' => $this->appointment->appointmentDetail->sPaymentDetails['gross_amount'],
|
||||||
|
'currency' => $this->appointment->appointmentDetail->sPaymentDetails['currency'],
|
||||||
|
'status_message' => $this->appointment->appointmentDetail->sPaymentDetails['status_message'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$livechat['payment_detail'] = $payment_detail;
|
||||||
|
return $livechat;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,17 +14,24 @@ class OrganizationResource extends JsonResource
|
|||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
{
|
{
|
||||||
|
|
||||||
$organization = [
|
$organization = [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
'type' => $this->type,
|
'type' => $this->type,
|
||||||
'code' => $this->code,
|
'code' => $this->code,
|
||||||
'description' => $this->description,
|
'description' => $this->description,
|
||||||
'kodeRs' => $this->meta->kodeRs ?? null,
|
'kodeRs' => $this->meta->KodeRS ?? null,
|
||||||
'phone' => $this->meta->phone ?? null,
|
'phone' => $this->meta->phone ?? null,
|
||||||
'lat' => $this->currentAddress->lat ?? null,
|
'lat' => $this->currentAddress->lat ?? null,
|
||||||
'lng' => $this->currentAddress->lng ?? null,
|
'lng' => $this->currentAddress->lng ?? null,
|
||||||
'address' => $this->currentAddress ?? null,
|
'address' => $this->currentAddress->text ?? null,
|
||||||
|
'province_id' => $this->currentAddress->province_id ?? null,
|
||||||
|
'city_id' => $this->currentAddress->city_id ?? null,
|
||||||
|
'district_id' => $this->currentAddress->district_id ?? null,
|
||||||
|
'village_id' => $this->currentAddress->village_id ?? null,
|
||||||
|
'postal_code' => $this->currentAddress->postal_code ?? null,
|
||||||
|
'active' => $this->status == 'active' ? 1 : 0,
|
||||||
];
|
];
|
||||||
|
|
||||||
return $organization;
|
return $organization;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Events;
|
namespace App\Events;
|
||||||
|
|
||||||
|
use App\Models\ClaimRequest;
|
||||||
use Illuminate\Broadcasting\Channel;
|
use Illuminate\Broadcasting\Channel;
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PresenceChannel;
|
use Illuminate\Broadcasting\PresenceChannel;
|
||||||
@@ -14,14 +15,16 @@ class ClaimRequested
|
|||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||||
|
|
||||||
|
public $claim_request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct(ClaimRequest $claimRequest)
|
||||||
{
|
{
|
||||||
//
|
$this->claim_request = $claimRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,8 +6,11 @@ use App\Helpers\Helper;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\Icd;
|
use App\Models\Icd;
|
||||||
use App\Models\Member;
|
use App\Models\Member;
|
||||||
|
use App\Models\Claim;
|
||||||
|
use App\Models\Speciality;
|
||||||
use App\Services\ClaimService;
|
use App\Services\ClaimService;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class ClaimController extends Controller
|
class ClaimController extends Controller
|
||||||
{
|
{
|
||||||
@@ -16,19 +19,23 @@ class ClaimController extends Controller
|
|||||||
$request->validate([
|
$request->validate([
|
||||||
'member_id' => 'required',
|
'member_id' => 'required',
|
||||||
'user_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',
|
'total_claim' => 'required',
|
||||||
'detail' => 'required',
|
'detail' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($request->type == 'consultation-gp') {
|
$currentSpeciality = Speciality::where('code', $request->speciality_code)->first();
|
||||||
$benefitCode = 'OPCONS1';
|
|
||||||
}
|
$gpSpecialityName = config('aso.general_practitioner_speciality_name', 'Umum');
|
||||||
if ($request->type == 'consultation-specialist') {
|
$isGp = $gpSpecialityName == ($currentSpeciality ? $currentSpeciality->name : false);
|
||||||
$benefitCode = 'OPCONS2';
|
|
||||||
}
|
|
||||||
if ($request->type == 'medicine') {
|
if ($request->type == 'medicine') {
|
||||||
$benefitCode = 'OPMEDI1';
|
$benefitCode = 'OPMEDI1';
|
||||||
|
} else if ($isGp) {
|
||||||
|
$benefitCode = 'OPCONS1';
|
||||||
|
} else {
|
||||||
|
$benefitCode = 'OPCONS2';
|
||||||
}
|
}
|
||||||
|
|
||||||
$member = Member::query()
|
$member = Member::query()
|
||||||
@@ -38,7 +45,6 @@ class ClaimController extends Controller
|
|||||||
])
|
])
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
$benefit = $member->currentPlan->benefits()->where('code', $benefitCode)->first();
|
$benefit = $member->currentPlan->benefits()->where('code', $benefitCode)->first();
|
||||||
// $diagnosis = Icd::first();
|
|
||||||
|
|
||||||
$claim = ClaimService::storeClaim($member, null, $request->total_claim, $benefit, 'requested');
|
$claim = ClaimService::storeClaim($member, null, $request->total_claim, $benefit, 'requested');
|
||||||
$claim->status = 'approved';
|
$claim->status = 'approved';
|
||||||
@@ -54,7 +60,29 @@ class ClaimController extends Controller
|
|||||||
'icd_codes' => 'required'
|
'icd_codes' => 'required'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// dd($request->toArray());
|
$claim = Claim::where('code', $request->claim_code)->firstOrFail();
|
||||||
return $request->toArray();
|
|
||||||
|
try {
|
||||||
|
DB::beginTransaction();
|
||||||
|
$claim->fill(['status' => 'postpone'])->update();
|
||||||
|
|
||||||
|
$icds = Icd::whereIn('code', $request['icd_codes'])->get();
|
||||||
|
$icds = $icds->map(function($icd) use ($claim) {
|
||||||
|
return [
|
||||||
|
'claim_id' => $claim->id,
|
||||||
|
'type' => 'primary',
|
||||||
|
'diagnosis_id' => $icd->id,
|
||||||
|
'note' => 'HIS Summary',
|
||||||
|
'description'=> ''
|
||||||
|
];
|
||||||
|
})->toArray();
|
||||||
|
|
||||||
|
return $claim->diagnoses()->insert($icds);
|
||||||
|
DB::commit();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollback();
|
||||||
|
|
||||||
|
return Helper::responseJson($e, 500);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ namespace App\Http\Controllers\Api\OLDLMS;
|
|||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Resources\OLDLMS\MemberResource;
|
||||||
|
use App\Models\Corporate;
|
||||||
use App\Models\Member;
|
use App\Models\Member;
|
||||||
|
use App\Rules\NikRule;
|
||||||
use App\Services\ClaimService;
|
use App\Services\ClaimService;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
@@ -25,7 +28,7 @@ class MembershipController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$member->active) {
|
if (!$member->active) {
|
||||||
return Helper::responseJson(statusCode: 406, message: 'The Member '.$request->member_id.' is Inactive.', status: 'error');
|
return Helper::responseJson(statusCode: 406, message: 'The Member ' . $request->member_id . ' is Inactive.', status: 'error');
|
||||||
}
|
}
|
||||||
|
|
||||||
return Helper::responseJson(data: $member, message: 'Member Found');
|
return Helper::responseJson(data: $member, message: 'Member Found');
|
||||||
@@ -35,68 +38,30 @@ class MembershipController extends Controller
|
|||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'member_id' => 'required',
|
'member_id' => 'required',
|
||||||
'type' => 'required|in:consultation-gp,consultation-specialist,medicine',
|
'type' => 'required|in:consultation,teleconsultation,medicine',
|
||||||
// 'speciality_code' => 'sometimes'
|
// 'speciality_code' => 'sometimes'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($request->type == 'consultation-gp') {
|
$member = Member::query()
|
||||||
$benefitCode = 'OPCONS1';
|
->where('member_id', $request->member_id)
|
||||||
}
|
->with(['currentCorporate', 'currentPolicy', 'currentPlan', 'postponedClaims'])
|
||||||
if ($request->type == 'consultation-specialist') {
|
->first();
|
||||||
$benefitCode = 'OPCONS2';
|
|
||||||
}
|
|
||||||
if ($request->type == 'medicine') {
|
|
||||||
$benefitCode = 'OPMEDI1';
|
|
||||||
}
|
|
||||||
|
|
||||||
$member = Member::where('member_id', $request->member_id)->with(['currentCorporate', 'currentPolicy', 'currentPlan', 'postponedClaims'])->first();
|
$corporateService = $member->currentCorporate->corporateServices()
|
||||||
|
|
||||||
$limits = ClaimService::showMemberBenefitLimit($member, $benefitCode);
|
|
||||||
$limits['postponed_claims'] = $member->postponedClaims;
|
|
||||||
$limits['postponed_claims_payment_url'] = route('postpone-pay', $member->member_id);
|
|
||||||
$limits['postponed_claims_unpaid_total'] = $member->postponedClaims->sum('total_claim');
|
|
||||||
|
|
||||||
$corporateService = $member->currentCorporate
|
|
||||||
->corporateServices()
|
|
||||||
->active()
|
->active()
|
||||||
->where('service_code', 'OP')
|
->where('service_code', 'OP')
|
||||||
->with([
|
->with([
|
||||||
'configs',
|
'configs',
|
||||||
'specialities' => function ($speciality) use ($request) {
|
'specialities' => function ($speciality) use ($request) {
|
||||||
$speciality->where('code', $request->speciality_code)
|
$speciality->where('code', $request->speciality_code ?? null)
|
||||||
->wherePivot('active', 1);
|
->wherePivot('active', 1);
|
||||||
}])
|
}
|
||||||
|
])
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$configs = $corporateService->configs->mapWithKeys(function ($config) {
|
$currentSpeciality = $corporateService->specialities->first();
|
||||||
return [$config->name => $config];
|
|
||||||
});
|
|
||||||
|
|
||||||
$coverage = [
|
if ($currentSpeciality) {
|
||||||
'benefit' => false,
|
|
||||||
'admin_fee' => false,
|
|
||||||
'medicine_benefit' => true, // TODO Make this into setting ?
|
|
||||||
'medicine_delivery_fee' => false
|
|
||||||
];
|
|
||||||
$coverage['medicine_delivery_fee'] = (($configs['delivery_fee']['value'] ?? 1) == 1);
|
|
||||||
$coverage['gp_benefit'] = (($configs['gp_internal_doctor_online']['value'] ?? 1) == 1);
|
|
||||||
$coverage['gp_admin_fee'] = (($configs['general_practitioner_fee']['value'] ?? 1) == 1);
|
|
||||||
$coverage['sp_benefit'] = (($configs['sp_internal_doctor_online']['value'] ?? 1) == 1);
|
|
||||||
$coverage['sp_admin_fee'] = (($configs['specialist_practitioner_fee']['value'] ?? 1) == 1);
|
|
||||||
|
|
||||||
if ($request->has('speciality_code') && !empty($request->speciality_code)) {
|
|
||||||
|
|
||||||
if (empty($corporateService) || empty($corporateService->specialities)) {
|
|
||||||
$coverage['benefit'] = false;
|
|
||||||
$coverage['admin_fee'] = false;
|
|
||||||
$limits['coverage'] = $coverage;
|
|
||||||
|
|
||||||
return Helper::responseJson(data: $limits);
|
|
||||||
}
|
|
||||||
|
|
||||||
$currentSpeciality = $corporateService->specialities->first();
|
|
||||||
|
|
||||||
// Load the Relation Data after speciality check is supported
|
|
||||||
$corporateService->load([
|
$corporateService->load([
|
||||||
'corporateServiceSpecialities' => function ($corporateServiceSpeciality) use ($currentSpeciality) {
|
'corporateServiceSpecialities' => function ($corporateServiceSpeciality) use ($currentSpeciality) {
|
||||||
$corporateServiceSpeciality->where('speciality_id', $currentSpeciality->id);
|
$corporateServiceSpeciality->where('speciality_id', $currentSpeciality->id);
|
||||||
@@ -106,94 +71,193 @@ class MembershipController extends Controller
|
|||||||
},
|
},
|
||||||
'corporateServiceSpecialities.exclusions.rules'
|
'corporateServiceSpecialities.exclusions.rules'
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$serviceSpeciality = $corporateService->corporateServiceSpecialities->first() ?? null;
|
$corporateServiceSpeciality = $corporateService->corporateServiceSpecialities->first() ?? null;
|
||||||
$serviceSpecialityRules = $serviceSpeciality->exclusions->first()->rules ?? collect([]);
|
|
||||||
$serviceSpecialityRules = $serviceSpecialityRules->mapWithKeys(function ($rule) {
|
|
||||||
return [$rule->name => $rule];
|
|
||||||
});
|
|
||||||
|
|
||||||
$gpSpecialityName = config('aso.general_practitioner_speciality_name', 'Umum');
|
$serviceSpecialityRules = $corporateServiceSpeciality->exclusions->first()->rules ?? collect([]);
|
||||||
|
$serviceSpecialityRules = $serviceSpecialityRules->mapWithKeys(function ($rule) {
|
||||||
|
return [$rule->name => $rule];
|
||||||
|
});
|
||||||
|
|
||||||
if ($gpSpecialityName == $currentSpeciality->name) {
|
$configs = $corporateService->configs->mapWithKeys(function ($config) {
|
||||||
// To General Practitioner
|
return [$config->name => $config];
|
||||||
if (($configs['gp_internal_doctor_online']['value'] ?? 1) == 1) {
|
});
|
||||||
$coverage['benefit'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($configs['general_practitioner_fee']['value'] ?? 1) == 1) {
|
$gpSpecialityName = config('aso.general_practitioner_speciality_name', 'Umum');
|
||||||
$coverage['admin_fee'] = true;
|
$isGp = $gpSpecialityName == ($currentSpeciality ? $currentSpeciality->name : false);
|
||||||
}
|
|
||||||
|
|
||||||
if ($serviceSpeciality->active == 1) {
|
if ($request->type == 'medicine') {
|
||||||
$coverage['benefit'] = true;
|
$benefitCode = 'OPMEDI1';
|
||||||
}
|
} else if ($isGp) {
|
||||||
|
$benefitCode = 'OPCONS1';
|
||||||
|
} else {
|
||||||
|
$benefitCode = 'OPCONS2';
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
$limits = ClaimService::showMemberBenefitLimit($member, $benefitCode);
|
||||||
// To Specialist
|
$limits['postponed_claims'] = $member->postponedClaims;
|
||||||
if (($configs['sp_internal_doctor_online']['value'] ?? 1) == 1) {
|
$limits['postponed_claims_payment_url'] = route('postpone-pay', $member->member_id);
|
||||||
$coverage['benefit'] = true;
|
$limits['postponed_claims_unpaid_total'] = $member->postponedClaims->sum('total_claim');
|
||||||
}
|
|
||||||
// dd($configs['specialist_practitioner_fee']['value'], $configs['specialist_practitioner_fee']['value'] ?? 1, ($configs['specialist_practitioner_fee']['value'] ?? 1) == 1);
|
|
||||||
|
|
||||||
if (($configs['specialist_practitioner_fee']['value'] ?? 1) == 1) {
|
$coverage['medicine_benefit'] = false;
|
||||||
$coverage['admin_fee'] = true;
|
if ($benefitCode = 'OPMEDI1') {
|
||||||
}
|
$medicineBenefit = $member->currentPlan->benefits()->where('code', $benefitCode)->wherePivot('active', 1)->first();
|
||||||
|
$coverage['medicine_benefit'] = !empty($medicineBenefit);
|
||||||
|
}
|
||||||
|
$coverage['medicine_delivery_fee'] = (($configs['delivery_fee']['value'] ?? 1) == 1);
|
||||||
|
|
||||||
if ($serviceSpeciality->active == 1) {
|
if ($currentSpeciality) {
|
||||||
$coverage['benefit'] = true;
|
$xCoverage['sp_consultation_benefit'] = (($configs['sp_internal_doctor_offline']['value'] ?? 1) == 1);
|
||||||
}
|
$xCoverage['sp_teleconsultation_benefit'] = (($configs['sp_internal_doctor_online']['value'] ?? 1) == 1);
|
||||||
}
|
$xCoverage['gp_consultation_benefit'] = (($configs['gp_internal_doctor_offline']['value'] ?? 1) == 1);
|
||||||
|
$xCoverage['gp_teleconsultation_benefit'] = (($configs['gp_internal_doctor_online']['value'] ?? 1) == 1);
|
||||||
|
$coverage['consultation_benefit'] = ($isGp)
|
||||||
// TODO THIS EXCLUSION IS USED AS INCLUSION NOW, MUST BE CHANGE TO USED AS EXCLUSION AND MAYBE MOVE THE TABLE
|
? $xCoverage['gp_consultation_benefit']
|
||||||
$excluded = [];
|
: $xCoverage['sp_consultation_benefit'];
|
||||||
foreach ($serviceSpecialityRules as $ruleName => $rule) {
|
$coverage['teleconsultation_benefit'] = ($isGp)
|
||||||
if ($ruleName == 'msc') {
|
? $xCoverage['gp_teleconsultation_benefit']
|
||||||
$values = explode(',', $rule->values);
|
: $xCoverage['sp_teleconsultation_benefit'];
|
||||||
if (!in_array(strtolower($member->marital_status), $values)) {
|
|
||||||
$excluded[] = $rule;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($ruleName == 'gender') {
|
|
||||||
$values = explode(',', $rule->values);
|
|
||||||
if (!in_array(strtolower($member->gender), $values)) {
|
|
||||||
$excluded[] = $rule;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($ruleName == 'min_age') {
|
|
||||||
if (!empty($rule->values) && $member->age < $rule->values) {
|
|
||||||
$excluded[] = $rule;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($ruleName == 'max_age') {
|
|
||||||
if (!empty($rule->values) && $member->age > $rule->values) {
|
|
||||||
$excluded[] = $rule;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($ruleName == 'plan') {
|
|
||||||
$values = explode(',', $rule->values);
|
|
||||||
if (!in_array($member->currentPlan->code, $values)) {
|
|
||||||
$excluded[] = $rule;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( count($excluded) ) {
|
|
||||||
$coverage['benefit'] = false;
|
|
||||||
$coverage['benefit_exclusion'] = $excluded;
|
|
||||||
} else {
|
|
||||||
$coverage['benefit'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$xCoverage['sp_admin_fee'] = (($configs['specialist_practitioner_fee']['value'] ?? 1) == 1);
|
||||||
|
$xCoverage['gp_admin_fee'] = (($configs['general_practitioner_fee']['value'] ?? 1) == 1);
|
||||||
|
$coverage['admin_fee'] = ($isGp)
|
||||||
|
? $xCoverage['gp_admin_fee']
|
||||||
|
: $xCoverage['sp_admin_fee'];
|
||||||
|
} else {
|
||||||
|
// Not Supported
|
||||||
|
$coverage['consultation_benefit'] = false;
|
||||||
|
$coverage['teleconsultation_benefit'] = false;
|
||||||
|
$coverage['admin_fee'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$limits['coverage'] = $coverage;
|
$limits['coverage'] = $coverage;
|
||||||
|
|
||||||
|
// TODO THIS EXCLUSION IS USED AS INCLUSION NOW, MUST BE CHANGE TO USED AS EXCLUSION AND MAYBE MOVE THE TABLE
|
||||||
|
$excluded = [];
|
||||||
|
foreach ($serviceSpecialityRules as $ruleName => $rule) {
|
||||||
|
if ($ruleName == 'msc') {
|
||||||
|
$values = explode(',', $rule->values);
|
||||||
|
if (!in_array(strtolower($member->marital_status), $values)) {
|
||||||
|
$excluded[] = $rule;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ruleName == 'gender') {
|
||||||
|
$values = explode(',', $rule->values);
|
||||||
|
if (!in_array(strtolower($member->gender), $values)) {
|
||||||
|
$excluded[] = $rule;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ruleName == 'min_age') {
|
||||||
|
if (!empty($rule->values) && $member->age < $rule->values) {
|
||||||
|
$excluded[] = $rule;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ruleName == 'max_age') {
|
||||||
|
if (!empty($rule->values) && $member->age > $rule->values) {
|
||||||
|
$excluded[] = $rule;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ruleName == 'plan') {
|
||||||
|
$values = explode(',', $rule->values);
|
||||||
|
if (!in_array($member->currentPlan->code, $values)) {
|
||||||
|
$excluded[] = $rule;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Helper::responseJson(data: $limits);
|
return Helper::responseJson(data: $limits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function linkingRules(Request $request)
|
||||||
|
{
|
||||||
|
$corporates = Corporate::query()
|
||||||
|
->when($request->search, function ($q, $search) {
|
||||||
|
$q->where('name', 'LIKE', '%'.$search.'%');
|
||||||
|
})
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return Helper::responseJson(data: $corporates);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function linkingValidate(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'corporate_id' => 'required'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$corporate = Corporate::findOrFail($request->corporate_id);
|
||||||
|
|
||||||
|
// Make Validation from Linking Rules
|
||||||
|
$linkingRulesArr = $corporate->linking_rules->toArray();
|
||||||
|
$validationRules = [];
|
||||||
|
foreach ($linkingRulesArr as $field) {
|
||||||
|
$rules = ['required']; // Default is required if in the linking_rules
|
||||||
|
if ($field == 'email') {
|
||||||
|
$rules[] = 'email';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($field == 'nric') {
|
||||||
|
$rules[] = new NikRule;
|
||||||
|
}
|
||||||
|
|
||||||
|
$validationRules[$field] = $rules;
|
||||||
|
}
|
||||||
|
$request->validate($validationRules);
|
||||||
|
|
||||||
|
$member = Member::query()
|
||||||
|
->when(in_array('nric', $linkingRulesArr), function($q) use ($request) {
|
||||||
|
$q->where('nric', $request->nric);
|
||||||
|
})
|
||||||
|
->when(in_array('member_id', $linkingRulesArr), function($q) use ($request) {
|
||||||
|
$q->where('member_id', $request->member_id);
|
||||||
|
})
|
||||||
|
->when(in_array('name', $linkingRulesArr), function($q) use ($request) {
|
||||||
|
$q->where('name', $request->name);
|
||||||
|
})
|
||||||
|
->when(in_array('dob', $linkingRulesArr), function($q) use ($request) {
|
||||||
|
$q->where('birth_date', $request->dob);
|
||||||
|
})
|
||||||
|
->when(in_array('phone', $linkingRulesArr), function($q) use ($request) {
|
||||||
|
$q->whereHas('person', function ($person) use ($request) {
|
||||||
|
$person->where('phone', $request->phone);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->when(in_array('email', $linkingRulesArr), function($q) use ($request) {
|
||||||
|
$q->where('email', $request->email);
|
||||||
|
})
|
||||||
|
->when(in_array('nik', $linkingRulesArr), function($q) use ($request) {
|
||||||
|
$q->whereHas('employeds', function ($employed) use ($request) {
|
||||||
|
$employed->where('corporate_id', $request->corporate_id)
|
||||||
|
->where('nik', $request->nik);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
->with([
|
||||||
|
'memberPlans' => function ($memberPlan) {
|
||||||
|
$memberPlan->latest();
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($member) {
|
||||||
|
return Helper::responseJson(data: MemberResource::make($member), message: 'Data Member ditemukan!');
|
||||||
|
}
|
||||||
|
|
||||||
|
return Helper::responseJson(data: [], message: 'Member Tidak ditemukan', statusCode: 404, status: 'error');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($member_id)
|
||||||
|
{
|
||||||
|
$member = Member::where('member_id', $member_id)->firstOrFail();
|
||||||
|
$member->load(['currentPlan', 'memberPlans']);
|
||||||
|
$member->totalUsage = ClaimService::getMemberTotalUsage($member);
|
||||||
|
|
||||||
|
return Helper::responseJson(data: MemberResource::make($member));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
92
app/Http/Controllers/GeneratedDocumentController.php
Normal file
92
app/Http/Controllers/GeneratedDocumentController.php
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App;
|
||||||
|
use App\Models\GeneratedDocument;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use PDF;
|
||||||
|
use Response;
|
||||||
|
|
||||||
|
class GeneratedDocumentController extends Controller
|
||||||
|
{
|
||||||
|
// Display Content from generated_documents to used by pdf generator (wkhtmltopdf)
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$document = GeneratedDocument::findOrFail($id);
|
||||||
|
|
||||||
|
return $document->html_content.$document->html_content.$document->html_content.$document->html_content.$document->html_content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function header(Request $request)
|
||||||
|
{
|
||||||
|
return '<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<pre>'.json_encode($request->toArray()).'
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 200px; background-color: #00be67;"> asdkjasnd </td>
|
||||||
|
<td style="width: 500px; background-color: #0a94e3;" align="center"> asjdkadsn </td>
|
||||||
|
<td style="width: 200px; background-color: #7b3f25" align="right"> qkjwenkqwjenkqwjen </td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function footer()
|
||||||
|
{
|
||||||
|
return "<h2>Footer Fatherfucker</h2>";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function pdf($id)
|
||||||
|
{
|
||||||
|
// return 'fuck';
|
||||||
|
// $document = GeneratedDocument::findOrFail($id);
|
||||||
|
|
||||||
|
// $pdf = PDF::loadFile('http://localhost:8000/');
|
||||||
|
// $pdf = PDF::loadFile('http://aso-linksehat.local/');
|
||||||
|
// return $pdf->inline();
|
||||||
|
// dd(route('generated-document.show', $id));
|
||||||
|
// $pdf = PDF::loadFile(route('generated-document.show', $id));
|
||||||
|
// return $pdf->inline();
|
||||||
|
|
||||||
|
// $snappy = App::make('snappy.pdf');
|
||||||
|
// $html = '<h1>Bill</h1><p>You owe me money, dude.</p>';
|
||||||
|
// // $snappy->generateFromHtml($html, '/tmp/bill-123.pdf');
|
||||||
|
// // $snappy->generate('http://www.github.com', '/tmp/github.pdf');
|
||||||
|
// //Or output:
|
||||||
|
// return new Response(
|
||||||
|
// $snappy->getOutputFromHtml($html),
|
||||||
|
// 200,
|
||||||
|
// array(
|
||||||
|
// 'Content-Type' => 'application/pdf',
|
||||||
|
// 'Content-Disposition' => 'attachment; filename="file.pdf"'
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
|
||||||
|
$pdf = PDF::loadFile(route('generated-document.show', $id));
|
||||||
|
|
||||||
|
// $pdf->loadFile(route('generated-document.show', $id));
|
||||||
|
// $pdf->loadFile(route('generated-document.show', $id));
|
||||||
|
// $pdf->loadFile(route('generated-document.show', $id));
|
||||||
|
// $pdf->loadFile(route('generated-document.show', $id));
|
||||||
|
|
||||||
|
// $pdf->setPaper('a4')->setOrientation('landscape')->setOption('margin-bottom', 0);
|
||||||
|
|
||||||
|
// $pdf->setOption('header-html', route('pdf.header'));
|
||||||
|
// $pdf->setOption('footer-html', route('pdf.header'));
|
||||||
|
// $pdf->setOption('footer-center', 'asdasdasd');
|
||||||
|
|
||||||
|
// $pdf->setOption('footer-html', route('pdf.footer'));
|
||||||
|
// $pdf->loadHtml('asdasdasd');
|
||||||
|
|
||||||
|
return $pdf->inline();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Resources\OLDLMS;
|
namespace App\Http\Resources\OLDLMS;
|
||||||
|
|
||||||
|
use App\Services\ClaimService;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
class MemberResource extends JsonResource
|
class MemberResource extends JsonResource
|
||||||
@@ -14,6 +15,32 @@ class MemberResource extends JsonResource
|
|||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
{
|
{
|
||||||
return parent::toArray($request);
|
// $data = parent::toArray($request);
|
||||||
|
$currentMemberPlan = $this->memberPlans?->first();
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'member_id' => $this->member_id,
|
||||||
|
'birth_date' => $this->birth_date,
|
||||||
|
'email' => $this->email,
|
||||||
|
'phone' => $this->person->phone ?? null,
|
||||||
|
'full_name' => $this->full_name,
|
||||||
|
'nric' => $this->nric,
|
||||||
|
'plan' => $currentMemberPlan ? [
|
||||||
|
'code' => $currentMemberPlan->plan->code ?? null,
|
||||||
|
'start' => $currentMemberPlan->start,
|
||||||
|
'end' => $currentMemberPlan->end,
|
||||||
|
'limit' => $this->currentPlan->limit_rules
|
||||||
|
] : null,
|
||||||
|
'policy_code' => $this->currentPolicy?->code ?? null,
|
||||||
|
'corporate' => [
|
||||||
|
'code' => $this->currentPolicy?->corporate->code ?? null,
|
||||||
|
'name' => $this->currentPolicy?->corporate->name,
|
||||||
|
'welcome_message' => $this->currentPolicy?->corporate?->welcome_message,
|
||||||
|
'help_text' => $this->currentPolicy?->corporate?->help_text,
|
||||||
|
'avatar_url' => $this->currentpolicy?->corporate?->avatar_url
|
||||||
|
],
|
||||||
|
'limit_usage' => $this->totalUsage ?? null
|
||||||
|
];
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
35
app/Listeners/NotifyClaimRequested.php
Normal file
35
app/Listeners/NotifyClaimRequested.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Listeners;
|
||||||
|
|
||||||
|
use App\Events\ClaimRequested;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Notifications\ClaimRequestedNotification;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
|
|
||||||
|
class NotifyClaimRequested
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create the event listener.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*
|
||||||
|
* @param \App\Events\ClaimRequested $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle(ClaimRequested $event)
|
||||||
|
{
|
||||||
|
// TODO List Of User that should be notified about Claim that Requested
|
||||||
|
$user = User::first();
|
||||||
|
$user->notify(new ClaimRequestedNotification());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,6 +18,15 @@ class Benefit extends Model
|
|||||||
'active'
|
'active'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected $hidden = [
|
||||||
|
"created_at",
|
||||||
|
"updated_at",
|
||||||
|
"deleted_at",
|
||||||
|
"created_by",
|
||||||
|
"updated_by",
|
||||||
|
"deleted_by",
|
||||||
|
];
|
||||||
|
|
||||||
public function scopeFilter($query, array $filters)
|
public function scopeFilter($query, array $filters)
|
||||||
{
|
{
|
||||||
$query->when($filters['search'] ?? false, function ($query, $search) {
|
$query->when($filters['search'] ?? false, function ($query, $search) {
|
||||||
|
|||||||
@@ -11,14 +11,18 @@ use App\Events\ClaimRequested;
|
|||||||
use App\Traits\Blameable;
|
use App\Traits\Blameable;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class Claim extends Model
|
class Claim extends Model
|
||||||
{
|
{
|
||||||
use HasFactory, Blameable;
|
use HasFactory, Blameable, SoftDeletes;
|
||||||
|
|
||||||
|
protected static $code_prefix = 'CLM';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
|
'claim_request_id',
|
||||||
'code',
|
'code',
|
||||||
'member_id',
|
'member_id',
|
||||||
'total_claim',
|
'total_claim',
|
||||||
@@ -53,7 +57,8 @@ class Claim extends Model
|
|||||||
|
|
||||||
static::creating(function ($model) {
|
static::creating(function ($model) {
|
||||||
try {
|
try {
|
||||||
$model->code = (string) Str::orderedUuid(); // generate uuid
|
$model->uuid = (string) Str::orderedUuid(); // generate uuid
|
||||||
|
$model->code = self::getNextCode();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
abort(500, $e->getMessage());
|
abort(500, $e->getMessage());
|
||||||
}
|
}
|
||||||
@@ -77,9 +82,9 @@ class Claim extends Model
|
|||||||
'status' => $model->status
|
'status' => $model->status
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($model->status == 'requested') {
|
// if ($model->status == 'requested') {
|
||||||
ClaimRequested::dispatch($model);
|
// ClaimRequested::dispatch($model);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if ($model->status == 'received') {
|
if ($model->status == 'received') {
|
||||||
ClaimReceived::dispatch($model);
|
ClaimReceived::dispatch($model);
|
||||||
@@ -104,6 +109,20 @@ class Claim extends Model
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getNextCode()
|
||||||
|
{
|
||||||
|
$last_number = self::withTrashed()->max('code');
|
||||||
|
$next_number = empty($last_number) ? 1 : ((int) explode('-', $last_number)[1] + 1);
|
||||||
|
|
||||||
|
return self::makeCode($next_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function makeCode($next_number)
|
||||||
|
{
|
||||||
|
return (string) self::$code_prefix .'-'. str_pad($next_number, 5, 0, STR_PAD_LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function files()
|
public function files()
|
||||||
{
|
{
|
||||||
return $this->morphMany(File::class, 'fileable');
|
return $this->morphMany(File::class, 'fileable');
|
||||||
|
|||||||
48
app/Models/ClaimHistory.php
Normal file
48
app/Models/ClaimHistory.php
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Traits\Blameable;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ClaimHistory extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, Blameable;
|
||||||
|
|
||||||
|
public $fillable = [
|
||||||
|
'claim_id',
|
||||||
|
'title',
|
||||||
|
'description',
|
||||||
|
'type',
|
||||||
|
'parent_id',
|
||||||
|
'data',
|
||||||
|
'system_origin'
|
||||||
|
];
|
||||||
|
|
||||||
|
public static $types = [
|
||||||
|
'info',
|
||||||
|
'document-request',
|
||||||
|
'document-submit'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function parent()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(ClaimHistory::class, 'parent_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function childs()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Claimhistory::class, 'parent_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function claim()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Claim::class, 'claim_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function historiable()
|
||||||
|
{
|
||||||
|
return $this->morphTo();
|
||||||
|
}
|
||||||
|
}
|
||||||
143
app/Models/ClaimRequest.php
Normal file
143
app/Models/ClaimRequest.php
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Events\ClaimReceived;
|
||||||
|
use App\Events\ClaimRequested;
|
||||||
|
use App\Traits\Blameable;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
use Str;
|
||||||
|
|
||||||
|
class ClaimRequest extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, SoftDeletes, Blameable;
|
||||||
|
|
||||||
|
protected static $code_prefix = 'CRQ';
|
||||||
|
|
||||||
|
public $fillable = [
|
||||||
|
'submission_date',
|
||||||
|
'member_id',
|
||||||
|
'status',
|
||||||
|
'claim_id'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $hidden = [
|
||||||
|
// 'created_at',
|
||||||
|
'updated_at',
|
||||||
|
'deleted_at',
|
||||||
|
'created_by',
|
||||||
|
'updated_by',
|
||||||
|
'deleted_by',
|
||||||
|
];
|
||||||
|
|
||||||
|
public static $status = [
|
||||||
|
'draft' => 'Draft',
|
||||||
|
'requested' => 'Requested',
|
||||||
|
'received' => 'Received',
|
||||||
|
'approved' => 'Approved',
|
||||||
|
'postpone' => 'Postpone',
|
||||||
|
'paid' => 'Paid',
|
||||||
|
'declined' => 'Declined'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected static function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
|
static::creating(function ($model) {
|
||||||
|
try {
|
||||||
|
$model->uuid = (string) Str::orderedUuid(); // generate uuid
|
||||||
|
$model->code = self::getNextCode();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
abort(500, $e->getMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
static::created(function ($model) {
|
||||||
|
// try {
|
||||||
|
// if (!empty($model->status) && $model->status == 'requested') {
|
||||||
|
// $model->histories()->create([
|
||||||
|
// 'title' => 'New Claim Requested',
|
||||||
|
// 'description' => "Claim Requested for Member : {$model->member->member_id} - ({$model->member->full_name})",
|
||||||
|
// 'type' => 'info'
|
||||||
|
// ]);
|
||||||
|
// }
|
||||||
|
// } catch (\Exception $e) {
|
||||||
|
// abort(500, $e->getMessage());
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
|
||||||
|
static::updated(function ($model) {
|
||||||
|
if ($model->hasChanges(['status'])) {
|
||||||
|
|
||||||
|
// if ($model->status == 'requested') {
|
||||||
|
// $model->histories()->create([
|
||||||
|
// 'title' => 'New Claim Requested',
|
||||||
|
// 'description' => "Claim Requested for Member : {$model->member->member_id} - ({$model->member->full_name})",
|
||||||
|
// 'type' => 'info'
|
||||||
|
// ]);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ($model->status == 'received') {
|
||||||
|
// ClaimReceived::dispatch($model);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ($model->status == 'approved') {
|
||||||
|
// ClaimApproved::dispatch($model);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ($model->status == 'postpone') {
|
||||||
|
// ClaimPostpone::dispatch($model);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ($model->status == 'paid') {
|
||||||
|
// ClaimPaid::dispatch($model);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ($model->status == 'declined') {
|
||||||
|
// ClaimDeclined::dispatch($model);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getNextCode()
|
||||||
|
{
|
||||||
|
$last_number = self::withTrashed()->max('code');
|
||||||
|
$next_number = empty($last_number) ? 1 : ((int) explode('-', $last_number)[1] + 1);
|
||||||
|
|
||||||
|
return self::makeCode($next_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function makeCode($next_number)
|
||||||
|
{
|
||||||
|
return (string) self::$code_prefix .'-'. str_pad($next_number, 5, 0, STR_PAD_LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function claims()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Claim::class, 'claim_request_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function files()
|
||||||
|
{
|
||||||
|
return $this->morphMany(File::class, 'fileable');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generatedDocuments()
|
||||||
|
{
|
||||||
|
return $this->morphMany(GeneratedDocument::class, 'generated_documentable');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function histories()
|
||||||
|
{
|
||||||
|
return $this->morphMany(ClaimHistory::class, 'historiable');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function member()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Member::class, 'member_id', 'id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Traits\Blameable;
|
use App\Traits\Blameable;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\AsArrayObject;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
@@ -23,7 +24,7 @@ class Corporate extends Model
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'linking_rules' => 'array',
|
'linking_rules' => AsArrayObject::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $appends = [
|
protected $appends = [
|
||||||
|
|||||||
@@ -215,6 +215,11 @@ class CorporateBenefit extends Model
|
|||||||
return $this->belongsTo(Plan::class);
|
return $this->belongsTo(Plan::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function scopeActive($query)
|
||||||
|
{
|
||||||
|
$query->where('active', 1);
|
||||||
|
}
|
||||||
|
|
||||||
public function scopeFilter($query, array $filters)
|
public function scopeFilter($query, array $filters)
|
||||||
{
|
{
|
||||||
$query->when($filters['search'] ?? false, function ($query, $search) {
|
$query->when($filters['search'] ?? false, function ($query, $search) {
|
||||||
|
|||||||
@@ -4,10 +4,11 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class CorporateManager extends Model
|
class CorporateManager extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory, SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'corporate_manager';
|
protected $table = 'corporate_manager';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,10 +16,20 @@ class File extends Model
|
|||||||
'fileable_id',
|
'fileable_id',
|
||||||
'type',
|
'type',
|
||||||
'name',
|
'name',
|
||||||
|
'original_name',
|
||||||
'extension',
|
'extension',
|
||||||
'path',
|
'path',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected $hidden = [
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
'deleted_at',
|
||||||
|
'created_by',
|
||||||
|
'updated_by',
|
||||||
|
'deleted_by',
|
||||||
|
];
|
||||||
|
|
||||||
public $appends = [
|
public $appends = [
|
||||||
'url'
|
'url'
|
||||||
];
|
];
|
||||||
@@ -27,7 +37,10 @@ class File extends Model
|
|||||||
public static $file_directories = [
|
public static $file_directories = [
|
||||||
'import-temp' => 'import-temp/',
|
'import-temp' => 'import-temp/',
|
||||||
'avatar' => 'user-avatar/',
|
'avatar' => 'user-avatar/',
|
||||||
'dataDiri' => 'data-diri/'
|
'dataDiri' => 'data-diri/',
|
||||||
|
'claim-result' => 'claim/',
|
||||||
|
'claim-diagnosis' => 'claim/',
|
||||||
|
'claim-kondisi' => 'claim/',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function fileable()
|
public function fileable()
|
||||||
@@ -45,6 +58,11 @@ class File extends Model
|
|||||||
return $type . '-' . $id . '-' . Str::random(10);
|
return $type . '-' . $id . '-' . Str::random(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNameAttribute($value)
|
||||||
|
{
|
||||||
|
return !empty($this->original_name) ? $this->original_name : ($value . '.' . $this->extension);
|
||||||
|
}
|
||||||
|
|
||||||
public function getUrlAttribute()
|
public function getUrlAttribute()
|
||||||
{
|
{
|
||||||
return url(Storage::url($this->path));
|
return url(Storage::url($this->path));
|
||||||
|
|||||||
41
app/Models/GeneratedDocument.php
Normal file
41
app/Models/GeneratedDocument.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use PDF;
|
||||||
|
|
||||||
|
class GeneratedDocument extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
public $fillable = [
|
||||||
|
'type',
|
||||||
|
'title',
|
||||||
|
'document_type',
|
||||||
|
'html_content',
|
||||||
|
'system_origin',
|
||||||
|
'parent_id'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function parent()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(GeneratedDocument::class, 'parent_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function childs()
|
||||||
|
{
|
||||||
|
return $this->hasMany(GeneratedDocument::class, 'parent_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generated_documentable()
|
||||||
|
{
|
||||||
|
return $this->morphTo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function makePdf()
|
||||||
|
{
|
||||||
|
return PDF::loadFile(route('generated-document.show', $this->id));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -141,7 +141,8 @@ class Member extends Model
|
|||||||
|
|
||||||
public function currentPlan()
|
public function currentPlan()
|
||||||
{
|
{
|
||||||
return $this->hasOneThrough(Plan::class, MemberPlan::class, 'member_id', 'id', 'id', 'plan_id')->latest();
|
return $this->hasOneThrough(Plan::class, MemberPlan::class, 'member_id', 'id', 'id', 'plan_id')
|
||||||
|
->latest(); // TODO Fix This
|
||||||
}
|
}
|
||||||
|
|
||||||
public function policies()
|
public function policies()
|
||||||
@@ -192,12 +193,13 @@ class Member extends Model
|
|||||||
|
|
||||||
public function getNameAttribute()
|
public function getNameAttribute()
|
||||||
{
|
{
|
||||||
return $this->person->name ?? null;
|
return $this->person->name ?? ($this->name ?? null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBirthDateAttribute()
|
public function getBirthDateAttribute()
|
||||||
{
|
{
|
||||||
return Carbon::parse($this->person->birth_date ?? null)->format('Y-m-d') ?? null;
|
$date = $this->person->birth_date ?? ($this->birth_date ?? null);
|
||||||
|
return !empty($date) ? Carbon::parse($date)->format('Y-m-d') : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGenderAttribute()
|
public function getGenderAttribute()
|
||||||
|
|||||||
@@ -31,4 +31,17 @@ class MemberPlan extends Model
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(CorporatePlan::class, 'plan_id', 'code');
|
return $this->belongsTo(CorporatePlan::class, 'plan_id', 'code');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function plan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Plan::class, 'plan_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scopeActive($q)
|
||||||
|
{
|
||||||
|
return $q
|
||||||
|
->where('start', '<', now())
|
||||||
|
->where('end', '>', now())
|
||||||
|
->latest();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Models\OLDLMS;
|
namespace App\Models\OLDLMS;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
@@ -14,12 +15,99 @@ class Appointment extends Model
|
|||||||
const UPDATED_AT = 'dUpdateOn';
|
const UPDATED_AT = 'dUpdateOn';
|
||||||
const DELETED_AT = 'dDeleteOn';
|
const DELETED_AT = 'dDeleteOn';
|
||||||
|
|
||||||
|
public $sStatusNames = [
|
||||||
|
0 => 'Menunggu Pembayaran',
|
||||||
|
1 => 'Pembayaran Terkonfirmasi', // Pembayaran Diterima
|
||||||
|
2 => 'Ditolak',
|
||||||
|
3 => 'Dibatalkan', // Canceled
|
||||||
|
4 => 'Expired',
|
||||||
|
];
|
||||||
|
|
||||||
|
public $sPaymentMethodName = [
|
||||||
|
1 => 'Pribadi',
|
||||||
|
2 => 'On-Site Payment',
|
||||||
|
3 => 'OVO',
|
||||||
|
4 => 'Asuransi',
|
||||||
|
5 => 'Voucher',
|
||||||
|
];
|
||||||
|
|
||||||
|
public $nIDJenisBookingNames = [
|
||||||
|
1 => 'Rawat Jalan',
|
||||||
|
2 => 'Telekonsultasi',
|
||||||
|
3 => 'Chat Sekarang'
|
||||||
|
];
|
||||||
|
|
||||||
protected $connection = 'oldlms';
|
protected $connection = 'oldlms';
|
||||||
|
|
||||||
protected $table = 'tx_appointment';
|
protected $table = 'tx_appointment';
|
||||||
|
|
||||||
public function detail()
|
protected $primaryKey = 'nID';
|
||||||
|
|
||||||
|
public $incrementing = false;
|
||||||
|
|
||||||
|
protected $keyType = 'string';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'nID',
|
||||||
|
'nIDDokter',
|
||||||
|
'nIDUser',
|
||||||
|
'sStatus',
|
||||||
|
'dCreateOn',
|
||||||
|
'dUpdateOn',
|
||||||
|
'dDeleteOn',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $appends = [
|
||||||
|
'status_name',
|
||||||
|
'payment_method',
|
||||||
|
'type'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function statusName(): Attribute
|
||||||
{
|
{
|
||||||
return $this->hasOne(AppointmentDetail::class, '');
|
return Attribute::make(
|
||||||
|
get: function ($value) {
|
||||||
|
return $this->sStatusNames[$this->sStatus] ?? '-';
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function paymentMethod(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: function ($value) {
|
||||||
|
return $this->sPaymentMethodName[$this->sPaymentMethod] ?? '-';
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function type(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: function($value) {
|
||||||
|
return $this->nIDJenisBookingNames[$this->nIDJenisBooking] ?? '-';
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function appointmentDetail()
|
||||||
|
{
|
||||||
|
return $this->hasOne(AppointmentDetail::class, 'nIDAppointment', 'nID');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function doctor()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Dokter::class, 'nIDDokter', 'nID');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'nIDUser', 'nID');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function healthCare()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Healthcare::class, 'nIDHealthCare', 'nID');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,4 +8,19 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
class AppointmentDetail extends Model
|
class AppointmentDetail extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
|
const CREATED_AT = 'dCreateOn';
|
||||||
|
const UPDATED_AT = 'dUpdateOn';
|
||||||
|
const DELETED_AT = 'dDeleteOn';
|
||||||
|
|
||||||
|
protected $connection = 'oldlms';
|
||||||
|
|
||||||
|
protected $table = 'tx_appointment_detail';
|
||||||
|
protected $casts = [
|
||||||
|
'sPaymentDetails' => 'array',
|
||||||
|
];
|
||||||
|
public function appointment()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Appointment::class, 'nIDAppointment', 'nID');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
37
app/Models/OLDLMS/Dokter.php
Normal file
37
app/Models/OLDLMS/Dokter.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\OLDLMS;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
class Dokter extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, SoftDeletes;
|
||||||
|
|
||||||
|
const CREATED_AT = 'dCreateOn';
|
||||||
|
const UPDATED_AT = 'dUpdateOn';
|
||||||
|
const DELETED_AT = 'dDeleteOn';
|
||||||
|
|
||||||
|
protected $connection = 'oldlms';
|
||||||
|
|
||||||
|
protected $table = 'tm_dokter';
|
||||||
|
|
||||||
|
protected $primaryKey = 'nID';
|
||||||
|
|
||||||
|
public function jadwalDokter()
|
||||||
|
{
|
||||||
|
return $this->hasMany(JadwalDokter::class, 'nIDDokter', 'nID');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'nIDUser', 'nID');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function speciality()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Speciality::class, 'nIDSpesialis', 'nID');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,8 +4,24 @@ namespace App\Models\OLDLMS;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class Healthcare extends Model
|
class Healthcare extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory, SoftDeletes;
|
||||||
|
|
||||||
|
const CREATED_AT = 'dCreateOn';
|
||||||
|
const UPDATED_AT = 'dUpdateOn';
|
||||||
|
const DELETED_AT = 'dDeleteOn';
|
||||||
|
|
||||||
|
protected $connection = 'oldlms';
|
||||||
|
|
||||||
|
protected $table = 'tm_healthcare';
|
||||||
|
|
||||||
|
protected $primaryKey = 'nID';
|
||||||
|
|
||||||
|
public function jadwalDokter()
|
||||||
|
{
|
||||||
|
return $this->hasMany(JadwalDokter::class, 'nIDHealthCare', 'nID');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
32
app/Models/OLDLMS/JadwalDokter.php
Normal file
32
app/Models/OLDLMS/JadwalDokter.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\OLDLMS;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
class JadwalDokter extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, SoftDeletes;
|
||||||
|
|
||||||
|
const CREATED_AT = 'dCreateOn';
|
||||||
|
const UPDATED_AT = 'dUpdateOn';
|
||||||
|
const DELETED_AT = 'dDeleteOn';
|
||||||
|
|
||||||
|
protected $connection = 'oldlms';
|
||||||
|
|
||||||
|
protected $table = 'tx_jadwal_dokter';
|
||||||
|
|
||||||
|
protected $primaryKey = 'nID';
|
||||||
|
|
||||||
|
public function jadwalDokterDay()
|
||||||
|
{
|
||||||
|
return $this->hasMany(JadwalDokterDay::class, 'nIDJadwalDokter', 'nID');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function healthcare()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Healthcare::class, 'nIDHealthCare', 'nID');
|
||||||
|
}
|
||||||
|
}
|
||||||
22
app/Models/OLDLMS/JadwalDokterDay.php
Normal file
22
app/Models/OLDLMS/JadwalDokterDay.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\OLDLMS;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
class JadwalDokterDay extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, SoftDeletes;
|
||||||
|
|
||||||
|
const CREATED_AT = 'dCreateOn';
|
||||||
|
const UPDATED_AT = 'dUpdateOn';
|
||||||
|
const DELETED_AT = 'dDeleteOn';
|
||||||
|
|
||||||
|
protected $connection = 'oldlms';
|
||||||
|
|
||||||
|
protected $table = 'tx_jadwal_dokter_detail';
|
||||||
|
|
||||||
|
protected $primaryKey = 'nID';
|
||||||
|
}
|
||||||
27
app/Models/OLDLMS/Kota.php
Normal file
27
app/Models/OLDLMS/Kota.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\OLDLMS;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
class Kota extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, SoftDeletes;
|
||||||
|
|
||||||
|
const CREATED_AT = 'dCreateOn';
|
||||||
|
const UPDATED_AT = 'dUpdateOn';
|
||||||
|
const DELETED_AT = 'dDeleteOn';
|
||||||
|
|
||||||
|
protected $connection = 'oldlms';
|
||||||
|
|
||||||
|
protected $table = 'tm_kota';
|
||||||
|
|
||||||
|
protected $primaryKey = 'nID';
|
||||||
|
|
||||||
|
public function provinsi()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Provinsi::class, 'nIDProvinsi', 'nID');
|
||||||
|
}
|
||||||
|
}
|
||||||
64
app/Models/OLDLMS/Livechat.php
Normal file
64
app/Models/OLDLMS/Livechat.php
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\OLDLMS;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Livechat extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
|
||||||
|
public $sStatusNames = [
|
||||||
|
0 => 'Menunggu Konfirmasi',
|
||||||
|
1 => 'Diterima',
|
||||||
|
2 => 'Ditolak',
|
||||||
|
3 => 'Selesai',
|
||||||
|
4 => 'Expired',
|
||||||
|
];
|
||||||
|
|
||||||
|
const CREATED_AT = 'dCreateOn';
|
||||||
|
const UPDATED_AT = 'dUpdateOn';
|
||||||
|
const DELETED_AT = 'dDeleteOn';
|
||||||
|
|
||||||
|
protected $connection = 'oldlms';
|
||||||
|
|
||||||
|
protected $table = 'tx_livechat';
|
||||||
|
|
||||||
|
protected $appends = [
|
||||||
|
'status_name',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function statusName(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: function ($value) {
|
||||||
|
return $this->sStatusNames[$this->sStatus] ?? '-';
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'nIDUser', 'nID');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function doctor()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Dokter::class, 'nIDDokter', 'nID');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function appointment()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Appointment::class, 'nIDAppointment', 'nID');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function healthCare()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Healthcare::class, 'nIDHealthCare', 'nID');
|
||||||
|
}
|
||||||
|
}
|
||||||
22
app/Models/OLDLMS/Provinsi.php
Normal file
22
app/Models/OLDLMS/Provinsi.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\OLDLMS;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
class Provinsi extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, SoftDeletes;
|
||||||
|
|
||||||
|
const CREATED_AT = 'dCreateOn';
|
||||||
|
const UPDATED_AT = 'dUpdateOn';
|
||||||
|
const DELETED_AT = 'dDeleteOn';
|
||||||
|
|
||||||
|
protected $connection = 'oldlms';
|
||||||
|
|
||||||
|
protected $table = 'tm_provinsi';
|
||||||
|
|
||||||
|
protected $primaryKey = 'nID';
|
||||||
|
}
|
||||||
26
app/Models/OLDLMS/Speciality.php
Normal file
26
app/Models/OLDLMS/Speciality.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\OLDLMS;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Speciality extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
const CREATED_AT = 'dCreateOn';
|
||||||
|
const UPDATED_AT = 'dUpdateOn';
|
||||||
|
const DELETED_AT = 'dDeleteOn';
|
||||||
|
|
||||||
|
protected $connection = 'oldlms';
|
||||||
|
|
||||||
|
protected $table = 'tm_spesialis';
|
||||||
|
|
||||||
|
protected $primaryKey = 'nID';
|
||||||
|
|
||||||
|
public function dokter()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Dokter::class, 'nIDSpesialis', 'nID');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,10 +2,46 @@
|
|||||||
|
|
||||||
namespace App\Models\OLDLMS;
|
namespace App\Models\OLDLMS;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class User extends Model
|
class User extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory, SoftDeletes;
|
||||||
|
|
||||||
|
const CREATED_AT = 'dCreateOn';
|
||||||
|
const UPDATED_AT = 'dUpdateOn';
|
||||||
|
const DELETED_AT = 'dDeleteOn';
|
||||||
|
|
||||||
|
protected $connection = 'oldlms';
|
||||||
|
|
||||||
|
protected $table = 'tm_users';
|
||||||
|
|
||||||
|
protected $appends = [
|
||||||
|
'full_name',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function fullName(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: function ($value) {
|
||||||
|
$names = [];
|
||||||
|
if (!empty($this->sFirstName)) {
|
||||||
|
array_push($names, $this->sFirstName);
|
||||||
|
}
|
||||||
|
if (!empty($this->sLastName)) {
|
||||||
|
array_push($names, $this->sLastName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(' ', $names);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function detail()
|
||||||
|
{
|
||||||
|
return $this->hasOne(UserDetail::class, 'nIDUser', 'nID');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,4 +8,13 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
class UserDetail extends Model
|
class UserDetail extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
|
const CREATED_AT = 'dCreateOn';
|
||||||
|
const UPDATED_AT = 'dUpdateOn';
|
||||||
|
const DELETED_AT = 'dDeleteOn';
|
||||||
|
|
||||||
|
protected $connection = 'oldlms';
|
||||||
|
|
||||||
|
protected $table = 'tm_users_detail';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,6 +114,11 @@ class Person extends Model
|
|||||||
return $this->hasOne(User::class, 'person_id');
|
return $this->hasOne(User::class, 'person_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function practitioner()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Practitioner::class, 'person_id');
|
||||||
|
}
|
||||||
|
|
||||||
public function appointmentParticipantables()
|
public function appointmentParticipantables()
|
||||||
{
|
{
|
||||||
return $this->morphMany(AppointmentParticipant::class, 'participantable');
|
return $this->morphMany(AppointmentParticipant::class, 'participantable');
|
||||||
|
|||||||
@@ -182,7 +182,63 @@ class Plan extends Model
|
|||||||
return $this->belongsToMany(Benefit::class, 'corporate_benefits', 'plan_id', 'benefit_id')
|
return $this->belongsToMany(Benefit::class, 'corporate_benefits', 'plan_id', 'benefit_id')
|
||||||
->withTimestamps()
|
->withTimestamps()
|
||||||
->withPivot([
|
->withPivot([
|
||||||
// TODO corporate_benefits pivot
|
'corporate_id',
|
||||||
|
'plan_id',
|
||||||
|
'benefit_id',
|
||||||
|
'corporate_benefit_code',
|
||||||
|
'budget',
|
||||||
|
'budget_conditions',
|
||||||
|
'budget_code',
|
||||||
|
'primary_benefit_code',
|
||||||
|
'benefit_mode',
|
||||||
|
'room_class_coverage',
|
||||||
|
'max_bed_coverage',
|
||||||
|
'tolerance_parameter',
|
||||||
|
'max_room_class',
|
||||||
|
'limit_amount',
|
||||||
|
'area_limit',
|
||||||
|
'shared_benefit',
|
||||||
|
'shared_benefit_type',
|
||||||
|
'msc',
|
||||||
|
'genders',
|
||||||
|
'min_age',
|
||||||
|
'max_age',
|
||||||
|
'max_frequency_period',
|
||||||
|
'daily_frequency',
|
||||||
|
'weekly_frequency',
|
||||||
|
'monthly_frequency',
|
||||||
|
'yearly_frequency',
|
||||||
|
'custom_frequency_days',
|
||||||
|
'custom_duration_value',
|
||||||
|
'allowed_transaction_types',
|
||||||
|
'high_plan_factor',
|
||||||
|
'pre_post_treatment',
|
||||||
|
'pre_treatment_days',
|
||||||
|
'post_treatment_days',
|
||||||
|
'layer_type_1',
|
||||||
|
'layer_value_1',
|
||||||
|
'layer_type_2',
|
||||||
|
'layer_value_2',
|
||||||
|
'cashless_percentage',
|
||||||
|
'reimbursement_percentage',
|
||||||
|
'digital_percentage',
|
||||||
|
'co_share_m_percentage',
|
||||||
|
'co_share_s_percentage',
|
||||||
|
'co_share_c_percentage',
|
||||||
|
'cashless_deductible',
|
||||||
|
'reimbursement_deductible',
|
||||||
|
'digital_deductible',
|
||||||
|
'co_share_m_deductible',
|
||||||
|
'co_share_s_deductible',
|
||||||
|
'co_share_c_deductible',
|
||||||
|
'prorate_type',
|
||||||
|
'prorate_lookup',
|
||||||
|
'max_days_for_disability',
|
||||||
|
'max_period_for_disability',
|
||||||
|
'currency',
|
||||||
|
'show_benefit_item',
|
||||||
|
'show_benefit_value',
|
||||||
|
'active'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,4 +246,9 @@ class Plan extends Model
|
|||||||
{
|
{
|
||||||
return $this->hasMany(CorporateBenefit::class, 'plan_id', 'id');
|
return $this->hasMany(CorporateBenefit::class, 'plan_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function service()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Service::class, 'service_code', 'code');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,9 @@ class Service extends Model
|
|||||||
'name',
|
'name',
|
||||||
'description',
|
'description',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function corporateService()
|
||||||
|
{
|
||||||
|
return $this->hasMany(CorporateService::class, 'service_code', 'code');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,11 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Laravel\Sanctum\HasApiTokens;
|
use Laravel\Sanctum\HasApiTokens;
|
||||||
|
use Spatie\Permission\Traits\HasRoles;
|
||||||
|
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
use HasApiTokens, HasFactory, Notifiable;
|
use HasApiTokens, HasFactory, Notifiable, HasRoles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
@@ -48,13 +49,26 @@ class User extends Authenticatable
|
|||||||
];
|
];
|
||||||
|
|
||||||
public $with = [
|
public $with = [
|
||||||
'metas'
|
'metas',
|
||||||
|
'person'
|
||||||
];
|
];
|
||||||
|
|
||||||
public $appends = [
|
public $appends = [
|
||||||
'meta'
|
'meta',
|
||||||
|
'avatar_url',
|
||||||
|
'full_name'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function getAvatarUrlAttribute()
|
||||||
|
{
|
||||||
|
return asset('images/specialities/anak.png');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFullNameAttribute()
|
||||||
|
{
|
||||||
|
return $this->person?->full_name;
|
||||||
|
}
|
||||||
|
|
||||||
public function getMetaAttribute()
|
public function getMetaAttribute()
|
||||||
{
|
{
|
||||||
$orgMeta = [];
|
$orgMeta = [];
|
||||||
|
|||||||
61
app/Notifications/ClaimRequestedNotification.php
Normal file
61
app/Notifications/ClaimRequestedNotification.php
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Notifications;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
use Illuminate\Notifications\Notification;
|
||||||
|
|
||||||
|
class ClaimRequestedNotification extends Notification implements ShouldQueue
|
||||||
|
{
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new notification instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the notification's delivery channels.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function via($notifiable)
|
||||||
|
{
|
||||||
|
return ['database'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the mail representation of the notification.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||||
|
*/
|
||||||
|
public function toMail($notifiable)
|
||||||
|
{
|
||||||
|
return (new MailMessage)
|
||||||
|
->line('The introduction to the notification.')
|
||||||
|
->action('Notification Action', url('/'))
|
||||||
|
->line('Thank you for using our application!');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the array representation of the notification.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray($notifiable)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'asdasd' => 'asdasdsd'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use App\Rules\NikRule;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Str;
|
use Str;
|
||||||
|
|
||||||
|
|||||||
36
app/Providers/ClaimRequested.php
Normal file
36
app/Providers/ClaimRequested.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Broadcasting\Channel;
|
||||||
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
|
use Illuminate\Broadcasting\PresenceChannel;
|
||||||
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||||
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class ClaimRequested
|
||||||
|
{
|
||||||
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new event instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the channels the event should broadcast on.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Broadcasting\Channel|array
|
||||||
|
*/
|
||||||
|
public function broadcastOn()
|
||||||
|
{
|
||||||
|
return new PrivateChannel('channel-name');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ namespace App\Providers;
|
|||||||
|
|
||||||
use App\Events\ClaimApproved;
|
use App\Events\ClaimApproved;
|
||||||
use App\Listeners\LogClaimJournal;
|
use App\Listeners\LogClaimJournal;
|
||||||
|
use App\Listeners\NotifyClaimRequested;
|
||||||
use Illuminate\Auth\Events\Registered;
|
use Illuminate\Auth\Events\Registered;
|
||||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||||
@@ -21,9 +22,14 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
SendEmailVerificationNotification::class,
|
SendEmailVerificationNotification::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
|
ClaimRequested::class => [
|
||||||
|
NotifyClaimRequested::class,
|
||||||
|
],
|
||||||
|
|
||||||
ClaimApproved::class => [
|
ClaimApproved::class => [
|
||||||
LogClaimJournal::class,
|
LogClaimJournal::class,
|
||||||
]
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,6 +49,6 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function shouldDiscoverEvents()
|
public function shouldDiscoverEvents()
|
||||||
{
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user