fixes and updates

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

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

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

Loading…
Cancel
Save