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(); 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) {
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; isPatientVaccineListLoading = false;
notifyListeners(); notifyListeners();
if (onSuccess != null) { if (onSuccess != null) {
onSuccess(apiResponse); onSuccess(apiResponse);
} }
} else {
print("⚠️ Unexpected messageStatus: ${apiResponse.messageStatus}");
isPatientVaccineListLoading = false;
notifyListeners();
} }
}, },
); );

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

@ -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