门诊医生站开立医嘱中成药的开医嘱录入界面和西药的开医嘱录入界面保持一致

This commit is contained in:
2025-11-14 09:01:48 +08:00
parent d97fd0bed1
commit a794cd0ce3

View File

@@ -353,45 +353,256 @@
</template>
<template v-else-if="scope.row.adviceType == 2">
<div style="display: flex; align-items: center; margin-bottom: 16px; gap: 16px">
<span style="font-size: 16px; font-weight: 600">
<span class="medicine-title">
{{
scope.row.adviceName +
' ' +
scope.row.volume +
' ' +
scope.row.unitPrice +
' 元/' +
scope.row.unitCode_dictText
' [' +
Number(scope.row.unitPrice).toFixed(2) +
' 元' +
'/' +
scope.row.unitCode_dictText +
']'
}}
</span>
<div class="form-group">
<!-- <el-form-item prop="conditionDefinitionId">
<el-select
v-model="scope.row.lotNumber"
style="width: 180px; margin-right: 20px"
v-model="scope.row.conditionDefinitionId"
style="width: 180px; margin: 0 20px"
placeholder="诊断"
>
<el-option
v-for="item in diagnosisList"
:key="item.conditionId"
:label="item.name"
:value="item.definitionId"
@click="handleDiagnosisChange(item, scope.row)"
/>
</el-select>
</el-form-item> -->
<el-form-item prop="lotNumber" label="药房:">
<el-select
v-model="scope.row.inventoryId"
style="width: 400px; margin-right: 20px"
placeholder="药房"
>
<el-option
v-for="item in scope.row.stockList"
:key="item.lotNumber"
:value="item.lotNumber"
:label="item.locationName "
:key="item.inventoryId"
:value="item.inventoryId"
:label="item.locationName"
@click="handleNumberClick(item, scope.$index)"
/>
</el-select>
</el-form-item>
<el-form-item
label="执行次数:"
prop="executeNum"
class="required-field"
data-prop="executeNum"
v-if="scope.row.injectFlag == 1"
>
<el-input-number
:min="1"
v-model="scope.row.executeNum"
controls-position="right"
:controls="false"
:ref="(el) => (inputRefs.executeNum = el)"
@keyup.enter.prevent="handleEnter('executeNum', scope.row, scope.$index)"
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"> 注射药品:{{ scope.row.injectFlag_enumText }} </span>
<span class="total-amount">
总金额:{{ scope.row.totalPrice ? scope.row.totalPrice + ' 元' : '0.00 元' }}
</span>
</div>
<div style="display: flex; align-items: center; gap: 12px; flex-wrap: wrap">
<div class="form-group">
<!-- 单次剂量 -->
<el-form-item
label="单次用量:"
prop="doseQuantity"
class="required-field"
data-prop="doseQuantity"
>
<el-input-number
:min="0"
v-model="scope.row.doseQuantity"
controls-position="right"
:controls="false"
style="width: 70px; margin-right: 20px"
:ref="(el) => (inputRefs.doseQuantity = el)"
@input="convertValues(scope.row, scope.$index)"
@keyup.enter.prevent="handleEnter('doseQuantity', scope.row, scope.$index)"
/>
</el-form-item>
<!-- 剂量单位 -->
<el-select
v-model="scope.row.unitCode"
style="width: 70px; margin-right: 20px"
placeholder=" "
>
<template v-for="item in scope.row.unitCodeList" :key="item.value">
<el-option
v-if="
scope.row.unitCodeList.length == 3
? item.type == unitMap['minUnit']
: item.type == unitMap['unit']
"
:value="item.value"
:label="item.label"
/>
</template>
</el-select>
<span>=</span>
<!-- 单次剂量 -->
<el-form-item prop="dose" class="required-field" data-prop="dose">
<el-input-number
v-model="scope.row.dose"
controls-position="right"
:controls="false"
style="width: 70px; margin: 0 20px"
:ref="(el) => (inputRefs.dose = el)"
@input="convertDoseValues(scope.row, scope.$index)"
@keyup.enter.prevent="handleEnter('dose', scope.row, scope.$index)"
/>
</el-form-item>
<!-- 全部单位 -->
<el-select
v-model="scope.row.doseUnitCode"
style="width: 70px"
placeholder=" "
@change="convertValues(scope.row, scope.$index)"
>
<el-option
v-for="item in scope.row.unitCodeList"
:value="item.value"
:label="item.label"
:key="item.value"
/>
</el-select>
</div>
<div class="form-group">
<el-form-item
label="数量"
label="给药途径"
prop="methodCode"
class="required-field"
data-prop="methodCode"
>
<el-select
v-model="scope.row.methodCode"
placeholder="给药途径"
clearable
filterable
:ref="(el) => (inputRefs.methodCode = el)"
@keyup.enter.prevent="
() => {
inputRefs.methodCode.blur();
}
"
@visible-change="
(value) => {
if (!value) {
handleEnter('methodCode', scope.row, scope.$index);
}
}
"
>
<el-option
v-for="dict in method_code"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item
label="用药频次:"
prop="rateCode"
class="required-field"
data-prop="rateCode"
>
<el-select
v-model="scope.row.rateCode"
placeholder="频次"
style="width: 120px"
filterable
@keyup.enter.prevent="
() => {
inputRefs.rateCode.blur();
}
"
@change="calculateTotalAmount(scope.row, scope.$index)"
@visible-change="
(value) => {
if (!value) {
handleEnter('rateCode', scope.row, scope.$index);
}
}
"
:ref="(el) => (inputRefs.rateCode = el)"
>
<el-option
v-for="dict in rate_code"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</div>
</div>
<div
style="
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
margin-top: 10px;
"
>
<div class="form-group">
<el-form-item
label="用药天数:"
prop="dispensePerDuration"
class="required-field"
data-prop="dispensePerDuration"
>
<el-input-number
v-model="scope.row.dispensePerDuration"
style="width: 80px"
:min="1"
controls-position="right"
:controls="false"
:ref="(el) => (inputRefs.dispensePerDuration = el)"
@keyup.enter.prevent="
handleEnter('dispensePerDuration', scope.row, scope.$index)
"
@input="calculateTotalAmount(scope.row, scope.$index)"
>
<template #suffix>天</template>
</el-input-number>
</el-form-item>
<el-form-item
label="总量:"
prop="quantity"
class="required-field"
data-prop="quantity"
>
<el-input-number
placeholder="数量"
v-model="scope.row.quantity"
style="width: 70px"
controls-position="right"
:controls="false"
:ref="(el) => (inputRefs.quantity = el)"
@keyup.enter.prevent="handleEnter('quantity', scope.row, scope.$index)"
@input="calculateTotalAmount(scope.row, scope.$index)"
@input="calculateTotalPrice(scope.row, scope.$index)"
/>
</el-form-item>
<el-select
@@ -407,15 +618,17 @@
:label="item.label"
@click="
() => {
if (item.type == unitMap['minUnit']) {
scope.row.unitPrice = scope.row.minUnitPrice;
} else {
scope.row.unitPrice = scope.row.unitTempPrice;
}
scope.row.unitCode_dictText = item.label;
}
"
/>
</template>
</el-select>
<span class="total-amount">
总金额:{{ scope.row.totalPrice ? scope.row.totalPrice + ' 元' : '0.00 元' }}
</span>
</div>
<el-button type="primary" @click="handleSaveSign(scope.row, scope.$index)">
确定
@@ -1234,7 +1447,7 @@ function selectAdviceBase(key, row) {
}
expandOrder.value = [key];
nextTick(() => {
if (row.adviceType == 1) {
if (row.adviceType == 1 || row.adviceType == 2) {
if (row.injectFlag == 1) {
inputRefs.value['executeNum']?.focus();
} else {
@@ -1464,7 +1677,7 @@ function handleSaveSign(row, index) {
row.patientId = props.patientInfo.patientId;
row.encounterId = props.patientInfo.encounterId;
row.accountId = accountId.value;
if (row.adviceType == 1) {
if (row.adviceType == 1 || row.adviceType == 2) {
row.minUnitQuantity =
row.minUnitCode == row.unitCode ? row.quantity : row.quantity * row.partPercent;
} else {
@@ -2033,20 +2246,8 @@ function convertDoseValues(row, index) {
// 总量计算,仅适用只有两种单位的情况
function calculateTotalAmount(row, index) {
nextTick(() => {
// 项目为耗材时
if (row.adviceType == 2) {
// 拆零比为1时 总价等于数量乘以单价
if (row.partPercent == 1) {
row.totalPrice = row.quantity * row.unitPrice;
} else {
// 拆零比不为1时 如果当前总量单位是大单位,总价等于数量乘以大单位价格 否则总价等于数量乘以小单位价格
if (row.unitCodeList.find((k) => k.value == row.unitCode).type == 'unit') {
row.totalPrice = row.quantity * row.unitPrice;
} else {
row.totalPrice = (row.quantity * row.minUnitPrice).toFixed(2);
}
}
} else if (row.adviceType == 1) {
// 项目为西药或中成药时,根据用药天数和用药频次自动计算总量
if (row.adviceType == 1 || row.adviceType == 2) {
if (row.rateCode && row.dispensePerDuration) {
// 根据用药天数和用药频次计算数量
let count = calculateQuantityByDays(row.rateCode, row.dispensePerDuration);
@@ -2067,6 +2268,23 @@ function calculateTotalAmount(row, index) {
prescriptionList.value[index].totalPrice = (quantity * row.unitPrice).toFixed(2);
}
}
} else {
// 如果没有用药频次或用药天数,则根据数量计算总价(中成药兼容旧逻辑)
if (row.adviceType == 2) {
// 拆零比为1时 总价等于数量乘以单价
if (row.partPercent == 1) {
row.totalPrice = row.quantity * row.unitPrice;
} else {
// 拆零比不为1时 如果当前总量单位是大单位,总价等于数量乘以大单位价格 否则总价等于数量乘以小单位价格
if (row.unitCodeList && row.unitCodeList.find((k) => k.value == row.unitCode)) {
if (row.unitCodeList.find((k) => k.value == row.unitCode).type == 'unit') {
row.totalPrice = row.quantity * row.unitPrice;
} else {
row.totalPrice = (row.quantity * row.minUnitPrice).toFixed(2);
}
}
}
}
}
}
});