added call_config

faiz_dev_new
FaizHashmiCS22 2 years ago
parent e82f908885
commit 01bf6736c6

@ -5,6 +5,7 @@ import 'package:flutter/cupertino.dart';
import 'package:queuing_system/core/base/base_app_client.dart';
import 'package:queuing_system/core/config/config.dart';
import 'package:queuing_system/core/response_model/patient_call.dart';
import 'package:queuing_system/home/home_screen.dart';
const _getCallRequestInfoByClinicInfo = "/GetCallRequestInfo_ByIP";
const _callUpdateNotIsQueueRecordByIDAsync = "/CallRequest_QueueUpdate";
@ -19,6 +20,23 @@ class MyHttpOverrides extends HttpOverrides {
class API {
static getCallRequestInfoByClinicInfo(String deviceIp, {@required Function(List<Tickets>, List<Tickets>) onSuccess, @required Function(dynamic) onFailure}) async {
final body = {"ipAdress": deviceIp, "apiKey": apiKey};
if (isDevMode) {
var callPatients = Tickets.testCallPatients;
// final patients = (response["drCallPatients"] as List).map((j) => Tickets.fromJson(j)).toList();
// callPatients.addAll(patients);
// log("callPatients: ${callPatients.toString()} ");
// log("patients: ${patients.toString()} ");
var isQueuePatients = callPatients.where((element) => (element.callType == 1 && element.isQueueNurse == false) || (element.callType == 2 && element.isQueueDr == false)).toList();
// callPatients.removeWhere((element) => (element.callType == 1 && element.isQueueNurse == false) || (element.callType == 2 && element.isQueueDr == false));
// callPatients.sort((a, b) => a.editedOnTimeStamp.compareTo(b.editedOnTimeStamp));
// callPatients.addAll(isQueuePatients.toList());
onSuccess(callPatients.reversed.toList(), isQueuePatients.reversed.toList());
return;
}
BaseAppClient.post(_getCallRequestInfoByClinicInfo,
body: body,
onSuccess: (apiResp, status) {

@ -0,0 +1,69 @@
// public int ConcurrentCallDelaySec { get; set; }
// public int VoiceType { get; set; }
// public int ScreenLanguage { get; set; }
// public int VoiceLanguage { get; set; }
// public int ScreenMaxDisplayPatients { get; set; }
// public string VitalSignText { get; set; }
// public string VitalSignTextN { get; set; }
// public string DoctorText { get; set; }
// public string DoctorTextN { get; set; }
// public string ProcedureText { get; set; }
// public string ProcedureTextN { get; set; }
// public string VaccinationText { get; set; }
// public string VaccinationTextN { get; set; }
// public string NebulizationText { get; set; }
// public string NebulizationTextN { get; set; }
class CallConfig {
int concurrentCallDelaySec;
int voiceType;
int screenLanguage;
int voiceLanguage;
int screenMaxDisplayPatients;
String vitalSignText;
String vitalSignTextN;
String doctorText;
String doctorTextN;
String procedureText;
String procedureTextN;
String vaccinationText;
String vaccinationTextN;
String nebulizationText;
String nebulizationTextN;
CallConfig({
this.concurrentCallDelaySec,
this.voiceType,
this.screenLanguage,
this.voiceLanguage,
this.screenMaxDisplayPatients,
this.vitalSignText,
this.vitalSignTextN,
this.doctorText,
this.doctorTextN,
this.procedureText,
this.procedureTextN,
this.vaccinationText,
this.vaccinationTextN,
this.nebulizationText,
this.nebulizationTextN,
});
CallConfig.fromJson(Map<String, dynamic> json) {
concurrentCallDelaySec = json['concurrentCallDelaySec'];
voiceType = json['voiceType'];
screenLanguage = json['screenLanguage'];
voiceLanguage = json['voiceLanguage'];
screenMaxDisplayPatients = json['screenMaxDisplayPatients'];
vitalSignText = json['vitalSignText'];
vitalSignTextN = json['vitalSignTextN'];
doctorText = json['doctorText'];
doctorTextN = json['doctorTextN'];
procedureText = json['procedureText'];
procedureTextN = json['procedureTextN'];
vaccinationText = json['vaccinationText'];
vaccinationTextN = json['vaccinationTextN'];
nebulizationText = json['nebulizationText'];
nebulizationTextN = json['nebulizationTextN'];
}
}

@ -44,7 +44,7 @@ class Tickets {
this.queueDuration});
int getRandomNum() {
return Random().nextInt(1);
return Random().nextInt(9);
}
Tickets.fromJson(Map<String, dynamic> json) {
@ -101,4 +101,84 @@ class Tickets {
if (callType == 2) return CallType.DOCTOR;
return CallType.NONE;
}
static List<Tickets> testCallPatients = [
Tickets(
id: 1,
patientID: 112,
mobileNo: "112",
doctorName: "name",
doctorNameN: "nameN",
patientGender: 1,
callType: 1,
roomNo: "617",
createdOn: DateTime.now().millisecondsSinceEpoch.toString(),
editedOn: DateTime.now().millisecondsSinceEpoch.toString(),
editedOnTimeStamp: DateTime.now().millisecondsSinceEpoch,
queueNo: "B-89",
callNoStr: "B-89",
isQueueNurse: true,
isQueueDr: false,
isToneReq: true,
isVoiceReq: true,
queueDuration: "5000",
),
Tickets(
id: 1,
patientID: 112,
mobileNo: "112",
doctorName: "name",
doctorNameN: "nameN",
patientGender: 1,
callType: 1,
roomNo: "617",
createdOn: DateTime.now().millisecondsSinceEpoch.toString(),
editedOn: DateTime.now().millisecondsSinceEpoch.toString(),
queueNo: "B-89",
callNoStr: "B-89",
isQueueNurse: true,
isQueueDr: false,
isToneReq: true,
isVoiceReq: true,
queueDuration: "5000",
),
Tickets(
id: 1,
patientID: 112,
mobileNo: "112",
doctorName: "name",
doctorNameN: "nameN",
patientGender: 1,
callType: 1,
roomNo: "617",
createdOn: DateTime.now().millisecondsSinceEpoch.toString(),
editedOn: DateTime.now().millisecondsSinceEpoch.toString(),
queueNo: "B-89",
callNoStr: "B-89",
isQueueNurse: true,
isQueueDr: false,
isToneReq: true,
isVoiceReq: true,
queueDuration: "5000",
),
Tickets(
id: 1,
patientID: 112,
mobileNo: "112",
doctorName: "name",
doctorNameN: "nameN",
patientGender: 1,
callType: 1,
roomNo: "617",
createdOn: DateTime.now().millisecondsSinceEpoch.toString(),
editedOn: DateTime.now().millisecondsSinceEpoch.toString(),
queueNo: "B-89",
callNoStr: "B-89",
isQueueNurse: true,
isQueueDr: false,
isToneReq: true,
isVoiceReq: true,
queueDuration: "5000",
),
];
}

@ -1,59 +0,0 @@
import 'dart:convert';
Xyz xyzFromJson(String str) => Xyz.fromJson(json.decode(str));
String xyzToJson(Xyz data) => json.encode(data.toJson());
class Xyz {
Xyz({
this.callNo,
this.roomNo,
this.callType,
this.createdON,
this.doctorName,
this.doctorNameN,
this.editedON,
this.mobileNo,
this.patientGender,
this.patientID,
this.queueNo,});
Xyz.fromJson(dynamic json) {
callNo = json['CallNo'];
roomNo = json['RoomNo'];
callType = json['CallType'];
createdON = json['CreatedON'];
doctorName = json['DoctorName'];
doctorNameN = json['DoctorNameN'];
editedON = json['EditedON'];
mobileNo = json['MobileNo'];
patientGender = json['PatientGender'];
patientID = json['PatientID'];
queueNo = json['QueueNo'];
}
int callNo;
String roomNo;
int callType;
String createdON;
String doctorName;
String doctorNameN;
String editedON;
String mobileNo;
int patientGender;
int patientID;
String queueNo;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['CallNo'] = callNo;
map['RoomNo'] = roomNo;
map['CallType'] = callType;
map['CreatedON'] = createdON;
map['DoctorName'] = doctorName;
map['DoctorNameN'] = doctorNameN;
map['EditedON'] = editedON;
map['MobileNo'] = mobileNo;
map['PatientGender'] = patientGender;
map['PatientID'] = patientID;
map['QueueNo'] = queueNo;
return map;
}
}

@ -17,7 +17,9 @@ import 'package:queuing_system/utils/signalR_utils.dart';
import 'package:queuing_system/utils/utils.dart';
import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
var deviceIPGlobal = "10.10.15.11"; // Testing IP
var deviceIPGlobal = "10.10.15.11";
bool isDevMode = true; // Testing IP
// var DEVICE_IP = "10.10.14.11"; // Testing IP
// var DEVICE_IP = "10.10.15.11";
@ -62,7 +64,6 @@ class _MyHomePageState extends State<MyHomePage> {
final AudioPlayer audioPlayer = AudioPlayer();
@override
void initState() {
listenNetworkConnectivity();
@ -102,10 +103,15 @@ class _MyHomePageState extends State<MyHomePage> {
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppText(
"Powered By",
fontSize: SizeConfig.getWidthMultiplier() * 2.6,
fontFamily: 'Poppins-Medium.ttf',
InkWell(
onTap: () {
onUpdateAvailable("");
},
child: AppText(
"Powered By",
fontSize: SizeConfig.getWidthMultiplier() * 2.6,
fontFamily: 'Poppins-Medium.ttf',
),
),
Text(deviceIPGlobal, style: TextStyle(fontWeight: FontWeight.w500, fontSize: SizeConfig.getWidthMultiplier() * 2.2)),
],
@ -257,6 +263,24 @@ class _MyHomePageState extends State<MyHomePage> {
}
}
Future<void> callPatientsAPI() async {
waitings.clear();
API.getCallRequestInfoByClinicInfo(deviceIPGlobal, onSuccess: (waitingCalls, isQueuePatientsCalls) {
setState(() {
waitings = waitingCalls;
isQueuePatients = isQueuePatientsCalls;
// currents = currentInClinic;
});
log("--------------------");
log("waiting: $waitings");
log("isQueuePatients: $isQueuePatients");
log("--------------------");
updateTickets();
}, onFailure: (error) {});
}
onUpdateAvailable(data) async {
// if (isQueuePatients.isNotEmpty && callFlag == 0) {
// callFlag = 1;
@ -264,59 +288,16 @@ class _MyHomePageState extends State<MyHomePage> {
// }
if (waitings.isNotEmpty) {
if ((waitings.first.isToneReq && isCallingInProgress) || (waitings.first.isVoiceReq && voiceCaller != null)) {
// if (true) {
// if (true) {
print("I will wait with $isCallingInProgress ");
Timer(Duration(milliseconds: int.parse(waitings.first.queueDuration)), () {
// Timer(Duration(milliseconds: 0), () {
waitings.clear();
API.getCallRequestInfoByClinicInfo(deviceIPGlobal, onSuccess: (waitingCalls, isQueuePatientsCalls) {
setState(() {
waitings = waitingCalls;
isQueuePatients = isQueuePatientsCalls;
// currents = currentInClinic;
});
log("--------------------");
log("waiting: $waitings");
log("isQueuePatients: $isQueuePatients");
log("--------------------");
updateTickets();
}, onFailure: (error) {});
Timer(Duration(milliseconds: int.parse(waitings.first.queueDuration)), () async {
await callPatientsAPI();
});
} else {
waitings.clear();
API.getCallRequestInfoByClinicInfo(deviceIPGlobal, onSuccess: (waitingCalls, isQueuePatientsCalls) {
setState(() {
waitings = waitingCalls;
isQueuePatients = isQueuePatientsCalls;
// currents = currentInClinic;
});
log("--------------------");
log("waiting: $waitings");
log("isQueuePatients: $isQueuePatients");
log("--------------------");
updateTickets();
}, onFailure: (error) {});
await callPatientsAPI();
}
} else {
waitings.clear();
API.getCallRequestInfoByClinicInfo(deviceIPGlobal, onSuccess: (waitingCalls, isQueuePatientsCalls) {
setState(() {
waitings = waitingCalls;
isQueuePatients = isQueuePatientsCalls;
// currents = currentInClinic;
});
log("--------------------");
log("waiting: $waitings");
log("isQueuePatients: $isQueuePatients");
log("--------------------");
updateTickets();
}, onFailure: (error) {});
await callPatientsAPI();
}
}

@ -63,6 +63,7 @@ class TicketItem extends StatelessWidget {
const TicketItem({Key key, @required this.isClinicAdded, @required this.ticketNo, @required this.roomNo, @required this.callType, this.scale, this.blink = false}) : super(key: key);
String getFormattedTicket(String ticketNo, bool isClinicAdded) {
print("ticket: $ticketNo");
if (isClinicAdded) {
var formattedString = ticketNo.split(" ");
return formattedString[0] + " " + formattedString[1];

Loading…
Cancel
Save