From a343464d8d11faa00236202792458d8fa9ffdce2 Mon Sep 17 00:00:00 2001
From: wzk <2438381872@qq.com>
Date: Tue, 18 Nov 2025 10:08:46 +0800
Subject: [PATCH] =?UTF-8?q?=E9=97=A8=E8=AF=8A=E5=8C=BB=E7=94=9F=E7=AB=99-?=
=?UTF-8?q?=E3=80=8B=E5=BC=80=E7=AB=8B=E5=8C=BB=E5=98=B1=EF=BC=9A=E5=A2=9E?=
=?UTF-8?q?=E5=8A=A0=E5=A4=87=E6=B3=A8=E5=AD=97=E6=AE=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../prescription/prescriptionlist.vue | 129 ++++++++++++++++--
1 file changed, 115 insertions(+), 14 deletions(-)
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 f4a8f07b..f20e2474 100644
--- a/openhis-ui-vue3/src/views/doctorstation/components/prescription/prescriptionlist.vue
+++ b/openhis-ui-vue3/src/views/doctorstation/components/prescription/prescriptionlist.vue
@@ -279,6 +279,15 @@
/>
+
+
+
+
+
+
+
+
+
总金额:{{ scope.row.totalPrice ? scope.row.totalPrice + ' 元' : '0.00 元' }}
@@ -874,6 +901,13 @@
+
+
+
+ {{ scope.row.remarks || '-' }}
+
+
+
@@ -1171,11 +1205,19 @@ function getListInfo(addNewRow) {
: (item.skinTestFlag !== undefined && item.skinTestFlag !== null
? (typeof item.skinTestFlag === 'number' ? item.skinTestFlag : (item.skinTestFlag ? 1 : 0))
: 0);
+ // 从后端获取数据时,将后端的耗材类型(2)转换为前端显示的耗材类型(4)
+ // 后端接口中:1=药品, 2=耗材, 3=诊疗
+ // 前端显示中:1=西药, 2=中成药, 3=诊疗, 4=耗材
+ let displayAdviceType = parsedContent.adviceType !== undefined ? Number(parsedContent.adviceType) : (item.adviceType !== undefined ? Number(item.adviceType) : undefined);
+ if (displayAdviceType === 2 && (parsedContent.deviceId || parsedContent.deviceName || item.deviceId || item.deviceName)) {
+ // 如果是耗材(adviceType=2 且有deviceId或deviceName),转换为前端显示的4
+ displayAdviceType = 4;
+ }
return {
...parsedContent,
...item,
// 确保adviceType是数字类型,以便正确显示文本
- adviceType: parsedContent.adviceType !== undefined ? Number(parsedContent.adviceType) : (item.adviceType !== undefined ? Number(item.adviceType) : undefined),
+ adviceType: displayAdviceType,
doseQuantity: parsedContent?.doseQuantity,
doseUnitCode_dictText: parsedContent?.doseUnitCode_dictText,
skinTestFlag: skinTestFlag, // 确保皮试字段是数字类型
@@ -1390,8 +1432,22 @@ function selectAdviceBase(key, row) {
// 如果医嘱类型是"全部"(5)或未选择,根据药品的categoryCode自动判断
// drord_doctor_type: 1=西药, 2=中成药, 3=诊疗, 4=耗材, 5=全部
let finalAdviceType = currentAdviceType;
- if ((currentAdviceType === undefined || currentAdviceType === null || currentAdviceType === '' || Number(currentAdviceType) === 5) && Number(row.adviceType) === 1) {
- // 药品类型,需要根据categoryCode判断是西药还是中成药
+
+ // 判断是否是耗材(从耗材目录接口返回的数据,adviceType=2表示耗材)
+ const isConsumablesFromDevice = row.adviceType == 2 && (row.deviceId || row.deviceName);
+
+ // 优先判断:如果用户已选择耗材类型(4),直接使用
+ if (currentAdviceType !== undefined && currentAdviceType !== null && currentAdviceType !== '' && Number(currentAdviceType) === 4) {
+ // 用户已选择耗材类型,直接使用
+ finalAdviceType = 4;
+ } else if (isConsumablesFromDevice) {
+ // 如果是耗材(从耗材目录接口来的数据),设置为4(前端显示的耗材类型)
+ finalAdviceType = 4;
+ } else if (currentAdviceType !== undefined && currentAdviceType !== null && currentAdviceType !== '' && Number(currentAdviceType) !== 5) {
+ // 用户已选择其他医嘱类型(且不是"全部"),保留用户的选择,确保是数字类型
+ finalAdviceType = Number(currentAdviceType);
+ } else if (Number(row.adviceType) === 1) {
+ // 药品类型(adviceType=1),需要根据categoryCode判断是西药还是中成药
// categoryCode = '1' 表示中成药,categoryCode = '2' 表示西药
if (row.categoryCode == '1') {
finalAdviceType = 2; // 中成药
@@ -1401,9 +1457,21 @@ function selectAdviceBase(key, row) {
// 如果没有categoryCode,使用项目默认的类型
finalAdviceType = Number(row.adviceType);
}
- } else if (currentAdviceType !== undefined && currentAdviceType !== null && currentAdviceType !== '' && Number(currentAdviceType) !== 5) {
- // 用户已选择医嘱类型(且不是"全部"),保留用户的选择,确保是数字类型
- finalAdviceType = Number(currentAdviceType);
+ } else if (Number(row.adviceType) === 2) {
+ // 如果 row.adviceType == 2,可能是中成药(药品)或耗材
+ // 优先判断是否是耗材:有 deviceId 或 deviceName
+ if (row.deviceId || row.deviceName) {
+ finalAdviceType = 4; // 耗材
+ } else {
+ // 没有 deviceId 或 deviceName,可能是中成药(药品)
+ // 根据 categoryCode 判断
+ if (row.categoryCode == '1') {
+ finalAdviceType = 2; // 中成药
+ } else {
+ // 默认认为是中成药
+ finalAdviceType = 2;
+ }
+ }
} else {
// 使用项目默认的类型,确保是数字类型
finalAdviceType = Number(row.adviceType);
@@ -1449,7 +1517,11 @@ function selectAdviceBase(key, row) {
).chargeItemDefinitionId;
// 库存列表 + 价格列表拼成批次号的下拉框
- if (row.adviceType != 3) {
+ // 判断是否是耗材(从耗材目录接口返回的数据)
+ const isConsumables = (row.adviceType == 2 && (row.deviceId || row.deviceName)) || finalAdviceType == 4;
+
+ if (row.adviceType != 3 && !isConsumables) {
+ // 药品类型(西药、中成药)需要检查库存
if (row.inventoryList && row.inventoryList.length == 0) {
expandOrder.value = [];
proxy.$modal.msgWarning('该项目无库存');
@@ -1485,12 +1557,23 @@ function selectAdviceBase(key, row) {
.toFixed(2);
prescriptionList.value[rowIndex.value].positionName = stock.locationName;
}
+ } else if (isConsumables) {
+ // 耗材类型:设置价格和位置信息
+ const price = row.price || row.retailPrice || (row.priceList && row.priceList.length > 0 ? row.priceList[0].price : 0);
+ prescriptionList.value[rowIndex.value].unitPrice = price;
+ prescriptionList.value[rowIndex.value].unitTempPrice = price;
+ prescriptionList.value[rowIndex.value].minUnitPrice = price;
+ prescriptionList.value[rowIndex.value].positionId = row.locationId;
+ prescriptionList.value[rowIndex.value].positionName = row.locationId_dictText || row.positionName || '';
+ // 耗材可能没有库存列表,设置为空数组
+ prescriptionList.value[rowIndex.value].stockList = [];
+ prescriptionList.value[rowIndex.value].inventoryList = [];
} else {
- // 执行科室默认逻辑:优先使用诊疗项目维护的所属科室,如果没有则使用开单科室
- const defaultOrgId = row.positionId || props.patientInfo.orgId;
- prescriptionList.value[rowIndex.value].orgId = defaultOrgId;
- prescriptionList.value[rowIndex.value].unitPrice = row.priceList[0].price;
-}
+ // 诊疗类型:执行科室默认逻辑:优先使用诊疗项目维护的所属科室,如果没有则使用开单科室
+ const defaultOrgId = row.positionId || props.patientInfo.orgId;
+ prescriptionList.value[rowIndex.value].orgId = defaultOrgId;
+ prescriptionList.value[rowIndex.value].unitPrice = row.priceList && row.priceList.length > 0 ? row.priceList[0].price : 0;
+ }
// 检查是否是皮试药品,如果是则弹出确认提示
// 只对药品类型(西药和中成药)进行皮试提示
@@ -1538,13 +1621,21 @@ function selectAdviceBase(key, row) {
function expandOrderAndFocus(key, row) {
expandOrder.value = [key];
nextTick(() => {
+ // 判断是否是耗材(adviceType == 4 或从耗材目录来的数据)
+ const isConsumables = row.adviceType == 4 || (row.adviceType == 2 && (row.deviceId || row.deviceName));
+
if (row.adviceType == 1 || row.adviceType == 2) {
+ // 药品类型(西药、中成药)
if (row.injectFlag == 1) {
inputRefs.value['executeNum']?.focus();
} else {
inputRefs.value['doseQuantity']?.focus();
}
+ } else if (isConsumables) {
+ // 耗材类型:类似诊疗,聚焦执行次数输入框
+ inputRefs.value['quantity']?.focus();
} else {
+ // 诊疗类型
inputRefs.value['quantity']?.focus();
}
});
@@ -1668,9 +1759,14 @@ function handleSave() {
// 此处签发处方和单行保存处方传参相同,后台已经将传参存为JSON字符串,此处直接转换为JSON即可
loading.value = true;
let list = saveList.map((item) => {
+ const parsedContent = JSON.parse(item.contentJson);
+ // 保存时,将前端的耗材类型(4)转换为后端需要的类型(2)
+ // 后端接口中:1=药品, 2=耗材, 3=诊疗
+ // 前端显示中:1=西药, 2=中成药, 3=诊疗, 4=耗材
+ const saveAdviceType = parsedContent.adviceType == 4 ? 2 : parsedContent.adviceType;
return {
- ...JSON.parse(item.contentJson),
- adviceType: item.adviceType,
+ ...parsedContent,
+ adviceType: saveAdviceType,
requestId: item.requestId,
dbOpType: '1',
groupId: item.groupId,
@@ -1800,6 +1896,11 @@ function handleSaveSign(row, index) {
if (row.injectFlag == 1) {
row.sortNumber = row.sortNumber ? row.sortNumber : prescriptionList.value.length;
}
+ // 保存时,将前端的耗材类型(4)转换为后端需要的类型(2)
+ // 后端接口中:1=药品, 2=耗材, 3=诊疗
+ // 前端显示中:1=西药, 2=中成药, 3=诊疗, 4=耗材
+ const saveAdviceType = row.adviceType == 4 ? 2 : row.adviceType;
+ row.adviceType = saveAdviceType;
// row.dose = row.doseQuantity;
// row.doseUnitCode = unitCodeList.value.find((item) => item.type == 'dose').value;
// row.doseUnitCode = JSON.parse(JSON.stringify(row.minUnitCode)); // 页面显示与赋值不符,此处先简单处理,后续修改