update create e-prescription
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Modules\Internal\Http\Controllers\Api;
|
||||
|
||||
use App\Models\Drug;
|
||||
use App\Models\Unit;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
@@ -25,6 +26,37 @@ class DrugController extends Controller
|
||||
return $drugs;
|
||||
}
|
||||
|
||||
public function drugList(Request $request){
|
||||
$drugs = Drug::query()
|
||||
->where([
|
||||
'atc_code' => 'lms', // ini untuk menggunakan list obat yang baru
|
||||
])
|
||||
->get();
|
||||
|
||||
$manipulatedDrugs = $drugs->map(function ($drug) {
|
||||
// Contoh manipulasi, tambahkan atau ubah properti sesuai kebutuhan
|
||||
return [
|
||||
'value' => $drug->id, // Ganti dengan properti yang sesuai dari model Icd
|
||||
'label' => $drug->name, // Ganti dengan properti yang sesuai dari model Icd
|
||||
];
|
||||
});
|
||||
return Helper::responseJson(data: $manipulatedDrugs);
|
||||
}
|
||||
|
||||
public function unitList(Request $request){
|
||||
$units = Unit::query()
|
||||
->get();
|
||||
|
||||
$manipulatedUnits = $units->map(function ($unit) {
|
||||
// Contoh manipulasi, tambahkan atau ubah properti sesuai kebutuhan
|
||||
return [
|
||||
'value' => $unit->id, // Ganti dengan properti yang sesuai dari model Icd
|
||||
'label' => $unit->name, // Ganti dengan properti yang sesuai dari model Icd
|
||||
];
|
||||
});
|
||||
return Helper::responseJson(data: $manipulatedUnits);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return Renderable
|
||||
@@ -123,20 +155,22 @@ class DrugController extends Controller
|
||||
|
||||
foreach ($processedData as $row) {
|
||||
try {
|
||||
Drug::create(
|
||||
[
|
||||
'name' => $row['name'],
|
||||
'code' => $row['code'],
|
||||
'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'],
|
||||
]
|
||||
Drug::updateOrCreate([
|
||||
'code' => $row['code'],
|
||||
],
|
||||
[
|
||||
'name' => $row['name'],
|
||||
'code' => $row['code'],
|
||||
'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'],
|
||||
]
|
||||
);
|
||||
$importedRows++;
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Internal\Http\Controllers\Api;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\OLDLMS\Livechat;
|
||||
use App\Models\OLDLMS\Appointment;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Modules\Internal\Transformers\LivechatResource;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
class EprescriptionController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$startDate = $request->startDate;
|
||||
$endDate = $request->endDate;
|
||||
|
||||
$livechat = Livechat::with('doctor.user', 'doctor.speciality', 'appointment.appointmentDetail', 'healthCare');
|
||||
// ->where('nIDAppointment', '!=', null)
|
||||
// ->where('nIDAppointment', '!=', '');
|
||||
|
||||
|
||||
if ($startDate) {
|
||||
$livechat = $livechat->where('dCreateOn', '>=', $startDate);
|
||||
}
|
||||
|
||||
if ($endDate) {
|
||||
$endDate = date('Y-m-d', strtotime($endDate . ' +1 day'));
|
||||
$livechat = $livechat->where('dCreateOn', '<', $endDate);
|
||||
}
|
||||
$livechat = $livechat->latest()->paginate(15);
|
||||
|
||||
return response()->json(Helper::paginateResources(LivechatResource::collection($livechat)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$livechat = Livechat::with('doctor.user', 'doctor.speciality', 'appointment.appointmentDetail', 'healthCare')
|
||||
->where('nIDAppointment', '!=', null)->where('nIDAppointment', '!=', '')
|
||||
->where('nID', $id)
|
||||
->first();
|
||||
return response()->json(new LivechatResource($livechat));
|
||||
}
|
||||
|
||||
public function export(Request $request)
|
||||
{
|
||||
$startDate = $request->has('startDate') ? $request->input('startDate') : '';
|
||||
$endDate = $request->has('endDate') ? $request->input('endDate') : '';
|
||||
|
||||
$liveChats = Livechat::with('user:nID,sFirstName,sLastName,sEmail,sPhone,nIDUser', 'doctor:nID,nIDSpesialis,nIDUser', 'doctor.user:nID,sFirstName,sLastName', 'appointment:nID,sPaymentStatus,sPaymentMethod', 'appointment.appointmentDetail:nID,nIDAppointment,dTanggalAppointment,tTimeAppointment', 'healthCare:nID,sHealthCare')
|
||||
->where(function (Builder $query) use ($startDate, $endDate) {
|
||||
// $query->where('nIDAppointment', '!=', null);
|
||||
// $query->where('nIDAppointment', '!=', '');
|
||||
if ($startDate) {
|
||||
$query->where('dCreateOn', '>=', $startDate);
|
||||
}
|
||||
if ($endDate) {
|
||||
$endDate = date('Y-m-d', strtotime($endDate . ' +1 day'));
|
||||
$query->where('dCreateOn', '<', $endDate);
|
||||
}
|
||||
})
|
||||
->orderBy('nID', 'desc')
|
||||
->get(['nID', 'nIDUser', 'nIDDokter', 'nIDHealthCare', 'nIDAppointment', 'sStatus', 'sMediaDokter', 'sMedia', 'dCreateOn']);
|
||||
|
||||
$headers = [
|
||||
['value' => 'No', 'cell' => 'A1', 'mergeCell' => true, 'mergeToCell' => 'A2'],
|
||||
['value' => 'Kode TC', 'cell' => 'B1', 'mergeCell' => true, 'mergeToCell' => 'B2'],
|
||||
['value' => 'Tanggal', 'cell' => 'C1', 'mergeCell' => true, 'mergeToCell' => 'C2'],
|
||||
['value' => 'Waktu', 'cell' => 'D1', 'mergeCell' => true, 'mergeToCell' => 'D2'],
|
||||
['value' => 'Faskes', 'cell' => 'E1', 'mergeCell' => true, 'mergeToCell' => 'E2'],
|
||||
['value' => 'Nama Dokter', 'cell' => 'F1', 'mergeCell' => true, 'mergeToCell' => 'F2'],
|
||||
['value' => 'Spesialis', 'cell' => 'G1', 'mergeCell' => true, 'mergeToCell' => 'G2'],
|
||||
['value' => 'Chat Via App/Website', 'cell' => 'H1', 'mergeCell' => true, 'mergeToCell' => 'I1'],
|
||||
['value' => 'Pasien', 'cell' => 'H2', 'mergeCell' => false, 'mergeToCell' => ''],
|
||||
['value' => 'Dokter', 'cell' => 'I2', 'mergeCell' => false, 'mergeToCell' => ''],
|
||||
['value' => 'nIDUser', 'cell' => 'J1', 'mergeCell' => true, 'mergeToCell' => 'J2'],
|
||||
['value' => 'Nama Pasien', 'cell' => 'K1', 'mergeCell' => true, 'mergeToCell' => 'K2'],
|
||||
['value' => 'No Telepon Pasien', 'cell' => 'L1', 'mergeCell' => true, 'mergeToCell' => 'L2'],
|
||||
['value' => 'Email Pasien', 'cell' => 'M1', 'mergeCell' => true, 'mergeToCell' => 'M2'],
|
||||
['value' => 'Status', 'cell' => 'N1', 'mergeCell' => true, 'mergeToCell' => 'N2'],
|
||||
['value' => 'Record Type', 'cell' => 'O1', 'mergeCell' => true, 'mergeToCell' => 'O2'],
|
||||
['value' => 'nID Principal', 'cell' => 'P1', 'mergeCell' => true, 'mergeToCell' => 'P2'],
|
||||
['value' => 'Metode Pembayaran', 'cell' => 'Q1', 'mergeCell' => true, 'mergeToCell' => 'Q2'],
|
||||
];
|
||||
|
||||
$spreadsheet = new Spreadsheet();
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
foreach ($headers as $header) {
|
||||
$sheet->setCellValue($header['cell'], $header['value']);
|
||||
|
||||
if ($header['mergeCell'] === true) {
|
||||
$sheet->mergeCells($header['cell'] . ':' . $header['mergeToCell']);
|
||||
}
|
||||
|
||||
$sheet->getStyle($header['cell'])->getFont()->setBold(true);
|
||||
$sheet->getStyle($header['cell'])->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER)->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
||||
}
|
||||
|
||||
$startFrom = 3;
|
||||
foreach ($liveChats as $indexLiveChat => $liveChat) {
|
||||
$phone = $liveChat->user->sPhone ?? '-';
|
||||
$status = $liveChat->sStatus;
|
||||
$nIDUser = $liveChat->user->nIDUser ?? 0; // Principal or Dependent
|
||||
$paymentMethod = $liveChat->appointment ? Helper::sPaymentMethod($liveChat->appointment->sPaymentMethod) : 'N/A';
|
||||
$fullNameDoctor = '-';
|
||||
if ($liveChat->doctor->user !== null) {
|
||||
$fullNameDoctor = '';
|
||||
|
||||
if ($liveChat->doctor->user->detail !== null) {
|
||||
if ($liveChat->doctor->user->detail->sTitlePrefix !== null) {
|
||||
$fullNameDoctor .= $liveChat->doctor->user->detail->sTitlePrefix . '. ';
|
||||
}
|
||||
|
||||
if ($liveChat->doctor->user->full_name !== null) {
|
||||
$fullNameDoctor .= $liveChat->doctor->user->full_name . ' ';
|
||||
}
|
||||
|
||||
if ($liveChat->doctor->user->detail->sTitleSuffix !== null) {
|
||||
$fullNameDoctor .= $liveChat->doctor->user->detail->sTitleSuffix;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$recordType = 'P';
|
||||
if ($nIDUser){
|
||||
$recordType = 'D';
|
||||
}
|
||||
switch ($status) {
|
||||
case 0:
|
||||
$statusLivechat = "Request TC";
|
||||
break;
|
||||
case 1:
|
||||
$statusLivechat = "Accepted by Doctor but User not Payment";
|
||||
break;
|
||||
case 2:
|
||||
$statusLivechat = "Payment Success";
|
||||
break;
|
||||
case 3:
|
||||
$statusLivechat = "Decline by Doctor";
|
||||
break;
|
||||
case 4:
|
||||
$statusLivechat = "Payment Expired";
|
||||
break;
|
||||
default:
|
||||
$statusLivechat = "Cancel by Patient";
|
||||
}
|
||||
|
||||
$sheet->setCellValue('A' . $startFrom, $indexLiveChat + 1);
|
||||
$sheet->setCellValue('B' . $startFrom, $liveChat->nID ?? '-');
|
||||
$sheet->setCellValue('C' . $startFrom, Carbon::parse($liveChat->dCreateOn)->format('d-m-Y'));
|
||||
$sheet->setCellValue('D' . $startFrom, Carbon::parse($liveChat->dCreateOn)->format('H:i:s'));
|
||||
// $sheet->setCellValue('D' . $startFrom, Carbon::parse($liveChat->dRequestTime)->format('H:i:s'));
|
||||
$sheet->setCellValue('E' . $startFrom, $liveChat->healthCare->sHealthCare ?? '-');
|
||||
$sheet->setCellValue('F' . $startFrom, $fullNameDoctor);
|
||||
$sheet->setCellValue('G' . $startFrom, $liveChat->doctor->speciality->sSpesialis ?? '-');
|
||||
$sheet->setCellValue('H' . $startFrom, $liveChat->sMedia ?? '-');
|
||||
$sheet->setCellValue('I' . $startFrom, $liveChat->sMediaDokter ?? '-');
|
||||
$sheet->setCellValue('J' . $startFrom, $liveChat->user->nID ?? '-');
|
||||
$sheet->setCellValue('K' . $startFrom, $liveChat->user->full_name ?? '-');
|
||||
$sheet->setCellValue('L' . $startFrom, preg_replace('/(\d{3})(\d{4})(\d{3})/', '$1$2$3', $phone));
|
||||
$sheet->setCellValue('M' . $startFrom, $liveChat->user->sEmail ?? '-');
|
||||
$sheet->setCellValue('N' . $startFrom, $statusLivechat);
|
||||
$sheet->setCellValue('O' . $startFrom, $recordType);
|
||||
$sheet->setCellValue('P' . $startFrom, $nIDUser ?? '-');
|
||||
$sheet->setCellValue('Q' . $startFrom, $paymentMethod ?? '-');
|
||||
$startFrom++;
|
||||
}
|
||||
|
||||
foreach (['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J','K', 'L', 'M', 'O', 'P'] as $header) {
|
||||
if ($header === 'A') {
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension($header)->setWidth(35, 'px');
|
||||
} elseif ($header === 'H' || $header === 'I') {
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension($header)->setWidth(100, 'px');
|
||||
} else {
|
||||
$spreadsheet->getActiveSheet()->getColumnDimension($header)->setAutoSize(true);
|
||||
}
|
||||
}
|
||||
|
||||
$spreadsheet->getActiveSheet()->getStyle('A3:A' . $startFrom)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER)->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
||||
|
||||
$sheet->getDefaultRowDimension()->setRowHeight(-1);
|
||||
$sheet->setTitle('Live Chat Report');
|
||||
|
||||
$writer = new Xlsx($spreadsheet);
|
||||
ob_start();
|
||||
$writer->save('php://output');
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$fileName = 'result-' . now()->getPreciseTimestamp(3) . '-livechat-report.xlsx';
|
||||
Storage::disk('public')->put('temp/' . $fileName, $content);
|
||||
|
||||
$fileUrl = url('storage/temp/' . $fileName);
|
||||
|
||||
return Helper::responseJson([
|
||||
"file_url" => $fileUrl
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,30 @@
|
||||
|
||||
namespace Modules\Internal\Http\Controllers\Api;
|
||||
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\OLDLMS\Livechat;
|
||||
use App\Models\OLDLMS\LivechatSummary;
|
||||
use App\Models\OLDLMS\Appointment;
|
||||
use App\Models\OLDLMS\User;
|
||||
use App\Models\OLDLMS\UserDetail;
|
||||
use App\Models\OLDLMS\Prescription;
|
||||
use App\Models\OLDLMS\PrescriptionItem;
|
||||
use App\Models\Icd;
|
||||
use App\Models\Organization;
|
||||
use App\Models\Drug;
|
||||
use App\Models\Unit;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Modules\Internal\Transformers\LivechatResource;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use DB;
|
||||
|
||||
class PrescriptionController extends Controller
|
||||
{
|
||||
@@ -15,21 +34,30 @@ class PrescriptionController extends Controller
|
||||
* @param int|null $id
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function index($id = null)
|
||||
public function index(Request $request)
|
||||
{
|
||||
$query = Prescription::query();
|
||||
if ($id !== null) {
|
||||
$query->where('nID', $id);
|
||||
$startDate = $request->startDate;
|
||||
$endDate = $request->endDate;
|
||||
|
||||
$livechat = Livechat::with('doctor.user', 'doctor.speciality', 'appointment.appointmentDetail', 'healthCare', 'summary');
|
||||
// ->where('nIDAppointment', '!=', null)
|
||||
// ->where('nIDAppointment', '!=', '');
|
||||
if ($startDate) {
|
||||
$livechat = $livechat->where('dCreateOn', '>=', $startDate);
|
||||
}
|
||||
|
||||
$prescriptions = $query->select('nID','nIDLiveChat', 'nIDLiveChatSummary', 'nIDDokter', 'sDokterName', 'dTanggalResep', 'sSource', 'nIDUser', 'sKodeResep', 'sDiagnose', 'sStatus')
|
||||
->get();
|
||||
|
||||
// $prescriptions->toArray();
|
||||
// dd($prescriptions);
|
||||
if ($endDate) {
|
||||
$endDate = date('Y-m-d', strtotime($endDate . ' +1 day'));
|
||||
$livechat = $livechat->where('dCreateOn', '<', $endDate);
|
||||
}
|
||||
|
||||
return response()->json($prescriptions);
|
||||
// return response()->json(Helper::paginateResources(LivechatResource::collection($livechat)));
|
||||
$livechat = $livechat->whereHas('summary', function ($query) {
|
||||
$query->whereNotNull('nIDLiveChat');
|
||||
});
|
||||
|
||||
$livechat = $livechat->latest()->paginate(15);
|
||||
|
||||
return response()->json(Helper::paginateResources(LivechatResource::collection($livechat)));
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +79,94 @@ class PrescriptionController extends Controller
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$livechat = Livechat::where('nID', $request->id)->first();
|
||||
$livechatSummary = LivechatSummary::where('nIDLivechat', $request->id)->first();
|
||||
|
||||
$userDokter = User::where('nID', $livechat->nIDDokter)->first();
|
||||
$userDetailDokter = UserDetail::where('nIDUser', $userDokter->nID)->first();
|
||||
|
||||
$dokter = $userDetailDokter->sTitlePrefix . ' ' . $userDokter->sFirstName . ' ' . $userDokter->sLastName . ' ' . $userDetailDokter->sTitleSuffix;
|
||||
|
||||
$kodeResep = 'LMS' . date('ymd') . rand(1,100);
|
||||
$diagnosis = explode(",",$request->diagnosis);
|
||||
|
||||
if(isset($request->diagnosis) && is_array($diagnosis) && count($diagnosis) > 0) {
|
||||
foreach($diagnosis as $data){
|
||||
$icd = Icd::where('code', $data)->first();
|
||||
array_push($diagnosis, $icd->name);
|
||||
};
|
||||
}
|
||||
$sDiagnosis = implode(", ",$diagnosis);
|
||||
$hospitalData = Organization::where('id', $request->hospital)->first();
|
||||
$hospital = '';
|
||||
if ($hospitalData) {
|
||||
$hospital = $hospitalData->code;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'nIDLivechat' => $request->id,
|
||||
'nIDLivechatSummary' => $livechatSummary->nID,
|
||||
'nIDDokter' => $livechat->nIDDokter,
|
||||
'sDokterName' => $dokter,
|
||||
'dTanggalResep' => date('Y-m-d H:i:s'),
|
||||
'sSource' => 'lms',
|
||||
'nIDUser' => $livechat->nIDUser,
|
||||
'sRegID' => '',
|
||||
'sKodeResep' => $kodeResep,
|
||||
'sDiagnose' => $sDiagnosis,
|
||||
'sKodeRS' => $hospital,
|
||||
];
|
||||
|
||||
$prescription = Prescription::create($data);
|
||||
|
||||
$medicine = $request->medicine;
|
||||
$customMessages = [
|
||||
'required' => 'Kolom :attribute wajib diisi.',
|
||||
'numeric' => 'Kolom :attribute harus berupa angka.',
|
||||
];
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'medicine' => 'required|array',
|
||||
'medicine.*' => 'required',
|
||||
], $customMessages);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return Helper::responseJson([$request->all()],'error', 400, $validator->errors());
|
||||
} else {
|
||||
// BeginTransaction
|
||||
DB::beginTransaction();
|
||||
foreach($medicine as $key => $value){
|
||||
$drugData = Drug::where('id', $value['drug_id'])->first();
|
||||
$drug = '';
|
||||
if ($drugData){
|
||||
$drug = $drugData->name;
|
||||
}
|
||||
$unitData = Unit::where('id', $value['unit_id'])->first();
|
||||
$unit = '';
|
||||
if ($unitData) {
|
||||
$unit = $unitData->name;
|
||||
}
|
||||
$data = [
|
||||
'nIDPrescription' => $prescription->id,
|
||||
'sItemName' => $drug,
|
||||
'nQty' => $value['qty'],
|
||||
'sSatuan' => $unit,
|
||||
'sSigna' => $value['signa'],
|
||||
'sNote' => $value['note'],
|
||||
];
|
||||
// Insert Data
|
||||
try {
|
||||
PrescriptionItem::create($data);
|
||||
} catch (\Throwable $th) {
|
||||
DB::rollBack();
|
||||
return Helper::responseJson(status: 'failed', statusCode: 500, message: $th->getMessage());
|
||||
}
|
||||
}
|
||||
DB::commit();
|
||||
return Helper::responseJson(status: 'success', statusCode: 201, message: 'success', data: $request->toArray());
|
||||
}
|
||||
|
||||
return Helper::responseJson(status: 'success', statusCode: 200, message: 'Resep Online berhasil ajukan!', data: $prescription);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -211,6 +211,24 @@ class RequestLogController extends Controller
|
||||
});
|
||||
return Helper::responseJson(data: $manipulatedIcds);
|
||||
}
|
||||
|
||||
public function hospitals(){
|
||||
$organizations = Organization::query()
|
||||
->where([
|
||||
'type' => 'hospital',
|
||||
'status' => 'active',
|
||||
])
|
||||
->get();
|
||||
|
||||
$manipulatedOrganizations = $organizations->map(function ($organization) {
|
||||
// Contoh manipulasi, tambahkan atau ubah properti sesuai kebutuhan
|
||||
return [
|
||||
'value' => $organization->id, // Ganti dengan properti yang sesuai dari model Icd
|
||||
'label' => $organization->name, // Ganti dengan properti yang sesuai dari model Icd
|
||||
];
|
||||
});
|
||||
return Helper::responseJson(data: $manipulatedOrganizations);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
|
||||
Reference in New Issue
Block a user