Update exclusion corporate setting
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Exceptions\ImportRowException;
|
||||
use App\Models\Benefit;
|
||||
use App\Models\Corporate;
|
||||
use App\Models\Icd;
|
||||
use App\Models\Exclusion;
|
||||
use App\Models\Plan;
|
||||
use Box\Spout\Writer\Common\Creator\WriterEntityFactory;
|
||||
|
||||
@@ -87,7 +88,8 @@ class ExclusionService
|
||||
$exclusion = $icd->exclusions()->create([
|
||||
'corporate_id' => $corporate->id,
|
||||
'service_code' => 'OP',
|
||||
'type' => 'diagnosis'
|
||||
'type' => 'diagnosis',
|
||||
'active' => 1
|
||||
]);
|
||||
|
||||
if (!empty($excl_array[1])) { //msc
|
||||
@@ -141,6 +143,22 @@ class ExclusionService
|
||||
]);
|
||||
});
|
||||
}
|
||||
} else if (!$excl_array[0]){
|
||||
$icd = Icd::where(['code' => $row['code']])->first();
|
||||
if (!$icd) {
|
||||
throw new ImportRowException(__('icd.NOT_FOUND'), 0, NULL, $row);
|
||||
}
|
||||
// Cari entitas Exclusion yang sesuai dengan kriteria tertentu
|
||||
$exclusion = Exclusion::where([
|
||||
'corporate_id' => $corporate->id,
|
||||
'exclusionable_id' => $icd->id,
|
||||
])->first();
|
||||
|
||||
// Jika entitas ditemukan, perbarui nilai 'active' menjadi 0
|
||||
if ($exclusion) {
|
||||
$exclusion->update(['active' => 0]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user