feat(claims): add tracking number and status history for claims

- Introduced `tracking_number` field in the `claims` table to store the insurance tracking number.
- Created `claim_status_logs` table to maintain a history of status changes for claims, including who made the change and when.
- Implemented `ClaimStatusLog` entity and repository for managing status log entries.
- Updated `ClaimService` to log transitions and handle tracking numbers during claim submissions.
- Added new API endpoint for fetching claims by patient, including detailed claim history and status logs.
- Enhanced frontend with a new `ClaimPatientDetailPage` to display claims and their status history.
- Added tests to ensure correct aggregation of claims and proper handling of status transitions.
This commit is contained in:
hamed
2026-07-18 23:38:02 +03:30
parent b3a5cda808
commit 20bdc49e89
15 changed files with 1412 additions and 309 deletions
+14 -2
View File
@@ -1,5 +1,5 @@
import React from 'react';
import type { AppointmentStatus, PaymentStatus, SmsTemplateStatus, SettlementStatus } from '../../types';
import type { AppointmentStatus, PaymentStatus, SmsTemplateStatus, SettlementStatus, ClaimStatus } from '../../types';
type BadgeColor = 'green' | 'amber' | 'red' | 'blue' | 'violet' | 'gray';
@@ -36,8 +36,17 @@ const settlementMap: Record<SettlementStatus, { color: BadgeColor; label: string
rejected: { color: 'red', label: 'رد شده' },
};
const claimMap: Record<ClaimStatus, { color: BadgeColor; label: string }> = {
pending: { color: 'gray', label: 'در انتظار ارسال' },
submitted: { color: 'blue', label: 'ارسال شده' },
approved: { color: 'amber', label: 'تأیید شده' },
rejected: { color: 'red', label: 'رد شده' },
paid: { color: 'green', label: 'پرداخت شده' },
mixed: { color: 'violet', label: 'وضعیت‌های مختلف' },
};
interface Props {
type: 'appointment' | 'payment' | 'sms' | 'settlement' | 'active';
type: 'appointment' | 'payment' | 'sms' | 'settlement' | 'active' | 'claim';
value: string;
}
@@ -57,6 +66,9 @@ export default function StatusBadge({ type, value }: Props) {
} else if (type === 'settlement') {
const m = settlementMap[value as SettlementStatus];
if (m) { color = m.color; label = m.label; }
} else if (type === 'claim') {
const m = claimMap[value as ClaimStatus];
if (m) { color = m.color; label = m.label; }
} else if (type === 'active') {
color = value === 'true' || value === 'active' ? 'green' : 'gray';
label = value === 'true' || value === 'active' ? 'فعال' : 'غیرفعال';