Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # openhis-ui-vue3/src/views/doctorstation/components/diagnosis/addDiagnosisDialog.vue # openhis-ui-vue3/src/views/doctorstation/components/tcm/tcmAdvice.vue
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<div
|
||||
class="prescription-section"
|
||||
v-for="(prescription, pIndex) in tcmPrescriptionList"
|
||||
:key="pIndex"
|
||||
:key="prescription.id"
|
||||
>
|
||||
<div class="section-header">
|
||||
<div class="title first-prescription">
|
||||
@@ -18,18 +18,20 @@
|
||||
<plus />
|
||||
</el-icon>
|
||||
<el-icon
|
||||
class="delete-icon"
|
||||
title="删除处方单"
|
||||
@click="handleDeletePrescriptionClick(pIndex)"
|
||||
:class="{ 'disabled-icon': isPrescriptionDeletable(pIndex) !== true }"
|
||||
style="font-size: 20px !important; margin-left: 10px; color: #f56c6c"
|
||||
class="add-icon"
|
||||
title="删除处方"
|
||||
@click="deletePrescription(prescription)"
|
||||
style="font-size: 26px !important; margin-left: 10px; color: red"
|
||||
>
|
||||
<minus />
|
||||
<Delete />
|
||||
</el-icon>
|
||||
</div>
|
||||
<div class="summary">
|
||||
<span class="summary-item">药品数: {{ getPrescriptionMedicineCount(pIndex) }}种</span>
|
||||
<span class="summary-item">总价: ¥ {{ getPrescriptionTotalPrice(pIndex) }}</span>
|
||||
<span class="summary-item">
|
||||
药品数:
|
||||
{{ prescription.prescriptionList ? prescription.prescriptionList.length : '0' }}种
|
||||
</span>
|
||||
<span class="summary-item">总价: ¥ {{ calculatePrescriptionTotal(pIndex) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
@@ -41,6 +43,9 @@
|
||||
<el-button type="danger" plain @click="handleDelete(pIndex)" :disabled="false">
|
||||
删除
|
||||
</el-button>
|
||||
<el-button type="primary" plain @click="handlePrint(pIndex)" :disabled="false">
|
||||
打印
|
||||
</el-button>
|
||||
</div>
|
||||
<div
|
||||
class="doctor-station"
|
||||
@@ -69,10 +74,8 @@
|
||||
:value="item.accountId"
|
||||
/>
|
||||
</el-select>
|
||||
<span class="doctor-station"> 配方名称: </span>
|
||||
<el-input v-model="formulaName" placeholder=" " style="width: 100px" />
|
||||
<span class="doctor-station"> 用药途径: </span>
|
||||
<el-select v-model="methodCode" placeholder="费用性质" style="width: 120px">
|
||||
<span class="doctor-station"> 用法: </span>
|
||||
<el-select v-model="prescription.methodCode" placeholder="用法" style="width: 120px">
|
||||
<el-option
|
||||
v-for="dict in method_code"
|
||||
:key="dict.value"
|
||||
@@ -134,7 +137,6 @@
|
||||
<span class="doctor-station" style="float: right"> </span>
|
||||
</div>
|
||||
<el-table
|
||||
max-height="650"
|
||||
ref="prescriptionRef"
|
||||
:data="prescription.prescriptionList"
|
||||
row-key="uniqueKey"
|
||||
@@ -243,21 +245,23 @@
|
||||
/>
|
||||
</template>
|
||||
</el-select>
|
||||
<span class="doctor-station"> 脚注: </span>
|
||||
<!-- 单次剂量 -->
|
||||
<el-form-item
|
||||
label="特殊煎法:"
|
||||
prop="dosageInstruction"
|
||||
class="required-field"
|
||||
data-prop="dosageInstruction"
|
||||
>
|
||||
<el-select
|
||||
v-model="footNote"
|
||||
filterable
|
||||
allow-create
|
||||
default-first-option
|
||||
style="width: 120px; margin-right: 20px"
|
||||
placeholder="">
|
||||
<el-option
|
||||
v-for="dict in hjerbal_footnotes"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value">
|
||||
</el-option>
|
||||
v-model="scope.row.dosageInstruction"
|
||||
style="width: 90px; margin-right: 20px"
|
||||
placeholder=" "
|
||||
>
|
||||
<template v-for="item in dosage_instruction" :key="item.value">
|
||||
<el-option :value="item.value" :label="item.label" />
|
||||
</template>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<span class="total-amount">
|
||||
总金额:{{
|
||||
@@ -360,7 +364,7 @@
|
||||
? formatNumber(scope.row.quantity) +
|
||||
' ' +
|
||||
scope.row.doseUnitCode_dictText +
|
||||
' (' +
|
||||
' (' +
|
||||
scope.row.chineseHerbsDoseQuantity +
|
||||
'付)'
|
||||
: ''
|
||||
@@ -401,10 +405,10 @@
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
<tcmdiagnosisDialog ref="tcmDianosis" :patientInfo="props.patientInfo" @flush="handleDiagnosisFlush()" />
|
||||
<tcmdiagnosisDialog ref="tcmDianosis" :patientInfo="props.patientInfo" @flush="getListInfo()" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
getDiagnosisDefinitionList,
|
||||
@@ -414,7 +418,6 @@ import {
|
||||
getOrgTree,
|
||||
signTcmAdvice,
|
||||
getTcmDiagnosis,
|
||||
deleteTcmDiagnosis,
|
||||
signOutTcmAdvice,
|
||||
updateGroupId,
|
||||
getContract,
|
||||
@@ -427,7 +430,9 @@ import { calculateQuantityByDays, formatNumber } from '@/utils/his';
|
||||
import Decimal from 'decimal.js';
|
||||
import tcmdiagnosisDialog from './tcmdiagnosisDialog';
|
||||
import { Delete, Minus } from '@element-plus/icons-vue';
|
||||
|
||||
import { ElMessage } from 'element-plus';
|
||||
import printUtils, { PRINT_TEMPLATE } from '@/utils/printUtils';
|
||||
import { advicePrint } from '@/api/public';
|
||||
const emit = defineEmits(['selectDiagnosis']);
|
||||
const total = ref(0);
|
||||
const queryParams = ref({});
|
||||
@@ -441,8 +446,14 @@ const encounterId = ref('');
|
||||
const accountId = ref('');
|
||||
const encounterDiagnosisId = ref('');
|
||||
|
||||
let prescriptionIdCounter = 1;
|
||||
const generatePrescriptionId = () => {
|
||||
return `prescription_${Date.now()}_${prescriptionIdCounter++}`;
|
||||
};
|
||||
|
||||
const tcmPrescriptionList = ref([
|
||||
{
|
||||
id: generatePrescriptionId(),
|
||||
prescriptionList: [],
|
||||
conditionDefinitionId: '',
|
||||
accountId: '',
|
||||
@@ -462,29 +473,9 @@ const tcmPrescriptionList = ref([
|
||||
const unitCodeList = ref([]);
|
||||
const adviceTableRef = ref([]);
|
||||
const organization = ref([]);
|
||||
const conditionDefinitionId = ref('');
|
||||
const diagnosisName = ref('');
|
||||
const diagnosisInfo = ref({});
|
||||
const rateCode = ref('');
|
||||
const footNote = ref('');
|
||||
const decoctionMethod = ref('');
|
||||
const chineseHerbsDoseQuantity = ref('');
|
||||
const dispensePerDuration = ref('');
|
||||
const formulaName = ref('');
|
||||
const sufferingFlag = ref(false);
|
||||
const methodCode = ref('');
|
||||
const loading = ref(false);
|
||||
const rowRules = ref({
|
||||
conditionDefinitionId: [{ required: true, message: '请选择诊断', trigger: 'change' }],
|
||||
minUnitQuantity: [{ required: true, message: '请输入单次剂量', trigger: 'change' }],
|
||||
doseQuantity: [{ required: true, message: '请输入单次剂量单位', trigger: 'change' }],
|
||||
quantity: [{ required: true, message: '请输入数量', trigger: 'change' }],
|
||||
dispensePerDuration: [{ required: true, message: '请输入用药天数', trigger: 'change' }],
|
||||
formulaName: [{ required: true, message: '请输入配方名称', trigger: 'change' }],
|
||||
executeNum: [{ required: true, message: '请输入执行次数', trigger: 'change' }],
|
||||
rateCode: [{ required: true, message: '请选择频次', trigger: 'change' }],
|
||||
methodCode: [{ required: true, message: '请选择给药途径', trigger: 'change' }],
|
||||
orgId: [{ required: true, message: '请选择执行科室', trigger: 'change' }],
|
||||
});
|
||||
const unitMap = ref({
|
||||
dose: 'dose',
|
||||
@@ -514,37 +505,15 @@ const inputRefs = ref({}); // 存储输入框实例
|
||||
const requiredProps = ref([]); // 存储必填项 prop 顺序
|
||||
const totalAmount = ref(0);
|
||||
const tcmDianosis = ref();
|
||||
const { method_code, unit_code, rate_code, method_of_decocting_medicine,hjerbal_footnotes,distribution_category_code } = proxy.useDict(
|
||||
'method_code',
|
||||
'unit_code',
|
||||
'rate_code',
|
||||
'method_of_decocting_medicine',
|
||||
'hjerbal_footnotes',
|
||||
'distribution_category_code'
|
||||
);
|
||||
const { method_code, unit_code, rate_code, distribution_category_code, dosage_instruction } =
|
||||
proxy.useDict(
|
||||
'method_code',
|
||||
'unit_code',
|
||||
'rate_code',
|
||||
'distribution_category_code',
|
||||
'dosage_instruction'
|
||||
);
|
||||
|
||||
const adviceTypeList = ref([
|
||||
{
|
||||
label: '西药',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '中成药',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '耗材',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label: '诊疗',
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
label: '全部',
|
||||
value: '',
|
||||
},
|
||||
]);
|
||||
onMounted(() => {
|
||||
document.addEventListener('keydown', escKeyListener);
|
||||
});
|
||||
@@ -570,91 +539,101 @@ function getList() {
|
||||
});
|
||||
}
|
||||
|
||||
function getListInfo(addNewRow) {
|
||||
// 确保isAdding变量存在
|
||||
if (typeof isAdding !== 'undefined') {
|
||||
isAdding.value = false;
|
||||
}
|
||||
|
||||
// 确保有患者信息
|
||||
if (!props.patientInfo || !props.patientInfo.encounterId) {
|
||||
console.error('患者信息不完整');
|
||||
return;
|
||||
}
|
||||
|
||||
getTcmAdviceList({ encounterId: props.patientInfo.encounterId }).then((res) => {
|
||||
if (res && res.data && Array.isArray(res.data)) {
|
||||
// 处理返回的数据
|
||||
if (res.data.length > 0) {
|
||||
// 如果有数据,清空当前列表并重新添加
|
||||
tcmPrescriptionList.value = [];
|
||||
|
||||
res.data.forEach((item) => {
|
||||
try {
|
||||
// 解析contentJson获取完整的医嘱数据
|
||||
const contentData = item.contentJson ? JSON.parse(item.contentJson) : {};
|
||||
|
||||
// 创建一个新的处方对象
|
||||
const newPrescription = {
|
||||
...item,
|
||||
...contentData,
|
||||
// 确保关键显示字段存在
|
||||
adviceName: contentData.adviceName || item.adviceName || '',
|
||||
quantity: contentData.quantity || item.quantity || '',
|
||||
totalPrice: contentData.totalPrice || item.totalPrice || '',
|
||||
diagnosisName: contentData.diagnosisName || item.diagnosisName || '',
|
||||
positionName: contentData.positionName || item.positionName || '',
|
||||
doseUnitCode_dictText: contentData.doseUnitCode_dictText || item.doseUnitCode_dictText || '',
|
||||
chineseHerbsDoseQuantity: contentData.chineseHerbsDoseQuantity || item.chineseHerbsDoseQuantity || '',
|
||||
prescriptionList: [contentData]
|
||||
};
|
||||
|
||||
// 添加到处方列表
|
||||
tcmPrescriptionList.value.push(newPrescription);
|
||||
} catch (error) {
|
||||
console.error('解析医嘱数据失败:', error, '数据项:', item);
|
||||
}
|
||||
});
|
||||
async function getListInfo(addNewRow) {
|
||||
// 重置所有处方的添加状态
|
||||
tcmPrescriptionList.value.forEach((prescription) => {
|
||||
prescription.isAdding = false;
|
||||
});
|
||||
await getTcmAdviceList({ encounterId: props.patientInfo.encounterId }).then(async (res) => {
|
||||
// 按 groupId 分组数据
|
||||
const groupedData = {};
|
||||
res.data.forEach((item) => {
|
||||
const groupId = item.groupId || 'default';
|
||||
if (!groupedData[groupId]) {
|
||||
groupedData[groupId] = [];
|
||||
}
|
||||
|
||||
// 重新计算总金额
|
||||
handleTotalAmount();
|
||||
|
||||
if (props.activeTab == 'prescription' && addNewRow) {
|
||||
handleAddMedicine();
|
||||
groupedData[groupId].push({
|
||||
...item,
|
||||
doseQuantity: JSON.parse(item.contentJson)?.doseQuantity,
|
||||
doseUnitCode_dictText: JSON.parse(item.contentJson)?.doseUnitCode_dictText,
|
||||
});
|
||||
});
|
||||
|
||||
await getContract({ encounterId: props.patientInfo.encounterId }).then((res) => {
|
||||
contractList.value = res.data;
|
||||
});
|
||||
// 更新处方列表
|
||||
const groupIds = Object.keys(groupedData);
|
||||
tcmPrescriptionList.value = groupIds.map((groupId, index) => {
|
||||
const prescription = tcmPrescriptionList.value[index] || {
|
||||
id: generatePrescriptionId(),
|
||||
prescriptionList: [],
|
||||
conditionDefinitionId: '',
|
||||
accountId: contractList.value[0].accountId,
|
||||
methodCode: '',
|
||||
rateCode: '',
|
||||
dispensePerDuration: '',
|
||||
chineseHerbsDoseQuantity: '',
|
||||
sufferingFlag: '0',
|
||||
checkAll: false,
|
||||
groupIndexList: [],
|
||||
expandOrder: [],
|
||||
totalAmount: 0,
|
||||
nextId: 1,
|
||||
isAdding: false,
|
||||
};
|
||||
|
||||
if (!prescription.id) {
|
||||
prescription.id = generatePrescriptionId();
|
||||
}
|
||||
} else {
|
||||
console.error('获取医嘱列表失败或数据格式错误:', res);
|
||||
// 保持当前列表不变,不要清空
|
||||
|
||||
prescription.prescriptionList = groupedData[groupId];
|
||||
return prescription;
|
||||
});
|
||||
|
||||
// 如果没有处方数据,确保至少有一个空处方
|
||||
if (tcmPrescriptionList.value.length === 0) {
|
||||
tcmPrescriptionList.value.push({
|
||||
id: generatePrescriptionId(),
|
||||
prescriptionList: [],
|
||||
conditionDefinitionId: '',
|
||||
accountId: contractList.value[0].accountId,
|
||||
methodCode: '',
|
||||
rateCode: '',
|
||||
dispensePerDuration: '',
|
||||
chineseHerbsDoseQuantity: '',
|
||||
sufferingFlag: '0',
|
||||
checkAll: false,
|
||||
groupIndexList: [],
|
||||
expandOrder: [],
|
||||
totalAmount: 0,
|
||||
nextId: 1,
|
||||
isAdding: false,
|
||||
});
|
||||
}
|
||||
tcmPrescriptionList.value.accountId = contractList.value[0].accountId;
|
||||
if (props.activeTab == 'prescription' && addNewRow) {
|
||||
handleAddMedicine(0);
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('获取医嘱列表异常:', error);
|
||||
// 保持当前列表不变,不要清空
|
||||
});
|
||||
|
||||
|
||||
tcmDiagnosisList.value = getFromDiagnosis(props.patientInfo.encounterId);
|
||||
|
||||
getContract({ encounterId: props.patientInfo.encounterId }).then((res) => {
|
||||
contractList.value = res?.data || [];
|
||||
}).catch(error => {
|
||||
console.error('获取合同信息失败:', error);
|
||||
});
|
||||
|
||||
accountId.value = props.patientInfo.accountId || '';
|
||||
accountId.value = props.patientInfo.accountId;
|
||||
}
|
||||
|
||||
function getDiagnosisInfo() {
|
||||
diagnosisList.value = [];
|
||||
getTcmDiagnosis({ encounterId: props.patientInfo.encounterId }).then((res) => {
|
||||
if (res.data.illness && res.data.illness.length > 0) {
|
||||
if (res.data.illness.length > 0) {
|
||||
res.data.illness.forEach((item, index) => {
|
||||
diagnosisList.value.push({
|
||||
name: item.name + '-' + res.data.symptom[index].name,
|
||||
definitionId: item.definitionId,
|
||||
encounterDiagnosisId: item.encounterDiagnosisId,
|
||||
conditionId: item.conditionId,
|
||||
syndromeGroupNo: item.syndromeGroupNo || res.data.symptom[index].syndromeGroupNo, // 保存syndromeGroupNo用于删除
|
||||
...item, // 保存完整的item数据
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -751,39 +730,36 @@ function handleChange(value) {
|
||||
adviceQueryParams.value.searchKey = value;
|
||||
}
|
||||
|
||||
function openDialog() {
|
||||
tcmDianosis.value.openDialog();
|
||||
}
|
||||
|
||||
function deleteDiagnosisBind(syndromeGroupNo) {
|
||||
if (!syndromeGroupNo) {
|
||||
proxy.$modal.msgWarning('缺少诊断标识,无法删除');
|
||||
return;
|
||||
}
|
||||
|
||||
// 调用API从服务器删除中医诊断
|
||||
deleteTcmDiagnosis(syndromeGroupNo).then((res) => {
|
||||
if (res.code === 200) {
|
||||
proxy.$modal.msgSuccess('删除成功');
|
||||
handleDiagnosisFlush();
|
||||
} else {
|
||||
proxy.$modal.msgError(res.msg || '删除失败');
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.error('删除中医诊断失败:', error);
|
||||
proxy.$modal.msgError('删除失败,请重试');
|
||||
function addNewPrescription() {
|
||||
tcmPrescriptionList.value.push({
|
||||
id: generatePrescriptionId(),
|
||||
prescriptionList: [],
|
||||
conditionDefinitionId: '',
|
||||
accountId: accountId.value,
|
||||
methodCode: '',
|
||||
rateCode: '',
|
||||
dispensePerDuration: '',
|
||||
chineseHerbsDoseQuantity: '',
|
||||
sufferingFlag: '0',
|
||||
checkAll: false,
|
||||
groupIndexList: [],
|
||||
expandOrder: [],
|
||||
totalAmount: 0,
|
||||
nextId: 1,
|
||||
isAdding: false,
|
||||
});
|
||||
}
|
||||
|
||||
// 诊断数据刷新处理函数
|
||||
function handleDiagnosisFlush() {
|
||||
// 同时刷新医嘱列表和诊断列表,确保诊断数据同步
|
||||
getListInfo();
|
||||
getDiagnosisInfo();
|
||||
}
|
||||
function deletePrescription(prescription) {
|
||||
if (tcmPrescriptionList.value.length <= 1) {
|
||||
proxy.$modal.msgError('至少保留一张处方');
|
||||
return;
|
||||
}
|
||||
|
||||
function addNewPrescription(){
|
||||
tcmPrescriptionList.value.push({})
|
||||
const index = tcmPrescriptionList.value.findIndex((p) => p.id === prescription.id);
|
||||
if (index !== -1) {
|
||||
tcmPrescriptionList.value.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 删除处方单
|
||||
@@ -991,13 +967,8 @@ function handleDelete(pIndex) {
|
||||
prescription.expandOrder = [];
|
||||
prescription.isAdding = false;
|
||||
adviceQueryParams.value.adviceType = undefined;
|
||||
// 删除行会出现组号混乱的情况,所以这里重新更新标记
|
||||
const allPrescriptions = tcmPrescriptionList.value.flatMap(p => p.prescriptionList);
|
||||
groupMarkers.value = getGroupMarkers(allPrescriptions);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function handleNumberClick(item, index, pIndex) {
|
||||
const prescription = tcmPrescriptionList.value[pIndex];
|
||||
prescription.prescriptionList[index].unitPrice = item.price;
|
||||
@@ -1077,132 +1048,72 @@ function handleSave(pIndex) {
|
||||
}
|
||||
|
||||
// 单行处方保存
|
||||
function handleSaveSign(row, index) {
|
||||
try {
|
||||
// 直接执行保存逻辑,不再进行表单验证
|
||||
function handleSaveSign(row, index, pIndex) {
|
||||
const prescription = tcmPrescriptionList.value[pIndex];
|
||||
const formRefName = 'formRef' + pIndex + '-' + index;
|
||||
proxy.$refs[formRefName][0].validate((valid) => {
|
||||
row.isEdit = false;
|
||||
isAdding.value = false;
|
||||
expandOrder.value = [];
|
||||
|
||||
// 确保必要的字段有值
|
||||
if (props.patientInfo) {
|
||||
row.patientId = props.patientInfo.patientId;
|
||||
row.encounterId = props.patientInfo.encounterId;
|
||||
}
|
||||
|
||||
row.accountId = accountId.value || '';
|
||||
row.quantity = row.minUnitQuantity || 1; // 确保数量有值
|
||||
row.conditionId = conditionId.value || '';
|
||||
row.conditionDefinitionId = conditionDefinitionId.value || '';
|
||||
row.encounterDiagnosisId = encounterDiagnosisId.value || '';
|
||||
row.diagnosisName = diagnosisName.value || '';
|
||||
|
||||
// 计算单价
|
||||
if (row.unitCodeList && row.unitCode) {
|
||||
const unitItem = row.unitCodeList.find((item) => item.value === row.unitCode);
|
||||
if (unitItem?.type !== 'unit' && row.unitPrice) {
|
||||
row.unitPrice = new Decimal(row.unitPrice).div(row.partPercent || 1).toFixed(2);
|
||||
}
|
||||
}
|
||||
|
||||
// 计算总金额
|
||||
if (row.minUnitQuantity && row.unitPrice) {
|
||||
row.totalPrice = new Decimal(row.minUnitQuantity).mul(row.unitPrice).toFixed(2);
|
||||
}
|
||||
|
||||
// 确保显示所需的字段都有值
|
||||
row.adviceName = row.adviceName || '未命名药品';
|
||||
row.positionName = row.positionName || '默认药房';
|
||||
|
||||
// 创建要保存的数据对象,避免循环引用
|
||||
const saveData = {
|
||||
...row,
|
||||
// 排除可能导致循环引用的复杂对象
|
||||
unitCodeList: undefined,
|
||||
stockList: undefined,
|
||||
contentJson: undefined
|
||||
};
|
||||
|
||||
// 序列化数据用于存储
|
||||
saveData.contentJson = JSON.stringify(saveData);
|
||||
|
||||
// 只保存当前行的数据,而不是整个列表
|
||||
savePrescription({ adviceSaveList: [saveData] }).then((res) => {
|
||||
if (res && res.code === 200) {
|
||||
proxy.$modal.msgSuccess('保存成功');
|
||||
// 此处错误调用getListInfo,导致医嘱信息被覆盖,从而不显示。
|
||||
// getListInfo(true);
|
||||
nextId.value = 1;
|
||||
} else {
|
||||
proxy.$modal.msgError('保存失败,请重试');
|
||||
console.error('保存失败响应:', res);
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('保存处方失败:', error);
|
||||
proxy.$modal.msgError('保存失败,请检查网络或联系管理员');
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('处理保存时出错:', error);
|
||||
proxy.$modal.msgError('操作异常,请重试');
|
||||
}
|
||||
prescription.isAdding = false;
|
||||
prescription.expandOrder = [];
|
||||
row.contentJson = undefined;
|
||||
row.patientId = props.patientInfo.patientId;
|
||||
row.encounterId = props.patientInfo.encounterId;
|
||||
row.accountId = prescription.accountId;
|
||||
row.quantity = row.minUnitQuantity;
|
||||
row.conditionId = prescription.conditionId;
|
||||
row.unitPrice =
|
||||
row.unitCodeList.find((item) => item.value == row.unitCode).type == 'unit'
|
||||
? row.unitPrice
|
||||
: new Decimal(row.unitPrice).div(row.partPercent).toFixed(2);
|
||||
row.conditionDefinitionId = prescription.conditionDefinitionId;
|
||||
row.encounterDiagnosisId = prescription.encounterDiagnosisId;
|
||||
row.diagnosisName = prescription.diagnosisName;
|
||||
row.contentJson = JSON.stringify(row);
|
||||
});
|
||||
}
|
||||
|
||||
function handleSaveBatch(pIndex) {
|
||||
const prescription = tcmPrescriptionList.value[pIndex];
|
||||
|
||||
function handleSaveBatch() {
|
||||
// 收集所有需要保存的处方项目
|
||||
let saveList = [];
|
||||
|
||||
// 遍历所有处方
|
||||
for (const prescription of tcmPrescriptionList.value) {
|
||||
if (prescription.prescriptionList) {
|
||||
// 检查处方是否有必填的付数
|
||||
if (!prescription.chineseHerbsDoseQuantity || prescription.chineseHerbsDoseQuantity == 0) {
|
||||
proxy.$modal.msgWarning('请输入付数');
|
||||
return;
|
||||
}
|
||||
|
||||
// 收集该处方下需要保存的项目
|
||||
const itemsToSave = prescription.prescriptionList
|
||||
.filter((item) => item.statusEnum == 1)
|
||||
.map((item, index) => {
|
||||
return {
|
||||
...item,
|
||||
accountId: accountId.value,
|
||||
conditionId: prescription.conditionId,
|
||||
encounterDiagnosisId: prescription.encounterDiagnosisId,
|
||||
conditionDefinitionId: prescription.conditionDefinitionId,
|
||||
encounterId: props.patientInfo.encounterId,
|
||||
patientId: props.patientInfo.patientId,
|
||||
requestId: item.requestId,
|
||||
groupId: item.groupId ? item.groupId : timestamp.toString(),
|
||||
chineseHerbsDoseQuantity: prescription.chineseHerbsDoseQuantity,
|
||||
dbOpType: item.requestId ? '2' : '1',
|
||||
};
|
||||
});
|
||||
|
||||
// 将项目添加到保存列表
|
||||
saveList = saveList.concat(itemsToSave);
|
||||
}
|
||||
}
|
||||
|
||||
// 检查是否有可保存的项目
|
||||
let timestamp = new Date().getTime();
|
||||
let saveList = prescription.prescriptionList
|
||||
.filter((item) => {
|
||||
return item.statusEnum == 1;
|
||||
})
|
||||
.map((item, index) => {
|
||||
return {
|
||||
...item,
|
||||
accountId: accountId.value,
|
||||
conditionId: prescription.conditionId,
|
||||
encounterDiagnosisId: prescription.encounterDiagnosisId,
|
||||
conditionDefinitionId: prescription.conditionDefinitionId,
|
||||
encounterId: props.patientInfo.encounterId,
|
||||
patientId: props.patientInfo.patientId,
|
||||
requestId: item.requestId,
|
||||
groupId: item.groupId ? item.groupId : timestamp.toString(),
|
||||
methodCode: prescription.methodCode,
|
||||
rateCode: prescription.rateCode,
|
||||
dispensePerDuration: prescription.dispensePerDuration,
|
||||
chineseHerbsDoseQuantity: prescription.chineseHerbsDoseQuantity,
|
||||
dbOpType: item.requestId ? '2' : '1',
|
||||
};
|
||||
});
|
||||
if (saveList.length == 0) {
|
||||
proxy.$modal.msgWarning('当前没有可保存医嘱');
|
||||
return;
|
||||
}
|
||||
|
||||
// 保存处方
|
||||
if (
|
||||
prescription.chineseHerbsDoseQuantity == undefined ||
|
||||
prescription.chineseHerbsDoseQuantity == 0
|
||||
) {
|
||||
proxy.$modal.msgWarning('请输入付数');
|
||||
return;
|
||||
}
|
||||
saveTcmAdvice({ adviceSaveList: saveList }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
proxy.$modal.msgSuccess('保存成功');
|
||||
getListInfo(true);
|
||||
|
||||
// 重置所有处方的nextId
|
||||
tcmPrescriptionList.value.forEach(prescription => {
|
||||
if (prescription.nextId) {
|
||||
prescription.nextId = 1;
|
||||
}
|
||||
});
|
||||
prescription.nextId = 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1370,26 +1281,75 @@ function validateGroups(saveList) {
|
||||
return true;
|
||||
}
|
||||
|
||||
async function handlePrint(pIndex) {
|
||||
const prescription = tcmPrescriptionList.value[pIndex];
|
||||
const selectedRows = prescription.prescriptionList.filter((item) => item.check);
|
||||
|
||||
if (selectedRows.length === 0) {
|
||||
ElMessage.warning('请先选择要打印的处方');
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查是否有待签发或已退费的记录
|
||||
const invalidRows = selectedRows.filter(
|
||||
(item) => item.statusEnum === 1 || item.chargeStatus === 8
|
||||
);
|
||||
|
||||
if (invalidRows.length > 0) {
|
||||
ElMessage.warning('待签发和已退费的项目不能打印,请重新选择');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const performPrint = async (rows) => {
|
||||
const requestIds = rows.map((item) => item.requestId).join(',');
|
||||
console.log('中药处方打印开始', requestIds);
|
||||
|
||||
const apiParams = { requestIds, isPrescription: '1' };
|
||||
const res = await advicePrint(apiParams);
|
||||
|
||||
const groupedRows = {};
|
||||
res.data.adviceItemList.forEach((row) => {
|
||||
const prescriptionNo = row.prescriptionNo;
|
||||
if (!groupedRows[prescriptionNo]) {
|
||||
groupedRows[prescriptionNo] = [];
|
||||
}
|
||||
row.contractName = res.data.contractName;
|
||||
groupedRows[prescriptionNo].push(row);
|
||||
});
|
||||
|
||||
const groupedArray = Object.values(groupedRows);
|
||||
const result = groupedArray.map((group) => ({
|
||||
...res.data,
|
||||
|
||||
// 药费
|
||||
medTotalAmount:
|
||||
'¥' + group.reduce((sum, item) => sum + (item.totalPrice || 0), 0).toFixed(2) + '元',
|
||||
|
||||
prescriptionList: group,
|
||||
}));
|
||||
|
||||
// 使用中药医生处方打印模板
|
||||
return { result, template: PRINT_TEMPLATE.DOC_CHINESE_MEDICINE_PRESCRIPTION };
|
||||
};
|
||||
|
||||
|
||||
|
||||
// 执行打印
|
||||
const { result, template } = await performPrint(selectedRows);
|
||||
printUtils.print(template, result);
|
||||
ElMessage.success('中药处方打印成功');
|
||||
} catch (error) {
|
||||
console.error('中药处方打印过程出错:', error);
|
||||
ElMessage.error('中药处方打印失败: ' + error.message);
|
||||
}
|
||||
}
|
||||
defineExpose({ getListInfo, getDiagnosisInfo });
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-table__expand-icon) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.medicine-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
@@ -1431,9 +1391,11 @@ defineExpose({ getListInfo, getDiagnosisInfo });
|
||||
.el-input-number .el-input__inner {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.el-table__cell .el-form-item--default {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.doctor-station {
|
||||
color: #606266;
|
||||
font-size: 14px;
|
||||
@@ -1495,25 +1457,4 @@ defineExpose({ getListInfo, getDiagnosisInfo });
|
||||
.add-icon:hover {
|
||||
background-color: #ecf5ff;
|
||||
}
|
||||
|
||||
.delete-icon {
|
||||
cursor: pointer;
|
||||
border-radius: 50%;
|
||||
padding: 4px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.delete-icon:hover {
|
||||
background-color: #fef0f0;
|
||||
}
|
||||
|
||||
.delete-icon.disabled-icon {
|
||||
cursor: not-allowed;
|
||||
color: #c0c4cc !important;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.delete-icon.disabled-icon:hover {
|
||||
background-color: transparent;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user