* 'master' of http://34.17.182.140/Haroon6138/HMG_Patient_App_New:
  QLine API changes handled
pull/224/head
Sultan khan 3 days ago
commit 5989dda613

@ -1,4 +1,48 @@
class PatientQueueDetails { class PatientQueueDetails {
Data? patientQueueData;
PatientQueueDetails({this.patientQueueData});
PatientQueueDetails.fromJson(Map<String, dynamic> json) {
patientQueueData = json['data'] != null ? new Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.patientQueueData != null) {
data['data'] = this.patientQueueData!.toJson();
}
return data;
}
}
class Data {
List<PatientInQueueList>? patientInQueueList;
int? isClinicConfigured;
Data({this.patientInQueueList, this.isClinicConfigured});
Data.fromJson(Map<String, dynamic> json) {
if (json['patientInQueueList'] != null) {
patientInQueueList = <PatientInQueueList>[];
json['patientInQueueList'].forEach((v) {
patientInQueueList!.add(new PatientInQueueList.fromJson(v));
});
}
isClinicConfigured = json['isClinicConfigured'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.patientInQueueList != null) {
data['patientInQueueList'] = this.patientInQueueList!.map((v) => v.toJson()).toList();
}
data['isClinicConfigured'] = this.isClinicConfigured;
return data;
}
}
class PatientInQueueList {
int? patientID; int? patientID;
String? patientName; String? patientName;
String? queueNo; String? queueNo;
@ -6,18 +50,15 @@ class PatientQueueDetails {
String? roomNo; String? roomNo;
String? calledOn; String? calledOn;
bool? servingNow; bool? servingNow;
int? isClinicConfigured;
PatientQueueDetails( PatientInQueueList({this.patientID,
{this.patientID,
this.patientName, this.patientName,
this.queueNo, this.queueNo,
this.callType, this.callType,
this.roomNo, this.roomNo,
this.calledOn, this.calledOn, this.servingNow});
this.servingNow, this.isClinicConfigured});
PatientQueueDetails.fromJson(Map<String, dynamic> json) { PatientInQueueList.fromJson(Map<String, dynamic> json) {
patientID = json['patientID']; patientID = json['patientID'];
patientName = json['patientName']; patientName = json['patientName'];
queueNo = json['queueNo']; queueNo = json['queueNo'];
@ -25,11 +66,10 @@ class PatientQueueDetails {
roomNo = json['roomNo']; roomNo = json['roomNo'];
calledOn = json['calledOn']; calledOn = json['calledOn'];
servingNow = json['servingNow']; servingNow = json['servingNow'];
isClinicConfigured = json['isClinicConfigured'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['patientID'] = this.patientID; data['patientID'] = this.patientID;
data['patientName'] = this.patientName; data['patientName'] = this.patientName;
data['queueNo'] = this.queueNo; data['queueNo'] = this.queueNo;
@ -37,7 +77,50 @@ class PatientQueueDetails {
data['roomNo'] = this.roomNo; data['roomNo'] = this.roomNo;
data['calledOn'] = this.calledOn; data['calledOn'] = this.calledOn;
data['servingNow'] = this.servingNow; data['servingNow'] = this.servingNow;
data['isClinicConfigured'] = this.isClinicConfigured;
return data; return data;
} }
} }
// class PatientQueueDetails {
// int? patientID;
// String? patientName;
// String? queueNo;
// int? callType;
// String? roomNo;
// String? calledOn;
// bool? servingNow;
// int? isClinicConfigured;
//
// PatientQueueDetails(
// {this.patientID,
// this.patientName,
// this.queueNo,
// this.callType,
// this.roomNo,
// this.calledOn,
// this.servingNow, this.isClinicConfigured});
//
// PatientQueueDetails.fromJson(Map<String, dynamic> json) {
// patientID = json['patientID'];
// patientName = json['patientName'];
// queueNo = json['queueNo'];
// callType = json['callType'];
// roomNo = json['roomNo'];
// calledOn = json['calledOn'];
// servingNow = json['servingNow'];
// isClinicConfigured = json['isClinicConfigured'];
// }
//
// Map<String, dynamic> toJson() {
// final Map<String, dynamic> data = Map<String, dynamic>();
// data['patientID'] = this.patientID;
// data['patientName'] = this.patientName;
// data['queueNo'] = this.queueNo;
// data['callType'] = this.callType;
// data['roomNo'] = this.roomNo;
// data['calledOn'] = this.calledOn;
// data['servingNow'] = this.servingNow;
// data['isClinicConfigured'] = this.isClinicConfigured;
// return data;
// }
// }

@ -77,7 +77,7 @@ abstract class MyAppointmentsRepo {
Future<Either<Failure, GenericApiModel<void>>> sendDoctorRate( Future<Either<Failure, GenericApiModel<void>>> sendDoctorRate(
int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note, String appoDate, String docName, String projectName, String clinicName); int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note, String appoDate, String docName, String projectName, String clinicName);
Future<Either<Failure, GenericApiModel<List<PatientQueueDetails>>>> getPatientAppointmentQueueDetails({required int appointmentNo, required int patientID, required int clinicID}); Future<Either<Failure, GenericApiModel<PatientQueueDetails>>> getPatientAppointmentQueueDetails({required int appointmentNo, required int patientID, required int clinicID});
Future<Either<Failure, GenericApiModel<dynamic>>> convertPatientToCash({required int projectID}); Future<Either<Failure, GenericApiModel<dynamic>>> convertPatientToCash({required int projectID});
@ -833,20 +833,23 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
} }
@override @override
Future<Either<Failure, GenericApiModel<List<PatientQueueDetails>>>> getPatientAppointmentQueueDetails({required int appointmentNo, required int patientID, required int clinicID}) async { Future<Either<Failure, GenericApiModel<PatientQueueDetails>>> getPatientAppointmentQueueDetails({required int appointmentNo, required int patientID, required int clinicID}) async {
Map<String, dynamic> mapDevice = {"appointmentNo": appointmentNo, "patientID": patientID, "clinicID": clinicID, "apiKey": "EE17D21C7943485D9780223CCE55DCE5"}; Map<String, dynamic> mapDevice = {"appointmentNo": appointmentNo, "patientID": patientID, "clinicID": clinicID, "apiKey": "EE17D21C7943485D9780223CCE55DCE5"};
try { try {
GenericApiModel<List<PatientQueueDetails>>? apiResponse; GenericApiModel<PatientQueueDetails>? apiResponse;
Failure? failure; Failure? failure;
await apiClient.post(ApiConsts.QLINE_URL, onFailure: (error, statusCode, {messageStatus, failureType}) { await apiClient.post(ApiConsts.QLINE_URL, onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType; failure = failureType;
}, onSuccess: (response, statusCode, {messageStatus, errorMessage}) { }, onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try { try {
// final list = response['data']; // final list = response['data'];
final list = response['data']; final queueData = response;
final queueList = list.map((item) => PatientQueueDetails.fromJson(item as Map<String, dynamic>)).toList().cast<PatientQueueDetails>(); // final queueList = list.map((item) => PatientQueueDetails.fromJson(item as Map<String, dynamic>)).toList().cast<PatientQueueDetails>();
final queueList = PatientQueueDetails.fromJson(queueData);
apiResponse = GenericApiModel<List<PatientQueueDetails>>( queueList.patientQueueData!.isClinicConfigured = 1;
apiResponse = GenericApiModel<PatientQueueDetails>(
messageStatus: messageStatus, messageStatus: messageStatus,
statusCode: statusCode, statusCode: statusCode,
errorMessage: null, errorMessage: null,

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

@ -67,7 +67,7 @@ class AppointmentQueuePage extends StatelessWidget {
labelText: myAppointmentsVM.currentQueueStatus == 0 ? LocaleKeys.inQueue.tr(context: context) : LocaleKeys.yourTurn.tr(context: context), labelText: myAppointmentsVM.currentQueueStatus == 0 ? LocaleKeys.inQueue.tr(context: context) : LocaleKeys.yourTurn.tr(context: context),
backgroundColor: Utils.getCardBorderColor(myAppointmentsVM.currentQueueStatus).withValues(alpha: 0.20), backgroundColor: Utils.getCardBorderColor(myAppointmentsVM.currentQueueStatus).withValues(alpha: 0.20),
textColor: Utils.getCardBorderColor(myAppointmentsVM.currentQueueStatus), textColor: Utils.getCardBorderColor(myAppointmentsVM.currentQueueStatus),
), ).toShimmer2(isShow: myAppointmentsVM.patientQueueDetailsList.isEmpty),
Container( Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.greyColor, color: AppColors.greyColor,
@ -86,7 +86,9 @@ class AppointmentQueuePage extends StatelessWidget {
.toText12(isBold: true, color: AppColors.textColorLight) .toText12(isBold: true, color: AppColors.textColorLight)
.toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading), .toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading),
SizedBox(height: 8.h), SizedBox(height: 8.h),
myAppointmentsVM.currentPatientQueueDetails.queueNo!.toText32(isBold: true).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading), (myAppointmentsVM.currentPatientQueueDetails.queueNo ?? "IM-123")
.toText32(isBold: true)
.toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading || myAppointmentsVM.patientQueueDetailsList.isEmpty),
SizedBox(height: 8.h), SizedBox(height: 8.h),
CustomButton( CustomButton(
text: Utils.getCardButtonText(myAppointmentsVM.currentQueueStatus, myAppointmentsVM.currentPatientQueueDetails.roomNo ?? ""), text: Utils.getCardButtonText(myAppointmentsVM.currentQueueStatus, myAppointmentsVM.currentPatientQueueDetails.roomNo ?? ""),
@ -101,7 +103,7 @@ class AppointmentQueuePage extends StatelessWidget {
height: 40.h, height: 40.h,
iconColor: AppColors.whiteColor, iconColor: AppColors.whiteColor,
iconSize: 18.h, iconSize: 18.h,
).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading), ).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading || myAppointmentsVM.patientQueueDetailsList.isEmpty),
], ],
), ),
), ),

@ -1017,11 +1017,11 @@ class _LandingPageState extends State<LandingPage> {
color: AppColors.textColorLight, color: AppColors.textColorLight,
), ),
SizedBox(height: 8.h), SizedBox(height: 8.h),
currentQueue.queueNo!.toText28(isBold: true), (currentQueue.queueNo ?? "IM-123").toText28(isBold: true).toShimmer2(isShow: myAppointmentsViewModel.patientQueueDetailsList.isEmpty),
SizedBox(height: 6.h), SizedBox(height: 6.h),
_buildServingNowSection(), _buildServingNowSection(),
SizedBox(height: 5.h), SizedBox(height: 5.h),
_buildQueueActionButton(currentStatus, currentQueue.roomNo ?? ""), _buildQueueActionButton(currentStatus, currentQueue.roomNo ?? "").toShimmer2(isShow: myAppointmentsViewModel.patientQueueDetailsList.isEmpty),
], ],
), ),
), ),
@ -1042,7 +1042,7 @@ class _LandingPageState extends State<LandingPage> {
labelText: currentStatus == 0 ? LocaleKeys.inQueue.tr() : LocaleKeys.yourTurn.tr(), labelText: currentStatus == 0 ? LocaleKeys.inQueue.tr() : LocaleKeys.yourTurn.tr(),
backgroundColor: Utils.getCardBorderColor(currentStatus).withValues(alpha: 0.20), backgroundColor: Utils.getCardBorderColor(currentStatus).withValues(alpha: 0.20),
textColor: Utils.getCardBorderColor(currentStatus), textColor: Utils.getCardBorderColor(currentStatus),
), ).toShimmer2(isShow: myAppointmentsViewModel.patientQueueDetailsList.isEmpty),
Container( Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.greyColor, color: AppColors.greyColor,

Loading…
Cancel
Save