fix: 后端按系统时间过滤号源,避免前端时间过滤导致数据不一致

This commit is contained in:
关羽
2026-04-09 10:11:30 +08:00
parent c210d57316
commit 9c4d55a352

View File

@@ -261,7 +261,8 @@
LEFT JOIN adm_patient pinfo ON o.patient_id = pinfo.id LEFT JOIN adm_patient pinfo ON o.patient_id = pinfo.id
<where> <where>
p.delete_flag = '0' p.delete_flag = '0'
AND s.delete_flag = '0' <!-- 1. 按日期查 --> AND s.delete_flag = '0'
<!-- 1. 按日期查 -->
<if test="query.date != null and query.date != ''"> <if test="query.date != null and query.date != ''">
AND p.schedule_date = CAST(#{query.date} AS DATE) AND p.schedule_date = CAST(#{query.date} AS DATE)
</if> </if>
@@ -296,7 +297,9 @@
<if test="query.phone != null and query.phone != ''"> <if test="query.phone != null and query.phone != ''">
AND o.phone LIKE CONCAT('%', #{query.phone}, '%') AND o.phone LIKE CONCAT('%', #{query.phone}, '%')
</if> </if>
<!-- 5. 核心:解答您疑问的 4 种业务状态的复合查询! --> <!-- 5. 核心:按系统时间过滤,只返回未过期的号源 -->
AND (p.schedule_date > CURRENT_DATE OR (p.schedule_date = CURRENT_DATE AND s.expect_time >= CAST(CURRENT_TIME AS TIME)))
<!-- 6. 状态过滤 -->
<if test="query.status != null and query.status != '' and query.status != 'all'"> <if test="query.status != null and query.status != '' and query.status != 'all'">
<choose> <choose>
<when test="'unbooked'.equals(query.status) or '未预约'.equals(query.status)"> <when test="'unbooked'.equals(query.status) or '未预约'.equals(query.status)">