From aa011c3721946b71881a62009c5c8a4dd6d00a54 Mon Sep 17 00:00:00 2001 From: chenqi Date: Thu, 25 Jun 2026 16:12:28 +0800 Subject: [PATCH] feat(i18n): fix menu auto-translation fallback + expand dictionary with 200+ menu terms --- healthlink-his-ui/src/i18n/autoTranslate.js | 87 +++++++++++++++++++ .../layout/components/Sidebar/SidebarItem.vue | 10 ++- .../src/layout/components/TagsView/index.vue | 8 +- 3 files changed, 103 insertions(+), 2 deletions(-) diff --git a/healthlink-his-ui/src/i18n/autoTranslate.js b/healthlink-his-ui/src/i18n/autoTranslate.js index cec174ea6..abc1b9194 100644 --- a/healthlink-his-ui/src/i18n/autoTranslate.js +++ b/healthlink-his-ui/src/i18n/autoTranslate.js @@ -85,6 +85,93 @@ const translationDict = { '在线': 'Online', '离线': 'Offline', '已连接': 'Connected', '未连接': 'Disconnected', '元': 'Yuan', '次': 'Times', '天': 'Days', '小时': 'Hours', '分钟': 'Minutes', '条': 'Items', '个': 'Items', '项': 'Items', '次/分': 'Times/min', + // 菜单专用术语 + '工作站': 'Workstation', '日结': 'Daily Settlement', '换卡': 'Card Replacement', + '预交金': 'Prepayment', '收费': 'Charge', '退费': 'Refund', '退号': 'Cancel Reg.', + '挂号': 'Registration', '划价': 'Pricing', '发药': 'Dispensing', '退药': 'Drug Return', + '领药': 'Drug Collection', '入库': 'Inbound', '出库': 'Outbound', '盘点': 'Stocktaking', + '调拨': 'Transfer', '报损': 'Damage Report', '损益': 'Profit/Loss', + '审批': 'Approval', '审核': 'Review', '校对': 'Proofreading', '签发': 'Sign & Issue', + '闭环': 'Closed Loop', '组套': 'Template', '组合': 'Combination', + '增强': 'Enhanced', '质量': 'Quality', '指标': 'Indicator', '统计': 'Statistics', + '报表': 'Report', '管理': 'Management', '维护': 'Maintenance', '配置': 'Config', + '设置': 'Settings', '参数': 'Parameter', '目录': 'Catalog', '对照': 'Mapping', + '清单': 'List', '明细': 'Detail', '汇总': 'Summary', '查询': 'Query', + '追溯': 'Traceability', '预警': 'Alert', '监测': 'Monitoring', '筛查': 'Screening', + '评估': 'Assessment', '记录': 'Record', '执行': 'Execution', '追踪': 'Tracking', + '床位': 'Bed', '病区': 'Ward', '病房': 'Room', '诊室': 'Consulting Room', + '叫号': 'Call Number', '排队': 'Queue', '分诊': 'Triage', '留观': 'Observation', + '抢救': 'Rescue', '绿色通道': 'Green Channel', + '知情同意': 'Informed Consent', '临床路径': 'Clinical Pathway', + '随访': 'Follow-up', '会诊': 'Consultation', '转诊': 'Referral', + '传染病': 'Infectious Disease', '疫情': 'Epidemic', '院感': 'HAI', + '抗菌': 'Antibiotic', '耐药': 'Drug Resistant', '手卫生': 'Hand Hygiene', + '消毒': 'Sterilization', '供应': 'Supply', + '手术室': 'Operating Room', '手术台': 'Operating Table', '麻醉': 'Anesthesia', + '病历': 'Medical Record', '病案': 'Case Record', '病程': 'Progress Notes', + '医嘱': 'Order', '处方': 'Prescription', '诊断': 'Diagnosis', + '检验': 'Lab Test', '检查': 'Examination', '标本': 'Specimen', '仪器': 'Instrument', + '药品': 'Drug', '耗材': 'Consumable', '设备': 'Device', '物资': 'Material', + '供应商': 'Supplier', '合同': 'Contract', '货位': 'Location', + '财务': 'Finance', '结算': 'Settlement', '对账': 'Reconciliation', + '发票': 'Invoice', '收据': 'Receipt', '押金': 'Deposit', + '排班': 'Schedule', '考勤': 'Attendance', '排期': 'Scheduling', + '权限': 'Permission', '角色': 'Role', '菜单': 'Menu', '字典': 'Dictionary', + '部门': 'Department', '岗位': 'Position', '租户': 'Tenant', + '日志': 'Log', '审计': 'Audit', '监控': 'Monitor', '缓存': 'Cache', + '接口': 'Interface', '服务': 'Service', '流程': 'Process', + '模板': 'Template', '签名': 'Signature', '电子': 'Electronic', + '知识库': 'Knowledge Base', '合理用药': 'Rational Drug Use', + 'DRG': 'DRG', 'DIP': 'DIP', 'EMPI': 'EMPI', 'ESB': 'ESB', + 'FHIR': 'FHIR', 'CDA': 'CDA', 'LIS': 'LIS', 'PACS': 'PACS', + 'TPR': 'TPR', 'ICD': 'ICD', 'CSSD': 'CSSD', + '门诊': 'Outpatient', '住院': 'Inpatient', '急诊': 'Emergency', + '外科': 'Surgery', '内科': 'Internal Medicine', '妇产科': 'OB/GYN', + '儿科': 'Pediatrics', '骨科': 'Orthopedics', '眼科': 'Ophthalmology', + '耳鼻喉': 'ENT', '口腔': 'Dental', '皮肤科': 'Dermatology', + '中医': 'TCM', '康复': 'Rehabilitation', '营养': 'Nutrition', + '心理': 'Psychology', '放射': 'Radiology', '超声': 'Ultrasound', + '病理': 'Pathology', '输血': 'Blood Transfusion', '透析': 'Dialysis', + '重症': 'ICU', '新生儿': 'Neonatal', '产科': 'Obstetrics', + '体检': 'Physical Exam', '预防': 'Prevention', '保健': 'Health Care', + '药品效期': 'Drug Expiry', '药品追溯': 'Drug Traceability', + '医嘱执行': 'Order Execution', '医嘱校对': 'Order Proofreading', + '发药管理': 'Dispensing Management', '发药统计': 'Dispensing Statistics', + '库存预警': 'Stock Alert', '库存明细': 'Stock Detail', + '价格调整': 'Price Adjustment', '调价': 'Price Adjustment', + '缴费': 'Payment', '退费': 'Refund', '欠费': 'Arrears', + '预交': 'Prepayment', '押金': 'Deposit', '补打': 'Reprint', + '重打': 'Reprint', '补录': 'Retroactive Entry', + '皮试': 'Skin Test', '过敏': 'Allergy', '不良反应': 'Adverse Reaction', + '危急值': 'Critical Value', '危急': 'Critical', + '床位管理': 'Bed Management', '入院': 'Admission', '出院': 'Discharge', + '转科': 'Transfer Dept.', '转院': 'Transfer Hospital', + '接诊': 'Consultation', '复诊': 'Follow-up Visit', '初诊': 'First Visit', + '叫号': 'Call Number', '候诊': 'Waiting', '就诊': 'Visit', + '收费工作站': 'Charge Workstation', '门诊日结': 'OPD Daily Settlement', + '门诊换卡': 'OPD Card Replacement', '预交金管理': 'Prepayment Management', + '收费记录': 'Charge Records', '出院结算': 'Discharge Settlement', + '门诊医生工作站': 'OPD Doctor Workstation', '住院医生工作站': 'IPD Doctor Workstation', + '门诊收费工作站': 'OPD Charge Workstation', '住院收费工作站': 'IPD Charge Workstation', + '门诊挂号': 'OPD Registration', '门诊收费': 'OPD Charge', '门诊退费': 'OPD Refund', + '门诊发药': 'OPD Dispensing', '门诊退药': 'OPD Drug Return', + '住院登记': 'IPD Registration', '住院结算': 'IPD Settlement', + '住院发药': 'IPD Dispensing', '住院退药': 'IPD Drug Return', + '手术安排': 'Surgery Schedule', '手术记录': 'Surgery Record', + '护理记录': 'Nursing Record', '护理评估': 'Nursing Assessment', + '病历检索': 'EMR Search', '病历时效': 'EMR Timeliness', + '病案归档': 'Case Archive', '病案首页': 'Case Homepage', + '合理用药': 'Rational Drug Use', '抗菌药物': 'Antibiotics', + '传染病报告': 'Infectious Disease Report', '院感管理': 'HAI Management', + '危急值处理': 'Critical Value Handling', '危急值管理': 'Critical Value Mgmt', + '检验报告': 'Lab Report', '检查报告': 'Inspection Report', + '药品目录': 'Drug Catalog', '诊疗目录': 'Treatment Catalog', + '医保结算': 'Insurance Settlement', '医保对账': 'Insurance Reconciliation', + '库存管理': 'Inventory Management', '采购管理': 'Procurement Management', + '知识库': 'Knowledge Base', '临床路径': 'Clinical Pathway', + '会诊管理': 'Consultation Management', '随访管理': 'Follow-up Management', + '电子签名': 'Electronic Signature', '电子病历': 'Electronic Medical Record', + '质量指标': 'Quality Indicator', '质量管理': 'Quality Management', }, 'vi': { '新增': 'Thêm', '编辑': 'Sửa', '删除': 'Xóa', '查询': 'Tìm kiếm', '重置': 'Đặt lại', diff --git a/healthlink-his-ui/src/layout/components/Sidebar/SidebarItem.vue b/healthlink-his-ui/src/layout/components/Sidebar/SidebarItem.vue index 096aca8e7..a72b0df23 100755 --- a/healthlink-his-ui/src/layout/components/Sidebar/SidebarItem.vue +++ b/healthlink-his-ui/src/layout/components/Sidebar/SidebarItem.vue @@ -59,6 +59,7 @@ import {isExternal} from '@/utils/validate' import AppLink from './Link' import {getNormalPath} from '@/utils/his' import {useI18n} from 'vue-i18n' +import {autoTranslate} from '@/i18n/autoTranslate' import menuTitleMap from './menuTitleMap' const {t} = useI18n() @@ -66,7 +67,14 @@ const {t} = useI18n() function translateTitle(title) { if (!title) return '' const key = menuTitleMap[title] - return key ? t(key) : title + if (key) { + const result = t(key) + // 如果翻译结果还是 key(locale 中没有),用自动翻译 + if (result === key) return autoTranslate(title) + return result + } + // 没有映射,直接用自动翻译字典 + return autoTranslate(title) } const props = defineProps({ diff --git a/healthlink-his-ui/src/layout/components/TagsView/index.vue b/healthlink-his-ui/src/layout/components/TagsView/index.vue index e86375945..d53aba0ca 100755 --- a/healthlink-his-ui/src/layout/components/TagsView/index.vue +++ b/healthlink-his-ui/src/layout/components/TagsView/index.vue @@ -75,6 +75,7 @@ import useTagsViewStore from '@/store/modules/tagsView'; import useSettingsStore from '@/store/modules/settings'; import usePermissionStore from '@/store/modules/permission'; import {useI18n} from 'vue-i18n'; +import {autoTranslate} from '@/i18n/autoTranslate'; import menuTitleMap from '../Sidebar/menuTitleMap'; const {t} = useI18n(); @@ -82,7 +83,12 @@ const {t} = useI18n(); function translateTitle(title) { if (!title) return ''; const key = menuTitleMap[title]; - return key ? t(key) : title; + if (key) { + const result = t(key); + if (result === key) return autoTranslate(title); + return result; + } + return autoTranslate(title); } const visible = ref(false);