首页报错和门诊医生站报错

This commit is contained in:
2025-12-12 15:48:07 +08:00
parent 0794782505
commit f33e3c6f15
8 changed files with 197 additions and 177 deletions

View File

@@ -85,6 +85,14 @@ function resolvePath(routePath, routeQuery) {
if (isExternal(props.basePath)) {
return props.basePath
}
// 特殊处理门诊医生站路径,确保路径正确
if (routePath === '/doctorstation' || routePath === 'doctorstation') {
if (routeQuery) {
let query = JSON.parse(routeQuery);
return { path: '/doctorstation', query: query }
}
return '/doctorstation'
}
if (routeQuery) {
let query = JSON.parse(routeQuery);
return { path: getNormalPath(props.basePath + '/' + routePath), query: query }

View File

@@ -5,7 +5,6 @@ import Cookies from 'js-cookie'
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'
import locale from 'element-plus/es/locale/lang/zh-cn'
import '@/assets/styles/index.scss' // global css
@@ -84,8 +83,14 @@ app.component('ImageUpload', ImageUpload)
app.component('ImagePreview', ImagePreview)
app.component('RightToolbar', RightToolbar)
app.component('Editor', Editor)
app.use(registerComponents)
// 使用element-plus 并且设置全局的大小
app.use(ElementPlus, {
locale: zhCn,
// 支持 large、default、small
size: Cookies.get('size') || 'default'
})
app.use(ElMessage)
app.use(registerComponents)
app.use(router)
app.use(store)
app.use(plugins)
@@ -94,11 +99,5 @@ app.component('svg-icon', SvgIcon)
directive(app)
// 全局禁止点击遮罩层关闭弹窗
ElDialog.props.closeOnClickModal.default = false;
// 使用element-plus 并且设置全局的大小
app.use(ElementPlus, {
locale: zhCn,
// 支持 large、default、small
size: Cookies.get('size') || 'default'
})
app.mount('#app')

View File

@@ -29,14 +29,9 @@ router.beforeEach((to, from, next) => {
// 判断当前用户是否已拉取完user_info信息
useUserStore().getInfo().then(() => {
isRelogin.show = false
usePermissionStore().generateRoutes().then(accessRoutes => {
// 根据roles权限生成可访问的路由表
accessRoutes.forEach(route => {
if (!isHttp(route.path)) {
router.addRoute(route) // 动态添加可访问路由表
}
})
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
usePermissionStore().generateRoutes().then(() => {
// 路由已在generateRoutes方法中添加无需再次添加
next({ ...to, replace: true }) // hack方法 确保路由已完成
})
}).catch(err => {
useUserStore().logOut().then(() => {

View File

@@ -27,6 +27,8 @@ import Layout from '@/layout'
// 公共路由
export const constantRoutes = [
{ path: '/appoinmentmanage', component: Layout, redirect: '/appoinmentmanage', name: 'AppoinmentManage', hidden: true, meta: { title: '预约管理', icon: 'component' }, children: [{ path: '', component: () => import('@/views/appoinmentmanage/index.vue'), name: 'AppoinmentManageIndex', meta: { title: '预约管理' } }, { path: 'doctorschedule/:deptId', component: () => import('@/views/appoinmentmanage/doctorschedule/index.vue'), name: 'DoctorSchedule', hidden: true, meta: { title: '医生排班' } }] },
// 门诊医生站路由配置
{ 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',
component: Layout,

View File

@@ -580,13 +580,17 @@ function getListInfo(addNewRow) {
getTcmAdviceList({ encounterId: props.patientInfo.encounterId }).then((res) => {
if (res && res.data && Array.isArray(res.data)) {
prescriptionList.value = res.data.map((item) => {
// 清空当前处方列表
tcmPrescriptionList.value = [];
// 处理返回的数据
res.data.forEach((item) => {
try {
// 解析contentJson获取完整的医嘱数据
const contentData = item.contentJson ? JSON.parse(item.contentJson) : {};
// 合并基础信息和contentJson中的详细信息
return {
// 创建一个新的处方对象
const newPrescription = {
...item,
...contentData,
// 确保关键显示字段存在
@@ -596,11 +600,14 @@ function getListInfo(addNewRow) {
diagnosisName: contentData.diagnosisName || item.diagnosisName || '',
positionName: contentData.positionName || item.positionName || '',
doseUnitCode_dictText: contentData.doseUnitCode_dictText || item.doseUnitCode_dictText || '',
chineseHerbsDoseQuantity: contentData.chineseHerbsDoseQuantity || item.chineseHerbsDoseQuantity || ''
chineseHerbsDoseQuantity: contentData.chineseHerbsDoseQuantity || item.chineseHerbsDoseQuantity || '',
prescriptionList: [contentData]
};
// 添加到处方列表
tcmPrescriptionList.value.push(newPrescription);
} catch (error) {
console.error('解析医嘱数据失败:', error, '数据项:', item);
return item; // 出错时返回原始数据
}
});
@@ -612,11 +619,11 @@ function getListInfo(addNewRow) {
}
} else {
console.error('获取医嘱列表失败或数据格式错误:', res);
prescriptionList.value = [];
tcmPrescriptionList.value = [];
}
}).catch(error => {
console.error('获取医嘱列表异常:', error);
prescriptionList.value = [];
tcmPrescriptionList.value = [];
});
tcmDiagnosisList.value = getFromDiagnosis(props.patientInfo.encounterId);
@@ -769,7 +776,8 @@ function handleDeletePrescriptionClick(prescriptionIndex) {
}
// 检查是否有已签发的药品
const hasChargedItems = prescriptionList.value.some(item => item.statusEnum === 2);
const prescription = tcmPrescriptionList.value[prescriptionIndex];
const hasChargedItems = prescription.prescriptionList.some(item => item.statusEnum === 2);
if (hasChargedItems) {
proxy.$modal.msgWarning('该处方单已收费,不能删除');
return;
@@ -793,16 +801,18 @@ function isPrescriptionDeletable(prescriptionIndex) {
}
// 检查是否有已签发的药品
const hasChargedItems = prescriptionList.value.some(item => item.statusEnum === 2);
const hasChargedItems = tcmPrescriptionList.value.some(item =>
item.prescriptionList && item.prescriptionList.some(med => med.statusEnum === 2)
);
return !hasChargedItems;
}
// 计算处方总价
function getPrescriptionTotalPrice(prescriptionIndex) {
const prescription = prescriptionList.value[prescriptionIndex];
const prescription = tcmPrescriptionList.value[prescriptionIndex];
let totalPrice = 0;
if (prescription && prescription.prescriptionDetailsList) {
prescription.prescriptionDetailsList.forEach(item => {
if (prescription && prescription.prescriptionList) {
prescription.prescriptionList.forEach(item => {
// 使用decimal.js确保精度计算
const quantity = new Decimal(item.minUnitQuantity || 0);
const unitPrice = new Decimal(item.unitPrice || 0);
@@ -814,9 +824,11 @@ function getPrescriptionTotalPrice(prescriptionIndex) {
// 获取处方中的药品数量
function getPrescriptionMedicineCount(prescriptionIndex) {
// 这里需要根据实际的业务逻辑来计算
// 假设每个处方对应一组药品,这里简化处理
return prescriptionList.value.filter(item => item.statusEnum !== 2).length;
const prescription = tcmPrescriptionList.value[prescriptionIndex];
if (prescription && prescription.prescriptionList) {
return prescription.prescriptionList.length;
}
return 0;
}
/**
@@ -959,7 +971,9 @@ function handleDelete(pIndex) {
prescription.expandOrder = [];
prescription.isAdding = false;
adviceQueryParams.value.adviceType = undefined;
groupMarkers.value = getGroupMarkers(prescriptionList.value); // 删除行会出现组号混乱的情况,所以这里重新更新标记
// 删除行会出现组号混乱的情况,所以这里重新更新标记
const allPrescriptions = tcmPrescriptionList.value.flatMap(p => p.prescriptionList);
groupMarkers.value = getGroupMarkers(allPrescriptions);
}
@@ -1115,42 +1129,60 @@ function handleSaveSign(row, index) {
function handleSaveBatch() {
let saveList = prescriptionList.value
.filter((item) => {
return item.statusEnum == 1;
})
.map((item, index) => {
return {
...item,
accountId: accountId.value,
conditionId: prescription.conditionId,
encounterDiagnosisId: prescription.encounterDiagnosisId,
conditionDefinitionId: prescription.conditionDefinitionId,
encounterId: props.patientInfo.encounterId,
patientId: props.patientInfo.patientId,
requestId: item.requestId,
groupId: item.groupId ? item.groupId : timestamp.toString(),
chineseHerbsDoseQuantity: prescription.chineseHerbsDoseQuantity,
dbOpType: item.requestId ? '2' : '1',
};
});
// 收集所有需要保存的处方项目
let saveList = [];
// 遍历所有处方
for (const prescription of tcmPrescriptionList.value) {
if (prescription.prescriptionList) {
// 检查处方是否有必填的付数
if (!prescription.chineseHerbsDoseQuantity || prescription.chineseHerbsDoseQuantity == 0) {
proxy.$modal.msgWarning('请输入付数');
return;
}
// 收集该处方下需要保存的项目
const itemsToSave = prescription.prescriptionList
.filter((item) => item.statusEnum == 1)
.map((item, index) => {
return {
...item,
accountId: accountId.value,
conditionId: prescription.conditionId,
encounterDiagnosisId: prescription.encounterDiagnosisId,
conditionDefinitionId: prescription.conditionDefinitionId,
encounterId: props.patientInfo.encounterId,
patientId: props.patientInfo.patientId,
requestId: item.requestId,
groupId: item.groupId ? item.groupId : timestamp.toString(),
chineseHerbsDoseQuantity: prescription.chineseHerbsDoseQuantity,
dbOpType: item.requestId ? '2' : '1',
};
});
// 将项目添加到保存列表
saveList = saveList.concat(itemsToSave);
}
}
// 检查是否有可保存的项目
if (saveList.length == 0) {
proxy.$modal.msgWarning('当前没有可保存医嘱');
return;
}
if (
prescription.chineseHerbsDoseQuantity == undefined ||
prescription.chineseHerbsDoseQuantity == 0
) {
proxy.$modal.msgWarning('请输入付数');
return;
}
// 保存处方
saveTcmAdvice({ adviceSaveList: saveList }).then((res) => {
if (res.code === 200) {
proxy.$modal.msgSuccess('保存成功');
getListInfo(true);
prescription.nextId = 1;
// 重置所有处方的nextId
tcmPrescriptionList.value.forEach(prescription => {
if (prescription.nextId) {
prescription.nextId = 1;
}
});
}
});
}

View File

@@ -362,18 +362,27 @@ const shortcuts = [
// const eprescriptionRef = ref();
onMounted(() => {
getWaitPatient();
getPatientList();
});
getPatientList();
// 获取现诊患者列表
function getPatientList() {
queryParams.value.statusEnum = 2;
console.log('调用getPatientList参数', queryParams.value);
getList(queryParams.value).then((res) => {
patientList.value = res.data.records.map((item) => {
return {
...item,
active: currentEncounterId.value ? item.encounterId == currentEncounterId.value : false,
};
});
console.log('getPatientList返回结果', res);
if (res.data && res.data.records) {
patientList.value = res.data.records.map((item) => {
return {
...item,
active: currentEncounterId.value ? item.encounterId == currentEncounterId.value : false,
};
});
console.log('患者列表数据:', patientList.value);
} else {
console.error('API返回的数据格式不正确', res);
}
}).catch(error => {
console.error('获取患者列表失败:', error);
});
}
function setVisitType(type) {