diff --git a/app/ActBillingType.php b/app/ActBillingType.php index 57b57b2..7c29f7b 100644 --- a/app/ActBillingType.php +++ b/app/ActBillingType.php @@ -6,5 +6,5 @@ abstract class ActBillingType { const UNIT_PRICE = 'UNIT_PRICE'; const PACKAGE = 'PACKAGE'; - + const FREE = 'FREE'; } diff --git a/app/Http/Controllers/AuthorizationCareRequestController.php b/app/Http/Controllers/AuthorizationCareRequestController.php index a8bd7c2..c341bc1 100755 --- a/app/Http/Controllers/AuthorizationCareRequestController.php +++ b/app/Http/Controllers/AuthorizationCareRequestController.php @@ -43,8 +43,8 @@ class AuthorizationCareRequestController extends Controller /** * @OA\Post( * path="/authorizations-care-requests", - * summary="Demander une autorisation de soin", - * tags={"Demandes d'autorisation de soins"}, + * summary="Demander une autorisation de prise en charge", + * tags={"Demandes d'autorisation de prise en charge"}, * security={{"api_key":{}}}, * @OA\RequestBody( * description="Corps de la requete", @@ -53,7 +53,7 @@ class AuthorizationCareRequestController extends Controller * mediaType="application/json", * @OA\Schema( * schema="request_for_authorizations_of_care", - * title = "Demande autorisation de soins", + * title = "Demande autorisation de prise en charge", * required={"health_care_sheet_id", "network_agent_id", "password", "practitioner_lastname", "practitioner_provider_class_id", * "prescriptions" , "exams"}, * @OA\Property( @@ -244,8 +244,8 @@ class AuthorizationCareRequestController extends Controller /** * @OA\Get( * path="/authorizations-care-requests", - * summary="Lister toutes les demandes autorisation de soin", - * tags={"Demandes d'autorisation de soins"}, + * summary="Lister toutes les demandes autorisation de prise en charge", + * tags={"Demandes d'autorisation de prise en charge"}, * security={{"api_key":{}}}, * @OA\Parameter( * parameter="issuer_network_agent_id", diff --git a/app/Http/Controllers/HealthCareSheetController.php b/app/Http/Controllers/HealthCareSheetController.php index b31b2af..7013b98 100755 --- a/app/Http/Controllers/HealthCareSheetController.php +++ b/app/Http/Controllers/HealthCareSheetController.php @@ -620,7 +620,7 @@ class HealthCareSheetController extends Controller 'exams' => 'nullable|array', 'exams.*.act_id' => 'required|integer|exists:nh_acts,id', 'exams.*.description' => 'required|string', - 'exams.*.quantity' => 'nullable|integer', + 'exams.*.quantity' => 'nullable|integer', // Obselete, la quantité n'est plu demandé lors de la saisie de la consultation ]); $performances = $request->input('performances', []); @@ -653,7 +653,7 @@ class HealthCareSheetController extends Controller return $this->errorResponse(trans('errors.act_quantity_required', ['act_name' => $act->name])); } - if (empty($act->amount)) { + if ($act->billing_type == ActBillingType::FREE) { if (empty($p['amount'])) { return $this->errorResponse(trans('errors.act_amount_required', ['act_name' => $act->name])); } @@ -739,7 +739,7 @@ class HealthCareSheetController extends Controller $exam = NhExam::create([ 'act_id' => $e['act_id'], 'description' => $e['description'], - 'quantity' => $e['quantity'] ?? 1, + 'quantity' => $e['quantity'] ?? null, 'created_at' => $datetime, 'updated_at' => $datetime, ]); @@ -920,6 +920,7 @@ class HealthCareSheetController extends Controller 'prescriptions.*.unit_price' => 'required|numeric', 'exams' => 'required_without:prescriptions|array', 'exams.*.id' => 'required|integer|exists:nh_exams,id', + 'exams.*.quantity' => 'required|numeric|min:1', 'exams.*.unit_price' => 'nullable|numeric', ]); @@ -1010,7 +1011,7 @@ class HealthCareSheetController extends Controller return $this->errorResponse(__('errors.exam_already_invoiced', ['id' => $itemIndex + 1])); } // Fetch exam unit price - if (empty($i->act->amount)) { + if ($i->act->billing_type == ActBillingType::FREE) { if (empty($exams[$itemIndex]['unit_price'])) { DB::rollBack(); return $this->errorResponse(trans('errors.act_unit_price_required', ['act_name' => $i->act->name])); @@ -1019,6 +1020,7 @@ class HealthCareSheetController extends Controller } else { $item->unit_price = $i->act->amount; } + $item->quantity = $exams[$itemIndex]['quantity']; } @@ -1894,8 +1896,8 @@ class HealthCareSheetController extends Controller if ($sheet->type == HealthCareSheetType::CONSULTATION) { $exam->act_id = !empty($p['act_id']) ? $p['act_id'] : $exam->act_id; $exam->description = !empty($p['description']) ? $p['description'] : $exam->description; - $exam->quantity = !empty($p['quantity']) ? $p['quantity'] : $exam->quantity; } else { + $exam->quantity = !empty($p['quantity']) ? $p['quantity'] : $exam->quantity; if (!empty($p['unit_price'])) { $exam->unit_price = $p['unit_price']; $exam->insured_paid_amount = $parts->insured_part * $exam->unit_price * ($exam->quantity ?? 1); diff --git a/database/migrations/2022_03_31_092838_add_amount_to_nh_acts_and_update_nh_insurances_state.php b/database/migrations/2022_03_31_092838_add_amount_to_nh_acts_and_update_nh_insurances_state.php index ea71d21..45a078e 100644 --- a/database/migrations/2022_03_31_092838_add_amount_to_nh_acts_and_update_nh_insurances_state.php +++ b/database/migrations/2022_03_31_092838_add_amount_to_nh_acts_and_update_nh_insurances_state.php @@ -18,7 +18,8 @@ class AddAmountToNhActsAndUpdateNhInsurancesState extends Migration DB::statement("alter table nh_insurances modify state enum ('PAID', 'UNDER_STOPPING', 'STOPPED', 'EXPIRED', 'UNDER_ACTIVATION', 'UNDER_RENEW','UNDER_ADDING_BENEFICIARY', 'PARTIALLY_PAID', 'SUSPENDED') default 'PAID' not null;"); - $table->enum('type', ['CONSULTATION', 'EXAM'])->default('CONSULTATION')->after('name'); + DB::statement("alter table nh_acts modify billing_type enum ('PACKAGE', 'UNIT_PRICE', 'FREE') default 'FREE' not null;"); + $table->enum('type', ['CONSULTATION', 'EXAM_OR_OTHER'])->default('CONSULTATION')->after('name'); $table->string('unit_value')->nullable()->after('billing_type'); $table->decimal('amount', 10)->nullable()->after('unit_value'); }); diff --git a/database/migrations/2022_04_07_120405_add_nullable_to_nh_exams_quantity.php b/database/migrations/2022_04_07_120405_add_nullable_to_nh_exams_quantity.php new file mode 100644 index 0000000..421c705 --- /dev/null +++ b/database/migrations/2022_04_07_120405_add_nullable_to_nh_exams_quantity.php @@ -0,0 +1,32 @@ +unsignedInteger('quantity')->nullable()->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('nh_exams', function (Blueprint $table) { + $table->unsignedInteger('quantity')->change(); + }); + } +} diff --git a/resources/lang/en/messages.php b/resources/lang/en/messages.php index fb3955f..0d6afb0 100755 --- a/resources/lang/en/messages.php +++ b/resources/lang/en/messages.php @@ -252,5 +252,6 @@ Your insurance has expired. ", 'insurance_invoice_generated_mail_title' => "Your :deadline insurance invoice has been issued", 'the_invoice' => "the invoice", - 'the_payment' => "the payment" + 'the_payment' => "the payment", + 'care_request_already_been_processed' => "The care request has already been processed" ]; diff --git a/resources/lang/fr/messages.php b/resources/lang/fr/messages.php index c7fc5a8..35decb3 100755 --- a/resources/lang/fr/messages.php +++ b/resources/lang/fr/messages.php @@ -146,13 +146,13 @@ Une nouvelle execution de prescription vient d'etre effectuée sur votre assuran 'phone' => "Téléphone", 'transmitter' => "Émetteur", 'recipient' => "Destinataire", - 'new_care_authorisation' => "Nouvelle autorisation de soin", - 'new_care_authorisation_email' => "L'assuré :insured demande une nouvelle autorisation de soin pour l'acte :act", + 'new_care_authorisation' => "Nouvelle autorisation de prise en charge", + 'new_care_authorisation_email' => "L'assuré :insured demande une nouvelle autorisation de prise en charge pour l'acte :act", 'new_care_authorisation_sent' => "Nouvelle demande autorisation soin envoyée", - 'care_request_accepted' => "Demande de soins acceptée", - 'care_request_rejected' => "Demande de soins refusée", - 'care_request_rejected_notification' => "Votre demande d'autorisation de soins :request_id a été refusée", - 'care_request_accepted_notification' => "Votre demande d'autorisation de soins :request_id a été acceptée", + 'care_request_accepted' => "Demande de prise en charges acceptée", + 'care_request_rejected' => "Demande de prise en charges refusée", + 'care_request_rejected_notification' => "Votre demande d'autorisation de prise en charge :request_id a été refusée", + 'care_request_accepted_notification' => "Votre demande d'autorisation de prise en charge :request_id a été acceptée", 'generated_invoice_mail' => "Facture émise par :agent pour la période :period", 'insurance_deletion_beneficiary_successful' => "Suppression d'ayant droit à votre assurance réussie", 'insurance_stop_successful' => "Demande d'arrêt de votre assurance réussie", @@ -269,5 +269,6 @@ Votre assurance est arrivée à échéance. ", 'insurance_invoice_generated_mail_title' => "La facture de votre assurance d'échéance :deadline a été émise.", 'the_invoice' => "la facture", - 'the_payment' => "le paiement" + 'the_payment' => "le paiement", + 'care_request_already_been_processed' => "La demande de prise en charge a deja ete traitée" ];