implemented search by doctor list

merge-update-with-lab-changes
haroon amjad 6 years ago
parent 13adb46319
commit 35cd02494c

@ -363,7 +363,7 @@ const Map<String, Map<String, String>> localizedValues = {
"consultation": {"en": "Consultation", "ar": "استشارة"}, "consultation": {"en": "Consultation", "ar": "استشارة"},
"logs": {"en": "Logs", "ar": "السجلات"}, "logs": {"en": "Logs", "ar": "السجلات"},
"textToSpeech": {"en": "How May I Help You?", "ar": "كيف يمكنني مساعدتك؟"}, "textToSpeech": {"en": "How May I Help You?", "ar": "كيف يمكنني مساعدتك؟"},
"locationDialogMessage": {"en": "Allow the HMG app to access your location will assist you in showing the hospitals according to the nearest to you.", "ar": "السماح لتطبيق مجموعة الحبيب الطبية بالوصول إلى موقعك سيساعدك في إظهار المستشفيات وفقًا للأقرب إليك."} "locationDialogMessage": {"en": "Allow the HMG app to access your location will assist you in showing the hospitals according to the nearest to you.", "ar": "السماح لتطبيق مجموعة الحبيب الطبية بالوصول إلى موقعك سيساعدك في إظهار المستشفيات وفقًا للأقرب إليك."},
"parking":{"en":"Parking","ar":"مواقف"}, "parking":{"en":"Parking","ar":"مواقف"},
"alhabiServices":{"en":"HMG Service","ar":"خدمات الحبيب"}, "alhabiServices":{"en":"HMG Service","ar":"خدمات الحبيب"},
"parkingTitle":{"en":"Car service, car service, service to save parking information, return to it later, 1- By clicking on (Read the code), save the parking data. 2- By clicking on the button (view my car park), it shows you the cars location in Google Maps. 3- Read another position by pressing the Clear Position Data button.","ar":" خدمة المواقف، تتيح هذه الخدمة للمستخدم معلومات عن موقف السيارة ليسهل عليه العودة لها لاحقاً ، 1- بالضغط على زر(قراءة الكود) تستطيع حفظ البيانات الخاصة بالموقف. 2-بالضغط على زر(عرض موقف سيارتي) يعرض لك موقع السيارة في خرائط قوقل. 3- لإعادة قراءة موقف آخرعن طريق الضغط على زر(مسح بيانات الموقف). "}, "parkingTitle":{"en":"Car service, car service, service to save parking information, return to it later, 1- By clicking on (Read the code), save the parking data. 2- By clicking on the button (view my car park), it shows you the cars location in Google Maps. 3- Read another position by pressing the Clear Position Data button.","ar":" خدمة المواقف، تتيح هذه الخدمة للمستخدم معلومات عن موقف السيارة ليسهل عليه العودة لها لاحقاً ، 1- بالضغط على زر(قراءة الكود) تستطيع حفظ البيانات الخاصة بالموقف. 2-بالضغط على زر(عرض موقف سيارتي) يعرض لك موقع السيارة في خرائط قوقل. 3- لإعادة قراءة موقف آخرعن طريق الضغط على زر(مسح بيانات الموقف). "},
@ -374,6 +374,5 @@ const Map<String, Map<String, String>> localizedValues = {
"gate":{"en":"Gate:","ar":"بوابة"}, "gate":{"en":"Gate:","ar":"بوابة"},
"building":{"en":"Building:","ar":"المبنى"}, "building":{"en":"Building:","ar":"المبنى"},
"branch":{"en":"Branch:","ar":"الفرع"}, "branch":{"en":"Branch:","ar":"الفرع"},
"emergencyServices":{"en":"Emergency Services:","ar":"خدمات الطوارئ"}, "emergencyServices":{"en":"Emergency Services:","ar":"خدمات الطوارئ"}
"textToSpeech": {"en": "How May I Help You?", "ar": "كيف يمكنني مساعدتك؟"}
}; };

