220 门诊医生站:新增耗材收费项目医嘱单价/总金额未显示正确的值
This commit is contained in:
@@ -143,8 +143,8 @@ watch(
|
|||||||
() => props.adviceQueryParams,
|
() => props.adviceQueryParams,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
queryParams.value.searchKey = newValue.searchKey;
|
queryParams.value.searchKey = newValue.searchKey;
|
||||||
if (newValue.adviceType) {
|
if (newValue.adviceTypes) {
|
||||||
queryParams.value.adviceTypes = [newValue.adviceType].join(',');
|
queryParams.value.adviceTypes = [newValue.adviceTypes].join(',');
|
||||||
} else {
|
} else {
|
||||||
queryParams.value.adviceTypes = '1,2,3';
|
queryParams.value.adviceTypes = '1,2,3';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,12 +191,18 @@
|
|||||||
<template v-if="scope.row.adviceType == 1">
|
<template v-if="scope.row.adviceType == 1">
|
||||||
<div style="display: flex; align-items: center; margin-bottom: 16px; gap: 16px">
|
<div style="display: flex; align-items: center; margin-bottom: 16px; gap: 16px">
|
||||||
<span class="medicine-title">
|
<span class="medicine-title">
|
||||||
{{ scope.row.adviceName }} {{ scope.row.volume }}
|
{{
|
||||||
<template v-if="scope.row.partPercent !== null && scope.row.partPercent !== undefined && scope.row.partPercent - 1 > 0">
|
scope.row.adviceName +
|
||||||
[1{{ scope.row.unitCode_dictText }}={{ scope.row.partPercent }}{{ scope.row.minUnitCode_dictText }}]
|
' ' +
|
||||||
</template>
|
scope.row.volume +
|
||||||
[{{ (scope.row.unitPrice !== undefined && scope.row.unitPrice !== null && !isNaN(scope.row.unitPrice) &&
|
' [' +
|
||||||
isFinite(scope.row.unitPrice)) ? Number(scope.row.unitPrice).toFixed(2) : '-' }} 元/{{ scope.row.unitCode_dictText }}]
|
(scope.row.unitPrice !== undefined && scope.row.unitPrice !== null && !isNaN(scope.row.unitPrice) &&
|
||||||
|
isFinite(scope.row.unitPrice) ? Number(scope.row.unitPrice).toFixed(2) : '-') +
|
||||||
|
' 元' +
|
||||||
|
'/' +
|
||||||
|
scope.row.unitCode_dictText +
|
||||||
|
']'
|
||||||
|
}}
|
||||||
</span>
|
</span>
|
||||||
<el-form-item prop="lotNumber" label="药房:">
|
<el-form-item prop="lotNumber" label="药房:">
|
||||||
<el-select v-model="scope.row.inventoryId" style="width: 330px; margin-right: 20px"
|
<el-select v-model="scope.row.inventoryId" style="width: 330px; margin-right: 20px"
|
||||||
@@ -261,7 +267,6 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<el-form-item label="给药途径:" prop="methodCode" class="required-field" data-prop="methodCode">
|
<el-form-item label="给药途径:" prop="methodCode" class="required-field" data-prop="methodCode">
|
||||||
<el-select v-model="scope.row.methodCode" placeholder="给药途径" clearable filterable
|
<el-select v-model="scope.row.methodCode" placeholder="给药途径" clearable filterable
|
||||||
style="width: 150px"
|
|
||||||
:ref="(el) => (inputRefs.methodCode = el)" @keyup.enter.prevent="
|
:ref="(el) => (inputRefs.methodCode = el)" @keyup.enter.prevent="
|
||||||
() => {
|
() => {
|
||||||
if (scope.row.methodCode) {
|
if (scope.row.methodCode) {
|
||||||
@@ -284,9 +289,7 @@
|
|||||||
}
|
}
|
||||||
// inputRefs.rateCode.blur();
|
// inputRefs.rateCode.blur();
|
||||||
}
|
}
|
||||||
"
|
" :ref="(el) => (inputRefs.rateCode = el)">
|
||||||
@change="calculateTotalAmount(scope.row, scope.$index)"
|
|
||||||
:ref="(el) => (inputRefs.rateCode = el)">
|
|
||||||
<el-option v-for="dict in rate_code" @click="() => (scope.row.rateCode_dictText = dict.label)"
|
<el-option v-for="dict in rate_code" @click="() => (scope.row.rateCode_dictText = dict.label)"
|
||||||
:key="dict.value" :label="dict.label" :value="dict.value" />
|
:key="dict.value" :label="dict.label" :value="dict.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
@@ -307,10 +310,7 @@
|
|||||||
controls-position="right" :controls="false" :ref="(el) => (inputRefs.dispensePerDuration = el)"
|
controls-position="right" :controls="false" :ref="(el) => (inputRefs.dispensePerDuration = el)"
|
||||||
@keyup.enter.prevent="
|
@keyup.enter.prevent="
|
||||||
handleEnter('dispensePerDuration', scope.row, scope.$index)
|
handleEnter('dispensePerDuration', scope.row, scope.$index)
|
||||||
"
|
">
|
||||||
@change="calculateTotalAmount(scope.row, scope.$index)"
|
|
||||||
@blur="calculateTotalAmount(scope.row, scope.$index)"
|
|
||||||
@input="calculateTotalAmount(scope.row, scope.$index)">
|
|
||||||
<template #suffix>天</template>
|
<template #suffix>天</template>
|
||||||
</el-input-number>
|
</el-input-number>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -321,8 +321,8 @@
|
|||||||
@keyup.enter.prevent="handleEnter('quantity', scope.row, scope.$index)"
|
@keyup.enter.prevent="handleEnter('quantity', scope.row, scope.$index)"
|
||||||
@input="calculateTotalPrice(scope.row, scope.$index)" />
|
@input="calculateTotalPrice(scope.row, scope.$index)" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item style="margin-left: -10px;">
|
<el-form-item>
|
||||||
<el-select v-model="scope.row.unitCode" style="width: 70px; margin-right: 10px" placeholder=" "
|
<el-select v-model="scope.row.unitCode" style="width: 70px; margin-right: 20px" placeholder=" "
|
||||||
@change="calculateTotalAmount(scope.row, scope.$index)">
|
@change="calculateTotalAmount(scope.row, scope.$index)">
|
||||||
<template v-for="item in scope.row.unitCodeList" :key="item.value">
|
<template v-for="item in scope.row.unitCodeList" :key="item.value">
|
||||||
<el-option v-if="checkUnit(item, scope.row)" :value="item.value" :label="item.label" @click="
|
<el-option v-if="checkUnit(item, scope.row)" :value="item.value" :label="item.label" @click="
|
||||||
@@ -342,13 +342,7 @@
|
|||||||
" />
|
" />
|
||||||
</template>
|
</template>
|
||||||
</el-select>
|
</el-select>
|
||||||
<span v-if="scope.row.unitCode_dictText" class="unit-text">{{ scope.row.unitCode_dictText }}</span>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- 🔧 Bug #273 拆零比提示 -->
|
|
||||||
<span v-if="scope.row.partPercent !== null && scope.row.partPercent !== undefined && scope.row.partPercent - 1 > 0 && scope.row.unitCode !== scope.row.minUnitCode"
|
|
||||||
class="part-percent-hint">
|
|
||||||
{{ scope.row.partPercent }}<template v-if="scope.row.minUnitCode_dictText">{{ scope.row.minUnitCode_dictText }}</template><template v-else>袋</template>/<template v-if="scope.row.unitCode_dictText">{{ scope.row.unitCode_dictText }}</template><template v-else>盒</template>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="
|
<div style="
|
||||||
@@ -687,6 +681,7 @@
|
|||||||
style="width: 60px"
|
style="width: 60px"
|
||||||
size="small"
|
size="small"
|
||||||
@change="calculateTotalPrice(scope.row, scope.$index)"
|
@change="calculateTotalPrice(scope.row, scope.$index)"
|
||||||
|
@input="calculateTotalPrice(scope.row, scope.$index)"
|
||||||
/>
|
/>
|
||||||
<span style="margin-left: 4px">{{ scope.row.unitCode_dictText }}</span>
|
<span style="margin-left: 4px">{{ scope.row.unitCode_dictText }}</span>
|
||||||
</template>
|
</template>
|
||||||
@@ -734,7 +729,7 @@
|
|||||||
size="small"
|
size="small"
|
||||||
/>
|
/>
|
||||||
<span style="margin: 0 2px; font-size: 12px;">天</span>
|
<span style="margin: 0 2px; font-size: 12px;">天</span>
|
||||||
<el-select v-model="scope.row.methodCode" size="small" style="width: 120px" placeholder="用法">
|
<el-select v-model="scope.row.methodCode" size="small" style="width: 65px" placeholder="用法">
|
||||||
<el-option v-for="item in method_code" :key="item.value" :label="item.label" :value="item.value" />
|
<el-option v-for="item in method_code" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
@@ -957,32 +952,6 @@ const { method_code, unit_code, rate_code, distribution_category_code, drord_doc
|
|||||||
'drord_doctor_type'
|
'drord_doctor_type'
|
||||||
);
|
);
|
||||||
|
|
||||||
// 格式化价格显示
|
|
||||||
function formatPrice(price, suffix = ' 元', defaultValue = '-') {
|
|
||||||
if (price !== undefined && price !== null && !isNaN(price) && isFinite(price)) {
|
|
||||||
return Number(price).toFixed(2) + suffix;
|
|
||||||
}
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 格式化价格(用于编辑状态,不带单位)
|
|
||||||
function formatPriceEdit(price) {
|
|
||||||
if (price !== undefined && price !== null && !isNaN(price) && isFinite(price)) {
|
|
||||||
return Number(price).toFixed(2);
|
|
||||||
}
|
|
||||||
return '0.00';
|
|
||||||
}
|
|
||||||
|
|
||||||
// 格式化剂量显示
|
|
||||||
function formatDose(dose, unitText) {
|
|
||||||
return dose ? dose + ' ' + (unitText || '') : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// 格式化数量显示
|
|
||||||
function formatQuantity(quantity, unitText) {
|
|
||||||
return quantity ? quantity + ' ' + (unitText || '') : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除硬编码的adviceTypeList,直接使用drord_doctor_type字典
|
// 删除硬编码的adviceTypeList,直接使用drord_doctor_type字典
|
||||||
// drord_doctor_type: 1=西药, 2=中成药, 3=诊疗, 4=耗材, 5=会诊, 6=全部
|
// drord_doctor_type: 1=西药, 2=中成药, 3=诊疗, 4=耗材, 5=会诊, 6=全部
|
||||||
const adviceTypeList = ref([
|
const adviceTypeList = ref([
|
||||||
@@ -1614,11 +1583,6 @@ function getListInfo(addNewRow) {
|
|||||||
console.log('BugFix#219: 过滤掉已作废的会诊医嘱, requestId=', item.requestId);
|
console.log('BugFix#219: 过滤掉已作废的会诊医嘱, requestId=', item.requestId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 🔧 Bug Fix: 过滤掉项目名称为空的无效医嘱
|
|
||||||
if (!item.adviceName || item.adviceName.trim() === '') {
|
|
||||||
console.log('BugFix: 过滤掉空白医嘱, requestId=', item.requestId, 'adviceType=', item.adviceType);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2062,7 +2026,6 @@ function handleDelete() {
|
|||||||
adviceType: item.adviceType,
|
adviceType: item.adviceType,
|
||||||
statusEnum: item.statusEnum,
|
statusEnum: item.statusEnum,
|
||||||
requestId: item.requestId,
|
requestId: item.requestId,
|
||||||
adviceName: item.adviceName
|
|
||||||
})));
|
})));
|
||||||
|
|
||||||
// 🔧 BugFix: 放宽条件,只要有requestId的会诊医嘱都可以尝试删除
|
// 🔧 BugFix: 放宽条件,只要有requestId的会诊医嘱都可以尝试删除
|
||||||
@@ -2167,18 +2130,13 @@ function handleDelete() {
|
|||||||
adviceType: item.adviceType,
|
adviceType: item.adviceType,
|
||||||
statusEnum: item.statusEnum,
|
statusEnum: item.statusEnum,
|
||||||
requestId: item.requestId,
|
requestId: item.requestId,
|
||||||
adviceName: item.adviceName,
|
|
||||||
uniqueKey: item.uniqueKey
|
uniqueKey: item.uniqueKey
|
||||||
})));
|
})));
|
||||||
|
|
||||||
console.log('BugFix#219: prescriptionList 中的所有医嘱=', prescriptionList.value.map(item => ({
|
console.log('BugFix#219: prescriptionList 中的所有医嘱=', prescriptionList.value.map(item => ({
|
||||||
adviceType: item.adviceType,
|
adviceType: item.adviceType,
|
||||||
statusEnum: item.statusEnum,
|
statusEnum: item.statusEnum,
|
||||||
adviceName: item.adviceName,
|
uniqueKey: item.uniqueKey
|
||||||
uniqueKey: item.uniqueKey,
|
|
||||||
totalPrice: item.totalPrice,
|
|
||||||
dose: item.dose,
|
|
||||||
doseQuantity: item.doseQuantity
|
|
||||||
})));
|
})));
|
||||||
|
|
||||||
for (let i = prescriptionList.value.length - 1; i >= 0; i--) {
|
for (let i = prescriptionList.value.length - 1; i >= 0; i--) {
|
||||||
@@ -2367,10 +2325,14 @@ function handleSave(prescriptionId) {
|
|||||||
|
|
||||||
// 签发核心逻辑
|
// 签发核心逻辑
|
||||||
function executeSaveLogic() {
|
function executeSaveLogic() {
|
||||||
// 🔧 Bug Fix: 获取当前选中的费用性质,保持字符串类型避免大整数精度丢失
|
// 🔧 Bug Fix: 获取当前选中的费用性质,如果是'ZIFEI'或0则转为null,让后端查询默认账户
|
||||||
let finalAccountId = accountId.value;
|
let finalAccountId = accountId.value;
|
||||||
if (finalAccountId === 'ZIFEI' || finalAccountId === 0) {
|
if (finalAccountId === 'ZIFEI' || finalAccountId === 0) {
|
||||||
finalAccountId = null;
|
finalAccountId = null;
|
||||||
|
} else if (finalAccountId && !isNaN(Number(finalAccountId))) {
|
||||||
|
finalAccountId = Number(finalAccountId);
|
||||||
|
} else {
|
||||||
|
finalAccountId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 🔧 Bug Fix: 校验患者信息完整性
|
// 🔧 Bug Fix: 校验患者信息完整性
|
||||||
@@ -2383,7 +2345,11 @@ function handleSave(prescriptionId) {
|
|||||||
saveList.forEach((item) => {
|
saveList.forEach((item) => {
|
||||||
item.patientId = props.patientInfo.patientId;
|
item.patientId = props.patientInfo.patientId;
|
||||||
item.encounterId = props.patientInfo.encounterId;
|
item.encounterId = props.patientInfo.encounterId;
|
||||||
item.accountId = finalAccountId;
|
// 🔧 使用项目自己的 accountId,而不是全局的 finalAccountId
|
||||||
|
// 这样自动带出的耗材才能保持与药品相同的账户
|
||||||
|
if (!item.accountId) {
|
||||||
|
item.accountId = finalAccountId;
|
||||||
|
}
|
||||||
item.dbOpType = '1';
|
item.dbOpType = '1';
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2393,7 +2359,7 @@ function handleSave(prescriptionId) {
|
|||||||
// 先解析contentJson
|
// 先解析contentJson
|
||||||
let parsedContent = JSON.parse(item.contentJson || '{}');
|
let parsedContent = JSON.parse(item.contentJson || '{}');
|
||||||
// 🔧 Bug Fix: 强制将accountId设为正确的值
|
// 🔧 Bug Fix: 强制将accountId设为正确的值
|
||||||
parsedContent.accountId = finalAccountId;
|
parsedContent.accountId = item.accountId || finalAccountId; // 🔧 使用 item 自己的 accountId
|
||||||
|
|
||||||
// --- 【修改点2:Bug 2 修复 (单位换算)】 ---
|
// --- 【修改点2:Bug 2 修复 (单位换算)】 ---
|
||||||
let finalQuantity = item.quantity;
|
let finalQuantity = item.quantity;
|
||||||
@@ -2443,7 +2409,6 @@ function handleSave(prescriptionId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log('保存医嘱参数:', {
|
console.log('保存医嘱参数:', {
|
||||||
adviceName: item.adviceName,
|
|
||||||
adviceType: item.adviceType,
|
adviceType: item.adviceType,
|
||||||
saveAdviceType: saveAdviceType,
|
saveAdviceType: saveAdviceType,
|
||||||
adviceTableName: adviceTableNameVal,
|
adviceTableName: adviceTableNameVal,
|
||||||
@@ -2467,15 +2432,28 @@ function handleSave(prescriptionId) {
|
|||||||
adviceTableName: adviceTableNameVal,
|
adviceTableName: adviceTableNameVal,
|
||||||
locationId: locationIdVal,
|
locationId: locationIdVal,
|
||||||
// 🔧 确保 methodCode 被传递(用于触发耗材绑定逻辑)
|
// 🔧 确保 methodCode 被传递(用于触发耗材绑定逻辑)
|
||||||
methodCode: item.methodCode || parsedContent.methodCode
|
methodCode: item.methodCode || parsedContent.methodCode,
|
||||||
|
// 🔧 确保 accountId 被传递(用于预结算)
|
||||||
|
accountId: item.accountId || parsedContent.accountId,
|
||||||
|
// 🔧 更新 contentJson 中的 adviceType,确保后端分类正确
|
||||||
|
contentJson: JSON.stringify({
|
||||||
|
...parsedContent,
|
||||||
|
adviceType: saveAdviceType
|
||||||
|
})
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// 提交签发请求
|
// 提交签发请求
|
||||||
isSaving.value = true;
|
isSaving.value = true;
|
||||||
console.log('签发处方参数:', {
|
console.log('organizationId:', props.patientInfo.orgId);
|
||||||
organizationId: props.patientInfo.orgId,
|
console.log('adviceSaveList:', list);
|
||||||
adviceSaveList: list,
|
list.forEach((item, idx) => {
|
||||||
|
console.log(`项目${idx + 1}:`, {
|
||||||
|
adviceName: item.adviceName,
|
||||||
|
adviceType: item.adviceType,
|
||||||
|
accountId: item.accountId,
|
||||||
|
methodCode: item.methodCode
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
savePrescriptionSign({
|
savePrescriptionSign({
|
||||||
@@ -2628,7 +2606,8 @@ function handleOrderBindInfo(bindIdInfo, currentMethodCode) {
|
|||||||
uniqueKey: nextId.value++,
|
uniqueKey: nextId.value++,
|
||||||
patientId: props.patientInfo.patientId,
|
patientId: props.patientInfo.patientId,
|
||||||
encounterId: props.patientInfo.encounterId,
|
encounterId: props.patientInfo.encounterId,
|
||||||
accountId: accountId.value,
|
accountId: accountId.value, // 🔧 使用当前全局的 accountId
|
||||||
|
requestId: undefined, // 🔧 耗材的 requestId 设为 undefined,让后端自动生成
|
||||||
quantity: item.quantity,
|
quantity: item.quantity,
|
||||||
methodCode: item.methodCode, // 🔧 现在 item.methodCode 有值了
|
methodCode: item.methodCode, // 🔧 现在 item.methodCode 有值了
|
||||||
rateCode: item.rateCode,
|
rateCode: item.rateCode,
|
||||||
@@ -2639,7 +2618,7 @@ function handleOrderBindInfo(bindIdInfo, currentMethodCode) {
|
|||||||
unitCode: item.unitCode,
|
unitCode: item.unitCode,
|
||||||
unitCode_dictText: item.unitCodeName || '',
|
unitCode_dictText: item.unitCodeName || '',
|
||||||
statusEnum: 1,
|
statusEnum: 1,
|
||||||
dbOpType: prescriptionList.value[rowIndex.value].requestId ? '2' : '1',
|
dbOpType: '1', // 🔧 新耗材总是 INSERT
|
||||||
conditionId: conditionId.value,
|
conditionId: conditionId.value,
|
||||||
conditionDefinitionId: conditionDefinitionId.value,
|
conditionDefinitionId: conditionDefinitionId.value,
|
||||||
encounterDiagnosisId: encounterDiagnosisId.value,
|
encounterDiagnosisId: encounterDiagnosisId.value,
|
||||||
@@ -2908,10 +2887,11 @@ function handleSaveBatch(prescriptionId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 🔧 Bug Fix: 在保存时才转换 accountId
|
// 🔧 Bug Fix: 在保存时才转换 accountId
|
||||||
// 保持为字符串类型,避免 JavaScript 大整数精度丢失问题
|
|
||||||
let finalAccountId = accountId.value;
|
let finalAccountId = accountId.value;
|
||||||
if (finalAccountId === 'ZIFEI' || finalAccountId === 0) {
|
if (finalAccountId === 'ZIFEI') {
|
||||||
finalAccountId = null;
|
finalAccountId = null;
|
||||||
|
} else if (finalAccountId && !isNaN(Number(finalAccountId))) {
|
||||||
|
finalAccountId = Number(finalAccountId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新到处方对象
|
// 更新到处方对象
|
||||||
@@ -2993,10 +2973,12 @@ function handleSaveBatch(prescriptionId) {
|
|||||||
};
|
};
|
||||||
const contentJson = JSON.stringify(itemToSave);
|
const contentJson = JSON.stringify(itemToSave);
|
||||||
|
|
||||||
// 🔧 Bug Fix: 处理accountId,保持字符串类型避免大整数精度丢失
|
// 🔧 Bug Fix: 处理accountId,如果是'ZIFEI'或0则转为null,让后端查询默认账户
|
||||||
let itemAccountId = finalAccountId;
|
let itemAccountId = finalAccountId;
|
||||||
if (itemAccountId === 'ZIFEI' || itemAccountId === 0) {
|
if (itemAccountId === 'ZIFEI' || itemAccountId === 0) {
|
||||||
itemAccountId = null;
|
itemAccountId = null;
|
||||||
|
} else if (itemAccountId && !isNaN(Number(itemAccountId))) {
|
||||||
|
itemAccountId = Number(itemAccountId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 🔧 Bug Fix: 确保库存匹配成功的关键字段
|
// 🔧 Bug Fix: 确保库存匹配成功的关键字段
|
||||||
@@ -3170,12 +3152,6 @@ function syncGroupFields(row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setValue(row) {
|
function setValue(row) {
|
||||||
// 🔧 Bug Fix: 强制设置耗材类型,确保 adviceType 为 4
|
|
||||||
// 如果 adviceTableName 是 adm_device_definition,强制设为耗材类型
|
|
||||||
if (row.adviceTableName === 'adm_device_definition') {
|
|
||||||
row.adviceType = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
unitCodeList.value = [];
|
unitCodeList.value = [];
|
||||||
unitCodeList.value.push({ value: row.unitCode, label: row.unitCode_dictText, type: 'unit' });
|
unitCodeList.value.push({ value: row.unitCode, label: row.unitCode_dictText, type: 'unit' });
|
||||||
unitCodeList.value.push({
|
unitCodeList.value.push({
|
||||||
@@ -3548,7 +3524,6 @@ function handleSingOut() {
|
|||||||
let selectRows = prescriptionRef.value.getSelectionRows();
|
let selectRows = prescriptionRef.value.getSelectionRows();
|
||||||
console.log('BugFix#219: handleSingOut called, selectRows=', selectRows);
|
console.log('BugFix#219: handleSingOut called, selectRows=', selectRows);
|
||||||
console.log('BugFix#219: 选中行详情:', selectRows.map(item => ({
|
console.log('BugFix#219: 选中行详情:', selectRows.map(item => ({
|
||||||
adviceName: item.adviceName,
|
|
||||||
adviceType: item.adviceType,
|
adviceType: item.adviceType,
|
||||||
statusEnum: item.statusEnum,
|
statusEnum: item.statusEnum,
|
||||||
statusEnumType: typeof item.statusEnum,
|
statusEnumType: typeof item.statusEnum,
|
||||||
@@ -3566,7 +3541,6 @@ function handleSingOut() {
|
|||||||
|
|
||||||
console.log('BugFix#219: consultationRows=', consultationRows.length, 'normalRows=', normalRows.length);
|
console.log('BugFix#219: consultationRows=', consultationRows.length, 'normalRows=', normalRows.length);
|
||||||
console.log('BugFix#219: normalRows详情:', normalRows.map(item => ({
|
console.log('BugFix#219: normalRows详情:', normalRows.map(item => ({
|
||||||
adviceName: item.adviceName,
|
|
||||||
statusEnum: item.statusEnum,
|
statusEnum: item.statusEnum,
|
||||||
statusEnumType: typeof item.statusEnum,
|
statusEnumType: typeof item.statusEnum,
|
||||||
requestId: item.requestId
|
requestId: item.requestId
|
||||||
@@ -3579,7 +3553,6 @@ function handleSingOut() {
|
|||||||
adviceType: item.adviceType,
|
adviceType: item.adviceType,
|
||||||
statusEnum: item.statusEnum,
|
statusEnum: item.statusEnum,
|
||||||
requestId: item.requestId,
|
requestId: item.requestId,
|
||||||
adviceName: item.adviceName
|
|
||||||
})));
|
})));
|
||||||
|
|
||||||
// 🔧 BugFix: 放宽条件,只要有requestId的会诊医嘱都可以处理
|
// 🔧 BugFix: 放宽条件,只要有requestId的会诊医嘱都可以处理
|
||||||
@@ -3682,7 +3655,6 @@ function handleSingOut() {
|
|||||||
adviceType: item.adviceType,
|
adviceType: item.adviceType,
|
||||||
statusEnum: item.statusEnum,
|
statusEnum: item.statusEnum,
|
||||||
requestId: item.requestId,
|
requestId: item.requestId,
|
||||||
adviceName: item.adviceName
|
|
||||||
})));
|
})));
|
||||||
|
|
||||||
// 🔧 BugFix: 将requestId转换为数字类型
|
// 🔧 BugFix: 将requestId转换为数字类型
|
||||||
@@ -3922,9 +3894,8 @@ function convertValues(row, index) {
|
|||||||
row.dose = row.doseQuantity / row.partPercent;
|
row.dose = row.doseQuantity / row.partPercent;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// 🔧 Bug #273 修复:单次剂量变化后重新计算总量
|
|
||||||
calculateTotalAmount(row, index);
|
|
||||||
});
|
});
|
||||||
|
// calculateTotalAmount(row, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 单次剂量数量改变时自动计算总量
|
// 单次剂量数量改变时自动计算总量
|
||||||
@@ -3950,106 +3921,25 @@ function convertDoseValues(row, index) {
|
|||||||
row.doseQuantity = row.dose * row.partPercent;
|
row.doseQuantity = row.dose * row.partPercent;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// 🔧 Bug #273 修复:单次剂量变化后重新计算总量
|
|
||||||
calculateTotalAmount(row, index);
|
|
||||||
});
|
});
|
||||||
|
// calculateTotalAmount(row, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 总量计算,仅适用只有两种单位的情况
|
// 总量计算,仅适用只有两种单位的情况
|
||||||
function calculateTotalAmount(row, index) {
|
function calculateTotalAmount(row, index) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
// 🔧 Bug #273 调试日志
|
if (row.adviceType == 2) {
|
||||||
console.log('[calculateTotalAmount] 开始计算', {
|
calculateTotalPrice(row, index);
|
||||||
adviceType: row.adviceType,
|
|
||||||
rateCode: row.rateCode,
|
|
||||||
dispensePerDuration: row.dispensePerDuration,
|
|
||||||
doseQuantity: row.doseQuantity,
|
|
||||||
partAttributeEnum: row.partAttributeEnum,
|
|
||||||
unitCode: row.unitCode,
|
|
||||||
minUnitCode: row.minUnitCode
|
|
||||||
});
|
|
||||||
|
|
||||||
// 项目为西药或中成药时
|
|
||||||
if (row.adviceType != 1 && row.adviceType != 2) {
|
|
||||||
console.log('[calculateTotalAmount] 非西药/中成药,跳过计算');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 🔧 Bug #273 修复:使用字典数据计算频次对应的每日次数
|
|
||||||
function getRateCount(rateCode) {
|
|
||||||
// 先从字典中查找
|
|
||||||
const rateDict = rate_code.value?.find(item => item.value === rateCode);
|
|
||||||
if (rateDict && rateDict.remark) {
|
|
||||||
return Number(rateDict.remark);
|
|
||||||
}
|
|
||||||
// 回退到固定映射
|
|
||||||
const frequencyMap = {
|
|
||||||
ST: 1, QD: 1, BID: 2, TID: 3, QID: 4, QN: 1,
|
|
||||||
QOD: 0.5, QW: 1/7, BIW: 2/7, TIW: 3/7, QOW: 1/14
|
|
||||||
};
|
|
||||||
return frequencyMap[rateCode] || 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 情况1: 根据用药天数和频次计算
|
|
||||||
if (row.rateCode && row.dispensePerDuration) {
|
|
||||||
const rateCount = getRateCount(row.rateCode);
|
|
||||||
const count = rateCount * row.dispensePerDuration;
|
|
||||||
console.log('[calculateTotalAmount] 计算count:', { rateCount, days: row.dispensePerDuration, count });
|
|
||||||
if (!count) return;
|
|
||||||
|
|
||||||
let quantity;
|
|
||||||
if (row.unitCode == row.minUnitCode) {
|
|
||||||
// 🔧 使用最小单位时,计算的是最小单位数量(如袋数)
|
|
||||||
quantity = calculateQuantityBySplitType(row.partAttributeEnum, row.doseQuantity, count, row.partPercent);
|
|
||||||
row.quantity = quantity;
|
|
||||||
row.totalPrice = (quantity * row.minUnitPrice).toFixed(2);
|
|
||||||
console.log('[calculateTotalAmount] 计算结果(最小单位):', { quantity, totalPrice: row.totalPrice, partPercent: row.partPercent });
|
|
||||||
} else {
|
|
||||||
// 🔧 使用包装单位时,计算的是包装单位数量(如盒数)
|
|
||||||
quantity = calculateQuantity(
|
|
||||||
row.partAttributeEnum,
|
|
||||||
row.doseQuantity,
|
|
||||||
count,
|
|
||||||
row.partPercent
|
|
||||||
);
|
|
||||||
row.quantity = quantity;
|
|
||||||
row.totalPrice = (quantity * row.unitPrice).toFixed(2);
|
|
||||||
console.log('[calculateTotalAmount] 计算结果(包装单位):', { quantity, totalPrice: row.totalPrice, partPercent: row.partPercent });
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('[calculateTotalAmount] 条件不满足,未计算(rateCode或dispensePerDuration为空)');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 总量计算,仅适用只有两种单位的情况
|
|
||||||
function calculateTotalAmount2(row, index) {
|
|
||||||
nextTick(() => {
|
|
||||||
// 项目为西药或中成药时
|
|
||||||
if (row.adviceType != 1 && row.adviceType != 2) {
|
if (row.adviceType != 1 && row.adviceType != 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 🔧 Bug #273 修复:使用字典数据计算频次对应的每日次数
|
|
||||||
function getRateCount(rateCode) {
|
|
||||||
// 先从字典中查找
|
|
||||||
const rateDict = rate_code.value?.find(item => item.value === rateCode);
|
|
||||||
if (rateDict && rateDict.remark) {
|
|
||||||
return Number(rateDict.remark);
|
|
||||||
}
|
|
||||||
// 回退到固定映射
|
|
||||||
const frequencyMap = {
|
|
||||||
ST: 1, QD: 1, BID: 2, TID: 3, QID: 4, QN: 1,
|
|
||||||
QOD: 0.5, QW: 1/7, BIW: 2/7, TIW: 3/7, QOW: 1/14
|
|
||||||
};
|
|
||||||
return frequencyMap[rateCode] || 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 情况1: 根据用药天数和频次计算
|
// 情况1: 根据用药天数和频次计算
|
||||||
if (row.rateCode && row.dispensePerDuration) {
|
if (row.rateCode && row.dispensePerDuration) {
|
||||||
const rateCount = getRateCount(row.rateCode);
|
const count = calculateQuantityByDays(row.rateCode, row.dispensePerDuration);
|
||||||
const count = rateCount * row.dispensePerDuration;
|
|
||||||
if (!count) return;
|
if (!count) return;
|
||||||
|
|
||||||
let quantity;
|
let quantity;
|
||||||
@@ -4069,62 +3959,100 @@ function calculateTotalAmount2(row, index) {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 情况2: 中成药兼容旧逻辑
|
||||||
|
if (row.adviceType == 2) {
|
||||||
|
if (row.partPercent == 1) {
|
||||||
|
row.totalPrice = (row.quantity * row.unitPrice).toFixed(6);
|
||||||
|
} else {
|
||||||
|
// 拆零比不为1时, 如果当前总量单位是大单位,总价等于数量乘以大单位价格 否则总价等于数量乘以小单位价格
|
||||||
|
if (row.unitCodeList.find((k) => k.value == row.unitCode).type == 'unit') {
|
||||||
|
row.totalPrice = (row.quantity * row.unitPrice).toFixed(6);
|
||||||
|
} else {
|
||||||
|
row.totalPrice = (row.quantity * row.minUnitPrice).toFixed(6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (row.adviceType == 1) {
|
||||||
|
if (row.rateCode && row.dispensePerDuration) {
|
||||||
|
// 根据用药天数和用药频次计算数量,医生按顺序填的情况
|
||||||
|
let count = calculateQuantityByDays(row.rateCode, row.dispensePerDuration);
|
||||||
|
if (count) {
|
||||||
|
let quantity;
|
||||||
|
if (row.unitCode == row.minUnitCode) {
|
||||||
|
quantity = calculateQuantityBySplitType(row.partAttributeEnum, row.doseQuantity, count);
|
||||||
|
prescriptionList.value[index].quantity = quantity;
|
||||||
|
prescriptionList.value[index].totalPrice = (quantity * row.minUnitPrice).toFixed(6);
|
||||||
|
} else {
|
||||||
|
quantity = calculateQuantity(
|
||||||
|
row.partAttributeEnum,
|
||||||
|
row.doseQuantity,
|
||||||
|
count,
|
||||||
|
row.partPercent
|
||||||
|
);
|
||||||
|
prescriptionList.value[index].quantity = quantity;
|
||||||
|
prescriptionList.value[index].totalPrice = (quantity * row.unitPrice).toFixed(6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (row.quantity) {
|
||||||
|
// 如果医生开药先填总量 直接计算总价格
|
||||||
|
if (row.unitCode == row.minUnitCode) {
|
||||||
|
prescriptionList.value[index].totalPrice = (row.quantity * row.minUnitPrice).toFixed(6);
|
||||||
|
} else {
|
||||||
|
prescriptionList.value[index].totalPrice = (row.quantity * row.unitPrice).toFixed(6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 情况3: 医生先填总量
|
||||||
|
if (row.quantity) {
|
||||||
|
if (row.unitCode == row.minUnitCode) {
|
||||||
|
prescriptionList.value[index].totalPrice = (row.quantity * row.minUnitPrice).toFixed(6);
|
||||||
|
} else {
|
||||||
|
prescriptionList.value[index].totalPrice = (row.quantity * row.unitPrice).toFixed(6);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据门诊拆分类型计算总药量 - 最小单位
|
* 根据门诊拆分类型计算总药量
|
||||||
* 🔧 Bug #273 修复:统一使用拆零比计算
|
*
|
||||||
* @param type 门诊拆分类型
|
* @param type 门诊拆分类型
|
||||||
* @param dose 单次剂量 最小单位
|
* @param dose 单次剂量 最小单位
|
||||||
* @param count 用药频次和用药天数计算出的总数
|
* @param count 用药频次和用药天数计算出的总数
|
||||||
* @param partPercent 拆零比
|
|
||||||
*/
|
*/
|
||||||
function calculateQuantityBySplitType(type, dose, count, partPercent) {
|
function calculateQuantityBySplitType(type, dose, count) {
|
||||||
// 先计算最小单位总量
|
|
||||||
const minUnitTotal = dose * count;
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 1: // 门诊按最小单位每次量向上取整
|
case 1: // 门诊按最小单位每次量向上取整
|
||||||
// 每次用量向上取整,然后计算总量
|
return Math.ceil(dose) * count;
|
||||||
return Math.ceil(Math.ceil(dose) * count / partPercent);
|
|
||||||
case 2: // 门诊按包装单位不可拆分
|
case 2: // 门诊按包装单位不可拆分
|
||||||
// 总量向上取整到包装单位
|
return Math.ceil(dose * count);
|
||||||
return Math.ceil(minUnitTotal / partPercent);
|
|
||||||
case 3: // 门诊按最小单位总量向上取整
|
case 3: // 门诊按最小单位总量向上取整
|
||||||
// 总量向上取整,然后转换为包装单位
|
return Math.ceil(dose * count);
|
||||||
return Math.ceil(minUnitTotal / partPercent);
|
|
||||||
case 4: // 门诊按包装单位每次量向上取整
|
case 4: // 门诊按包装单位每次量向上取整
|
||||||
// 每次用量转换为包装单位后向上取整
|
return Math.ceil(dose) * count;
|
||||||
return Math.ceil(Math.ceil(dose / partPercent) * count);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据门诊拆分类型计算总药量 - 包装单位
|
* 根据门诊拆分类型计算总药量
|
||||||
* 🔧 Bug #273 修复:统一使用拆零比计算
|
*
|
||||||
* @param type 门诊拆分类型
|
* @param type 门诊拆分类型
|
||||||
* @param dose 单次剂量 最小单位
|
* @param dose 单次剂量 最小单位
|
||||||
* @param count 用药频次和用药天数计算出的总数
|
* @param count 用药频次和用药天数计算出的总数
|
||||||
* @param partPercent 拆零比
|
|
||||||
*/
|
*/
|
||||||
function calculateQuantity(type, dose, count, partPercent) {
|
function calculateQuantity(type, dose, count, partPercent) {
|
||||||
// 先计算最小单位总量
|
|
||||||
const minUnitTotal = dose * count;
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 1: // 门诊按最小单位每次量向上取整
|
case 1: // 门诊按最小单位每次量向上取整
|
||||||
// 每次用量向上取整,然后计算总量
|
return Math.ceil(dose / partPercent) * count;
|
||||||
return Math.ceil(Math.ceil(dose) * count / partPercent);
|
|
||||||
case 2: // 门诊按包装单位不可拆分
|
case 2: // 门诊按包装单位不可拆分
|
||||||
// 总量向上取整到包装单位
|
return Math.ceil(dose * count);
|
||||||
return Math.ceil(minUnitTotal / partPercent);
|
|
||||||
case 3: // 门诊按最小单位总量向上取整
|
case 3: // 门诊按最小单位总量向上取整
|
||||||
// 总量向上取整,然后转换为包装单位
|
return Math.ceil((dose / partPercent) * count);
|
||||||
return Math.ceil(minUnitTotal / partPercent);
|
|
||||||
case 4: // 门诊按包装单位每次量向上取整
|
case 4: // 门诊按包装单位每次量向上取整
|
||||||
// 每次用量转换为包装单位后向上取整
|
return Math.ceil(dose) * count;
|
||||||
return Math.ceil(Math.ceil(dose / partPercent) * count);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4508,16 +4436,6 @@ defineExpose({ getListInfo, getDiagnosisInfo });
|
|||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 🔧 Bug #273 拆零比提示样式 */
|
|
||||||
.part-percent-hint {
|
|
||||||
color: #909399;
|
|
||||||
font-size: 12px;
|
|
||||||
white-space: nowrap;
|
|
||||||
margin-left: 8px;
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* V1.3 风格侧边栏 - 组套列表样式 */
|
/* V1.3 风格侧边栏 - 组套列表样式 */
|
||||||
.order-group-container {
|
.order-group-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
Reference in New Issue
Block a user