完成100需求,补充99需求追溯术中产生的费用新增费用项时向表中插入SourceBillNo和generate_source_enum字段值

This commit is contained in:
chenjinyang
2026-02-10 16:49:28 +08:00
parent f1bddf3fbe
commit b5b91d8971
5 changed files with 882 additions and 50 deletions

View File

@@ -55,6 +55,9 @@
<el-col :span="1.5">
<el-button type="success" plain icon="Money" @click="handleChargeCharge(selectedRow)" :disabled="!selectedRow"> 计费 </el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="Document" @click="handleMedicalAdvice(selectedRow)" :disabled="!selectedRow"> 医嘱 </el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="Download" @click="handleExport">导出表格</el-button>
</el-col>
@@ -62,7 +65,7 @@
</el-row>
<!-- 中部表格区 -->
<el-table v-loading="loading" :data="surgeryList" row-key="scheduleId" :row-class-name="getRowClassName" highlight-current-row @current-change="handleCurrentChange">
<el-table v-loading="loading" :data="surgeryList" row-key="scheduleId" :row-class-name="getRowClassName" @current-change="handleCurrentChange">
<el-table-column label="ID" align="center" width="80">
<template #default="{ $index }">
{{ (applyQueryParams.pageNo - 1) * applyQueryParams.pageSize + $index + 1 }}
@@ -799,6 +802,18 @@
</div>
</div>
</el-dialog>
<!-- 临时医嘱弹窗 -->
<el-dialog :title="temporaryMedicalTitle" v-model="showTemporaryMedical" width="80%" append-to-body :close-on-click-modal="false">
<temporary-medical
:patient-info="temporaryPatientInfo"
:billing-medicines="temporaryBillingMedicines"
v-model:temporary-advices="temporaryAdvices"
@submit="handleTemporaryMedicalSubmit"
@cancel="handleTemporaryMedicalCancel"
@delete-advice="handleDeleteTemporaryAdvice"
/>
</el-dialog>
</div>
</template>
@@ -810,6 +825,9 @@ import { useDict } from '@/utils/dict'
import download from '@/plugins/download'
import Prescriptionlist from '@/views/clinicmanagement/bargain/component/prescriptionlist.vue'
import useUserStore from '@/store/modules/user'
import { ElMessage } from 'element-plus'
// 导入计费相关接口
import { getPrescriptionList } from '@/views/clinicmanagement/bargain/component/api'
// API 导入
import { getSurgerySchedulePage, addSurgerySchedule, updateSurgerySchedule, deleteSurgerySchedule, getSurgeryScheduleDetail } from '@/api/surgicalschedule'
@@ -820,6 +838,7 @@ import { getTestResultPage} from '@/views/inpatientDoctor/home/components/applic
import { getTenantPage } from '@/api/system/tenant'
import { getContract } from '@/views/inpatientDoctor/home/components/api.js'
import SurgeryCharge from '../charge/surgerycharge/index.vue'
import TemporaryMedical from './temporaryMedical.vue'
const { proxy } = getCurrentInstance()
const userStore = useUserStore()
@@ -947,6 +966,13 @@ const chargePatientInfo = ref({})
const chargeSurgeryInfo = ref({})
const prescriptionRef = ref()
// 临时医嘱弹窗
const showTemporaryMedical = ref(false)
const temporaryMedicalTitle = ref('门诊术中临时医嘱')
const temporaryPatientInfo = ref({})
const temporaryBillingMedicines = ref([])
const temporaryAdvices = ref([])
// 下拉列表数据
const orgList = ref([])
const deptList = ref([])
@@ -1026,8 +1052,7 @@ function loadOrgList() {
orgList.value = []
}
})
.catch(error => {
console.error('加载卫生机构列表失败:', error)
.catch(() => {
proxy.$modal.msgError('获取卫生机构列表失败')
orgList.value = []
})
@@ -1046,7 +1071,6 @@ function loadDeptList() {
}
})
.catch(error => {
console.error('加载科室列表失败:', error)
proxy.$modal.msgError('获取科室列表失败')
deptList.value = []
})
@@ -1065,7 +1089,6 @@ function loadDoctorList() {
}
})
.catch(error => {
console.error('加载医生列表失败:', error)
proxy.$modal.msgError('获取医生列表失败')
doctorList.value = []
})
@@ -1084,7 +1107,6 @@ function loadNurseList() {
}
})
.catch(error => {
console.error('加载护士列表失败:', error)
proxy.$modal.msgError('获取护士列表失败')
nurseList.value = []
})
@@ -1103,7 +1125,6 @@ function loadOperatingRoomList() {
}
})
.catch(error => {
console.error('加载手术室列表失败:', error)
proxy.$modal.msgError('获取手术室列表失败')
operatingRoomList.value = []
})
@@ -1116,7 +1137,6 @@ function getList() {
surgeryList.value = res.data.records
total.value = res.data.total
}).catch(error => {
console.error('获取手术安排列表失败:', error)
proxy.$modal.msgError('获取手术安排列表失败,请稍后重试')
surgeryList.value = []
total.value = 0
@@ -1170,8 +1190,7 @@ function handleEdit(row) {
} else {
proxy.$modal.msgError('获取手术安排详情失败')
}
}).catch(error => {
console.error('获取手术安排详情失败:', error)
}).catch(() => {
proxy.$modal.msgError('获取手术安排详情失败')
})
open.value = true
@@ -1190,8 +1209,7 @@ function handleView(row) {
} else {
proxy.$modal.msgError('获取手术安排详情失败')
}
}).catch(error => {
console.error('获取手术安排详情失败:', error)
}).catch(() => {
proxy.$modal.msgError('获取手术安排详情失败')
})
open.value = true
@@ -1215,7 +1233,8 @@ function handleDelete(row) {
}).then(() => {
getPageList()
proxy.$modal.msgSuccess('手术安排已取消')
}).catch(error => {
}).catch(() => {
return
})
}
@@ -1232,32 +1251,18 @@ async function handleChargeCharge(row) {
return
}
console.log('计费按钮被点击,行数据:', row)
// 检查用户信息中的机构信息
console.log('完整的用户信息:', JSON.stringify(userStore, null, 2))
console.log('用户机构信息:', {
organizationId: userStore.organizationId,
orgId: userStore.orgId,
tenantId: userStore.tenantId,
userInfo: userStore.userInfo
})
// 调用接口获取账户信息
let accountId = null
try {
const contractResult = await getContract({ encounterId: row.visitId })
console.log('账户信息接口返回:', contractResult)
if (contractResult.code === 200 && contractResult.data && contractResult.data.length > 0) {
// 从返回数据中提取accountId - data是数组取第一个元素的accountId
accountId = contractResult.data[0].accountId || contractResult.data[0].id
console.log('获取到的accountId:', accountId)
} else {
console.warn('获取账户信息失败:', contractResult.msg)
proxy.$modal.msgError('获取账户信息失败')
}
} catch (error) {
console.error('调用账户信息接口出错:', error)
return
}
// 设置计费弹窗数据 - 直接复制划价页面的逻辑
@@ -1279,7 +1284,9 @@ async function handleChargeCharge(row) {
// 添加账户ID
accountId: accountId,
// 添加手术申请单号用于追溯
sourceBillNo: row.applyId || row.operCode
sourceBillNo: row.applyId,
//添加计费标志手术计费
generateSourceEnum: 6
}
chargeSurgeryInfo.value = {
@@ -1287,21 +1294,12 @@ async function handleChargeCharge(row) {
surgeryNo: row.operCode
}
console.log('计费弹窗数据设置完成:', {
chargeDialogTitle: chargeDialogTitle.value,
chargePatientInfo: chargePatientInfo.value,
chargeSurgeryInfo: chargeSurgeryInfo.value
})
// 打开计费弹窗
showChargeDialog.value = true
console.log('计费弹窗状态:', showChargeDialog.value)
// 延迟加载处方列表,确保组件已经渲染
nextTick(() => {
console.log('nextTick执行prescriptionRef:', prescriptionRef.value)
if (prescriptionRef.value && prescriptionRef.value.getListInfo) {
console.log('调用prescriptionRef.getListInfo()')
prescriptionRef.value.getListInfo()
}
})
@@ -1314,6 +1312,114 @@ function closeChargeDialog() {
chargeSurgeryInfo.value = {}
}
// 处理医嘱按钮点击事件
function handleMedicalAdvice(row) {
// 如果没有传入行数据,使用选中的行
if (!row && selectedRow.value) {
row = selectedRow.value
}
// 如果还是没有行数据,显示提示
if (!row) {
proxy.$modal.msgWarning('请先选择要开具医嘱的手术安排')
return
}
// 设置临时医嘱弹窗数据
temporaryPatientInfo.value = {
patientName: row.patientName,
visitId: row.visitId,
operCode: row.operCode,
roomCode: row.roomCode,
doctorName: userStore.nickName,
role: userStore.roles[0],
}
// 初始化临时医嘱列表
temporaryAdvices.value = []
// 调用计费接口获取数据
getPrescriptionList(row.visitId).then((res) => {
if (res.code === 200 && res.data) {
// 过滤数据,只保留 adviceType 值为 1 的药品
const filteredItems = res.data.filter(item => {
try {
// 尝试从 contentJson 中解析数据
const contentData = JSON.parse(item.contentJson)
const adviceType = Number(contentData.adviceType)
return adviceType === 3
} catch (e) {
// 如果解析失败,尝试使用顶层的 adviceType
const adviceType = Number(item.adviceType)
return adviceType === 3
}
})
// 将过滤后的数据转换为临时医嘱需要的格式
temporaryBillingMedicines.value = filteredItems.map(item => {
try {
// 从 contentJson 中解析详细数据
const contentData = JSON.parse(item.contentJson)
return {
medicineName: contentData.adviceName || item.adviceName || '',
specification: contentData.volume || contentData.specification || '',
quantity: contentData.quantity || item.quantity || 0,
batchNumber: contentData.lotNumber || item.lotNumber || '',
unitPrice: contentData.unitPrice || item.unitPrice || 0,
subtotal: contentData.totalPrice || item.totalPrice || 0,
insuranceType: contentData.insuranceType === 1 ? '医保' : '自费'
}
} catch (e) {
// 如果解析失败,使用顶层数据
return {
medicineName: item.adviceName || '',
specification: item.specification || '',
quantity: item.quantity || 0,
batchNumber: item.lotNumber || '',
unitPrice: item.unitPrice || 0,
subtotal: item.totalPrice || 0,
insuranceType: item.insuranceType === 1 ? '医保' : '自费'
}
}
})
} else {
// 如果没有数据或接口调用失败,初始化空列表
temporaryBillingMedicines.value = []
}
}).catch(() => {
temporaryBillingMedicines.value = []
})
// 打开临时医嘱弹窗
showTemporaryMedical.value = true
}
// 关闭临时医嘱弹窗
function closeTemporaryMedical() {
showTemporaryMedical.value = false
temporaryPatientInfo.value = {}
temporaryBillingMedicines.value = []
temporaryAdvices.value = []
}
// 处理临时医嘱提交
function handleTemporaryMedicalSubmit(data) {
// 这里可以调用后端API保存临时医嘱数据
proxy.$modal.msgSuccess('临时医嘱提交成功')
closeTemporaryMedical()
}
// 处理临时医嘱取消
function handleTemporaryMedicalCancel() {
closeTemporaryMedical()
}
// 处理删除临时医嘱
function handleDeleteTemporaryAdvice(index) {
temporaryAdvices.value.splice(index, 1)
proxy.$modal.msgSuccess('临时医嘱已删除')
}
// 格式化计费弹窗中的日期
function formatChargeDate(date) {
if (!date) return '-'
@@ -1394,15 +1500,13 @@ function submitForm() {
proxy.$refs['surgeryRef'].validate((valid) => {
if (valid) {
const submitData = { ...form }
console.log("scheduleId:", form.scheduleId)
if (!form.scheduleId) {
// 新增手术安排
addSurgerySchedule(submitData).then((res) => {
proxy.$modal.msgSuccess('新增成功')
open.value = false
getPageList()
}).catch(error => {
console.error('新增手术安排失败:', error)
}).catch(() => {
proxy.$message.error('新增手术安排失败,请检查表单信息')
})
} else {
@@ -1411,8 +1515,7 @@ function submitForm() {
proxy.$modal.msgSuccess('修改成功')
open.value = false
getPageList()
}).catch(error => {
console.error('更新手术安排失败:', error)
}).catch(() => {
proxy.$message.error('更新手术安排失败,请检查表单信息')
})
}
@@ -1455,8 +1558,7 @@ function getSurgicalScheduleList() {
const responseData = res.data.data || res.data
applyList.value = responseData.records || []
applyTotal.value = responseData.total || 0
}).catch(error => {
console.error('获取手术申请列表失败:', error)
}).catch(() => {
proxy.$modal.msgError('获取手术申请列表失败,请稍后重试')
applyList.value = []
applyTotal.value = 0