@ -41,44 +41,44 @@ class DoctorList {
DoctorList( DoctorList(
{this.clinicID, {this.clinicID,
this.clinicName, this.clinicName,
this.doctorTitle, this.doctorTitle,
this.iD, this.iD,
this.name, this.name,
this.projectID, this.projectID,
this.projectName, this.projectName,
this.actualDoctorRate, this.actualDoctorRate,
this.clinicRoomNo, this.clinicRoomNo,
this.date, this.date,
this.dayName, this.dayName,
this.doctorID, this.doctorID,
this.doctorImageURL, this.doctorImageURL,
this.doctorProfile, this.doctorProfile,
this.doctorProfileInfo, this.doctorProfileInfo,
this.doctorRate, this.doctorRate,
this.gender, this.gender,
this.genderDescription, this.genderDescription,
this.isAppointmentAllowed, this.isAppointmentAllowed,
this.isDoctorAllowVedioCall, this.isDoctorAllowVedioCall,
this.isDoctorDummy, this.isDoctorDummy,
this.isLiveCare, this.isLiveCare,
this.latitude, this.latitude,
this.longitude, this.longitude,
this.nationalityFlagURL, this.nationalityFlagURL,
this.nationalityID, this.nationalityID,
this.nationalityName, this.nationalityName,
this.nearestFreeSlot, this.nearestFreeSlot,
this.noOfPatientsRate, this.noOfPatientsRate,
this.originalClinicID, this.originalClinicID,
this.personRate, this.personRate,
this.projectDistanceInKiloMeters, this.projectDistanceInKiloMeters,
this.qR, this.qR,
this.qRString, this.qRString,
this.rateNumber, this.rateNumber,
this.serviceID, this.serviceID,
this.setupID, this.setupID,
this.speciality, this.speciality,
this.workingHours}); this.workingHours});
DoctorList.fromJson(Map<String, dynamic> json) { DoctorList.fromJson(Map<String, dynamic> json) {
clinicID = json['ClinicID']; clinicID = json['ClinicID'];
@ -166,3 +166,13 @@ class DoctorList {
return data; return data;
} }
} }
class PatientDoctorAppointmentList {
String filterName = "";
List<DoctorList> patientDoctorAppointmentList = List();
PatientDoctorAppointmentList(
{this.filterName, DoctorList patientDoctorAppointment}) {
patientDoctorAppointmentList.add(patientDoctorAppointment);
}
}

@ -8,8 +8,10 @@ import 'package:flutter/material.dart';
class SearchResults extends StatefulWidget { class SearchResults extends StatefulWidget {
List<DoctorList> doctorsList = []; List<DoctorList> doctorsList = [];
List<PatientDoctorAppointmentList> patientDoctorAppointmentListHospital;
SearchResults({@required this.doctorsList}); SearchResults(
{@required this.doctorsList, this.patientDoctorAppointmentListHospital});
@override @override
_SearchResultsState createState() => _SearchResultsState(); _SearchResultsState createState() => _SearchResultsState();
@ -21,23 +23,7 @@ class _SearchResultsState extends State<SearchResults> {
@override @override
void initState() { void initState() {
event.controller.stream.listen((p) { event.controller.stream.listen((p) {});
// if (p['project_id'] != null) {
// tempList = [];
// widget.doctorsList.forEach((e) => {
// if (e.projectID == int.parse(p['project_id'])) {tempList.add(e)}
// });
// } else if (p['doctor_id'] != null) {
// tempList = [];
// widget.doctorsList.forEach((e) => {
// if (e.doctorID == int.parse(p['doctor_id'])) {tempList.add(e)}
// });
// DoctorView().getDoctorsProfile(context, tempList[0], isAppo: true);
// }
// setState(() {
// widget.doctorsList = tempList;
// });
});
super.initState(); super.initState();
} }
@ -50,50 +36,28 @@ class _SearchResultsState extends State<SearchResults> {
margin: EdgeInsets.only(bottom: 10.0), margin: EdgeInsets.only(bottom: 10.0),
child: SingleChildScrollView( child: SingleChildScrollView(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
child: FractionallySizedBox( child: Column(
widthFactor: 1.0, children: <Widget>[
child: Column( ...List.generate(
children: <Widget>[ widget.patientDoctorAppointmentListHospital.length,
...List.generate( (index) => AppExpandableNotifier(
widget.doctorsList.length, title: widget
(index) => AppExpandableNotifier( .patientDoctorAppointmentListHospital[index].filterName,
title: widget.doctorsList[index].projectName,
bodyWidget: Column( bodyWidget: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: widget.doctorsList.map((doctorObj) { children: widget
.patientDoctorAppointmentListHospital[index]
.patientDoctorAppointmentList
.map((doctor) {
return DoctorView( return DoctorView(
doctor: doctorObj, doctor: doctor,
); );
}).toList(), }).toList(),
), )),
), )
) ],
],
),
), ),
// ListView.builder(
// scrollDirection: Axis.vertical,
// shrinkWrap: true,
// physics: ScrollPhysics(),
// padding: EdgeInsets.all(0.0),
// itemCount: widget.doctorsList.length,
// itemBuilder: (context, index) {
// return AppExpandableNotifier(
// title: widget.doctorsList[index].projectName,
// bodyWidget: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: widget.doctorsList.map((labOrder) {
// return DoctorView(
// doctor: widget.doctorsList[index],
// );
// }).toList(),
// ),
// );
// },
// ),
), ),
), ),
); );

