first commit

This commit is contained in:
=
2026-09-21 16:33:51 -04:00
commit a899479dc9
204 changed files with 21132 additions and 0 deletions
@@ -0,0 +1,109 @@
class PatientSummaryModel {
final int id;
final String nombre;
final String apellido;
final String cedula;
final String telefono;
final String fecReg;
final String fecProxCita;
final String seguro;
final String motCons;
final String estadoEspera;
const PatientSummaryModel({
required this.id,
required this.nombre,
required this.apellido,
required this.cedula,
required this.telefono,
required this.fecReg,
required this.fecProxCita,
required this.seguro,
required this.motCons,
this.estadoEspera = 'no_presente',
});
String get fullName => '$nombre $apellido'.trim();
bool get isNoPresente => estadoEspera == 'no_presente' || estadoEspera.isEmpty;
bool get isEnEspera => estadoEspera == 'en_espera';
bool get isEnConsulta => estadoEspera == 'en_consulta';
bool get isAtendido => estadoEspera == 'atendido';
String get estadoEsperaLabel {
switch (estadoEspera) {
case 'en_espera':
return 'En Sala de Espera';
case 'en_consulta':
return 'En Consulta';
case 'atendido':
return 'Atendido';
case 'no_presente':
default:
return 'No Presente';
}
}
PatientSummaryModel copyWith({
int? id,
String? nombre,
String? apellido,
String? cedula,
String? telefono,
String? fecReg,
String? fecProxCita,
String? seguro,
String? motCons,
String? estadoEspera,
}) {
return PatientSummaryModel(
id: id ?? this.id,
nombre: nombre ?? this.nombre,
apellido: apellido ?? this.apellido,
cedula: cedula ?? this.cedula,
telefono: telefono ?? this.telefono,
fecReg: fecReg ?? this.fecReg,
fecProxCita: fecProxCita ?? this.fecProxCita,
seguro: seguro ?? this.seguro,
motCons: motCons ?? this.motCons,
estadoEspera: estadoEspera ?? this.estadoEspera,
);
}
factory PatientSummaryModel.fromJson(Map<String, dynamic> json) {
int parsedId = 0;
if (json['id'] is int) {
parsedId = json['id'] as int;
} else if (json['id'] != null) {
parsedId = int.tryParse(json['id'].toString()) ?? 0;
}
return PatientSummaryModel(
id: parsedId,
nombre: json['nombre']?.toString() ?? '',
apellido: json['apellido']?.toString() ?? '',
cedula: json['cedula']?.toString() ?? '',
telefono: json['telefono']?.toString() ?? '',
fecReg: json['fec_reg']?.toString() ?? '',
fecProxCita: json['fec_proxcita']?.toString() ?? '',
seguro: json['seguro']?.toString() ?? '',
motCons: json['mot_cons']?.toString() ?? '',
estadoEspera: json['estado_espera']?.toString() ?? 'no_presente',
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'nombre': nombre,
'apellido': apellido,
'cedula': cedula,
'telefono': telefono,
'fec_reg': fecReg,
'fec_proxcita': fecProxCita,
'seguro': seguro,
'mot_cons': motCons,
'estado_espera': estadoEspera,
};
}
}