|
|
|
|
@ -7,9 +7,9 @@ import 'package:queuing_system/core/response_models/call_config_model.dart';
|
|
|
|
|
import 'package:queuing_system/core/response_models/patient_ticket_model.dart';
|
|
|
|
|
import 'package:queuing_system/core/response_models/prayers_widget_model.dart';
|
|
|
|
|
import 'package:queuing_system/core/response_models/rss_feed_model.dart';
|
|
|
|
|
import 'package:queuing_system/core/response_models/test_patients.dart';
|
|
|
|
|
import 'package:queuing_system/core/response_models/weathers_widget_model.dart';
|
|
|
|
|
import 'package:queuing_system/core/response_models/widgets_config_model.dart';
|
|
|
|
|
import 'package:queuing_system/core/response_models/test_patients.dart';
|
|
|
|
|
|
|
|
|
|
const _getCallRequestInfoByClinicInfo = "/GetCallRequestInfo_ByIP";
|
|
|
|
|
const _callUpdateNotIsQueueRecordByIDAsync = "/CallRequest_QueueUpdate";
|
|
|
|
|
@ -27,14 +27,16 @@ class MyHttpOverrides extends HttpOverrides {
|
|
|
|
|
|
|
|
|
|
class API {
|
|
|
|
|
static getCallRequestInfoByClinicInfo(String deviceIp,
|
|
|
|
|
{required Function(List<PatientTicketModel>, List<PatientTicketModel>, CallConfig callConfig) onSuccess, required Function(dynamic) onFailure}) async {
|
|
|
|
|
{required Function(List<PatientTicketModel>, List<PatientTicketModel>, CallConfig callConfig) onSuccess,
|
|
|
|
|
required Function(dynamic) onFailure}) async {
|
|
|
|
|
final body = {"ipAdress": deviceIp, "apiKey": apiKey};
|
|
|
|
|
bool isDevMode = false;
|
|
|
|
|
if (isDevMode) {
|
|
|
|
|
final Map<String, dynamic> response = testPatientsData["data"] as Map<String, dynamic>;
|
|
|
|
|
|
|
|
|
|
CallConfig callConfig = CallConfig.fromJson(response["callConfig"]);
|
|
|
|
|
var callPatients = (response["callPatients"] as List).map((j) => PatientTicketModel.fromJson(j)).toList().where((element) => element.callType != 0).toList();
|
|
|
|
|
var callPatients =
|
|
|
|
|
(response["callPatients"] as List).map((j) => PatientTicketModel.fromJson(j)).toList().where((element) => element.callType != 0).toList();
|
|
|
|
|
var isQueuePatients = callPatients.where((element) => (element.isQueue == false && element.callType != 0)).toList();
|
|
|
|
|
log("callPatients: ${callPatients.toString()}");
|
|
|
|
|
log("isQueuePatients: ${isQueuePatients.toString()}");
|
|
|
|
|
@ -48,15 +50,20 @@ class API {
|
|
|
|
|
final response = apiResp["data"];
|
|
|
|
|
|
|
|
|
|
CallConfig callConfig = CallConfig.fromJson(response["callConfig"]);
|
|
|
|
|
var callPatients = (response["callPatients"] as List).map((j) => PatientTicketModel.fromJson(j)).toList().where((element) => element.callType != 0).toList();
|
|
|
|
|
var callPatients = (response["callPatients"] as List)
|
|
|
|
|
.map((j) => PatientTicketModel.fromJson(j))
|
|
|
|
|
.toList()
|
|
|
|
|
.where((element) => element.callType != 0)
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
var isQueuePatients = callPatients.where((element) => (element.isQueue == false && element.callType != 0)).toList();
|
|
|
|
|
callPatients.sort((a, b) => a.editedOnTimeStamp.compareTo(b.editedOnTimeStamp));
|
|
|
|
|
isQueuePatients.sort((a, b) => a.editedOnTimeStamp.compareTo(b.editedOnTimeStamp));
|
|
|
|
|
|
|
|
|
|
log("callPatients: ${callPatients.toList().toString()}");
|
|
|
|
|
callPatients.removeWhere((element) => element.isQueue == false);
|
|
|
|
|
callPatients.addAll(isQueuePatients);
|
|
|
|
|
log("callPatients: ${callPatients.reversed.toList().toString()}");
|
|
|
|
|
log("isQueuePatients: ${isQueuePatients.reversed.toList().toString()}");
|
|
|
|
|
onSuccess(callPatients.toList(), isQueuePatients.reversed.toList(), callConfig);
|
|
|
|
|
onSuccess(callPatients.reversed.toList(), isQueuePatients.reversed.toList(), callConfig);
|
|
|
|
|
} else {
|
|
|
|
|
onFailure(apiResp);
|
|
|
|
|
}
|
|
|
|
|
|