换卡处理的分页
This commit is contained in:
@@ -46,7 +46,7 @@ export const getPatientInfo = (patientId) => {
|
||||
};
|
||||
|
||||
// 获取患者详细信息
|
||||
export function getPatientInfo(patientId) {
|
||||
/* export function getPatientInfo(patientId) {
|
||||
return request({
|
||||
url: '/cardRenewal/patient/info/' + patientId,
|
||||
method: 'get'
|
||||
@@ -58,4 +58,4 @@ export function getPatientInfo(patientId) {
|
||||
data: {}
|
||||
};
|
||||
});
|
||||
}
|
||||
} */
|
||||
@@ -17,3 +17,26 @@ export const doCardRenewal = (params) => {
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询患者信息 - 复用门诊挂号的API
|
||||
* @param {Object} params - 查询参数
|
||||
* @param {string} params.searchKey - 搜索关键字(姓名、身份证号、手机号等)
|
||||
* @param {number} params.pageNo - 当前页码
|
||||
* @param {number} params.pageSize - 每页大小
|
||||
* @returns {Promise} 请求结果
|
||||
*/
|
||||
export const getPatientList = (params) => {
|
||||
// 构建searchKey参数,将姓名、身份证号、手机号组合成一个搜索关键字
|
||||
const searchKey = params.patientName || params.idCard || params.phoneNumber || '';
|
||||
|
||||
return request({
|
||||
url: '/charge-manage/register/patient-metadata',
|
||||
method: 'get',
|
||||
params: {
|
||||
searchKey: searchKey,
|
||||
pageNo: params.pageNo || 1,
|
||||
pageSize: params.pageSize || 10
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -190,6 +190,20 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页组件 -->
|
||||
<div style="margin-top: 15px; display: flex; justify-content: flex-end;">
|
||||
<el-pagination
|
||||
v-model:current-page="currentPage"
|
||||
v-model:page-size="pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="showPatientList = false">取消</el-button>
|
||||
@@ -220,9 +234,8 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, onUnmounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { getPatientList } from '@/api/cardRenewal/api.js';
|
||||
import { doCardRenewal } from './components/api.js';
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { doCardRenewal, getPatientList } from './components/api.js';
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive({
|
||||
@@ -237,6 +250,10 @@ const patientInfo = ref(null)
|
||||
// 患者列表
|
||||
const patientList = ref([])
|
||||
const showPatientList = ref(false)
|
||||
// 分页相关状态
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(10)
|
||||
const total = ref(0)
|
||||
|
||||
// 换卡表单
|
||||
const renewalForm = reactive({
|
||||
@@ -249,6 +266,23 @@ const loading = ref(false)
|
||||
// 成功弹窗显示状态
|
||||
const renewalSuccessVisible = ref(false)
|
||||
|
||||
// 分页大小变化处理
|
||||
const handleSizeChange = (newSize) => {
|
||||
pageSize.value = newSize
|
||||
currentPage.value = 1 // 重置为第一页
|
||||
if (showPatientList.value) {
|
||||
handlePatientSearch() // 重新查询
|
||||
}
|
||||
}
|
||||
|
||||
// 当前页码变化处理
|
||||
const handleCurrentChange = (newPage) => {
|
||||
currentPage.value = newPage
|
||||
if (showPatientList.value) {
|
||||
handlePatientSearch() // 重新查询
|
||||
}
|
||||
}
|
||||
|
||||
// 查询患者信息
|
||||
const handlePatientSearch = async () => {
|
||||
// 检查是否至少填写了一个查询条件
|
||||
@@ -259,26 +293,29 @@ const renewalSuccessVisible = ref(false)
|
||||
|
||||
loading.value = true
|
||||
try {
|
||||
// 构建查询参数,使用专门的换卡API
|
||||
// 构建查询参数,包含分页信息
|
||||
const queryParams = {
|
||||
patientName: searchForm.patientName || '',
|
||||
idCard: searchForm.idCard || '',
|
||||
phoneNumber: searchForm.phoneNumber || ''
|
||||
phoneNumber: searchForm.phoneNumber || '',
|
||||
pageNo: currentPage.value,
|
||||
pageSize: pageSize.value
|
||||
}
|
||||
|
||||
// 调用专门的换卡API获取患者列表
|
||||
// 调用复用的门诊挂号API获取患者列表
|
||||
const response = await getPatientList(queryParams)
|
||||
|
||||
// 查询患者数据
|
||||
|
||||
if (response && response.code === 200) {
|
||||
// 检查是否有查询结果
|
||||
if (response.rows && response.rows.length > 0) {
|
||||
// 如果只有一条记录,直接显示
|
||||
if (response.rows.length === 1) {
|
||||
const patient = response.rows[0]
|
||||
if (response.data && response.data.records && response.data.records.length > 0) {
|
||||
// 更新总条数
|
||||
total.value = response.data.total || 0
|
||||
|
||||
// 获取门诊号码,优先使用identifierNo
|
||||
// 如果只有一条记录且是第一页,直接显示
|
||||
if (response.data.records.length === 1 && currentPage.value === 1) {
|
||||
const patient = response.data.records[0]
|
||||
|
||||
// 获取门诊号码,优先使用identifierNo或patientId
|
||||
const outpatientNo = patient.identifierNo || patient.cardNo || patient.card_number || patient.就诊卡号 || patient.outpatientNumber || patient.outpatientNo || patient.门诊号码 || patient.卡号 || patient.card || patient.patientNo || patient.patient_id;
|
||||
// 获取性别,优先使用genderEnum_enumText
|
||||
const gender = patient.genderEnum_enumText || patient.gender || patient.sex || patient.性别 || patient.xb || patient.sexCode || patient.GENDER || patient.SEX;
|
||||
@@ -293,12 +330,14 @@ const renewalSuccessVisible = ref(false)
|
||||
patientId: patient.patientId || outpatientNo
|
||||
}
|
||||
} else {
|
||||
// 有多条记录时,显示患者列表供选择
|
||||
// 如果有多条记录或不是第一页,显示患者列表供选择
|
||||
patientList.value = response.data.records
|
||||
showPatientList.value = true
|
||||
patientList.value = response.rows
|
||||
}
|
||||
} else {
|
||||
ElMessage.warning('未找到符合条件的患者信息')
|
||||
// 无数据时重置总条数
|
||||
total.value = 0
|
||||
ElMessage.warning('未查询到患者信息')
|
||||
}
|
||||
} else {
|
||||
ElMessage.error('查询失败:' + (response?.msg || '未知错误'))
|
||||
@@ -306,7 +345,7 @@ const renewalSuccessVisible = ref(false)
|
||||
|
||||
} catch (error) {
|
||||
ElMessage.error('查询失败,请稍后重试')
|
||||
console.error('查询患者信息失败:', error)
|
||||
// 可以在这里添加错误监控或日志记录
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
@@ -352,7 +391,7 @@ const handleConfirm = async () => {
|
||||
|
||||
} catch (error) {
|
||||
ElMessage.error('换卡失败,请稍后重试')
|
||||
console.error('换卡失败:', error)
|
||||
// 可以在这里添加错误监控或日志记录
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
@@ -428,6 +467,10 @@ onUnmounted(() => {
|
||||
patientList.value = []
|
||||
showPatientList.value = false
|
||||
renewalForm.newOutpatientNo = ''
|
||||
// 重置分页状态
|
||||
currentPage.value = 1
|
||||
pageSize.value = 10
|
||||
total.value = 0
|
||||
}
|
||||
|
||||
// 格式化日期为YYYY-MM-DD格式
|
||||
|
||||
Reference in New Issue
Block a user