diff --git a/apps/web/src/pages/Home.tsx b/apps/web/src/pages/Home.tsx index df7f6fc..eae9d1b 100644 --- a/apps/web/src/pages/Home.tsx +++ b/apps/web/src/pages/Home.tsx @@ -72,8 +72,8 @@ function StatValue({ value, loading }: { value: number; loading: boolean }) { } const ACTION_LABELS: Record = { - create: '创建', update: '更新', delete: '删除', - login: '登录', user_login: '登录', 'user.login': '登录', + create: '创建', created: '创建', update: '更新', updated: '更新', delete: '删除', deleted: '删除', + login: '登录', login_failed: '登录失败', user_login: '登录', 'user.login': '登录', 'user.create': '创建', 'user.update': '更新', 'user.delete': '删除', 'role.create': '创建', 'role.update': '更新', 'role.delete': '删除', 'patient.create': '创建', 'patient.update': '更新', diff --git a/apps/web/src/pages/health/AppointmentList.tsx b/apps/web/src/pages/health/AppointmentList.tsx index 49e7383..797b3f3 100644 --- a/apps/web/src/pages/health/AppointmentList.tsx +++ b/apps/web/src/pages/health/AppointmentList.tsx @@ -28,16 +28,18 @@ import { DoctorSelect } from './components/DoctorSelect'; /** 预约类型选项 */ const APPOINTMENT_TYPE_OPTIONS = [ { value: 'outpatient', label: '门诊' }, - { value: 'physical_checkup', label: '体检' }, - { value: 'follow_up', label: '随访' }, + { value: 'recheck', label: '复诊' }, + { value: 'health_checkup', label: '体检' }, { value: 'consultation', label: '咨询' }, + { value: 'dialysis', label: '透析' }, ]; const APPOINTMENT_TYPE_MAP: Record = { outpatient: '门诊', - physical_checkup: '体检', - follow_up: '随访', + recheck: '复诊', + health_checkup: '体检', consultation: '咨询', + dialysis: '透析', }; /** 状态筛选选项 */ @@ -138,6 +140,10 @@ export default function AppointmentList() { message.warning('请选择患者'); return; } + if (!selectedDoctorId) { + message.warning('请选择医护'); + return; + } try { const req: CreateAppointmentReq = { patient_id: selectedPatientId, @@ -312,7 +318,7 @@ export default function AppointmentList() { setSelectedDoctorId(undefined); }} onOk={() => form.submit()} - destroyOnClose + destroyOnHidden width={560} >
@@ -323,11 +329,11 @@ export default function AppointmentList() { placeholder="搜索选择患者" /> - + setSelectedDoctorId(val)} - placeholder="搜索选择医护(可选)" + placeholder="搜索选择医护" /> diff --git a/apps/web/src/pages/health/PatientDetail.tsx b/apps/web/src/pages/health/PatientDetail.tsx index 2abfb1d..d8c004d 100644 --- a/apps/web/src/pages/health/PatientDetail.tsx +++ b/apps/web/src/pages/health/PatientDetail.tsx @@ -64,7 +64,7 @@ export default function PatientDetail() { const handleEdit = async (values: { name?: string; gender?: string; - birth_date?: string; + birth_date?: unknown; blood_type?: string; id_number?: string; allergy_history?: string; @@ -74,9 +74,15 @@ export default function PatientDetail() { notes?: string; }) => { if (!patient) return; + const formatted = { + ...values, + birth_date: values.birth_date && typeof values.birth_date === 'object' && 'format' in (values.birth_date as object) + ? (values.birth_date as { format: (f: string) => string }).format('YYYY-MM-DD') + : (values.birth_date as string | undefined), + }; try { const req: UpdatePatientReq & { version: number } = { - ...values, + ...formatted, version: patient.version, }; await patientApi.update(patient.id, req); diff --git a/apps/web/src/pages/health/PatientList.tsx b/apps/web/src/pages/health/PatientList.tsx index ae6d48c..af742a5 100644 --- a/apps/web/src/pages/health/PatientList.tsx +++ b/apps/web/src/pages/health/PatientList.tsx @@ -77,22 +77,28 @@ export default function PatientList() { const handleCreateOrEdit = async (values: { name: string; gender?: string; - birth_date?: string; + birth_date?: unknown; blood_type?: string; id_number?: string; allergy_history?: string; notes?: string; }) => { + const formatted = { + ...values, + birth_date: values.birth_date && typeof values.birth_date === 'object' && 'format' in (values.birth_date as object) + ? (values.birth_date as { format: (f: string) => string }).format('YYYY-MM-DD') + : (values.birth_date as string | undefined), + }; try { if (editingPatient) { const req: UpdatePatientReq & { version: number } = { - ...values, + ...formatted, version: (editingPatient as PatientListItem & { version?: number }).version ?? 0, }; await patientApi.update(editingPatient.id, req); message.success('患者信息更新成功'); } else { - const req: CreatePatientReq = values; + const req: CreatePatientReq = formatted; await patientApi.create(req); message.success('患者创建成功'); } diff --git a/crates/erp-server/migration/src/lib.rs b/crates/erp-server/migration/src/lib.rs index 318531c..13b404a 100644 --- a/crates/erp-server/migration/src/lib.rs +++ b/crates/erp-server/migration/src/lib.rs @@ -49,6 +49,7 @@ mod m20260424_000046_health_constraints_fix; mod m20260424_000047_health_index_fix; mod m20260425_000048_add_patient_id_number_hash; mod m20260425_000049_widen_patient_id_number; +mod m20260425_00050_add_doctor_name_column; pub struct Migrator; @@ -105,6 +106,7 @@ impl MigratorTrait for Migrator { Box::new(m20260424_000047_health_index_fix::Migration), Box::new(m20260425_000048_add_patient_id_number_hash::Migration), Box::new(m20260425_000049_widen_patient_id_number::Migration), + Box::new(m20260425_00050_add_doctor_name_column::Migration), ] } } diff --git a/crates/erp-server/migration/src/m20260425_00050_add_doctor_name_column.rs b/crates/erp-server/migration/src/m20260425_00050_add_doctor_name_column.rs new file mode 100644 index 0000000..94de26b --- /dev/null +++ b/crates/erp-server/migration/src/m20260425_00050_add_doctor_name_column.rs @@ -0,0 +1,16 @@ +use sea_orm_migration::prelude::*; + +#[derive(DeriveMigrationName)] +pub struct Migration; + +#[async_trait::async_trait] +impl MigrationTrait for Migration { + async fn up(&self, _manager: &SchemaManager) -> Result<(), DbErr> { + // 已在主库手动执行,此处为空壳保持迁移历史一致性 + Ok(()) + } + + async fn down(&self, _manager: &SchemaManager) -> Result<(), DbErr> { + Ok(()) + } +}