Improve method get health care sheet

This commit is contained in:
Djery-Tom 2022-01-04 11:54:02 +01:00
parent edf205a374
commit 7547d9dd55
1 changed files with 5 additions and 2 deletions

View File

@ -781,7 +781,7 @@ class HealthCareSheetController extends Controller
'prescriptions.*.id' => 'required|integer|exists:nh_medical_prescriptions,id', 'prescriptions.*.id' => 'required|integer|exists:nh_medical_prescriptions,id',
'prescriptions.*.unit_price' => 'required|numeric', 'prescriptions.*.unit_price' => 'required|numeric',
'exams' => 'nullable|array', 'exams' => 'nullable|array',
'exams.*.id' => 'nullable|integer|exists:nh_exams,id', 'exams.*.id' => 'required|integer|exists:nh_exams,id',
'exams.*.unit_price' => 'required|numeric', 'exams.*.unit_price' => 'required|numeric',
]); ]);
@ -1018,10 +1018,13 @@ class HealthCareSheetController extends Controller
if (!empty($user_id)) { if (!empty($user_id)) {
$query = NhInfosHealthCareSheets::where('user_id', $user_id); $query = NhInfosHealthCareSheets::where('user_id', $user_id);
} else { }
if (!empty($network_agent_id)) {
$query = NhInfosHealthCareSheets::where('network_agent_id', $network_agent_id); $query = NhInfosHealthCareSheets::where('network_agent_id', $network_agent_id);
} }
$query = $query->with(['performances.act:id,code,name', 'exams.act:id,code,name', 'prescriptions.drug_or_device:id,name']); $query = $query->with(['performances.act:id,code,name', 'exams.act:id,code,name', 'prescriptions.drug_or_device:id,name']);
if (!empty($state) && $state == 'TO_BILL') { if (!empty($state) && $state == 'TO_BILL') {