This commit is contained in:
Your Name
2026-09-09 15:47:48 +08:00
parent bd5d5c5f08
commit cb10e75ead
98 changed files with 7031 additions and 804 deletions
@@ -108,6 +108,32 @@ class AppointmentLists extends BaseAdminDataLists implements ListsSearchInterfac
);
}
/**
* 挂号类型筛选:空筛选表示全部;未知筛选值返回空结果,不套用旧记录的视频默认值。
* 列表、总数与状态角标共用,历史空值按 normalizeStored 的规则归入视频。
*/
private function applyAppointmentTypeFilter($query): void
{
$type = $this->params['appointment_type'] ?? '';
if ($type === '') {
return;
}
if (!AppointmentTypeEnum::isWritable($type)) {
$query->whereRaw('0 = 1');
return;
}
$query->where(function ($q) use ($type): void {
$q->whereRaw('BINARY a.appointment_type = :appointment_type_filter', ['appointment_type_filter' => $type]);
if ($type === AppointmentTypeEnum::VIDEO) {
// PHP trim 默认空白:空格、NUL、TAB、LF、VT、CR;只把完全为空白的旧值归入视频。
$blankTypeSql = "TRIM(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(a.appointment_type, CHAR(0), ''),"
. " CHAR(9), ''), CHAR(10), ''), CHAR(11), ''), CHAR(13), '')) = ''";
$q->whereOrRaw('a.appointment_type IS NULL')->whereOrRaw($blankTypeSql);
}
});
}
/**
* 渠道筛选:与 AppointmentLogic 一致,兼容仅有 channel_source、仅有 channels、或两者皆有的表结构
*
@@ -228,6 +254,8 @@ class AppointmentLists extends BaseAdminDataLists implements ListsSearchInterfac
$this->applyChannelSourceFilter($query, $chFilter);
$this->applyAppointmentTypeFilter($query);
// 是否确认诊单:1=已确认 0=未确认
if (isset($this->params['diagnosis_confirmed']) && $this->params['diagnosis_confirmed'] !== '') {
$confirmed = (int)$this->params['diagnosis_confirmed'];
@@ -422,6 +450,8 @@ class AppointmentLists extends BaseAdminDataLists implements ListsSearchInterfac
$this->applyChannelSourceFilter($query, $chFilter);
$this->applyAppointmentTypeFilter($query);
if ((int) ($this->params['exclude_cancelled'] ?? 0) === 1) {
$sf = $this->params['status'] ?? '';
if ($sf === '' || (int) $sf !== 2) {