diff --git a/Modules/HospitalPortal/Http/Controllers/Api/RequestLogController.php b/Modules/HospitalPortal/Http/Controllers/Api/RequestLogController.php index 5386556a..7dbe787e 100755 --- a/Modules/HospitalPortal/Http/Controllers/Api/RequestLogController.php +++ b/Modules/HospitalPortal/Http/Controllers/Api/RequestLogController.php @@ -227,6 +227,8 @@ class RequestLogController extends Controller 'members.member_id as no_polis', 'members.birth_date', 'request_logs.service_code', + 'request_logs.specialities_id', + 'request_logs.dppj', DB::raw(' CASE WHEN request_logs.status = "requested" THEN "requested" @@ -369,6 +371,8 @@ class RequestLogController extends Controller 'final_log' => 1, 'service_code' =>$request->service_code, 'discharge_date' => $request->discharge_date, + 'dppj' => $request->dppj, + 'specialities_id' => $request->spescialis_id, 'created_final_by'=> auth()->user()->id, 'created_final_at'=> date('Y-m-d H:i:s'), ]); diff --git a/Modules/HospitalPortal/Routes/api.php b/Modules/HospitalPortal/Routes/api.php index 94f74d27..00dbf376 100755 --- a/Modules/HospitalPortal/Routes/api.php +++ b/Modules/HospitalPortal/Routes/api.php @@ -37,6 +37,7 @@ Route::prefix('v1')->group(function() { Route::post('verify-code', [AuthController::class, 'verifCode']); Route::get('service-member/{id}', [AutocompleteController::class, 'serviceCode']); + Route::get('specialis', [AutocompleteController::class, 'specialisList']); Route::middleware('auth:sanctum')->group(function () { diff --git a/Modules/Internal/Http/Controllers/Api/DrugController.php b/Modules/Internal/Http/Controllers/Api/DrugController.php index 6372c770..4a4876de 100755 --- a/Modules/Internal/Http/Controllers/Api/DrugController.php +++ b/Modules/Internal/Http/Controllers/Api/DrugController.php @@ -142,8 +142,8 @@ class DrugController extends Controller public function downloadTemplate() { return Helper::responseJson([ - 'file_name' => "Template - Drugs.xlsx", - "file_url" => url('files/Template - Drugs.xlsx') + 'file_name' => "Template1.xlsx", + "file_url" => url('files/Template1.xlsx') ]); } public function import(Request $request) @@ -156,36 +156,37 @@ class DrugController extends Controller $importedRows = 0; $failedRows = []; - - foreach ($processedData as $row) { - try { - Drug::updateOrCreate([ - 'code' => $row['code'], - ], - [ - 'name' => $row['name'], - 'code' => $row['code'], - 'id_setara' => $row['id_setara'], - 'code_setara' => $row['code_setara'], - 'nama_setara' => $row['nama_setara'], - 'multiply_jual' => $row['multiply_jual'], - 'generic_name' => $row['generic_name'], - 'description' => $row['description'], - 'mims_class' => $row['mims_class'], - 'indications' => $row['indications'], - 'atc_code' => $row['atc_code'], - 'segmentation' => $row['segmentation'], - 'type' => $row['type'], - 'dosage' => $row['dosage'], - 'remark' => $row['remark'], - // 'price' => $row['price'], - // 'unit' => $row['unit'], - ] - ); - $importedRows++; - } catch (\Exception $e) { - dd($e); - $failedRows[] = $row; + if ($processedData){ + foreach ($processedData as $row) { + try { + Drug::updateOrCreate([ + 'code' => $row['code'], + ], + [ + 'name' => $row['name'], + 'code' => $row['code'], + 'id_setara' => $row['id_setara'], + 'code_setara' => $row['code_setara'], + 'nama_setara' => $row['nama_setara'], + 'multiply_jual' => $row['multiply_jual'], + 'generic_name' => $row['generic_name'], + 'description' => $row['description'], + 'mims_class' => $row['mims_class'], + 'indications' => $row['indications'], + 'atc_code' => $row['atc_code'], + 'segmentation' => $row['segmentation'], + 'type' => $row['type'], + 'dosage' => $row['dosage'], + 'remark' => $row['remark'], + // 'price' => $row['price'], + 'unit' => $row['unit'], + ] + ); + $importedRows++; + } catch (\Exception $e) { + dd($e); + $failedRows[] = $row; + } } } diff --git a/Modules/Internal/Transformers/RequestLogShowResource.php b/Modules/Internal/Transformers/RequestLogShowResource.php index d1c9d509..9f2a1143 100755 --- a/Modules/Internal/Transformers/RequestLogShowResource.php +++ b/Modules/Internal/Transformers/RequestLogShowResource.php @@ -117,8 +117,7 @@ class RequestLogShowResource extends JsonResource ->get(); } $memberUsage = Helper::getUsageMember($corporateId, $requestLog['member']['id'], $benefitData); - - if(isset($requestLog['specialities_id'])) + if($requestLog['specialities_id']) { $spesialis = Speciality::query() ->where('id', $requestLog['specialities_id']) @@ -129,7 +128,7 @@ class RequestLogShowResource extends JsonResource $name = '-'; } - if (isset($requestLog['specialities_id'])){ + if ($requestLog['dppj']){ $dppj = $requestLog['dppj']; } else { $dppj = '-'; diff --git a/Modules/Linksehat/Http/Controllers/Api/AutocompleteController.php b/Modules/Linksehat/Http/Controllers/Api/AutocompleteController.php index fddfd0ae..6690cd07 100755 --- a/Modules/Linksehat/Http/Controllers/Api/AutocompleteController.php +++ b/Modules/Linksehat/Http/Controllers/Api/AutocompleteController.php @@ -6,6 +6,7 @@ use App\Models\OLDLMS\User; use App\Models\Icd; use App\Models\Drug; use App\Models\Unit; +use App\Models\Speciality; use App\Models\MemberPlan; use Illuminate\Contracts\Support\Renderable; use Illuminate\Http\Request; @@ -197,6 +198,17 @@ class AutocompleteController extends Controller { return response()->json($manipulatedPlan); } + public function specialisList(Request $request){ + $specialities = Speciality::query()->get(); + $manipulatedSpecial = $specialities->map(function ($special) { + return [ + 'value' => optional($special)->id , + 'label' => optional($special)->name, + ]; + }); + return response()->json($manipulatedSpecial); + } + } diff --git a/database/migrations/2024_08_21_114955_add_unit_to_drugs_table.php b/database/migrations/2024_08_21_114955_add_unit_to_drugs_table.php old mode 100644 new mode 100755 diff --git a/frontend/hospital-portal/src/sections/dashboard/DialogFinalLog.tsx b/frontend/hospital-portal/src/sections/dashboard/DialogFinalLog.tsx index a3d34b0c..25eb62d6 100755 --- a/frontend/hospital-portal/src/sections/dashboard/DialogFinalLog.tsx +++ b/frontend/hospital-portal/src/sections/dashboard/DialogFinalLog.tsx @@ -86,7 +86,8 @@ export default function DialogFinalLog({ member, getData, onClose, handleSubmitS // -------------------------------------------------------------- // Submit Form - + const [idSpecialities, setIdSpecialities] = useState(member.specialities_id); + const [inputDppj, setInputDppj] = useState(member.dppj); const [submitLoading, setSubmitLoading] = useState(false); function submitRequestFinalLog() { if(dischargeDate == '') @@ -102,6 +103,8 @@ export default function DialogFinalLog({ member, getData, onClose, handleSubmitS kondisi_files: fileKondisis, discharge_date: fPostFormat(dischargeDate, 'yyyy-MM-dd HH:mm:ss'), service_code: serviceCode, + spescialis_id: idSpecialities, + dppj: inputDppj, }); axios .post('/request-final-log', formData) @@ -121,6 +124,9 @@ export default function DialogFinalLog({ member, getData, onClose, handleSubmitS const [serviceOptions, setServiceOptions] = useState([ { value: '-', label: '-' } ]); + const [specialisOptions, setSpecialisOptions] = useState([ + { value: '-', label: '-' } + ]); useEffect(() => { axios.get('service-member/'+member.member_id) @@ -129,6 +135,13 @@ export default function DialogFinalLog({ member, getData, onClose, handleSubmitS }).catch((error) => { console.error('Error fetching ICD options:', error); }); + + axios.get('specialis') + .then((response) => { + setSpecialisOptions(response.data); + }).catch((error) => { + console.error('Error fetching ICD options:', error); + }); }, []); @@ -365,7 +378,7 @@ export default function DialogFinalLog({ member, getData, onClose, handleSubmitS id="service_type" options={serviceOptions} getOptionLabel={(option) => option.label || ""} - value={serviceOptions.find((opt) => opt.value == member.service_code) || null} + value={serviceOptions.find((opt) => opt.value == serviceCode) || null} onChange={(event, newValue) => { setServiceCode(newValue?.value || ""); }} @@ -377,6 +390,42 @@ export default function DialogFinalLog({ member, getData, onClose, handleSubmitS + {/* Specialist */} + + + {localeData.txtSpecialist} + option.label || ''} + value={specialisOptions.find((opt) => opt.value === idSpecialities) || null} + onChange={(event, newValue) => { + setIdSpecialities(newValue?.value || 0); + }} + renderInput={(params) => ( + + )} + /> + + + + + + + { localeData.txtDPPJ } + { + setInputDppj(event.target.value); + }} + fullWidth + /> + + + ):''} {obj.final_log === 0 && obj.status === 'approved' ? ( - handleRequestFinalLog(obj.id, obj.full_name, obj.no_polis, obj.submission_date, obj.service_code, obj.member_id) }> + handleRequestFinalLog( + obj.id, + obj.full_name, + obj.no_polis, + obj.submission_date, + obj.service_code, + obj.member_id, + obj.specialities_id, + obj.dppj, + ) }> Request Final LOG diff --git a/public/files/Template1.xlsx b/public/files/Template1.xlsx new file mode 100644 index 00000000..038a7158 Binary files /dev/null and b/public/files/Template1.xlsx differ