Update fitur impor dan history exlusion
This commit is contained in:
55
Modules/Internal/Services/IcdService.php
Normal file
55
Modules/Internal/Services/IcdService.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Internal\Services;
|
||||
|
||||
use App\Exceptions\ImportRowException;
|
||||
use App\Models\Benefit;
|
||||
use App\Models\Corporate;
|
||||
use App\Models\Icd;
|
||||
use App\Models\Plan;
|
||||
use Box\Spout\Writer\Common\Creator\WriterEntityFactory;
|
||||
|
||||
class IcdService
|
||||
{
|
||||
protected function validateDiagnosisExclusionRow($row)
|
||||
{
|
||||
if (empty($row['code'])) {
|
||||
throw new ImportRowException(__('code.REQUIRED'), 0, null, $row);
|
||||
}
|
||||
if (empty($row['description_en'])) {
|
||||
throw new ImportRowException(__('name.REQUIRED'), 0, null, $row);
|
||||
}
|
||||
}
|
||||
|
||||
public function handleIcdRow($row)
|
||||
{
|
||||
try {
|
||||
$this->validateDiagnosisExclusionRow($row);
|
||||
$icd = Icd::updateOrCreate([
|
||||
'code' => $row['code']
|
||||
], [
|
||||
"code" => $row['code'],
|
||||
"parent_code" => $row['parent_code'] ?? null,
|
||||
"rev" => $row['reff_exc'],
|
||||
"name" => $row['description_en'],
|
||||
"version" => $row["version"] ?? null,
|
||||
"active" => $row["active"] ?? 0
|
||||
]);
|
||||
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public $listing_doc_headers = [
|
||||
"Rev",
|
||||
"Version",
|
||||
"Code",
|
||||
"Parent Code",
|
||||
"Name",
|
||||
"Description",
|
||||
"Status",
|
||||
"Type"
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user