fix: 医生余号查询按schedule_date分组,避免多日期余号累加

This commit is contained in:
关羽
2026-04-09 09:42:07 +08:00
parent 3a02e327c7
commit 41b1d47bba

View File

@@ -354,6 +354,7 @@
SELECT SELECT
p.doctor_id AS doctorId, p.doctor_id AS doctorId,
p.doctor_name AS doctorName, p.doctor_name AS doctorName,
p.schedule_date AS scheduleDate,
COALESCE( COALESCE(
SUM( SUM(
GREATEST( GREATEST(
@@ -363,6 +364,7 @@
), ),
0 0
) AS available, ) AS available,
COUNT(DISTINCT p.id) AS poolCount,
CASE CASE
WHEN MAX( WHEN MAX(
CASE CASE
@@ -407,8 +409,10 @@
</where> </where>
GROUP BY GROUP BY
p.doctor_id, p.doctor_id,
p.doctor_name p.doctor_name,
p.schedule_date
ORDER BY ORDER BY
p.schedule_date ASC,
p.doctor_name ASC p.doctor_name ASC
</select> </select>