换卡处理的分页
This commit is contained in:
@@ -46,7 +46,7 @@ export const getPatientInfo = (patientId) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 获取患者详细信息
|
// 获取患者详细信息
|
||||||
export function getPatientInfo(patientId) {
|
/* export function getPatientInfo(patientId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/cardRenewal/patient/info/' + patientId,
|
url: '/cardRenewal/patient/info/' + patientId,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
@@ -58,4 +58,4 @@ export function getPatientInfo(patientId) {
|
|||||||
data: {}
|
data: {}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
} */
|
||||||
@@ -16,4 +16,27 @@ export const doCardRenewal = (params) => {
|
|||||||
method: 'post',
|
method: 'post',
|
||||||
data: 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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</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>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click="showPatientList = false">取消</el-button>
|
<el-button @click="showPatientList = false">取消</el-button>
|
||||||
@@ -220,9 +234,8 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted, onUnmounted } from 'vue'
|
import { ref, reactive, onMounted, onUnmounted } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { getPatientList } from '@/api/cardRenewal/api.js';
|
import { doCardRenewal, getPatientList } from './components/api.js';
|
||||||
import { doCardRenewal } from './components/api.js';
|
|
||||||
|
|
||||||
// 搜索表单
|
// 搜索表单
|
||||||
const searchForm = reactive({
|
const searchForm = reactive({
|
||||||
@@ -237,9 +250,13 @@ const patientInfo = ref(null)
|
|||||||
// 患者列表
|
// 患者列表
|
||||||
const patientList = ref([])
|
const patientList = ref([])
|
||||||
const showPatientList = ref(false)
|
const showPatientList = ref(false)
|
||||||
|
// 分页相关状态
|
||||||
|
const currentPage = ref(1)
|
||||||
|
const pageSize = ref(10)
|
||||||
|
const total = ref(0)
|
||||||
|
|
||||||
// 换卡表单
|
// 换卡表单
|
||||||
const renewalForm = reactive({
|
const renewalForm = reactive({
|
||||||
newOutpatientNo: ''
|
newOutpatientNo: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -249,6 +266,23 @@ const loading = ref(false)
|
|||||||
// 成功弹窗显示状态
|
// 成功弹窗显示状态
|
||||||
const renewalSuccessVisible = 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 () => {
|
const handlePatientSearch = async () => {
|
||||||
// 检查是否至少填写了一个查询条件
|
// 检查是否至少填写了一个查询条件
|
||||||
@@ -259,26 +293,29 @@ const renewalSuccessVisible = ref(false)
|
|||||||
|
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
// 构建查询参数,使用专门的换卡API
|
// 构建查询参数,包含分页信息
|
||||||
const queryParams = {
|
const queryParams = {
|
||||||
patientName: searchForm.patientName || '',
|
patientName: searchForm.patientName || '',
|
||||||
idCard: searchForm.idCard || '',
|
idCard: searchForm.idCard || '',
|
||||||
phoneNumber: searchForm.phoneNumber || ''
|
phoneNumber: searchForm.phoneNumber || '',
|
||||||
|
pageNo: currentPage.value,
|
||||||
|
pageSize: pageSize.value
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调用专门的换卡API获取患者列表
|
// 调用复用的门诊挂号API获取患者列表
|
||||||
const response = await getPatientList(queryParams)
|
const response = await getPatientList(queryParams)
|
||||||
|
|
||||||
// 查询患者数据
|
|
||||||
|
|
||||||
if (response && response.code === 200) {
|
if (response && response.code === 200) {
|
||||||
// 检查是否有查询结果
|
// 检查是否有查询结果
|
||||||
if (response.rows && response.rows.length > 0) {
|
if (response.data && response.data.records && response.data.records.length > 0) {
|
||||||
// 如果只有一条记录,直接显示
|
// 更新总条数
|
||||||
if (response.rows.length === 1) {
|
total.value = response.data.total || 0
|
||||||
const patient = response.rows[0]
|
|
||||||
|
// 如果只有一条记录且是第一页,直接显示
|
||||||
|
if (response.data.records.length === 1 && currentPage.value === 1) {
|
||||||
|
const patient = response.data.records[0]
|
||||||
|
|
||||||
// 获取门诊号码,优先使用identifierNo
|
// 获取门诊号码,优先使用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;
|
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
|
// 获取性别,优先使用genderEnum_enumText
|
||||||
const gender = patient.genderEnum_enumText || patient.gender || patient.sex || patient.性别 || patient.xb || patient.sexCode || patient.GENDER || patient.SEX;
|
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
|
patientId: patient.patientId || outpatientNo
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 有多条记录时,显示患者列表供选择
|
// 如果有多条记录或不是第一页,显示患者列表供选择
|
||||||
|
patientList.value = response.data.records
|
||||||
showPatientList.value = true
|
showPatientList.value = true
|
||||||
patientList.value = response.rows
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ElMessage.warning('未找到符合条件的患者信息')
|
// 无数据时重置总条数
|
||||||
|
total.value = 0
|
||||||
|
ElMessage.warning('未查询到患者信息')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error('查询失败:' + (response?.msg || '未知错误'))
|
ElMessage.error('查询失败:' + (response?.msg || '未知错误'))
|
||||||
@@ -306,7 +345,7 @@ const renewalSuccessVisible = ref(false)
|
|||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
ElMessage.error('查询失败,请稍后重试')
|
ElMessage.error('查询失败,请稍后重试')
|
||||||
console.error('查询患者信息失败:', error)
|
// 可以在这里添加错误监控或日志记录
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
@@ -352,7 +391,7 @@ const handleConfirm = async () => {
|
|||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
ElMessage.error('换卡失败,请稍后重试')
|
ElMessage.error('换卡失败,请稍后重试')
|
||||||
console.error('换卡失败:', error)
|
// 可以在这里添加错误监控或日志记录
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
@@ -428,6 +467,10 @@ onUnmounted(() => {
|
|||||||
patientList.value = []
|
patientList.value = []
|
||||||
showPatientList.value = false
|
showPatientList.value = false
|
||||||
renewalForm.newOutpatientNo = ''
|
renewalForm.newOutpatientNo = ''
|
||||||
|
// 重置分页状态
|
||||||
|
currentPage.value = 1
|
||||||
|
pageSize.value = 10
|
||||||
|
total.value = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// 格式化日期为YYYY-MM-DD格式
|
// 格式化日期为YYYY-MM-DD格式
|
||||||
|
|||||||
Reference in New Issue
Block a user