// TODO : it have to be changed.

class PatiantInformtion {
  final PatiantInformtion patientDetails;
  int genderInt;
  dynamic age;
  String appointmentDate;
  int appointmentNo;
  String appointmentType;
  int appointmentTypeId;
  String arrivedOn;
  int clinicGroupId;
  String companyName;
  dynamic dischargeStatus;
  dynamic doctorDetails;
  int doctorId;
  String endTime;
  int episodeNo;
  int fallRiskScore;
  bool isSigned;
  int medicationOrders;
  String mobileNumber;
  String nationality;
  int projectId;
  int clinicId;
  int patientId;
  String doctorName;
  String doctorNameN;
  String firstName;
  String middleName;
  String lastName;
  String firstNameN;
  String middleNameN;
  String lastNameN;
  String fullName;
  String fullNameN;
  int gender;
  String dateofBirth;
  String nationalityId;
  String emailAddress;
  String patientIdentificationNo;
  int patientType;
  int patientMRN;
  String admissionNo;
  String admissionDate;
  String createdOn;
  String roomId;
  String bedId;
  String nursingStationId;
  String description;
  String clinicDescription;
  String clinicDescriptionN;
  String nationalityName;
  String nationalityNameN;
  String genderDescription;
  String nursingStationName;
  String startTime;
  String visitType;
  String nationalityFlagURL;
  int patientStatusType;
  int visitTypeId;
  String startTimes;
  String dischargeDate;
  PatiantInformtion(
      {this.patientDetails,
      this.projectId,
      this.clinicId,
      this.doctorId,
      this.patientId,
      this.doctorName,
      this.doctorNameN,
      this.firstName,
      this.middleName,
      this.lastName,
      this.firstNameN,
      this.middleNameN,
      this.lastNameN,
      this.gender,
      this.dateofBirth,
      this.nationalityId,
      this.mobileNumber,
      this.emailAddress,
      this.patientIdentificationNo,
      this.patientType,
      this.admissionNo,
      this.admissionDate,
      this.createdOn,
      this.roomId,
      this.bedId,
      this.nursingStationId,
      this.description,
      this.clinicDescription,
      this.clinicDescriptionN,
      this.nationalityName,
      this.nationalityNameN,
      this.age,
      this.genderDescription,
      this.nursingStationName,
      this.appointmentDate,
      this.startTime,
      this.appointmentNo,
      this.appointmentType,
      this.appointmentTypeId,
      this.arrivedOn,
      this.clinicGroupId,
      this.companyName,
      this.dischargeStatus,
      this.doctorDetails,
      this.endTime,
      this.episodeNo,
      this.fallRiskScore,
      this.genderInt,
      this.isSigned,
      this.medicationOrders,
      this.nationality,
      this.patientMRN,
      this.visitType,
      this.fullName,
      this.fullNameN,
      this.nationalityFlagURL,
      this.patientStatusType,
      this.visitTypeId,
      this.startTimes,this.dischargeDate});

  factory PatiantInformtion.fromJson(Map<String, dynamic> json) =>
      PatiantInformtion(
        patientDetails: json['patientDetails'] != null ? new PatiantInformtion.fromJson(json['patientDetails'])
            : null,
        projectId: json["ProjectID"] ?? json["projectID"],
        clinicId: json["ClinicID"] ?? json["clinicID"],
        doctorId: json["DoctorID"] ?? json["doctorID"],
        patientId: json["PatientID"] ??
            json["patientID"] ??
            json['patientMRN'] ??
            json['PatientMRN'],
        doctorName: json["DoctorName"] ?? json["doctorName"],
        doctorNameN: json["DoctorNameN"] ?? json["doctorNameN"],
        firstName: json["FirstName"] ?? json["firstName"],
        middleName: json["MiddleName"] ?? json["middleName"],
        lastName: json["LastName"] ?? json["lastName"],
        firstNameN: json["FirstNameN"] ?? json["firstNameN"],
        middleNameN: json["MiddleNameN"] ?? json["middleNameN"],
        lastNameN: json["LastNameN"] ?? json["lastNameN"],
        gender: json["Gender"] ?? json["gender"],
        fullName: json["fullName"] ?? json["fullName"],
        fullNameN: json["fullNameN"] ?? json["fullNameN"],
        dateofBirth: json["DateofBirth"] ?? json["dob"],
        nationalityId: json["NationalityID"] ?? json["nationalityID"],
        mobileNumber: json["MobileNumber"] ?? json["mobileNumber"],
        emailAddress: json["EmailAddress"] ?? json["emailAddress"],
        patientIdentificationNo:
            json["PatientIdentificationNo"] ?? json["patientIdentificationNo"],
        //TODO make 7 dynamic when the backend retrun it in patient arrival
          patientType: json["PatientType"] ?? json["patientType"]??7,
        admissionNo: json["AdmissionNo"] ?? json["admissionNo"],
        admissionDate: json["AdmissionDate"] ?? json["admissionDate"],
        createdOn: json["CreatedOn"] ?? json["CreatedOn"],
        roomId: json["RoomID"] ?? json["roomID"],
        bedId: json["BedID"] ?? json["bedID"],
        nursingStationId: json["NursingStationID"] ?? json["nursingStationID"],
        description: json["Description"] ?? json["description"],
        clinicDescription:
            json["ClinicDescription"] ?? json["clinicDescription"],
        clinicDescriptionN:
            json["ClinicDescriptionN"] ?? json["clinicDescriptionN"],
        nationalityName: json["NationalityName"] ??
            json["nationalityName"] ??
            json['NationalityName'],
        nationalityNameN: json["NationalityNameN"] ??
            json["nationalityNameN"] ??
            json['NationalityNameN'],
        age: json["Age"] ?? json["age"],
        genderDescription: json["GenderDescription"],
        nursingStationName: json["NursingStationName"],
        appointmentDate: json["AppointmentDate"] ?? '',
        startTime: json["startTime"],
        appointmentNo: json['appointmentNo'] ?? json['AppointmentNo'],
        appointmentType: json['appointmentType'],
        appointmentTypeId: json['appointmentTypeId']?? json['appointmentTypeid'],
        arrivedOn: json['ArrivedOn'] ?? json['arrivedOn'] ?? json['ArrivedOn'],
        clinicGroupId: json['clinicGroupId'],
        companyName: json['companyName'],
        dischargeStatus: json['dischargeStatus'],
        doctorDetails: json['doctorDetails'],
        endTime: json['endTime'],
        episodeNo: json['episodeNo'] ?? json['EpisodeID'] ?? json['EpisodeNo'],
        fallRiskScore: json['fallRiskScore'],
        isSigned: json['isSigned'],
        medicationOrders: json['medicationOrders'],
        nationality: json['nationality'] ?? json['NationalityNameN'],
        patientMRN: json['patientMRN'] ?? json['PatientMRN'],
        visitType: json['visitType'] ?? json['visitType']?? json['visitType'],
        nationalityFlagURL:
            json['NationalityFlagURL'] ?? json['NationalityFlagURL'],
        patientStatusType:
            json['patientStatusType'] ?? json['PatientStatusType'],
        visitTypeId: json['visitTypeId'] ?? json['visitTypeId'] ?? json['visitTypeid'],
        startTimes: json['StartTime'] ?? json['StartTime'],
        dischargeDate: json['DischargeDate'] ,
      );
}
