first commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
class DashboardMetricsModel {
|
||||
final int nuevosPacientes;
|
||||
final int consultadosHoy;
|
||||
final int citasHoy;
|
||||
final int pacientesMasculinos;
|
||||
final int pacientesFemeninos;
|
||||
final int totalPacientes;
|
||||
|
||||
const DashboardMetricsModel({
|
||||
this.nuevosPacientes = 0,
|
||||
this.consultadosHoy = 0,
|
||||
this.citasHoy = 0,
|
||||
this.pacientesMasculinos = 11078,
|
||||
this.pacientesFemeninos = 2634,
|
||||
this.totalPacientes = 13712,
|
||||
});
|
||||
|
||||
factory DashboardMetricsModel.fromJson(Map<String, dynamic> json) {
|
||||
return DashboardMetricsModel(
|
||||
nuevosPacientes: json['nuevos_pacientes'] as int? ?? 0,
|
||||
consultadosHoy: json['consultados_hoy'] as int? ?? 0,
|
||||
citasHoy: json['citas_hoy'] as int? ?? 0,
|
||||
pacientesMasculinos: json['pacientes_masculinos'] as int? ?? 0,
|
||||
pacientesFemeninos: json['pacientes_femeninos'] as int? ?? 0,
|
||||
totalPacientes: json['total_pacientes'] as int? ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'nuevos_pacientes': nuevosPacientes,
|
||||
'consultados_hoy': consultadosHoy,
|
||||
'citas_hoy': citasHoy,
|
||||
'pacientes_masculinos': pacientesMasculinos,
|
||||
'pacientes_femeninos': pacientesFemeninos,
|
||||
'total_pacientes': totalPacientes,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
class DoctorInfoModel {
|
||||
final int? id;
|
||||
final String nombreDoctor;
|
||||
final String especialidad;
|
||||
final String descripEspecialidad;
|
||||
final String descripGeneral;
|
||||
|
||||
const DoctorInfoModel({
|
||||
this.id,
|
||||
required this.nombreDoctor,
|
||||
required this.especialidad,
|
||||
required this.descripEspecialidad,
|
||||
required this.descripGeneral,
|
||||
});
|
||||
|
||||
factory DoctorInfoModel.fromJson(Map<String, dynamic> json) {
|
||||
final doctor = (json['nombre_doctor']?.toString() ?? 'Dr. Luis A. Castro Sosa').trim();
|
||||
final esp = (json['especialidad']?.toString() ?? 'Cirujano Urólogo').trim();
|
||||
|
||||
return DoctorInfoModel(
|
||||
id: json['id'] is int ? json['id'] as int : int.tryParse(json['id']?.toString() ?? ''),
|
||||
nombreDoctor: doctor.isEmpty ? 'Dr. Luis A. Castro Sosa' : doctor,
|
||||
especialidad: esp.isEmpty ? 'Cirujano Urólogo' : esp,
|
||||
descripEspecialidad: json['descrip_especialidad']?.toString() ?? '',
|
||||
descripGeneral: json['descrip_general']?.toString() ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson({bool includeId = false}) {
|
||||
final map = <String, dynamic>{
|
||||
'nombre_doctor': nombreDoctor,
|
||||
'especialidad': especialidad,
|
||||
'descrip_especialidad': descripEspecialidad,
|
||||
'descrip_general': descripGeneral,
|
||||
};
|
||||
if (includeId && id != null) {
|
||||
map['id'] = id;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
DoctorInfoModel copyWith({
|
||||
int? id,
|
||||
String? nombreDoctor,
|
||||
String? especialidad,
|
||||
String? descripEspecialidad,
|
||||
String? descripGeneral,
|
||||
}) {
|
||||
return DoctorInfoModel(
|
||||
id: id ?? this.id,
|
||||
nombreDoctor: nombreDoctor ?? this.nombreDoctor,
|
||||
especialidad: especialidad ?? this.especialidad,
|
||||
descripEspecialidad: descripEspecialidad ?? this.descripEspecialidad,
|
||||
descripGeneral: descripGeneral ?? this.descripGeneral,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user