添加申请单表单患者信息自动填充姓名、就诊卡号、费用性质,以及申请医生和申请科室的输入框格式,
依据申请单和申请单明细表字段修改表单变量名。
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--检验信息-->
|
||||
<el-table
|
||||
ref="inspectionTableRef"
|
||||
:data="inspectionList"
|
||||
@@ -29,17 +29,17 @@
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="申请ID" prop="applicationId" width="90" align="center" />
|
||||
<el-table-column label="申请单号" prop="applicationNo" width="140" align="center" />
|
||||
<el-table-column label="申请单号" prop="applyNo" width="140" align="center" />
|
||||
<el-table-column label="检验项目" prop="inspectionItem" width="150" align="center" />
|
||||
<el-table-column label="申请医生" prop="doctorName" width="120" align="center" />
|
||||
<el-table-column label="申请医生" prop="applyDocName" width="120" align="center" />
|
||||
<el-table-column label="急" width="60" align="center">
|
||||
<template #default="scope">
|
||||
<el-checkbox :model-value="scope.row.isUrgent" disabled />
|
||||
<el-checkbox :model-value="scope.row.priorityCode" disabled />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="收费" width="80" align="center">
|
||||
<template #default="scope">
|
||||
<el-checkbox :model-value="scope.row.needCharge" disabled />
|
||||
<el-checkbox :model-value="scope.row.applyStatus" disabled />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="退费" width="80" align="center">
|
||||
@@ -79,7 +79,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 下方:申请单和检验项目选择器 -->
|
||||
<!-- 下方:申请单和检验项目选择器 -->
|
||||
<div style="display: flex; gap: 20px">
|
||||
<!-- 左侧:申请单和检验信息 -->
|
||||
<div style="width: 55%">
|
||||
@@ -88,22 +88,22 @@
|
||||
<div class="application-form" style="padding: 20px; height: 700px; overflow-y: auto; border: 1px solid #e4e7ed; border-radius: 4px; margin: 10px;">
|
||||
<div style="margin-bottom: 20px">
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">申请单号</label>
|
||||
<el-input v-model="formData.applicationNo" disabled size="small" />
|
||||
<el-input v-model="formData.applyNo" readonly size="small" />
|
||||
</div>
|
||||
|
||||
<!-- 患者信息行 -->
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; margin-bottom: 20px">
|
||||
<div>
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">姓名</label>
|
||||
<el-input v-model="formData.patientName" disabled size="small" />
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">姓名<span style="color: #f56c6c">*</span></label>
|
||||
<el-input v-model="formData.patientName" readonly size="small" />
|
||||
</div>
|
||||
<div>
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">就诊卡号</label>
|
||||
<el-input v-model="formData.cardNo" disabled size="small" />
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">就诊卡号<span style="color: #f56c6c">*</span></label>
|
||||
<el-input v-model="formData.medicalrecordNumber" readonly size="small" />
|
||||
</div>
|
||||
<div>
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">费用性质</label>
|
||||
<el-select v-model="formData.feeType" placeholder="请选择费用性质" size="small" style="width: 100%">
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">费用性质<span style="color: #f56c6c">*</span></label>
|
||||
<el-select v-model="formData.natureofCost" placeholder="请选择费用性质" size="small" style="width: 100%">
|
||||
<el-option label="自费医疗" value="self" />
|
||||
<el-option label="医保" value="medical" />
|
||||
<el-option label="公费医疗" value="public" />
|
||||
@@ -115,10 +115,11 @@
|
||||
|
||||
<!-- 申请信息行 -->
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; margin-bottom: 20px">
|
||||
<!--申请日期-->
|
||||
<div>
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">申请日期</label>
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">申请日期<span style="color: #f56c6c">*</span></label>
|
||||
<el-date-picker
|
||||
v-model="formData.applicationDate"
|
||||
v-model="formData.applyTime"
|
||||
type="datetime"
|
||||
placeholder="选择日期时间"
|
||||
size="small"
|
||||
@@ -127,21 +128,16 @@
|
||||
style="width: 100%"
|
||||
/>
|
||||
</div>
|
||||
<!--申请科室-->
|
||||
<div>
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">申请科室</label>
|
||||
<el-select v-model="formData.departmentName" placeholder="请选择申请科室" size="small" style="width: 100%" disabled>
|
||||
<el-option label="内科" value="internal" />
|
||||
<el-option label="外科" value="surgery" />
|
||||
<el-option label="儿科" value="pediatrics" />
|
||||
</el-select>
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">申请科室<span style="color: #f56c6c">*</span></label>
|
||||
<el-input v-model="formData.applyDepartment" readonly size="small" />
|
||||
</div>
|
||||
|
||||
<!--申请医生-->
|
||||
<div>
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">申请医生</label>
|
||||
<el-select v-model="formData.doctorName" placeholder="请选择申请医生" size="small" style="width: 100%" disabled>
|
||||
<el-option label="张医生" value="doctor_zhang" />
|
||||
<el-option label="李医生" value="doctor_li" />
|
||||
<el-option label="王医生" value="doctor_wang" />
|
||||
</el-select>
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">申请医生<span style="color: #f56c6c">*</span></label>
|
||||
<el-input v-model="formData.applyDocName" readonly size="small" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -164,29 +160,29 @@
|
||||
<div v-if="validationErrors.executeDepartment" class="error-message">请选择执行科室</div>
|
||||
</div>
|
||||
|
||||
<!-- 诊断相关字段 -->
|
||||
<!-- 诊断描述 -->
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px">
|
||||
<div :class="{ 'form-item-error': validationErrors.diagnosisDesc }">
|
||||
<div :class="{ 'form-item-error': validationErrors.clinicDesc }">
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">诊断描述 <span style="color: #f56c6c">*</span></label>
|
||||
<el-input
|
||||
v-model="formData.diagnosisDesc"
|
||||
v-model="formData.clinicDesc"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
size="small"
|
||||
:class="{ 'is-error': validationErrors.diagnosisDesc }"
|
||||
:class="{ 'is-error': validationErrors.clinicDesc }"
|
||||
/>
|
||||
<div v-if="validationErrors.diagnosisDesc" class="error-message">请输入诊断描述</div>
|
||||
<div v-if="validationErrors.clinicDesc" class="error-message">请输入诊断描述</div>
|
||||
</div>
|
||||
<div :class="{ 'form-item-error': validationErrors.clinicalDiagnosis }">
|
||||
<div :class="{ 'form-item-error': validationErrors.clinicDiag }">
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">临床诊断 <span style="color: #f56c6c">*</span></label>
|
||||
<el-input
|
||||
v-model="formData.clinicalDiagnosis"
|
||||
v-model="formData.clinicDiag"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
size="small"
|
||||
:class="{ 'is-error': validationErrors.clinicalDiagnosis }"
|
||||
:class="{ 'is-error': validationErrors.clinicDiag }"
|
||||
/>
|
||||
<div v-if="validationErrors.clinicalDiagnosis" class="error-message">请输入临床诊断</div>
|
||||
<div v-if="validationErrors.clinicDiag" class="error-message">请输入临床诊断</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -194,29 +190,29 @@
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px">
|
||||
<div>
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">禁忌症</label>
|
||||
<el-input v-model="formData.contraindications" type="textarea" :rows="2" size="small" />
|
||||
<el-input v-model="formData.contraindication" type="textarea" :rows="2" size="small" />
|
||||
</div>
|
||||
<div :class="{ 'form-item-error': validationErrors.medicalHistory }">
|
||||
<div :class="{ 'form-item-error': validationErrors.medicalHistorySummary }">
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">病史摘要 <span style="color: #f56c6c">*</span></label>
|
||||
<el-input
|
||||
v-model="formData.medicalHistory"
|
||||
v-model="formData.medicalHistorySummary"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
size="small"
|
||||
:class="{ 'is-error': validationErrors.medicalHistory }"
|
||||
:class="{ 'is-error': validationErrors.medicalHistorySummary }"
|
||||
/>
|
||||
<div v-if="validationErrors.medicalHistory" class="error-message">请输入病史摘要</div>
|
||||
<div v-if="validationErrors.medicalHistorySummary" class="error-message">请输入病史摘要</div>
|
||||
</div>
|
||||
<div :class="{ 'form-item-error': validationErrors.inspectionPurpose }">
|
||||
<div :class="{ 'form-item-error': validationErrors.purposeofInspection }">
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">检验目的 <span style="color: #f56c6c">*</span></label>
|
||||
<el-input
|
||||
v-model="formData.inspectionPurpose"
|
||||
v-model="formData.purposeofInspection"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
size="small"
|
||||
:class="{ 'is-error': validationErrors.inspectionPurpose }"
|
||||
:class="{ 'is-error': validationErrors.purposeofInspection }"
|
||||
/>
|
||||
<div v-if="validationErrors.inspectionPurpose" class="error-message">请输入检验目的</div>
|
||||
<div v-if="validationErrors.purposeofInspection" class="error-message">请输入检验目的</div>
|
||||
</div>
|
||||
<div>
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">体格检查</label>
|
||||
@@ -232,7 +228,7 @@
|
||||
</div>
|
||||
<div>
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: bold">备注</label>
|
||||
<el-input v-model="formData.remark" type="textarea" :rows="2" size="small" />
|
||||
<el-input v-model="formData.applyRemark" type="textarea" :rows="2" size="small" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -240,15 +236,14 @@
|
||||
<div style="margin-bottom: 20px; padding: 15px; background: #f8f9fa; border-radius: 4px; border: 1px solid #e9ecef">
|
||||
<label style="display: block; margin-bottom: 10px; font-weight: bold; color: #1a2b6d">状态设置</label>
|
||||
<div style="display: flex; gap: 30px; flex-wrap: wrap">
|
||||
<el-checkbox v-model="formData.isUrgent">急</el-checkbox>
|
||||
<el-checkbox v-model="formData.needCharge" checked>收费</el-checkbox>
|
||||
<el-checkbox v-model="formData.priorityCode" :true-value="1" :false-value="0">急</el-checkbox>
|
||||
<el-checkbox v-model="formData.applyStatus" :true-value="1" :false-value="0">收费</el-checkbox>
|
||||
<el-checkbox v-model="formData.needRefund">退费</el-checkbox>
|
||||
<el-checkbox v-model="formData.needExecute">执行</el-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="检验信息" name="inspectionInfo">
|
||||
<div style="padding: 20px; height: 700px; overflow-y: auto; border: 1px solid #e4e7ed; border-radius: 4px; margin: 10px;">
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px">
|
||||
@@ -290,22 +285,22 @@
|
||||
<div style="margin-top: 20px">
|
||||
<h4 style="margin-bottom: 10px; font-weight: bold">检验信息详情</h4>
|
||||
<el-table :data="selectedInspectionItems" border size="small" style="width: 100%" max-height="300">
|
||||
<el-table-column label="检验信息" prop="name" width="200" />
|
||||
<el-table-column label="项目名称" prop="itemName" width="200" />
|
||||
<el-table-column label="样本类型" prop="sampleType" width="80" align="center" />
|
||||
<el-table-column label="单位" prop="unit" width="60" align="center" />
|
||||
<el-table-column label="总量" width="60" align="center">
|
||||
<el-table-column label="总量" prop="itemQty" width="60" align="center">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.quantity || 1 }}</span>
|
||||
<span>{{ scope.row.itemQty || 1 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单价" width="70" align="right">
|
||||
<el-table-column label="单价" prop="itemPrice" width="70" align="right">
|
||||
<template #default="scope">
|
||||
¥{{ scope.row.price }}
|
||||
¥{{ scope.row.itemPrice }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="金额" width="70" align="right">
|
||||
<el-table-column label="金额" prop="itemAmount" width="70" align="right">
|
||||
<template #default="scope">
|
||||
¥{{ (scope.row.quantity || 1) * scope.row.price }}
|
||||
¥{{ scope.row.itemAmount }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="服务费" width="70" align="right">
|
||||
@@ -371,8 +366,8 @@
|
||||
@change="toggleInspectionItem(item)"
|
||||
@click.stop
|
||||
/>
|
||||
<span class="item-name">{{ item.name }}</span>
|
||||
<span class="item-price">¥{{ item.price }}</span>
|
||||
<span class="item-itemName">{{ item.itemName }}</span>
|
||||
<span class="item-price">¥{{ item.itemPrice }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -395,8 +390,8 @@
|
||||
class="selected-tree-item"
|
||||
>
|
||||
<div class="selected-item-content">
|
||||
<span class="item-name">{{ item.name }}</span>
|
||||
<span class="item-price">¥{{ item.price }}</span>
|
||||
<span class="item-itemName">{{ item.itemName }}</span>
|
||||
<span class="item-price">¥{{ item.itemPrice }}</span>
|
||||
<el-button
|
||||
type="text"
|
||||
size="small"
|
||||
@@ -422,6 +417,43 @@
|
||||
import {onMounted, reactive, ref, watch} from 'vue'
|
||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||
import {deleteInspectionApplication, getInspectionApplicationList, saveInspectionApplication} from '../api'
|
||||
import useUserStore from '@/store/modules/user.js'
|
||||
import {storeToRefs} from 'pinia'
|
||||
import {listType} from "@/api/system/dict/type.js";
|
||||
|
||||
|
||||
// const getCurrentDeptCode = async () => {
|
||||
// // try {
|
||||
// const res = await listType({ dictType: 'dept' }); // 按字典类型查询科室
|
||||
// console.log('【检验】获取科室字典数据:', res.data)
|
||||
// deptOptions.value = res.data;
|
||||
// console.log('【检验】科室字典数据:',deptOptions.value)
|
||||
|
||||
// // 获取当前科室名称(来自患者信息)
|
||||
// const currentDeptName = props.patientInfo?.organizationName;
|
||||
// console.log('【检验】当前科室名称:', currentDeptName)
|
||||
//
|
||||
// // 根据当前科室名称查找对应的编码
|
||||
// const deptItem = res.data.find(item => item.dictLabel === currentDeptName);
|
||||
// console.log('【检验】找到的科室名称:', deptItem)
|
||||
// if (deptItem) {
|
||||
// return deptItem.dictValue; // 返回科室编码
|
||||
// } else {
|
||||
// console.warn(`未找到科室名称为 ${currentDeptName} 的对应编码`);
|
||||
// return currentDeptName || ''; // 使用原始名称作为默认值,符合防御性编程原则
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.error('获取科室字典数据失败:', error);
|
||||
// return '';
|
||||
// }
|
||||
// }
|
||||
// 在 onMounted 中调用初始化函数
|
||||
onMounted(async () => {
|
||||
await initData();
|
||||
// 设置当前科室编码
|
||||
// const currentDeptCode = await getCurrentDeptCode();
|
||||
// formData.applyDeptCode = currentDeptCode || '';
|
||||
})
|
||||
|
||||
// Props
|
||||
const props = defineProps({
|
||||
@@ -442,6 +474,33 @@ const showForm = ref(false)
|
||||
const loading = ref(false)
|
||||
const total = ref(0)
|
||||
const leftActiveTab = ref('application')
|
||||
const deptOptions = ref([])
|
||||
|
||||
// 用户信息store
|
||||
const userStore = useUserStore()
|
||||
const { id: userId, name: userName, nickName: userNickName } = storeToRefs(userStore)
|
||||
|
||||
// 修改 initData 函数
|
||||
async function initData() {
|
||||
// 然后执行原有的初始化逻辑
|
||||
if (props.patientInfo) {
|
||||
queryParams.encounterId = props.patientInfo.encounterId
|
||||
formData.visitNo = props.patientInfo.busNo || ''
|
||||
formData.patientId = props.patientInfo.patientId || ''
|
||||
formData.patientName = props.patientInfo.patientName || ''
|
||||
formData.medicalrecordNumber = props.patientInfo.identifierNo || ''
|
||||
formData.applyDepartment = props.patientInfo.organizationName || ''
|
||||
formData.operatorId = userId.value || ''
|
||||
formData.applyDocName = userNickName.value || userName.value || ''
|
||||
formData.applyDocCode = userId.value || ''
|
||||
formData.specimenName = '血液'
|
||||
}
|
||||
|
||||
// 只有在存在 encounterId 时才调用接口
|
||||
if (queryParams.encounterId) {
|
||||
getInspectionList()
|
||||
}
|
||||
}
|
||||
|
||||
// 查询参数
|
||||
const queryParams = reactive({
|
||||
@@ -456,43 +515,49 @@ const inspectionList = ref([])
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
applicationId: null,
|
||||
applicationNo: '202511210001',
|
||||
applyNo: '202511210001',
|
||||
patientId:'',
|
||||
patientName: '',
|
||||
cardNo: '',
|
||||
feeType: 'self',
|
||||
applicationDate: new Date(),
|
||||
departmentName: '',
|
||||
doctorName: '',
|
||||
medicalrecordNumber: '',
|
||||
natureofCost: 'self',
|
||||
applyTime: new Date(),
|
||||
applyDepartment: '',
|
||||
applyDocName: '',
|
||||
executeDepartment: 'medical_lab',
|
||||
diagnosisDesc: '',
|
||||
contraindications: '',
|
||||
clinicalDiagnosis: '',
|
||||
medicalHistory: '',
|
||||
inspectionPurpose: '',
|
||||
clinicDesc: '',
|
||||
contraindication: '',
|
||||
clinicDiag: '',
|
||||
medicalHistorySummary: '',
|
||||
purposeofInspection: '',
|
||||
physicalExam: '',
|
||||
inspectionItems: [],
|
||||
labApplyItemList: [],
|
||||
inspectionItemsText: '',
|
||||
remark: '',
|
||||
isUrgent: false,
|
||||
needCharge: true,
|
||||
applyRemark: '',
|
||||
priorityCode: 0,
|
||||
applyStatus: 1,
|
||||
needRefund: false,
|
||||
needExecute: false,
|
||||
inspectionDoctor: '',
|
||||
inspectionTime: null,
|
||||
auditDoctor: '',
|
||||
auditTime: null
|
||||
auditTime: null,
|
||||
visitNo: '',
|
||||
applyDocCode:'',
|
||||
applyDeptCode: '',
|
||||
operatorId: '',
|
||||
specimenName: '血液',
|
||||
})
|
||||
|
||||
// 表单验证规则
|
||||
const formRules = {
|
||||
feeType: [{ required: true, message: '请选择费用性质', trigger: 'change' }],
|
||||
applicationDate: [{ required: true, message: '请选择申请日期', trigger: 'change' }],
|
||||
natureofCost: [{ required: true, message: '请选择费用性质', trigger: 'change' }],
|
||||
applyTime: [{ required: true, message: '请选择申请日期', trigger: 'change' }],
|
||||
executeDepartment: [{ required: true, message: '请选择执行科室', trigger: 'change' }],
|
||||
diagnosisDesc: [{ required: true, message: '请输入诊断描述', trigger: 'blur' }],
|
||||
clinicalDiagnosis: [{ required: true, message: '请输入临床诊断', trigger: 'blur' }],
|
||||
medicalHistory: [{ required: true, message: '请输入病史摘要', trigger: 'blur' }],
|
||||
inspectionPurpose: [{ required: true, message: '请输入检验目的', trigger: 'blur' }],
|
||||
inspectionItems: [{ required: true, message: '请至少选择一个检验项目', trigger: 'change' }]
|
||||
clinicDesc: [{ required: true, message: '请输入诊断描述', trigger: 'blur' }],
|
||||
clinicDiag: [{ required: true, message: '请输入临床诊断', trigger: 'blur' }],
|
||||
medicalHistorySummary: [{ required: true, message: '请输入病史摘要', trigger: 'blur' }],
|
||||
purposeofInspection: [{ required: true, message: '请输入检验目的', trigger: 'blur' }],
|
||||
labApplyItemList: [{ required: true, message: '请至少选择一个检验项目', trigger: 'change' }]
|
||||
}
|
||||
|
||||
// 表单引用
|
||||
@@ -504,11 +569,11 @@ const inspectionTableRef = ref()
|
||||
// 验证错误状态
|
||||
const validationErrors = reactive({
|
||||
executeDepartment: false,
|
||||
diagnosisDesc: false,
|
||||
clinicalDiagnosis: false,
|
||||
medicalHistory: false,
|
||||
inspectionPurpose: false,
|
||||
inspectionItems: false
|
||||
clinicDesc: false,
|
||||
clinicDiag: false,
|
||||
medicalHistorySummary: false,
|
||||
purposeofInspection: false,
|
||||
labApplyItemList: false
|
||||
})
|
||||
|
||||
// 已选择的表格行
|
||||
@@ -524,15 +589,15 @@ const searchKeyword = ref('')
|
||||
const activeCategory = ref('biochemical')
|
||||
|
||||
// 检验项目分类(树形结构)
|
||||
const inspectionCategories = ref([
|
||||
let inspectionCategories = ref([
|
||||
{
|
||||
key: 'biochemical',
|
||||
label: '生化',
|
||||
expanded: true,
|
||||
items: [
|
||||
{ id: 1, name: '肝功能', price: 31, sampleType: '血清', unit: 'U/L', quantity: 1, serviceFee: 0, type: '生化', isSelfPay: false },
|
||||
{ id: 2, name: '肾功能', price: 28, sampleType: '血清', unit: 'U/L', quantity: 1, serviceFee: 0, type: '生化', isSelfPay: false },
|
||||
{ id: 3, name: '血糖', price: 15, sampleType: '血清', unit: 'mmol/L', quantity: 1, serviceFee: 0, type: '生化', isSelfPay: false }
|
||||
{ id: 1, itemName: '肝功能', itemPrice: 31, itemAmount: 31, sampleType: '血清', unit: 'U/L', itemQty: 1, serviceFee: 0, type: '生化', isSelfPay: false },
|
||||
{ id: 2, itemName: '肾功能', itemPrice: 28, itemAmount: 28, sampleType: '血清', unit: 'U/L', itemQty: 1, serviceFee: 0, type: '生化', isSelfPay: false },
|
||||
{ id: 3, itemName: '血糖', itemPrice: 15, itemAmount: 15, sampleType: '血清', unit: 'mmol/L', itemQty: 1, serviceFee: 0, type: '生化', isSelfPay: false }
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -540,8 +605,8 @@ const inspectionCategories = ref([
|
||||
label: '临检',
|
||||
expanded: false,
|
||||
items: [
|
||||
{ id: 4, name: '血常规+crp', price: 50, sampleType: '全血', unit: '×10^9/L', quantity: 1, serviceFee: 0, type: '血液', isSelfPay: false },
|
||||
{ id: 5, name: '血常规(五分类)', price: 15, sampleType: '全血', unit: '×10^9/L', quantity: 1, serviceFee: 0, type: '血液', isSelfPay: false }
|
||||
{ id: 4, itemName: '血常规+crp', itemPrice: 50, itemAmount: 50, sampleType: '全血', unit: '×10^9/L', itemQty: 1, serviceFee: 0, type: '血液', isSelfPay: false },
|
||||
{ id: 5, itemName: '血常规(五分类)', itemPrice: 15, itemAmount: 15, sampleType: '全血', unit: '×10^9/L', itemQty: 1, serviceFee: 0, type: '血液', isSelfPay: false }
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -549,7 +614,7 @@ const inspectionCategories = ref([
|
||||
label: '尿液',
|
||||
expanded: false,
|
||||
items: [
|
||||
{ id: 6, name: '尿常规', price: 20, sampleType: '尿液', unit: '细胞/μl', quantity: 1, serviceFee: 0, type: '尿液', isSelfPay: false }
|
||||
{ id: 6, itemName: '尿常规', itemPrice: 20, itemAmount: 20, sampleType: '尿液', unit: '细胞/μl', itemQty: 1, serviceFee: 0, type: '尿液', isSelfPay: false }
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -557,8 +622,8 @@ const inspectionCategories = ref([
|
||||
label: '免疫',
|
||||
expanded: false,
|
||||
items: [
|
||||
{ id: 7, name: '总IgE测定', price: 30, sampleType: '血清', unit: 'IU/ml', quantity: 1, serviceFee: 0, type: '免疫', isSelfPay: false },
|
||||
{ id: 8, name: '风湿', price: 119, sampleType: '血清', unit: 'U/ml', quantity: 1, serviceFee: 0, type: '免疫', isSelfPay: false }
|
||||
{ id: 7, itemName: '总IgE测定', itemPrice: 30, itemAmount: 30, sampleType: '血清', unit: 'IU/ml', itemQty: 1, serviceFee: 0, type: '免疫', isSelfPay: false },
|
||||
{ id: 8, itemName: '风湿', itemPrice: 119, itemAmount: 119, sampleType: '血清', unit: 'U/ml', itemQty: 1, serviceFee: 0, type: '免疫', isSelfPay: false }
|
||||
]
|
||||
}
|
||||
])
|
||||
@@ -573,70 +638,39 @@ const getFilteredItems = (categoryKey) => {
|
||||
}
|
||||
|
||||
return category.items.filter(item =>
|
||||
item.name.toLowerCase().includes(searchKeyword.value.toLowerCase())
|
||||
item.itemName.toLowerCase().includes(searchKeyword.value.toLowerCase())
|
||||
)
|
||||
}
|
||||
|
||||
// 初始化数据
|
||||
function initData() {
|
||||
console.log('检验组件初始化,patientInfo:', props.patientInfo)
|
||||
if (props.patientInfo) {
|
||||
// 确保 encounterId 存在且有效,优先使用 encounterId,其次尝试 id,最后尝试 patientId
|
||||
queryParams.encounterId = props.patientInfo.encounterId || props.patientInfo.id || props.patientInfo.patientId
|
||||
formData.patientName = props.patientInfo.patientName || ''
|
||||
formData.cardNo = props.patientInfo.cardNo || ''
|
||||
formData.departmentName = props.patientInfo.departmentName || ''
|
||||
formData.doctorName = props.patientInfo.doctorName || ''
|
||||
}
|
||||
|
||||
// 只有在存在有效的 encounterId 时才调用接口
|
||||
if (queryParams.encounterId && queryParams.encounterId !== 'undefined' && queryParams.encounterId !== 'null' && queryParams.encounterId !== '') {
|
||||
getInspectionList()
|
||||
} else {
|
||||
console.warn('缺少有效的就诊ID,无法获取检验申请单列表')
|
||||
inspectionList.value = []
|
||||
total.value = 0
|
||||
}
|
||||
}
|
||||
|
||||
// 获取检验申请单列表
|
||||
function getInspectionList() {
|
||||
// 先检查是否有有效的encounterId
|
||||
if (!queryParams.encounterId || queryParams.encounterId === 'undefined' || queryParams.encounterId === 'null') {
|
||||
console.warn('缺少有效的就诊ID,无法获取检验申请单列表')
|
||||
inspectionList.value = []
|
||||
total.value = 0
|
||||
loading.value = false
|
||||
// 如果没有encounterId,不调用接口
|
||||
if (!queryParams.encounterId) {
|
||||
// console.warn('【检验】encounterId为空,不调用接口')
|
||||
return
|
||||
}
|
||||
|
||||
loading.value = true
|
||||
|
||||
// 调用真实的API,只传递 encounterId 参数
|
||||
// console.log('【检验】调用API,encounterId:', queryParams.encounterId)
|
||||
getInspectionApplicationList({ encounterId: queryParams.encounterId }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
inspectionList.value = res.data || []
|
||||
total.value = res.data?.length || 0
|
||||
// console.log('【检验】获取数据成功,数量:', inspectionList.value.length)
|
||||
} else {
|
||||
inspectionList.value = []
|
||||
total.value = 0
|
||||
console.error('获取检验申请单列表失败:', res.message || res.msg)
|
||||
ElMessage.error(res.message || res.msg || '获取检验申请单列表失败')
|
||||
ElMessage.error('获取检验申请单列表失败')
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.error('获取检验申请单列表异常:', error)
|
||||
// console.error('获取检验申请单列表异常:', error)
|
||||
inspectionList.value = []
|
||||
total.value = 0
|
||||
// 提供更友好的错误信息
|
||||
let errorMessage = '获取检验申请单列表异常'
|
||||
if (error.response) {
|
||||
errorMessage += ` (${error.response.status}): ${error.response.data.message || error.response.statusText}`
|
||||
} else if (error.request) {
|
||||
errorMessage += ': 网络请求失败,请检查网络连接'
|
||||
} else {
|
||||
errorMessage += `: ${error.message}`
|
||||
}
|
||||
ElMessage.error(errorMessage)
|
||||
ElMessage.error('获取检验申请单列表异常')
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
@@ -644,10 +678,12 @@ function getInspectionList() {
|
||||
|
||||
// 新增申请单
|
||||
function handleNewApplication() {
|
||||
console.log('点击新增按钮')
|
||||
// console.log('点击新增按钮')
|
||||
resetForm()
|
||||
// 生成申请单号
|
||||
formData.applicationNo = generateApplicationNo()
|
||||
formData.applyNo = generateApplicationNo()
|
||||
// 确保申请医生是当前登录医生
|
||||
formData.applyDocName = userNickName.value || userName.value || ''
|
||||
leftActiveTab.value = 'application'
|
||||
}
|
||||
|
||||
@@ -661,30 +697,37 @@ function generateApplicationNo() {
|
||||
return `${year}${month}${day}${String(timestamp).slice(-3)}`
|
||||
}
|
||||
|
||||
|
||||
// 重置表单
|
||||
function resetForm() {
|
||||
async function resetForm() {
|
||||
Object.assign(formData, {
|
||||
applicationId: null,
|
||||
applicationNo: '',
|
||||
apply: '',
|
||||
patientName: props.patientInfo.patientName || '',
|
||||
cardNo: props.patientInfo.cardNo || '',
|
||||
feeType: 'self',
|
||||
applicationDate: new Date(),
|
||||
departmentName: props.patientInfo.departmentName || '',
|
||||
doctorName: props.patientInfo.doctorName || '',
|
||||
medicalrecordNumber: props.patientInfo.identifierNo || '',
|
||||
natureofCost: 'self',
|
||||
applyTime: new Date(),
|
||||
applyDepartment: props.patientInfo.organizationName || '',
|
||||
applyDeptCode: '',
|
||||
applyDocCode: userId.value || '',
|
||||
applyDocName: userNickName.value || userName.value || '',
|
||||
operatorId: userId.value || '',
|
||||
executeDepartment: 'medical_lab',
|
||||
diagnosisDesc: '',
|
||||
contraindications: '',
|
||||
clinicalDiagnosis: '',
|
||||
medicalHistory: '',
|
||||
inspectionPurpose: '',
|
||||
clinicDesc: '',
|
||||
contraindication: '',
|
||||
clinicDiag: '',
|
||||
medicalHistorySummary: '',
|
||||
purposeofInspection: '',
|
||||
physicalExam: '',
|
||||
inspectionItems: [],
|
||||
remark: '',
|
||||
isUrgent: false,
|
||||
needCharge: true,
|
||||
labApplyItemList: [],
|
||||
applyRemark: '',
|
||||
priorityCode: 0,
|
||||
applyStatus: 1,
|
||||
needRefund: false,
|
||||
needExecute: false
|
||||
needExecute: false,
|
||||
patientId: props.patientInfo.patientId || '',
|
||||
visitNo: '',
|
||||
specimenName: '血液',
|
||||
})
|
||||
selectedInspectionItems.value = []
|
||||
|
||||
@@ -712,32 +755,43 @@ function handleSave() {
|
||||
let hasErrors = false
|
||||
|
||||
// 检查必填字段
|
||||
// 检查必填字段,执行科室
|
||||
if (!formData.executeDepartment) {
|
||||
validationErrors.executeDepartment = true
|
||||
hasErrors = true
|
||||
}
|
||||
if (!formData.diagnosisDesc.trim()) {
|
||||
validationErrors.diagnosisDesc = true
|
||||
// 检查必填字段,诊断描述
|
||||
if (!formData.clinicDesc.trim()) {
|
||||
validationErrors.clinicDesc = true
|
||||
hasErrors = true
|
||||
}
|
||||
if (!formData.clinicalDiagnosis.trim()) {
|
||||
validationErrors.clinicalDiagnosis = true
|
||||
// 检查必填字段,临床诊断
|
||||
if (!formData.clinicDiag.trim()) {
|
||||
validationErrors.clinicDiag = true
|
||||
hasErrors = true
|
||||
}
|
||||
if (!formData.medicalHistory.trim()) {
|
||||
validationErrors.medicalHistory = true
|
||||
// 检查必填字段,病史摘要
|
||||
if (!formData.medicalHistorySummary.trim()) {
|
||||
validationErrors.medicalHistorySummary = true
|
||||
hasErrors = true
|
||||
}
|
||||
if (!formData.inspectionPurpose.trim()) {
|
||||
validationErrors.inspectionPurpose = true
|
||||
// 检查必填字段,检验目的
|
||||
if (!formData.purposeofInspection.trim()) {
|
||||
validationErrors.purposeofInspection = true
|
||||
hasErrors = true
|
||||
}
|
||||
// 检查必填字段,检验项目
|
||||
if (selectedInspectionItems.value.length === 0) {
|
||||
validationErrors.inspectionItems = true
|
||||
validationErrors.labApplyItemList = true
|
||||
hasErrors = true
|
||||
ElMessage.error('请至少选择一项检验项目')
|
||||
return
|
||||
}
|
||||
// 检查必填字段,申请日期
|
||||
if(!formData.applyTime || (typeof formData.applyTime === 'string' && !formData.applyTime.trim())) {
|
||||
validationErrors.applyTime = true
|
||||
hasErrors = true
|
||||
}
|
||||
|
||||
if (hasErrors) {
|
||||
ElMessage.error('请填写所有必填字段')
|
||||
@@ -747,11 +801,11 @@ function handleSave() {
|
||||
// 准备保存数据
|
||||
const saveData = {
|
||||
...formData,
|
||||
inspectionItems: selectedInspectionItems.value,
|
||||
inspectionItemsText: selectedInspectionItems.value.map(item => item.name).join('、'),
|
||||
amount: selectedInspectionItems.value.reduce((sum, item) => sum + item.price, 0),
|
||||
labApplyItemList: selectedInspectionItems.value,
|
||||
inspectionItemsText: selectedInspectionItems.value.map(item => item.itemName).join('、'),
|
||||
amount: selectedInspectionItems.value.reduce((sum, item) => sum + item.itemAmount, 0),
|
||||
serviceFee: selectedInspectionItems.value.reduce((sum, item) => sum + (item.serviceFee || 0), 0),
|
||||
totalAmount: selectedInspectionItems.value.reduce((sum, item) => sum + item.price + (item.serviceFee || 0), 0)
|
||||
totalAmount: selectedInspectionItems.value.reduce((sum, item) => sum + item.itemAmount + (item.serviceFee || 0), 0)
|
||||
}
|
||||
|
||||
console.log('保存检验申请单数据:', saveData)
|
||||
@@ -768,7 +822,7 @@ function handleSave() {
|
||||
ElMessage.error(res.message || '保存失败')
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.error('保存检验申请单异常:', error)
|
||||
// console.error('保存检验申请单异常:', error)
|
||||
ElMessage.error('保存异常')
|
||||
})
|
||||
}
|
||||
@@ -777,8 +831,8 @@ function handleSave() {
|
||||
function handleFormSave() {
|
||||
formRef.value?.validate((valid) => {
|
||||
if (valid) {
|
||||
formData.inspectionItems = selectedInspectionItems.value.map(item => item.id)
|
||||
console.log('保存检验申请单表单数据:', formData)
|
||||
formData.labApplyItemList = selectedInspectionItems.value.map(item => item.id)
|
||||
// console.log('保存检验申请单表单数据:', formData)
|
||||
ElMessage.success('保存成功')
|
||||
showForm.value = false
|
||||
getInspectionList()
|
||||
@@ -788,7 +842,7 @@ function handleFormSave() {
|
||||
|
||||
// 查看详情
|
||||
function handleView(row) {
|
||||
console.log('点击查看按钮,数据:', row)
|
||||
// console.log('点击查看按钮,数据:', row)
|
||||
// 加载表单数据
|
||||
Object.assign(formData, row)
|
||||
|
||||
@@ -828,7 +882,7 @@ function switchCategory(category) {
|
||||
// 处理搜索
|
||||
function handleSearch() {
|
||||
// 搜索逻辑已在getFilteredItems中实现,这里可以添加额外的搜索逻辑
|
||||
console.log('搜索关键词:', searchKeyword.value)
|
||||
// console.log('搜索关键词:', searchKeyword.value)
|
||||
}
|
||||
|
||||
// 处理项目项点击(排除勾选框点击)
|
||||
@@ -847,7 +901,12 @@ function toggleInspectionItem(item) {
|
||||
if (index > -1) {
|
||||
selectedInspectionItems.value.splice(index, 1)
|
||||
} else {
|
||||
selectedInspectionItems.value.push({ ...item })
|
||||
// 创建新对象,包含 itemName 属性(等于 name 属性)
|
||||
const newItem = {
|
||||
...item,
|
||||
itemName: item.itemName
|
||||
};
|
||||
selectedInspectionItems.value.push(newItem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -883,7 +942,7 @@ function handleSelectionChange(selection) {
|
||||
|
||||
// 打印申请单
|
||||
function handlePrint(row) {
|
||||
console.log('打印申请单:', row)
|
||||
// console.log('打印申请单:', row)
|
||||
|
||||
// 切换到申请单TAB
|
||||
leftActiveTab.value = 'application'
|
||||
@@ -957,7 +1016,7 @@ function handlePrint(row) {
|
||||
// 删除申请单
|
||||
function handleDelete(row) {
|
||||
ElMessageBox.confirm(
|
||||
`确定要删除申请单 "${row.applicationNo}" 吗?此操作不可撤销。`,
|
||||
`确定要删除申请单 "${row.applyNo}" 吗?此操作不可撤销。`,
|
||||
'删除确认',
|
||||
{
|
||||
confirmButtonText: '确定删除',
|
||||
@@ -966,7 +1025,7 @@ function handleDelete(row) {
|
||||
confirmButtonClass: 'el-button--danger'
|
||||
}
|
||||
).then(() => {
|
||||
console.log('删除申请单:', row)
|
||||
// console.log('删除申请单:', row)
|
||||
// 调用真实的API删除
|
||||
deleteInspectionApplication(row.applicationId).then((res) => {
|
||||
if (res.code === 200) {
|
||||
@@ -977,7 +1036,7 @@ function handleDelete(row) {
|
||||
ElMessage.error(res.message || '删除失败')
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.error('删除检验申请单异常:', error)
|
||||
// console.error('删除检验申请单异常:', error)
|
||||
ElMessage.error('删除异常')
|
||||
})
|
||||
}).catch(() => {
|
||||
@@ -991,9 +1050,9 @@ function handleCellClick(row, column) {
|
||||
}
|
||||
|
||||
// 监听activeTab变化
|
||||
watch(() => props.activeTab, (newVal) => {
|
||||
watch(() => props.activeTab, async (newVal) => {
|
||||
if (newVal === 'inspection') {
|
||||
initData()
|
||||
await initData()
|
||||
// 默认展开生化分类
|
||||
activeCategory.value = 'biochemical'
|
||||
inspectionCategories.value.forEach(cat => {
|
||||
@@ -1002,33 +1061,32 @@ watch(() => props.activeTab, (newVal) => {
|
||||
}
|
||||
})
|
||||
|
||||
// 监听patientInfo变化,确保在患者信息更新时也更新检验申请单列表
|
||||
watch(() => props.patientInfo, (newPatientInfo) => {
|
||||
if (newPatientInfo && Object.keys(newPatientInfo).length > 0) {
|
||||
// 更新encounterId
|
||||
queryParams.encounterId = newPatientInfo.encounterId || newPatientInfo.id || newPatientInfo.patientId
|
||||
// 如果有有效的encounterId,则获取检验申请单列表
|
||||
if (queryParams.encounterId && queryParams.encounterId !== 'undefined' && queryParams.encounterId !== 'null' && queryParams.encounterId !== '') {
|
||||
getInspectionList()
|
||||
}
|
||||
// 监听patientInfo变化,确保encounterId及时更新
|
||||
watch(() => props.patientInfo, async (newVal) => {
|
||||
// console.log('【检验】patientInfo变化:', newVal)
|
||||
console.log('【检验】接收到的完整patientInfo:', JSON.stringify(newVal, null, 2))
|
||||
if (newVal && newVal.encounterId) {
|
||||
queryParams.encounterId = newVal.encounterId
|
||||
// console.log('【检验】更新encounterId:', queryParams.encounterId)
|
||||
|
||||
// 更新科室编码
|
||||
// const currentDeptCode = await getCurrentDeptCode();
|
||||
// formData.applyDeptCode = currentDeptCode || '';
|
||||
}
|
||||
}, { deep: true })
|
||||
}, { deep: true, immediate: true })
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
initData()
|
||||
onMounted(async () => {
|
||||
await initData()
|
||||
})
|
||||
|
||||
// 暴露方法
|
||||
defineExpose({
|
||||
getList() {
|
||||
// 在调用getList时,先检查是否有有效的patientInfo,如果有则更新encounterId
|
||||
if (props.patientInfo && Object.keys(props.patientInfo).length > 0) {
|
||||
queryParams.encounterId = props.patientInfo.encounterId || props.patientInfo.id || props.patientInfo.patientId;
|
||||
}
|
||||
getInspectionList();
|
||||
}
|
||||
getList: getInspectionList
|
||||
})
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -1207,7 +1265,7 @@ defineExpose({
|
||||
background-color: #ecf5ff;
|
||||
}
|
||||
|
||||
.item-name {
|
||||
.item-itemName {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
@@ -1392,7 +1450,7 @@ defineExpose({
|
||||
border-left: 3px solid #409eff;
|
||||
}
|
||||
|
||||
.inspection-tree-item .item-name {
|
||||
.inspection-tree-item .item-itemName {
|
||||
flex: 1;
|
||||
margin-left: 10px;
|
||||
font-weight: 500;
|
||||
@@ -1436,7 +1494,7 @@ defineExpose({
|
||||
margin: 2px 0;
|
||||
}
|
||||
|
||||
.selected-item-content .item-name {
|
||||
.selected-item-content .item-itemName {
|
||||
flex: 1;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user