fixes and updates

pull/229/head
Sultan khan 2 days ago
parent 7e2c470767
commit 207b84e493

@ -215,27 +215,40 @@ class MedicalFileViewModel extends ChangeNotifier {
final result = await medicalFileRepo.getPatientVaccinesList();
result.fold(
// (failure) async => await errorHandlerService.handleError(
// failure: failure,
// onOkPressed: () {
// onError!(failure.message);
// },
// ),
(failure) async {
// onError!(failure.message);
print("❌ Vaccine API Failure: ${failure.message}");
isPatientVaccineListLoading = false;
notifyListeners();
if (onError != null) {
onError(failure.message);
}
},
(apiResponse) {
print("📦 Vaccine API Response - Status: ${apiResponse.messageStatus}, Data: ${apiResponse.data}");
if (apiResponse.messageStatus == 2) {
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
print("⚠️ Vaccine API Error: ${apiResponse.errorMessage}");
isPatientVaccineListLoading = false;
notifyListeners();
if (onError != null) {
onError(apiResponse.errorMessage ?? "Unknown error");
}
} else if (apiResponse.messageStatus == 1) {
patientVaccineList = apiResponse.data!;
if (apiResponse.data != null) {
patientVaccineList = apiResponse.data!;
print("✅ Vaccine data loaded: ${patientVaccineList.length} items");
} else {
print("⚠️ Vaccine API returned success but data is null");
}
isPatientVaccineListLoading = false;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
} else {
print("⚠️ Unexpected messageStatus: ${apiResponse.messageStatus}");
isPatientVaccineListLoading = false;
notifyListeners();
}
},
);

@ -1,160 +1,169 @@
import 'dart:convert';
class PatientVaccineResponseModel {
String? setupID;
int? projectID;
int? patientID;
String? setupId;
int? projectId;
int? patientId;
int? invoiceNo;
String? procedureID;
String? procedureId;
String? vaccineName;
Null? vaccineNameN;
dynamic vaccineNameN;
String? invoiceDate;
int? doctorID;
int? clinicID;
int? doctorId;
int? clinicId;
String? firstName;
String? middleName;
String? lastName;
Null? firstNameN;
Null? middleNameN;
Null? lastNameN;
dynamic firstNameN;
dynamic middleNameN;
dynamic lastNameN;
String? dateofBirth;
int? actualDoctorRate;
String? age;
String? clinicName;
Null? decimalDoctorRate;
Null? doctorImageURL;
double? decimalDoctorRate;
dynamic doctorImageUrl;
String? doctorName;
int? doctorRate;
int? doctorStarsRate;
double? doctorStarsRate;
String? doctorTitle;
int? gender;
Null? genderDescription;
Null? invoiceNoVP;
dynamic genderDescription;
dynamic invoiceNoVp;
bool? isActiveDoctorProfile;
bool? isDoctorAllowVedioCall;
bool? isExecludeDoctor;
int? noOfPatientsRate;
String? patientName;
String? projectName;
String? qR;
String? qr;
List<dynamic>? speciality;
String? vaccinationDate;
PatientVaccineResponseModel(
{this.setupID,
this.projectID,
this.patientID,
this.invoiceNo,
this.procedureID,
this.vaccineName,
this.vaccineNameN,
this.invoiceDate,
this.doctorID,
this.clinicID,
this.firstName,
this.middleName,
this.lastName,
this.firstNameN,
this.middleNameN,
this.lastNameN,
this.dateofBirth,
this.actualDoctorRate,
this.age,
this.clinicName,
this.decimalDoctorRate,
this.doctorImageURL,
this.doctorName,
this.doctorRate,
this.doctorStarsRate,
this.doctorTitle,
this.gender,
this.genderDescription,
this.invoiceNoVP,
this.isActiveDoctorProfile,
this.isDoctorAllowVedioCall,
this.isExecludeDoctor,
this.noOfPatientsRate,
this.patientName,
this.projectName,
this.qR,
this.vaccinationDate});
PatientVaccineResponseModel({
this.setupId,
this.projectId,
this.patientId,
this.invoiceNo,
this.procedureId,
this.vaccineName,
this.vaccineNameN,
this.invoiceDate,
this.doctorId,
this.clinicId,
this.firstName,
this.middleName,
this.lastName,
this.firstNameN,
this.middleNameN,
this.lastNameN,
this.dateofBirth,
this.actualDoctorRate,
this.age,
this.clinicName,
this.decimalDoctorRate,
this.doctorImageUrl,
this.doctorName,
this.doctorRate,
this.doctorStarsRate,
this.doctorTitle,
this.gender,
this.genderDescription,
this.invoiceNoVp,
this.isActiveDoctorProfile,
this.isDoctorAllowVedioCall,
this.isExecludeDoctor,
this.noOfPatientsRate,
this.patientName,
this.projectName,
this.qr,
this.speciality,
this.vaccinationDate,
});
factory PatientVaccineResponseModel.fromRawJson(String str) => PatientVaccineResponseModel.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
PatientVaccineResponseModel.fromJson(Map<String, dynamic> json) {
setupID = json['SetupID'];
projectID = json['ProjectID'];
patientID = json['PatientID'];
invoiceNo = json['InvoiceNo'];
procedureID = json['ProcedureID'];
vaccineName = json['VaccineName'];
vaccineNameN = json['VaccineNameN'];
invoiceDate = json['InvoiceDate'];
doctorID = json['DoctorID'];
clinicID = json['ClinicID'];
firstName = json['FirstName'];
middleName = json['MiddleName'];
lastName = json['LastName'];
firstNameN = json['FirstNameN'];
middleNameN = json['MiddleNameN'];
lastNameN = json['LastNameN'];
dateofBirth = json['DateofBirth'];
actualDoctorRate = json['ActualDoctorRate'];
age = json['Age'];
clinicName = json['ClinicName'];
decimalDoctorRate = json['DecimalDoctorRate'];
doctorImageURL = json['DoctorImageURL'];
doctorName = json['DoctorName'];
doctorRate = json['DoctorRate'];
doctorStarsRate = json['DoctorStarsRate'];
doctorTitle = json['DoctorTitle'];
gender = json['Gender'];
genderDescription = json['GenderDescription'];
invoiceNoVP = json['InvoiceNo_VP'];
isActiveDoctorProfile = json['IsActiveDoctorProfile'];
isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall'];
isExecludeDoctor = json['IsExecludeDoctor'];
noOfPatientsRate = json['NoOfPatientsRate'];
patientName = json['PatientName'];
projectName = json['ProjectName'];
qR = json['QR'];
vaccinationDate = json['VaccinationDate'];
}
factory PatientVaccineResponseModel.fromJson(Map<String, dynamic> json) => PatientVaccineResponseModel(
setupId: json["SetupID"],
projectId: json["ProjectID"],
patientId: json["PatientID"],
invoiceNo: json["InvoiceNo"],
procedureId: json["ProcedureID"],
vaccineName: json["VaccineName"],
vaccineNameN: json["VaccineNameN"],
invoiceDate: json["InvoiceDate"],
doctorId: json["DoctorID"],
clinicId: json["ClinicID"],
firstName: json["FirstName"],
middleName: json["MiddleName"],
lastName: json["LastName"],
firstNameN: json["FirstNameN"],
middleNameN: json["MiddleNameN"],
lastNameN: json["LastNameN"],
dateofBirth: json["DateofBirth"],
actualDoctorRate: json["ActualDoctorRate"],
age: json["Age"],
clinicName: json["ClinicName"],
decimalDoctorRate: json["DecimalDoctorRate"]?.toDouble(),
doctorImageUrl: json["DoctorImageURL"],
doctorName: json["DoctorName"],
doctorRate: json["DoctorRate"],
doctorStarsRate: json["DoctorStarsRate"]?.toDouble(),
doctorTitle: json["DoctorTitle"],
gender: json["Gender"],
genderDescription: json["GenderDescription"],
invoiceNoVp: json["InvoiceNo_VP"],
isActiveDoctorProfile: json["IsActiveDoctorProfile"],
isDoctorAllowVedioCall: json["IsDoctorAllowVedioCall"],
isExecludeDoctor: json["IsExecludeDoctor"],
noOfPatientsRate: json["NoOfPatientsRate"],
patientName: json["PatientName"],
projectName: json["ProjectName"],
qr: json["QR"],
speciality: json["Speciality"] == null ? [] : List<dynamic>.from(json["Speciality"]!.map((x) => x)),
vaccinationDate: json["VaccinationDate"],
);
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['SetupID'] = this.setupID;
data['ProjectID'] = this.projectID;
data['PatientID'] = this.patientID;
data['InvoiceNo'] = this.invoiceNo;
data['ProcedureID'] = this.procedureID;
data['VaccineName'] = this.vaccineName;
data['VaccineNameN'] = this.vaccineNameN;
data['InvoiceDate'] = this.invoiceDate;
data['DoctorID'] = this.doctorID;
data['ClinicID'] = this.clinicID;
data['FirstName'] = this.firstName;
data['MiddleName'] = this.middleName;
data['LastName'] = this.lastName;
data['FirstNameN'] = this.firstNameN;
data['MiddleNameN'] = this.middleNameN;
data['LastNameN'] = this.lastNameN;
data['DateofBirth'] = this.dateofBirth;
data['ActualDoctorRate'] = this.actualDoctorRate;
data['Age'] = this.age;
data['ClinicName'] = this.clinicName;
data['DecimalDoctorRate'] = this.decimalDoctorRate;
data['DoctorImageURL'] = this.doctorImageURL;
data['DoctorName'] = this.doctorName;
data['DoctorRate'] = this.doctorRate;
data['DoctorStarsRate'] = this.doctorStarsRate;
data['DoctorTitle'] = this.doctorTitle;
data['Gender'] = this.gender;
data['GenderDescription'] = this.genderDescription;
data['InvoiceNo_VP'] = this.invoiceNoVP;
data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile;
data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall;
data['IsExecludeDoctor'] = this.isExecludeDoctor;
data['NoOfPatientsRate'] = this.noOfPatientsRate;
data['PatientName'] = this.patientName;
data['ProjectName'] = this.projectName;
data['QR'] = this.qR;
data['VaccinationDate'] = this.vaccinationDate;
return data;
}
Map<String, dynamic> toJson() => {
"SetupID": setupId,
"ProjectID": projectId,
"PatientID": patientId,
"InvoiceNo": invoiceNo,
"ProcedureID": procedureId,
"VaccineName": vaccineName,
"VaccineNameN": vaccineNameN,
"InvoiceDate": invoiceDate,
"DoctorID": doctorId,
"ClinicID": clinicId,
"FirstName": firstName,
"MiddleName": middleName,
"LastName": lastName,
"FirstNameN": firstNameN,
"MiddleNameN": middleNameN,
"LastNameN": lastNameN,
"DateofBirth": dateofBirth,
"ActualDoctorRate": actualDoctorRate,
"Age": age,
"ClinicName": clinicName,
"DecimalDoctorRate": decimalDoctorRate,
"DoctorImageURL": doctorImageUrl,
"DoctorName": doctorName,
"DoctorRate": doctorRate,
"DoctorStarsRate": doctorStarsRate,
"DoctorTitle": doctorTitle,
"Gender": gender,
"GenderDescription": genderDescription,
"InvoiceNo_VP": invoiceNoVp,
"IsActiveDoctorProfile": isActiveDoctorProfile,
"IsDoctorAllowVedioCall": isDoctorAllowVedioCall,
"IsExecludeDoctor": isExecludeDoctor,
"NoOfPatientsRate": noOfPatientsRate,
"PatientName": patientName,
"ProjectName": projectName,
"QR": qr,
"Speciality": speciality == null ? [] : List<dynamic>.from(speciality!.map((x) => x)),
"VaccinationDate": vaccinationDate,
};
}

@ -29,11 +29,19 @@ class _VaccineListPageState extends State<VaccineListPage> {
@override
void initState() {
super.initState();
scheduleMicrotask(() {
medicalFileViewModel = Provider.of<MedicalFileViewModel>(context, listen: false);
medicalFileViewModel.setIsPatientVaccineListLoading(true);
medicalFileViewModel.getPatientVaccinesList();
medicalFileViewModel.getPatientVaccinesList(
onSuccess: (data) {
print("✅ Vaccine data received: ${medicalFileViewModel.patientVaccineList.length} items");
},
onError: (error) {
print("❌ Vaccine error: $error");
},
);
});
super.initState();
}
@override

Loading…
Cancel
Save