Merge remote-tracking branch 'origin/staging' into origin/production
This commit is contained in:
@@ -175,8 +175,12 @@ class DataServiceMonitoring extends JsonResource
|
|||||||
->groupBy(function ($requestLogDailyMonitoring) {
|
->groupBy(function ($requestLogDailyMonitoring) {
|
||||||
return Carbon::parse($requestLogDailyMonitoring->lab_date)->format('d M Y');
|
return Carbon::parse($requestLogDailyMonitoring->lab_date)->format('d M Y');
|
||||||
})
|
})
|
||||||
|
->filter(function ($groupedItems) {
|
||||||
|
return !is_null($groupedItems->first()->lab_date);
|
||||||
|
})
|
||||||
->map(function ($groupedItems) {
|
->map(function ($groupedItems) {
|
||||||
return collect($groupedItems)
|
return collect($groupedItems)
|
||||||
|
|
||||||
->map(function ($test) {
|
->map(function ($test) {
|
||||||
$arr_document = [];
|
$arr_document = [];
|
||||||
$document = DB::table('files')
|
$document = DB::table('files')
|
||||||
@@ -197,6 +201,7 @@ class DataServiceMonitoring extends JsonResource
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'code' => $test->code,
|
'code' => $test->code,
|
||||||
'date' => Carbon::parse($test->lab_date)->format('d M Y') ?? null,
|
'date' => Carbon::parse($test->lab_date)->format('d M Y') ?? null,
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ class ClaimController extends Controller
|
|||||||
$processedData = $this->processCategoryNames($data);
|
$processedData = $this->processCategoryNames($data);
|
||||||
|
|
||||||
$importedRows = 0;
|
$importedRows = 0;
|
||||||
|
$result_rows = [];
|
||||||
$failedRows = [];
|
$failedRows = [];
|
||||||
|
|
||||||
foreach ($processedData as $row) {
|
foreach ($processedData as $row) {
|
||||||
@@ -146,7 +147,9 @@ class ClaimController extends Controller
|
|||||||
$affectedRows = DB::table('claim_requests')
|
$affectedRows = DB::table('claim_requests')
|
||||||
->where('code','=', $row['code'])
|
->where('code','=', $row['code'])
|
||||||
->where('claim_management','=', 1)
|
->where('claim_management','=', 1)
|
||||||
|
->where('claim_requests.status_claim_management', '=', 'received')
|
||||||
->update([
|
->update([
|
||||||
|
'status' => $row['qc'] == 'Y' ? 'approved' : 'declined',
|
||||||
'status_claim_management' => $row['qc'] == 'Y' ? 'approved' : 'declined',
|
'status_claim_management' => $row['qc'] == 'Y' ? 'approved' : 'declined',
|
||||||
'reason_decline' => $row['reason'] ? $row['reason'] : null,
|
'reason_decline' => $row['reason'] ? $row['reason'] : null,
|
||||||
'approval_by_claim_management' => auth()->user()->id,
|
'approval_by_claim_management' => auth()->user()->id,
|
||||||
@@ -154,11 +157,39 @@ class ClaimController extends Controller
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
if ($affectedRows === 0) {
|
if ($affectedRows === 0) {
|
||||||
|
$check_status = DB::table('claim_requests')
|
||||||
|
->where('code','=', $row['code'])
|
||||||
|
->where('claim_management','=', 1)
|
||||||
|
->select('status_claim_management')
|
||||||
|
->first();
|
||||||
|
if($check_status)
|
||||||
|
{
|
||||||
|
$row['error'] = 'Gagal update karena Status Claim sudah '.$check_status->status_claim_management;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$row['error'] = 'Gagal update karena Code tidak sesuai';
|
||||||
|
}
|
||||||
|
$row['code_error'] = '500';
|
||||||
|
$result_rows[] = $row;
|
||||||
$failedRows[] = $row;
|
$failedRows[] = $row;
|
||||||
} else {
|
} else {
|
||||||
$importedRows += $affectedRows;
|
$importedRows += $affectedRows;
|
||||||
|
$row['code_error'] = '200';
|
||||||
|
$row['error'] = 'Sukses';
|
||||||
|
$result_rows[] = $row;
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
$row['code_error'] = '500';
|
||||||
|
$row['error'] = $e->getMessage();
|
||||||
|
if(!$row['code'])
|
||||||
|
{
|
||||||
|
$row['error'] = 'Kolom Code wajib isi';
|
||||||
|
}
|
||||||
|
if(!$row['qc'])
|
||||||
|
{
|
||||||
|
$row['error'] = 'Kolom QC wajib isi';
|
||||||
|
}
|
||||||
|
$result_rows[] = $row;
|
||||||
$failedRows[] = $row;
|
$failedRows[] = $row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -168,7 +199,7 @@ class ClaimController extends Controller
|
|||||||
'data' => [
|
'data' => [
|
||||||
'total_success_row' => $importedRows,
|
'total_success_row' => $importedRows,
|
||||||
'total_failed_row' => count($failedRows),
|
'total_failed_row' => count($failedRows),
|
||||||
'failed_rows' => $failedRows,
|
'result_rows' => $result_rows,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -375,11 +406,13 @@ class ClaimController extends Controller
|
|||||||
public function exportFiled(Request $request)
|
public function exportFiled(Request $request)
|
||||||
{
|
{
|
||||||
$writer = WriterEntityFactory::createXLSXWriter();
|
$writer = WriterEntityFactory::createXLSXWriter();
|
||||||
$writer->openToFile(public_path('files/Report-Data-Filed-Import.xlsx'));
|
$writer->openToFile(public_path('files/Report-Data-Result-Import.xlsx'));
|
||||||
$header = [
|
$header = [
|
||||||
'Code*',
|
'Code*',
|
||||||
'QC*',
|
'QC*',
|
||||||
'Reason'
|
'Reason',
|
||||||
|
'Ingest Code',
|
||||||
|
'Ingest Note'
|
||||||
];
|
];
|
||||||
$style = (new StyleBuilder())
|
$style = (new StyleBuilder())
|
||||||
->setFontBold()
|
->setFontBold()
|
||||||
@@ -400,7 +433,9 @@ class ClaimController extends Controller
|
|||||||
$rowData = [
|
$rowData = [
|
||||||
$item['code'],
|
$item['code'],
|
||||||
$item['qc'],
|
$item['qc'],
|
||||||
$item['reason']
|
$item['reason'],
|
||||||
|
$item['code_error'],
|
||||||
|
$item['error']
|
||||||
];
|
];
|
||||||
$style = (new StyleBuilder())
|
$style = (new StyleBuilder())
|
||||||
//->setFontBold()
|
//->setFontBold()
|
||||||
@@ -433,8 +468,8 @@ class ClaimController extends Controller
|
|||||||
$writer->close();
|
$writer->close();
|
||||||
|
|
||||||
return Helper::responseJson([
|
return Helper::responseJson([
|
||||||
'file_name' => 'Report-Data-Filed-Import',
|
'file_name' => 'Report-Data-Result-Import',
|
||||||
"file_url" => url('files/Report-Data-Filed-Import.xlsx')
|
"file_url" => url('files/Report-Data-Result-Import.xlsx')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
public function getProvider(Request $request)
|
public function getProvider(Request $request)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use Exception;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Routing\Controller;
|
use Illuminate\Routing\Controller;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\File as Files;
|
||||||
use Modules\Internal\Transformers\DailyMonitoringResource;
|
use Modules\Internal\Transformers\DailyMonitoringResource;
|
||||||
use App\Models\File;
|
use App\Models\File;
|
||||||
|
|
||||||
@@ -120,6 +121,230 @@ class DailyMonitoringController extends Controller
|
|||||||
],200);
|
],200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function GetDetailMonitoringListbyID(Request $request, $id)
|
||||||
|
{
|
||||||
|
|
||||||
|
$detail = RequestDailyMonitoring::where('id', $id)
|
||||||
|
->orderBy("created_at", "desc")
|
||||||
|
->first();
|
||||||
|
return response()->json([
|
||||||
|
'error' => false,
|
||||||
|
'message' => "success",
|
||||||
|
'data' => $detail,
|
||||||
|
],200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function UpdateDetailMonitoringbyID(Request $request)
|
||||||
|
{
|
||||||
|
// validation rule
|
||||||
|
$validator = Validator::make($request->all(),[
|
||||||
|
'subject' => 'required',
|
||||||
|
'submission_date' => 'required',
|
||||||
|
'body_temperature' => 'required',
|
||||||
|
'sistole' => 'required',
|
||||||
|
'diastole' => 'required',
|
||||||
|
'respiration_rate' => 'required',
|
||||||
|
'analysis' => 'required',
|
||||||
|
'medical_plan' => 'required',
|
||||||
|
'reason' => 'required',
|
||||||
|
'non_medikamentosa_plan' => 'required',
|
||||||
|
],$this->messages());
|
||||||
|
|
||||||
|
// validation error
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => true,
|
||||||
|
'message' => $validator->getMessageBag()
|
||||||
|
],400);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// insert claim daily monitoring
|
||||||
|
$db_response = RequestDailyMonitoring::where('id', $request->id)
|
||||||
|
->update([
|
||||||
|
'submission_date' => $request->submission_date,
|
||||||
|
'subject' => $request->subject,
|
||||||
|
'object' => $request->objective,
|
||||||
|
'sistole' => $request->sistole,
|
||||||
|
'diastole' => $request->diastole,
|
||||||
|
'body_temperature' => $request->body_temperature,
|
||||||
|
'respiration_rate' => $request->respiration_rate,
|
||||||
|
'analysis' => $request->analysis,
|
||||||
|
'lab_date' => $request->lab_date,
|
||||||
|
'provider' => $request->provider,
|
||||||
|
'examination' => $request->examination,
|
||||||
|
'reason' => $request->reason,
|
||||||
|
'created_by' => auth()->user()->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// cek medical plan
|
||||||
|
$num_medical_plan = 0;
|
||||||
|
foreach ($request->medical_plan as $row) {
|
||||||
|
if ($row['medical_plan_str']) {
|
||||||
|
$num_medical_plan++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($num_medical_plan == 0) {
|
||||||
|
DB::rollBack();
|
||||||
|
return response()->json([
|
||||||
|
'error' => true,
|
||||||
|
'message' => [
|
||||||
|
'medical_plan' => ['medical plan harus diisi']
|
||||||
|
],
|
||||||
|
'data' => []
|
||||||
|
],400);
|
||||||
|
}
|
||||||
|
if ($request->medical_plan){
|
||||||
|
// delete medical plan
|
||||||
|
DB::table('request_log_medical_plan')
|
||||||
|
->where([
|
||||||
|
'request_log_daily_monitoring_id' => $request->id,
|
||||||
|
'type' => 1
|
||||||
|
])
|
||||||
|
->delete();
|
||||||
|
// insert medical plan
|
||||||
|
foreach ($request->medical_plan as $row) {
|
||||||
|
DB::table('request_log_medical_plan')->insert([
|
||||||
|
'request_log_daily_monitoring_id' => $request->id,
|
||||||
|
'plan' => $row['medical_plan_str'],
|
||||||
|
'type' => 1,
|
||||||
|
'created_at' => date('Y-m-d'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->non_medikamentosa_plan){
|
||||||
|
// delete medical plan
|
||||||
|
DB::table('request_log_medical_plan')
|
||||||
|
->where([
|
||||||
|
'request_log_daily_monitoring_id' => $request->id,
|
||||||
|
'type' => 2
|
||||||
|
])
|
||||||
|
->delete();
|
||||||
|
// insert non medical plan
|
||||||
|
foreach ($request->non_medikamentosa_plan as $row) {
|
||||||
|
DB::table('request_log_medical_plan')->insert([
|
||||||
|
'request_log_daily_monitoring_id' => $request->id,
|
||||||
|
'plan' => $row['non_medikamentosa_plan_str'],
|
||||||
|
'type' => 2,
|
||||||
|
'created_at' => date('Y-m-d'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// insert file result
|
||||||
|
if ($request->confirmation_medical_leter){
|
||||||
|
// $fileCurrents = File::where([
|
||||||
|
// 'fileable_id' => $request->id,
|
||||||
|
// 'type' => 'confirmation-medical-letter',
|
||||||
|
// ])->get();
|
||||||
|
// if ($fileCurrents){
|
||||||
|
// foreach($fileCurrents as $fileCurrent){
|
||||||
|
// if (Files::exists($fileCurrent->path)) {
|
||||||
|
// Files::delete();
|
||||||
|
// }
|
||||||
|
// File::find($fileCurrent->id)->delete();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
foreach ($request->confirmation_medical_leter as $file) {
|
||||||
|
$name = 'labresult-' . uniqid();
|
||||||
|
$extension= $file->getClientOriginalExtension();
|
||||||
|
$fileName = $name . '.' . $extension;
|
||||||
|
$orignalName = $file->getClientOriginalName();
|
||||||
|
$path = $file->storeAs($this->path_for_store, $fileName);
|
||||||
|
File::create([
|
||||||
|
'fileable_type' => 'App\Models\LaboratoriumResult',
|
||||||
|
'fileable_id' => $request->id,
|
||||||
|
'type' => 'confirmation-medical-letter',
|
||||||
|
'name' => $name,
|
||||||
|
'original_name' => $orignalName,
|
||||||
|
'extension' => $extension,
|
||||||
|
'path' => $path,
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($request->medical_action_letter){
|
||||||
|
// $fileCurrents = File::where([
|
||||||
|
// 'fileable_id' => $request->id,
|
||||||
|
// 'type' => 'medical-action-letter',
|
||||||
|
// ])->get();
|
||||||
|
// if ($fileCurrents){
|
||||||
|
// foreach($fileCurrents as $fileCurrent){
|
||||||
|
// if (Files::exists($fileCurrent->path)) {
|
||||||
|
// Files::delete();
|
||||||
|
// }
|
||||||
|
// File::find($fileCurrent->id)->delete();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
foreach ($request->medical_action_letter as $file) {
|
||||||
|
$name = 'labresult-' . uniqid();
|
||||||
|
$extension= $file->getClientOriginalExtension();
|
||||||
|
$fileName = $name . '.' . $extension;
|
||||||
|
$orignalName = $file->getClientOriginalName();
|
||||||
|
$path = $file->storeAs($this->path_for_store, $fileName);
|
||||||
|
File::create([
|
||||||
|
'fileable_type' => 'App\Models\LaboratoriumResult',
|
||||||
|
'fileable_id' => $request->id,
|
||||||
|
'type' => 'medical-action-letter',
|
||||||
|
'name' => $name,
|
||||||
|
'original_name' => $orignalName,
|
||||||
|
'extension' => $extension,
|
||||||
|
'path' => $path,
|
||||||
|
]);
|
||||||
|
// $file->storeAs($this->path_for_store, $fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($request->result){
|
||||||
|
// $fileCurrents = File::where([
|
||||||
|
// 'fileable_id' => $request->id,
|
||||||
|
// 'type' => 'laboratorium-result',
|
||||||
|
// ])->get();
|
||||||
|
// if ($fileCurrents){
|
||||||
|
// foreach($fileCurrents as $fileCurrent){
|
||||||
|
// if (Files::exists($fileCurrent->path)) {
|
||||||
|
// Files::delete();
|
||||||
|
// }
|
||||||
|
// File::find($fileCurrent->id)->delete();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
foreach ($request->result as $file) {
|
||||||
|
$name = 'labresult-' . uniqid();
|
||||||
|
$extension= $file->getClientOriginalExtension();
|
||||||
|
$orignalName = $file->getClientOriginalName();
|
||||||
|
$fileName = $name . '.' . $extension;
|
||||||
|
$path = $file->storeAs($this->path_for_store, $fileName);
|
||||||
|
File::create([
|
||||||
|
'fileable_type' => 'App\Models\LaboratoriumResult',
|
||||||
|
'fileable_id' => $request->id,
|
||||||
|
'type' => 'laboratorium-result',
|
||||||
|
'name' => $name,
|
||||||
|
'original_name' => $orignalName,
|
||||||
|
'extension' => $extension,
|
||||||
|
'path' => $path,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// $file->storeAs($this->path_for_store, $fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'error' => false,
|
||||||
|
'message' => "success",
|
||||||
|
'data' => []
|
||||||
|
],200);
|
||||||
|
}
|
||||||
|
catch (Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
return response()->json([
|
||||||
|
'error' => true,
|
||||||
|
'message' => $e->getMessage(),
|
||||||
|
'data' => []
|
||||||
|
],500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add Detail Monitoring List
|
* Add Detail Monitoring List
|
||||||
*/
|
*/
|
||||||
@@ -420,6 +645,35 @@ class DailyMonitoringController extends Controller
|
|||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete File Daily Monitoring
|
||||||
|
*/
|
||||||
|
public function deleteFileDetailMonitoringListRequestLog(Request $request, $id){
|
||||||
|
$fileCurrent = File::where([
|
||||||
|
'id' => $id,
|
||||||
|
])->first();
|
||||||
|
if ($fileCurrent){
|
||||||
|
if (Files::exists($fileCurrent->path)) {
|
||||||
|
Files::delete();
|
||||||
|
}
|
||||||
|
$fileCurrent->deleted_at = now();
|
||||||
|
$fileCurrent->reason = $request->reason;
|
||||||
|
$fileCurrent->deleted_by = auth()->user()->id;
|
||||||
|
$fileCurrent->save();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'error' => false,
|
||||||
|
'message' => "Delete success",
|
||||||
|
'data' => $fileCurrent
|
||||||
|
], 200);
|
||||||
|
} else {
|
||||||
|
return response()->json([
|
||||||
|
'error' => true,
|
||||||
|
'message' => "Data not found.",
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update Status Request LOG
|
* Update Status Request LOG
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -175,10 +175,13 @@ Route::prefix('internal')->group(function () {
|
|||||||
// Daily Monitoring
|
// Daily Monitoring
|
||||||
Route::prefix('daily_monitoring')->group(function () {
|
Route::prefix('daily_monitoring')->group(function () {
|
||||||
Route::get('detail/{claim_code}/list', [DailyMonitoringController::class, 'GetDetailMonitoringList']);
|
Route::get('detail/{claim_code}/list', [DailyMonitoringController::class, 'GetDetailMonitoringList']);
|
||||||
|
Route::get('detail/{id}/edit', [DailyMonitoringController::class, 'GetDetailMonitoringListbyID']);
|
||||||
|
Route::post('detail/update-request', [DailyMonitoringController::class, 'UpdateDetailMonitoringbyID']);
|
||||||
Route::post('detail/{claim_code}/add', [DailyMonitoringController::class, 'AddDetailMonitoringList']);
|
Route::post('detail/{claim_code}/add', [DailyMonitoringController::class, 'AddDetailMonitoringList']);
|
||||||
Route::post('detail/{claim_code}/add-request', [DailyMonitoringController::class, 'AddDetailMonitoringListRequestLog']);
|
Route::post('detail/{claim_code}/add-request', [DailyMonitoringController::class, 'AddDetailMonitoringListRequestLog']);
|
||||||
Route::post('detail/{claim_code}/update-status', [DailyMonitoringController::class, 'UpdateListRequestLog']);
|
Route::post('detail/{claim_code}/update-status', [DailyMonitoringController::class, 'UpdateListRequestLog']);
|
||||||
Route::get('detail/{id}/delete', [DailyMonitoringController::class, 'deleteDetailMonitoringListRequestLog']);
|
Route::get('detail/{id}/delete', [DailyMonitoringController::class, 'deleteDetailMonitoringListRequestLog']);
|
||||||
|
Route::get('detail/{id}/delete-file', [DailyMonitoringController::class, 'deleteFileDetailMonitoringListRequestLog']);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Laboratorium Result
|
// Laboratorium Result
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class ClaimRequest extends Model
|
|||||||
"Amt Approved" => "amount_apporve",
|
"Amt Approved" => "amount_apporve",
|
||||||
"Amt Not Approved" => "amount_not_apporve",
|
"Amt Not Approved" => "amount_not_apporve",
|
||||||
"Excess Paid" => "excess_paid",
|
"Excess Paid" => "excess_paid",
|
||||||
"Reason" => "reason",
|
// "Reason" => "reason",
|
||||||
"QC" => "qc",
|
"QC" => "qc",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class RequestDailyMonitoring extends Model
|
|||||||
'deleted_at'
|
'deleted_at'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $appends = ['medical_plan', 'non_medikamentosa_plan', 'document', 'discharge_date'];
|
protected $appends = ['medical_plan', 'non_medikamentosa_plan', 'document', 'discharge_date', 'confirmation_medical_leter', 'medical_action_letter', 'laboratorium_result'];
|
||||||
|
|
||||||
// public function getBodyTemperatureAttribute()
|
// public function getBodyTemperatureAttribute()
|
||||||
// {
|
// {
|
||||||
@@ -99,10 +99,15 @@ class RequestDailyMonitoring extends Model
|
|||||||
public function getDocumentAttribute()
|
public function getDocumentAttribute()
|
||||||
{
|
{
|
||||||
$arr_document = [];
|
$arr_document = [];
|
||||||
$document = DB::table('files')->where(['fileable_type' => 'App\Models\LaboratoriumResult', 'fileable_id' => $this->attributes['id']])->get();
|
$document = DB::table('files')->where([
|
||||||
|
'fileable_type' => 'App\Models\LaboratoriumResult',
|
||||||
|
'fileable_id' => $this->attributes['id'],
|
||||||
|
'deleted_at' => null,
|
||||||
|
])->get();
|
||||||
|
|
||||||
foreach ($document as $row) {
|
foreach ($document as $row) {
|
||||||
$arr_document[] = [
|
$arr_document[] = [
|
||||||
|
'id' => $row->id,
|
||||||
'file_name' => $row->original_name,
|
'file_name' => $row->original_name,
|
||||||
'path' => env('APP_URL') . '/storage/lab_result/' . $row->name .'.'. $row->extension,
|
'path' => env('APP_URL') . '/storage/lab_result/' . $row->name .'.'. $row->extension,
|
||||||
'type' => $row->type,
|
'type' => $row->type,
|
||||||
@@ -117,4 +122,62 @@ class RequestDailyMonitoring extends Model
|
|||||||
return $discharge_date = DB::table('request_logs')->where('id', $this->attributes['request_log_id'])->select('discharge_date')->first();
|
return $discharge_date = DB::table('request_logs')->where('id', $this->attributes['request_log_id'])->select('discharge_date')->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getConfirmationMedicalLeterAttribute()
|
||||||
|
{
|
||||||
|
$arr_document = [];
|
||||||
|
$document = DB::table('files')->where([
|
||||||
|
'fileable_type' => 'App\Models\LaboratoriumResult',
|
||||||
|
'type' => 'confirmation-medical-letter',
|
||||||
|
'fileable_id' => $this->attributes['id'],
|
||||||
|
])->get();
|
||||||
|
|
||||||
|
foreach ($document as $row) {
|
||||||
|
$arr_document[] = [
|
||||||
|
'name' => $row->original_name,
|
||||||
|
'path' => env('APP_URL') . '/storage/lab_result/' . $row->name .'.'. $row->extension,
|
||||||
|
'type' => $row->type,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arr_document;
|
||||||
|
}
|
||||||
|
public function getMedicalActionLetterAttribute()
|
||||||
|
{
|
||||||
|
$arr_document = [];
|
||||||
|
$document = DB::table('files')->where([
|
||||||
|
'fileable_type' => 'App\Models\LaboratoriumResult',
|
||||||
|
'type' => 'medical-action-letter',
|
||||||
|
'fileable_id' => $this->attributes['id'],
|
||||||
|
])->get();
|
||||||
|
|
||||||
|
foreach ($document as $row) {
|
||||||
|
$arr_document[] = [
|
||||||
|
'name' => $row->original_name,
|
||||||
|
'path' => env('APP_URL') . '/storage/lab_result/' . $row->name .'.'. $row->extension,
|
||||||
|
'type' => $row->type,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arr_document;
|
||||||
|
}
|
||||||
|
public function getLaboratoriumResultAttribute()
|
||||||
|
{
|
||||||
|
$arr_document = [];
|
||||||
|
$document = DB::table('files')->where([
|
||||||
|
'fileable_type' => 'App\Models\LaboratoriumResult',
|
||||||
|
'type' => 'laboratorium-result',
|
||||||
|
'fileable_id' => $this->attributes['id'],
|
||||||
|
])->get();
|
||||||
|
|
||||||
|
foreach ($document as $row) {
|
||||||
|
$arr_document[] = [
|
||||||
|
'name' => $row->original_name,
|
||||||
|
'path' => env('APP_URL') . '/storage/lab_result/' . $row->name .'.'. $row->extension,
|
||||||
|
'type' => $row->type,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arr_document;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { useFieldArray, useForm } from 'react-hook-form';
|
import { useFieldArray, useForm } from 'react-hook-form';
|
||||||
import { useNavigate, useParams } from 'react-router-dom';
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
import { Box, IconButton, Typography, Grid, Card, Button, ButtonBase, Stack } from '@mui/material';
|
import { Box, IconButton, Typography, Grid, Card, Button, ButtonBase, Stack, Autocomplete } from '@mui/material';
|
||||||
import { LoadingButton } from "@mui/lab";
|
import { LoadingButton } from "@mui/lab";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,16 +28,23 @@ import InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile';
|
|||||||
* Utils, Types, Functions
|
* Utils, Types, Functions
|
||||||
* ============================================
|
* ============================================
|
||||||
*/
|
*/
|
||||||
import { AddMonitoringDetail, getOrganizationId } from '../Model/Functions';
|
import { AddMonitoringDetail, UpdateMonitoringDetail, getMonitoringDetailById, getMonitoringDetailList, getMonitorungDetailById, getOrganizationId } from '../Model/Functions';
|
||||||
import { DetailMonitoringListType} from '../Model/Types';
|
import { DetailMonitoringListType} from '../Model/Types';
|
||||||
import FormCreateFilesUpload from '@/pages/CustomerService/FinalLog/Components/FormCreateFilesUpload';
|
import FormCreateFilesUpload from '@/pages/CustomerService/FinalLog/Components/FormCreateFilesUpload';
|
||||||
import MultiFilePreview from '@/components/upload/MultiFilePreview';
|
import MultiFilePreview from '@/components/upload/MultiFilePreview';
|
||||||
import Iconify from '@/components/Iconify';
|
import Iconify from '@/components/Iconify';
|
||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
|
import { TextField } from '@mui/material';
|
||||||
|
|
||||||
|
type Detail = {
|
||||||
|
row : DetailMonitoringListType|undefined
|
||||||
|
}
|
||||||
|
|
||||||
export default function DetailMonitoringList() {
|
export default function DetailMonitoringList() {
|
||||||
const { member_id, claim_code } = useParams();
|
const { member_id, claim_code, id} = useParams();
|
||||||
const [organizationId, setOrganizationId] = useState<number|undefined>();
|
const [organizationId, setOrganizationId] = useState<number|undefined>();
|
||||||
|
const [isEdit, setIsEdit] = useState<boolean|undefined>(false);
|
||||||
|
const [data, setData] = useState<DetailMonitoringListType>();
|
||||||
|
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const pageTitle = claim_code??'_ _ _ _';
|
const pageTitle = claim_code??'_ _ _ _';
|
||||||
@@ -49,39 +56,94 @@ export default function DetailMonitoringList() {
|
|||||||
const organization_id = await getOrganizationId(claim_code??'');
|
const organization_id = await getOrganizationId(claim_code??'');
|
||||||
setOrganizationId(organization_id);
|
setOrganizationId(organization_id);
|
||||||
}
|
}
|
||||||
|
const loadDetailDailyMonitoring = async () => {
|
||||||
|
const monitoring = await getMonitoringDetailById(id??'')
|
||||||
|
setData(monitoring)
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadOrganizationID();
|
loadOrganizationID();
|
||||||
|
if (id){
|
||||||
|
loadDetailDailyMonitoring();
|
||||||
|
setIsEdit(true)
|
||||||
|
console.log(data)
|
||||||
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
// setup form
|
// setup form
|
||||||
// ====================================
|
// ====================================
|
||||||
const defaultValues: DetailMonitoringListType = {
|
const defaultValues = useMemo(
|
||||||
id : '',
|
() => ({
|
||||||
claim_code : '',
|
id : data?.id ??'',
|
||||||
claim_id : '',
|
claim_code : data?.claim_code ?? '',
|
||||||
subject : '',
|
claim_id : data?.claim_id ?? '',
|
||||||
objective : '',
|
subject : data?.subject ?? '',
|
||||||
submission_date : '',
|
objective : data?.object ?? '',
|
||||||
body_temperature: '',
|
submission_date : data?.submission_date ?? '',
|
||||||
sistole : '',
|
body_temperature: data?.body_temperature ?? '',
|
||||||
diastole : '',
|
sistole : data?.sistole ?? '',
|
||||||
respiration_rate: '',
|
diastole : data?.diastole ??'',
|
||||||
complaints : '',
|
respiration_rate: data?.respiration_rate ??'',
|
||||||
analysis : '',
|
complaints : data?.complaints ?? '',
|
||||||
medical_plan : [{
|
analysis : data?.analysis ?? '',
|
||||||
medical_plan_str: ''
|
medical_plan : data?.medical_plan ?? [{
|
||||||
}],
|
medical_plan_str: ''
|
||||||
non_medikamentosa_plan : [{
|
}],
|
||||||
non_medikamentosa_plan_str: ''
|
non_medikamentosa_plan : data?.non_medikamentosa_plan ?? [{
|
||||||
}],
|
non_medikamentosa_plan_str: ''
|
||||||
confirmation_medical_leter : [],
|
}],
|
||||||
medical_action_letter : [],
|
confirmation_medical_leter : [],
|
||||||
result : [],
|
medical_action_letter : [],
|
||||||
created_at : '',
|
// result : data?.laboratorium_result ?? [],
|
||||||
lab_date : '',
|
result : [],
|
||||||
provider : '',
|
created_at : data?.created_at ?? '',
|
||||||
examination : '',
|
lab_date : data?.lab_date ?? '',
|
||||||
};
|
provider : data?.provider ?? '',
|
||||||
|
examination : data?.examination ?? '',
|
||||||
|
reason : '',
|
||||||
|
}),
|
||||||
|
[data]
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isEdit && data) {
|
||||||
|
reset(defaultValues);
|
||||||
|
}
|
||||||
|
if (!isEdit) {
|
||||||
|
reset(defaultValues);
|
||||||
|
}
|
||||||
|
// setFileKondisis(currentClaim?.files_by_type?.claim_diagnosis);
|
||||||
|
// setFileDiagnosas(currentClaim?.files_by_type?.claim_diagnosis);
|
||||||
|
}, [isEdit, data]);
|
||||||
|
|
||||||
|
// const defaultValues: DetailMonitoringListType = {
|
||||||
|
// id : '',
|
||||||
|
// claim_code : '',
|
||||||
|
// claim_id : '',
|
||||||
|
// subject : '',
|
||||||
|
// objective : '',
|
||||||
|
// submission_date : '',
|
||||||
|
// body_temperature: '',
|
||||||
|
// sistole : '',
|
||||||
|
// diastole : '',
|
||||||
|
// respiration_rate: '',
|
||||||
|
// complaints : '',
|
||||||
|
// analysis : data?.analysis ?? '',
|
||||||
|
// medical_plan : [{
|
||||||
|
// medical_plan_str: ''
|
||||||
|
// }],
|
||||||
|
// non_medikamentosa_plan : [{
|
||||||
|
// non_medikamentosa_plan_str: ''
|
||||||
|
// }],
|
||||||
|
// confirmation_medical_leter : [],
|
||||||
|
// medical_action_letter : [],
|
||||||
|
// result : [],
|
||||||
|
// created_at : '',
|
||||||
|
// lab_date : '',
|
||||||
|
// provider : '',
|
||||||
|
// examination : '',
|
||||||
|
// };
|
||||||
|
|
||||||
|
|
||||||
const methods = useForm<any>({
|
const methods = useForm<any>({
|
||||||
defaultValues
|
defaultValues
|
||||||
@@ -113,7 +175,6 @@ export default function DetailMonitoringList() {
|
|||||||
arr_medical_action_letter.push(event.target.files[0]);
|
arr_medical_action_letter.push(event.target.files[0]);
|
||||||
|
|
||||||
setValue('medical_action_letter', arr_medical_action_letter)
|
setValue('medical_action_letter', arr_medical_action_letter)
|
||||||
console.log('test2')
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log('NO FILE');
|
console.log('NO FILE');
|
||||||
@@ -168,15 +229,27 @@ export default function DetailMonitoringList() {
|
|||||||
// Submit Form
|
// Submit Form
|
||||||
// =====================================
|
// =====================================
|
||||||
const submitHandler = async (data: DetailMonitoringListType) => {
|
const submitHandler = async (data: DetailMonitoringListType) => {
|
||||||
const response = await AddMonitoringDetail(claim_code??'', data);
|
|
||||||
|
const response = isEdit ? await UpdateMonitoringDetail(data) : await AddMonitoringDetail(claim_code??'', data);
|
||||||
|
|
||||||
if (response == true) {
|
if (response == true) {
|
||||||
reset();
|
reset();
|
||||||
navigate('/case_management/daily_monitoring/'+member_id+'/'+organizationId+'/claims', { replace: true });
|
if (isEdit) {
|
||||||
|
navigate('/case_management/daily_monitoring/'+member_id+'/claims/'+claim_code+'/list_monitoring', { replace: true });
|
||||||
|
} else {
|
||||||
|
navigate('/case_management/daily_monitoring/'+member_id+'/'+organizationId+'/claims', { replace: true });
|
||||||
|
}
|
||||||
// window.location.reload()
|
// window.location.reload()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const [selectedReason, setSelectedReason] = useState({value:'-', label:''});
|
||||||
|
const reasons = [
|
||||||
|
{ value: 'Wrong Setting', label: 'Wrong Setting' },
|
||||||
|
{ value: 'Hospital Request', label: 'Hospital Request' }
|
||||||
|
];
|
||||||
|
const [error, setError] = useState(true);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page title={pageTitle}>
|
<Page title={pageTitle}>
|
||||||
<Box sx={{ display: 'flex', alignItems: 'center', pl: '22px', mb: '40px' }}>
|
<Box sx={{ display: 'flex', alignItems: 'center', pl: '22px', mb: '40px' }}>
|
||||||
@@ -211,6 +284,7 @@ export default function DetailMonitoringList() {
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
{/* Subject */}
|
{/* Subject */}
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Grid container spacing={3}>
|
<Grid container spacing={3}>
|
||||||
@@ -586,7 +660,6 @@ export default function DetailMonitoringList() {
|
|||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
{/* Laboratorium */}
|
{/* Laboratorium */}
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
@@ -689,16 +762,59 @@ export default function DetailMonitoringList() {
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
{/* Reason Update */}
|
||||||
|
{
|
||||||
|
isEdit ? (
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Grid container spacing={3}>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Typography variant="subtitle1" marginY={2}>Reason for Update*</Typography>
|
||||||
|
<Stack direction='row' spacing={2} sx={{marginBottom: 2}}>
|
||||||
|
<Autocomplete
|
||||||
|
options={reasons}
|
||||||
|
getOptionLabel={(option) => option.label}
|
||||||
|
fullWidth
|
||||||
|
value={selectedReason}
|
||||||
|
onChange={(event, newValue) => {
|
||||||
|
setSelectedReason(newValue);
|
||||||
|
setValue('reason',newValue?.value)
|
||||||
|
// Validasi jika newValue adalah null
|
||||||
|
if (!newValue) {
|
||||||
|
setError('Please select a reason');
|
||||||
|
} else {
|
||||||
|
setError('');
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
renderInput={(params) => (
|
||||||
|
<RHFTextField
|
||||||
|
{...params}
|
||||||
|
label="Reason for Delete"
|
||||||
|
variant="outlined"
|
||||||
|
id="reason"
|
||||||
|
name='reason'
|
||||||
|
error={Boolean(error)} // Menampilkan error jika ada
|
||||||
|
helperText={error} // Menampilkan pesan kesalahan
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
) : null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* Button Cancel & Save */}
|
{/* Button Cancel & Save */}
|
||||||
<Grid item xs={12} md={12}>
|
<Grid item xs={12} md={12}>
|
||||||
<Box display="flex" justifyContent={'flex-end'}>
|
<Box display="flex" justifyContent={'flex-end'}>
|
||||||
<Box display="flex" gap={1}>
|
<Box display="flex" gap={1}>
|
||||||
<Button variant="outlined" color="inherit" onClick={() => navigate(`/case_management/daily_monitoring/${member_id}/claims`)}>
|
<Button variant="outlined" color="inherit" onClick={() => isEdit ? navigate(`/case_management/daily_monitoring/${member_id}/claims/${claim_code}/list_monitoring`) : navigate(`/case_management/daily_monitoring/${member_id}/${organizationId}/claims`)}>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
<LoadingButton disabled={!isDirty} type="submit" variant="contained" loading={isSubmitting}>
|
<LoadingButton disabled={ isEdit ? error : !isDirty} type="submit" variant="contained" loading={isSubmitting}>
|
||||||
Add
|
{isEdit ? 'Update' : 'Add'}
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import { getOrganizationId } from '../Model/Functions';
|
|||||||
import { DetailMonitoringListType } from '../Model/Types';
|
import { DetailMonitoringListType } from '../Model/Types';
|
||||||
import TableMoreMenu from '@/components/table/TableMoreMenu';
|
import TableMoreMenu from '@/components/table/TableMoreMenu';
|
||||||
import { MenuItem } from '@mui/material';
|
import { MenuItem } from '@mui/material';
|
||||||
import { Delete } from '@mui/icons-material';
|
import { Delete, DeleteForever, Edit, LoopOutlined } from '@mui/icons-material';
|
||||||
import MuiDialog from '@/components/MuiDialog';
|
import MuiDialog from '@/components/MuiDialog';
|
||||||
import { DialogActions } from '@mui/material';
|
import { DialogActions } from '@mui/material';
|
||||||
import axios from '@/utils/axios';
|
import axios from '@/utils/axios';
|
||||||
@@ -68,7 +68,9 @@ export default function DetailMonitoringList() {
|
|||||||
{ value: 'Hospital Request', label: 'Hospital Request' }
|
{ value: 'Hospital Request', label: 'Hospital Request' }
|
||||||
];
|
];
|
||||||
const [error, setError] = useState('');
|
const [error, setError] = useState('');
|
||||||
const [id, setId] = useState(null);
|
const [id, setId] = useState<null|number>(null);
|
||||||
|
const [id_file, setIdFile] = useState<null|number>(null);
|
||||||
|
|
||||||
const handleCloseDialog = () => {
|
const handleCloseDialog = () => {
|
||||||
setOpenDialog(false);
|
setOpenDialog(false);
|
||||||
}
|
}
|
||||||
@@ -77,27 +79,52 @@ export default function DetailMonitoringList() {
|
|||||||
const parameters = {
|
const parameters = {
|
||||||
'reason' : selectedReason.value
|
'reason' : selectedReason.value
|
||||||
}
|
}
|
||||||
const response = axios.get(`case_management/daily_monitoring/detail/${id}/delete`, {
|
if (id){
|
||||||
params: { ...parameters },
|
const response = axios.get(`case_management/daily_monitoring/detail/${id}/delete`, {
|
||||||
});
|
params: { ...parameters },
|
||||||
if (!response.error){
|
});
|
||||||
enqueueSnackbar('Claim Request Updated Successfully!', { variant: 'success' });
|
|
||||||
window.location.reload();
|
if (!response.error){
|
||||||
setOpenDialog(false)
|
enqueueSnackbar('Claim Request Updated Successfully!', { variant: 'success' });
|
||||||
} else {
|
window.location.reload();
|
||||||
enqueueSnackbar('Claim Request Updated Error!', { variant: 'error' });
|
setOpenDialog(false)
|
||||||
}
|
} else {
|
||||||
|
enqueueSnackbar('Claim Request Updated Error!', { variant: 'error' });
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
axios.get(`case_management/daily_monitoring/detail/${id_file}/delete-file`, {
|
||||||
|
params: { ...parameters },
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
if (!response.error) {
|
||||||
|
enqueueSnackbar('File Successfully deleted!', { variant: 'success' });
|
||||||
|
window.location.reload();
|
||||||
|
setOpenDialog(false);
|
||||||
|
} else {
|
||||||
|
enqueueSnackbar('Deleted File Error!', { variant: 'error' });
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setError('Please select a reason')
|
setError('Please select a reason')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const handleEdit = (id:number|undefined) => {
|
||||||
|
navigate(`/case_management/daily_monitoring/${member_id}/claims/${claim_code}/${id}`)
|
||||||
|
}
|
||||||
|
|
||||||
const getContent = () => (
|
const getContent = () => (
|
||||||
<Stack spacing={1} marginTop={2}>
|
<Stack spacing={1} marginTop={2}>
|
||||||
<Typography variant="subtitle2">Are you sure to delete this Daily Monitoring ?</Typography>
|
<Typography variant="subtitle2">Are you sure to delete this {id_file ? 'File ' : '' } Daily Monitoring ?</Typography>
|
||||||
<Grid item xs={12} md={12} marginTop={4}>
|
<Grid item xs={12} md={12} marginTop={4}>
|
||||||
<Card sx={{padding:2, marginTop:2}} >
|
<Card sx={{padding:2, marginTop:2}} >
|
||||||
<Typography variant="subtitle1" marginY={2}>Reason for Delete*</Typography>
|
<Typography variant="subtitle1" marginY={2}>Reason for Delete*</Typography>
|
||||||
<Stack direction='row' spacing={2} sx={marginBottom2}>
|
<Stack direction='row' spacing={2} sx={marginBottom2}>
|
||||||
<Autocomplete
|
<Autocomplete
|
||||||
options={reason}
|
options={reason}
|
||||||
@@ -131,9 +158,10 @@ export default function DetailMonitoringList() {
|
|||||||
<Button variant="outlined" sx={{color: '#212B36', borderColor: '#919EAB52'}} onClick={handleCloseDialog}>Cancel</Button>
|
<Button variant="outlined" sx={{color: '#212B36', borderColor: '#919EAB52'}} onClick={handleCloseDialog}>Cancel</Button>
|
||||||
<Button color="primary" variant="contained" onClick={() => handleDelete()}>Delete</Button>
|
<Button color="primary" variant="contained" onClick={() => handleDelete()}>Delete</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Stack>
|
</Stack>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// Load Data
|
// Load Data
|
||||||
// -------------------
|
// -------------------
|
||||||
const loadDataTableData = async () => {
|
const loadDataTableData = async () => {
|
||||||
@@ -203,10 +231,16 @@ export default function DetailMonitoringList() {
|
|||||||
|
|
||||||
<Box sx={{ marginLeft: 'auto' }}> {/* Menempatkan TableMoreMenu di sebelah kanan */}
|
<Box sx={{ marginLeft: 'auto' }}> {/* Menempatkan TableMoreMenu di sebelah kanan */}
|
||||||
<TableMoreMenu actions={
|
<TableMoreMenu actions={
|
||||||
<MenuItem onClick={() => {setOpenDialog(true); setId(row.id)}}>
|
<>
|
||||||
<Delete color='error' />
|
<MenuItem onClick={() => {handleEdit(row.id);}}>
|
||||||
Delete
|
<Edit />
|
||||||
</MenuItem>
|
Edit
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem onClick={() => {setOpenDialog(true); setId(row.id); setIdFile(null)}}>
|
||||||
|
<Delete color='error' />
|
||||||
|
Delete
|
||||||
|
</MenuItem>
|
||||||
|
</>
|
||||||
} />
|
} />
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
@@ -394,93 +428,106 @@ export default function DetailMonitoringList() {
|
|||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Grid container gap={1}>
|
<Grid container>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Typography variant="body1" sx={{ fontWeight: 'bold' }}>
|
<Typography variant="body1" sx={{ fontWeight: 'bold' }}>
|
||||||
Document Confirmation Medical Letter:
|
Document Confirmation Medical Letter:
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<List sx={{ color: 'GrayText' }}>
|
<List>
|
||||||
{row.document?.map((data, index) => (
|
{row.document?.map((data, index) => (
|
||||||
<ListItem key={index}>
|
data.type === 'confirmation-medical-letter' ? (
|
||||||
{data.type === 'confirmation-medical-letter' ? (
|
<ListItem key={index} sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
|
||||||
<>
|
<div sx={{ display: 'flex', alignItems: 'center' }}>
|
||||||
<FiberManualRecord sx={{ fontSize: '8px', mr: '10px' }} />
|
<FiberManualRecord sx={{ fontSize: '8px', mr: '10px' }} />
|
||||||
<a
|
<a
|
||||||
href={data.path} // Replace 'data.download_link' with the actual download link
|
href={data.path}
|
||||||
target="_blank" // Optional: Open the link in a new tab
|
target="_blank"
|
||||||
rel="noopener noreferrer" // Recommended when using target="_blank"
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
{data.file_name}
|
{data.file_name}
|
||||||
</a>
|
</a>
|
||||||
</>
|
</div>
|
||||||
) : null}
|
<a
|
||||||
</ListItem>
|
onClick={() => { setOpenDialog(true); setIdFile(data.id); setId(null); }}
|
||||||
|
style={{ cursor: 'pointer' }}
|
||||||
|
>
|
||||||
|
<DeleteForever color='error'/>
|
||||||
|
</a>
|
||||||
|
</ListItem>
|
||||||
|
) : null
|
||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={12}>
|
|
||||||
<Grid container gap={1}>
|
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Typography variant="body1" sx={{ fontWeight: 'bold' }}>
|
<Typography variant="body1" sx={{ fontWeight: 'bold' }}>
|
||||||
Document Medical Action Letter:
|
Document Medical Action Letter:
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<List sx={{ color: 'GrayText' }}>
|
<List>
|
||||||
{row.document?.map((data, index) => (
|
{row.document?.map((data, index) => (
|
||||||
<ListItem key={index}>
|
data.type === 'medical-action-letter' ? (
|
||||||
{data.type === 'medical-action-letter' ? (
|
<ListItem key={index} sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
|
||||||
<>
|
<div sx={{ display: 'flex', alignItems: 'center' }}>
|
||||||
<FiberManualRecord sx={{ fontSize: '8px', mr: '10px' }} />
|
<FiberManualRecord sx={{ fontSize: '8px', mr: '10px' }} />
|
||||||
<a
|
<a
|
||||||
href={data.path} // Replace 'data.download_link' with the actual download link
|
href={data.path}
|
||||||
target="_blank" // Optional: Open the link in a new tab
|
target="_blank"
|
||||||
rel="noopener noreferrer" // Recommended when using target="_blank"
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
{data.file_name}
|
{data.file_name}
|
||||||
</a>
|
</a>
|
||||||
</>
|
</div>
|
||||||
) : null}
|
<a
|
||||||
</ListItem>
|
onClick={() => { setOpenDialog(true); setIdFile(data.id); setId(null); }}
|
||||||
|
style={{ cursor: 'pointer' }}
|
||||||
|
>
|
||||||
|
<DeleteForever color='error'/>
|
||||||
|
</a>
|
||||||
|
</ListItem>
|
||||||
|
) : null
|
||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={12}>
|
|
||||||
<Grid container gap={1}>
|
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Typography variant="body1" sx={{ fontWeight: 'bold' }}>
|
<Typography variant="body1" sx={{ fontWeight: 'bold' }}>
|
||||||
Document Laboratorium Result:
|
Document Laboratorium Result:
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<List sx={{ color: 'GrayText' }}>
|
<List>
|
||||||
{row.document?.map((data, index) => (
|
{row.document?.map((data, index) => (
|
||||||
<ListItem key={index}>
|
data.type === 'laboratorium-result' ? (
|
||||||
{data.type === 'laboratorium-result' ? (
|
<ListItem key={index} sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
|
||||||
<>
|
<div sx={{ display: 'flex', alignItems: 'center' }}>
|
||||||
<FiberManualRecord sx={{ fontSize: '8px', mr: '10px' }} />
|
<FiberManualRecord sx={{ fontSize: '8px', mr: '10px' }} />
|
||||||
<a
|
<a
|
||||||
href={data.path} // Replace 'data.download_link' with the actual download link
|
href={data.path}
|
||||||
target="_blank" // Optional: Open the link in a new tab
|
target="_blank"
|
||||||
rel="noopener noreferrer" // Recommended when using target="_blank"
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
{data.file_name}
|
{data.file_name}
|
||||||
</a>
|
</a>
|
||||||
</>
|
</div>
|
||||||
) : null}
|
<a
|
||||||
</ListItem>
|
onClick={() => { setOpenDialog(true); setIdFile(data.id); setId(null); }}
|
||||||
|
style={{ cursor: 'pointer' }}
|
||||||
|
>
|
||||||
|
<DeleteForever color='error'/>
|
||||||
|
</a>
|
||||||
|
</ListItem>
|
||||||
|
) : null
|
||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Card>
|
</Card>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -492,7 +539,7 @@ export default function DetailMonitoringList() {
|
|||||||
|
|
||||||
{/* Dialog Delete */}
|
{/* Dialog Delete */}
|
||||||
<MuiDialog
|
<MuiDialog
|
||||||
title={{name: "Delete Daily Monitoring"}}
|
title={{name: id_file ? "Delete File Daily Monitoring" : "Delete Daily Monitoring"}}
|
||||||
openDialog={openDialog}
|
openDialog={openDialog}
|
||||||
setOpenDialog={setOpenDialog}
|
setOpenDialog={setOpenDialog}
|
||||||
content={getContent()}
|
content={getContent()}
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ export const getMonitoringDetailList = async ( claim_code: string ): Promise<Det
|
|||||||
|
|
||||||
return response;
|
return response;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Monitoring Detail List
|
* Get Monitoring Detail List
|
||||||
*/
|
*/
|
||||||
@@ -117,3 +118,61 @@ export const getOrganizationId = async ( claim_code: string ): Promise<number> =
|
|||||||
|
|
||||||
return response;
|
return response;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get detail monitoring
|
||||||
|
*/
|
||||||
|
export const getMonitoringDetailById = async ( id: string) => {
|
||||||
|
const response = await axios.get(`/case_management/daily_monitoring/detail/${id}/edit`)
|
||||||
|
.then((res) =>{
|
||||||
|
return res.data.data;
|
||||||
|
})
|
||||||
|
.catch((res) => {
|
||||||
|
enqueueSnackbar("server error !", {
|
||||||
|
variant: 'error',
|
||||||
|
});
|
||||||
|
|
||||||
|
return [];
|
||||||
|
});
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update detail monitoring
|
||||||
|
*/
|
||||||
|
export const UpdateMonitoringDetail = async (data: DetailMonitoringListType) => {
|
||||||
|
data.lab_date = data.lab_date != '' && data.lab_date != null ? fDateOnly(data.lab_date) : '';
|
||||||
|
data.submission_date = data.submission_date != '' && data.submission_date != null ? fDateOnly(data.submission_date) : '';
|
||||||
|
|
||||||
|
const formData = makeFormData({...data});
|
||||||
|
|
||||||
|
const response = await axios.post(`/case_management/daily_monitoring/detail/update-request`, formData)
|
||||||
|
.then((res) =>{
|
||||||
|
enqueueSnackbar(res.data.message, {
|
||||||
|
variant: 'success',
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.catch((res) => {
|
||||||
|
if (res.response.status == 400) {
|
||||||
|
let arr_message = res.response.data.message;
|
||||||
|
|
||||||
|
for (const key in arr_message) {
|
||||||
|
enqueueSnackbar(arr_message[key][0], {
|
||||||
|
variant: 'warning',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
enqueueSnackbar("server error !", {
|
||||||
|
variant: 'error',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|||||||
@@ -50,21 +50,22 @@ export type ClaimListType = {
|
|||||||
export type DetailMonitoringListType = {
|
export type DetailMonitoringListType = {
|
||||||
id : number|null,
|
id : number|null,
|
||||||
claim_id : string|null,
|
claim_id : string|null,
|
||||||
claim_code : string,
|
claim_code : string|undefined,
|
||||||
subject : string,
|
subject : string|undefined,
|
||||||
object : string,
|
object : string|undefined,
|
||||||
objective : string,
|
objective : string|undefined,
|
||||||
body_temperature: string,
|
body_temperature: string|undefined,
|
||||||
respiration_rate: string,
|
respiration_rate: string|undefined,
|
||||||
sistole : string,
|
sistole : string|undefined,
|
||||||
diastole : string
|
diastole : string|undefined
|
||||||
analysis : string,
|
analysis : string|undefined,
|
||||||
complaints : string,
|
complaints : string|undefined,
|
||||||
submission_date : string,
|
submission_date : string|undefined,
|
||||||
discharge_date : string,
|
discharge_date : string|undefined,
|
||||||
lab_date : string,
|
lab_date : string|undefined,
|
||||||
provider : string,
|
provider : string|undefined,
|
||||||
examination : string,
|
examination : string|undefined,
|
||||||
|
reason : string|undefined,
|
||||||
medical_plan : MedicalPlanStrType[],
|
medical_plan : MedicalPlanStrType[],
|
||||||
non_medikamentosa_plan : NonMedikamentosaPlanType[],
|
non_medikamentosa_plan : NonMedikamentosaPlanType[],
|
||||||
confirmation_medical_leter : files[],
|
confirmation_medical_leter : files[],
|
||||||
@@ -90,6 +91,7 @@ export type files = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type document = {
|
export type document = {
|
||||||
|
id: number
|
||||||
file_name: string,
|
file_name: string,
|
||||||
path: string,
|
path: string,
|
||||||
type: string
|
type: string
|
||||||
|
|||||||
@@ -492,7 +492,7 @@ export default function List() {
|
|||||||
Name
|
Name
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell style={headStyle} align="left">
|
<TableCell style={headStyle} align="left">
|
||||||
Date of Submission
|
Date of Admission
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell style={headStyle} align="left">
|
<TableCell style={headStyle} align="left">
|
||||||
Service Type
|
Service Type
|
||||||
|
|||||||
@@ -397,7 +397,7 @@ const dummyServices = [
|
|||||||
|
|
||||||
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
|
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
|
||||||
const createMenu = Boolean(anchorEl);
|
const createMenu = Boolean(anchorEl);
|
||||||
const importHospital = useRef<HTMLInputElement>(null);
|
const importClaimManagement = useRef<HTMLInputElement>(null);
|
||||||
const [currentImportFileName, setCurrentImportFileName] = useState(null);
|
const [currentImportFileName, setCurrentImportFileName] = useState(null);
|
||||||
const [importLoading, setImportLoading] = useState(false);
|
const [importLoading, setImportLoading] = useState(false);
|
||||||
const [importResult, setImportResult] = useState(null);
|
const [importResult, setImportResult] = useState(null);
|
||||||
@@ -408,18 +408,18 @@ const dummyServices = [
|
|||||||
setAnchorEl(null);
|
setAnchorEl(null);
|
||||||
};
|
};
|
||||||
const handleImportButton = () => {
|
const handleImportButton = () => {
|
||||||
if (importHospital?.current) {
|
if (importClaimManagement?.current) {
|
||||||
handleClose();
|
handleClose();
|
||||||
importHospital.current ? importHospital.current.click() : console.log('No File selected');
|
importClaimManagement.current ? importClaimManagement.current.click() : console.log('No File selected');
|
||||||
} else {
|
} else {
|
||||||
alert('No file selected');
|
alert('No file selected');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleCancelImportButton = () => {
|
const handleCancelImportButton = () => {
|
||||||
if(importHospital.current)
|
if(importClaimManagement.current)
|
||||||
{
|
{
|
||||||
importHospital.current.value = '';
|
importClaimManagement.current.value = '';
|
||||||
importHospital.current.dispatchEvent(new Event('change', { bubbles: true }));
|
importClaimManagement.current.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleImportChange = (event: any) => {
|
const handleImportChange = (event: any) => {
|
||||||
@@ -430,11 +430,11 @@ const dummyServices = [
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleUpload = () => {
|
const handleUpload = () => {
|
||||||
if(importHospital.current && importHospital.current.files)
|
if(importClaimManagement.current && importClaimManagement.current.files)
|
||||||
{
|
{
|
||||||
if (importHospital.current?.files.length) {
|
if (importClaimManagement.current?.files.length) {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('file', importHospital.current?.files[0]);
|
formData.append('file', importClaimManagement.current?.files[0]);
|
||||||
setImportLoading(true);
|
setImportLoading(true);
|
||||||
axios
|
axios
|
||||||
.post('claims/import', formData)
|
.post('claims/import', formData)
|
||||||
@@ -443,7 +443,7 @@ const dummyServices = [
|
|||||||
loadDataTableData();
|
loadDataTableData();
|
||||||
setImportResult(response.data);
|
setImportResult(response.data);
|
||||||
setImportLoading(false);
|
setImportLoading(false);
|
||||||
enqueueSnackbar('Success Import Hospitals', { variant: 'success' });
|
enqueueSnackbar('Success Import Claim Managemenet', { variant: 'success' });
|
||||||
})
|
})
|
||||||
.catch((response) => {
|
.catch((response) => {
|
||||||
enqueueSnackbar(
|
enqueueSnackbar(
|
||||||
@@ -474,7 +474,7 @@ const dummyServices = [
|
|||||||
const handleExportReportFiled = async () => {
|
const handleExportReportFiled = async () => {
|
||||||
|
|
||||||
await axios
|
await axios
|
||||||
.post('claims/exportFiled', { params: importResult?.data.failed_rows })
|
.post('claims/exportFiled', { params: importResult?.data.result_rows })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
enqueueSnackbar('Data berhasil di Export', {
|
enqueueSnackbar('Data berhasil di Export', {
|
||||||
variant: 'success',
|
variant: 'success',
|
||||||
@@ -792,7 +792,7 @@ const handleExportReportFiled = async () => {
|
|||||||
<input
|
<input
|
||||||
type="file"
|
type="file"
|
||||||
id="file"
|
id="file"
|
||||||
ref={importHospital}
|
ref={importClaimManagement}
|
||||||
style={{ display: 'none' }}
|
style={{ display: 'none' }}
|
||||||
onChange={handleImportChange}
|
onChange={handleImportChange}
|
||||||
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/plain"
|
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/plain"
|
||||||
@@ -975,11 +975,12 @@ const handleExportReportFiled = async () => {
|
|||||||
<Box sx={{ color: 'error.main', display: 'inline' }}>
|
<Box sx={{ color: 'error.main', display: 'inline' }}>
|
||||||
{importResult.data.total_failed_row}
|
{importResult.data.total_failed_row}
|
||||||
</Box>{' '}
|
</Box>{' '}
|
||||||
Failed
|
Failed,
|
||||||
{/* {importResult.data.failed_rows.map((row, index) => (
|
{/* {importResult.data.failed_rows.map((row, index) => (
|
||||||
<Typography variant='body' key={index} color="error"> [Code={row.code ? row.code : 'Required'}]</Typography>
|
<Typography variant='body' key={index} color="error"> [Code={row.code ? row.code : 'Required'}]</Typography>
|
||||||
))} */}
|
))} */}
|
||||||
<u onClick={handleExportReportFiled} style={{cursor:'pointer'}}>Download Data Filed</u>
|
Report:
|
||||||
|
<u onClick={handleExportReportFiled} style={{cursor:'pointer'}}>Download Data Result Import</u>
|
||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -359,7 +359,11 @@ export default function List() {
|
|||||||
<TableCell align="left">{row.code}</TableCell>
|
<TableCell align="left">{row.code}</TableCell>
|
||||||
<TableCell align="left">{row.provider}</TableCell>
|
<TableCell align="left">{row.provider}</TableCell>
|
||||||
<TableCell align="left">{row.member_name}</TableCell>
|
<TableCell align="left">{row.member_name}</TableCell>
|
||||||
<TableCell align="left"><Label>{fDateTimesecond(row.admission_date)}</Label></TableCell>
|
<TableCell align="left">
|
||||||
|
{row.admission_date ? (
|
||||||
|
<Label>{fDateTimesecond(row.admission_date)}</Label>
|
||||||
|
) : '-'}
|
||||||
|
</TableCell>
|
||||||
<TableCell align="left">{row.service_name}</TableCell>
|
<TableCell align="left">{row.service_name}</TableCell>
|
||||||
<TableCell align="left">{row.payment_type_name}</TableCell>
|
<TableCell align="left">{row.payment_type_name}</TableCell>
|
||||||
<TableCell align="left">
|
<TableCell align="left">
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ export type FinalLogType = {
|
|||||||
member_name : string,
|
member_name : string,
|
||||||
submission_date_fgl : string,
|
submission_date_fgl : string,
|
||||||
submission_date : string,
|
submission_date : string,
|
||||||
admission_date : string,
|
|
||||||
created_at : string,
|
|
||||||
service_name : string,
|
service_name : string,
|
||||||
payment_type_name : string,
|
payment_type_name : string,
|
||||||
status_final_log : string,
|
status_final_log : string,
|
||||||
|
|||||||
@@ -232,6 +232,10 @@ export default function Router() {
|
|||||||
path: 'daily_monitoring/:member_id/claims/:claim_code/add_monitoring',
|
path: 'daily_monitoring/:member_id/claims/:claim_code/add_monitoring',
|
||||||
element: <DetailMonitoringForm />
|
element: <DetailMonitoringForm />
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'daily_monitoring/:member_id/claims/:claim_code/:id',
|
||||||
|
element: <DetailMonitoringForm />
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'daily_monitoring/:member_id/claims/:claim_code/list_monitoring',
|
path: 'daily_monitoring/:member_id/claims/:claim_code/list_monitoring',
|
||||||
element: <DetailMonitoringList />
|
element: <DetailMonitoringList />
|
||||||
|
|||||||
Reference in New Issue
Block a user