Update exclusion corporate setting
This commit is contained in:
@@ -4,6 +4,7 @@ namespace Modules\Internal\Http\Controllers\Api;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\AuditTrail;
|
||||
use App\Models\ExclusionRules;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
@@ -16,6 +17,10 @@ class AuditTrailController extends Controller {
|
||||
*/
|
||||
public function index(Request $request, $id)
|
||||
{
|
||||
$exlusionId = null;
|
||||
if ($request->model == 'App\Models\ExclusionRules'){
|
||||
$exlusionId = ExclusionRules::where('exclusion_id', $id)->get();
|
||||
}
|
||||
$audittrails = AuditTrail::query()
|
||||
->where('model', '=', $request->model)
|
||||
->where('model_id', '=', $id)
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ class DiagnosisExclusionResource extends JsonResource
|
||||
'diagnosis_type' => $this->exclusionable->type,
|
||||
'service_code' => $this->service_code,
|
||||
'type' => $this->type,
|
||||
'active' => $this->active,
|
||||
'rules' => $this->rules->mapToGroups(function ($item, $key) {
|
||||
return [$item['name'] => $item['values']];
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user