|
|
|
|
@ -194,62 +194,70 @@ class _SearchBot extends State<BottomBarSearch> {
|
|
|
|
|
searchProvider
|
|
|
|
|
.getBotPages(request)
|
|
|
|
|
.then((value) => {getCommands(value['Understand'])});
|
|
|
|
|
//getDoctorsList(12, 17, 40036, context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getCommands(result) async {
|
|
|
|
|
//RoboSearch.closeAlertDialog(context);
|
|
|
|
|
print(result);
|
|
|
|
|
results = result;
|
|
|
|
|
//getDoctorsList(12, 17, 40036, context);
|
|
|
|
|
|
|
|
|
|
List clnicID = unique(result['ClinicId']);
|
|
|
|
|
switch (result["CommandNumber"]) {
|
|
|
|
|
case 100:
|
|
|
|
|
if (result['ProjectId'] != 0 &&
|
|
|
|
|
result['ClinicId'] != 0 &&
|
|
|
|
|
result['DoctorId'] != 0) {
|
|
|
|
|
clnicID.length > 0 &&
|
|
|
|
|
result['DoctorId'].length > 0) {
|
|
|
|
|
var name = result['DoctorName'].replaceAll('دكتور', '');
|
|
|
|
|
getDoctorsList(
|
|
|
|
|
result['ProjectId'],
|
|
|
|
|
result['ClinicId'],
|
|
|
|
|
context,
|
|
|
|
|
doctorId: result['DoctorId'],
|
|
|
|
|
doctorName: name.trim(),
|
|
|
|
|
);
|
|
|
|
|
if (clnicID.length == 1) {
|
|
|
|
|
getDoctorsList(
|
|
|
|
|
result['ProjectId'],
|
|
|
|
|
clnicID[0],
|
|
|
|
|
context,
|
|
|
|
|
doctorId: result['DoctorId'],
|
|
|
|
|
doctorName: name.trim(),
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
goToClinic(clnicID);
|
|
|
|
|
}
|
|
|
|
|
} else if (result['ProjectId'] != 0 &&
|
|
|
|
|
result['ClinicId'] != 0 &&
|
|
|
|
|
result['DoctorId'] == 0) {
|
|
|
|
|
getDoctorsList(
|
|
|
|
|
result['ProjectId'],
|
|
|
|
|
result['ClinicId'],
|
|
|
|
|
context,
|
|
|
|
|
);
|
|
|
|
|
clnicID.length > 0 &&
|
|
|
|
|
result['DoctorId'].length == 0) {
|
|
|
|
|
if (clnicID.length == 1) {
|
|
|
|
|
getDoctorsList(
|
|
|
|
|
result['ProjectId'],
|
|
|
|
|
clnicID[0],
|
|
|
|
|
context,
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
goToClinic(clnicID);
|
|
|
|
|
}
|
|
|
|
|
} else if (result['ProjectId'] == 0 &&
|
|
|
|
|
result['ClinicId'] != 0 &&
|
|
|
|
|
result['DoctorId'] == 0) {
|
|
|
|
|
getDoctorsList(
|
|
|
|
|
result['ProjectId'],
|
|
|
|
|
result['ClinicId'],
|
|
|
|
|
context,
|
|
|
|
|
);
|
|
|
|
|
clnicID.length > 0 &&
|
|
|
|
|
result['DoctorId'].length == 0) {
|
|
|
|
|
if (clnicID.length == 1) {
|
|
|
|
|
getDoctorsList(
|
|
|
|
|
result['ProjectId'],
|
|
|
|
|
clnicID[0],
|
|
|
|
|
context,
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
goToClinic(clnicID);
|
|
|
|
|
}
|
|
|
|
|
} else if (result['ProjectId'] == 0 &&
|
|
|
|
|
result['ClinicId'] != 0 &&
|
|
|
|
|
result['DoctorId'] != 0) {
|
|
|
|
|
clnicID.length > 0 &&
|
|
|
|
|
result['DoctorId'].length > 0) {
|
|
|
|
|
var name = result['DoctorName'].replaceAll('دكتور', '');
|
|
|
|
|
getDoctorsList(
|
|
|
|
|
result['ProjectId'],
|
|
|
|
|
result['ClinicId'],
|
|
|
|
|
context,
|
|
|
|
|
doctorId: result['DoctorId'],
|
|
|
|
|
doctorName: name.trim(),
|
|
|
|
|
);
|
|
|
|
|
if (clnicID.length == 1) {
|
|
|
|
|
getDoctorsList(
|
|
|
|
|
result['ProjectId'],
|
|
|
|
|
clnicID[0],
|
|
|
|
|
context,
|
|
|
|
|
doctorId: result['DoctorId'],
|
|
|
|
|
doctorName: name.trim(),
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
goToClinic(clnicID);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
AppGlobal.context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => Search(
|
|
|
|
|
type: 0,
|
|
|
|
|
)));
|
|
|
|
|
goToClinic(clnicID);
|
|
|
|
|
}
|
|
|
|
|
speak();
|
|
|
|
|
break;
|
|
|
|
|
@ -327,9 +335,9 @@ class _SearchBot extends State<BottomBarSearch> {
|
|
|
|
|
doctorsList.add(new DoctorList.fromJson(v));
|
|
|
|
|
arr.add(new DoctorList.fromJson(v).projectName);
|
|
|
|
|
});
|
|
|
|
|
if (res['DoctorList'].length == 1 && doctorId != null) {
|
|
|
|
|
if (res['DoctorList'].length == 1) {
|
|
|
|
|
getDoctorProfile(
|
|
|
|
|
projectId, clinicId, doctorId, context, doctorsList);
|
|
|
|
|
projectId, clinicId, doctorId[0], context, doctorsList);
|
|
|
|
|
|
|
|
|
|
//speak();
|
|
|
|
|
} else {
|
|
|
|
|
@ -384,4 +392,19 @@ class _SearchBot extends State<BottomBarSearch> {
|
|
|
|
|
// initSpeechState().then((value) => startVoiceSearch());
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
goToClinic(List ids) {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
AppGlobal.context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => Search(
|
|
|
|
|
type: 0,
|
|
|
|
|
clnicIds: ids,
|
|
|
|
|
)));
|
|
|
|
|
// eventProvider.setValue({"clinic_id": ids});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List unique(List list) {
|
|
|
|
|
return list.toSet().toList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|