Bug fixes AMG

master
FaizHashmiCS22 2 years ago
parent 74ab4d5f84
commit 3b1966f819

@ -28,7 +28,7 @@ class API {
static getCallRequestInfoByClinicInfo(String deviceIp,
{required Function(List<PatientTicketModel>, List<PatientTicketModel>, CallConfig callConfig) onSuccess, required Function(dynamic) onFailure}) async {
final body = {"ipAdress": deviceIp, "apiKey": apiKey};
bool isDevMode = true;
bool isDevMode = false;
if (isDevMode) {
var callPatients = PatientTicketModel.testCallPatients;
CallConfig callConfig = CallConfig.testCallConfig;

@ -20,26 +20,59 @@ class PatientTicketModel {
late bool isQueue;
late bool isToneReq;
late bool isVoiceReq;
late int voiceLanguage;
late String voiceLanguageText;
late String ticketNoText;
late String vitalSignText;
late String doctorText;
late String procedureText;
late String vaccinationText;
late String nebulizationText;
late String callForVitalSignText;
late String callForDoctorText;
late String callForProcedureText;
late String callForVaccinationText;
late String callForNebulizationText;
late String roomText;
late String queueNoText;
late String callForText;
late bool callUpdated = false;
PatientTicketModel(
{this.id = 0,
this.patientID = 0,
this.mobileNo = "",
this.doctorName = "",
this.doctorNameN = "",
this.patientGender = 1,
this.callType = 1,
this.editedOnTimeStamp = 0,
this.roomNo = "",
this.createdOn = "",
this.editedOn = "",
this.queueNo = "",
this.callNoStr = "",
this.isQueue = false,
this.isToneReq = false,
this.isVoiceReq = false,
this.concurrentCallDelaySec = 1});
PatientTicketModel({
this.id = 0,
this.patientID = 0,
this.mobileNo = "",
this.doctorName = "",
this.doctorNameN = "",
this.patientGender = 1,
this.callType = 1,
this.editedOnTimeStamp = 0,
this.roomNo = "",
this.createdOn = "",
this.editedOn = "",
this.queueNo = "",
this.callNoStr = "",
this.isQueue = false,
this.isToneReq = false,
this.isVoiceReq = false,
this.concurrentCallDelaySec = 1,
this.voiceLanguage = 1,
this.voiceLanguageText = "English",
this.ticketNoText = "Ticket Number",
this.vitalSignText = "VitalSign",
this.doctorText = "Doctor",
this.procedureText = "Procedure",
this.vaccinationText = "Vaccination",
this.nebulizationText = "Nebulization",
this.callForVitalSignText = "Call For VitalSign",
this.callForDoctorText = "Call For Doctor",
this.callForProcedureText = "Call For Procedure",
this.callForVaccinationText = "Call For Vaccination",
this.callForNebulizationText = "Call For Nebulization",
this.roomText = "Room",
this.queueNoText = "Queue No",
this.callForText = "Call For",
});
int getRandomNum() {
return Random().nextInt(9);
@ -62,9 +95,41 @@ class PatientTicketModel {
isQueue = json['isQueue'];
isToneReq = json['isToneReq'];
isVoiceReq = json['isVoiceReq'];
concurrentCallDelaySec = json['concurrentCallDelaySec'];
voiceLanguage = json['voiceLanguage'];
voiceLanguageText = json['voiceLanguageText'] ?? "English";
ticketNoText = json['ticketNoText'];
vitalSignText = json['vitalSignText'];
doctorText = json['doctorText'];
procedureText = json['procedureText'];
vaccinationText = json['vaccinationText'];
nebulizationText = json['nebulizationText'];
callForVitalSignText = json['callForVitalSignText'];
callForDoctorText = json['callForDoctorText'];
callForProcedureText = json['callForProcedureText'];
callForVaccinationText = json['callForVaccinationText'];
callForNebulizationText = json['callForNebulizationText'];
roomText = json['roomText'];
queueNoText = json['queueNoText'];
callForText = json['callForText'];
}
// "voiceLanguage": 1,
// "voiceLanguageText": null,
// "ticketNoText": "Ticket Number",
// "vitalSignText": "VitalSign",
// "doctorText": "Doctor",
// "procedureText": "Procedure",
// "vaccinationText": "Vaccination",
// "nebulizationText": "Nebulization",
// "callForVitalSignText": "Call For VitalSign",
// "callForDoctorText": "Call For Doctor",
// "callForProcedureText": "Call For Procedure",
// "callForVaccinationText": "Call For Vaccination",
// "callForNebulizationText": "Call For Nebulization",
// "roomText": "Room",
// "queueNoText": "Queue No",
// "callForText": "Call For"
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;

@ -86,7 +86,6 @@ class AppProvider extends ChangeNotifier {
WeathersWidgetModel currentWeathersWidgetModel = WeathersWidgetModel();
Future<void> getWeatherDetailsFromServer() async {
WeathersWidgetModel? weathersWidgetModel = await API.getWeatherDetailsFromServer(
(currentWidgetsConfigModel!.cityKey ?? "").toString(),
onFailure: (error) => log("Api call failed with this error: ${error.toString()}"),
@ -274,27 +273,38 @@ class AppProvider extends ChangeNotifier {
}
}
String getCallTypeText(PatientTicketModel ticket, CallConfig callConfig) {
String getCallTypeText(PatientTicketModel ticket) {
final callType = ticket.getCallType();
switch (callType) {
case CallType.vitalSign:
return callConfig.vitalSignText;
return ticket.callForVitalSignText;
case CallType.doctor:
return callConfig.doctorText;
return ticket.callForDoctorText;
case CallType.procedure:
return callConfig.procedureText;
return ticket.callForProcedureText;
case CallType.vaccination:
return callConfig.vaccinationText;
return ticket.callForVaccinationText;
case CallType.nebulization:
return callConfig.nebulizationText;
return ticket.callForNebulizationText;
default:
return callConfig.vitalSignText;
return ticket.callForVitalSignText;
}
}
CallByVoice? voiceCaller;
PatientTicketModel currentPatient = PatientTicketModel();
testCalling() async {
voiceCaller = CallByVoice(
preVoice: "رقم التذكرة",
ticketNo: "AMG A-78",
postVoice: "دعوة للتطعيم",
lang: "ar",
flutterTts: flutterTts,
);
await voiceCaller!.startCalling(true);
}
voiceCallPatientTicket(PatientTicketModel patientTicket) async {
currentPatient = patientTicket;
isCallingInProgress = true;
@ -307,12 +317,12 @@ class AppProvider extends ChangeNotifier {
}
if (patientTicket.isVoiceReq && voiceCaller == null && !patientTicket.isQueue) {
final postVoice = getCallTypeText(patientTicket, patientCallConfigurations);
final postVoice = getCallTypeText(patientTicket);
voiceCaller = CallByVoice(
preVoice: patientCallConfigurations.preVoiceText,
preVoice: patientTicket.ticketNoText,
ticketNo: patientTicket.queueNo.trim().toString(),
postVoice: postVoice,
lang: patientCallConfigurations.voiceLanguage == 1 ? "en-US" : "ar",
lang: patientTicket.voiceLanguage == 1 ? "en" : "ar",
flutterTts: flutterTts,
);
await voiceCaller!.startCalling(patientTicket.queueNo.trim().toString() != patientTicket.callNoStr.trim().toString());
@ -391,6 +401,7 @@ class AppProvider extends ChangeNotifier {
}
}
isCallingInProgress = false;
print("I am gere with: $isCallingInProgress");
if (isApiCallNeeded) {
Timer(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec), () async {
await callPatientsAPI();

@ -139,9 +139,8 @@ class MyHomePage extends StatelessWidget {
}
Widget dataContent({required AppProvider appProvider}) {
// if (true) {
// return qamarsBirthdayWidget();
// }
// appProvider.testCalling();
if (appProvider.patientTickets.isEmpty) {
// No Patient in Queue
return noPatientInQueue();

@ -21,6 +21,11 @@ class CallByVoice {
// log("langs4: ${(await flutterTts.setVoice({"name": "kn-in-x-knf-network", "locale": "kn-IN"})).toString()}");
// log("langs5: ${(await flutterTts.getEngines).toString()}");
// print("lang: $lang");
// print("preVoice: $preVoice");
// print("postVoice: $postVoice");
// print("ticketNo: $ticketNo");
String clinicName = "";
String patientAlpha = "";
String patientNumeric = "";
@ -37,12 +42,21 @@ class CallByVoice {
// Create Pre Voice Players
if (postVoice != null && postVoice.isNotEmpty) {
flutterTts.setSpeechRate(0.45);
flutterTts.setPitch(0.9);
if (lang == "ar") {
flutterTts.setPitch(1.1);
} else {
flutterTts.setPitch(0.9);
}
flutterTts.setVolume(1.0);
await flutterTts.setLanguage(lang);
await flutterTts.awaitSpeakCompletion(true);
// await flutterTts.speak(clinicName + " .. " + patientAlpha + " .. " + patientNumeric + " .. " + postVoice);
await flutterTts.speak(preVoice + " .. " + clinicName + " .. " + patientAlpha + " .. " + patientNumeric + " .. " + postVoice);
// await flutterTts.speak(preVoice + " .. " + clinicName + " .. " + patientAlpha + " .. " + patientNumeric + " .. " + postVoice);
await flutterTts.speak(preVoice + " .. ");
await flutterTts.setLanguage("en");
await flutterTts.speak(clinicName + " .. " + patientAlpha + " .. " + patientNumeric + " .. ");
await flutterTts.setLanguage(lang);
await flutterTts.speak(postVoice);
}
// // Create Ticket Number Voice Players

Loading…
Cancel
Save