|
|
|
|
@ -5,7 +5,7 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Appointments/SearchInfoModel.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/DentalComplaints.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
@ -216,6 +216,9 @@ class _SearchByClinicState extends State<SearchByClinic> {
|
|
|
|
|
List<String> arrDistance = [];
|
|
|
|
|
List<String> result;
|
|
|
|
|
int numAll;
|
|
|
|
|
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital =
|
|
|
|
|
List();
|
|
|
|
|
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service
|
|
|
|
|
.getDoctorsList(
|
|
|
|
|
@ -228,23 +231,48 @@ class _SearchByClinicState extends State<SearchByClinic> {
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (res['DoctorList'].length != 0) {
|
|
|
|
|
print(res['DoctorList']);
|
|
|
|
|
// print(res['DoctorList']);
|
|
|
|
|
doctorsList.clear();
|
|
|
|
|
res['DoctorList'].forEach((v) {
|
|
|
|
|
doctorsList.add(new DoctorList.fromJson(v));
|
|
|
|
|
// arr.add(new DoctorList.fromJson(v).projectName);
|
|
|
|
|
// arrDistance.add(new DoctorList.fromJson(v)
|
|
|
|
|
// .projectDistanceInKiloMeters
|
|
|
|
|
// .toString());
|
|
|
|
|
});
|
|
|
|
|
doctorsList.forEach((element) {
|
|
|
|
|
List<PatientDoctorAppointmentList> doctorByHospital =
|
|
|
|
|
_patientDoctorAppointmentListHospital
|
|
|
|
|
.where(
|
|
|
|
|
(elementClinic) =>
|
|
|
|
|
elementClinic.filterName == element.projectName,
|
|
|
|
|
)
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
arr.add(new DoctorList.fromJson(v).projectName);
|
|
|
|
|
arrDistance.add(new DoctorList.fromJson(v)
|
|
|
|
|
.projectDistanceInKiloMeters
|
|
|
|
|
.toString());
|
|
|
|
|
if (doctorByHospital.length != 0) {
|
|
|
|
|
_patientDoctorAppointmentListHospital[
|
|
|
|
|
_patientDoctorAppointmentListHospital
|
|
|
|
|
.indexOf(doctorByHospital[0])]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.add(element);
|
|
|
|
|
} else {
|
|
|
|
|
_patientDoctorAppointmentListHospital.add(
|
|
|
|
|
PatientDoctorAppointmentList(
|
|
|
|
|
filterName: element.projectName,
|
|
|
|
|
distanceInKMs:
|
|
|
|
|
element.projectDistanceInKiloMeters.toString(),
|
|
|
|
|
patientDoctorAppointment: element));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
result = LinkedHashSet<String>.from(arr).toList();
|
|
|
|
|
numAll = result.length;
|
|
|
|
|
// navigateToSearchResults(
|
|
|
|
|
// context, doctorsList, result, numAll, arrDistance);
|
|
|
|
|
navigateToSearchResults(
|
|
|
|
|
context, doctorsList, result, numAll, arrDistance);
|
|
|
|
|
context, doctorsList, _patientDoctorAppointmentListHospital);
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
|
@ -267,17 +295,18 @@ class _SearchByClinicState extends State<SearchByClinic> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future navigateToSearchResults(
|
|
|
|
|
context, docList, result, numAll, resultDistance) async {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => BranchView(
|
|
|
|
|
doctorsList: docList,
|
|
|
|
|
result: result,
|
|
|
|
|
num: numAll,
|
|
|
|
|
resultDistance: resultDistance),
|
|
|
|
|
),
|
|
|
|
|
).then((value) {
|
|
|
|
|
List<DoctorList> docList,
|
|
|
|
|
List<PatientDoctorAppointmentList>
|
|
|
|
|
patientDoctorAppointmentListHospital) async {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => SearchResults(
|
|
|
|
|
isLiveCareAppointment: false,
|
|
|
|
|
doctorsList: docList,
|
|
|
|
|
patientDoctorAppointmentListHospital:
|
|
|
|
|
patientDoctorAppointmentListHospital))).then((value) {
|
|
|
|
|
getProjectsList();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|