feature: Improve dashboard functionality
This commit is contained in:
@@ -12,6 +12,26 @@ export function fetchAllAlerts(status) {
|
||||
return api.get(`/api/v1/alerts?${params}`)
|
||||
}
|
||||
|
||||
export async function fetchAllOpenAlerts() {
|
||||
const items = []
|
||||
let page = 1
|
||||
let totalCount = 0
|
||||
|
||||
do {
|
||||
const params = new URLSearchParams({
|
||||
status: 'OPEN',
|
||||
page: String(page),
|
||||
pageSize: '100',
|
||||
})
|
||||
const data = await api.get(`/api/v1/alerts?${params}`)
|
||||
items.push(...(data.items ?? []))
|
||||
totalCount = data.totalCount ?? items.length
|
||||
page += 1
|
||||
} while (items.length < totalCount)
|
||||
|
||||
return items
|
||||
}
|
||||
|
||||
export function acknowledgeAlert(alertId, note) {
|
||||
return api.post(`/api/v1/alerts/${alertId}/acknowledge`, { note })
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { api } from './client'
|
||||
|
||||
export function fetchAlertSummary({ severity, department, from, to } = {}) {
|
||||
const params = new URLSearchParams()
|
||||
if (severity) params.set('severity', severity)
|
||||
if (department) params.set('department', department)
|
||||
if (from) params.set('from', from)
|
||||
if (to) params.set('to', to)
|
||||
const qs = params.toString()
|
||||
return api.get(`/api/v1/analytics/alerts/summary${qs ? `?${qs}` : ''}`)
|
||||
}
|
||||
@@ -1,11 +1,30 @@
|
||||
import { api } from './client'
|
||||
|
||||
export function fetchActiveEncounters(department) {
|
||||
const params = new URLSearchParams({ status: 'ACTIVE' })
|
||||
export function fetchActiveEncounters(department, { page = 1, pageSize = 20 } = {}) {
|
||||
const params = new URLSearchParams({
|
||||
status: 'ACTIVE',
|
||||
page: String(page),
|
||||
pageSize: String(pageSize),
|
||||
})
|
||||
if (department) params.set('department', department)
|
||||
return api.get(`/api/v1/encounters?${params}`)
|
||||
}
|
||||
|
||||
export async function fetchAllActiveEncounters(department) {
|
||||
const items = []
|
||||
let page = 1
|
||||
let totalCount = 0
|
||||
|
||||
do {
|
||||
const data = await fetchActiveEncounters(department, { page, pageSize: 100 })
|
||||
items.push(...(data.items ?? []))
|
||||
totalCount = data.totalCount ?? items.length
|
||||
page += 1
|
||||
} while (items.length < totalCount)
|
||||
|
||||
return items
|
||||
}
|
||||
|
||||
export function fetchEncounter(id) {
|
||||
return api.get(`/api/v1/encounters/${id}`)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { api } from './client'
|
||||
|
||||
export function fetchSepsisBundles({ status = 'IN_PROGRESS', page = 1, pageSize = 100 } = {}) {
|
||||
const params = new URLSearchParams({
|
||||
page: String(page),
|
||||
pageSize: String(pageSize),
|
||||
})
|
||||
if (status) params.set('status', status)
|
||||
return api.get(`/api/v1/sepsis-bundles?${params}`)
|
||||
}
|
||||
Reference in New Issue
Block a user