@ -125,14 +125,6 @@ class _SearchByClinicState extends State<SearchByClinic> {
arrDistance.add(new DoctorList.fromJson(v) arrDistance.add(new DoctorList.fromJson(v)
.projectDistanceInKiloMeters .projectDistanceInKiloMeters
.toString()); .toString());
// print(DoctorList
// .fromJson(v)
// .projectName);
// print(DoctorList
// .fromJson(v)
// .projectDistanceInKiloMeters);
// distinctIds = result.toSet().toList();
}); });
} else {} } else {}
}); });

@ -84,6 +84,10 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
getDoctorsList(BuildContext context) { getDoctorsList(BuildContext context) {
List<DoctorList> doctorsList = []; List<DoctorList> doctorsList = [];
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital =
List();
service service
.getDoctorsListByName(doctorNameController.text, context) .getDoctorsListByName(doctorNameController.text, context)
.then((res) { .then((res) {
@ -93,9 +97,34 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
res['DoctorList'].forEach((v) { res['DoctorList'].forEach((v) {
doctorsList.add(new DoctorList.fromJson(v)); doctorsList.add(new DoctorList.fromJson(v));
}); });
doctorsList.forEach((element) {
List<PatientDoctorAppointmentList> doctorByHospital =
_patientDoctorAppointmentListHospital
.where(
(elementClinic) =>
elementClinic.filterName == element.projectName,
)
.toList();
if (doctorByHospital.length != 0) {
_patientDoctorAppointmentListHospital[
_patientDoctorAppointmentListHospital
.indexOf(doctorByHospital[0])]
.patientDoctorAppointmentList
.add(element);
} else {
_patientDoctorAppointmentListHospital.add(
PatientDoctorAppointmentList(
filterName: element.projectName,
patientDoctorAppointment: element));
}
});
} else {} } else {}
}); });
navigateToSearchResults(context, doctorsList);
navigateToSearchResults(
context, doctorsList, _patientDoctorAppointmentListHospital);
} else { } else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']); AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
} }
@ -107,7 +136,7 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
_onDocTextChanged(content) { _onDocTextChanged(content) {
print(content); print(content);
if (content.length >= 4) { if (content.length >= 3) {
setState(() { setState(() {
_isButtonDisabled = false; _isButtonDisabled = false;
}); });
@ -123,10 +152,17 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
getDoctorsList(context); getDoctorsList(context);
} }
Future navigateToSearchResults(context, List<DoctorList> docList) async { Future navigateToSearchResults(
context,
List<DoctorList> docList,
List<PatientDoctorAppointmentList>
patientDoctorAppointmentListHospital) async {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => SearchResults(doctorsList: docList))); builder: (context) => SearchResults(
doctorsList: docList,
patientDoctorAppointmentListHospital:
patientDoctorAppointmentListHospital)));
} }
} }

@ -82,13 +82,9 @@ class _ExpandableListViewState extends State<ExpandableListView> {
children: <Widget>[ children: <Widget>[
new Text( new Text(
widget.result2[widget.val].toString() + widget.result2[widget.val].toString() +
" " + " " +
widget.resultDistance[widget.val] getProjectDistance(
.toString() != widget.resultDistance[widget.val].toString()),
"0"
? getProjectDistance(
widget.resultDistance[widget.val].toString())
: "",
style: new TextStyle( style: new TextStyle(
fontWeight: FontWeight.bold, color: Colors.black), fontWeight: FontWeight.bold, color: Colors.black),
), ),
@ -148,7 +144,11 @@ class _ExpandableListViewState extends State<ExpandableListView> {
} }
String getProjectDistance(String distance) { String getProjectDistance(String distance) {
return " - " + distance + " KM"; if (distance != "0")
return " - " + distance + " KMs";
else {
return "";
}
} }
} }

Loading…
Cancel
Save