首页报错和门诊医生站报错
This commit is contained in:
@@ -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;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user