feat: enrich patient record with full profile
GET /api/v1/patient/{uuid} now returns a `profile` object from UserProfile
(demographics, contact, insurance names resolved). Admin record detail shows
a "patient info" section. Empty fields render as "ثبت نشده".
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -169,6 +169,13 @@ function MyPatientsPageInner() {
|
||||
),
|
||||
});
|
||||
|
||||
const { data: recordDetail } = useQuery<ApiResponse<PatientRecord>>({
|
||||
queryKey: ["patient-detail", selectedRecord?.uuid],
|
||||
queryFn: () => api.get(`/api/v1/patient/${selectedRecord!.uuid}`),
|
||||
enabled: !!selectedRecord,
|
||||
});
|
||||
const patientProfile = (recordDetail?.data as PatientRecord | undefined)?.profile ?? null;
|
||||
|
||||
const { data: sessionsData, isLoading: sessionsLoading } = useQuery<
|
||||
PaginatedResponse<PatientSession>
|
||||
>({
|
||||
@@ -885,6 +892,35 @@ function MyPatientsPageInner() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{patientProfile && (
|
||||
<div className="card" style={{ padding: 16, marginBottom: 16 }}>
|
||||
<div style={{ fontWeight: 600, fontSize: 14, marginBottom: 12 }}>اطلاعات بیمار</div>
|
||||
<div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(180px, 1fr))", gap: 12 }}>
|
||||
{([
|
||||
["نام کامل", patientProfile.full_name],
|
||||
["کد ملی", patientProfile.national_code],
|
||||
["جنسیت", patientProfile.gender === "male" ? "مرد" : patientProfile.gender === "female" ? "زن" : patientProfile.gender],
|
||||
["تاریخ تولد", patientProfile.date_of_birth ? formatDate(patientProfile.date_of_birth) : null],
|
||||
["گروه خونی", patientProfile.blood_type],
|
||||
["وضعیت تأهل", patientProfile.marital_status],
|
||||
["شغل", patientProfile.job],
|
||||
["موبایل", patientProfile.mobile],
|
||||
["تلفن منزل", patientProfile.home_phone],
|
||||
["بیمه پایه", patientProfile.basic_insurance_name],
|
||||
["بیمه تکمیلی", patientProfile.supplementary_insurance_name],
|
||||
["آدرس", patientProfile.address],
|
||||
] as [string, string | null | undefined][]).map(([label, value]) => (
|
||||
<div key={label}>
|
||||
<div style={{ fontSize: 11.5, color: "var(--text-3)", marginBottom: 3 }}>{label}</div>
|
||||
<div style={{ fontSize: 13, fontWeight: 500 }} dir={label === "موبایل" || label === "کد ملی" || label === "تلفن منزل" ? "ltr" : undefined}>
|
||||
{value ? value : <span style={{ color: "var(--text-3)", fontWeight: 400 }}>ثبت نشده</span>}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="card">
|
||||
<div
|
||||
style={{
|
||||
|
||||
@@ -424,6 +424,22 @@ export interface SmsSettings {
|
||||
post_visit_text_reject_reason?: string | null;
|
||||
}
|
||||
|
||||
export interface PatientProfile {
|
||||
full_name?: string | null;
|
||||
national_code?: string | null;
|
||||
gender?: string | null;
|
||||
date_of_birth?: number | null;
|
||||
blood_type?: string | null;
|
||||
marital_status?: string | null;
|
||||
job?: string | null;
|
||||
address?: string | null;
|
||||
home_phone?: string | null;
|
||||
work_phone?: string | null;
|
||||
mobile?: string | null;
|
||||
basic_insurance_name?: string | null;
|
||||
supplementary_insurance_name?: string | null;
|
||||
}
|
||||
|
||||
export interface PatientRecord {
|
||||
uuid: string;
|
||||
entity_type: string;
|
||||
@@ -433,6 +449,7 @@ export interface PatientRecord {
|
||||
user_mobile?: string | null;
|
||||
user_national_code?: string | null;
|
||||
created_at: number;
|
||||
profile?: PatientProfile | null;
|
||||
}
|
||||
|
||||
export interface PatientSession {
|
||||
|
||||
Reference in New Issue
Block a user