first commit
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
class PatientSearchItemModel {
|
||||
final int id;
|
||||
final String nombre;
|
||||
final String apellido;
|
||||
final String cedula;
|
||||
final String telefono;
|
||||
final String edad;
|
||||
final String sexo;
|
||||
final String fecUltcon;
|
||||
final String seguro;
|
||||
final String motCons;
|
||||
|
||||
const PatientSearchItemModel({
|
||||
required this.id,
|
||||
required this.nombre,
|
||||
required this.apellido,
|
||||
required this.cedula,
|
||||
required this.telefono,
|
||||
required this.edad,
|
||||
required this.sexo,
|
||||
required this.fecUltcon,
|
||||
required this.seguro,
|
||||
required this.motCons,
|
||||
});
|
||||
|
||||
String get fullName => '$nombre $apellido'.trim();
|
||||
|
||||
factory PatientSearchItemModel.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 PatientSearchItemModel(
|
||||
id: parsedId,
|
||||
nombre: json['nombre']?.toString().trim() ?? '',
|
||||
apellido: json['apellido']?.toString().trim() ?? '',
|
||||
cedula: json['cedula']?.toString().trim() ?? '',
|
||||
telefono: json['telefono']?.toString().trim() ?? '',
|
||||
edad: json['edad']?.toString().trim() ?? '',
|
||||
sexo: json['sexo']?.toString().trim() ?? '',
|
||||
fecUltcon: json['fec_ultcon']?.toString().trim() ?? '',
|
||||
seguro: json['seguro']?.toString().trim() ?? '',
|
||||
motCons: json['mot_cons']?.toString().trim() ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'nombre': nombre,
|
||||
'apellido': apellido,
|
||||
'cedula': cedula,
|
||||
'telefono': telefono,
|
||||
'edad': edad,
|
||||
'sexo': sexo,
|
||||
'fec_ultcon': fecUltcon,
|
||||
'seguro': seguro,
|
||||
'mot_cons': motCons,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user