Merge branch 'feature/primaya' into staging
This commit is contained in:
@@ -488,6 +488,7 @@ class RequestLogController extends Controller
|
||||
'members.birth_date',
|
||||
'members.member_id',
|
||||
'members.gender',
|
||||
'corporate_employees.branch_code',
|
||||
DB::raw('
|
||||
(Select persons.nik FROM persons WHERE persons.id = members.person_id LIMIT 1) AS nik
|
||||
'),
|
||||
@@ -535,6 +536,7 @@ class RequestLogController extends Controller
|
||||
'members.members_effective_date AS mulai',
|
||||
'members.members_expire_date AS akhir'
|
||||
)
|
||||
->leftJoin('corporate_employees', 'corporate_employees.member_id', '=', 'members.id')
|
||||
->first();
|
||||
$data['namaKaryawan'] = '';
|
||||
if($dataMember->principal_id)
|
||||
@@ -613,6 +615,44 @@ class RequestLogController extends Controller
|
||||
|
||||
$data['signatureAd'] = $signatureAd;
|
||||
|
||||
$namaPenjaminTtd = $dataMember->nama_perusahaan;
|
||||
|
||||
$isVale = ($logoPerusahaan->code ?? null) === "VALEIND";
|
||||
$ttdNama = '';
|
||||
$ttdJabatan = '';
|
||||
$ttdImage = null;
|
||||
|
||||
if ($isVale) {
|
||||
if ($dataRequestLog->submission_date <= '2025-05-12') {
|
||||
$ttdNama = 'Dr. Hery Hermas, M.Kes';
|
||||
$ttdImage = public_path('images/ttd_dr_vale.png');
|
||||
} else {
|
||||
$ttdNama = 'dr. Irmawati Baso, S. Ked., MM';
|
||||
$ttdImage = public_path('images/ttd_dr_irma_2.png');
|
||||
}
|
||||
|
||||
$ttdJabatan = 'Offsite Medical Treatment';
|
||||
|
||||
} else {
|
||||
$ttdNama = 'Fariz Ariyadi';
|
||||
$ttdJabatan = 'Chief Executive Officer';
|
||||
$ttdImage = public_path('images/ttd_fariz.png');
|
||||
}
|
||||
|
||||
$data['ttdNama'] = $ttdNama;
|
||||
$data['ttdJabatan'] = $ttdJabatan;
|
||||
$data['ttdImage'] = $ttdImage;
|
||||
|
||||
if (!$isVale) {
|
||||
$namaPenjaminTtd = 'Primayan Medicare';
|
||||
}
|
||||
|
||||
$data['namaPenjaminTtd'] = $namaPenjaminTtd;
|
||||
|
||||
if (!$isVale) {
|
||||
$data['penjamin'] = 'Primayan Medicare';
|
||||
}
|
||||
|
||||
$pdf = new Dompdf();
|
||||
|
||||
$options = new Options();
|
||||
@@ -623,25 +663,47 @@ class RequestLogController extends Controller
|
||||
|
||||
$pdf->setPaper('A4', 'portrait');
|
||||
|
||||
// Halaman 1
|
||||
$html1 = view('pdf.req_log_page_1', $data);
|
||||
if (!$isVale) {
|
||||
// Halaman 1
|
||||
$html1 = view('pdf.req_log_page_1_primayan', $data);
|
||||
|
||||
// Halaman 2
|
||||
// $html2 = view('pdf.req_log_page_2', $data);
|
||||
// Halaman 2
|
||||
// $html2 = view('pdf.req_log_page_2', $data);
|
||||
|
||||
// Gabung konten HTML dari dua tampilan
|
||||
// $htmlCombined = $html1 . $html2;
|
||||
$htmlCombined = $html1;
|
||||
// Gabung konten HTML dari dua tampilan
|
||||
// $htmlCombined = $html1 . $html2;
|
||||
$htmlCombined = $html1;
|
||||
|
||||
$pdf->loadHtml($htmlCombined);
|
||||
$pdf->render();
|
||||
$pdf->loadHtml($htmlCombined);
|
||||
$pdf->render();
|
||||
|
||||
$headers = [
|
||||
'Content-Type' => 'application/pdf',
|
||||
'Content-Disposition' => 'inline; filename="file.pdf"',
|
||||
];
|
||||
$headers = [
|
||||
'Content-Type' => 'application/pdf',
|
||||
'Content-Disposition' => 'inline; filename="file.pdf"',
|
||||
];
|
||||
|
||||
return response($pdf->output(), 200, $headers);
|
||||
return response($pdf->output(), 200, $headers);
|
||||
} else {
|
||||
// Halaman 1
|
||||
$html1 = view('pdf.req_log_page_1', $data);
|
||||
|
||||
// Halaman 2
|
||||
// $html2 = view('pdf.req_log_page_2', $data);
|
||||
|
||||
// Gabung konten HTML dari dua tampilan
|
||||
// $htmlCombined = $html1 . $html2;
|
||||
$htmlCombined = $html1;
|
||||
|
||||
$pdf->loadHtml($htmlCombined);
|
||||
$pdf->render();
|
||||
|
||||
$headers = [
|
||||
'Content-Type' => 'application/pdf',
|
||||
'Content-Disposition' => 'inline; filename="file.pdf"',
|
||||
];
|
||||
|
||||
return response($pdf->output(), 200, $headers);
|
||||
}
|
||||
}
|
||||
|
||||
public function downlodFinalLog($request_log_id)
|
||||
@@ -660,6 +722,7 @@ class RequestLogController extends Controller
|
||||
'members.birth_date',
|
||||
'members.member_id',
|
||||
'members.gender',
|
||||
'corporate_employees.branch_code',
|
||||
DB::raw('
|
||||
(Select persons.nik FROM persons WHERE persons.id = members.person_id LIMIT 1) AS nik
|
||||
'),
|
||||
@@ -707,6 +770,7 @@ class RequestLogController extends Controller
|
||||
'members.members_effective_date AS mulai',
|
||||
'members.members_expire_date AS akhir'
|
||||
)
|
||||
->leftJoin('corporate_employees', 'corporate_employees.member_id', '=', 'members.id')
|
||||
->first();
|
||||
$data['namaKaryawan'] = '';
|
||||
if($dataMember->principal_id)
|
||||
@@ -809,6 +873,44 @@ class RequestLogController extends Controller
|
||||
|
||||
$data['signatureAd'] = $signatureAd;
|
||||
|
||||
$namaPenjaminTtd = $dataMember->nama_perusahaan;
|
||||
|
||||
$isVale = ($logoPerusahaan->code ?? null) === "VALEIND";
|
||||
$ttdNama = '';
|
||||
$ttdJabatan = '';
|
||||
$ttdImage = null;
|
||||
|
||||
if ($isVale) {
|
||||
if ($dataRequestLog->submission_date <= '2025-05-12') {
|
||||
$ttdNama = 'Dr. Hery Hermas, M.Kes';
|
||||
$ttdImage = public_path('images/ttd_dr_vale.png');
|
||||
} else {
|
||||
$ttdNama = 'dr. Irmawati Baso, S. Ked., MM';
|
||||
$ttdImage = public_path('images/ttd_dr_irma_2.png');
|
||||
}
|
||||
|
||||
$ttdJabatan = 'Offsite Medical Treatment';
|
||||
|
||||
} else {
|
||||
$ttdNama = 'Fariz Ariyadi';
|
||||
$ttdJabatan = 'Chief Executive Officer';
|
||||
$ttdImage = public_path('images/ttd_fariz.png');
|
||||
}
|
||||
|
||||
$data['ttdNama'] = $ttdNama;
|
||||
$data['ttdJabatan'] = $ttdJabatan;
|
||||
$data['ttdImage'] = $ttdImage;
|
||||
|
||||
if (!$isVale) {
|
||||
$namaPenjaminTtd = 'Primayan Medicare';
|
||||
}
|
||||
|
||||
$data['namaPenjaminTtd'] = $namaPenjaminTtd;
|
||||
|
||||
if (!$isVale) {
|
||||
$data['penjamin'] = 'Primayan Medicare';
|
||||
}
|
||||
|
||||
$dataDiagnosis = [];
|
||||
if($dataRequestLog->diagnosis)
|
||||
{
|
||||
@@ -825,6 +927,9 @@ class RequestLogController extends Controller
|
||||
|
||||
$data['dataDiagnosis'] = $dataDiagnosis;
|
||||
|
||||
if (($logoPerusahaan->code ?? null) !== "VALEIND") {
|
||||
$data['penjamin'] = 'Primayan Medicare';
|
||||
}
|
||||
|
||||
$pdf = new Dompdf();
|
||||
|
||||
@@ -834,24 +939,45 @@ class RequestLogController extends Controller
|
||||
$options->set(['isRemoteEnabled' => true]);
|
||||
$pdf->setOptions($options);
|
||||
|
||||
// Halaman 1
|
||||
$html1 = view('pdf.final_log_page_1', $data);
|
||||
if (!$isVale) {
|
||||
// Halaman 1
|
||||
$html1 = view('pdf.final_log_page_1_primayan', $data);
|
||||
|
||||
// Halaman 2
|
||||
$html2 = view('pdf.final_log_page_2', $data);
|
||||
// Halaman 2
|
||||
$html2 = view('pdf.final_log_page_2_primayan', $data);
|
||||
|
||||
// Gabung konten HTML dari dua tampilan
|
||||
$htmlCombined = $html1 . $html2;
|
||||
// Gabung konten HTML dari dua tampilan
|
||||
$htmlCombined = $html1 . $html2;
|
||||
|
||||
$pdf->loadHtml($htmlCombined);
|
||||
$pdf->render();
|
||||
$pdf->loadHtml($htmlCombined);
|
||||
$pdf->render();
|
||||
|
||||
$headers = [
|
||||
'Content-Type' => 'application/pdf',
|
||||
'Content-Disposition' => 'inline; filename="file.pdf"',
|
||||
];
|
||||
$headers = [
|
||||
'Content-Type' => 'application/pdf',
|
||||
'Content-Disposition' => 'inline; filename="file.pdf"',
|
||||
];
|
||||
|
||||
return response($pdf->output(), 200, $headers);
|
||||
return response($pdf->output(), 200, $headers);
|
||||
} else {
|
||||
// Halaman 1
|
||||
$html1 = view('pdf.final_log_page_1', $data);
|
||||
|
||||
// Halaman 2
|
||||
$html2 = view('pdf.final_log_page_2', $data);
|
||||
|
||||
// Gabung konten HTML dari dua tampilan
|
||||
$htmlCombined = $html1 . $html2;
|
||||
|
||||
$pdf->loadHtml($htmlCombined);
|
||||
$pdf->render();
|
||||
|
||||
$headers = [
|
||||
'Content-Type' => 'application/pdf',
|
||||
'Content-Disposition' => 'inline; filename="file.pdf"',
|
||||
];
|
||||
|
||||
return response($pdf->output(), 200, $headers);
|
||||
}
|
||||
}
|
||||
|
||||
public function submitClaims(Request $request)
|
||||
|
||||
@@ -246,4 +246,160 @@ class RequestLogController extends Controller
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function requestLogAwal(Request $request)
|
||||
{
|
||||
$data = [
|
||||
'member_id' => $request->member_id,
|
||||
'service_code' => $request->service_code,
|
||||
'organization_id' => $request->organization_id,
|
||||
'organization_name' => !empty($request->organization_name) ? $request->organization_name : null,
|
||||
'address_provider' => !empty($request->address_provider) ? $request->address_provider : null,
|
||||
'submission_date' => $request->submission_date,
|
||||
'corporate_id_partner' => !empty($request->corporate_id_partner) ? $request->corporate_id_partner : [],
|
||||
'specialities_id' => $request->specialities_id,
|
||||
'dppj' => $request->dppj
|
||||
];
|
||||
$validator = Validator::make($request->all(), [
|
||||
'member_id' => 'required',
|
||||
'service_code' => 'required',
|
||||
'submission_date' => 'required',
|
||||
'specialities_id' => 'required',
|
||||
'dppj' => 'required',
|
||||
], [
|
||||
'member_id.required' => trans('Validation.required',['attribute' => 'Member ID']),
|
||||
'service_code.required' => trans('Validation.required',['attribute' => 'Service Code']),
|
||||
'submission_date.required' => trans('Validation.required',['attribute' => 'Submission Date']),
|
||||
'specialities_id.required' => trans('Validation.required',['attribute' => 'Specialities']),
|
||||
'dppj.required' => trans('Validation.required',['attribute' => 'DPJP']),
|
||||
]);
|
||||
if(!empty($request->organization_id))
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'organization_id' => 'required',
|
||||
'member_id' => 'required',
|
||||
'service_code' => 'required',
|
||||
'submission_date' => 'required',
|
||||
'specialities_id' => 'required',
|
||||
'dppj' => 'required',
|
||||
], [
|
||||
'organization_id.required' => trans('Validation.required',['attribute' => 'Provider ID']),
|
||||
'member_id.required' => trans('Validation.required',['attribute' => 'Member ID']),
|
||||
'service_code.required' => trans('Validation.required',['attribute' => 'Service Code']),
|
||||
'submission_date.required' => trans('Validation.required',['attribute' => 'Submission Date']),
|
||||
'specialities_id.required' => trans('Validation.required',['attribute' => 'Specialities']),
|
||||
'dppj.required' => trans('Validation.required',['attribute' => 'DPJP']),
|
||||
]);
|
||||
}
|
||||
if ($validator->fails())
|
||||
{
|
||||
return ApiResponse::apiResponse('Bad Request', $data, $validator->errors(), 400);
|
||||
}
|
||||
else
|
||||
{
|
||||
//insert data to organization
|
||||
try {
|
||||
if (!empty($request->organization_name) && !empty($request->address_provider))
|
||||
{
|
||||
// Memulai transaksi
|
||||
DB::beginTransaction();
|
||||
|
||||
// Membuat singkatan dari nama rumah sakit
|
||||
$singkatan = "";
|
||||
$words = explode(' ', $request->organization_name);
|
||||
|
||||
foreach ($words as $word) {
|
||||
$singkatan .= strtoupper(substr($word, 0, 2));
|
||||
}
|
||||
|
||||
// Membuat kode organisasi
|
||||
$kodeOrganisasi = "ORG000" . $singkatan;
|
||||
|
||||
// Insert data ke tabel organizations
|
||||
$organization_id = DB::table('organizations')
|
||||
->insertGetId([
|
||||
'name' => $request->organization_name,
|
||||
'code' => $kodeOrganisasi,
|
||||
'type' => 'hospital',
|
||||
'corporate_id_partner' => $request->corporate_id_partner ? implode(',', $request->corporate_id_partner) : null,
|
||||
'created_at' => now(),
|
||||
// 'created_by' => auth()->user()->id
|
||||
]);
|
||||
|
||||
// Insert data ke tabel addresses
|
||||
$address_id = DB::table('addresses')
|
||||
->insertGetId([
|
||||
'text'=> $request->address_provider,
|
||||
'addressable_type' => 'App\Models\Organization',
|
||||
'addressable_id' => $organization_id,
|
||||
'type' => 'hospital',
|
||||
'created_at' => now(),
|
||||
// 'created_by' => auth()->user()->id
|
||||
]);
|
||||
|
||||
// Update main_address_id di tabel organizations
|
||||
DB::table('organizations')
|
||||
->where('organizations.id', '=', $organization_id)
|
||||
->update(['main_address_id' => $address_id]);
|
||||
|
||||
// Commit transaksi
|
||||
DB::commit();
|
||||
$request->merge(['organization_id' => $organization_id]);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
$requestLogControllerInstance = new PrimeCenterRequestLog();
|
||||
$code = $requestLogControllerInstance->getNextCode($request);
|
||||
|
||||
$member = Member::find($request->member_id);
|
||||
|
||||
$requestLogData = [
|
||||
'code' => $code,
|
||||
'member_id' => $request->member_id,
|
||||
'submission_date' => $request->submission_date ?? now(),
|
||||
'status' => 'requested',
|
||||
'payment_type' => 'cashless',
|
||||
'service_code' => $request->service_code,
|
||||
'policy_id' => $member->currentPolicy->id ?? null,
|
||||
'organization_id' => $request->organization_id ?? 0,
|
||||
'source' => $request->source,
|
||||
'specialities_id' => $request->specialities_id,
|
||||
'dppj' => $request->dppj
|
||||
];
|
||||
|
||||
// SIMPAN LOG
|
||||
$requestLog = RequestLog::create($requestLogData);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return ApiResponse::apiResponse(
|
||||
'Success Create Log',
|
||||
$requestLog,
|
||||
'Berhasil create LOG dan Benefit',
|
||||
200
|
||||
);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
DB::rollBack();
|
||||
|
||||
return ApiResponse::apiResponse(
|
||||
'Server Error Create Log',
|
||||
$data,
|
||||
$e->getMessage(),
|
||||
500
|
||||
);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// Rollback transaksi jika terjadi kesalahan
|
||||
DB::rollBack();
|
||||
|
||||
// Handle error, bisa di-log atau dikembalikan sebagai response
|
||||
return ApiResponse::apiResponse('Server Error 3', $data, $e->getMessage(), 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,10 @@ Route::prefix('v1')->group(function () {
|
||||
|
||||
// Request LOG
|
||||
Route::controller(RequestLogController::class)->group(function () {
|
||||
//Final
|
||||
Route::post('request-log', 'requestLog');
|
||||
//Awal
|
||||
Route::post('request-log-awal', 'requestLogAwal');
|
||||
});
|
||||
|
||||
Route::post('calculate-benefit', [MemberController::class, 'calculateBenefit']);
|
||||
|
||||
Reference in New Issue
Block a user