修复门诊医生站->【处方单】按钮,点击【处方单】按钮无响应问题
This commit is contained in:
@@ -594,15 +594,22 @@ function getPrescriptionNoInit() {
|
||||
form.rxTypeCode = props.prescriptionData.rxTypeCode;
|
||||
infoForm.prescriptionNo = props.prescriptionData.prescriptionNo;
|
||||
}
|
||||
console.log(infoForm.prescriptionNo, 'infoForm.prescriptionNo', props.prescriptionData);
|
||||
console.log('infoForm.prescriptionNo (初始值):', infoForm.prescriptionNo, 'props.prescriptionData:', props.prescriptionData);
|
||||
// prescriptionInfo.value = props.prescriptionData;
|
||||
if (title.value === '新增处方') {
|
||||
prescriptionNoInit().then((res) => {
|
||||
infoForm.prescriptionNo = res.data;
|
||||
console.log(props, 'props', res, 'res', 'form', form.value);
|
||||
console.log('处方号初始化成功:', {
|
||||
prescriptionNo: infoForm.prescriptionNo,
|
||||
form: form,
|
||||
medicationInfoListLength: form.medicationInfoList.length
|
||||
});
|
||||
}).catch((error) => {
|
||||
console.error('处方号初始化失败:', error);
|
||||
proxy.$modal.msgError('获取处方号失败,请重试');
|
||||
});
|
||||
}
|
||||
form.medicationInfoList = props.medicationInfo;
|
||||
form.medicationInfoList = props.medicationInfo || [];
|
||||
}
|
||||
|
||||
function getDiagnosisInfo() {
|
||||
@@ -611,13 +618,26 @@ function getDiagnosisInfo() {
|
||||
let diagnosisInfo = diagnosisList.value.filter((item) => {
|
||||
return item.maindiseFlag == 1;
|
||||
});
|
||||
if (diagnosisInfo.length > 0) {
|
||||
diagnosisInfo.value = diagnosisInfo[0];
|
||||
if (title.value === '新增处方') {
|
||||
conditionId.value = diagnosisInfo[0].id;
|
||||
}
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.error('获取诊断信息失败:', error);
|
||||
});
|
||||
|
||||
// 获取慢性病诊断信息,如果医保未连接则静默跳过
|
||||
getChronicDisease({ encounterId: props.patient.encounterId }).then((res) => {
|
||||
speDiagnosisList.value = res.data;
|
||||
speDiagnosisList.value = res.data || [];
|
||||
}).catch((error) => {
|
||||
// 医保未连接时,静默处理,不显示错误信息
|
||||
// 只在开发环境下记录日志,生产环境不输出
|
||||
if (import.meta.env.DEV) {
|
||||
console.debug('获取慢性病诊断信息失败(医保未连接,已静默处理):', error.message);
|
||||
}
|
||||
speDiagnosisList.value = [];
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ function getRowDisabled(row) {
|
||||
* 新增处方按钮操作
|
||||
*/
|
||||
function handleAddPrescription() {
|
||||
console.log('handleAddPrescription新增处方按钮操作', prescriptionNoTemp.value);
|
||||
console.log('新增处方按钮操作 - 打开新增处方弹窗');
|
||||
title.value = '新增处方';
|
||||
openPrescriptionDialog();
|
||||
}
|
||||
|
||||
@@ -3212,7 +3212,54 @@ function getPrescriptionTotalAmount(prescriptionId) {
|
||||
}
|
||||
|
||||
|
||||
defineExpose({ getListInfo, getDiagnosisInfo });
|
||||
/**
|
||||
* 获取已签发的处方单信息(用于处方单预览)
|
||||
* 返回已签发的药品处方单数据(statusEnum == 2 且 adviceType == 1 或 2)
|
||||
*/
|
||||
function getSignedPrescriptionInfo() {
|
||||
const signedPrescriptions = [];
|
||||
|
||||
// 遍历所有处方
|
||||
Object.keys(allPrescriptionsData.value).forEach(prescriptionId => {
|
||||
const prescriptionData = allPrescriptionsData.value[prescriptionId] || [];
|
||||
const prescription = westernPrescriptions.value.find(p => p.id === prescriptionId);
|
||||
|
||||
if (!prescription) return;
|
||||
|
||||
// 筛选已签发的药品(西药和中成药)
|
||||
const signedMedicines = prescriptionData.filter(item =>
|
||||
item.statusEnum === 2 && (item.adviceType === 1 || item.adviceType === 2)
|
||||
);
|
||||
|
||||
if (signedMedicines.length > 0) {
|
||||
// 构建处方单信息
|
||||
const prescriptionInfo = {
|
||||
prescriptionNo: prescription.name || `处方${prescriptionId}`,
|
||||
patientName: props.patientInfo?.patientName || '',
|
||||
requestTime: new Date().toISOString(),
|
||||
conditionDefinitionName: diagnosisName.value || '',
|
||||
prescriptionInfoDetail: signedMedicines.map(item => ({
|
||||
requestId: item.requestId,
|
||||
adviceName: item.adviceName || '',
|
||||
volume: item.volume || '',
|
||||
quantity: item.quantity || '',
|
||||
unitCode_dictText: item.unitCode_dictText || '',
|
||||
lotNumber: item.lotNumber || '',
|
||||
methodCode_dictText: item.methodCode_dictText || '',
|
||||
dose: item.dose || '',
|
||||
doseUnitCode_dictText: item.doseUnitCode_dictText || '',
|
||||
rateCode_dictText: item.rateCode_dictText || ''
|
||||
}))
|
||||
};
|
||||
|
||||
signedPrescriptions.push(prescriptionInfo);
|
||||
}
|
||||
});
|
||||
|
||||
return signedPrescriptions;
|
||||
}
|
||||
|
||||
defineExpose({ getListInfo, getDiagnosisInfo, getSignedPrescriptionInfo });
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -391,12 +391,67 @@ function handleClick(tab) {
|
||||
// }
|
||||
}
|
||||
|
||||
// 查看本次就诊处方单
|
||||
// 查看本次就诊处方单(从医嘱Tab页获取已开立的处方单信息)
|
||||
function getEnPrescription(encounterId) {
|
||||
getEnPrescriptionInfo({ encounterId: encounterId }).then((res) => {
|
||||
prescriptionInfo.value = res.data;
|
||||
// 检查是否有选中的患者
|
||||
if (!patientInfo.value || !patientInfo.value.encounterId) {
|
||||
proxy.$modal.msgWarning('请先选择患者');
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查是否在医嘱Tab页,如果不在则切换到医嘱Tab页
|
||||
if (activeTab.value !== 'prescription') {
|
||||
activeTab.value = 'prescription';
|
||||
// 等待Tab切换完成后再获取数据
|
||||
nextTick(() => {
|
||||
// 确保数据已加载
|
||||
if (prescriptionRef.value) {
|
||||
// 先刷新数据,确保获取最新的处方单信息
|
||||
if (prescriptionRef.value.getListInfo) {
|
||||
prescriptionRef.value.getListInfo(false);
|
||||
}
|
||||
// 等待数据加载完成后再获取处方单信息
|
||||
setTimeout(() => {
|
||||
if (prescriptionRef.value && prescriptionRef.value.getSignedPrescriptionInfo) {
|
||||
const signedPrescriptions = prescriptionRef.value.getSignedPrescriptionInfo();
|
||||
if (signedPrescriptions && signedPrescriptions.length > 0) {
|
||||
prescriptionInfo.value = signedPrescriptions;
|
||||
openPrescriptionDialog.value = true;
|
||||
} else {
|
||||
proxy.$modal.msgWarning('当前患者没有已签发的处方单');
|
||||
}
|
||||
} else {
|
||||
proxy.$modal.msgWarning('无法获取处方单信息,请稍后重试');
|
||||
}
|
||||
}, 300);
|
||||
} else {
|
||||
proxy.$modal.msgWarning('无法获取处方单信息,请稍后重试');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 如果已经在医嘱Tab页,先刷新数据再获取
|
||||
if (prescriptionRef.value) {
|
||||
if (prescriptionRef.value.getListInfo) {
|
||||
prescriptionRef.value.getListInfo(false);
|
||||
}
|
||||
// 等待数据加载完成后再获取处方单信息
|
||||
setTimeout(() => {
|
||||
if (prescriptionRef.value && prescriptionRef.value.getSignedPrescriptionInfo) {
|
||||
const signedPrescriptions = prescriptionRef.value.getSignedPrescriptionInfo();
|
||||
if (signedPrescriptions && signedPrescriptions.length > 0) {
|
||||
prescriptionInfo.value = signedPrescriptions;
|
||||
openPrescriptionDialog.value = true;
|
||||
} else {
|
||||
proxy.$modal.msgWarning('当前患者没有已签发的处方单');
|
||||
}
|
||||
} else {
|
||||
proxy.$modal.msgWarning('无法获取处方单信息,请稍后重试');
|
||||
}
|
||||
}, 300);
|
||||
} else {
|
||||
proxy.$modal.msgWarning('无法获取处方单信息,请稍后重试');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleRefund(encounterId) {
|
||||
|
||||
Reference in New Issue
Block a user