333 门诊医生站开立耗材医嘱时,类型误转为“中成药”且保存报错

341 门诊挂号报错
This commit is contained in:
Ranyunqiao
2026-04-07 10:33:04 +08:00
parent 5c8bfbc98b
commit d2dfc714ec
3 changed files with 109 additions and 22 deletions

View File

@@ -59,7 +59,7 @@
T9.gender_enum AS genderEnum,
T9.id_card AS idCard,
T9.status_enum AS statusEnum,
T9.register_time AS registerTime,
T9.register_time AS register_time,
T9.total_price AS totalPrice,
T9.account_name AS accountName,
T9.enterer_name AS entererName,
@@ -84,7 +84,7 @@
T8.gender_enum AS gender_enum,
T8.id_card AS id_card,
T1.status_enum AS status_enum,
T1.create_time AS registerTime,
T1.create_time AS register_time,
T10.total_price,
T11."name" AS account_name,
T12."name" AS enterer_name,
@@ -178,7 +178,7 @@
AND T10.context_enum = #{register}
) AS T9
${ew.customSqlSegment}
ORDER BY T9.registerTime DESC
ORDER BY T9.register_time DESC
</select>
<select id="getTmpActivityList" resultType="com.openhis.web.personalization.dto.ActivityDeviceDto">

View File

