Booking physical consultation , bugs fixed and Profile picture adding using firebase storage is complete. Co-authored-by: Jipson George <152465898+Jipson-cosq@users.noreply.github.com> Reviewed-on: cosqnet/telemednet#6 Co-authored-by: DhanshCOSQ <dhanshas@cosq.net> Co-committed-by: DhanshCOSQ <dhanshas@cosq.net>
136 lines
3.2 KiB
Dart
136 lines
3.2 KiB
Dart
class PatientModel {
|
|
String? name;
|
|
String? phoneNumber;
|
|
String? gender;
|
|
DateTime? dateOfBirth;
|
|
String? profileImagePath;
|
|
String? profileImageUrl;
|
|
PatientAddress address;
|
|
|
|
List<FamilyMember> familyMembers = [];
|
|
|
|
PatientModel() : address = PatientAddress();
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'name': name,
|
|
'phoneNumber': phoneNumber,
|
|
'gender': gender,
|
|
'dateOfBirth': dateOfBirth?.toIso8601String(),
|
|
'profileImagePath': profileImagePath,
|
|
'profileImageUrl': profileImageUrl,
|
|
'address': address.toJson(),
|
|
'familyMembers': familyMembers.map((member) => member.toJson()).toList(),
|
|
};
|
|
}
|
|
|
|
PatientModel.fromJson(Map<String, dynamic> json)
|
|
: address = PatientAddress() {
|
|
name = json['name'];
|
|
phoneNumber = json['phoneNumber'];
|
|
gender = json['gender'];
|
|
dateOfBirth = json['dateOfBirth'] != null
|
|
? DateTime.parse(json['dateOfBirth'])
|
|
: null;
|
|
profileImagePath = json['profileImagePath'];
|
|
profileImageUrl = json['profileImageUrl'];
|
|
if (json['address'] != null) {
|
|
address =
|
|
PatientAddress.fromJson(json['address'] as Map<String, dynamic>);
|
|
}
|
|
if (json['familyMembers'] != null) {
|
|
familyMembers = (json['familyMembers'] as List)
|
|
.map((memberJson) => FamilyMember.fromJson(memberJson))
|
|
.toList();
|
|
}
|
|
}
|
|
|
|
void updateFrom(PatientModel other) {
|
|
name = other.name;
|
|
phoneNumber = other.phoneNumber;
|
|
gender = other.gender;
|
|
dateOfBirth = other.dateOfBirth;
|
|
profileImagePath = other.profileImagePath;
|
|
profileImageUrl = other.profileImageUrl;
|
|
address = other.address;
|
|
familyMembers = other.familyMembers;
|
|
}
|
|
}
|
|
|
|
class FamilyMember {
|
|
String? name;
|
|
String? relation;
|
|
String? gender;
|
|
DateTime? dateOfBirth;
|
|
|
|
FamilyMember({this.name, this.relation, this.gender, this.dateOfBirth});
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'name': name,
|
|
'relation': relation,
|
|
'gender': gender,
|
|
'dateOfBirth': dateOfBirth?.toIso8601String(),
|
|
};
|
|
}
|
|
|
|
FamilyMember.fromJson(Map<String, dynamic> json) {
|
|
name = json['name'];
|
|
relation = json['relation'];
|
|
gender = json['gender'];
|
|
dateOfBirth = json['dateOfBirth'] != null
|
|
? DateTime.parse(json['dateOfBirth'])
|
|
: null;
|
|
}
|
|
}
|
|
|
|
class PatientAddress {
|
|
String? houseNo;
|
|
String? line;
|
|
String? town;
|
|
String? pincode;
|
|
String? country;
|
|
String? state;
|
|
String? city;
|
|
String? addressType;
|
|
String? otherLabel;
|
|
|
|
PatientAddress({
|
|
this.houseNo,
|
|
this.line,
|
|
this.town,
|
|
this.pincode,
|
|
this.country,
|
|
this.state,
|
|
this.city,
|
|
this.addressType,
|
|
this.otherLabel,
|
|
});
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'houseNo': houseNo,
|
|
'line': line,
|
|
'town': town,
|
|
'pincode': pincode,
|
|
'country': country,
|
|
'state': state,
|
|
'city': city,
|
|
'addressType': addressType,
|
|
'otherLabel': otherLabel,
|
|
};
|
|
}
|
|
|
|
PatientAddress.fromJson(Map<String, dynamic> json) {
|
|
houseNo = json['houseNo'];
|
|
line = json['line'];
|
|
town = json['town'];
|
|
pincode = json['pincode'];
|
|
country = json['country'];
|
|
state = json['state'];
|
|
city = json['city'];
|
|
addressType = json['addressType'];
|
|
otherLabel = json['otherLabel'];
|
|
}
|
|
}
|