Refactor insurance share calculation logic in PatientService
- Consolidated the calculation of patient and insurance shares into a single method using BillingCalculator. - Introduced new fields in PatientSession to store breakdown of insurance shares and patient share. - Updated the API responses to include the new fields for consistency across payment, invoice, and claims dashboard. - Added migration to backfill existing sessions with appropriate values for the new fields. - Implemented tests to ensure the correctness of the new logic and verify that the breakdown sums to the gross total. - Redesigned the claims dashboard to provide a more user-friendly overview of patient claims and their statuses.
This commit is contained in:
@@ -24,6 +24,12 @@ export interface SessionCardData {
|
||||
supplementary_discount_percent?: number;
|
||||
doctor_name?: string | null;
|
||||
final_price_rials?: number;
|
||||
// تفکیک بیمه — سرور محاسبه میکند (PatientSession::applyShares)
|
||||
gross_total_rials?: number;
|
||||
base_insurance_rials?: number;
|
||||
supplementary_insurance_rials?: number;
|
||||
patient_share_rials?: number;
|
||||
remaining_rials?: number;
|
||||
patient_debt_rials?: number;
|
||||
is_paid?: boolean;
|
||||
invoice_uuid?: string | null;
|
||||
|
||||
Reference in New Issue
Block a user