Update endpoint to fetch health care sheets
This commit is contained in:
parent
d7ef5fe660
commit
dc7ea55260
|
@ -800,6 +800,17 @@ class HealthCareSheetController extends Controller
|
|||
* in="query",
|
||||
* required=true
|
||||
* ),
|
||||
* @OA\Parameter(
|
||||
* parameter="type",
|
||||
* name="type",
|
||||
* description="Type des feuilles de soins",
|
||||
* @OA\Schema(
|
||||
* type="string",
|
||||
* default = "UNTREATED"
|
||||
* ),
|
||||
* in="query",
|
||||
* required=false
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="OK",
|
||||
|
@ -823,10 +834,18 @@ class HealthCareSheetController extends Controller
|
|||
public function getHealthCareSheets(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'user_id' => 'required|integer|exists:users,id'
|
||||
'user_id' => 'required|integer|exists:users,id',
|
||||
'type' => 'nullable|in:UNTREATED'
|
||||
]);
|
||||
|
||||
$sheets = NhInfosHealthCareSheets::with(['performances.act:id,code,name', 'exams.act:id,code,name', 'prescriptions.drug_or_device:id,name'])->where('user_id', $request->input('user_id'))->get();
|
||||
$type = $request->input('type');
|
||||
$query = NhInfosHealthCareSheets::with(['performances.act:id,code,name', 'exams.act:id,code,name', 'prescriptions.drug_or_device:id,name'])->where('user_id', $request->input('user_id'));
|
||||
|
||||
if (isset($type) && $type == 'UNTREATED') {
|
||||
$query = $query->where('state', InsuranceSubscriptionState::UNDER_VALIDATION);
|
||||
}
|
||||
|
||||
$sheets = $query->get();
|
||||
foreach ($sheets as $sheet) {
|
||||
$this->formalizeHealthCareSheet($sheet);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue