Merge remote-tracking branch 'origin/staging' into origin/production

This commit is contained in:
Linksehat Staging Server
2024-01-24 15:47:24 +07:00
6 changed files with 103 additions and 66 deletions

View File

@@ -21,21 +21,21 @@ class RequestLogService
private static $code_prefix = 'LOG'; private static $code_prefix = 'LOG';
public $doc_headers_to_field_map = [ public $doc_headers_to_field_map = [
"Date Of Request" => "submission_date", "Record Mode" => "record_mode",
"Date Addmission" => "submission_date", "Date Addmission" => "submission_date",
"Date Discharge" => "discharge_date", "Date Discharge" => "discharge_date",
"Member ID Peserta" => "member_id", "Member ID Peserta" => "member_id",
"Type of patient" => "service", "Type of patient" => "service",
"Provider Name" => "organization_id", "Provider Code" => "organization_id",
"End Of Claim Numbers" => "code", "End Of Claim Numbers" => "code",
"Remarks" => "keterangan", "Diagnosis" => "diagnosis",
"Diagnosis" => "catatan",
"Tgl Billing dari RS" => "approved_final_log_at", "Tgl Billing dari RS" => "approved_final_log_at",
"Benefit Item" => "benefit_id",
"Total Billing" => "total_billing", "Total Billing" => "total_billing",
"Benefit Item" => "benefit_id",
"Amount Approval" => "amount_approval", "Amount Approval" => "amount_approval",
"Amount Not Approval" => "amount_not_approval", "Amount Not Approval" => "amount_not_approval",
"Final Billing" => "final_billing", "Final Billing" => "final_billing",
"Remarks" => "keterangan",
"QC 1" => "status_final_log", "QC 1" => "status_final_log",
"Ingestion Code" => "ingestion_code", // TODO I think this should not be here because if user uploading result then ingestion code and status will be filled "Ingestion Code" => "ingestion_code", // TODO I think this should not be here because if user uploading result then ingestion code and status will be filled
"Ingestion Status" => "ingestion_status", "Ingestion Status" => "ingestion_status",
@@ -43,20 +43,20 @@ class RequestLogService
]; ];
public $field_to_doc_headers_map = [ public $field_to_doc_headers_map = [
"submission_date" => "Date Of Request", "record_mode" => "Record Mode",
"submission_date" => "Date Addmission", "submission_date" => "Date Addmission",
"discharge_date" => "Date Discharge", "discharge_date" => "Date Discharge",
"member_id" => "Member ID Peserta", "member_id" => "Member ID Peserta",
"service" => "Type of patient", "service" => "Type of patient",
"organization_id" => "Provider Name", "organization_id" => "Provider Code",
"code" => "End Of Claim Numbers", "code" => "End Of Claim Numbers",
"keterangan" => "Remarks", "diagnosis" => "Diagnosis",
"catatan" => "Diagnosis",
"approved_final_log_at" => "Tgl Billing dari RS", "approved_final_log_at" => "Tgl Billing dari RS",
"benefit_id" => "Benefit Item",
"total_billing" => "Total Billing", "total_billing" => "Total Billing",
"benefit_id" => "Benefit Item",
"amount_approval" => "Amount Approval", "amount_approval" => "Amount Approval",
"amount_not_approval" => "Amount Not Approval", "amount_not_approval" => "Amount Not Approval",
"keterangan" => "Remarks",
"final_billing" => "Final Billing", "final_billing" => "Final Billing",
"status_final_log" => "QC 1" , "status_final_log" => "QC 1" ,
"ingestion_code" => "Ingestion Code", "ingestion_code" => "Ingestion Code",
@@ -64,42 +64,42 @@ class RequestLogService
]; ];
public $result_doc_headers = [ public $result_doc_headers = [
"Date Of Request", "Record Mode",
"Date Addmission", "Date Addmission",
"Date Discharge", "Date Discharge",
"Member ID Peserta", "Member ID Peserta",
"Type of patient", "Type of patient",
"Provider Name", "Provider Code",
"End Of Claim Numbers", "End Of Claim Numbers",
"Remarks",
"Diagnosis", "Diagnosis",
"Tgl Billing dari RS", "Tgl Billing dari RS",
"Benefit Item",
"Total Billing", "Total Billing",
"Benefit Item",
"Amount Approval", "Amount Approval",
"Amount Not Approval", "Amount Not Approval",
"Final Billing", "Final Billing",
"Remarks",
"QC 1", "QC 1",
"Ingestion Code", "Ingestion Code",
"Ingestion Status", "Ingestion Status",
]; ];
public $listing_doc_headers = [ public $listing_doc_headers = [
"Date Of Request", "Record Mode",
"Date Addmission", "Date Addmission",
"Date Discharge", "Date Discharge",
"Member ID Peserta", "Member ID Peserta",
"Type of patient", "Type of patient",
"Provider Name", "Provider Code",
"End Of Claim Numbers", "End Of Claim Numbers",
"Remarks",
"Diagnosis", "Diagnosis",
"Tgl Billing dari RS", "Tgl Billing dari RS",
"Benefit Item",
"Total Billing", "Total Billing",
"Benefit Item",
"Amount Approval", "Amount Approval",
"Amount Not Approval", "Amount Not Approval",
"Final Billing", "Final Billing",
"Remarks",
"QC 1", "QC 1",
"Ingestion Code", "Ingestion Code",
"Ingestion Status", "Ingestion Status",
@@ -152,35 +152,44 @@ class RequestLogService
throw new ImportRowException(__('Format Date Invalid'), 0, null, $row); throw new ImportRowException(__('Format Date Invalid'), 0, null, $row);
} }
// Membuat singkatan dari nama rumah sakit if (!$row['organization_id']){
$singkatan = ""; throw new ImportRowException(__('Provider Required'), 0, null, $row);
$words = explode(' ', $row['organization_id']);
foreach ($words as $word) {
$singkatan .= strtoupper(substr($word, 0, 1));
} }
// Membuat singkatan dari nama rumah sakit
// $singkatan = "";
// $words = explode(' ', $row['organization_id']);
// foreach ($words as $word) {
// $singkatan .= strtoupper(substr($word, 0, 1));
// }
// Membuat kode organisasi // Membuat kode organisasi
$kodeOrganisasi = "ORG000" . $singkatan; // $kodeOrganisasi = "ORG000" . $singkatan;
// Insert data ke tabel organizations // Insert data ke tabel organizations
$organization = DB::table('organizations')->where('code', $kodeOrganisasi)->first(); $organization = DB::table('organizations')->where('code', $row['organization_id'])->first();
// dd( $organization);
if ($organization) { if (!$organization){
$organization_id = $organization->id; throw new ImportRowException(__('Provider Not Found'), 0, null, $row);
} else {
$organization_id = DB::table('organizations')
->insertGetId([
'name' => $row['organization_id'],
'code' => $kodeOrganisasi,
'type' => 'hospital',
'created_at' => now(),
'created_by' => auth()->user()->id
]);
} }
// if ($organization) {
$organization_id = $organization->id;
// } else {
// $organization_id = DB::table('organizations')
// ->insertGetId([
// 'name' => $row['organization_id'],
// 'code' => $kodeOrganisasi,
// 'type' => 'hospital',
// 'created_at' => now(),
// 'created_by' => auth()->user()->id
// ]);
// }
$data = [ $data = [
'source' => 'H', 'source' => 'H',
'provideCode' => $kodeOrganisasi , // 'provideCode' => $kodeOrganisasi ,
'provideCode' => $organization->code ,
'date' => $this->dateParserCode($row['submission_date']), 'date' => $this->dateParserCode($row['submission_date']),
'policy' => $member->currentPolicy->code, 'policy' => $member->currentPolicy->code,
'member_code' => $row['member_id'] 'member_code' => $row['member_id']
@@ -212,7 +221,7 @@ class RequestLogService
$final_log = 1; $final_log = 1;
} }
if ($row['catatan']){ if ($row['diagnosis']){
$data = [ $data = [
'code' => $code, 'code' => $code,
'member_id' => $member->id, 'member_id' => $member->id,
@@ -227,7 +236,7 @@ class RequestLogService
'keterangan' => $row['keterangan'], 'keterangan' => $row['keterangan'],
'policy_id' => $member->currentPolicy->id ?? null, 'policy_id' => $member->currentPolicy->id ?? null,
'organization_id' => $organization_id, 'organization_id' => $organization_id,
'diagnosis' => $row['catatan'], 'diagnosis' => $row['diagnosis'],
'service_code' => $serviceCode, 'service_code' => $serviceCode,
'approved_final_log_at' => $row['approved_final_log_at'], 'approved_final_log_at' => $row['approved_final_log_at'],
]; ];
@@ -242,7 +251,7 @@ class RequestLogService
'status_final_log' => $statusFinalLog, 'status_final_log' => $statusFinalLog,
'final_log' =>$final_log, 'final_log' =>$final_log,
'import_system' =>TRUE, 'import_system' =>TRUE,
// 'catatan' => $row['catatan'], 'diagnosis' => $row['diagnosis'],
'keterangan' => $row['keterangan'], 'keterangan' => $row['keterangan'],
'policy_id' => $member->currentPolicy->id ?? null, 'policy_id' => $member->currentPolicy->id ?? null,
'organization_id' => $organization_id, 'organization_id' => $organization_id,
@@ -251,25 +260,31 @@ class RequestLogService
]; ];
} }
$requestLog = RequestLog::updateOrCreate( if ($row['record_mode'] == 1){
[ $requestLog = RequestLog::updateOrCreate(["code" => $code], $data);
'code' => $code, } else if ($row['record_mode'] == 2) {
], $requestLog = RequestLog::updateOrCreate(
$data); [
'member_id' => $member->id,
'submission_date' => $row['submission_date'],
'organization_id' => $organization_id,
],
$data
);
}
if ($benefit) { // jika tidak ada benefit nya maka belum ngisi benefit nya if ($benefit) { // jika tidak ada benefit nya maka belum ngisi benefit nya
// Delete item // Delete item
if ($row['final_billing']){ if ($row['total_billing']){
RequestLogBenefit::where('request_log_id', '=', $requestLog->id)->delete(); RequestLogBenefit::where('request_log_id', '=', $requestLog->id)->delete();
} }
// Insert Item // Insert Item
RequestLogBenefit::create( RequestLogBenefit::create(
[ [
'request_log_id' => $requestLog->id, 'request_log_id' => $requestLog->id,
'benefit_id' => $benefit->id, 'benefit_id' => $benefit->id,
'amount_incurred' => ($row['amount_approval'] ? $row['amount_approval'] : 0) + ($row['amount_not_approval'] ? $row['amount_not_approval'] : 0) , // 'amount_incurred' => ($row['amount_approval'] ? $row['amount_approval'] : 0) + ($row['amount_not_approval'] ? $row['amount_not_approval'] : 0) ,
'amount_incurred' => $row['total_billing'] ,
'amount_approved' => $row['amount_approval'] ?? 0, 'amount_approved' => $row['amount_approval'] ?? 0,
'amount_not_approved' => $row['amount_not_approval'] ?? 0, 'amount_not_approved' => $row['amount_not_approval'] ?? 0,
'excess_paid' => $row['amount_not_approval'] ?? 0, 'excess_paid' => $row['amount_not_approval'] ?? 0,
@@ -277,8 +292,6 @@ class RequestLogService
]); ]);
} }
// Commit transaksi // Commit transaksi
DB::commit(); DB::commit();
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@@ -8,6 +8,7 @@ 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\Database\Eloquent\SoftDeletes;
use Altek\Accountant\Contracts\Recordable;
use Str; use Str;
class RequestLog extends Model class RequestLog extends Model
@@ -56,36 +57,42 @@ class RequestLog extends Model
]; ];
public static $doc_headers_to_field_map = [ public static $doc_headers_to_field_map = [
"Date Of Request" => "submission_date", "Record Mode" => "record_mode",
"Date Addmission" => "submission_date", "Date Addmission" => "submission_date",
"Date Discharge" => "discharge_date",
"Member ID Peserta" => "member_id", "Member ID Peserta" => "member_id",
"Type of patient" => "service", "Type of patient" => "service",
"Provider Name" => "organization_id", "Provider Code" => "organization_id",
"End Of Claim Numbers" => "code", "End Of Claim Numbers" => "code",
"Remarks" => "keterangan", "Remarks" => "keterangan",
"Diagnosis" => "catatan", "Diagnosis" => "catatan",
"Tgl Billing dari RS" => "approved_final_log_at", "Tgl Billing dari RS" => "approved_final_log_at",
"Benefit Item" => "benefit_id",
"Total Billing" => "total_billing", "Total Billing" => "total_billing",
"Benefit Item" => "benefit_id",
"Amount Approval" => "amount_approval", "Amount Approval" => "amount_approval",
"Amount Not Approval" => "amount_not_approval", "Amount Not Approval" => "amount_not_approval",
"Final Billing" => "final_billing",
"Remarks" => "keterangan",
"QC 1" => "status_final_log", "QC 1" => "status_final_log",
]; ];
public static $listing_doc_headers = [ public static $listing_doc_headers = [
"Date Of Request", "Record Mode",
"Date Addmission", "Date Addmission",
"Date Discharge",
"Member ID Peserta", "Member ID Peserta",
"Type of patient", "Type of patient",
"Provider Name", "Provider Code",
"End Of Claim Numbers", "End Of Claim Numbers",
"Remarks", "Remarks",
"Diagnosis", "Diagnosis",
"Tgl Billing dari RS", "Tgl Billing dari RS",
"Benefit Item",
"Total Billing", "Total Billing",
"Benefit Item",
"Amount Approval", "Amount Approval",
"Amount Not Approval", "Amount Not Approval",
"Final Billing",
"Remarks",
"QC 1", "QC 1",
]; ];

