This commit is contained in:
Server D3 Linksehat
2024-10-14 10:35:21 +07:00
parent 611689235b
commit 013c57d00a
86 changed files with 9199 additions and 729 deletions

View File

@@ -27,17 +27,21 @@ class DrugController extends Controller
}
public function drugList(Request $request){
$drugs = Drug::query()
->where([
'atc_code' => 'lms', // ini untuk menggunakan list obat yang baru
'atc_code' => $request->provider, // 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
'value' => $drug->id,
'label' => $drug->name,
'code' => $drug->code,
'price' => $drug->price,
'unit' => $drug->unit,
];
});
return Helper::responseJson(data: $manipulatedDrugs);
@@ -152,6 +156,7 @@ class DrugController extends Controller
$importedRows = 0;
$failedRows = [];
foreach ($processedData as $row) {
try {
Drug::updateOrCreate([
@@ -169,11 +174,13 @@ class DrugController extends Controller
'type' => $row['type'],
'dosage' => $row['dosage'],
'remark' => $row['remark'],
'price' => $row['price'],
// 'price' => $row['price'],
'unit' => $row['unit'],
]
);
$importedRows++;
} catch (\Exception $e) {
dd($e);
$failedRows[] = $row;
}
}