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';
public $doc_headers_to_field_map = [
"Date Of Request" => "submission_date",
"Record Mode" => "record_mode",
"Date Addmission" => "submission_date",
"Date Discharge" => "discharge_date",
"Member ID Peserta" => "member_id",
"Type of patient" => "service",
"Provider Name" => "organization_id",
"Provider Code" => "organization_id",
"End Of Claim Numbers" => "code",
"Remarks" => "keterangan",
"Diagnosis" => "catatan",
"Diagnosis" => "diagnosis",
"Tgl Billing dari RS" => "approved_final_log_at",
"Benefit Item" => "benefit_id",
"Total Billing" => "total_billing",
"Benefit Item" => "benefit_id",
"Amount Approval" => "amount_approval",
"Amount Not Approval" => "amount_not_approval",
"Final Billing" => "final_billing",
"Remarks" => "keterangan",
"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 Status" => "ingestion_status",
@@ -43,20 +43,20 @@ class RequestLogService
];
public $field_to_doc_headers_map = [
"submission_date" => "Date Of Request",
"record_mode" => "Record Mode",
"submission_date" => "Date Addmission",
"discharge_date" => "Date Discharge",
"member_id" => "Member ID Peserta",
"service" => "Type of patient",
"organization_id" => "Provider Name",
"organization_id" => "Provider Code",
"code" => "End Of Claim Numbers",
"keterangan" => "Remarks",
"catatan" => "Diagnosis",
"diagnosis" => "Diagnosis",
"approved_final_log_at" => "Tgl Billing dari RS",
"benefit_id" => "Benefit Item",
"total_billing" => "Total Billing",
"benefit_id" => "Benefit Item",
"amount_approval" => "Amount Approval",
"amount_not_approval" => "Amount Not Approval",
"keterangan" => "Remarks",
"final_billing" => "Final Billing",
"status_final_log" => "QC 1" ,
"ingestion_code" => "Ingestion Code",
@@ -64,42 +64,42 @@ class RequestLogService
];
public $result_doc_headers = [
"Date Of Request",
"Record Mode",
"Date Addmission",
"Date Discharge",
"Member ID Peserta",
"Type of patient",
"Provider Name",
"Provider Code",
"End Of Claim Numbers",
"Remarks",
"Diagnosis",
"Tgl Billing dari RS",
"Benefit Item",
"Total Billing",
"Benefit Item",
"Amount Approval",
"Amount Not Approval",
"Final Billing",
"Remarks",
"QC 1",
"Ingestion Code",
"Ingestion Status",
];
public $listing_doc_headers = [
"Date Of Request",
"Record Mode",
"Date Addmission",
"Date Discharge",
"Member ID Peserta",
"Type of patient",
"Provider Name",
"Provider Code",
"End Of Claim Numbers",
"Remarks",
"Diagnosis",
"Tgl Billing dari RS",
"Benefit Item",
"Total Billing",
"Benefit Item",
"Amount Approval",
"Amount Not Approval",
"Final Billing",
"Remarks",
"QC 1",
"Ingestion Code",
"Ingestion Status",
@@ -152,35 +152,44 @@ class RequestLogService
throw new ImportRowException(__('Format Date Invalid'), 0, null, $row);
}
// Membuat singkatan dari nama rumah sakit
$singkatan = "";
$words = explode(' ', $row['organization_id']);
foreach ($words as $word) {
$singkatan .= strtoupper(substr($word, 0, 1));
if (!$row['organization_id']){
throw new ImportRowException(__('Provider Required'), 0, null, $row);
}
// 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
$kodeOrganisasi = "ORG000" . $singkatan;
// $kodeOrganisasi = "ORG000" . $singkatan;
// Insert data ke tabel organizations
$organization = DB::table('organizations')->where('code', $kodeOrganisasi)->first();
// dd( $organization);
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
]);
$organization = DB::table('organizations')->where('code', $row['organization_id'])->first();
if (!$organization){
throw new ImportRowException(__('Provider Not Found'), 0, null, $row);
}
// 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 = [
'source' => 'H',
'provideCode' => $kodeOrganisasi ,
// 'provideCode' => $kodeOrganisasi ,
'provideCode' => $organization->code ,
'date' => $this->dateParserCode($row['submission_date']),
'policy' => $member->currentPolicy->code,
'member_code' => $row['member_id']
@@ -212,7 +221,7 @@ class RequestLogService
$final_log = 1;
}
if ($row['catatan']){
if ($row['diagnosis']){
$data = [
'code' => $code,
'member_id' => $member->id,
@@ -227,7 +236,7 @@ class RequestLogService
'keterangan' => $row['keterangan'],
'policy_id' => $member->currentPolicy->id ?? null,
'organization_id' => $organization_id,
'diagnosis' => $row['catatan'],
'diagnosis' => $row['diagnosis'],
'service_code' => $serviceCode,
'approved_final_log_at' => $row['approved_final_log_at'],
];
@@ -242,7 +251,7 @@ class RequestLogService
'status_final_log' => $statusFinalLog,
'final_log' =>$final_log,
'import_system' =>TRUE,
// 'catatan' => $row['catatan'],
'diagnosis' => $row['diagnosis'],
'keterangan' => $row['keterangan'],
'policy_id' => $member->currentPolicy->id ?? null,
'organization_id' => $organization_id,
@@ -251,25 +260,31 @@ class RequestLogService
];
}
$requestLog = RequestLog::updateOrCreate(
[
'code' => $code,
],
$data);
if ($row['record_mode'] == 1){
$requestLog = RequestLog::updateOrCreate(["code" => $code], $data);
} else if ($row['record_mode'] == 2) {
$requestLog = RequestLog::updateOrCreate(
[
'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
// Delete item
if ($row['final_billing']){
if ($row['total_billing']){
RequestLogBenefit::where('request_log_id', '=', $requestLog->id)->delete();
}
// Insert Item
RequestLogBenefit::create(
[
'request_log_id' => $requestLog->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_not_approved' => $row['amount_not_approval'] ?? 0,
'excess_paid' => $row['amount_not_approval'] ?? 0,
@@ -277,8 +292,6 @@ class RequestLogService
]);
}
// Commit transaksi
DB::commit();
} catch (\Exception $e) {

View File

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

View File

@@ -4,6 +4,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Altek\Accountant\Contracts\Recordable;
class RequestLogBenefit extends Model
{

View File

@@ -20,6 +20,8 @@ use App\Models\Icd;
use App\Models\IcdTemplate;
use App\Models\FormulariumTemplate;
use App\Models\AuditTrail;
use App\Models\RequestLog;
use App\Models\RequestLogBenefit;
use Illuminate\Support\Facades\Auth;
use App\Models\OLDLMS\PersonalAccessToken;
@@ -170,6 +172,22 @@ class AppServiceProvider extends ServiceProvider
$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
CorporateFormularium::updated(function ($model) {
$this->logAuditTrail($model, 'updated');

View File

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

View File

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