View File

@@ -4,6 +4,7 @@ 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 Altek\Accountant\Contracts\Recordable;
class RequestLogBenefit extends Model class RequestLogBenefit extends Model
{ {

View File

@@ -20,6 +20,8 @@ use App\Models\Icd;
use App\Models\IcdTemplate; use App\Models\IcdTemplate;
use App\Models\FormulariumTemplate; use App\Models\FormulariumTemplate;
use App\Models\AuditTrail; use App\Models\AuditTrail;
use App\Models\RequestLog;
use App\Models\RequestLogBenefit;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use App\Models\OLDLMS\PersonalAccessToken; use App\Models\OLDLMS\PersonalAccessToken;
@@ -170,6 +172,22 @@ class AppServiceProvider extends ServiceProvider
$this->logAuditTrail($model, 'deleted'); $this->logAuditTrail($model, 'deleted');
}); });
// Request LOG Template
RequestLog::updated(function ($model) {
$this->logAuditTrail($model, 'updated');
});
RequestLog::deleted(function ($model) {
$this->logAuditTrail($model, 'deleted');
});
// Request LOG Template
RequestLogBenefit::updated(function ($model) {
$this->logAuditTrail($model, 'updated');
});
RequestLogBenefit::deleted(function ($model) {
$this->logAuditTrail($model, 'deleted');
});
// Formualrium Template // Formualrium Template
CorporateFormularium::updated(function ($model) { CorporateFormularium::updated(function ($model) {
$this->logAuditTrail($model, 'updated'); $this->logAuditTrail($model, 'updated');

View File

@@ -85,11 +85,8 @@ export default function DialogEditFinalLOG({requestLog, setOpenDialog, openDialo
.then((response) => { .then((response) => {
enqueueSnackbar('Verification Request LOG Success', { variant: 'success' }); enqueueSnackbar('Verification Request LOG Success', { variant: 'success' });
setOpenDialog(false); setOpenDialog(false);
if (requestLog?.service_type == 'Inpatient'){ navigate('/custormer-service/final-log/detail/' + requestLog?.id)
navigate('/case_management/inpatient_monitoring'); window.location.reload()
} else {
navigate('/custormer-service/final-log');
}
}) })
.catch(({ response }) => { .catch(({ response }) => {
enqueueSnackbar(response.data.message ?? 'Something went wrong!', { variant: 'error' }); enqueueSnackbar(response.data.message ?? 'Something went wrong!', { variant: 'error' });
@@ -183,7 +180,7 @@ export default function DialogEditFinalLOG({requestLog, setOpenDialog, openDialo
variant="outlined" variant="outlined"
fullWidth fullWidth
type="date" type="date"
value={formData.discharge_date ? fDateOnly(formData.discharge_date) : ''} value={formData.discharge_date ? fDateOnly(formData.discharge_date) : '-'}
onChange={(e) => handleChange('discharge_date', e.target.value)} onChange={(e) => handleChange('discharge_date', e.target.value)}
/> />
</Stack> </Stack>

View File

@@ -71,7 +71,8 @@ export default function DialogEditInformation({requestLog, setOpenDialog, openDi
.then((response) => { .then((response) => {
enqueueSnackbar('Verification Request LOG Success', { variant: 'success' }); enqueueSnackbar('Verification Request LOG Success', { variant: 'success' });
setOpenDialog(false); setOpenDialog(false);
navigate('/custormer-service/request') navigate('/custormer-service/request/detail/' + requestLog?.id)
window.location.reload()
}) })
.catch(({ response }) => { .catch(({ response }) => {
enqueueSnackbar(response.data.message ?? 'Something went wrong!', { variant: 'error' }); enqueueSnackbar(response.data.message ?? 'Something went wrong!', { variant: 'error' });