feat: add supplementary insurance select to patient record info form
The «اطلاعات پرونده» form only exposed basic insurance («نوع بیمه»). Add a
«بیمه تکمیلی» select next to it, wired to the supplementary insurances from
insurance-pricing. Backend PATCH /api/v1/patient/{uuid} already accepts
supplementary_insurance_id (UserProfile entity + controller) — frontend-only:
schema field, form select, profileToFormValues/formValuesToPayload mapping,
PatientProfileUpdate type, and the supplementary option passed from both the
case-file info tab (PatientDetailPage) and MyPatientsPage.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1176,6 +1176,7 @@ function MyPatientsPageInner() {
|
||||
education: EDUCATION_OPTS,
|
||||
referral: REFERRAL_OPTS,
|
||||
insurance: baseInsuranceOptions,
|
||||
supplementary: suppInsuranceOptions,
|
||||
province: locOpts(provincesQ.data),
|
||||
city: locOpts(citiesQ.data),
|
||||
}}
|
||||
|
||||
@@ -29,7 +29,10 @@ beforeEach(() => {
|
||||
if (url === '/api/v1/provinces') return Promise.resolve({ success: true, data: [{ id: 10, name: 'یزد' }] });
|
||||
if (url.startsWith('/api/v1/cities')) return Promise.resolve({ success: true, data: [{ id: 100, name: 'یزد' }] });
|
||||
if (url === '/api/v1/insurance-pricing') return Promise.resolve({ success: true, data: {
|
||||
insurances: [{ insurance_id: 1, insurance_name: 'تأمین اجتماعی', type: 'basic' }],
|
||||
insurances: [
|
||||
{ insurance_id: 1, insurance_name: 'تأمین اجتماعی', type: 'basic' },
|
||||
{ insurance_id: 5, insurance_name: 'بیمه دانا', type: 'supplementary' },
|
||||
],
|
||||
} });
|
||||
if (url === '/api/v1/patient/r1/sessions') return Promise.resolve({ success: true, data: [
|
||||
{ uuid: 's1', services: [{ service_name: 'اسکیلینگ' }], doctor_name: 'دکتر فتحی', final_price_rials: 2500000, is_paid: false, patient_debt_rials: 1500000, notes: 'یادداشت', created_at: 1700000000, visit_price_rials: 0 },
|
||||
@@ -104,6 +107,8 @@ describe('PatientDetailPage (پرونده تبدار)', () => {
|
||||
// لیبل فیلدهای فرم (معادل tauri FileInfoSection)
|
||||
expect(await screen.findByText('نام و نام خانوادگی مراجعه کننده')).toBeInTheDocument();
|
||||
expect(screen.getByText('کدملی')).toBeInTheDocument();
|
||||
expect(screen.getByText('بیمه پایه')).toBeInTheDocument();
|
||||
expect(screen.getByText('بیمه تکمیلی')).toBeInTheDocument();
|
||||
// مقادیر پیشپرشده از پروفایل
|
||||
expect(screen.getByDisplayValue('1234567890')).toBeInTheDocument();
|
||||
expect(screen.getByDisplayValue('ساغر صابری')).toBeInTheDocument();
|
||||
|
||||
@@ -108,6 +108,9 @@ export default function PatientDetailPage() {
|
||||
const baseInsuranceOptions = ((pricingQ.data?.data as any)?.insurances ?? [])
|
||||
.filter((i: any) => i.type === 'basic')
|
||||
.map((i: any) => ({ value: String(i.insurance_id), label: i.insurance_name }));
|
||||
const suppInsuranceOptions = ((pricingQ.data?.data as any)?.insurances ?? [])
|
||||
.filter((i: any) => i.type === 'supplementary')
|
||||
.map((i: any) => ({ value: String(i.insurance_id), label: i.insurance_name }));
|
||||
|
||||
const updateProfileMut = useMutation({
|
||||
mutationFn: (body: object) => api.patch(`/api/v1/patient/${uuid}`, body),
|
||||
@@ -195,6 +198,7 @@ export default function PatientDetailPage() {
|
||||
education: EDUCATION_OPTS,
|
||||
referral: REFERRAL_OPTS,
|
||||
insurance: baseInsuranceOptions,
|
||||
supplementary: suppInsuranceOptions,
|
||||
province: locOpts(provincesQ.data),
|
||||
city: locOpts(citiesQ.data),
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user