修复各界面测试BUG

This commit is contained in:
Euni4U 2025-02-28 10:30:21 +08:00
parent d87da93abd
commit d0aa46f87d
6 changed files with 95 additions and 127 deletions

View File

@ -24,6 +24,7 @@ export interface PatientVO {
auditor: string // 审核人
auditorTime: Date // 审核时间
chargetime: Date // 收费时间
headimage: string // 个人信息图片
}
// 患者信息 API

View File

@ -883,15 +883,19 @@ const formattedMedicalDateTime = computed(() => {
}).replace(/\//g, '-')
})
//
const age = computed(() => {
if (!reportData.value.birthday || !Array.isArray(reportData.value.birthday)) return ''
if (!reportData.value.birthday) return ''
// YYYY-MM-DD
const birthDate = new Date(reportData.value.birthday)
if (isNaN(birthDate.getTime())) return '' //
const [year, month, day] = reportData.value.birthday
const birthDate = new Date(year, month - 1, day) // 1JS0
const today = new Date()
let age = today.getFullYear() - birthDate.getFullYear()
const monthDiff = today.getMonth() - birthDate.getMonth()
// 1
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
age--
}

View File

@ -161,28 +161,30 @@
<div
class="pic-box"
:style="{
border: personParam.avatar ? '0 !important;' : 'auto'
border: personParam.avatar ? '0 !important;' : 'auto',
cursor: isEditable ? 'pointer' : 'not-allowed',
opacity: isEditable ? '1' : '0.6'
}"
@click.stop="handlePhotographInfo"
@click.stop="isEditable ? handlePhotographInfo() : null"
>
<el-icon :size="20" color="#2988f3" v-if="!personParam.avatar">
<el-icon :size="20" :color="isEditable ? '#2988f3' : '#909399'" v-if="!personParam.avatar">
<Plus />
</el-icon>
<span
style="
font-size: 13.8px;
line-height: 0;
height: auto;
margin-top: 26px;
color: #2988f3;
"
:style="{
fontSize: '13.8px',
lineHeight: '0',
height: 'auto',
marginTop: '26px',
color: isEditable ? '#2988f3' : '#909399'
}"
v-if="!personParam.avatar"
>
人像采集
</span>
<template v-else>
<img :src="personParam.avatar" style="height: 100%; width: 100%" />
<div class="demo-upload-list-cover">
<div class="demo-upload-list-cover" v-if="isEditable">
<el-icon :size="20" @click.stop="handlePhotographView(personParam.avatar)">
<ZoomIn />
</el-icon>
@ -398,12 +400,7 @@
体检项目
</span>
<el-button
@click="
() => {
selectProjectDrawerTabName = 'comboInfo'
selectProjectDrawerShow = true
}
"
@click="handleOpenProjectDrawer"
size="small"
style="
margin: 0;
@ -481,7 +478,11 @@
prop="section"
min-width="180"
show-overflow-tooltip
/>
>
<template #default="scope">
{{ scope.row.section || '暂无科室' }}
</template>
</el-table-column>
<el-table-column
label="销售价(元)"
prop="price"
@ -972,7 +973,10 @@ const handlePersonInfoSave = async () => {
try {
//
await personParamRef.value.validate()
var avatar=''
if(personParam.value.avatar){
avatar= personParam.value.avatar.split(',')[1]
}
//
const patientData: PatientVO = {
id: selectedPatient.value?.id, // ID
@ -985,7 +989,8 @@ const handlePersonInfoSave = async () => {
phoneNum: personParam.value.mobile,
status: 0, //
headPicUrl: personParam.value.avatar,
medicalDateTime: new Date().getTime() //
medicalDateTime: new Date().getTime(), //
headimage: avatar
}
let result
@ -1007,9 +1012,10 @@ const handlePersonInfoSave = async () => {
price: item.price,
discountedPrice: item.discountPrice,
discounted: item.discount,
sectionID: item.section,
sectionID: item.sectionID,
itemStatus: '0',
createTime: new Date().getTime() //
createTime: new Date().getTime(), //
headimage: avatar
}))
await PatientitemsApi.createPatientitemsBatch(saveItems)
@ -1100,7 +1106,7 @@ const getPatientData = async () => {
mobile: item.phoneNum,
avatar: item.headPicUrl,
physicalType: item.chargeType,
status: item.status
status: item.status,
}))
personDataOriginal.value = mappedData //
@ -1191,7 +1197,8 @@ const loadPatientProjects = async (medicalSn) => {
discount: item.discounted || 0,
discountPrice: item.discountedPrice || 0,
moduleName: item.moduleName || '',
section: item.sectionID || '',
section: item.section || '',
sectionID: item.sectionID || '',
itemCode: item.itemCode
}))
@ -1316,31 +1323,6 @@ const getComboInfoData = async () => {
}
}
//
onMounted(() => {
getComboInfoData()
//
personParam.value = {
avatar: '',
testNum: '',
personName: '',
sex: '',
age: '',
idCard: '',
mobile: ''
}
//
comboInfoTable1.value = []
})
watch(() => selectProjectDrawerShow.value, (newVal) => {
if (newVal) {
getComboInfoData()
}
})
//
const handleComboInfoSearch = () => {
comboInfoParam.value.pageNumber = 1
@ -1413,7 +1395,6 @@ const handleCheckInfoSelection = (selection) => {
const confirmSelectedProjects = async () => {
try {
let selectedProjects: ProjectDetail[] = []
// SetitemCode
const processedItemCodes = new Set()
// itemCodeSet
@ -1422,67 +1403,41 @@ const confirmSelectedProjects = async () => {
})
if (selectProjectDrawerTabName.value === 'comboInfo') {
//
for (const combo of comboInfoSelectedData.value) {
try {
//
const moduleItems = await ExammoduleApi.getListExammodule()
//
const filteredItems = moduleItems.filter(item =>
item.examModuleID === combo.examModuleID
)
//
for (const moduleItem of filteredItems) {
// itemCode
if (processedItemCodes.has(moduleItem.itemCode)) {
continue
}
try {
//
const itemDetail = await getItemDetailByCode(moduleItem.itemCode)
const itemDetail = await itemsApi.getitemsPage({
pageNum: 1,
pageSize: 1,
itemCode: moduleItem.itemCode
})
//
processedItemCodes.add(moduleItem.itemCode)
if (itemDetail) {
// 使
if (itemDetail?.list?.[0]) {
const item = itemDetail.list[0]
processedItemCodes.add(moduleItem.itemCode)
selectedProjects.push({
name: itemDetail.itemName,
section: itemDetail.section || '',
price: itemDetail.price || 0,
discount: itemDetail.discounted || 0,
discountPrice: itemDetail.discountedPrice || 0,
moduleName: itemDetail.moduleName || moduleItem.examModuleName,
itemCode: moduleItem.itemCode
})
} else {
// 使
selectedProjects.push({
name: moduleItem.examModuleName,
section: '',
price: 0,
discount: 0,
discountPrice: 0,
moduleName: moduleItem.examModuleName,
name: item.itemName,
section: item.section, // 使
sectionID: item.sectionID, // ID
price: item.price || 0,
discount: item.discounted || 0,
discountPrice: item.discountedPrice || 0,
moduleName: item.moduleName || moduleItem.examModuleName,
itemCode: moduleItem.itemCode
})
}
} catch (itemError) {
// 使
if (!processedItemCodes.has(moduleItem.itemCode)) {
processedItemCodes.add(moduleItem.itemCode)
selectedProjects.push({
name: moduleItem.examModuleName,
section: '',
price: 0,
discount: 0,
discountPrice: 0,
moduleName: moduleItem.examModuleName,
itemCode: moduleItem.itemCode
})
}
console.error('处理项目详情失败:', itemError)
}
}
} catch (comboError) {
@ -1490,19 +1445,16 @@ const confirmSelectedProjects = async () => {
}
}
} else if (selectProjectDrawerTabName.value === 'checkInfo') {
//
for (const item of checkInfoSelectedData.value) {
// itemCode
if (processedItemCodes.has(item.itemCode)) {
continue
}
//
processedItemCodes.add(item.itemCode)
selectedProjects.push({
name: item.itemName,
section: item.section,
section: item.section, // 使
sectionID: item.sectionID, // ID
price: item.price,
discount: item.discounted,
discountPrice: item.discountedPrice,
@ -1513,7 +1465,6 @@ const confirmSelectedProjects = async () => {
}
if (selectedProjects.length > 0) {
//
comboInfoTable1.value = [...comboInfoTable1.value, ...selectedProjects]
message.success(`成功添加${selectedProjects.length}个新项目`)
} else {
@ -1526,24 +1477,6 @@ const confirmSelectedProjects = async () => {
}
}
// itemCode
const getItemDetailByCode = async (itemCode) => {
try {
//
const allItems = await itemsApi.getitemsPage({
pageNum: 1,
pageSize: 100
})
// itemCode
const item = allItems.list.find(item => item.itemCode === itemCode)
return item || null
} catch (error) {
console.error('通过itemCode查询项目详情失败:', error)
return null
}
}
/** 钩子方法 **/
onMounted(() => {
//
@ -1569,11 +1502,12 @@ const startIndex = computed(() => {
//
interface ProjectDetail {
name: string
section: string //
sectionID: string // ID
price: number
discount: number
discountPrice: number
moduleName: string
section: string
itemCode: string
}
@ -1610,6 +1544,21 @@ const handleDeleteSelectedItems = async () => {
}
}
//
const handleOpenProjectDrawer = () => {
//
comboInfoSelectedData.value = []
checkInfoSelectedData.value = []
//
if (comboInfoTableRef.value) {
comboInfoTableRef.value.clearSelection()
}
selectProjectDrawerTabName.value = 'comboInfo'
selectProjectDrawerShow.value = true
}
//
const handleIdCardInput = (value) => {
if (!value || value.length < 15) return

View File

@ -157,7 +157,7 @@ const getDepartmentList = async () => {
try {
const data = await DepartmentApi.getListDepartment()
departmentOptions.value = data.map((item: DepartmentVO) => ({
value: item.id,
value: item.departmentCode,
label: item.departmentName
}))
} catch (error) {

View File

@ -68,23 +68,27 @@ async function handleSearch() {
pageSize: pageSize.value
}
//
const keyword = searchForm.keyword?.trim()
if (keyword) {
queryParams.itemName = keyword // 使itemName
queryParams.itemName = keyword
}
if (searchForm.department) {
queryParams.sectionID = searchForm.department // 使section
queryParams.sectionID = searchForm.department
console.log('选中的科室ID:', searchForm.department)
}
console.log('查询参数:', queryParams)
try {
const res = await itemsApi.getitemsPage(queryParams)
console.log('查询结果:', res)
if (res) {
tableData.value = res.list || []
total.value = res.total || 0
}
} catch (error) {
console.error('查询失败:', error)
ElMessage.error('查询失败')
tableData.value = []
total.value = 0
@ -103,7 +107,9 @@ const getDepartmentList = async () => {
value: item.departmentCode,
label: item.departmentName
}))
console.log('科室列表数据:', departmentOptions.value)
} catch (error) {
console.error('获取科室列表错误:', error)
ElMessage.error('获取科室列表失败')
}
}

View File

@ -60,11 +60,19 @@
<el-button type="primary" @click="handleAdd">
<el-icon><Plus /></el-icon>
</el-button>
<el-button type="primary" @click="openDrawer">
<el-button
type="primary"
@click="openDrawer"
:disabled="!selectedPackage"
>
<el-icon><Plus /></el-icon>
</el-button>
<el-button type="danger" @click="handleDeleteSelected">
<el-icon><Delete /></el-icon>
<el-button
type="danger"
@click="handleDeleteSelected"
:disabled="!selectedPackage || multipleSelection.length === 0"
>
<el-icon><Delete /></el-icon>
</el-button>
<el-button
type="success"