add exclusion diagnosis done

This commit is contained in:
pajri
2022-12-27 15:55:21 +07:00
parent 9400145990
commit 55ae0efc66
10 changed files with 1064 additions and 231 deletions

View File

@@ -14,7 +14,7 @@ class DiagnosisExclusionResource extends JsonResource
*/
public function toArray($request)
{
return [
$data = [
'id' => $this->id,
'code' => $this->exclusionable->code,
'name' => $this->exclusionable->name,
@@ -25,5 +25,36 @@ class DiagnosisExclusionResource extends JsonResource
return [$item['name'] => $item['values']];
})
];
$msc = explode(',', $this->rules->where('name', 'msc')->first()->values ?? '');
$list_msc = [
'm' => in_array('m', $msc),
's' => in_array('s', $msc),
'c' => in_array('c', $msc),
];
$gender = explode(',', $this->rules->where('name', 'gender')->first()->values ?? '');
$list_gender = [
'male' => in_array('male', $gender),
'female' => in_array('female', $gender),
];
$min_age = $this->rules->where('name', 'min_age')->first()->values ?? '';
$max_age = $this->rules->where('name', 'max_age')->first()->values ?? '';
$plan = $this->rules->where('name', 'plan')->first()->values ?? '';
$value_plan = [
'plan' => $plan,
'gender' => $list_gender,
'msc' => $list_msc,
'min_age' => $min_age,
'max_age' => $max_age,
];
$data['value_rules'] = $value_plan;
return $data;
}
}