@@ -257,15 +257,16 @@ function fetchFromApi(searchKey) {
searchKey: searchKey || '',
statusEnum: 2,
}).then((res) => {
console.log('[Debug] 耗材列表返回数据:', res.data);
console.log('[BugFix] 耗材列表返回数据:', res.data);
if (res.data && res.data.records) {
adviceBaseList.value = res.data.records.map((item) => {
console.log('[Debug] 耗材项:', item.name, 'price:', item.price, 'retailPrice:', item.retailPrice);
return {
console.log('[BugFix] 耗材项:', item.name, 'price:', item.price, 'retailPrice:', item.retailPrice);
const mappedItem = {
...item,
// 🔧 Bug Fix: 强制覆盖后端返回的字段,确保数据正确
adviceName: item.name || item.busNo,
adviceType: 4, // 强制设置为前端耗材类型
adviceType_dictText: '耗材', // 🔧 Bug Fix: 设置医嘱类型显示文本
adviceTableName: 'adm_device_definition',
unitCode: item.unitCode || '',
unitCode_dictText: item.unitCode_dictText || '',
@@ -299,6 +300,8 @@ function fetchFromApi(searchKey) {
? [{ price: item.price }]
: []),
};
console.log('[BugFix] 映射后的耗材项:', mappedItem.adviceName, 'adviceType:', mappedItem.adviceType, 'adviceType_dictText:', mappedItem.adviceType_dictText);
return mappedItem;
});
nextTick(() => {
currentIndex.value = 0;

View File

@@ -223,7 +223,12 @@
style="width: 70px; margin-right: 20px" />
</el-form-item>
<span class="medicine-info"> 诊断{{ diagnosisName }} </span>
<span class="medicine-info"> 皮试{{ scope.row.skinTestFlag_enumText }} </span>
<span class="medicine-info" style="display: flex; align-items: center; gap: 5px;">
皮试<el-checkbox v-model="scope.row.skinTestFlag" :true-value="1" :false-value="0"
@change="handleSkinTestChange(scope.row, scope.$index)">
</el-checkbox>
</span>
<span class="medicine-info"> 注射药品{{ scope.row.injectFlag_enumText }} </span>
<span class="total-amount">
总金额{{
@@ -470,6 +475,12 @@
</template>
</el-select>
</el-form-item>
<span class="medicine-info" style="display: flex; align-items: center; gap: 5px;">
皮试:<el-checkbox v-model="scope.row.skinTestFlag" :true-value="1" :false-value="0"
@change="handleSkinTestChange(scope.row, scope.$index)">
</el-checkbox>
</span>
<span class="total-amount">
总金额:{{
(scope.row.totalPrice !== undefined && scope.row.totalPrice !== null && !isNaN(scope.row.totalPrice)
@@ -761,7 +772,13 @@
</el-table-column>
<el-table-column label="皮试" align="center" prop="" width="80">
<template #default="scope">
<span v-if="!scope.row.isEdit">
<template v-if="scope.row.isEdit">
<el-checkbox v-model="scope.row.skinTestFlag" :true-value="1" :false-value="0"
@change="handleSkinTestChange(scope.row, scope.$index)">
</el-checkbox>
</template>
<span v-else>
{{ scope.row.skinTestFlag_enumText || '-' }}
</span>
</template>
@@ -1908,6 +1925,34 @@ const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
* 选择药品回调
*/
function selectAdviceBase(key, row) {
// 🔧 Bug Fix: 检查药品是否需要皮试,如果需要则弹出确认框
if (row.skinTestFlag == 1) {
ElMessageBox.confirm(`药品:${row.adviceName}需要做皮试,是否做皮试?`, '提示', {
confirmButtonText: '是',
cancelButtonText: '否',
type: 'warning',
center: true,
customClass: 'skin-test-confirm-dialog',
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
// 用户点击右边的按钮confirm保持皮试标记为1
setNewRow(key, row);
done();
} else if (action === 'cancel') {
// 用户点击左边的按钮cancel将皮试标记改为0
row.skinTestFlag = 0;
row.skinTestFlag_enumText = '否';
setNewRow(key, row);
done();
} else {
done();
}
}
});
return;
}
// 检查检查检验项目是否有历史记录30天内
if (row.categoryCode == 22 || row.categoryCode == 23) {
checkServicesHistory({
patientId: props.patientInfo.patientId,
@@ -1930,6 +1975,7 @@ function selectAdviceBase(key, row) {
}
async function setNewRow(key, row) {
console.log('[BugFix] setNewRow - row.adviceType:', row.adviceType, 'row.adviceType_dictText:', row.adviceType_dictText, 'row.adviceTableName:', row.adviceTableName);
// 每次选择药品时,将当前行数据完全重置,清空所有旧数据
const preservedData = {
uniqueKey: prescriptionList.value[rowIndex.value].uniqueKey,
@@ -1943,6 +1989,8 @@ function selectAdviceBase(key, row) {
setValue(row);
console.log('[BugFix] setNewRow after setValue - prescriptionList[rowIndex].adviceType:', prescriptionList.value[rowIndex.value].adviceType, 'adviceType_dictText:', prescriptionList.value[rowIndex.value].adviceType_dictText);
// 🔧 Bug #220 修复确保在setValue之后重新计算耗材类型的总金额
// 耗材(adviceType=4)和诊疗(adviceType=3)需要重新计算以确保显示正确
const currentRow = prescriptionList.value[rowIndex.value];
@@ -3067,10 +3115,8 @@ function handleSaveBatch(prescriptionId) {
// 🔧 Bug Fix: 处理accountId如果是'ZIFEI'或0则转为null让后端查询默认账户
let itemAccountId = finalAccountId;
if (itemAccountId === 'ZIFEI' || itemAccountId === 0) {
if (itemAccountId === 'ZIFEI' || itemAccountId === 0 || itemAccountId === '0') {
itemAccountId = null;
} else if (itemAccountId && !isNaN(Number(itemAccountId))) {
itemAccountId = Number(itemAccountId);
}
// 🔧 Bug Fix: 确保库存匹配成功的关键字段
@@ -3117,7 +3163,11 @@ function handleSaveBatch(prescriptionId) {
accountId: itemAccountId,
// 🔧 Bug Fix: 确保库存匹配成功
adviceTableName: adviceTableNameVal,
locationId: locationIdVal
locationId: locationIdVal,
// 🔧 Bug Fix: 确保 minUnitQuantity、minUnitCode 等字段被传递(药品必填字段)
minUnitQuantity: item.minUnitQuantity,
minUnitCode: item.minUnitCode,
minUnitCode_dictText: item.minUnitCode_dictText
};
});
// --- 【修改结束】 ---
@@ -3279,10 +3329,13 @@ function setValue(row) {
: 0;
// 创建一个新的对象,而不是合并旧数据,以避免残留数据问题
console.log('[BugFix] setValue - row.adviceType:', row.adviceType, 'row.adviceType_dictText:', row.adviceType_dictText, 'row.adviceTableName:', row.adviceTableName);
prescriptionList.value[rowIndex.value] = {
...JSON.parse(JSON.stringify(row)),
// 确保adviceType为数字类型避免类型不匹配导致的显示问题
adviceType: Number(row.adviceType),
// 🔧 Bug Fix: 确保adviceType_dictText被正确设置避免展开行时显示错误
adviceType_dictText: row.adviceType_dictText || mapAdviceTypeLabel(row.adviceType, row.adviceTableName),
skinTestFlag: skinTestFlag, // 确保皮试字段是数字类型
skinTestFlag_enumText: skinTestFlag == 1 ? '是' : '否', // 更新显示文本
// 保留原来设置的初始状态值
@@ -3291,6 +3344,7 @@ function setValue(row) {
statusEnum: prescriptionList.value[rowIndex.value].statusEnum,
showPopover: false, // 确保查询框关闭
};
console.log('[BugFix] setValue - prescriptionList[rowIndex].adviceType_dictText:', prescriptionList.value[rowIndex.value].adviceType_dictText);
// 🔧 Bug #218 修复保留组套中的值不要强制设为undefined
// 只有当值未定义时才使用默认值
prescriptionList.value[rowIndex.value].orgId = row.positionId || row.orgId;
@@ -4511,6 +4565,36 @@ function handleOrderSetSaved() {
defineExpose({ getListInfo, getDiagnosisInfo });
</script>
<style lang="scss">
/* 皮试确认弹窗全局样式 - 反转按钮顺序,左边是是,右边是否 */
.skin-test-confirm-dialog.el-message-box {
.el-message-box__btns {
display: flex !important;
flex-direction: row-reverse !important;
justify-content: center !important;
.el-button {
margin-left: 10px !important;
margin-right: 10px !important;
}
}
}
/* 如果自定义类名不生效,使用更强的选择器 */
.el-message-box.skin-test-confirm-dialog {
.el-message-box__btns {
display: flex !important;
flex-direction: row-reverse !important;
justify-content: center !important;
.el-button {
margin-left: 10px !important;
margin-right: 10px !important;
}
}
}
</style>
<style lang="scss" scoped>
:deep(.el-table__expand-icon) {
display: none !important;