|
|
|
|
@ -55,8 +55,8 @@ class MyAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
bool isAppointmentQueueDetailsLoading = false;
|
|
|
|
|
bool isPatientHasQueueAppointment = false;
|
|
|
|
|
int currentQueueStatus = 0;
|
|
|
|
|
List<PatientQueueDetails> patientQueueDetailsList = [];
|
|
|
|
|
late PatientQueueDetails currentPatientQueueDetails;
|
|
|
|
|
List<PatientInQueueList> patientQueueDetailsList = [];
|
|
|
|
|
late PatientInQueueList currentPatientQueueDetails;
|
|
|
|
|
|
|
|
|
|
List<PatientAppointmentHistoryResponseModel> patientAppointmentsHistoryList = [];
|
|
|
|
|
List<PatientAppointmentHistoryResponseModel> filteredAppointmentList = [];
|
|
|
|
|
@ -314,14 +314,14 @@ class MyAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
// Build grouped list immediately so the UI has data for the default (By Clinic) view.
|
|
|
|
|
_groupAppointmentsByClinicAndHospital();
|
|
|
|
|
|
|
|
|
|
if (patientArrivedAppointmentsHistoryList.isNotEmpty) {
|
|
|
|
|
isPatientHasQueueAppointment = false;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
if (Utils.isDateToday(DateUtil.convertStringToDate(patientArrivedAppointmentsHistoryList.first.appointmentDate))) {
|
|
|
|
|
// getPatientAppointmentQueueDetails(appointmentNo: patientArrivedAppointmentsHistoryList.first.appointmentNo, patientID: patientArrivedAppointmentsHistoryList.first.patientID);
|
|
|
|
|
getPatientAppointmentQueueDetails();
|
|
|
|
|
}
|
|
|
|
|
// if (patientArrivedAppointmentsHistoryList.isNotEmpty) {
|
|
|
|
|
isPatientHasQueueAppointment = false;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
if (Utils.isDateToday(DateUtil.convertStringToDate(patientArrivedAppointmentsHistoryList.first.appointmentDate))) {
|
|
|
|
|
// getPatientAppointmentQueueDetails(appointmentNo: patientArrivedAppointmentsHistoryList.first.appointmentNo, patientID: patientArrivedAppointmentsHistoryList.first.patientID);
|
|
|
|
|
getPatientAppointmentQueueDetails();
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
debugPrint('Upcoming Appointments: ${patientUpcomingAppointmentsHistoryList.length}');
|
|
|
|
|
debugPrint('Arrived Appointments: ${patientArrivedAppointmentsHistoryList.length}');
|
|
|
|
|
@ -949,10 +949,12 @@ class MyAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
if (apiResponse.messageStatus == 2) {
|
|
|
|
|
onError!(apiResponse.errorMessage!);
|
|
|
|
|
} else if (apiResponse.messageStatus == 1) {
|
|
|
|
|
if (apiResponse.data != null && apiResponse.data!.isNotEmpty) {
|
|
|
|
|
patientQueueDetailsList = apiResponse.data!;
|
|
|
|
|
if (apiResponse.data != null) {
|
|
|
|
|
patientQueueDetailsList.clear();
|
|
|
|
|
patientQueueDetailsList = apiResponse.data!.patientQueueData!.patientInQueueList!;
|
|
|
|
|
|
|
|
|
|
if (patientQueueDetailsList.first.isClinicConfigured == 1) {
|
|
|
|
|
if (apiResponse.data!.patientQueueData!.isClinicConfigured == 1) {
|
|
|
|
|
currentPatientQueueDetails = PatientInQueueList();
|
|
|
|
|
isPatientHasQueueAppointment = true;
|
|
|
|
|
for (var element in patientQueueDetailsList) {
|
|
|
|
|
if (element.patientID == patientArrivedAppointmentsHistoryList.first.patientID) {
|
|
|
|
|
@ -965,33 +967,35 @@ class MyAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
// patientQueueDetailsList.first.callType = 1;
|
|
|
|
|
patientQueueDetailsList.removeWhere((element) => element.patientID == patientArrivedAppointmentsHistoryList.first.patientID);
|
|
|
|
|
} else {
|
|
|
|
|
patientQueueDetailsList.clear();
|
|
|
|
|
isPatientHasQueueAppointment = false;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
patientQueueDetailsList.clear();
|
|
|
|
|
isPatientHasQueueAppointment = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (apiResponse.data != null && apiResponse.data!.isNotEmpty) {
|
|
|
|
|
patientQueueDetailsList = apiResponse.data!;
|
|
|
|
|
|
|
|
|
|
// if (patientQueueDetailsList.first.isClinicConfigured == 1) {
|
|
|
|
|
isPatientHasQueueAppointment = true;
|
|
|
|
|
for (var element in patientQueueDetailsList) {
|
|
|
|
|
if (element.patientID == patientArrivedAppointmentsHistoryList.first.patientID) {
|
|
|
|
|
currentPatientQueueDetails = element;
|
|
|
|
|
currentQueueStatus = element.callType!;
|
|
|
|
|
// currentQueueStatus = 2;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// patientQueueDetailsList.first.callType = 1;
|
|
|
|
|
patientQueueDetailsList.removeWhere((element) => element.patientID == patientArrivedAppointmentsHistoryList.first.patientID);
|
|
|
|
|
// } else {
|
|
|
|
|
// isPatientHasQueueAppointment = false;
|
|
|
|
|
// }
|
|
|
|
|
} else {
|
|
|
|
|
isPatientHasQueueAppointment = false;
|
|
|
|
|
}
|
|
|
|
|
// if (apiResponse.data != null && apiResponse.data!.isNotEmpty) {
|
|
|
|
|
// patientQueueDetailsList = apiResponse.data!;
|
|
|
|
|
//
|
|
|
|
|
// // if (patientQueueDetailsList.first.isClinicConfigured == 1) {
|
|
|
|
|
// isPatientHasQueueAppointment = true;
|
|
|
|
|
// for (var element in patientQueueDetailsList) {
|
|
|
|
|
// if (element.patientID == patientArrivedAppointmentsHistoryList.first.patientID) {
|
|
|
|
|
// currentPatientQueueDetails = element;
|
|
|
|
|
// currentQueueStatus = element.callType!;
|
|
|
|
|
// // currentQueueStatus = 2;
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// // patientQueueDetailsList.first.callType = 1;
|
|
|
|
|
// patientQueueDetailsList.removeWhere((element) => element.patientID == patientArrivedAppointmentsHistoryList.first.patientID);
|
|
|
|
|
// // } else {
|
|
|
|
|
// // isPatientHasQueueAppointment = false;
|
|
|
|
|
// // }
|
|
|
|
|
// } else {
|
|
|
|
|
// isPatientHasQueueAppointment = false;
|
|
|
|
|
// }
|
|
|
|
|
notifyListeners();
|
|
|
|
|
if (onSuccess != null) {
|
|
|
|
|
onSuccess(apiResponse.data);
|
|
|
|
|
|