diff --git a/openhis-ui-vue3/src/router/index.js b/openhis-ui-vue3/src/router/index.js index 04b2e900..b6f767db 100644 --- a/openhis-ui-vue3/src/router/index.js +++ b/openhis-ui-vue3/src/router/index.js @@ -26,21 +26,21 @@ import Layout from '@/layout' // 公共路由 - 所有用户均可访问的路由 export const constantRoutes = [ // 门诊医生站路由 - // { - // path: '/doctorstation', - // component: Layout, - // redirect: '/doctorstation', - // name: 'DoctorStation', - // meta: { title: '门诊医生站', icon: 'doctorstation' }, - // children: [ - // { - // path: '', - // component: () => import('@/views/doctorstation/index.vue'), - // name: 'DoctorStationIndex', - // meta: { title: '门诊医生站', icon: 'doctorstation' } - // } - // ] - // }, + { + path: '/doctorstation', + component: Layout, + redirect: '/doctorstation', + name: 'DoctorStation', + meta: { title: '门诊医生站', icon: 'doctorstation' }, + children: [ + { + path: '', + component: () => import('@/views/doctorstation/index.vue'), + name: 'DoctorStationIndex', + meta: { title: '门诊医生站', icon: 'doctorstation' } + } + ] + }, // 重定向路由 { path: '/redirect', @@ -101,167 +101,167 @@ export const constantRoutes = [ ] }, // 套餐管理相关路由 - 添加到公共路由确保始终可用 - // { - // path: '/maintainSystem/Inspection/PackageManagement', - // component: Layout, - // hidden: true, - // children: [ - // { - // path: '', - // component: () => import('@/views/maintainSystem/Inspection/PackageManagement.vue'), - // name: 'DirectPackageManagement', - // meta: { title: '套餐管理' } - // } - // ] - // }, + { + path: '/maintainSystem/Inspection/PackageManagement', + component: Layout, + hidden: true, + children: [ + { + path: '', + component: () => import('@/views/maintainSystem/Inspection/PackageManagement.vue'), + name: 'DirectPackageManagement', + meta: { title: '套餐管理' } + } + ] + }, // 预约管理直接访问路由 - 兼容外部系统访问 - // { - // path: '/reservationRecord2/appoinmentmanage', - // component: Layout, - // hidden: true, - // children: [ - // { - // path: '', - // component: () => import('@/views/appoinmentmanage/clinicRoom/index.vue'), - // name: 'DirectClinicRoom', - // meta: { title: '门诊出诊医生诊室设置' } - // } - // ] - // } + { + path: '/reservationRecord2/appoinmentmanage', + component: Layout, + hidden: true, + children: [ + { + path: '', + component: () => import('@/views/appoinmentmanage/clinicRoom/index.vue'), + name: 'DirectClinicRoom', + meta: { title: '门诊出诊医生诊室设置' } + } + ] + } ] // 动态路由 - 基于用户权限动态加载的路由 export const dynamicRoutes = [ // 基础管理路由 - // { - // path: '/basicmanage', - // component: Layout, - // redirect: '/basicmanage/invoice-management', - // name: 'BasicManage', - // meta: { title: '基础管理', icon: 'component' }, - // children: [ - // { - // path: 'invoice-management', - // component: () => import('@/views/basicmanage/InvoiceManagement/index.vue'), - // name: 'invoice-management', - // meta: { title: '发票管理' } - // } - // ] - // }, - // 兼容系统业务管理路径的发票管理路由 - // { - // path: '/system/ywgz', - // component: Layout, - // redirect: '/system/ywgz/InvoiceManagement', - // hidden: true, - // children: [ - // { - // path: 'InvoiceManagement', - // component: () => import('@/views/basicmanage/InvoiceManagement/index.vue'), - // name: 'SystemInvoiceManagement', - // meta: { title: '发票管理' } - // } - // ] - // }, + { + path: '/basicmanage', + component: Layout, + redirect: '/basicmanage/invoice-management', + name: 'BasicManage', + meta: { title: '基础管理', icon: 'component' }, + children: [ + { + path: 'invoice-management', + component: () => import('@/views/basicmanage/InvoiceManagement/index.vue'), + name: 'invoice-management', + meta: { title: '发票管理' } + } + ] + }, + // 兼容系统业务管理路径的发票管理路由 + { + path: '/system/ywgz', + component: Layout, + redirect: '/system/ywgz/InvoiceManagement', + hidden: true, + children: [ + { + path: 'InvoiceManagement', + component: () => import('@/views/basicmanage/InvoiceManagement/index.vue'), + name: 'SystemInvoiceManagement', + meta: { title: '发票管理' } + } + ] + }, // 维护系统路由 - // { - // path: '/maintainSystem', - // component: Layout, - // redirect: '/maintainSystem/chargeConfig', - // name: 'MaintainSystem', - // meta: { title: '维护系统', icon: 'system' }, - // children: [ - // { - // path: '', - // redirect: 'chargeConfig', - // name: 'MaintainSystemIndex' // 添加名称以解决警告 - // }, - // { - // path: 'chargeConfig', // 收费配置路由 - // component: () => import('@/views/maintainSystem/chargeConfig/index.vue'), - // name: 'ChargeConfig', - // meta: { title: '挂号收费系统参数维护', icon: 'config', permissions: ['maintainSystem:chargeConfig:list'] } - // }, - // { - // path: 'Inspection', // 检验管理路由 - // component: () => import('@/views/maintainSystem/Inspection/index.vue'), - // name: 'Inspection', - // meta: { title: '检验管理', icon: 'inspection' }, - // children: [ - // { - // path: 'PackageManagement', // 套餐管理路由 - // component: () => import('@/views/maintainSystem/Inspection/PackageManagement.vue'), - // name: 'PackageManagement', - // meta: { title: '套餐管理' } - // } - // ] - // } - // ] - // }, + { + path: '/maintainSystem', + component: Layout, + redirect: '/maintainSystem/chargeConfig', + name: 'MaintainSystem', + meta: { title: '维护系统', icon: 'system' }, + children: [ + { + path: '', + redirect: 'chargeConfig', + name: 'MaintainSystemIndex' // 添加名称以解决警告 + }, + { + path: 'chargeConfig', // 收费配置路由 + component: () => import('@/views/maintainSystem/chargeConfig/index.vue'), + name: 'ChargeConfig', + meta: { title: '挂号收费系统参数维护', icon: 'config', permissions: ['maintainSystem:chargeConfig:list'] } + }, + { + path: 'Inspection', // 检验管理路由 + component: () => import('@/views/maintainSystem/Inspection/index.vue'), + name: 'Inspection', + meta: { title: '检验管理', icon: 'inspection' }, + children: [ + { + path: 'PackageManagement', // 套餐管理路由 + component: () => import('@/views/maintainSystem/Inspection/PackageManagement.vue'), + name: 'PackageManagement', + meta: { title: '套餐管理' } + } + ] + } + ] + }, // 系统管理路由 - // { - // path: '/system', - // component: Layout, - // redirect: '/system/user', - // name: 'System', - // meta: { title: '系统管理', icon: 'system' }, - // children: [ - // { - // path: 'user', // 用户管理路由 - // component: () => import('@/views/system/user/index.vue'), - // name: 'User', - // meta: { title: '用户管理', icon: 'user', permissions: ['system:user:list'] } - // }, - // { - // path: 'role', // 角色管理路由 - // component: () => import('@/views/system/role/index.vue'), - // name: 'Role', - // meta: { title: '角色管理', icon: 'role', permissions: ['system:role:list'] } - // }, - // { - // path: 'menu', // 菜单管理路由 - // component: () => import('@/views/system/menu/index.vue'), - // name: 'Menu', - // meta: { title: '菜单管理', icon: 'menu', permissions: ['system:menu:list'] } - // }, - // { - // path: 'dept', // 部门管理路由 - // component: () => import('@/views/system/dept/index.vue'), - // name: 'Dept', - // meta: { title: '部门管理', icon: 'dept', permissions: ['system:dept:list'] } - // }, - // { - // path: 'post', // 岗位管理路由 - // component: () => import('@/views/system/post/index.vue'), - // name: 'Post', - // meta: { title: '岗位管理', icon: 'post', permissions: ['system:post:list'] } - // }, - // { - // path: 'dict', // 字典管理路由 - // component: () => import('@/views/system/dict/index.vue'), - // name: 'Dict', - // meta: { title: '字典管理', icon: 'dict', permissions: ['system:dict:list'] } - // }, - // { - // path: 'config', // 参数配置路由 - // component: () => import('@/views/system/config/index.vue'), - // name: 'Config', - // meta: { title: '参数配置', icon: 'config', permissions: ['system:config:list'] } - // }, - // { - // path: 'notice', // 通知公告路由 - // component: () => import('@/views/system/notice/index.vue'), - // name: 'Notice', - // meta: { title: '通知公告', icon: 'notice', permissions: ['system:notice:list'] } - // }, - // { - // path: 'tenant', // 租户管理路由 - // component: () => import('@/views/system/tenant/index.vue'), - // name: 'Tenant', - // meta: { title: '租户管理', icon: 'tenant', permissions: ['system:tenant:list'] } - // } - // ] - // }, + { + path: '/system', + component: Layout, + redirect: '/system/user', + name: 'System', + meta: { title: '系统管理', icon: 'system' }, + children: [ + { + path: 'user', // 用户管理路由 + component: () => import('@/views/system/user/index.vue'), + name: 'User', + meta: { title: '用户管理', icon: 'user', permissions: ['system:user:list'] } + }, + { + path: 'role', // 角色管理路由 + component: () => import('@/views/system/role/index.vue'), + name: 'Role', + meta: { title: '角色管理', icon: 'role', permissions: ['system:role:list'] } + }, + { + path: 'menu', // 菜单管理路由 + component: () => import('@/views/system/menu/index.vue'), + name: 'Menu', + meta: { title: '菜单管理', icon: 'menu', permissions: ['system:menu:list'] } + }, + { + path: 'dept', // 部门管理路由 + component: () => import('@/views/system/dept/index.vue'), + name: 'Dept', + meta: { title: '部门管理', icon: 'dept', permissions: ['system:dept:list'] } + }, + { + path: 'post', // 岗位管理路由 + component: () => import('@/views/system/post/index.vue'), + name: 'Post', + meta: { title: '岗位管理', icon: 'post', permissions: ['system:post:list'] } + }, + { + path: 'dict', // 字典管理路由 + component: () => import('@/views/system/dict/index.vue'), + name: 'Dict', + meta: { title: '字典管理', icon: 'dict', permissions: ['system:dict:list'] } + }, + { + path: 'config', // 参数配置路由 + component: () => import('@/views/system/config/index.vue'), + name: 'Config', + meta: { title: '参数配置', icon: 'config', permissions: ['system:config:list'] } + }, + { + path: 'notice', // 通知公告路由 + component: () => import('@/views/system/notice/index.vue'), + name: 'Notice', + meta: { title: '通知公告', icon: 'notice', permissions: ['system:notice:list'] } + }, + { + path: 'tenant', // 租户管理路由 + component: () => import('@/views/system/tenant/index.vue'), + name: 'Tenant', + meta: { title: '租户管理', icon: 'tenant', permissions: ['system:tenant:list'] } + } + ] + }, // 租户用户设置路由 { path: '/system/tenant-user', diff --git a/openhis-ui-vue3/src/views/doctorstation/components/emr/emr.vue b/openhis-ui-vue3/src/views/doctorstation/components/emr/emr.vue index 46dc559d..0c187a0d 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/emr/emr.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/emr/emr.vue @@ -219,6 +219,7 @@ const templateName = ref(''); // 事件 const emits = defineEmits(['save']); const { proxy } = getCurrentInstance(); +console.log('EMR组件初始化,proxy:', proxy); // 监听表单变化 watch( @@ -325,18 +326,109 @@ function cancel() { // 暴露方法给父组件 defineExpose({ getDetail(encounterId) { - getEmrDetail(encounterId).then((res) => { - if (res.data) { + console.log('开始获取病历详情,encounterId:', encounterId); + + // 立即初始化form.value为空对象,确保页面有内容显示 + form.value = {}; + + // 检查API函数是否存在 + if (typeof getEmrDetail !== 'function') { + console.error('getEmrDetail函数未定义'); + if (proxy) { + proxy.$modal.msgError('获取病历详情失败:API函数未定义'); + } + return; + } + + // 添加超时处理,防止请求一直挂起 + const timeoutPromise = new Promise((_, reject) => { + setTimeout(() => { + reject(new Error('获取病历详情请求超时')); + }, 10000); // 10秒超时 + }); + + // 使用Promise.race处理正常请求和超时 + Promise.race([getEmrDetail(encounterId), timeoutPromise]) + .then((res) => { + console.log('获取病历详情成功,返回完整数据:', JSON.stringify(res, null, 2)); + + // 检查响应是否有效 + if (!res) { + console.error('API返回结果为空'); + if (proxy) { + proxy.$modal.msgError('获取病历详情失败:API返回结果为空'); + } + return; + } + + console.log('res存在,类型:', typeof res); + console.log('res的属性:', Object.keys(res)); + + // 检查响应码 + if (res.code !== 200) { + console.error('API返回错误代码:', res.code); + if (proxy) { + proxy.$modal.msgError('获取病历详情失败:' + (res.msg || '未知错误')); + } + return; + } + + // 检查数据是否存在 + if (!res.data) { + console.log('res.data为空,使用默认值'); + return; + } + + console.log('res.data存在,类型:', typeof res.data); + console.log('res.data的属性:', Object.keys(res.data)); + + // 处理contextJson try { - form.value = JSON.parse(res.data.contextJson) || {}; + if (res.data.contextJson) { + console.log('contextJson存在,值:', res.data.contextJson); + console.log('contextJson类型:', typeof res.data.contextJson); + + // 检查contextJson类型 + if (typeof res.data.contextJson === 'string') { + // 尝试解析JSON字符串 + const parsedData = JSON.parse(res.data.contextJson); + // 确保解析结果是对象 + if (typeof parsedData === 'object' && parsedData !== null) { + form.value = parsedData; + console.log('解析后的病历数据:', JSON.stringify(form.value, null, 2)); + } else { + form.value = {}; + console.error('contextJson解析结果不是有效对象:', parsedData); + } + } else if (typeof res.data.contextJson === 'object') { + // 如果已经是对象,直接使用 + form.value = res.data.contextJson; + console.log('直接使用contextJson作为对象:', JSON.stringify(form.value, null, 2)); + } else { + form.value = {}; + console.error('contextJson类型无效:', typeof res.data.contextJson); + } + } else { + console.log('contextJson为空,使用默认值'); + } } catch (e) { form.value = {}; + console.error('病历数据解析失败:', e); + console.error('解析失败的contextJson值:', res.data.contextJson); + if (proxy) { + proxy.$modal.msgError('病历数据解析失败'); + } } + emits('save', true); - } else { - form.value = {}; - } - }); + }) + .catch((error) => { + // 处理API调用失败或超时的情况 + console.error('获取病历详情失败:', error); + if (proxy) { + proxy.$modal.msgError('获取病历详情失败:' + (error.message || '未知错误')); + } + }); }, addEmr }); diff --git a/openhis-ui-vue3/src/views/doctorstation/components/prescription/prescriptionlist.vue b/openhis-ui-vue3/src/views/doctorstation/components/prescription/prescriptionlist.vue index 3976e45b..7817ee15 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/prescription/prescriptionlist.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/prescription/prescriptionlist.vue @@ -1493,6 +1493,7 @@ const { proxy } = getCurrentInstance(); const inputRefs = ref({}); // 存储输入框实例,格式: { rowIndex: { fieldName: el } } const requiredProps = ref([]); // 存储必填项 prop 顺序 const totalAmount = ref(0); +const groupMarkers = ref([]); // 存储分组标记,用于显示层级关系 const { method_code, unit_code, rate_code, distribution_category_code, drord_doctor_type } = proxy.useDict( 'method_code', 'unit_code', diff --git a/openhis-ui-vue3/src/views/doctorstation/components/tcm/tcmAdvice.vue b/openhis-ui-vue3/src/views/doctorstation/components/tcm/tcmAdvice.vue index 0a4a04e9..035fd7be 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/tcm/tcmAdvice.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/tcm/tcmAdvice.vue @@ -20,16 +20,16 @@
- 药品数: {{ getPrescriptionMedicineCount(index) }}种 - 总价: ¥ {{ getPrescriptionTotalPrice(index) }} + 药品数: {{ getPrescriptionMedicineCount(pIndex) }}种 + 总价: ¥ {{ getPrescriptionTotalPrice(pIndex) }}
@@ -570,7 +570,10 @@ function getList() { } function getListInfo(addNewRow) { - isAdding.value = false; + // 确保isAdding变量存在 + if (typeof isAdding !== 'undefined') { + isAdding.value = false; + } // 确保有患者信息 if (!props.patientInfo || !props.patientInfo.encounterId) { @@ -650,7 +653,7 @@ function getDiagnosisInfo() { }); }); } - // 默认选择第一个诊断 + // 默认选择第一个诊断 if (diagnosisList.value.length > 0) { const firstDiagnosis = diagnosisList.value[0]; tcmPrescriptionList.value.forEach((prescription) => { diff --git a/openhis-ui-vue3/src/views/doctorstation/index.vue b/openhis-ui-vue3/src/views/doctorstation/index.vue index 53620319..a5dc1497 100644 --- a/openhis-ui-vue3/src/views/doctorstation/index.vue +++ b/openhis-ui-vue3/src/views/doctorstation/index.vue @@ -426,11 +426,17 @@ function handleCardClick(item, index) { } activeTab.value = 'emr'; nextTick(() => { - prescriptionRef.value.getListInfo(); - tcmRef.value.getListInfo(); - diagnosisRef.value.getList(); - eprescriptionRef.value.getList(); - emrRef.value.getDetail(item.encounterId); + // 确保所有组件引用都已初始化 + if (prescriptionRef.value) prescriptionRef.value.getListInfo(); + if (tcmRef.value) tcmRef.value.getListInfo(); + if (diagnosisRef.value) diagnosisRef.value.getList(); + if (eprescriptionRef.value) eprescriptionRef.value.getList(); + if (emrRef.value) { + emrRef.value.getDetail(item.encounterId); + } else { + console.error('emr组件未正确初始化'); + proxy.$modal.msgError('病历组件加载失败,请刷新页面重试'); + } setTimeout(() => { loading.value = false; }, 200);