This commit is contained in:
Your Name
2026-04-21 18:02:27 +08:00
parent a1d2ab4649
commit d899e0fe0a
301 changed files with 1937 additions and 344 deletions
@@ -115,6 +115,13 @@ class DiagnosisLists extends BaseAdminDataLists implements ListsSearchInterface
}
}
// 至少有一条挂号为「已完成」(status=3),用于列表顶部「已完成」Tab
if (isset($this->params['completed_appointment']) && (string) $this->params['completed_appointment'] === '1') {
$aptTbl = (new Appointment())->getTable();
$diagTbl = (new Diagnosis())->getTable();
$query->whereExists("SELECT 1 FROM {$aptTbl} apt WHERE apt.patient_id = {$diagTbl}.id AND apt.status = 3");
}
// 仅已开方(有处方)的诊单:随访列表传 only_has_prescription=1;问诊等页面不传则不过滤
if (isset($this->params['only_has_prescription']) && (string) $this->params['only_has_prescription'] === '1') {
$rxTbl = (new Prescription())->getTable();
@@ -474,6 +481,13 @@ class DiagnosisLists extends BaseAdminDataLists implements ListsSearchInterface
$query->whereNotExists("SELECT 1 FROM {$aptTbl} apt WHERE apt.patient_id = {$diagTbl}.id AND apt.status IN (1,3,4)");
}
}
// 至少有一条挂号为「已完成」(status=3)
if (isset($this->params['completed_appointment']) && (string) $this->params['completed_appointment'] === '1') {
$aptTbl = (new Appointment())->getTable();
$diagTbl = (new Diagnosis())->getTable();
$query->whereExists("SELECT 1 FROM {$aptTbl} apt WHERE apt.patient_id = {$diagTbl}.id AND apt.status = 3");
}
return $query->count();
}