Update calculate consultation performances amount

This commit is contained in:
Djery-Tom 2021-11-30 15:18:09 +01:00
parent b94017eebf
commit 870de4af7a
3 changed files with 16 additions and 24 deletions

View File

@ -307,13 +307,13 @@ class HealthCareSheetController extends Controller
* enum={"CURRENT_AFFECTION","LONG_TERM_AFFECTION","EXONERATION"}, * enum={"CURRENT_AFFECTION","LONG_TERM_AFFECTION","EXONERATION"},
* example= "CURRENT_AFFECTION" * example= "CURRENT_AFFECTION"
* ), * ),
* @OA\Property( * @OA\Property(property="amount",
* property="performances", * type="integer",
* description="Listes des montants des prestations", * example = 20000,
* example = {{"amount":20000}} * description="Montant de la prestation"
* ), * ),
* ), * ),
* example = {"network_id":250,"care_condition":"CURRENT_AFFECTION","performances":{{"amount":20000}}} * example = {"network_id":250,"care_condition":"CURRENT_AFFECTION","amount":20000 }
* ) * )
* ), * ),
* @OA\Response( * @OA\Response(
@ -321,8 +321,7 @@ class HealthCareSheetController extends Controller
* description="OK", * description="OK",
* @OA\JsonContent( * @OA\JsonContent(
* ref="#/components/schemas/ApiResponse", * ref="#/components/schemas/ApiResponse",
* example = {"status":200,"response":{{"moderator_ticket":4000,"moderator_ticket_formatted":"4\u202f000 FCFA","insurance_amount":16000, * example = {"status":200,"response":{"moderator_ticket":"4\u202f000 FCFA","insurance_amount":"16\u202f000 FCFA"},"error":null},
* "insurance_amount_formatted":"16\u202f000 FCFA"}},"error":null},
* ) * )
* ) * )
* ) * )
@ -332,8 +331,7 @@ class HealthCareSheetController extends Controller
$this->validate($request, [ $this->validate($request, [
'network_id' => 'required|integer|exists:networks,id', 'network_id' => 'required|integer|exists:networks,id',
'care_condition' => 'required|in:CURRENT_AFFECTION,LONG_TERM_AFFECTION,EXONERATION', 'care_condition' => 'required|in:CURRENT_AFFECTION,LONG_TERM_AFFECTION,EXONERATION',
'performances' => 'required|array', 'amount' => 'required|numeric',
'performances.*.amount' => 'required|numeric',
]); ]);
$nhConfig = NhNetworksConfig::where('network_id', $request->input('network_id'))->first(); $nhConfig = NhNetworksConfig::where('network_id', $request->input('network_id'))->first();
@ -343,15 +341,9 @@ class HealthCareSheetController extends Controller
$currency_code = $this->getNetworkCurrency($request->input('network_id')); $currency_code = $this->getNetworkCurrency($request->input('network_id'));
$parts = $this->getConfigInsuranceParts($nhConfig, $request->input('care_condition')); $parts = $this->getConfigInsuranceParts($nhConfig, $request->input('care_condition'));
$result = []; $result = new stdClass();
foreach ($request->input('performances') as $p) { $result->moderator_ticket = $this->toMoneyWithCurrencyCode($parts->insured_part * $request->input('amount'), $currency_code);
array_push($result, [ $result->insurance_amount = $this->toMoneyWithCurrencyCode($parts->insurer_part * $request->input('amount'), $currency_code); //
'moderator_ticket' => $parts->insured_part * $p['amount'],
'moderator_ticket_formatted' => $this->toMoneyWithCurrencyCode($parts->insured_part * $p['amount'], $currency_code),
'insurance_amount' => $parts->insurer_part * $p['amount'],
'insurance_amount_formatted' => $this->toMoneyWithCurrencyCode($parts->insurer_part * $p['amount'], $currency_code), //
]);
}
return $this->successResponse($result); return $this->successResponse($result);
} }
@ -686,7 +678,7 @@ class HealthCareSheetController extends Controller
'exams.*.unit_price' => 'required|numeric', 'exams.*.unit_price' => 'required|numeric',
]); ]);
$insurance = NhHealthCareSheet::where('id', $request->input('health_care_sheet_id'))->where('state', InsuranceState::PAID)->first(); $sheet = NhHealthCareSheet::where('id', $request->input('health_care_sheet_id'))->where('state', InsuranceState::PAID)->first();
if (!isset($insurance)) { if (!isset($insurance)) {
return $this->errorResponse(trans('errors.not_insured')); return $this->errorResponse(trans('errors.not_insured'));
} }

View File

@ -94,7 +94,7 @@ Your request to add a beneficiary to your insurance is being validated.
'consultation_or_prescription_carried_out' => "Consultation or prescription carried out", 'consultation_or_prescription_carried_out' => "Consultation or prescription carried out",
'consultation_or_prescription_carried_out_mail' => ":gender :name , 'consultation_or_prescription_carried_out_mail' => ":gender :name ,
A new consultation or prescription has been made with your insurance company. A new consultation or prescription has been made with your insurance.
Information about the consultation or prescription: Information about the consultation or prescription:
- Insured number: :insured_id - Insured number: :insured_id
- Name of the insurance company: :insurance_name - Name of the insurance company: :insurance_name
@ -108,7 +108,7 @@ A new consultation or prescription has been made with your insurance company.
Log in to the application to have more details and validate this operation. 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 company", 'consultation_or_prescription_carried_out_notification' => "A new consultation or prescription has just been made with your insurance",
"care_sheet_accepted" => "The care sheet has been accepted", "care_sheet_accepted" => "The care sheet has been accepted",
"care_sheet_rejected" => "The care sheet has been rejected", "care_sheet_rejected" => "The care sheet has been rejected",
"care_sheet_resubmitted" => "The care sheet has been resubmitted" "care_sheet_resubmitted" => "The care sheet has been resubmitted"

View File

@ -94,8 +94,8 @@ Votre demande d'ajout d'ayant droit à votre assurance est en cours de validatio
'consultation_or_prescription_carried_out' => "Consultation ou prescription effectuée", 'consultation_or_prescription_carried_out' => "Consultation ou prescription effectuée",
'consultation_or_prescription_carried_out_mail' => ":gender :name , 'consultation_or_prescription_carried_out_mail' => ":gender :name ,
Une nouvelle consultation ou prescription vient d'etre effectuée auprès de votre assurance. Une nouvelle consultation ou prescription vient d'etre effectuée sur votre assurance.
Informations de la consultation ou prescriptions : Informations de la consultation ou prescription :
- Numéro d'assuré : :insured_id - Numéro d'assuré : :insured_id
- Nom de l'assurance : :insurance_name - Nom de l'assurance : :insurance_name
@ -108,7 +108,7 @@ Une nouvelle consultation ou prescription vient d'etre effectuée auprès de vot
Connectez-vous à l'application pour avoir plus de details et valider cette opération. 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 auprès de votre assurance", 'consultation_or_prescription_carried_out_notification' => "Une nouvelle consultation ou prescription vient d'etre effectuée sur votre assurance",
"care_sheet_accepted" => "La feuille de soins a été acceptée", "care_sheet_accepted" => "La feuille de soins a été acceptée",
"care_sheet_rejected" => "La feuille de soins a été rejetée", "care_sheet_rejected" => "La feuille de soins a été rejetée",
"care_sheet_resubmitted" => "La feuille de soins a été re-soumise" "care_sheet_resubmitted" => "La feuille de soins a été re-soumise"