301
预约管理-》门诊预约挂号:号源信息的序号未进行取值 316门诊医生站-》医嘱TAB页面:会诊医嘱状态从“已签发”变成“草稿” 317【门诊医生站】已签发会诊医嘱未同步至门诊收费系统生成待收费项目 344 门诊预约挂号:未过滤过期号源,允许预约已过时的时间段 347 医生门诊工作已就诊的病人提示未就诊
This commit is contained in:
@@ -315,25 +315,105 @@ export default {
|
||||
computed: {
|
||||
filteredDoctors() {
|
||||
let filtered = [...this.doctors];
|
||||
|
||||
|
||||
// 根据号源类型过滤医生列表
|
||||
if (this.selectedType === 'general') {
|
||||
filtered = filtered.filter(doctor => doctor.type === 'general');
|
||||
} else if (this.selectedType === 'expert') {
|
||||
filtered = filtered.filter(doctor => doctor.type === 'expert');
|
||||
}
|
||||
|
||||
|
||||
// 根据搜索关键词过滤
|
||||
if (this.searchQuery) {
|
||||
filtered = filtered.filter(doctor =>
|
||||
filtered = filtered.filter(doctor =>
|
||||
doctor.name.includes(this.searchQuery)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// 🎯 实时更新余号数量:统计该医生当前筛选条件下剩余可预约(未预约 + 未过期)号源数量
|
||||
const availableCountMap = {};
|
||||
this.filteredAndSortedTickets.forEach(ticket => {
|
||||
const doctorId = String(ticket.doctorId || ticket.doctor_id);
|
||||
if (!availableCountMap[doctorId]) {
|
||||
availableCountMap[doctorId] = 0;
|
||||
}
|
||||
// 只有未预约的号源才算作可预约余号
|
||||
if (ticket.status === '未预约') {
|
||||
availableCountMap[doctorId]++;
|
||||
}
|
||||
});
|
||||
|
||||
// 更新每个医生的余号数量
|
||||
filtered = filtered.map(doctor => {
|
||||
const actualAvailable = availableCountMap[String(doctor.id)] || 0;
|
||||
return {
|
||||
...doctor,
|
||||
available: actualAvailable
|
||||
};
|
||||
});
|
||||
|
||||
return filtered;
|
||||
},
|
||||
// 过滤并排序后的完整号源列表
|
||||
filteredAndSortedTickets() {
|
||||
let filtered = [...this.tickets];
|
||||
|
||||
// 🎯 精确过滤:过滤掉早于当前时间的号源
|
||||
// - 日期早于今天 → 过滤
|
||||
// - 日期是今天但号源时段已经开始(开始时间早于当前时间) → 过滤
|
||||
const now = new Date();
|
||||
|
||||
filtered = filtered.filter(ticket => {
|
||||
// dateTime 格式示例:"2024-01-01 08:00-09:00"
|
||||
const parts = (ticket.dateTime || '').split(' ');
|
||||
if (parts.length < 2) return true; // 如果格式不正确,保留显示
|
||||
|
||||
const dateStr = parts[0];
|
||||
const timeRangeStr = parts[1];
|
||||
if (!dateStr || !timeRangeStr) return true;
|
||||
|
||||
// 提取开始时间
|
||||
const startTimeStr = timeRangeStr.split('-')[0]; // "08:00"
|
||||
if (!startTimeStr) return true;
|
||||
|
||||
// 构建号源开始时间的完整 Date 对象
|
||||
const ticketStartStr = `${dateStr} ${startTimeStr}`;
|
||||
const ticketStart = new Date(ticketStartStr);
|
||||
|
||||
// 只显示开始时间晚于当前时间的号源
|
||||
return ticketStart > now;
|
||||
});
|
||||
|
||||
// 🎯 按开始时间升序排序 → 较早的号源排在前面
|
||||
filtered.sort((a, b) => {
|
||||
const getStartTime = (ticket) => {
|
||||
const parts = (ticket.dateTime || '').split(' ');
|
||||
if (parts.length < 2) return new Date(0).getTime();
|
||||
const dateStr = parts[0];
|
||||
const timeRangeStr = parts[1];
|
||||
const startTimeStr = (timeRangeStr || '').split('-')[0];
|
||||
if (!startTimeStr) return new Date(0).getTime();
|
||||
const ticketStartStr = `${dateStr} ${startTimeStr}`;
|
||||
return new Date(ticketStartStr).getTime();
|
||||
};
|
||||
|
||||
const timeA = getStartTime(a);
|
||||
const timeB = getStartTime(b);
|
||||
return timeA - timeB;
|
||||
});
|
||||
|
||||
return filtered;
|
||||
},
|
||||
// 🎯 分页:按照用户选择的每页条数分页,返回当前页的数据
|
||||
filteredTickets() {
|
||||
return [...this.tickets];
|
||||
const filtered = this.filteredAndSortedTickets;
|
||||
const startIndex = (this.currentPage - 1) * this.pageSize;
|
||||
const endIndex = startIndex + this.pageSize;
|
||||
return filtered.slice(startIndex, endIndex);
|
||||
},
|
||||
// 更新总条数为过滤后的实际条数,分页自动处理
|
||||
totalTickets() {
|
||||
return this.filteredAndSortedTickets.length;
|
||||
},
|
||||
hasSearchCriteria() {
|
||||
return !!this.patientKeyword?.trim();
|
||||
@@ -733,12 +813,8 @@ export default {
|
||||
const total = Number(payload.total);
|
||||
this.tickets = [...filteredRecords];
|
||||
this.allTickets = [...filteredRecords];
|
||||
// 当按状态筛选时,优先使用前端过滤后的数量,避免后端状态未生效导致“显示全部”
|
||||
if (this.selectedStatus && this.selectedStatus !== 'all') {
|
||||
this.totalTickets = this.tickets.length;
|
||||
} else {
|
||||
this.totalTickets = Number.isFinite(total) ? total : this.tickets.length;
|
||||
}
|
||||
// 后端已经分页,总条数由后端返回,始终使用后端返回的total
|
||||
this.totalTickets = Number.isFinite(total) ? total : this.tickets.length;
|
||||
},
|
||||
applyStatusFilter(records = []) {
|
||||
if (!Array.isArray(records) || records.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user