KpisViewModel class

ViewModel de indicadores clave (KPIs) del servicio.

Carga los 5 indicadores en paralelo mediante Future.wait y expone los resultados para las gráficas de fl_chart. Soporta filtro por año y, opcionalmente, por mes (vista mensual vs. vista anual).

Inheritance

Constructors

KpisViewModel({required KpisRepository repository})

Properties

admissionsByDoctor List<KpiDoctorData>
no setter
admissionsByService List<KpiMonthValue>
no setter
avgStay List<KpiMonthValue>
no setter
avgStayByDoctor List<KpiDoctorData>
no setter
errorMessage String?
no setter
exitus List<KpiMonthValue>
no setter
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isLoading bool
no setter
isMonthlyView bool
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedMonth int?
no setter
selectedYear int
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
changeFilters({required int year, int? month}) Future<void>
Cambia los filtros de año/mes y recarga todos los KPIs.
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
inherited
doctorSingleValue(KpiDoctorData doc) double
Para médico en vista mensual: suma de sus values del único mes devuelto.
loadAll() Future<void>
Carga los 5 KPIs en paralelo con los filtros actuales de año/mes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
singleValue(List<KpiMonthValue> data) double
Valor único de un mes concreto (vista mensual).
toString() String
A string representation of this object.
inherited
totalValue(List<KpiMonthValue> data) double
Total acumulado de un List KpiMonthValue (útil para KPI cards mensuales).

Operators

operator ==(Object other) bool
The equality operator.
inherited