view, search dan tambah daily monitoring
This commit is contained in:
@@ -13,6 +13,7 @@ use Illuminate\Support\Facades\Validator;
|
|||||||
use Illuminate\Support\Facades\File as Files;
|
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;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,11 +39,27 @@ class DailyMonitoringController extends Controller
|
|||||||
|
|
||||||
public function GetMemberList(Request $request)
|
public function GetMemberList(Request $request)
|
||||||
{
|
{
|
||||||
$memberList = DB::table('request_logs')
|
$startDate = $request->start_date ? Carbon::parse($request->start_date) : Carbon::today();
|
||||||
|
$endDate = $request->end_date ? Carbon::parse($request->end_date)->addDay() : Carbon::today()->addDay();
|
||||||
|
|
||||||
|
$memberList = DB::table('request_log_daily_monitorings')
|
||||||
|
->leftJoin('request_logs', 'request_log_daily_monitorings.request_log_id', '=', 'request_logs.id')
|
||||||
->leftJoin('members', 'request_logs.member_id', '=', 'members.id')
|
->leftJoin('members', 'request_logs.member_id', '=', 'members.id')
|
||||||
->leftJoin('organizations', 'organizations.id', '=', 'request_logs.organization_id')
|
->leftJoin('organizations', 'organizations.id', '=', 'request_logs.organization_id')
|
||||||
->select('members.member_id','members.name','members.members_effective_date AS startdate','members.members_expire_date AS enddate', 'request_logs.submission_date as addmision_date', 'organizations.name as provider', 'request_logs.organization_id' )
|
->select(
|
||||||
->where('request_logs.service_code', 'IP')
|
'members.member_id',
|
||||||
|
'members.name',
|
||||||
|
'members.birth_date',
|
||||||
|
'members.record_type as member_type',
|
||||||
|
'members.members_effective_date AS startdate',
|
||||||
|
'members.members_expire_date AS enddate',
|
||||||
|
'request_logs.submission_date as addmision_date',
|
||||||
|
'organizations.name as provider',
|
||||||
|
'request_logs.organization_id',
|
||||||
|
'request_logs.code',
|
||||||
|
'request_log_daily_monitorings.*'
|
||||||
|
)
|
||||||
|
// ->where('request_logs.service_code', 'IP')
|
||||||
->where('request_logs.deleted_at', null)
|
->where('request_logs.deleted_at', null)
|
||||||
->when($request->search, function ($q, $search) {
|
->when($request->search, function ($q, $search) {
|
||||||
$q->where(function ($subQ) use ($search) {
|
$q->where(function ($subQ) use ($search) {
|
||||||
@@ -50,13 +67,17 @@ class DailyMonitoringController extends Controller
|
|||||||
$subQ->orWhere('members.name','LIKE',"%".$search."%");
|
$subQ->orWhere('members.name','LIKE',"%".$search."%");
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
->when($startDate, function ($q) use ($startDate) {
|
||||||
|
$q->where('request_log_daily_monitorings.submission_date', '>=', $startDate);
|
||||||
|
})
|
||||||
|
->when($endDate, function ($q) use ($endDate) {
|
||||||
|
$q->where('request_log_daily_monitorings.submission_date', '<=', Carbon::parse($endDate)->addDay());
|
||||||
|
})
|
||||||
// ->where('request_logs.status_final_log', 'approved')
|
// ->where('request_logs.status_final_log', 'approved')
|
||||||
->groupBy('request_logs.member_id', 'request_logs.organization_id')
|
// ->groupBy('request_logs.member_id', 'request_logs.organization_id')
|
||||||
->orderBy('request_logs.created_at', 'desc')
|
->orderBy('request_logs.created_at', 'desc')
|
||||||
// ->get()
|
// ->get()
|
||||||
->paginate();
|
->paginate();
|
||||||
|
|
||||||
|
|
||||||
return Helper::paginateResources(DailyMonitoringResource::collection($memberList));
|
return Helper::paginateResources(DailyMonitoringResource::collection($memberList));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -620,6 +641,181 @@ class DailyMonitoringController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function AddListRequestLog(Request $request)
|
||||||
|
{
|
||||||
|
// validation rule
|
||||||
|
$validator = Validator::make($request->all(),[
|
||||||
|
'log_code' => 'required|exists:request_logs,id',
|
||||||
|
'subject' => 'required',
|
||||||
|
'submission_date' => 'required',
|
||||||
|
'body_temperature' => 'required',
|
||||||
|
'sistole' => 'required',
|
||||||
|
'diastole' => 'required',
|
||||||
|
'respiration_rate' => 'required',
|
||||||
|
'analysis' => 'required',
|
||||||
|
'medical_plan' => 'required',
|
||||||
|
'non_medikamentosa_plan' => 'required',
|
||||||
|
],$this->messages());
|
||||||
|
|
||||||
|
// validation error
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => true,
|
||||||
|
'message' => $validator->getMessageBag()
|
||||||
|
],400);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get claim request
|
||||||
|
$request_log = DB::table('request_logs')
|
||||||
|
->select('id')
|
||||||
|
->where('id', $request->log_code)
|
||||||
|
->first();
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
// insert claim daily monitoring
|
||||||
|
$db_response = RequestDailyMonitoring::create([
|
||||||
|
'request_log_id' => $request->log_code,
|
||||||
|
'submission_date' => $request->submission_date,
|
||||||
|
'doctor_1' => $request->doctor_1,
|
||||||
|
'doctor_2' => $request->doctor_2,
|
||||||
|
'temp_diagnosis' => $request->temp_diagnosis,
|
||||||
|
'final_diagnosis' => $request->final_diagnosis,
|
||||||
|
'approval_pendamping' => $request->approval_pendamping,
|
||||||
|
'description' => $request->keterangan,
|
||||||
|
'note' => $request->catatan,
|
||||||
|
'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,
|
||||||
|
'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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// insert medical plan
|
||||||
|
foreach ($request->medical_plan as $row) {
|
||||||
|
DB::table('request_log_medical_plan')->insert([
|
||||||
|
'request_log_daily_monitoring_id' => $db_response->id,
|
||||||
|
'plan' => $row['medical_plan_str'],
|
||||||
|
'type' => 1,
|
||||||
|
'created_at' => date('Y-m-d'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// insert non medical plan
|
||||||
|
foreach ($request->non_medikamentosa_plan as $row) {
|
||||||
|
DB::table('request_log_medical_plan')->insert([
|
||||||
|
'request_log_daily_monitoring_id' => $db_response->id,
|
||||||
|
'plan' => $row['non_medikamentosa_plan_str'],
|
||||||
|
'type' => 2,
|
||||||
|
'created_at' => date('Y-m-d'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// insert file result
|
||||||
|
if ($request->confirmation_medical_leter){
|
||||||
|
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' => $db_response->id,
|
||||||
|
'type' => 'confirmation-medical-letter',
|
||||||
|
'name' => $name,
|
||||||
|
'original_name' => $orignalName,
|
||||||
|
'extension' => $extension,
|
||||||
|
'path' => $path,
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($request->medical_action_letter){
|
||||||
|
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' => $db_response->id,
|
||||||
|
'type' => 'medical-action-letter',
|
||||||
|
'name' => $name,
|
||||||
|
'original_name' => $orignalName,
|
||||||
|
'extension' => $extension,
|
||||||
|
'path' => $path,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// $file->storeAs($this->path_for_store, $fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($request->result){
|
||||||
|
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' => $db_response->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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete Listing Daily Monitoring
|
* Delete Listing Daily Monitoring
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -236,6 +236,25 @@ class RequestLogController extends Controller
|
|||||||
return Helper::responseJson(data: $manipulatedIcds);
|
return Helper::responseJson(data: $manipulatedIcds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function codeLog(Request $request){
|
||||||
|
$codeLogs = RequestLog::with(['member'])->when($request->search, function ($q, $search) {
|
||||||
|
$q->where('code', 'LIKE', "%".$search."%");
|
||||||
|
$q->orWhereHas('member', function ($subQuery) use ($search) {
|
||||||
|
$subQuery->where('name', 'LIKE', "%".$search."%");
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->paginate();
|
||||||
|
|
||||||
|
$manipulatedIcds = $codeLogs->map(function ($codeLog) {
|
||||||
|
// Contoh manipulasi, tambahkan atau ubah properti sesuai kebutuhan
|
||||||
|
return [
|
||||||
|
'value' => $codeLog->id, // Ganti dengan properti yang sesuai dari model Icd
|
||||||
|
'label' => $codeLog->code . ' - ' .$codeLog->member->name, // Ganti dengan properti yang sesuai dari model Icd
|
||||||
|
];
|
||||||
|
});
|
||||||
|
return Helper::responseJson(data: $manipulatedIcds);
|
||||||
|
}
|
||||||
|
|
||||||
public function hospitals(){
|
public function hospitals(){
|
||||||
$organizations = Organization::query()
|
$organizations = Organization::query()
|
||||||
->where([
|
->where([
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ Route::prefix('internal')->group(function () {
|
|||||||
|
|
||||||
|
|
||||||
Route::get('diagnosis', [RequestLogController::class, 'diagnosis']);
|
Route::get('diagnosis', [RequestLogController::class, 'diagnosis']);
|
||||||
|
Route::get('codeLog', [RequestLogController::class, 'codeLog']);
|
||||||
Route::get('drugs', [AutocompleteController::class, 'drugList']);
|
Route::get('drugs', [AutocompleteController::class, 'drugList']);
|
||||||
Route::get('units', [AutocompleteController::class, 'unitList']);
|
Route::get('units', [AutocompleteController::class, 'unitList']);
|
||||||
|
|
||||||
@@ -207,6 +208,7 @@ Route::prefix('internal')->group(function () {
|
|||||||
Route::post('detail/update-request', [DailyMonitoringController::class, 'UpdateDetailMonitoringbyID']);
|
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('add-request', [DailyMonitoringController::class, 'AddListRequestLog']);
|
||||||
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']);
|
Route::get('detail/{id}/delete-file', [DailyMonitoringController::class, 'deleteFileDetailMonitoringListRequestLog']);
|
||||||
|
|||||||
@@ -14,15 +14,26 @@ class DailyMonitoringResource extends JsonResource
|
|||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
{
|
{
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
|
'code' => $this->code,
|
||||||
|
'id' => $this->id,
|
||||||
'member_id' => $this->member_id,
|
'member_id' => $this->member_id,
|
||||||
|
'member_type' => $this->member_type,
|
||||||
|
'birth_date' => $this->birth_date,
|
||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
'start_date' => $this->startdate,
|
'start_date' => $this->startdate,
|
||||||
'end_date' => $this->enddate,
|
'end_date' => $this->enddate,
|
||||||
'addmision_date' => $this->addmision_date,
|
'addmision_date' => $this->addmision_date,
|
||||||
'provider' => $this->provider,
|
'provider' => $this->provider,
|
||||||
'organization_id' => $this->organization_id,
|
'organization_id' => $this->organization_id,
|
||||||
|
'doctor_1' => $this->doctor_1,
|
||||||
|
'doctor_2' => $this->doctor_2,
|
||||||
|
'temp_diagnosis' => $this->temp_diagnosis,
|
||||||
|
'final_diagnosis' => $this->final_diagnosis,
|
||||||
|
'approval_pendamping' => $this->approval_pendamping,
|
||||||
|
'status' => $this->status,
|
||||||
|
'description' => strip_tags($this->description),
|
||||||
|
'note' => strip_tags($this->note),
|
||||||
];
|
];
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
|||||||
@@ -16,6 +16,13 @@ class RequestDailyMonitoring extends Model
|
|||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'request_log_id',
|
'request_log_id',
|
||||||
|
'doctor_1',
|
||||||
|
'doctor_2',
|
||||||
|
'temp_diagnosis',
|
||||||
|
'final_diagnosis',
|
||||||
|
'approval_pendamping',
|
||||||
|
'description',
|
||||||
|
'note',
|
||||||
'subject',
|
'subject',
|
||||||
'object',
|
'object',
|
||||||
'submission_date',
|
'submission_date',
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('request_log_daily_monitorings', function (Blueprint $table) {
|
||||||
|
$table->string('doctor_1')->after('examination')->nullable();
|
||||||
|
$table->string('doctor_2')->after('doctor_1')->nullable();
|
||||||
|
$table->string('approval_pendamping')->after('doctor_2')->nullable();
|
||||||
|
$table->text('description')->after('approval_pendamping')->nullable();
|
||||||
|
$table->text('note')->after('description')->nullable();
|
||||||
|
$table->string('temp_diagnosis')->after('note')->nullable();
|
||||||
|
$table->string('final_diagnosis')->after('temp_diagnosis')->nullable();
|
||||||
|
$table->string('status')->after('final_diagnosis')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('request_log_daily_monitorings', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('doctor_1');
|
||||||
|
$table->dropColumn('doctor_2');
|
||||||
|
$table->dropColumn('description');
|
||||||
|
$table->dropColumn('note');
|
||||||
|
$table->dropColumn('temp_diagnosis');
|
||||||
|
$table->dropColumn('final_diagnosis');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
* ============================================
|
* ============================================
|
||||||
*/
|
*/
|
||||||
import React, { ChangeEvent, useEffect, useRef, useState } from "react";
|
import React, { ChangeEvent, useEffect, useRef, useState } from "react";
|
||||||
import { Box, Paper, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Stack, TextField, Button, Menu, } from "@mui/material";
|
import { Box, Paper, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Stack, TextField, Button, Menu, Typography, ButtonGroup, } from "@mui/material";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Types & Functions
|
* Types & Functions
|
||||||
@@ -15,9 +15,18 @@ import DailyMonitoringListRow from "./DailyMonitoringListRow";
|
|||||||
import { LaravelPaginatedData, LaravelPaginatedDataDefault } from "@/@types/paginated-data";
|
import { LaravelPaginatedData, LaravelPaginatedDataDefault } from "@/@types/paginated-data";
|
||||||
import { Grid } from "@mui/material";
|
import { Grid } from "@mui/material";
|
||||||
import DataTable from '../../../../components/LaravelTable';
|
import DataTable from '../../../../components/LaravelTable';
|
||||||
|
import DownloadIcon from '@mui/icons-material/Download';
|
||||||
|
import CancelIcon from '@mui/icons-material/Cancel';
|
||||||
|
import UploadIcon from '@mui/icons-material/Upload';
|
||||||
import { MenuItem } from "@mui/material";
|
import { MenuItem } from "@mui/material";
|
||||||
import { useSearchParams } from "react-router-dom";
|
import { useNavigate, useSearchParams } from "react-router-dom";
|
||||||
import axios from "@/utils/axios";
|
import axios from "@/utils/axios";
|
||||||
|
import { DesktopDatePicker, LocalizationProvider } from "@mui/x-date-pickers";
|
||||||
|
import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns";
|
||||||
|
import { fDateOnly } from "@/utils/formatTime";
|
||||||
|
import { LoadingButton } from "@mui/lab";
|
||||||
|
import { Import } from "@/@types/claims";
|
||||||
|
import { HeadCell, Order } from '@/@types/table';
|
||||||
|
|
||||||
export default function DailyMonitoringList() {
|
export default function DailyMonitoringList() {
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
@@ -34,8 +43,7 @@ export default function DailyMonitoringList() {
|
|||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [importResult, setImportResult] = useState<Import>(null);
|
||||||
|
|
||||||
// Load Data
|
// Load Data
|
||||||
// -------------------
|
// -------------------
|
||||||
const loadDataTableData = async (appliedFilter: any | null = null) => {
|
const loadDataTableData = async (appliedFilter: any | null = null) => {
|
||||||
@@ -57,46 +65,156 @@ export default function DailyMonitoringList() {
|
|||||||
loadDataTableData(filter);
|
loadDataTableData(filter);
|
||||||
setSearchParams(filter);
|
setSearchParams(filter);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------ handle params ----------------------------- */
|
||||||
|
const [appliedParams, setAppliedParams] = useState({});
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
searchParams: searchParams,
|
||||||
|
setSearchParams: setSearchParams,
|
||||||
|
appliedParams: appliedParams,
|
||||||
|
setAppliedParams: setAppliedParams,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* ------------------------------ handle order ------------------------------ */
|
||||||
|
const [order, setOrder] = useState<Order>('desc');
|
||||||
|
const [orderBy, setOrderBy] = useState('submission_date');
|
||||||
|
|
||||||
|
const orders = {
|
||||||
|
order: order,
|
||||||
|
setOrder: setOrder,
|
||||||
|
orderBy: orderBy,
|
||||||
|
setOrderBy: setOrderBy,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* ------------------------------- handle sort ------------------------------ */
|
||||||
|
const handleRequestSort = async (event: React.MouseEvent<unknown>, property: string) => {
|
||||||
|
const isAsc = orders?.orderBy === property && orders?.order === 'asc';
|
||||||
|
|
||||||
|
orders?.setOrder(isAsc ? 'desc' : 'asc');
|
||||||
|
orders?.setOrderBy(property);
|
||||||
|
const parameters = Object.fromEntries([
|
||||||
|
...(params?.searchParams.entries() as IterableIterator<[string, string]>),
|
||||||
|
['order', isAsc ? 'desc' : 'asc'],
|
||||||
|
['orderBy', property],
|
||||||
|
]);
|
||||||
|
params?.setAppliedParams(parameters);
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadDataTableData();
|
loadDataTableData();
|
||||||
}, [])
|
}, [appliedParams, searchParams, order, orderBy, setSearchParams])
|
||||||
|
|
||||||
function SearchInput(props: any) {
|
function SearchInput(props: any) {
|
||||||
// SEARCH
|
// SEARCH
|
||||||
const searchInput = useRef<HTMLInputElement>(null);
|
const searchInput = useRef<HTMLInputElement>(null);
|
||||||
const [searchText, setSearchText] = useState('');
|
const [searchText, setSearchText] = useState('');
|
||||||
|
// Start Date
|
||||||
|
// con
|
||||||
|
|
||||||
const handleSearchChange = (event: any) => {
|
const handleSearchChange = (event: any) => {
|
||||||
const newSearchText = event.target.value ?? '';
|
const newSearchText = event.target.value ?? '';
|
||||||
setSearchText(newSearchText);
|
setSearchText(newSearchText);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSearchSubmit = (event: any) => {
|
|
||||||
event.preventDefault();
|
const today = new Date(); // Default ke hari ini
|
||||||
props.onSearch({ search: searchText }); // Trigger to Parent
|
|
||||||
};
|
const [startDate, setStartDate] = useState<Date | null>(today);
|
||||||
|
const [endDate, setEndDate] = useState<Date | null>(today);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// Set nilai default saat pertama kali load jika searchParams kosong
|
||||||
|
const paramStartDate = searchParams.get('start_date');
|
||||||
|
const paramEndDate = searchParams.get('end_date');
|
||||||
|
|
||||||
|
if (paramStartDate) {
|
||||||
|
setStartDate(new Date(paramStartDate));
|
||||||
|
}
|
||||||
|
if (paramEndDate) {
|
||||||
|
setEndDate(new Date(paramEndDate));
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Trigger First Search
|
// Trigger First Search
|
||||||
setSearchText(searchParams.get('search') ?? '');
|
setSearchText(searchParams.get('search') ?? '');
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form onSubmit={handleSearchSubmit} style={{ width: '100%' }}>
|
<form style={{ width: '100%' }}>
|
||||||
<TextField
|
<Grid container spacing={2} >
|
||||||
id="search-input"
|
<Grid item md={8}>
|
||||||
ref={searchInput}
|
<TextField
|
||||||
label="Search"
|
id="search-input"
|
||||||
variant="outlined"
|
ref={searchInput}
|
||||||
fullWidth
|
label="Search"
|
||||||
onChange={handleSearchChange}
|
variant="outlined"
|
||||||
value={searchText}
|
fullWidth
|
||||||
placeholder='Search Member Code or Member Name...'
|
onChange={handleSearchChange}
|
||||||
/>
|
onKeyDown={(event) => {
|
||||||
|
if (event.key === 'Enter') {
|
||||||
|
// handleSearchSubmit(event);
|
||||||
|
|
||||||
|
const filter = Object.fromEntries([
|
||||||
|
...searchParams.entries(),
|
||||||
|
['search', searchText],
|
||||||
|
]);
|
||||||
|
setSearchParams(filter);
|
||||||
|
loadDataTableData(filter);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
value={searchText}
|
||||||
|
placeholder='Search Code or Name...'
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
{/* Start Date */}
|
||||||
|
<Grid item md={2}>
|
||||||
|
<LocalizationProvider dateAdapter={AdapterDateFns}>
|
||||||
|
<DesktopDatePicker
|
||||||
|
label="Start Date"
|
||||||
|
inputFormat="dd/MM/yyyy"
|
||||||
|
value={startDate}
|
||||||
|
onChange={(value) => {
|
||||||
|
if (value) {
|
||||||
|
setStartDate(value);
|
||||||
|
const dateStr = fDateOnly(value);
|
||||||
|
const filter = Object.fromEntries([...searchParams.entries(), ['start_date', dateStr]]);
|
||||||
|
setSearchParams(filter);
|
||||||
|
loadDataTableData(filter);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
renderInput={(params) => <TextField {...params} variant="outlined" />}
|
||||||
|
/>
|
||||||
|
</LocalizationProvider>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
{/* End Date */}
|
||||||
|
<Grid item md={2}>
|
||||||
|
<LocalizationProvider dateAdapter={AdapterDateFns}>
|
||||||
|
<DesktopDatePicker
|
||||||
|
label="End Date"
|
||||||
|
inputFormat="dd/MM/yyyy"
|
||||||
|
value={endDate}
|
||||||
|
onChange={(value) => {
|
||||||
|
if (value) {
|
||||||
|
setEndDate(value);
|
||||||
|
const dateStr = fDateOnly(value);
|
||||||
|
const filter = Object.fromEntries([...searchParams.entries(), ['end_date', dateStr]]);
|
||||||
|
setSearchParams(filter);
|
||||||
|
loadDataTableData(filter);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
renderInput={(params) => <TextField {...params} variant="outlined" />}
|
||||||
|
/>
|
||||||
|
</LocalizationProvider>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ImportForm(props: any) {
|
function ImportForm(props: any) {
|
||||||
// IMPORT
|
// IMPORT
|
||||||
@@ -110,6 +228,7 @@ export default function DailyMonitoringList() {
|
|||||||
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
||||||
setAnchorEl(event.currentTarget);
|
setAnchorEl(event.currentTarget);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
setAnchorEl(null);
|
setAnchorEl(null);
|
||||||
};
|
};
|
||||||
@@ -124,7 +243,8 @@ export default function DailyMonitoringList() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleCancelImportButton = () => {
|
const handleCancelImportButton = () => {
|
||||||
|
importForm.current.value = '';
|
||||||
|
importForm.current.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleImportChange = (event: any) => {
|
const handleImportChange = (event: any) => {
|
||||||
@@ -136,32 +256,146 @@ export default function DailyMonitoringList() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleUpload = () => {
|
const handleUpload = () => {
|
||||||
|
if (importForm.current?.files.length) {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append('file', importForm.current?.files[0]);
|
||||||
|
|
||||||
|
setImportLoading(true);
|
||||||
|
axios
|
||||||
|
.post(`customer-service/request/import`, formData)
|
||||||
|
.then((response) => {
|
||||||
|
handleCancelImportButton();
|
||||||
|
loadDataTableData();
|
||||||
|
setImportResult(response.data);
|
||||||
|
// alert('Succesfully read '+ response.data.total_successed_row + ' with ' + response.data.total_failed_row + ' failed rows');
|
||||||
|
setImportLoading(false);
|
||||||
|
})
|
||||||
|
.catch((response) => {
|
||||||
|
enqueueSnackbar(
|
||||||
|
'Looks like something went wrong. Please check your data and try again. ' +
|
||||||
|
response.message,
|
||||||
|
{ variant: 'error' }
|
||||||
|
);
|
||||||
|
setImportLoading(false);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
enqueueSnackbar('No File Selected', { variant: 'warning' });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleGetTemplate = (type :string) => {
|
const handleGetTemplate = (type :string) => {
|
||||||
|
axios.get('corporates/import-document-example/' + type)
|
||||||
|
.then((response) => {
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = response.data.data.file_url;
|
||||||
|
link.setAttribute('download', response.data.data.file_name);
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
handleClose();
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleGetData = (type :string) => {
|
const handleGetData = (type :string) => {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const navigate = useNavigate()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
<input
|
||||||
|
type="file"
|
||||||
|
id="file"
|
||||||
|
ref={importForm}
|
||||||
|
style={{ display: 'none' }}
|
||||||
|
onChange={handleImportChange}
|
||||||
|
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/plain"
|
||||||
|
/>
|
||||||
{!currentImportFileName && (
|
{!currentImportFileName && (
|
||||||
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
|
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
|
||||||
<SearchInput onSearch={applyFilter} />
|
<SearchInput onSearch={applyFilter} />
|
||||||
{/* <Button
|
<Button
|
||||||
variant="contained"
|
id="import-button"
|
||||||
startIcon={<AddIcon />}
|
startIcon={<DownloadIcon />}
|
||||||
sx={{ p: 1.8 }}
|
sx={{ p: 1.8, color: '#FFFFFF', backgroundColor: '#19BBBB', width: '125px', height: '48px' }}
|
||||||
onClick={() => {
|
aria-controls={createMenu ? 'basic-menu' : undefined}
|
||||||
navigate('/claim-requests/create');
|
aria-haspopup="true"
|
||||||
}}
|
aria-expanded={createMenu ? 'true' : undefined}
|
||||||
|
onClick={handleClick}
|
||||||
>
|
>
|
||||||
Create
|
Create
|
||||||
</Button> */}
|
</Button>
|
||||||
|
<Menu
|
||||||
|
id="import-button"
|
||||||
|
anchorEl={anchorEl}
|
||||||
|
open={createMenu}
|
||||||
|
onClose={handleClose}
|
||||||
|
MenuListProps={{
|
||||||
|
'aria-labelledby': 'basic-button',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<MenuItem onClick={handleImportButton}>
|
||||||
|
<Typography variant='body2'>Import</Typography>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem
|
||||||
|
onClick={() => {
|
||||||
|
handleGetTemplate('member');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography variant='body2'> Download Template</Typography>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem onClick={() => navigate(`/case_management/daily_monitoring/add_monitoring`)}>
|
||||||
|
<Typography variant='body2'>Tambah</Typography>
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
||||||
|
</Stack>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{currentImportFileName && (
|
||||||
|
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
|
||||||
|
<ButtonGroup variant="outlined" aria-label="outlined button group" fullWidth>
|
||||||
|
<Button onClick={handleImportButton} fullWidth>
|
||||||
|
{currentImportFileName ?? 'No File Selected'}
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={handleCancelImportButton}
|
||||||
|
size="small"
|
||||||
|
fullWidth={false}
|
||||||
|
sx={{ p: 1.8 }}
|
||||||
|
>
|
||||||
|
<CancelIcon color="error" />
|
||||||
|
</Button>
|
||||||
|
</ButtonGroup>
|
||||||
|
|
||||||
|
<LoadingButton
|
||||||
|
id="upload-button"
|
||||||
|
variant="outlined"
|
||||||
|
startIcon={<UploadIcon />}
|
||||||
|
sx={{ p: 1.8 }}
|
||||||
|
onClick={handleUpload}
|
||||||
|
loading={importLoading}
|
||||||
|
>
|
||||||
|
Upload
|
||||||
|
</LoadingButton>
|
||||||
|
</Stack>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{importResult && (
|
||||||
|
<Stack direction={'row'} sx={{ px: 2, pb: 2 }}>
|
||||||
|
<Box sx={{ color: 'text.secondary' }}>
|
||||||
|
Last Import Result :{' '}
|
||||||
|
<Box sx={{ color: 'success.main', display: 'inline' }}>
|
||||||
|
{importResult.total_success_row ?? 0}
|
||||||
|
</Box>{' '}
|
||||||
|
Row Processed,{' '}
|
||||||
|
<Box sx={{ color: 'error.main', display: 'inline' }}>
|
||||||
|
{importResult.total_failed_row}
|
||||||
|
</Box>{' '}
|
||||||
|
Failed, Report :{' '}
|
||||||
|
<a href={importResult.result_file?.url ?? '#'}>
|
||||||
|
{importResult.result_file?.name ?? '-'}
|
||||||
|
</a>
|
||||||
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -175,12 +409,19 @@ export default function DailyMonitoringList() {
|
|||||||
<TableHead>
|
<TableHead>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell style={TableHeadStyle} align="left" width={50} />
|
<TableCell style={TableHeadStyle} align="left" width={50} />
|
||||||
|
<TableCell style={TableHeadStyle} align="left" width={160}>Admission Date</TableCell>
|
||||||
<TableCell style={TableHeadStyle} align="left" width={150}>Member ID</TableCell>
|
<TableCell style={TableHeadStyle} align="left" width={150}>Member ID</TableCell>
|
||||||
<TableCell style={TableHeadStyle} align="left" width={'*'}>Name</TableCell>
|
<TableCell style={TableHeadStyle} align="left" width={'*'}>Name</TableCell>
|
||||||
<TableCell style={TableHeadStyle} align="left" width={160}>Start Date</TableCell>
|
<TableCell style={TableHeadStyle} align="left" width={160}>Tanggal Lahir</TableCell>
|
||||||
<TableCell style={TableHeadStyle} align="left" width={160}>End Date</TableCell>
|
<TableCell style={TableHeadStyle} align="left" width={160}>Member Type</TableCell>
|
||||||
<TableCell style={TableHeadStyle} align="left" width={160}>Admission Date</TableCell>
|
<TableCell style={TableHeadStyle} align="left" width={160}>Dokter 1</TableCell>
|
||||||
<TableCell style={TableHeadStyle} align="left" width={160}>Provider</TableCell>
|
<TableCell style={TableHeadStyle} align="left" width={160}>Dokter 2</TableCell>
|
||||||
|
<TableCell style={TableHeadStyle} align="left" width={160}>Temp Diagnosa</TableCell>
|
||||||
|
<TableCell style={TableHeadStyle} align="left" width={160}>Diagnosa Akhir</TableCell>
|
||||||
|
<TableCell style={TableHeadStyle} align="left" width={160}>Approval Pendamping</TableCell>
|
||||||
|
<TableCell style={TableHeadStyle} align="left" width={160}>Keterangan</TableCell>
|
||||||
|
<TableCell style={TableHeadStyle} align="left" width={160}>Penjaminan</TableCell>
|
||||||
|
<TableCell style={TableHeadStyle} align="left" width={160}>Catatan</TableCell>
|
||||||
<TableCell align="left" width={"10"} />
|
<TableCell align="left" width={"10"} />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHead>
|
</TableHead>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import TableMoreMenu from '@/components/table/TableMoreMenu';
|
|||||||
*/
|
*/
|
||||||
import { fDate } from "@/utils/formatTime";
|
import { fDate } from "@/utils/formatTime";
|
||||||
import { DailyMonitoringListType } from "../Model/Types";
|
import { DailyMonitoringListType } from "../Model/Types";
|
||||||
|
import { Edit } from "@mui/icons-material";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
row: DailyMonitoringListType,
|
row: DailyMonitoringListType,
|
||||||
@@ -29,12 +30,20 @@ type Props = {
|
|||||||
|
|
||||||
export default function DailyMonitoringListRow ({ ...props }: Props) {
|
export default function DailyMonitoringListRow ({ ...props }: Props) {
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
|
||||||
<TableRow hover sx={{ '& > td': { borderBottom: '1' } }}>
|
<TableRow hover sx={{ '& > td': { borderBottom: '1' } }}>
|
||||||
<TableCell align="left" />
|
<TableCell align="left" />
|
||||||
|
<TableCell align="left">
|
||||||
|
<Label
|
||||||
|
variant="ghost"
|
||||||
|
color="default"
|
||||||
|
>
|
||||||
|
{props.row.addmision_date ? fDate(props.row.addmision_date) : '-'}
|
||||||
|
</Label>
|
||||||
|
</TableCell>
|
||||||
<TableCell align="left">{props.row.member_id}</TableCell>
|
<TableCell align="left">{props.row.member_id}</TableCell>
|
||||||
<TableCell align="left">{props.row.name}</TableCell>
|
<TableCell align="left">{props.row.name}</TableCell>
|
||||||
<TableCell align="left">
|
<TableCell align="left">
|
||||||
@@ -42,34 +51,44 @@ export default function DailyMonitoringListRow ({ ...props }: Props) {
|
|||||||
variant="ghost"
|
variant="ghost"
|
||||||
color="default"
|
color="default"
|
||||||
>
|
>
|
||||||
{fDate(props.row.start_date)}
|
{props.row.birth_date ? fDate(props.row.birth_date) : '-'}
|
||||||
</Label>
|
</Label>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell align="left">
|
<TableCell align="left">
|
||||||
<Label
|
{props.row.member_type}
|
||||||
variant="ghost"
|
|
||||||
color="default"
|
|
||||||
>
|
|
||||||
{fDate(props.row.end_date)}
|
|
||||||
</Label>
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
<TableCell align="left">{props.row.doctor_1}</TableCell>
|
||||||
|
<TableCell align="left">{props.row.doctor_2}</TableCell>
|
||||||
|
<TableCell align="left">{props.row.temp_diagnosis}</TableCell>
|
||||||
|
<TableCell align="left">{props.row.final_diagnosis}</TableCell>
|
||||||
|
<TableCell align="left">{props.row.approval_pendamping}</TableCell>
|
||||||
<TableCell align="left">
|
<TableCell align="left">
|
||||||
<Label
|
{props.row.description
|
||||||
variant="ghost"
|
? props.row.description.length > 130
|
||||||
color="default"
|
? props.row.description.substring(0, 130) + "..."
|
||||||
>
|
: props.row.description
|
||||||
{fDate(props.row.addmision_date)}
|
: "-"}
|
||||||
</Label>
|
</TableCell>
|
||||||
|
<TableCell align="left">{props.row.provider || "-"}</TableCell>
|
||||||
|
<TableCell align="left">
|
||||||
|
{props.row.note
|
||||||
|
? props.row.note.length > 130
|
||||||
|
? props.row.note.substring(0, 130) + "..."
|
||||||
|
: props.row.note
|
||||||
|
: "-"}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell align="left">{props.row.provider}</TableCell>
|
|
||||||
<TableCell align="right" onClick={(e) => e.stopPropagation()}>
|
<TableCell align="right" onClick={(e) => e.stopPropagation()}>
|
||||||
<Stack direction="row" justifyContent="flex-end" spacing={1}>
|
<Stack direction="row" justifyContent="flex-end" spacing={1}>
|
||||||
<TableMoreMenu actions={
|
<TableMoreMenu actions={
|
||||||
<>
|
<>
|
||||||
<MenuItem onClick={() => navigate(`/case_management/daily_monitoring/${props.row.member_id}/${props.row.organization_id}/claims`)}>
|
<MenuItem onClick={() => navigate(`/case_management/daily_monitoring/${props.row.member_id}/claims/${props.row.code}/list_monitoring`)}>
|
||||||
<Visibility />
|
<Visibility />
|
||||||
View
|
View
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem onClick={() => navigate(`/case_management/daily_monitoring/${props.row.member_id}/claims/${props.row.code}/${props.row.id}`)}>
|
||||||
|
<Edit />
|
||||||
|
Edit
|
||||||
|
</MenuItem>
|
||||||
</>
|
</>
|
||||||
} />
|
} />
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -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, Autocomplete } from '@mui/material';
|
import { Box, IconButton, Typography, Grid, Card, Button, ButtonBase, Stack, Autocomplete, CircularProgress } from '@mui/material';
|
||||||
import { LoadingButton } from "@mui/lab";
|
import { LoadingButton } from "@mui/lab";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,41 +28,41 @@ import InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile';
|
|||||||
* Utils, Types, Functions
|
* Utils, Types, Functions
|
||||||
* ============================================
|
* ============================================
|
||||||
*/
|
*/
|
||||||
import { AddMonitoringDetail, UpdateMonitoringDetail, getMonitoringDetailById, getMonitoringDetailList, getMonitorungDetailById, getOrganizationId } from '../Model/Functions';
|
import { AddMonitoringDetail, UpdateMonitoringDetail, getMonitoringDetailById, 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, useMemo, useRef, useState } from 'react';
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { TextField } from '@mui/material';
|
import { TextField } from '@mui/material';
|
||||||
|
import axios from "@/utils/axios";
|
||||||
|
|
||||||
type Detail = {
|
type Detail = {
|
||||||
row : DetailMonitoringListType|undefined
|
row : DetailMonitoringListType|undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function DetailMonitoringList() {
|
export default function DetailMonitoringList() {
|
||||||
const { member_id, claim_code, id} = useParams();
|
const { member_id, id} = useParams();
|
||||||
const [organizationId, setOrganizationId] = useState<number|undefined>();
|
const [organizationId, setOrganizationId] = useState<number|undefined>();
|
||||||
const [isEdit, setIsEdit] = useState<boolean|undefined>(false);
|
const [isEdit, setIsEdit] = useState<boolean|undefined>(false);
|
||||||
const [data, setData] = useState<DetailMonitoringListType>();
|
const [data, setData] = useState<DetailMonitoringListType>();
|
||||||
|
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const pageTitle = claim_code??'_ _ _ _';
|
|
||||||
const fileInput1 = useRef<HTMLInputElement>(null);
|
const fileInput1 = useRef<HTMLInputElement>(null);
|
||||||
const fileInput2 = useRef<HTMLInputElement>(null);
|
const fileInput2 = useRef<HTMLInputElement>(null);
|
||||||
const fileInput3 = useRef<HTMLInputElement>(null);
|
const fileInput3 = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
const loadOrganizationID = async () => {
|
// const loadOrganizationID = async () => {
|
||||||
const organization_id = await getOrganizationId(claim_code??'');
|
// const organization_id = await getOrganizationId('');
|
||||||
setOrganizationId(organization_id);
|
// setOrganizationId(organization_id);
|
||||||
}
|
// }
|
||||||
const loadDetailDailyMonitoring = async () => {
|
const loadDetailDailyMonitoring = async () => {
|
||||||
const monitoring = await getMonitoringDetailById(id??'')
|
const monitoring = await getMonitoringDetailById('')
|
||||||
setData(monitoring)
|
setData(monitoring)
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadOrganizationID();
|
// loadOrganizationID();
|
||||||
if (id){
|
if (id){
|
||||||
loadDetailDailyMonitoring();
|
loadDetailDailyMonitoring();
|
||||||
setIsEdit(true)
|
setIsEdit(true)
|
||||||
@@ -75,7 +75,15 @@ export default function DetailMonitoringList() {
|
|||||||
const defaultValues = useMemo(
|
const defaultValues = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
id : data?.id ??'',
|
id : data?.id ??'',
|
||||||
claim_code : data?.claim_code ?? '',
|
// claim_code : data?.claim_code ?? '',
|
||||||
|
log_code : data?.log_code ?? '',
|
||||||
|
doctor_1 : data?.doctor_1 ?? '',
|
||||||
|
doctor_2 : data?.doctor_2 ?? '',
|
||||||
|
temp_diagnosis : data?.temp_diagnosis ?? '',
|
||||||
|
final_diagnosis : data?.final_diagnosis ?? '',
|
||||||
|
approval_pendamping : data?.approval_pendamping ?? '',
|
||||||
|
keterangan : data?.keterangan ?? '',
|
||||||
|
catatan : data?.catatan ?? '',
|
||||||
claim_id : data?.claim_id ?? '',
|
claim_id : data?.claim_id ?? '',
|
||||||
subject : data?.subject ?? '',
|
subject : data?.subject ?? '',
|
||||||
objective : data?.object ?? '',
|
objective : data?.object ?? '',
|
||||||
@@ -188,7 +196,6 @@ export default function DetailMonitoringList() {
|
|||||||
arr_result.push(event.target.files[0]);
|
arr_result.push(event.target.files[0]);
|
||||||
|
|
||||||
setValue('result', arr_result)
|
setValue('result', arr_result)
|
||||||
console.log('test3')
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log('NO FILE');
|
console.log('NO FILE');
|
||||||
@@ -230,35 +237,70 @@ export default function DetailMonitoringList() {
|
|||||||
// =====================================
|
// =====================================
|
||||||
const submitHandler = async (data: DetailMonitoringListType) => {
|
const submitHandler = async (data: DetailMonitoringListType) => {
|
||||||
|
|
||||||
const response = isEdit ? await UpdateMonitoringDetail(data) : await AddMonitoringDetail(claim_code??'', data);
|
const response = isEdit ? await UpdateMonitoringDetail(data) : await AddMonitoringDetail('', data);
|
||||||
|
|
||||||
if (response == true) {
|
if (response == true) {
|
||||||
reset();
|
reset();
|
||||||
if (isEdit) {
|
if (isEdit) {
|
||||||
navigate('/case_management/daily_monitoring/'+member_id+'/claims/'+claim_code+'/list_monitoring', { replace: true });
|
navigate('/case_management/daily_monitoring', { replace: true });
|
||||||
} else {
|
} else {
|
||||||
navigate('/case_management/daily_monitoring/'+member_id+'/'+organizationId+'/claims', { replace: true });
|
navigate('/case_management/daily_monitoring', { replace: true });
|
||||||
}
|
}
|
||||||
// window.location.reload()
|
// window.location.reload()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const [selectedReason, setSelectedReason] = useState({value:'-', label:''});
|
const [selectedReason, setSelectedReason] = useState({value:'-', label:''});
|
||||||
|
const [selectedCode, setSelectedCode] = useState({value:'-', label:''});
|
||||||
const reasons = [
|
const reasons = [
|
||||||
{ value: 'Wrong Setting', label: 'Wrong Setting' },
|
{ value: 'Wrong Setting', label: 'Wrong Setting' },
|
||||||
{ value: 'Hospital Request', label: 'Hospital Request' }
|
{ value: 'Hospital Request', label: 'Hospital Request' }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const [codes, setCodes] = useState([{ value: '-', label: '-' }]); // Data hasil pencarian
|
||||||
|
const [searchTerm, setSearchTerm] = useState(''); // Nilai input pencarian
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// Ambil data dari API dan atur opsi ICD
|
||||||
|
axios.get('codeLog')
|
||||||
|
.then((response) => {
|
||||||
|
setCodes(response.data.data);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Error fetching Code LOG options:', error);
|
||||||
|
});
|
||||||
|
|
||||||
|
}, []); // useEffect dijalankan hanya sekali saat komponen dimount
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchCodes = async () => {
|
||||||
|
if (searchTerm.length > 2) { // Hanya fetch jika input lebih dari 2 karakter
|
||||||
|
try {
|
||||||
|
const response = await axios.get(`codeLog?search=${searchTerm}`);
|
||||||
|
setCodes(response.data.data);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching codes:', error);
|
||||||
|
setCodes([]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const debounceFetch = setTimeout(fetchCodes, 500); // Debounce 500ms
|
||||||
|
return () => clearTimeout(debounceFetch);
|
||||||
|
}, [searchTerm]);
|
||||||
|
const [searchCode, setSearchCode] = useState('');
|
||||||
|
|
||||||
const [error, setError] = useState(true);
|
const [error, setError] = useState(true);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page title={pageTitle}>
|
<Page title=''>
|
||||||
<Box sx={{ display: 'flex', alignItems: 'center', pl: '22px', mb: '40px' }}>
|
<Box sx={{ display: 'flex', alignItems: 'center', pl: '22px', mb: '40px' }}>
|
||||||
<IconButton size='large' color='inherit' onClick={() => navigate(`/case_management/daily_monitoring/${member_id}/${organizationId}/claims`)} >
|
<IconButton size='large' color='inherit' onClick={() => navigate(`/case_management/daily_monitoring`)} >
|
||||||
<ArrowBackIosNew/>
|
<ArrowBackIosNew/>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
<Typography variant="h5" sx={{ marginLeft: '24px' }}>
|
<Typography variant="h5" sx={{ marginLeft: '24px' }}>
|
||||||
{pageTitle}
|
Tambah Daily Monitoring
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
@@ -269,6 +311,43 @@ export default function DetailMonitoringList() {
|
|||||||
{/* Date */}
|
{/* Date */}
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Grid container spacing={3}>
|
<Grid container spacing={3}>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Typography variant="body1" component="div">
|
||||||
|
Code Letter of Guarantee* :
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12} sx={{ display: 'flex', gap: 1 }}>
|
||||||
|
<Autocomplete
|
||||||
|
options={codes}
|
||||||
|
getOptionLabel={(option) => option.label}
|
||||||
|
fullWidth
|
||||||
|
value={selectedCode}
|
||||||
|
onChange={(event, newValue) => {
|
||||||
|
setSelectedCode(newValue);
|
||||||
|
setValue('log_code',newValue?.value)
|
||||||
|
// Validasi jika newValue adalah null
|
||||||
|
if (!newValue) {
|
||||||
|
setError('Please select a code');
|
||||||
|
} else {
|
||||||
|
setError('');
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onInputChange={(event, newInputValue) => {
|
||||||
|
setSearchTerm(newInputValue); // Set nilai pencarian untuk fetch data
|
||||||
|
}}
|
||||||
|
renderInput={(params) => (
|
||||||
|
<RHFTextField
|
||||||
|
{...params}
|
||||||
|
label="Code LOG"
|
||||||
|
variant="outlined"
|
||||||
|
id="log_code"
|
||||||
|
name='log_code'
|
||||||
|
error={false} // Menampilkan error jika ada
|
||||||
|
helperText={error} // Menampilkan pesan kesalahan
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Typography variant="body1" component="div">
|
<Typography variant="body1" component="div">
|
||||||
Date* :
|
Date* :
|
||||||
@@ -285,6 +364,72 @@ export default function DetailMonitoringList() {
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
{/* Doctor 1 */}
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Grid container spacing={3}>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Typography variant="body1" component="div">
|
||||||
|
Dokter 1
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<RHFTextField
|
||||||
|
id="doctor_1"
|
||||||
|
name='doctor_1'
|
||||||
|
placeholder='Dokter 1'
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Typography variant="body1" component="div">
|
||||||
|
Dokter 2
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<RHFTextField
|
||||||
|
id="doctor_2"
|
||||||
|
name='doctor_2'
|
||||||
|
placeholder='Dokter 2'
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Typography variant="body1" component="div">
|
||||||
|
Temp Diagnosis
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<RHFTextField
|
||||||
|
id="temp_diagnosis"
|
||||||
|
name='temp_diagnosis'
|
||||||
|
placeholder='Temp Diagnosis'
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Typography variant="body1" component="div">
|
||||||
|
Final Diagnosis
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<RHFTextField
|
||||||
|
id="final_diagnosis"
|
||||||
|
name='final_diagnosis'
|
||||||
|
placeholder='Final Diagnosis'
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Typography variant="body1" component="div">
|
||||||
|
Approval Pendamping
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<RHFTextField
|
||||||
|
id="approval_pendamping"
|
||||||
|
name='approval_pendamping'
|
||||||
|
placeholder='Approval Pendamping'
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
{/* Subject */}
|
{/* Subject */}
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Grid container spacing={3}>
|
<Grid container spacing={3}>
|
||||||
@@ -562,6 +707,28 @@ export default function DetailMonitoringList() {
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
{/* Keterangan dan Catatan */}
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Grid container spacing={3}>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Typography variant="body1" component="div">
|
||||||
|
Keterangan
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<RHFEditor id="keterangan" name="keterangan" placeholder="Keterangan"/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<Typography variant="body1" component="div">
|
||||||
|
Catatan
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<RHFEditor id="catatan" name="catatan" placeholder="Catatan"/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
{/* Confirmation Medical Letter */}
|
{/* Confirmation Medical Letter */}
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Grid container spacing={3}>
|
<Grid container spacing={3}>
|
||||||
@@ -673,7 +840,7 @@ export default function DetailMonitoringList() {
|
|||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
{/* Laboratorium */}
|
{/* Laboratorium */}
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Grid container spacing={3}>
|
<Grid container spacing={3}>
|
||||||
@@ -823,7 +990,7 @@ export default function DetailMonitoringList() {
|
|||||||
<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={() => isEdit ? navigate(`/case_management/daily_monitoring/${member_id}/claims/${claim_code}/list_monitoring`) : navigate(`/case_management/daily_monitoring/${member_id}/${organizationId}/claims`)}>
|
<Button variant="outlined" color="inherit" onClick={() => navigate(`/case_management/daily_monitoring`)}>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
<LoadingButton disabled={ isEdit ? error : !isDirty} type="submit" variant="contained" loading={isSubmitting}>
|
<LoadingButton disabled={ isEdit ? error : !isDirty} type="submit" variant="contained" loading={isSubmitting}>
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export default function DetailMonitoringList() {
|
|||||||
// Use Effect
|
// Use Effect
|
||||||
// --------------------
|
// --------------------
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadDataTableData();
|
// loadDataTableData();
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
// Dialog
|
// Dialog
|
||||||
@@ -165,13 +165,13 @@ export default function DetailMonitoringList() {
|
|||||||
|
|
||||||
// Load Data
|
// Load Data
|
||||||
// -------------------
|
// -------------------
|
||||||
const loadDataTableData = async () => {
|
// const loadDataTableData = async () => {
|
||||||
const response = await getMonitoringDetailList(claim_code??'');
|
// const response = await getMonitoringDetailList(claim_code??'');
|
||||||
const organization_id = await getOrganizationId(claim_code??'');
|
// const organization_id = await getOrganizationId(claim_code??'');
|
||||||
|
|
||||||
setDetailMonitoringList(response);
|
// setDetailMonitoringList(response);
|
||||||
setOrganizationId(organization_id);
|
// setOrganizationId(organization_id);
|
||||||
}
|
// }
|
||||||
|
|
||||||
const renderHTML = (data:string) => {
|
const renderHTML = (data:string) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export const AddMonitoringDetail = async ( claim_code: string,data: DetailMonito
|
|||||||
|
|
||||||
const formData = makeFormData({...data});
|
const formData = makeFormData({...data});
|
||||||
|
|
||||||
const response = await axios.post(`/case_management/daily_monitoring/detail/${claim_code}/add-request`, formData)
|
const response = await axios.post(`/case_management/daily_monitoring/add-request`, formData)
|
||||||
.then((res) =>{
|
.then((res) =>{
|
||||||
enqueueSnackbar(res.data.message, {
|
enqueueSnackbar(res.data.message, {
|
||||||
variant: 'success',
|
variant: 'success',
|
||||||
|
|||||||
@@ -3,12 +3,21 @@
|
|||||||
*/
|
*/
|
||||||
export type DailyMonitoringListType = {
|
export type DailyMonitoringListType = {
|
||||||
member_id : string,
|
member_id : string,
|
||||||
|
member_type : string,
|
||||||
|
birth_date : string,
|
||||||
name : string,
|
name : string,
|
||||||
start_date : string,
|
start_date : string,
|
||||||
end_date : string,
|
end_date : string,
|
||||||
addmision_date : string,
|
description : string,
|
||||||
provider : string,
|
doctor_1 : string,
|
||||||
organization_id : number,
|
doctor_2 : string,
|
||||||
|
temp_diagnosis : string,
|
||||||
|
final_diagnosis : string,
|
||||||
|
approval_pendamping : string,
|
||||||
|
note : string,
|
||||||
|
addmision_date : string,
|
||||||
|
provider : string,
|
||||||
|
organization_id : number,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,7 +59,15 @@ export type ClaimListType = {
|
|||||||
export type DetailMonitoringListType = {
|
export type DetailMonitoringListType = {
|
||||||
id : number|null,
|
id : number|null,
|
||||||
claim_id : string|null,
|
claim_id : string|null,
|
||||||
|
log_code : string|null,
|
||||||
claim_code : string|undefined,
|
claim_code : string|undefined,
|
||||||
|
doctor_1 : string|undefined,
|
||||||
|
doctor_2 : string|undefined,
|
||||||
|
temp_diagnosis : string|undefined,
|
||||||
|
final_diagnosis : string|undefined,
|
||||||
|
approval_pendamping : string|undefined,
|
||||||
|
keterangan : string|undefined,
|
||||||
|
catatan : string|undefined,
|
||||||
subject : string|undefined,
|
subject : string|undefined,
|
||||||
object : string|undefined,
|
object : string|undefined,
|
||||||
objective : string|undefined,
|
objective : string|undefined,
|
||||||
|
|||||||
@@ -233,6 +233,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/add_monitoring',
|
||||||
|
element: <DetailMonitoringForm />
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'daily_monitoring/:member_id/claims/:claim_code/:id',
|
path: 'daily_monitoring/:member_id/claims/:claim_code/:id',
|
||||||
element: <DetailMonitoringForm />
|
element: <DetailMonitoringForm />
|
||||||
|
|||||||
Reference in New Issue
Block a user