Serve EzDent startup profile and recent acquisitions

This commit is contained in:
SantaSpeen committed 2026-11-22 21:10:22 +03:00
1 parent a46a111d50
commit aeefb0f7f0
2 files changed
+64 -7

No files matched your search

+12
View File
@@ -143,6 +143,18 @@ final class ServerStore {
return records
}
func recentlyAcquiredPatients(offset: Int, limit: Int) throws -> [PatientRecord] {
lock.lock()
defer { lock.unlock() }
return try query("""
SELECT patients.id, patients.name, patients.chart_number
FROM patients JOIN images ON images.patient_id = patients.id
GROUP BY patients.id
ORDER BY MAX(images.imported_at) DESC, patients.id
LIMIT ? OFFSET ?
""", values: [.integer(limit), .integer(offset)], map: { try self.patient($0) })
}
func patient(chartNumber: String) throws -> PatientRecord? {
lock.lock()
defer { lock.unlock() }