修改逻辑
This commit is contained in:
parent
4d0586fb46
commit
ba1b35d37f
@ -25,6 +25,7 @@ export interface PatientVO {
|
|||||||
auditorTime: Date // 审核时间
|
auditorTime: Date // 审核时间
|
||||||
chargetime: Date // 收费时间
|
chargetime: Date // 收费时间
|
||||||
headimage: string // 个人信息图片
|
headimage: string // 个人信息图片
|
||||||
|
domicileaddress: string // 住址
|
||||||
}
|
}
|
||||||
|
|
||||||
// 患者信息 API
|
// 患者信息 API
|
||||||
@ -58,4 +59,9 @@ export const PatientApi = {
|
|||||||
exportPatient: async (params) => {
|
exportPatient: async (params) => {
|
||||||
return await request.download({ url: `/inspect/patient/export-excel`, params })
|
return await request.download({ url: `/inspect/patient/export-excel`, params })
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 导入患者信息
|
||||||
|
uploadExcel: async (data: FormData) => {
|
||||||
|
return await request.upload({ url: `/inspect/patient/uploadExcel`, data })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -129,7 +129,8 @@ const getImageUrls = async () => {
|
|||||||
'ultrasound': ['ultrasound', 'us', '超声', '彩超', 'b超', 'doppler'],
|
'ultrasound': ['ultrasound', 'us', '超声', '彩超', 'b超', 'doppler'],
|
||||||
'ecg': ['ecg', 'ekg', '心电图', 'electrocardiogram'],
|
'ecg': ['ecg', 'ekg', '心电图', 'electrocardiogram'],
|
||||||
'blood': ['blood', 'cbc', '血常规', '血液', 'bloodtest'],
|
'blood': ['blood', 'cbc', '血常规', '血液', 'bloodtest'],
|
||||||
'urine': ['urine', 'ua', '尿常规', '尿液', 'urinalysis','RT','rt']
|
'urine': ['urine', 'ua', '尿常规', '尿液', 'urinalysis','RT','rt'],
|
||||||
|
'biochemical': ['biochemical', 'biochemistry', '生化', '化验','生化检查','生化检验','bt','BT']
|
||||||
}
|
}
|
||||||
|
|
||||||
const patterns = typePatterns[props.examType]
|
const patterns = typePatterns[props.examType]
|
||||||
@ -162,9 +163,6 @@ const getImageUrls = async () => {
|
|||||||
type: isPDF ? 'pdf' : 'image'
|
type: isPDF ? 'pdf' : 'image'
|
||||||
}
|
}
|
||||||
}).filter(item => item)
|
}).filter(item => item)
|
||||||
|
|
||||||
console.log('处理后的媒体文件:', mediaFiles.value) // 添加调试日志
|
|
||||||
|
|
||||||
// 只收集图片URL用于预览
|
// 只收集图片URL用于预览
|
||||||
imageUrls.value = mediaFiles.value
|
imageUrls.value = mediaFiles.value
|
||||||
.filter(file => file.type === 'image')
|
.filter(file => file.type === 'image')
|
||||||
@ -361,9 +359,6 @@ const loadPatientData = async (patient) => {
|
|||||||
if (patientItemsResponse?.list && patientItemsResponse.list.length > 0) {
|
if (patientItemsResponse?.list && patientItemsResponse.list.length > 0) {
|
||||||
// 选择第一个检查项目作为当前项目
|
// 选择第一个检查项目作为当前项目
|
||||||
currentItem.value = patientItemsResponse.list[0]
|
currentItem.value = patientItemsResponse.list[0]
|
||||||
|
|
||||||
console.log('找到的当前检查项目:', currentItem.value)
|
|
||||||
|
|
||||||
// 如果找到了检查项目,加载其检查所见和结果
|
// 如果找到了检查项目,加载其检查所见和结果
|
||||||
if (currentItem.value) {
|
if (currentItem.value) {
|
||||||
imageFinding.value = currentItem.value.examDescription || ''
|
imageFinding.value = currentItem.value.examDescription || ''
|
||||||
@ -407,7 +402,6 @@ watch(
|
|||||||
() => props.examType,
|
() => props.examType,
|
||||||
async (newType) => {
|
async (newType) => {
|
||||||
if (newType && reportData.value.medicalSn) {
|
if (newType && reportData.value.medicalSn) {
|
||||||
console.log('检查类型变更为:', newType)
|
|
||||||
imageUrls.value = await getImageUrls()
|
imageUrls.value = await getImageUrls()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -428,7 +422,8 @@ const getExamTypeTitle = () => {
|
|||||||
ultrasound: '超声',
|
ultrasound: '超声',
|
||||||
ecg: '心电图',
|
ecg: '心电图',
|
||||||
blood: '血常规',
|
blood: '血常规',
|
||||||
urine: '尿常规'
|
urine: '尿常规',
|
||||||
|
biochemical: '生化'
|
||||||
}
|
}
|
||||||
return typeMap[props.examType] || '检查'
|
return typeMap[props.examType] || '检查'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,52 +6,34 @@
|
|||||||
<div class="filter-options">
|
<div class="filter-options">
|
||||||
<div class="header-title">
|
<div class="header-title">
|
||||||
<span>患者列表</span>
|
<span>患者列表</span>
|
||||||
<el-button
|
<div class="header-buttons">
|
||||||
type="success"
|
<el-button
|
||||||
size="small"
|
type="primary"
|
||||||
@click="handleRefresh"
|
size="small"
|
||||||
:icon="Refresh"
|
@click="handleSync"
|
||||||
>
|
:icon="RefreshRight"
|
||||||
刷新
|
>
|
||||||
</el-button>
|
同步
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
size="small"
|
||||||
|
@click="handleRefresh"
|
||||||
|
:icon="Refresh"
|
||||||
|
>
|
||||||
|
刷新
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 添加时间筛选 -->
|
<!-- 添加检查状态筛选 -->
|
||||||
<div class="view-options">
|
<div class="status-filter">
|
||||||
<div class="view-buttons">
|
<el-radio-group v-model="statusFilter" @change="handleStatusFilterChange">
|
||||||
<button
|
<el-radio label="0">待检查</el-radio>
|
||||||
v-for="period in timePeriods"
|
<el-radio label="1">已检查</el-radio>
|
||||||
:key="period.value"
|
<el-radio label="">全部</el-radio>
|
||||||
class="view-btn"
|
</el-radio-group>
|
||||||
:class="{ active: selectedPeriod === period.value }"
|
|
||||||
@click="handlePeriodChange(period.value)"
|
|
||||||
>
|
|
||||||
{{ period.label }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 添加日期选择器 -->
|
|
||||||
<div v-if="showDatePicker" class="date-picker-container">
|
|
||||||
<div class="date-picker-wrapper">
|
|
||||||
<el-date-picker
|
|
||||||
v-model="customDateRange"
|
|
||||||
type="daterange"
|
|
||||||
unlink-panels
|
|
||||||
range-separator="至"
|
|
||||||
start-placeholder="开始日期"
|
|
||||||
end-placeholder="结束日期"
|
|
||||||
:shortcuts="shortcuts"
|
|
||||||
format="YYYY-MM-DD"
|
|
||||||
value-format="YYYY-MM-DD"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
@click="handleDateSearch"
|
|
||||||
class="search-button"
|
|
||||||
>搜索</el-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 简化体检编号搜索框 -->
|
<!-- 简化体检编号搜索框 -->
|
||||||
@ -331,9 +313,7 @@ import { PatientApi } from '@/api/inspect/inspectpatient'
|
|||||||
import { PatientitemsApi } from '@/api/inspect/inspectpatientitems'
|
import { PatientitemsApi } from '@/api/inspect/inspectpatientitems'
|
||||||
import { getUserProfile } from '@/api/system/user/profile'
|
import { getUserProfile } from '@/api/system/user/profile'
|
||||||
import ExamImages from './Exam_images.vue'
|
import ExamImages from './Exam_images.vue'
|
||||||
import CT from './CT.vue' // 导入CT组件
|
import { ArrowDown, Refresh, RefreshRight } from '@element-plus/icons-vue'
|
||||||
import { ArrowDown, Refresh } from '@element-plus/icons-vue'
|
|
||||||
import BloodTest from './blood.vue' // 导入血常规组件
|
|
||||||
import All from './All.vue' // 导入All组件用于超声、心电图等
|
import All from './All.vue' // 导入All组件用于超声、心电图等
|
||||||
|
|
||||||
const dialogTitle = ref('体检报告')
|
const dialogTitle = ref('体检报告')
|
||||||
@ -390,7 +370,8 @@ const examTabs = ref([
|
|||||||
{ id: 'ultrasound', name: '超声', color: '#0099CC' },
|
{ id: 'ultrasound', name: '超声', color: '#0099CC' },
|
||||||
{ id: 'ecg', name: '心电图', color: '#00CCFF' },
|
{ id: 'ecg', name: '心电图', color: '#00CCFF' },
|
||||||
{ id: 'blood', name: '血常规', color: '#66CCFF' },
|
{ id: 'blood', name: '血常规', color: '#66CCFF' },
|
||||||
{ id: 'urine', name: '尿常规', color: '#99CCFF' }
|
{ id: 'urine', name: '尿常规', color: '#99CCFF' },
|
||||||
|
{ id: 'biochemical', name: '生化', color: '#0099CC' }
|
||||||
])
|
])
|
||||||
|
|
||||||
const currentTab = ref('general')
|
const currentTab = ref('general')
|
||||||
@ -420,10 +401,33 @@ return [...currentExamItems.value].sort((a, b) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// 修改切换标签页函数,添加小结切换逻辑
|
// 修改切换标签页函数,添加数据清理逻辑
|
||||||
const switchTab = (tabId) => {
|
const switchTab = (tabId) => {
|
||||||
currentTab.value = tabId
|
// 保存当前标签页的数据
|
||||||
// 不再需要单独设置 activeConclusion
|
if (currentTab.value && examItems.value) {
|
||||||
|
// 存储当前标签页的数据到缓存
|
||||||
|
const currentItems = sortedExamItems.value || [];
|
||||||
|
|
||||||
|
// 如果切换到新标签页,检查是否有数据
|
||||||
|
if (tabId !== currentTab.value) {
|
||||||
|
// 设置新的当前标签
|
||||||
|
currentTab.value = tabId;
|
||||||
|
|
||||||
|
// 如果新标签页没有数据,显示空状态
|
||||||
|
if (!examItems.value[tabId] || examItems.value[tabId].length === 0) {
|
||||||
|
// 确保该标签页有一个空数组
|
||||||
|
examItems.value[tabId] = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 如果没有当前标签页数据,直接设置新标签
|
||||||
|
currentTab.value = tabId;
|
||||||
|
|
||||||
|
// 确保该标签页有一个空数组
|
||||||
|
if (!examItems.value[tabId]) {
|
||||||
|
examItems.value[tabId] = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改 conclusionData 的数据结构
|
// 修改 conclusionData 的数据结构
|
||||||
@ -432,58 +436,14 @@ const conclusionData = ref({
|
|||||||
ultrasound: { finding: '', diagnosis: '' },
|
ultrasound: { finding: '', diagnosis: '' },
|
||||||
ecg: { finding: '', diagnosis: '' },
|
ecg: { finding: '', diagnosis: '' },
|
||||||
blood: { summary: '' },
|
blood: { summary: '' },
|
||||||
urine: { summary: '' }
|
urine: { summary: '' },
|
||||||
|
biochemical: { summary: '' } // 添加生化检查的小结
|
||||||
})
|
})
|
||||||
|
|
||||||
// 其他数据
|
// 其他数据
|
||||||
const examConclusion = ref('')
|
const examConclusion = ref('')
|
||||||
const examDate = ref('')
|
const examDate = ref('')
|
||||||
|
|
||||||
// 添加时间周期选项
|
|
||||||
const timePeriods = [
|
|
||||||
{ label: '今日', value: 'today' },
|
|
||||||
{ label: '本周', value: 'week' },
|
|
||||||
{ label: '本月', value: 'month' },
|
|
||||||
{ label: '自定义', value: 'custom' },
|
|
||||||
{ label: '重置', value: 'reset' }
|
|
||||||
]
|
|
||||||
|
|
||||||
// 添加日期相关的响应式数据
|
|
||||||
const selectedPeriod = ref('today')
|
|
||||||
const showDatePicker = ref(false)
|
|
||||||
const customDateRange = ref([])
|
|
||||||
|
|
||||||
// 添加日期快捷选项
|
|
||||||
const shortcuts = [
|
|
||||||
{
|
|
||||||
text: '最近一周',
|
|
||||||
value: () => {
|
|
||||||
const end = new Date()
|
|
||||||
const start = new Date()
|
|
||||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
|
|
||||||
return [start, end]
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '最近一个月',
|
|
||||||
value: () => {
|
|
||||||
const end = new Date()
|
|
||||||
const start = new Date()
|
|
||||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
|
|
||||||
return [start, end]
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '最近三个月',
|
|
||||||
value: () => {
|
|
||||||
const end = new Date()
|
|
||||||
const start = new Date()
|
|
||||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
|
|
||||||
return [start, end]
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
const pageNo = ref(1)
|
const pageNo = ref(1)
|
||||||
const pageSize = ref(100)
|
const pageSize = ref(100)
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
@ -491,7 +451,6 @@ const total = ref(0)
|
|||||||
// 添加搜索相关的状态
|
// 添加搜索相关的状态
|
||||||
const searchQuery = ref('')
|
const searchQuery = ref('')
|
||||||
const originalPatients = ref([]) // 保存原始患者列表
|
const originalPatients = ref([]) // 保存原始患者列表
|
||||||
const filteredPatients = ref([]) // 添加过滤后的患者列表
|
|
||||||
|
|
||||||
// 添加数据缓存
|
// 添加数据缓存
|
||||||
const patientDataCache = ref(new Map())
|
const patientDataCache = ref(new Map())
|
||||||
@ -513,7 +472,7 @@ const handleLocalSearch = () => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改获取患者列表数据的函数,确保状态更新
|
// 修改获取患者列表数据的函数
|
||||||
const getPatientList = async () => {
|
const getPatientList = async () => {
|
||||||
try {
|
try {
|
||||||
const loading = ElLoading.service({
|
const loading = ElLoading.service({
|
||||||
@ -526,71 +485,63 @@ const getPatientList = async () => {
|
|||||||
pageNo: pageNo.value,
|
pageNo: pageNo.value,
|
||||||
pageSize: pageSize.value
|
pageSize: pageSize.value
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await PatientApi.getPatientPage(params)
|
const res = await PatientApi.getPatientPage(params)
|
||||||
|
|
||||||
// 获取患者列表后,检查每个患者的检查状态
|
|
||||||
if (res.list && res.list.length > 0) {
|
if (res.list && res.list.length > 0) {
|
||||||
// 可以考虑批量查询所有患者的检查项目状态
|
patients.value = res.list
|
||||||
// 或者在后端接口中直接返回每个患者的检查状态
|
originalPatients.value = res.list
|
||||||
|
total.value = res.total
|
||||||
|
} else {
|
||||||
|
patients.value = []
|
||||||
|
originalPatients.value = []
|
||||||
|
total.value = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
patients.value = res.list
|
|
||||||
originalPatients.value = res.list // 保存原始列表用于搜索
|
|
||||||
filteredPatients.value = res.list // 初始化过滤后的列表
|
|
||||||
total.value = res.total
|
|
||||||
|
|
||||||
loading.close()
|
loading.close()
|
||||||
|
|
||||||
// 如果当前有选中的患者,更新其状态
|
|
||||||
if (selectedPatient.value) {
|
|
||||||
const updatedPatient = res.list.find(p => p.id === selectedPatient.value.id)
|
|
||||||
if (updatedPatient) {
|
|
||||||
selectedPatient.value = updatedPatient
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取患者列表出错:', error)
|
console.error('获取患者列表出错:', error)
|
||||||
message.error('获取患者列表出错')
|
ElMessage.error('获取患者列表失败')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改获取患者体检项目数据的方法
|
// 修改获取患者体检项目数据的方法
|
||||||
const getpatientitemData = async (medicalSn) => {
|
const getpatientitemData = async (medicalSn) => {
|
||||||
try {
|
try {
|
||||||
const params = {
|
const params = {
|
||||||
medicalSn: medicalSn,
|
medicalSn: medicalSn,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 100
|
pageSize: 100
|
||||||
}
|
}
|
||||||
const itemsRes = await PatientitemsApi.getPatientitemsPage(params)
|
const itemsRes = await PatientitemsApi.getPatientitemsPage(params)
|
||||||
|
|
||||||
if (itemsRes.list && itemsRes.list.length > 0) {
|
|
||||||
patientitemData.value = itemsRes.list[0]
|
|
||||||
|
|
||||||
// 获取用户信息
|
if (itemsRes.list && itemsRes.list.length > 0) {
|
||||||
const userProfile = await getUserProfile()
|
patientitemData.value = itemsRes.list[0]
|
||||||
user.value = userProfile
|
|
||||||
|
// 获取用户信息
|
||||||
// 检查当前部门的项目状态
|
const userProfile = await getUserProfile()
|
||||||
const currentDeptItems = itemsRes.list.filter(item =>
|
user.value = userProfile
|
||||||
item.sectionID === userProfile.deptId || item.sectionID == userProfile.deptId
|
|
||||||
)
|
// 检查当前部门的项目状态
|
||||||
// 如果有项目且都是已检查状态,更新患者状态
|
const currentDeptItems = itemsRes.list.filter(item =>
|
||||||
if (currentDeptItems.length > 0 && currentDeptItems.every(item => item.itemStatus === '1')) {
|
item.sectionID === userProfile.deptId || item.sectionID == userProfile.deptId
|
||||||
// 更新患者列表中的状态
|
)
|
||||||
const patientIndex = patients.value.findIndex(p => p.medicalSn === medicalSn)
|
// 如果有项目且都是已检查状态,更新患者状态
|
||||||
if (patientIndex !== -1) {
|
if (currentDeptItems.length > 0 && currentDeptItems.every(item => item.itemStatus === '1')) {
|
||||||
patients.value[patientIndex] = {
|
// 更新患者列表中的状态
|
||||||
...patients.value[patientIndex],
|
const patientIndex = patients.value.findIndex(p => p.medicalSn === medicalSn)
|
||||||
examStatus: '1' // 添加检查状态属性
|
if (patientIndex !== -1) {
|
||||||
|
patients.value[patientIndex] = {
|
||||||
|
...patients.value[patientIndex],
|
||||||
|
examStatus: '1' // 添加检查状态属性
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取患者体检项目数据出错:', error)
|
||||||
|
message.error('获取患者体检项目数据出错')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
console.error('获取患者体检项目数据出错:', error)
|
|
||||||
message.error('获取患者体检项目数据出错')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除原来的loadPatientData声明,只保留这一个完整的实现
|
// 删除原来的loadPatientData声明,只保留这一个完整的实现
|
||||||
@ -627,18 +578,11 @@ const loadPatientData = async (patient) => {
|
|||||||
// 检查患者是否已有检查项目
|
// 检查患者是否已有检查项目
|
||||||
const hasItems = await checkPatientHasItems(patient.medicalSn)
|
const hasItems = await checkPatientHasItems(patient.medicalSn)
|
||||||
|
|
||||||
// 如果没有检查项目,自动同步
|
// 如果没有检查项目,提示用户需要同步
|
||||||
if (!hasItems) {
|
if (!hasItems) {
|
||||||
console.log('患者没有检查项目,自动同步')
|
console.log('患者没有检查项目,需要同步')
|
||||||
try {
|
ElMessage.info('该患者没有检查项目,请点击"同步"按钮获取最新数据')
|
||||||
await PatientitemsApi.createPatientapiInfo({
|
// 不再自动同步
|
||||||
medicalSn: patient.medicalSn
|
|
||||||
})
|
|
||||||
console.log('自动同步成功')
|
|
||||||
} catch (syncError) {
|
|
||||||
console.error('自动同步失败:', syncError)
|
|
||||||
// 同步失败不阻止后续操作
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取检查项目
|
// 获取检查项目
|
||||||
@ -659,7 +603,8 @@ const loadPatientData = async (patient) => {
|
|||||||
ultrasound: { finding: '', diagnosis: '' },
|
ultrasound: { finding: '', diagnosis: '' },
|
||||||
ecg: { finding: '', diagnosis: '' },
|
ecg: { finding: '', diagnosis: '' },
|
||||||
blood: { summary: '' },
|
blood: { summary: '' },
|
||||||
urine: { summary: '' }
|
urine: { summary: '' },
|
||||||
|
biochemical: { summary: '' } // 添加生化检查的小结
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化检查医生和检查时间为空
|
// 初始化检查医生和检查时间为空
|
||||||
@ -736,6 +681,9 @@ const getCategoryByItemName = (itemName) => {
|
|||||||
return 'blood'
|
return 'blood'
|
||||||
} else if (itemName.includes('尿常规') || itemName.includes('尿液分析')) {
|
} else if (itemName.includes('尿常规') || itemName.includes('尿液分析')) {
|
||||||
return 'urine'
|
return 'urine'
|
||||||
|
} else if (itemName.includes('生化') || itemName.includes('肝功能') || itemName.includes('肾功能') ||
|
||||||
|
itemName.includes('血脂') || itemName.includes('血糖') || itemName.includes('电解质')) {
|
||||||
|
return 'biochemical'
|
||||||
} else {
|
} else {
|
||||||
return 'general'
|
return 'general'
|
||||||
}
|
}
|
||||||
@ -886,7 +834,7 @@ return '一般检查'
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 标签颜色映射
|
// 标签颜色映射
|
||||||
const tabColors = ['#003366', '#006699', '#0099CC', '#00CCFF']
|
const tabColors = ['#003366', '#006699', '#0099CC', '#00CCFF', '#0099CC']
|
||||||
const getTabColor = (index) => {
|
const getTabColor = (index) => {
|
||||||
return tabColors[index % tabColors.length]
|
return tabColors[index % tabColors.length]
|
||||||
}
|
}
|
||||||
@ -967,73 +915,14 @@ try {
|
|||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
// 清理页面状态
|
// 清理页面状态
|
||||||
patients.value = []
|
patients.value = []
|
||||||
filteredPatients.value = [] // 初始化过滤后的列表
|
|
||||||
selectedPatient.value = null
|
selectedPatient.value = null
|
||||||
reportData.value = {
|
|
||||||
medicalSn: '',
|
|
||||||
cardId: '',
|
|
||||||
pName: '',
|
|
||||||
gender: '',
|
|
||||||
birthday: '',
|
|
||||||
nationality: '',
|
|
||||||
nation: '',
|
|
||||||
race: '',
|
|
||||||
phoneNum: '',
|
|
||||||
status: 0,
|
|
||||||
reportType: '',
|
|
||||||
medicalDateTime: '',
|
|
||||||
chargeType: '',
|
|
||||||
totalPrice: 0,
|
|
||||||
headPicUrl: '',
|
|
||||||
summaryResult: '',
|
|
||||||
auditor: '',
|
|
||||||
auditorTime: ''
|
|
||||||
}
|
|
||||||
patientitemData.value = {
|
|
||||||
medicalSn: '',
|
|
||||||
itemName: '',
|
|
||||||
itemCode: '',
|
|
||||||
price: 0,
|
|
||||||
discountedPrice: 0,
|
|
||||||
discounted: 0,
|
|
||||||
sectionID: '',
|
|
||||||
examDescription: '',
|
|
||||||
itemResult: '',
|
|
||||||
unit: '',
|
|
||||||
highValue: 0,
|
|
||||||
lowValue: 0,
|
|
||||||
itemStatus: '',
|
|
||||||
createTime: '',
|
|
||||||
positive: '',
|
|
||||||
inspectdoctor: '',
|
|
||||||
inspecttime: ''
|
|
||||||
}
|
|
||||||
customDateRange.value = []
|
|
||||||
|
|
||||||
// 初始化科室类型
|
|
||||||
try {
|
|
||||||
const userProfile = await getUserProfile()
|
|
||||||
user.value = userProfile
|
|
||||||
isImageDepartment.value = checkIsImageDepartment(userProfile.deptId)
|
|
||||||
|
|
||||||
// 添加默认查询所有人员
|
|
||||||
await getPatientList()
|
|
||||||
} catch (error) {
|
|
||||||
console.error('获取用户信息失败:', error)
|
|
||||||
isImageDepartment.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置默认为今日
|
|
||||||
const today = new Date()
|
|
||||||
selectedPeriod.value = 'today'
|
|
||||||
const todayStart = new Date(today)
|
|
||||||
todayStart.setHours(0, 0, 0, 0)
|
|
||||||
const todayEnd = new Date(today)
|
|
||||||
todayEnd.setHours(23, 59, 59, 999)
|
|
||||||
customDateRange.value = [todayStart, todayEnd]
|
|
||||||
|
|
||||||
// 获取今日数据
|
// 设置合理的分页大小
|
||||||
await fetchPatientsByDate()
|
pageSize.value = 20 // 或其他合适的数值
|
||||||
|
pageNo.value = 1
|
||||||
|
|
||||||
|
// 直接调用获取列表方法,不附加任何过滤条件
|
||||||
|
await getPatientList()
|
||||||
})
|
})
|
||||||
|
|
||||||
// 修改处理时间周期切换的函数
|
// 修改处理时间周期切换的函数
|
||||||
@ -1043,6 +932,16 @@ const handlePeriodChange = (period) => {
|
|||||||
// 清除选中状态
|
// 清除选中状态
|
||||||
selectedPatient.value = null
|
selectedPatient.value = null
|
||||||
|
|
||||||
|
if (period === 'reset') {
|
||||||
|
// 重置所有筛选条件
|
||||||
|
selectedPeriod.value = '' // 清除选中的时间周期
|
||||||
|
customDateRange.value = [] // 清除日期范围
|
||||||
|
showDatePicker.value = false
|
||||||
|
// 重新获取所有数据,不带日期过滤
|
||||||
|
getPatientList()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const today = new Date()
|
const today = new Date()
|
||||||
let startDate, endDate
|
let startDate, endDate
|
||||||
|
|
||||||
@ -1076,19 +975,10 @@ const handlePeriodChange = (period) => {
|
|||||||
case 'custom':
|
case 'custom':
|
||||||
showDatePicker.value = !showDatePicker.value
|
showDatePicker.value = !showDatePicker.value
|
||||||
break
|
break
|
||||||
|
|
||||||
case 'reset':
|
|
||||||
selectedPeriod.value = 'today'
|
|
||||||
const todayStart = new Date(today.setHours(0, 0, 0, 0))
|
|
||||||
const todayEnd = new Date(today.setHours(23, 59, 59, 999))
|
|
||||||
customDateRange.value = [todayStart, todayEnd]
|
|
||||||
showDatePicker.value = false
|
|
||||||
fetchPatientsByDate()
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改按日期获取患者列表方法
|
// 修改按日期获取患者列表方法 - 不再自动同步
|
||||||
const fetchPatientsByDate = async () => {
|
const fetchPatientsByDate = async () => {
|
||||||
try {
|
try {
|
||||||
if (!customDateRange.value || customDateRange.value.length !== 2) return
|
if (!customDateRange.value || customDateRange.value.length !== 2) return
|
||||||
@ -1106,7 +996,6 @@ const fetchPatientsByDate = async () => {
|
|||||||
const res = await PatientApi.getPatientPage(params)
|
const res = await PatientApi.getPatientPage(params)
|
||||||
patients.value = res.list
|
patients.value = res.list
|
||||||
originalPatients.value = res.list
|
originalPatients.value = res.list
|
||||||
filteredPatients.value = res.list
|
|
||||||
total.value = res.total
|
total.value = res.total
|
||||||
|
|
||||||
// 如果没有查询到患者,清除右侧详情
|
// 如果没有查询到患者,清除右侧详情
|
||||||
@ -1214,89 +1103,26 @@ const checkEditPermission = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 修改同步结果处理函数
|
// 修改同步结果处理函数
|
||||||
const handleSyncResults = async () => {
|
const handleSync = async () => {
|
||||||
if (!selectedPatient.value?.medicalSn) {
|
|
||||||
console.warn('未选择患者,无法同步')
|
|
||||||
ElMessage.warning('请先选择患者')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log('开始同步患者数据, 体检编号:', selectedPatient.value.medicalSn)
|
|
||||||
const loading = ElLoading.service({
|
const loading = ElLoading.service({
|
||||||
lock: true,
|
lock: true,
|
||||||
text: '同步中...',
|
text: '同步中...',
|
||||||
background: 'rgba(255, 255, 255, 0.7)'
|
background: 'rgba(255, 255, 255, 0.7)'
|
||||||
})
|
})
|
||||||
|
|
||||||
// 先查询该体检编号是否已有检查项目
|
|
||||||
const existingItems = await PatientitemsApi.getPatientitemsPage({
|
|
||||||
medicalSn: selectedPatient.value.medicalSn,
|
|
||||||
pageNo: 1,
|
|
||||||
pageSize: 1
|
|
||||||
})
|
|
||||||
|
|
||||||
// 如果已有检查项目,则不再同步
|
|
||||||
if (existingItems.list && existingItems.list.length > 0) {
|
|
||||||
console.log('该患者已有检查项目,无需再次同步')
|
|
||||||
loading.close()
|
|
||||||
ElMessage.info('该患者已有检查项目,无需再次同步')
|
|
||||||
|
|
||||||
// 重新加载患者数据
|
|
||||||
await loadPatientData(selectedPatient.value)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 调用同步接口
|
|
||||||
const syncResult = await PatientitemsApi.createPatientapiInfo({
|
|
||||||
medicalSn: selectedPatient.value.medicalSn
|
|
||||||
})
|
|
||||||
console.log('同步接口调用成功:', syncResult)
|
|
||||||
|
|
||||||
// 重新加载患者数据
|
|
||||||
console.log('重新加载患者数据')
|
|
||||||
await loadPatientData(selectedPatient.value)
|
|
||||||
console.log('患者数据加载完成')
|
|
||||||
|
|
||||||
loading.close()
|
|
||||||
console.log('同步操作完成')
|
|
||||||
ElMessage.success('同步成功')
|
|
||||||
} catch (error) {
|
|
||||||
console.error('同步失败:', error)
|
|
||||||
ElMessage.error('同步失败,请稍后重试')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修改刷新处理函数
|
|
||||||
const handleRefresh = async () => {
|
|
||||||
try {
|
|
||||||
const loading = ElLoading.service({
|
|
||||||
lock: true,
|
|
||||||
text: '刷新中...',
|
|
||||||
background: 'rgba(255, 255, 255, 0.7)'
|
|
||||||
})
|
|
||||||
|
|
||||||
// 重置所有状态
|
|
||||||
selectedPeriod.value = 'today'
|
|
||||||
showDatePicker.value = false
|
|
||||||
searchQuery.value = ''
|
|
||||||
selectedPatient.value = null
|
|
||||||
pageNo.value = 1
|
|
||||||
|
|
||||||
// 设置今日日期范围
|
|
||||||
const today = new Date()
|
|
||||||
const todayStart = new Date(today.setHours(0, 0, 0, 0))
|
|
||||||
const todayEnd = new Date(today.setHours(23, 59, 59, 999))
|
|
||||||
customDateRange.value = [todayStart, todayEnd]
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 1. 先调用同步接口
|
// 调用同步接口
|
||||||
await PatientitemsApi.createPatientapiInfo({})
|
await PatientitemsApi.createPatientapiInfo({})
|
||||||
|
|
||||||
// 2. 等待一小段时间确保后端数据同步完成
|
// 等待一小段时间确保后端数据同步完成
|
||||||
await new Promise(resolve => setTimeout(resolve, 1000))
|
await new Promise(resolve => setTimeout(resolve, 1000))
|
||||||
|
|
||||||
// 3. 获取最新的患者列表
|
// 获取最新的患者列表
|
||||||
|
const today = new Date()
|
||||||
|
const todayStart = new Date(today.setHours(0, 0, 0, 0))
|
||||||
|
const todayEnd = new Date(today.setHours(23, 59, 59, 999))
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
pageNo: pageNo.value,
|
pageNo: pageNo.value,
|
||||||
pageSize: pageSize.value,
|
pageSize: pageSize.value,
|
||||||
@ -1311,18 +1137,52 @@ const handleRefresh = async () => {
|
|||||||
// 更新列表数据
|
// 更新列表数据
|
||||||
patients.value = res.list
|
patients.value = res.list
|
||||||
originalPatients.value = res.list
|
originalPatients.value = res.list
|
||||||
filteredPatients.value = res.list
|
|
||||||
total.value = res.total
|
total.value = res.total
|
||||||
|
|
||||||
// 清除缓存
|
// 清除缓存
|
||||||
patientDataCache.value.clear()
|
patientDataCache.value.clear()
|
||||||
|
|
||||||
|
loading.close()
|
||||||
|
ElMessage.success('同步成功')
|
||||||
|
} catch (error) {
|
||||||
|
loading.close()
|
||||||
|
console.error('同步数据失败:', error)
|
||||||
|
ElMessage.error('同步数据失败,请稍后重试')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('同步失败:', error)
|
||||||
|
ElMessage.error('同步失败,请稍后重试')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改刷新处理函数 - 移除同步功能
|
||||||
|
const handleRefresh = async () => {
|
||||||
|
try {
|
||||||
|
const loading = ElLoading.service({
|
||||||
|
lock: true,
|
||||||
|
text: '刷新中...',
|
||||||
|
background: 'rgba(255, 255, 255, 0.7)'
|
||||||
|
})
|
||||||
|
|
||||||
|
// 重置所有状态
|
||||||
|
searchQuery.value = ''
|
||||||
|
selectedPatient.value = null
|
||||||
|
pageNo.value = 1
|
||||||
|
statusFilter.value = '0' // 重置为默认的待检查状态
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 获取最新的患者列表
|
||||||
|
await getPatientList()
|
||||||
|
|
||||||
|
// 清除缓存
|
||||||
|
patientDataCache.value.clear()
|
||||||
|
|
||||||
loading.close()
|
loading.close()
|
||||||
ElMessage.success('刷新成功')
|
ElMessage.success('刷新成功')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
loading.close()
|
loading.close()
|
||||||
console.error('同步数据失败:', error)
|
console.error('刷新数据失败:', error)
|
||||||
ElMessage.error('同步数据失败,请稍后重试')
|
ElMessage.error('刷新数据失败,请稍后重试')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('刷新失败:', error)
|
console.error('刷新失败:', error)
|
||||||
@ -1437,7 +1297,7 @@ const isReadOnly = computed(() => {
|
|||||||
// 修改分页处理函数
|
// 修改分页处理函数
|
||||||
const handleCurrentChange = (val) => {
|
const handleCurrentChange = (val) => {
|
||||||
pageNo.value = val
|
pageNo.value = val
|
||||||
getPatientList() // 使用通用查询函数替代特定日期查询
|
getPatientList() // 直接调用获取列表函数
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改签名加载错误处理
|
// 修改签名加载错误处理
|
||||||
@ -1586,6 +1446,13 @@ const validateAllResults = () => {
|
|||||||
errors.push('尿常规体检小结不能为空')
|
errors.push('尿常规体检小结不能为空')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查生化
|
||||||
|
if (conclusionData.value.biochemical) {
|
||||||
|
if (!conclusionData.value.biochemical.summary?.trim()) {
|
||||||
|
errors.push('生化检查体检小结不能为空')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (errors.length > 0) {
|
if (errors.length > 0) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
@ -1601,7 +1468,7 @@ const validateAllResults = () => {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改统一保存方法,更新检查医生和检查日期
|
// 修改统一保存方法,更新检查医生和检查日期,同时更新患者状态和体检日期
|
||||||
const handleSaveAllResults = async () => {
|
const handleSaveAllResults = async () => {
|
||||||
if (!checkEditPermission()) return
|
if (!checkEditPermission()) return
|
||||||
|
|
||||||
@ -1661,18 +1528,28 @@ const handleSaveAllResults = async () => {
|
|||||||
} else if (itemName.includes('血常规') || itemName.includes('血细胞') || itemName.includes('血红蛋白')) {
|
} else if (itemName.includes('血常规') || itemName.includes('血细胞') || itemName.includes('血红蛋白')) {
|
||||||
allUpdatedItems.push({
|
allUpdatedItems.push({
|
||||||
...baseFields,
|
...baseFields,
|
||||||
analyse: conclusionData.value.blood?.summary?.trim() || '' // 只将小结保存到analyse字段
|
analyse: conclusionData.value.blood?.summary?.trim() || '', // 只将小结保存到analyse字段
|
||||||
|
itemResult: conclusionData.value.blood?.summary?.trim() || '' // 同时更新itemResult字段
|
||||||
})
|
})
|
||||||
} else if (itemName.includes('尿常规') || itemName.includes('尿液分析')) {
|
} else if (itemName.includes('尿常规') || itemName.includes('尿液分析')) {
|
||||||
allUpdatedItems.push({
|
allUpdatedItems.push({
|
||||||
...baseFields,
|
...baseFields,
|
||||||
analyse: conclusionData.value.urine?.summary?.trim() || '' // 只将小结保存到analyse字段
|
analyse: conclusionData.value.urine?.summary?.trim() || '', // 只将小结保存到analyse字段
|
||||||
|
itemResult: conclusionData.value.urine?.summary?.trim() || '' // 同时更新itemResult字段
|
||||||
|
})
|
||||||
|
} else if (itemName.includes('生化') || itemName.includes('肝功能') || itemName.includes('肾功能') ||
|
||||||
|
itemName.includes('血脂') || itemName.includes('血糖') || itemName.includes('电解质')) {
|
||||||
|
allUpdatedItems.push({
|
||||||
|
...baseFields,
|
||||||
|
analyse: conclusionData.value.biochemical?.summary?.trim() || '', // 只将小结保存到analyse字段
|
||||||
|
itemResult: conclusionData.value.biochemical?.summary?.trim() || '' // 同时更新itemResult字段
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// 一般检查项目
|
// 一般检查项目
|
||||||
allUpdatedItems.push({
|
allUpdatedItems.push({
|
||||||
...baseFields,
|
...baseFields,
|
||||||
analyse: conclusionData.value.general?.summary?.trim() || '' // 只将小结保存到analyse字段
|
analyse: conclusionData.value.general?.summary?.trim() || '', // 只将小结保存到analyse字段
|
||||||
|
itemResult: conclusionData.value.general?.summary?.trim() || '' // 同时更新itemResult字段
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1692,25 +1569,29 @@ const handleSaveAllResults = async () => {
|
|||||||
|
|
||||||
// 更新患者状态为已检查 - 调用更新患者状态的API
|
// 更新患者状态为已检查 - 调用更新患者状态的API
|
||||||
if (selectedPatient.value) {
|
if (selectedPatient.value) {
|
||||||
// 更新数据库中的status字段为1
|
// 更新数据库中的status字段为1,同时更新体检日期为当前时间戳
|
||||||
await PatientApi.updatePatient({
|
await PatientApi.updatePatient({
|
||||||
id: selectedPatient.value.id,
|
id: selectedPatient.value.id,
|
||||||
status: 1 // 设置为已检查状态
|
status: 1, // 设置为已检查状态
|
||||||
|
medicalDateTime: currentTimestamp // 更新体检日期为当前时间戳
|
||||||
})
|
})
|
||||||
|
|
||||||
// 更新本地状态
|
// 更新本地状态
|
||||||
selectedPatient.value.status = 1
|
selectedPatient.value.status = 1
|
||||||
|
selectedPatient.value.medicalDateTime = currentTimestamp
|
||||||
|
|
||||||
// 更新列表中的患者状态
|
// 更新列表中的患者状态
|
||||||
const patientIndex = patients.value.findIndex(p => p.id === selectedPatient.value.id)
|
const patientIndex = patients.value.findIndex(p => p.id === selectedPatient.value.id)
|
||||||
if (patientIndex !== -1) {
|
if (patientIndex !== -1) {
|
||||||
patients.value[patientIndex].status = 1
|
patients.value[patientIndex].status = 1
|
||||||
|
patients.value[patientIndex].medicalDateTime = currentTimestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新过滤后的列表中的患者状态
|
// 更新过滤后的列表中的患者状态
|
||||||
const filteredIndex = filteredPatients.value.findIndex(p => p.id === selectedPatient.value.id)
|
const filteredIndex = filteredPatients.value.findIndex(p => p.id === selectedPatient.value.id)
|
||||||
if (filteredIndex !== -1) {
|
if (filteredIndex !== -1) {
|
||||||
filteredPatients.value[filteredIndex].status = 1
|
filteredPatients.value[filteredIndex].status = 1
|
||||||
|
filteredPatients.value[filteredIndex].medicalDateTime = currentTimestamp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1772,9 +1653,42 @@ const inspectTime = ref('')
|
|||||||
|
|
||||||
// 添加特殊检查类型的计算属性
|
// 添加特殊检查类型的计算属性
|
||||||
const isSpecialExam = computed(() => {
|
const isSpecialExam = computed(() => {
|
||||||
return ['ultrasound', 'ecg', 'blood', 'urine'].includes(currentTab.value)
|
return ['ultrasound', 'ecg', 'blood', 'urine', 'biochemical'].includes(currentTab.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 添加状态筛选的响应式引用
|
||||||
|
const statusFilter = ref('0') // 默认选择待检查
|
||||||
|
|
||||||
|
// 修改过滤后的患者列表计算属性
|
||||||
|
const filteredPatients = computed(() => {
|
||||||
|
let result = patients.value
|
||||||
|
|
||||||
|
// 先按状态筛选
|
||||||
|
if (statusFilter.value !== '') {
|
||||||
|
result = result.filter(patient =>
|
||||||
|
String(patient.status) === statusFilter.value
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 再按搜索词筛选
|
||||||
|
if (searchQuery.value) {
|
||||||
|
const query = searchQuery.value.toLowerCase()
|
||||||
|
result = result.filter(patient =>
|
||||||
|
(patient.pname && patient.pname.toLowerCase().includes(query)) ||
|
||||||
|
(patient.medicalSn && patient.medicalSn.toLowerCase().includes(query))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
|
||||||
|
// 添加状态筛选变化处理函数
|
||||||
|
const handleStatusFilterChange = (value) => {
|
||||||
|
statusFilter.value = value
|
||||||
|
// 重置选中的患者
|
||||||
|
selectedPatient.value = null
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -1803,11 +1717,13 @@ color: #333;
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
padding: 8px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-options {
|
.filter-options {
|
||||||
padding: 10px 15px;
|
width: 100%;
|
||||||
border-bottom: 1px solid #e6e6e6;
|
padding: 0 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.radio-label {
|
.radio-label {
|
||||||
@ -2673,4 +2589,45 @@ cursor: not-allowed;
|
|||||||
background-color: #f5f7fa;
|
background-color: #f5f7fa;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 修改按钮样式 */
|
||||||
|
.header-buttons {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 8px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 确保按钮容器有足够的宽度 */
|
||||||
|
.filter-options {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 确保按钮不会换行 */
|
||||||
|
.header-buttons .el-button {
|
||||||
|
flex-shrink: 0;
|
||||||
|
margin-left: 8px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 添加状态筛选样式 */
|
||||||
|
.status-filter {
|
||||||
|
padding: 10px 15px;
|
||||||
|
border-bottom: 1px solid #e6e6e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-radio-group) {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-radio) {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-radio__label) {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
247
src/views/Inspection-checklist/Inspection-checklist.vue
Normal file
247
src/views/Inspection-checklist/Inspection-checklist.vue
Normal file
@ -0,0 +1,247 @@
|
|||||||
|
<template>
|
||||||
|
<div id="PrintElementOptionSetting" style="display:none;"></div>
|
||||||
|
|
||||||
|
<ContentWrap style="height: 70px; display: flex; align-items: center;">
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<el-form
|
||||||
|
class="-mb-15px"
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryFormRef"
|
||||||
|
:inline="true"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
|
<el-form-item label="体检编号" prop="medicalSn">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.medicalSn"
|
||||||
|
placeholder="请输入体检编号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-200px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="姓名" prop="pname">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.pname"
|
||||||
|
placeholder="请输入姓名"
|
||||||
|
clearable
|
||||||
|
@input="handleQuery"
|
||||||
|
class="!w-200px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="体检日期" prop="medicalDateTime">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="queryParams.medicalDateTime"
|
||||||
|
type="daterange"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
:default-time="[
|
||||||
|
new Date(2000, 1, 1, 0, 0, 0),
|
||||||
|
new Date(2000, 1, 1, 23, 59, 59)
|
||||||
|
]"
|
||||||
|
clearable
|
||||||
|
class="!w-320px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="handleQuery">
|
||||||
|
<Icon icon="ep:search" class="mr-5px" /> 查询
|
||||||
|
</el-button>
|
||||||
|
<el-button type="success" @click="handleImport">
|
||||||
|
<Icon icon="ep:upload" class="mr-5px" /> 导入Excel文件
|
||||||
|
</el-button>
|
||||||
|
<input
|
||||||
|
type="file"
|
||||||
|
ref="fileInputRef"
|
||||||
|
accept=".xlsx,.xls"
|
||||||
|
style="display: none"
|
||||||
|
@change="uploadFile"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<ContentWrap>
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="list"
|
||||||
|
:stripe="true"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
:header-cell-style="{ background: 'rgb(235, 241, 250)', height: '56px',color:'#333333' }"
|
||||||
|
:row-style="{ height: '56px' }"
|
||||||
|
>
|
||||||
|
<el-table-column label="体检编号" align="center" prop="medicalSn" />
|
||||||
|
<el-table-column label="姓名" align="center" prop="pname" />
|
||||||
|
<el-table-column label="性别" align="center" prop="gender" />
|
||||||
|
<el-table-column label="身份证号" align="center" prop="cardId" />
|
||||||
|
<el-table-column label="联系电话" align="center" prop="phoneNum" />
|
||||||
|
<el-table-column label="住址" align="center" prop="domicileaddress" />
|
||||||
|
<el-table-column label="体检日期" align="center" prop="medicalDateTime" :formatter="dateFormatter" />
|
||||||
|
<el-table-column label="操作" align="center" fixed="right" width="120px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="handlePrint(scope.row)"
|
||||||
|
>
|
||||||
|
打印导检单
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
|
<DepartmentForm ref="formRef" @success="getList" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { PatientApi, type PatientVO } from '@/api/inspect/inspectpatient'
|
||||||
|
import * as SummaryApi from "@/api/summary";
|
||||||
|
import { newHiprintPrintTemplate } from "@/views/summary/utils/template-helper";
|
||||||
|
import template from "@/views/summary/print/template";
|
||||||
|
|
||||||
|
defineOptions({ name: 'Department' })
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const loading = ref(true) // 列表的加载中
|
||||||
|
const list = ref<PatientVO[]>([]) // 用于展示的数据
|
||||||
|
const total = ref(0) // 列表的总页数
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
medicalSn: undefined,
|
||||||
|
pname: undefined,
|
||||||
|
medicalDateTime: [],
|
||||||
|
cardId: undefined,
|
||||||
|
phoneNum: undefined,
|
||||||
|
domicileaddress: undefined
|
||||||
|
})
|
||||||
|
const queryFormRef = ref() // 搜索的表单
|
||||||
|
const fileInputRef = ref<HTMLInputElement | null>(null) // 文件输入引用
|
||||||
|
|
||||||
|
/** 获取列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await PatientApi.getPatientPage({
|
||||||
|
pageNo: queryParams.pageNo,
|
||||||
|
pageSize: queryParams.pageSize,
|
||||||
|
medicalSn: queryParams.medicalSn,
|
||||||
|
pname: queryParams.pname,
|
||||||
|
medicalDateTime: queryParams.medicalDateTime,
|
||||||
|
cardId: queryParams.cardId,
|
||||||
|
phoneNum: queryParams.phoneNum,
|
||||||
|
domicileaddress: queryParams.domicileaddress
|
||||||
|
})
|
||||||
|
list.value = data.list
|
||||||
|
total.value = data.total
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
/** 添加/修改操作 */
|
||||||
|
const formRef = ref()
|
||||||
|
/** 初始化 **/
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 打印报告按钮操作 */
|
||||||
|
const handlePrint = async (row: PatientVO) => {
|
||||||
|
try {
|
||||||
|
console.log('开始打印,体检编号:', row.medicalSn);
|
||||||
|
|
||||||
|
// 使用SummaryApi打印导检单
|
||||||
|
const dataPrint = await SummaryApi.printInfoOfMedicalSn(row.medicalSn);
|
||||||
|
console.log('获取到的打印数据:', dataPrint);
|
||||||
|
|
||||||
|
// 创建打印模板 - 修改这里,使用固定的模板名称而不是动态获取
|
||||||
|
const hiprintTemplate = newHiprintPrintTemplate("InspectionChecklist", {
|
||||||
|
template: template,
|
||||||
|
settingContainer: "#PrintElementOptionSetting",
|
||||||
|
});
|
||||||
|
console.log('打印模板创建成功');
|
||||||
|
|
||||||
|
// 打印设置
|
||||||
|
const options = {leftOffset: -1, topOffset: -1};
|
||||||
|
|
||||||
|
// 扩展配置
|
||||||
|
const ext = {
|
||||||
|
callback: () => {
|
||||||
|
console.log("浏览器打印窗口已打开");
|
||||||
|
},
|
||||||
|
styleHandler: () => {
|
||||||
|
return "<style>.hiprint-printElement-text{color:black !important;}</style>";
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// 调用浏览器打印
|
||||||
|
hiprintTemplate.print(dataPrint, options, ext);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('打印导检单失败,详细错误:', error);
|
||||||
|
message.error(`打印导检单失败: ${error.message || '未知错误'}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 日期格式化 */
|
||||||
|
const dateFormatter = (row: any, column: any) => {
|
||||||
|
if (!row.medicalDateTime) return ''
|
||||||
|
const date = new Date(row.medicalDateTime)
|
||||||
|
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 处理导入按钮点击 */
|
||||||
|
const handleImport = () => {
|
||||||
|
fileInputRef.value?.click()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 处理文件上传 */
|
||||||
|
const uploadFile = async (event: Event) => {
|
||||||
|
const target = event.target as HTMLInputElement
|
||||||
|
if (!target.files || target.files.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const file = target.files[0]
|
||||||
|
if (!file.name.endsWith('.xlsx') && !file.name.endsWith('.xls')) {
|
||||||
|
message.error('请上传Excel文件(.xlsx或.xls格式)')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
loading.value = true
|
||||||
|
const formData = new FormData()
|
||||||
|
formData.append('file', file)
|
||||||
|
|
||||||
|
await PatientApi.uploadExcel(formData)
|
||||||
|
message.success('导入成功')
|
||||||
|
// 重置文件输入
|
||||||
|
if (fileInputRef.value) {
|
||||||
|
fileInputRef.value.value = ''
|
||||||
|
}
|
||||||
|
// 刷新列表
|
||||||
|
await getList()
|
||||||
|
} catch (error) {
|
||||||
|
console.error('导入失败:', error)
|
||||||
|
message.error('导入失败,请检查文件格式是否正确')
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user