diff --git a/app/Http/Controllers/HealthCareSheetController.php b/app/Http/Controllers/HealthCareSheetController.php index e6d8c6b..ff92ff7 100755 --- a/app/Http/Controllers/HealthCareSheetController.php +++ b/app/Http/Controllers/HealthCareSheetController.php @@ -656,10 +656,13 @@ class HealthCareSheetController extends Controller ]); $healthCareSheet->user = $insurance->user; + $patient_name = $healthCareSheet->patient_lastname . ' ' . $healthCareSheet->patient_firstname; + $institution_name = $healthCareSheet->institution->lastname; + $practitioner_name = $healthCareSheet->practitioner_lastname . ' ' . $healthCareSheet->practitioner_firstname; Event::dispatch(new InsuredConsultation($healthCareSheet, trans('messages.consultation_or_prescription_carried_out'), trans('messages.consultation_or_prescription_carried_out_mail', ['name' => $insurance->user->lastname, 'insured_id' => $insurance->insured_id, - 'patient_name' => $healthCareSheet->patient_lastname . ' ' . $healthCareSheet->patient_firstname, 'patient_situation' => trans('states.' . $healthCareSheet->patient_situation), 'care_condition' => trans('states.' . $healthCareSheet->care_condition), - 'gender' => trans('states.' . $insurance->user->identification->gender), 'insurance_name' => $nhConfig->network->name, 'practitioner_name' => $healthCareSheet->practitioner_lastname . ' ' . $healthCareSheet->practitioner_firstname, 'institution_name' => $healthCareSheet->institution->lastname]), - trans('messages.consultation_or_prescription_carried_out_notification'))); + 'patient_name' => $patient_name, 'patient_situation' => trans('states.' . $healthCareSheet->patient_situation), 'care_condition' => trans('states.' . $healthCareSheet->care_condition), + 'gender' => trans('states.' . $insurance->user->identification->gender), 'insurance_name' => $nhConfig->network->name, 'practitioner_name' => $practitioner_name, 'institution_name' => $institution_name]), + trans('messages.consultation_or_prescription_carried_out_notification', ['patient_name' => $patient_name, 'practitioner_name' => $practitioner_name, 'institution_name' => $institution_name]))); DB::commit(); return $this->successResponse(trans('messages.consultation_or_prescription_carried_out')); @@ -914,10 +917,13 @@ class HealthCareSheetController extends Controller ]); $healthCareSheet->user = $insurance->user; + $patient_name = $healthCareSheet->patient_lastname . ' ' . $healthCareSheet->patient_firstname; + $institution_name = $healthCareSheet->institution->lastname; + $practitioner_name = $healthCareSheet->practitioner_lastname . ' ' . $healthCareSheet->practitioner_firstname; Event::dispatch(new InsuredConsultation($healthCareSheet, trans('messages.execution_carried_out'), trans('messages.execution_carried_out_mail', ['name' => $insurance->user->lastname, 'insured_id' => $insurance->insured_id, - 'patient_name' => $healthCareSheet->patient_lastname . ' ' . $healthCareSheet->patient_firstname, 'patient_situation' => trans('states.' . $healthCareSheet->patient_situation), 'care_condition' => trans('states.' . $healthCareSheet->care_condition), - 'gender' => trans('states.' . $insurance->user->identification->gender), 'insurance_name' => $nhConfig->network->name, 'practitioner_name' => $healthCareSheet->practitioner_lastname . ' ' . $healthCareSheet->practitioner_firstname, 'institution_name' => $healthCareSheet->institution->lastname]), - trans('messages.execution_carried_out'))); + 'patient_name' => $patient_name, 'patient_situation' => trans('states.' . $healthCareSheet->patient_situation), 'care_condition' => trans('states.' . $healthCareSheet->care_condition), + 'gender' => trans('states.' . $insurance->user->identification->gender), 'insurance_name' => $nhConfig->network->name, 'practitioner_name' => $practitioner_name, 'institution_name' => $institution_name]), + trans('messages.execution_carried_out', ['patient_name' => $patient_name, 'practitioner_name' => $practitioner_name, 'institution_name' => $institution_name]))); DB::commit(); return $this->successResponse(trans('messages.execution_carried_out')); @@ -985,12 +991,32 @@ class HealthCareSheetController extends Controller * description="Status des feuilles de soins", * @OA\Schema( * type="string", - * enum = {"UNTREATED","TREATED","ACCEPTED","TO_BILL"}, + * enum = {"UNTREATED","TREATED","ACCEPTED","TO_BILL","ALL"}, * default = "UNTREATED" * ), * in="query", * required=false * ), + * @OA\Parameter( + * parameter="page", + * name="page", + * description="Page", + * in="query", + * required=false, + * @OA\Schema( + * type="integer" + * ) + * ), + * @OA\Parameter( + * parameter="perPage", + * name="perPage", + * description="Pas de pagination", + * in="query", + * required=false, + * @OA\Schema( + * type="integer" + * ) + * ), * @OA\Response( * response=200, * description="OK", @@ -1018,7 +1044,7 @@ class HealthCareSheetController extends Controller 'beneficiary_id' => 'nullable|integer|exists:nh_having_rights,id', 'network_agent_id' => 'required_without:user_id|integer|exists:networks_agents,id', 'type' => 'nullable|in:CONSULTATION,EXECUTION', - 'state' => 'nullable|in:UNTREATED,TREATED,ACCEPTED,TO_BILL' + 'state' => 'nullable|in:UNTREATED,TREATED,ACCEPTED,TO_BILL,ALL' ]); $type = $request->input('type'); @@ -1032,7 +1058,9 @@ class HealthCareSheetController extends Controller if (!empty($beneficiary_id)) { $query = $query->where('beneficiary_id', $beneficiary_id); } else { - $query = $query->whereNull('beneficiary_id'); + if ($state != 'ALL') { + $query = $query->whereNull('beneficiary_id'); + } } if (!empty($network_agent_id)) { $query = $query->where('network_agent_id', $network_agent_id); @@ -1079,21 +1107,23 @@ class HealthCareSheetController extends Controller } } - $sheets = $query->orderBy('created_at', 'DESC')->get(); + $sheets = $query->orderBy('created_at', 'DESC')->paginate($request->input('perPage', 10)); if (!empty($state) && $state == 'TO_BILL') { // Liste des feuilles de soins a afficher pour l'execution , // Retirer les feuilles de soins qui n'ont ni exams ou prescriptions non soldes $notEmptySheets = []; - foreach ($sheets as $s) { + foreach ($sheets->items() as $s) { if (sizeof($s->exams) == 0 && sizeof($s->prescriptions) == 0) { continue; } $notEmptySheets[] = $s; } - $sheets = $notEmptySheets; +// $sheets = $notEmptySheets; + $sheets->setCollection(collect($notEmptySheets)); + } - foreach ($sheets as $sheet) { + foreach ($sheets->items() as $sheet) { $this->formalizeHealthCareSheet($sheet); } diff --git a/app/Http/Controllers/InsuranceSubscriptionController.php b/app/Http/Controllers/InsuranceSubscriptionController.php index 9e6bff8..c9b2927 100644 --- a/app/Http/Controllers/InsuranceSubscriptionController.php +++ b/app/Http/Controllers/InsuranceSubscriptionController.php @@ -683,6 +683,26 @@ class InsuranceSubscriptionController extends Controller * enum={"ALL","ACCEPTED"} * ) * ), + * @OA\Parameter( + * parameter="page", + * name="page", + * description="Page", + * in="query", + * required=false, + * @OA\Schema( + * type="integer" + * ) + * ), + * @OA\Parameter( + * parameter="perPage", + * name="perPage", + * description="Pas de pagination", + * in="query", + * required=false, + * @OA\Schema( + * type="integer" + * ) + * ), * @OA\Response( * response=200, * description="OK", @@ -725,8 +745,8 @@ class InsuranceSubscriptionController extends Controller } } - $subscriptions = $query->get(); - foreach ($subscriptions as $subscription) { + $subscriptions = $query->paginate($request->input('perPage', 10));; + foreach ($subscriptions->items() as $subscription) { $subscription->state = trans('states.' . $subscription->state); $subscription->insurance_action = trans('states.' . $subscription->insurance_action); $subscription->bonus_amount = $this->toMoneyWithCurrencyCode($subscription->bonus_amount, $currency_code); diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 5c4ac17..364c5b0 100755 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -164,6 +164,26 @@ class InvoiceController extends Controller * in="query", * required=false * ), + * @OA\Parameter( + * parameter="page", + * name="page", + * description="Page", + * in="query", + * required=false, + * @OA\Schema( + * type="integer" + * ) + * ), + * @OA\Parameter( + * parameter="perPage", + * name="perPage", + * description="Pas de pagination", + * in="query", + * required=false, + * @OA\Schema( + * type="integer" + * ) + * ), * @OA\Response( * response=200, * description="OK", @@ -202,8 +222,8 @@ class InvoiceController extends Controller $query = $query->where('network_agent_id', $network_agent_id); } - $invoices = $query->orderBy('created_at', 'DESC')->get(); - foreach ($invoices as $i) { + $invoices = $query->orderBy('created_at', 'DESC')->paginate($request->input('perPage', 10)); + foreach ($invoices->items() as $i) { $i->amount = $this->toMoneyWithCurrencyCode($i->amount, $i->currency_code); $i->insured_amount = $this->toMoneyWithCurrencyCode($i->insured_amount, $i->currency_code); $i->insurer_amount = $this->toMoneyWithCurrencyCode($i->insurer_amount, $i->currency_code); diff --git a/app/Listeners/InsuredConsultationNotification.php b/app/Listeners/InsuredConsultationNotification.php index 07b2eb1..e3cc730 100644 --- a/app/Listeners/InsuredConsultationNotification.php +++ b/app/Listeners/InsuredConsultationNotification.php @@ -61,6 +61,7 @@ class InsuredConsultationNotification $data->data = new stdClass(); $data->data->id = $event->healthCareSheet->id; $body->data = $data; + $data->not_saved = true; // Notification non sauvegardé $client->request('POST', '/onesignal/pushToUser', ['json' => $body, 'headers' => $headers]); } diff --git a/resources/lang/en/messages.php b/resources/lang/en/messages.php index d9ef40c..22acdd1 100755 --- a/resources/lang/en/messages.php +++ b/resources/lang/en/messages.php @@ -108,11 +108,12 @@ A new consultation or prescription has been made with your insurance. Log in to the application to have more details and validate this operation. ", - 'consultation_or_prescription_carried_out_notification' => "A new consultation or prescription has just been made with your insurance", + 'consultation_or_prescription_carried_out_notification' => "Consultation or prescription carried out for the insured :patient_name in the institution :institution_name by :practitioner_name", "care_sheet_accepted" => "The care sheet has been accepted", "care_sheet_rejected" => "The care sheet has been rejected", "care_sheet_resubmitted" => "The care sheet has been resubmitted", 'execution_carried_out' => "Execution of prescription carried out", + 'execution_carried_out_notification' => "Execution of prescription carried out for the insured :patient_name in the institution :institution_name by :practitioner_name", 'consultation_or_prescription_updated' => "Consultation or prescription updated", 'amount' => 'Amount', 'total_amount' => 'Total Amount', diff --git a/resources/lang/fr/messages.php b/resources/lang/fr/messages.php index cba8f19..c5d05db 100755 --- a/resources/lang/fr/messages.php +++ b/resources/lang/fr/messages.php @@ -108,11 +108,12 @@ Une nouvelle consultation ou prescription vient d'etre effectuée sur votre assu Connectez-vous à l'application pour avoir plus de details et valider cette opération. ", - 'consultation_or_prescription_carried_out_notification' => "Une nouvelle consultation ou prescription vient d'etre effectuée sur votre assurance", + 'consultation_or_prescription_carried_out_notification' => "Consultation ou prescription effectuée pour l'assuré :patient_name dans l'établissement :institution_name par :practitioner_name", "care_sheet_accepted" => "La feuille de soins a été acceptée", "care_sheet_rejected" => "La feuille de soins a été rejetée", "care_sheet_resubmitted" => "La feuille de soins a été re-soumise", 'execution_carried_out' => "Execution de prescription effectuée", + 'execution_carried_out_notification' => "Execution de prescription effectuée pour l'assuré :patient_name dans l'établissement :institution_name par :practitioner_name", 'execution_carried_out_mail' => ":gender :name , Une nouvelle execution de prescription vient d'etre effectuée sur votre assurance.