修改体检登记样式以及增加删除患者信息的接口
This commit is contained in:
parent
0884335e59
commit
d87da93abd
@ -58,6 +58,11 @@ export const PatientitemsApi = {
|
|||||||
return await request.delete({ url: `/Inspect/patientitems/delete?id=` + id })
|
return await request.delete({ url: `/Inspect/patientitems/delete?id=` + id })
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 删除患者所有体检项目
|
||||||
|
deletePatientitemsAll: async (medicalSn: string) => {
|
||||||
|
return await request.delete({ url: `/Inspect/patientitems/deletemedicalSn?medicalSn=` + medicalSn })
|
||||||
|
},
|
||||||
|
|
||||||
// 导出患者体检项目 Excel
|
// 导出患者体检项目 Excel
|
||||||
exportPatientitems: async (params) => {
|
exportPatientitems: async (params) => {
|
||||||
return await request.download({ url: `/Inspect/patientitems/export-excel`, params })
|
return await request.download({ url: `/Inspect/patientitems/export-excel`, params })
|
||||||
|
@ -446,18 +446,26 @@ const fetchPatientsByDate = async () => {
|
|||||||
`${formatDate(startDate)} 00:00:00`,
|
`${formatDate(startDate)} 00:00:00`,
|
||||||
`${formatDate(endDate)} 23:59:59`
|
`${formatDate(endDate)} 23:59:59`
|
||||||
],
|
],
|
||||||
// 添加收费状态筛选参数
|
|
||||||
chargeStatus: chargeStatus.value === 'unpaid' ? '0' : '1',
|
|
||||||
// 添加搜索关键词
|
// 添加搜索关键词
|
||||||
pname: searchQuery.value || undefined
|
pname: searchQuery.value || undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await PatientApi.getPatientPage(params)
|
const res = await PatientApi.getPatientPage(params)
|
||||||
patients.value = res.list
|
|
||||||
total.value = res.total
|
// 在前端根据chargeType字段筛选
|
||||||
|
if (chargeStatus.value === 'unpaid') {
|
||||||
|
// 筛选未收费的患者(chargeType为null、undefined或空字符串)
|
||||||
|
patients.value = res.list.filter(patient => !patient.chargeType || patient.chargeType === '')
|
||||||
|
} else {
|
||||||
|
// 筛选已收费的患者(chargeType有值且不为空字符串)
|
||||||
|
patients.value = res.list.filter(patient => patient.chargeType && patient.chargeType !== '')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新总数
|
||||||
|
total.value = patients.value.length
|
||||||
|
|
||||||
// 如果没有查询到患者,清除选中状态
|
// 如果没有查询到患者,清除选中状态
|
||||||
if (!patients.value.length) {
|
if (patients.value.length === 0) {
|
||||||
selectedPatient.value = null
|
selectedPatient.value = null
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -39,38 +39,6 @@
|
|||||||
<el-radio-group v-model="searchForm_extra.passStatus">
|
<el-radio-group v-model="searchForm_extra.passStatus">
|
||||||
<el-radio value="1">已登记</el-radio>
|
<el-radio value="1">已登记</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
<div>
|
|
||||||
<el-button
|
|
||||||
@click="handlePersonInfoCustomAdd"
|
|
||||||
size="default"
|
|
||||||
type="text"
|
|
||||||
style="
|
|
||||||
margin-left: 10px;
|
|
||||||
color: #67C23A;
|
|
||||||
font-size: 15px;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<Icon :size="15" class="mr-4px" />新增
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
@click="handlePersonInfoIDCard2nd"
|
|
||||||
size="default"
|
|
||||||
type="text"
|
|
||||||
style="
|
|
||||||
margin-left: 10px;
|
|
||||||
color: #2d8cf0;
|
|
||||||
font-size: 15px;
|
|
||||||
"
|
|
||||||
:loading="btnPersonInfoIDCard2ndLoading"
|
|
||||||
>
|
|
||||||
<Icon
|
|
||||||
:size="15"
|
|
||||||
icon="ep:card"
|
|
||||||
class="mr-4px"
|
|
||||||
v-show="!btnPersonInfoIDCard2ndLoading"
|
|
||||||
/>读取身份证
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -89,11 +57,6 @@
|
|||||||
<el-scrollbar
|
<el-scrollbar
|
||||||
:view-style="[personData && personData.length > 0 ? { height: '99.6%' } : null]"
|
:view-style="[personData && personData.length > 0 ? { height: '99.6%' } : null]"
|
||||||
>
|
>
|
||||||
<el-empty
|
|
||||||
description="暂无数据"
|
|
||||||
image="/public/static/inspect/empty.png"
|
|
||||||
v-if="!personData || personData.length == 1"
|
|
||||||
/>
|
|
||||||
<el-table
|
<el-table
|
||||||
ref="personTableRef"
|
ref="personTableRef"
|
||||||
size="default"
|
size="default"
|
||||||
@ -109,6 +72,21 @@
|
|||||||
:highlight-current-row="true"
|
:highlight-current-row="true"
|
||||||
:row-class-name="getRowClassName"
|
:row-class-name="getRowClassName"
|
||||||
>
|
>
|
||||||
|
<template #empty>
|
||||||
|
<div class="empty-text">暂无数据</div>
|
||||||
|
</template>
|
||||||
|
<el-table-column width="60" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-radio
|
||||||
|
v-model="selectedPatientId"
|
||||||
|
:label="scope.row.id"
|
||||||
|
@change="() => handlePatientSelect(scope.row)"
|
||||||
|
class="custom-radio"
|
||||||
|
>
|
||||||
|
<!-- 空标签,只显示单选按钮 -->
|
||||||
|
</el-radio>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="体检编号" width="90px" prop="medicalSn" show-overflow-tooltip />
|
<el-table-column label="体检编号" width="90px" prop="medicalSn" show-overflow-tooltip />
|
||||||
<el-table-column label="患者信息" min-width="200px">
|
<el-table-column label="患者信息" min-width="200px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
@ -117,19 +95,18 @@
|
|||||||
:span="24"
|
:span="24"
|
||||||
style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap"
|
style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap"
|
||||||
>
|
>
|
||||||
|
<span :class="{ 'selected-patient': selectedPatient?.id === scope.row.id }">
|
||||||
姓名:{{ scope.row.personName }}
|
姓名:{{ scope.row.personName }}
|
||||||
<el-icon
|
</span>
|
||||||
v-if="selectedPatient?.id === scope.row.id"
|
|
||||||
color="#67C23A"
|
|
||||||
class="ml-4px"
|
|
||||||
>
|
|
||||||
<Check />
|
|
||||||
</el-icon>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row style="display: flex; align-items: center; white-space: nowrap">
|
||||||
<el-col :span="9">性别:{{ scope.row.sex }}</el-col>
|
<el-col :span="12" style="display: flex; align-items: center">
|
||||||
<el-col :span="9">年龄:{{ scope.row.age }}岁</el-col>
|
<span>性别:{{ scope.row.sex }}</span>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" style="display: flex; align-items: center">
|
||||||
|
<span style="white-space: nowrap">年龄:{{ scope.row.age }}岁</span>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -312,6 +289,7 @@
|
|||||||
'width: 110px'
|
'width: 110px'
|
||||||
]"
|
]"
|
||||||
v-show="!personInfoCustomAdd && !isEditing"
|
v-show="!personInfoCustomAdd && !isEditing"
|
||||||
|
:disabled="!selectedPatient"
|
||||||
>
|
>
|
||||||
<Icon :size="13.2" icon="ep:edit" class="mr-6px" />修改信息
|
<Icon :size="13.2" icon="ep:edit" class="mr-6px" />修改信息
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -351,9 +329,55 @@
|
|||||||
width: 126px;
|
width: 126px;
|
||||||
"
|
"
|
||||||
v-show="!personInfoCustomAdd"
|
v-show="!personInfoCustomAdd"
|
||||||
|
:disabled="!selectedPatient"
|
||||||
>
|
>
|
||||||
<Icon :size="13.2" icon="ep:printer" class="mr-6px" />打印导检单
|
<Icon :size="13.2" icon="ep:printer" class="mr-6px" />打印导检单
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
@click="handlePersonInfoCustomAdd"
|
||||||
|
style="
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 6.4px;
|
||||||
|
background-color: #67C23A;
|
||||||
|
color: rgba(255, 255, 255, 1);
|
||||||
|
width: 84px;
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<Icon :size="13.2" icon="ep:plus" class="mr-6px" />新增
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
@click="handlePersonInfoIDCard2nd"
|
||||||
|
style="
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 6.4px;
|
||||||
|
background-color: #2d8cf0;
|
||||||
|
color: rgba(255, 255, 255, 1);
|
||||||
|
width: 126px;
|
||||||
|
"
|
||||||
|
:loading="btnPersonInfoIDCard2ndLoading"
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
:size="13.2"
|
||||||
|
icon="ep:card"
|
||||||
|
class="mr-6px"
|
||||||
|
v-show="!btnPersonInfoIDCard2ndLoading"
|
||||||
|
/>读取身份证
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
@click="handlePersonInfoDelete"
|
||||||
|
style="
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 6.4px;
|
||||||
|
background-color: #F56C6C;
|
||||||
|
color: rgba(255, 255, 255, 1);
|
||||||
|
width: 84px;
|
||||||
|
"
|
||||||
|
v-show="!personInfoCustomAdd"
|
||||||
|
:disabled="!selectedPatient || selectedPatient?.chargeType"
|
||||||
|
:title="selectedPatient?.chargeType ? '已收费的记录不能删除' : ''"
|
||||||
|
>
|
||||||
|
<Icon :size="13.2" icon="ep:delete" class="mr-6px" />删除此人
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
<ContentWrap
|
<ContentWrap
|
||||||
@ -412,7 +436,7 @@
|
|||||||
"
|
"
|
||||||
v-show="personInfoCustomAdd || isEditing"
|
v-show="personInfoCustomAdd || isEditing"
|
||||||
>
|
>
|
||||||
<Icon :size="13.2" icon="ep:delete" class="mr-4px" />删除
|
<Icon :size="13.2" icon="ep:delete" class="mr-4px" />删除项目
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-alert>
|
</el-alert>
|
||||||
@ -835,6 +859,7 @@ const checkInfoParam_extra = ref<any>({
|
|||||||
})
|
})
|
||||||
//表格核心
|
//表格核心
|
||||||
const personData = ref<any[]>([])
|
const personData = ref<any[]>([])
|
||||||
|
const personDataOriginal = ref<any[]>([]) // 添加一个存储原始数据的ref
|
||||||
const personTotal = ref(0)
|
const personTotal = ref(0)
|
||||||
const projectTable = ref<any[]>([{}, {}, {}, {}])
|
const projectTable = ref<any[]>([{}, {}, {}, {}])
|
||||||
const projectTable_extra = ref<any>({
|
const projectTable_extra = ref<any>({
|
||||||
@ -909,10 +934,6 @@ const handlePhotographRemove = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handlePersonInfoEdit = () => {
|
const handlePersonInfoEdit = () => {
|
||||||
if (!selectedPatient.value) {
|
|
||||||
message.warning('请先在左侧选择一名患者')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
isEditing.value = true
|
isEditing.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -920,6 +941,8 @@ const handlePersonInfoCustomAdd = () => {
|
|||||||
personInfoCustomAdd.value = true
|
personInfoCustomAdd.value = true
|
||||||
isEditing.value = true
|
isEditing.value = true
|
||||||
// 清空表单数据,准备新增
|
// 清空表单数据,准备新增
|
||||||
|
selectedPatient.value = null
|
||||||
|
selectedPatientId.value = null
|
||||||
personParam.value = {
|
personParam.value = {
|
||||||
avatar: '',
|
avatar: '',
|
||||||
testNum: '',
|
testNum: '',
|
||||||
@ -930,8 +953,6 @@ const handlePersonInfoCustomAdd = () => {
|
|||||||
mobile: ''
|
mobile: ''
|
||||||
}
|
}
|
||||||
comboInfoTable1.value = []
|
comboInfoTable1.value = []
|
||||||
// 取消当前选中的患者
|
|
||||||
selectedPatient.value = null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlePersonInfoIDCard2nd = () => {
|
const handlePersonInfoIDCard2nd = () => {
|
||||||
@ -1039,7 +1060,8 @@ const handlePersonInfoCancel = () => {
|
|||||||
if (selectedPatient.value) {
|
if (selectedPatient.value) {
|
||||||
handlePatientSelect(selectedPatient.value)
|
handlePatientSelect(selectedPatient.value)
|
||||||
} else {
|
} else {
|
||||||
// 否则清空表单
|
// 否则清空表单和单选按钮
|
||||||
|
selectedPatientId.value = null
|
||||||
personParam.value = {
|
personParam.value = {
|
||||||
avatar: '',
|
avatar: '',
|
||||||
testNum: '',
|
testNum: '',
|
||||||
@ -1064,13 +1086,11 @@ const getPatientData = async () => {
|
|||||||
checkPersonLoading.value = true
|
checkPersonLoading.value = true
|
||||||
const params = {
|
const params = {
|
||||||
pageNo: searchForm.value.pageNumber,
|
pageNo: searchForm.value.pageNumber,
|
||||||
pageSize: searchForm.value.pageSize,
|
pageSize: searchForm.value.pageSize
|
||||||
// 只有当有输入时才加入姓名查询条件
|
|
||||||
...(searchForm.value.personName && { pname: searchForm.value.personName })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await PatientApi.getPatientPage(params)
|
const res = await PatientApi.getPatientPage(params)
|
||||||
personData.value = res.list.map(item => ({
|
const mappedData = res.list.map(item => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
medicalSn: item.medicalSn,
|
medicalSn: item.medicalSn,
|
||||||
personName: item.pname,
|
personName: item.pname,
|
||||||
@ -1082,10 +1102,14 @@ const getPatientData = async () => {
|
|||||||
physicalType: item.chargeType,
|
physicalType: item.chargeType,
|
||||||
status: item.status
|
status: item.status
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
personDataOriginal.value = mappedData // 保存原始数据
|
||||||
|
personData.value = mappedData
|
||||||
personTotal.value = res.total || 0
|
personTotal.value = res.total || 0
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取患者数据出错:', error)
|
console.error('获取患者数据出错:', error)
|
||||||
message.error('获取患者数据出错')
|
message.error('获取患者数据出错')
|
||||||
|
personDataOriginal.value = []
|
||||||
personData.value = []
|
personData.value = []
|
||||||
personTotal.value = 0
|
personTotal.value = 0
|
||||||
} finally {
|
} finally {
|
||||||
@ -1106,10 +1130,18 @@ const calculateAge = (birthday) => {
|
|||||||
return age.toString()
|
return age.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 使用防抖处理搜索
|
// 修改搜索监听函数,使用本地过滤
|
||||||
const debouncedSearch = debounce(() => {
|
const debouncedSearch = debounce(() => {
|
||||||
searchForm.value.pageNumber = 1
|
const keyword = searchForm.value.personName?.trim().toLowerCase()
|
||||||
getPatientData()
|
if (!keyword) {
|
||||||
|
personData.value = personDataOriginal.value
|
||||||
|
} else {
|
||||||
|
personData.value = personDataOriginal.value.filter(item =>
|
||||||
|
item.personName.toLowerCase().includes(keyword)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
// 更新总数
|
||||||
|
personTotal.value = personData.value.length
|
||||||
}, 300)
|
}, 300)
|
||||||
|
|
||||||
// 修改监听函数,使用防抖
|
// 修改监听函数,使用防抖
|
||||||
@ -1130,6 +1162,7 @@ watch(() => searchForm_extra.value.passStatus, () => {
|
|||||||
|
|
||||||
// 添加选中患者的 ref
|
// 添加选中患者的 ref
|
||||||
const selectedPatient = ref(null)
|
const selectedPatient = ref(null)
|
||||||
|
const selectedPatientId = ref(null)
|
||||||
|
|
||||||
// 修改加载患者项目的方法,减少不必要的API请求
|
// 修改加载患者项目的方法,减少不必要的API请求
|
||||||
const loadPatientProjects = async (medicalSn) => {
|
const loadPatientProjects = async (medicalSn) => {
|
||||||
@ -1177,11 +1210,12 @@ const loadPatientProjects = async (medicalSn) => {
|
|||||||
// 修改选择患者的处理方法
|
// 修改选择患者的处理方法
|
||||||
const handlePatientSelect = async (row) => {
|
const handlePatientSelect = async (row) => {
|
||||||
try {
|
try {
|
||||||
console.log('选中患者:', row) // 添加调试日志
|
// 如果点击的是当前选中行,则取消选中
|
||||||
|
|
||||||
// 如果点击的是当前选中行,则取消选中并清空右侧页面
|
|
||||||
if (selectedPatient.value?.id === row.id) {
|
if (selectedPatient.value?.id === row.id) {
|
||||||
selectedPatient.value = null
|
selectedPatient.value = null
|
||||||
|
selectedPatientId.value = null
|
||||||
|
|
||||||
|
// 清空表单数据
|
||||||
personParam.value = {
|
personParam.value = {
|
||||||
avatar: '',
|
avatar: '',
|
||||||
testNum: '',
|
testNum: '',
|
||||||
@ -1192,15 +1226,22 @@ const handlePatientSelect = async (row) => {
|
|||||||
mobile: ''
|
mobile: ''
|
||||||
}
|
}
|
||||||
comboInfoTable1.value = []
|
comboInfoTable1.value = []
|
||||||
|
|
||||||
|
personInfoEdit.value = false
|
||||||
|
personInfoDelete.value = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置新选中的患者
|
// 设置新选中的患者
|
||||||
selectedPatient.value = row
|
selectedPatient.value = {
|
||||||
|
...row,
|
||||||
|
chargeType: row.chargeType
|
||||||
|
}
|
||||||
|
selectedPatientId.value = row.id
|
||||||
|
|
||||||
// 获取患者详情
|
// 获取患者详情
|
||||||
const res = await PatientApi.getPatient(row.id)
|
const res = await PatientApi.getPatient(row.id)
|
||||||
console.log('获取到患者详情:', res) // 添加调试日志
|
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
personParam.value = {
|
personParam.value = {
|
||||||
@ -1220,17 +1261,15 @@ const handlePatientSelect = async (row) => {
|
|||||||
|
|
||||||
// 如果有体检编号,加载体检项目
|
// 如果有体检编号,加载体检项目
|
||||||
if (res.medicalSn) {
|
if (res.medicalSn) {
|
||||||
console.log('开始加载患者体检项目, 体检编号:', res.medicalSn) // 添加调试日志
|
|
||||||
await loadPatientProjects(res.medicalSn)
|
await loadPatientProjects(res.medicalSn)
|
||||||
} else {
|
} else {
|
||||||
console.log('患者没有体检编号,不加载项目') // 添加调试日志
|
|
||||||
comboInfoTable1.value = []
|
comboInfoTable1.value = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取患者详情失败:', error)
|
message.error('获取患者详情失败')
|
||||||
ElMessage.error('获取患者详情失败')
|
|
||||||
selectedPatient.value = null
|
selectedPatient.value = null
|
||||||
|
selectedPatientId.value = null
|
||||||
// 确保出错时也有默认值
|
// 确保出错时也有默认值
|
||||||
personParam.value = {
|
personParam.value = {
|
||||||
avatar: '',
|
avatar: '',
|
||||||
@ -1310,7 +1349,6 @@ const handleComboInfoSearch = () => {
|
|||||||
|
|
||||||
// 选中套餐项目
|
// 选中套餐项目
|
||||||
const handleComboInfoSelection = (selection) => {
|
const handleComboInfoSelection = (selection) => {
|
||||||
console.log('套餐选择变化:', selection) // 添加调试日志
|
|
||||||
comboInfoSelectedData.value = selection
|
comboInfoSelectedData.value = selection
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1368,11 +1406,10 @@ const handleCheckInfoSearch = () => {
|
|||||||
|
|
||||||
// 选中检查项目
|
// 选中检查项目
|
||||||
const handleCheckInfoSelection = (selection) => {
|
const handleCheckInfoSelection = (selection) => {
|
||||||
console.log('检查项目选择变化:', selection) // 添加调试日志
|
|
||||||
checkInfoSelectedData.value = selection
|
checkInfoSelectedData.value = selection
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修复确认选择项目的方法 - 只在UI中添加项目,不保存到数据库
|
// 修改确认选择项目的方法
|
||||||
const confirmSelectedProjects = async () => {
|
const confirmSelectedProjects = async () => {
|
||||||
try {
|
try {
|
||||||
let selectedProjects: ProjectDetail[] = []
|
let selectedProjects: ProjectDetail[] = []
|
||||||
@ -1384,14 +1421,10 @@ const confirmSelectedProjects = async () => {
|
|||||||
processedItemCodes.add(item.itemCode)
|
processedItemCodes.add(item.itemCode)
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log('现有项目的itemCode:', Array.from(processedItemCodes))
|
|
||||||
|
|
||||||
if (selectProjectDrawerTabName.value === 'comboInfo') {
|
if (selectProjectDrawerTabName.value === 'comboInfo') {
|
||||||
// 处理套餐项目
|
// 处理套餐项目
|
||||||
for (const combo of comboInfoSelectedData.value) {
|
for (const combo of comboInfoSelectedData.value) {
|
||||||
try {
|
try {
|
||||||
console.log('处理选中的套餐:', combo)
|
|
||||||
|
|
||||||
// 获取套餐下的所有项目
|
// 获取套餐下的所有项目
|
||||||
const moduleItems = await ExammoduleApi.getListExammodule()
|
const moduleItems = await ExammoduleApi.getListExammodule()
|
||||||
// 过滤出当前套餐的项目
|
// 过滤出当前套餐的项目
|
||||||
@ -1399,23 +1432,16 @@ const confirmSelectedProjects = async () => {
|
|||||||
item.examModuleID === combo.examModuleID
|
item.examModuleID === combo.examModuleID
|
||||||
)
|
)
|
||||||
|
|
||||||
console.log('当前套餐的项目:', filteredItems)
|
|
||||||
|
|
||||||
// 逐个处理套餐中的项目
|
// 逐个处理套餐中的项目
|
||||||
for (const moduleItem of filteredItems) {
|
for (const moduleItem of filteredItems) {
|
||||||
// 如果已经处理过这个itemCode,跳过
|
// 如果已经处理过这个itemCode,跳过
|
||||||
if (processedItemCodes.has(moduleItem.itemCode)) {
|
if (processedItemCodes.has(moduleItem.itemCode)) {
|
||||||
console.log(`项目 ${moduleItem.itemCode} 已存在,跳过`)
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 使用itemCode查询项目详情
|
// 获取项目详情
|
||||||
console.log('查询项目详情,itemCode:', moduleItem.itemCode)
|
|
||||||
|
|
||||||
// 获取项目详情 - 使用自定义方法通过itemCode查询
|
|
||||||
const itemDetail = await getItemDetailByCode(moduleItem.itemCode)
|
const itemDetail = await getItemDetailByCode(moduleItem.itemCode)
|
||||||
console.log('获取到项目详情:', itemDetail)
|
|
||||||
|
|
||||||
// 添加到已处理集合
|
// 添加到已处理集合
|
||||||
processedItemCodes.add(moduleItem.itemCode)
|
processedItemCodes.add(moduleItem.itemCode)
|
||||||
@ -1444,7 +1470,6 @@ const confirmSelectedProjects = async () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
} catch (itemError) {
|
} catch (itemError) {
|
||||||
console.error('处理项目失败:', itemError)
|
|
||||||
// 出错时也尝试添加项目,使用套餐数据
|
// 出错时也尝试添加项目,使用套餐数据
|
||||||
if (!processedItemCodes.has(moduleItem.itemCode)) {
|
if (!processedItemCodes.has(moduleItem.itemCode)) {
|
||||||
processedItemCodes.add(moduleItem.itemCode)
|
processedItemCodes.add(moduleItem.itemCode)
|
||||||
@ -1461,7 +1486,7 @@ const confirmSelectedProjects = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (comboError) {
|
} catch (comboError) {
|
||||||
console.error('处理套餐失败:', comboError)
|
message.error('处理套餐失败')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (selectProjectDrawerTabName.value === 'checkInfo') {
|
} else if (selectProjectDrawerTabName.value === 'checkInfo') {
|
||||||
@ -1469,7 +1494,6 @@ const confirmSelectedProjects = async () => {
|
|||||||
for (const item of checkInfoSelectedData.value) {
|
for (const item of checkInfoSelectedData.value) {
|
||||||
// 如果已经处理过这个itemCode,跳过
|
// 如果已经处理过这个itemCode,跳过
|
||||||
if (processedItemCodes.has(item.itemCode)) {
|
if (processedItemCodes.has(item.itemCode)) {
|
||||||
console.log(`项目 ${item.itemCode} 已存在,跳过`)
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1488,8 +1512,6 @@ const confirmSelectedProjects = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('最终要添加的项目:', selectedProjects)
|
|
||||||
|
|
||||||
if (selectedProjects.length > 0) {
|
if (selectedProjects.length > 0) {
|
||||||
// 只添加到前端表格,不保存到数据库
|
// 只添加到前端表格,不保存到数据库
|
||||||
comboInfoTable1.value = [...comboInfoTable1.value, ...selectedProjects]
|
comboInfoTable1.value = [...comboInfoTable1.value, ...selectedProjects]
|
||||||
@ -1500,7 +1522,6 @@ const confirmSelectedProjects = async () => {
|
|||||||
|
|
||||||
selectProjectDrawerShow.value = false
|
selectProjectDrawerShow.value = false
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('添加项目失败:', error)
|
|
||||||
message.error('添加项目失败')
|
message.error('添加项目失败')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1648,7 +1669,10 @@ const handleIdCardInput = (value) => {
|
|||||||
// 添加行类名方法
|
// 添加行类名方法
|
||||||
const getRowClassName = ({ row }) => {
|
const getRowClassName = ({ row }) => {
|
||||||
// 如果处于编辑/新增模式,添加禁用样式
|
// 如果处于编辑/新增模式,添加禁用样式
|
||||||
return personInfoCustomAdd.value ? 'disabled-row' : ''
|
if (personInfoCustomAdd.value) return 'disabled-row'
|
||||||
|
// 如果是选中的行,添加选中样式
|
||||||
|
if (selectedPatient.value?.id === row.id) return 'selected-row'
|
||||||
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保表格分页参数正确
|
// 确保表格分页参数正确
|
||||||
@ -1665,6 +1689,72 @@ watch(() => [comboInfoParam.value.pageNumber, comboInfoParam.value.pageSize], ()
|
|||||||
const isEditable = computed(() => {
|
const isEditable = computed(() => {
|
||||||
return personInfoCustomAdd.value || isEditing.value
|
return personInfoCustomAdd.value || isEditing.value
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 在 script setup 部分添加删除方法
|
||||||
|
const handlePersonInfoDelete = async () => {
|
||||||
|
if (!selectedPatient.value) {
|
||||||
|
message.warning('请先选择要删除的人员')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加收费状态判断
|
||||||
|
const data = await PatientApi.getPatient(selectedPatient.value.id)
|
||||||
|
if (data.chargeType) {
|
||||||
|
ElMessage.error('已收费的记录不能删除')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 确认删除
|
||||||
|
await ElMessageBox.confirm(
|
||||||
|
'删除后将无法恢复,是否确认删除该人员及其所有体检项目?',
|
||||||
|
'警告',
|
||||||
|
{
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// 1. 删除患者的体检项目
|
||||||
|
if (data.chargeType) {
|
||||||
|
ElMessage.error('已收费的记录不能删除')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
await PatientitemsApi.deletePatientitemsAll(selectedPatient.value.medicalSn)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 删除患者信息
|
||||||
|
await PatientApi.deletePatient(selectedPatient.value.id)
|
||||||
|
|
||||||
|
message.success('删除成功')
|
||||||
|
|
||||||
|
// 3. 重置选中状态
|
||||||
|
selectedPatient.value = null
|
||||||
|
selectedPatientId.value = null
|
||||||
|
|
||||||
|
// 4. 清空右侧表单
|
||||||
|
personParam.value = {
|
||||||
|
avatar: '',
|
||||||
|
testNum: '',
|
||||||
|
personName: '',
|
||||||
|
sex: '',
|
||||||
|
age: '',
|
||||||
|
idCard: '',
|
||||||
|
mobile: ''
|
||||||
|
}
|
||||||
|
comboInfoTable1.value = []
|
||||||
|
|
||||||
|
// 5. 刷新列表
|
||||||
|
await getPatientData()
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
if (error === 'cancel') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
message.error('删除失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@ -1760,11 +1850,6 @@ const isEditable = computed(() => {
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 移除之前的选中行样式
|
|
||||||
// :deep(.el-table__row.current-row) {
|
|
||||||
// background-color: #ecf5ff !important;
|
|
||||||
// }
|
|
||||||
|
|
||||||
.physicalRegister {
|
.physicalRegister {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@ -1887,4 +1972,35 @@ const isEditable = computed(() => {
|
|||||||
.form-item-test-num .el-form-item__content {
|
.form-item-test-num .el-form-item__content {
|
||||||
width: calc(100% - 72px);
|
width: calc(100% - 72px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 添加禁用按钮的样式 */
|
||||||
|
.el-button.is-disabled {
|
||||||
|
background-color: #c0c4cc !important;
|
||||||
|
border-color: #c0c4cc !important;
|
||||||
|
color: #ffffff !important;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.selected-patient {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #409EFF;
|
||||||
|
background-color: #ecf5ff;
|
||||||
|
padding: 2px 6px;
|
||||||
|
border-radius: 4px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.selected-row) {
|
||||||
|
background-color: #ecf5ff !important;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 自定义单选按钮样式,隐藏标签文本 */
|
||||||
|
:deep(.custom-radio) {
|
||||||
|
margin-right: 0;
|
||||||
|
|
||||||
|
.el-radio__label {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user