fix: 医生余号查询按schedule_date分组,避免多日期余号累加
This commit is contained in:
@@ -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>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user