|
|
|
|
@ -52,7 +52,8 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
inputWidget(TranslationBase.of(context).enterDocName, '', doctorNameController),
|
|
|
|
|
inputWidget(TranslationBase.of(context).enterDocName, '',
|
|
|
|
|
doctorNameController),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -84,7 +85,8 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
|
|
|
|
|
_searchDoctor(context);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
child: Text(TranslationBase.of(context).search, style: TextStyle(fontSize: 18.0, color: Colors.white)),
|
|
|
|
|
child: Text(TranslationBase.of(context).search,
|
|
|
|
|
style: TextStyle(fontSize: 18.0, color: Colors.white)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
@ -98,50 +100,50 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
|
|
|
|
|
var counter = 0;
|
|
|
|
|
var isHmc = false;
|
|
|
|
|
|
|
|
|
|
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital = [];
|
|
|
|
|
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital =
|
|
|
|
|
[];
|
|
|
|
|
|
|
|
|
|
service.getDoctorsListByName(doctorNameController.text, languageID, context).then((res) async {
|
|
|
|
|
service
|
|
|
|
|
.getDoctorsListByName(doctorNameController.text, languageID, context)
|
|
|
|
|
.then((res) async {
|
|
|
|
|
// GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
RegionList regionHospitalList = RegionList();
|
|
|
|
|
|
|
|
|
|
if (res['DoctorList'].length != 0) {
|
|
|
|
|
res['DoctorList'].forEach((v) {
|
|
|
|
|
var reg = region[counter%4];
|
|
|
|
|
counter++;
|
|
|
|
|
doctorsList.add(new DoctorList.fromJson(v, region: reg,isHMC: isHmc));
|
|
|
|
|
isHmc = !isHmc;
|
|
|
|
|
});
|
|
|
|
|
print('the counter is ${
|
|
|
|
|
counter
|
|
|
|
|
}');
|
|
|
|
|
if (res['DoctorList'].length != 0) {
|
|
|
|
|
res['DoctorList'].forEach((v) {
|
|
|
|
|
var reg = region[counter % 4];
|
|
|
|
|
counter++;
|
|
|
|
|
doctorsList
|
|
|
|
|
.add(new DoctorList.fromJson(v, region: reg, isHMC: isHmc));
|
|
|
|
|
isHmc = !isHmc;
|
|
|
|
|
});
|
|
|
|
|
print('the counter is ${counter}');
|
|
|
|
|
|
|
|
|
|
regionHospitalList = await DoctorMapper.getMappedDoctor(doctorsList);
|
|
|
|
|
regionHospitalList =
|
|
|
|
|
await DoctorMapper.sortList(true, regionHospitalList);
|
|
|
|
|
|
|
|
|
|
regionHospitalList = await DoctorMapper.getMappedDoctor(doctorsList);
|
|
|
|
|
regionHospitalList = await DoctorMapper.sortList(true, regionHospitalList);
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
// doctorsList.forEach((element) {
|
|
|
|
|
// List<PatientDoctorAppointmentList> doctorByHospital =
|
|
|
|
|
// _patientDoctorAppointmentListHospital.where((elementClinic) => elementClinic.filterName == element.getProjectCompleteName()).toList();
|
|
|
|
|
//
|
|
|
|
|
// if (doctorByHospital.length != 0) {
|
|
|
|
|
// _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element);
|
|
|
|
|
// } else {
|
|
|
|
|
// _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(
|
|
|
|
|
// filterName: element.getProjectCompleteName(),
|
|
|
|
|
// distanceInKMs: element.projectDistanceInKiloMeters.toString(),
|
|
|
|
|
// projectTopName: element.projectTopName,
|
|
|
|
|
// projectBottomName: element.projectBottomName,
|
|
|
|
|
// patientDoctorAppointment: element));
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
} else {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorSearchMsg']);
|
|
|
|
|
}
|
|
|
|
|
setState(() {});
|
|
|
|
|
// doctorsList.forEach((element) {
|
|
|
|
|
// List<PatientDoctorAppointmentList> doctorByHospital =
|
|
|
|
|
// _patientDoctorAppointmentListHospital.where((elementClinic) => elementClinic.filterName == element.getProjectCompleteName()).toList();
|
|
|
|
|
//
|
|
|
|
|
// if (doctorByHospital.length != 0) {
|
|
|
|
|
// _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element);
|
|
|
|
|
// } else {
|
|
|
|
|
// _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(
|
|
|
|
|
// filterName: element.getProjectCompleteName(),
|
|
|
|
|
// distanceInKMs: element.projectDistanceInKiloMeters.toString(),
|
|
|
|
|
// projectTopName: element.projectTopName,
|
|
|
|
|
// projectBottomName: element.projectBottomName,
|
|
|
|
|
// patientDoctorAppointment: element));
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
} else {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorSearchMsg']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
// navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital);
|
|
|
|
|
@ -173,23 +175,30 @@ setState(() {
|
|
|
|
|
|
|
|
|
|
_searchDoctor(BuildContext context) {
|
|
|
|
|
getDoctorsList(context);
|
|
|
|
|
context.read<ProjectViewModel>().analytics.appointment.book_appointment_doctor_search(query: doctorNameController.text);
|
|
|
|
|
context
|
|
|
|
|
.read<ProjectViewModel>()
|
|
|
|
|
.analytics
|
|
|
|
|
.appointment
|
|
|
|
|
.book_appointment_doctor_search(query: doctorNameController.text);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
navigateToSearchResults(context, RegionList regionHospitalList) {
|
|
|
|
|
// Navigator.push(context,
|
|
|
|
|
// FadePage(page: SearchResults(isLiveCareAppointment: false, isDoctorNameSearch: true, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital, isDoctorSearchResult: true,)));
|
|
|
|
|
Navigator.push(context,
|
|
|
|
|
FadePage(page:
|
|
|
|
|
SearchResultsByRegion(
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: SearchResultsByRegion(
|
|
|
|
|
doctorsList: [],
|
|
|
|
|
patientDoctorAppointmentListHospital:regionHospitalList,
|
|
|
|
|
patientDoctorAppointmentListHospital: regionHospitalList,
|
|
|
|
|
isLiveCareAppointment: false,
|
|
|
|
|
isDoctorSearchResult: true,
|
|
|
|
|
)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String? prefix, bool isEnable = true, bool hasSelection = false}) {
|
|
|
|
|
Widget inputWidget(
|
|
|
|
|
String _labelText, String _hintText, TextEditingController _controller,
|
|
|
|
|
{String? prefix, bool isEnable = true, bool hasSelection = false}) {
|
|
|
|
|
return Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
|