diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index a55f9732..c1ae248a 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -200,7 +200,7 @@ class PatientReferralViewModel extends BaseViewModel { patientID: patient.patientId, roomID: patient.roomId, referralClinic: clinicID, - admissionNo: patient.appointmentNo, /// TODO Elham* something in case inpateint since we send send appointmentNo for admissionNo which all time null + admissionNo: int.parse(patient.admissionNo!), /// TODO Elham* something in case inpateint since we send send appointmentNo for admissionNo which all time null referralDoctor: doctorID, patientTypeID: patient.patientType, referringDoctorRemarks: remarks, diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index 16377e7a..06936a59 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -1,7 +1,7 @@ // TODO : it have to be changed. class PatiantInformtion { - final PatiantInformtion? patientDetails; + PatiantInformtion? patientDetails; int? genderInt; dynamic age; String? appointmentDate; @@ -75,7 +75,8 @@ class PatiantInformtion { int? vcId; String? voipToken; - PatiantInformtion( + + PatiantInformtion( {this.patientDetails, this.projectId, this.clinicId, @@ -149,93 +150,111 @@ class PatiantInformtion { this.status, this.vcId, this.voipToken}); + PatiantInformtion.fromJson(Map json) { + try { + 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"] != null + ? json["PatientID"] is String + ? int?.parse(json["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"] != null + ? json["Gender"] is String + ? int?.parse(json["Gender"]) + : json["Gender"] + : json["gender"]; + fullName = json["fullName"] ?? json["fullName"] ?? json["PatientName"]; + fullNameN = + json["fullNameN"] ?? json["fullNameN"] ?? json["PatientName"]; + dateofBirth = json["DateofBirth"] ?? json["dob"] ?? json['DateOfBirth']; + 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"] ?? 1; + 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"] ?? 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'] ?? + (json["PatientID"] != null + ? int?.parse(json["PatientID"].toString()) + : json["patientID"] != null ? int?.parse( + json["patientID"].toString()) : json["patientId"] != null ? int + ?.parse(json["patientId"].toString()) : ''); + 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']; + status = json['Status']; + vcId = json['VC_ID']; - factory PatiantInformtion.fromJson(Map 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"] != null - ? json["PatientID"] is String - ? int?.parse(json["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"] != null - ? json["Gender"] is String - ? int?.parse(json["Gender"]) - : json["Gender"] - : json["gender"], - fullName: json["fullName"] ?? json["fullName"] ?? json["PatientName"], - fullNameN: json["fullNameN"] ?? json["fullNameN"] ?? json["PatientName"], - dateofBirth: json["DateofBirth"] ?? json["dob"] ?? json['DateOfBirth'], - 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"] ?? 1, - 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"] ?? 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'] ?? - (json["PatientID"] != null - ? int?.parse(json["PatientID"].toString()) - : int?.parse(json["patientID"].toString())), - 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'], - status: json['Status'], - vcId: json['VC_ID'], - - arrivalTime: json['ArrivalTime'], - arrivalTimeD: json['ArrivalTimeD'], - callStatus: json['CallStatus'], - callStatusDisc: json['CallStatusDisc'], - callTypeID: json['CallTypeID'], - clientRequestID: json['ClientRequestID'], - clinicName: json['ClinicName'], - consoltationEnd: json['ConsoltationEnd'], - consultationNotes: json['ConsultationNotes'], - patientStatus: json['PatientStatus'], - voipToken: json['VoipToken'], - ); + arrivalTime = json['ArrivalTime']; + arrivalTimeD = json['ArrivalTimeD']; + callStatus = json['CallStatus']; + callStatusDisc = json['CallStatusDisc']; + callTypeID = json['CallTypeID']; + clientRequestID = json['ClientRequestID']; + clinicName = json['ClinicName']; + consoltationEnd = json['ConsoltationEnd']; + consultationNotes = json['ConsultationNotes']; + patientStatus = json['PatientStatus']; + voipToken = json['VoipToken']; + } catch (e) { + print(e); + } + } } diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index 772f2f90..92d3ba17 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -106,9 +106,9 @@ class _PatientMakeReferralScreenState extends State { patientGender: model.patientReferral[model.patientReferral.length - 1].patientDetails!.gender, referredDate: - model.patientReferral[model.patientReferral.length - 1].referredOn!.split(" ")[0], + model.patientReferral[model.patientReferral.length - 1].referredOn?.split(" ")[0], referredTime: - model.patientReferral[model.patientReferral.length - 1].referredOn!.split(" ")[1], + model.patientReferral[model.patientReferral.length - 1].referredOn?.split(" ")[1], patientID: "${model.patientReferral[model.patientReferral.length - 1].patientID}", isSameBranch: model.patientReferral[model.patientReferral.length - 1].isReferralDoctorSameBranch, @@ -136,22 +136,22 @@ class _PatientMakeReferralScreenState extends State { if (_referTo == null) { branchError = TranslationBase.of(context).fieldRequired!; } else { - branchError = null!; + branchError = null; } if (_selectedBranch == null) { hospitalError = TranslationBase.of(context).fieldRequired!; } else { - hospitalError = null!; + hospitalError = null; } if (_selectedClinic == null) { clinicError = TranslationBase.of(context).fieldRequired!; } else { - clinicError = null!; + clinicError = null; } if (_selectedDoctor == null) { doctorError = TranslationBase.of(context).fieldRequired!; } else { - doctorError = null!; + doctorError = null; } }); if (appointmentDate == null || diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index de4d821c..6209e1fc 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -85,7 +85,7 @@ class PatientReferralItemWidget extends StatelessWidget { : Colors.red[700], ), AppText( - referredDate!, + referredDate??'', fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 2.0 * SizeConfig.textMultiplier!, @@ -98,7 +98,7 @@ class PatientReferralItemWidget extends StatelessWidget { children: [ Expanded( child: AppText( - patientName!, + patientName??'', fontSize: SizeConfig.textMultiplier! * 2.2, fontWeight: FontWeight.bold, color: Colors.black, @@ -121,7 +121,7 @@ class PatientReferralItemWidget extends StatelessWidget { width: 4, ), AppText( - referredTime!, + referredTime??'', fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 1.8 * SizeConfig.textMultiplier!, @@ -278,7 +278,7 @@ class PatientReferralItemWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - referralDoctorName!, + referralDoctorName??'', fontFamily: 'Poppins', fontWeight: FontWeight.w800, fontSize: 1.7 * SizeConfig.textMultiplier!,