Search By Clinic & Search By Doctor Name implemented

merge-requests/2/head
haroon amjad 4 years ago
parent 9eb9f01dbd
commit ca7b4534a8

@ -12,6 +12,9 @@ const BASE_URL = 'https://hmgwebservices.com/'; // Production Environment
//URL to get clinic list
const GET_CLINICS_LIST_URL = "Services/lists.svc/REST/GetClinicCentralized";
//URL to get doctors list
const GET_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/SearchDoctorsByTime";
class AppGlobal {
static var context;

@ -1,12 +0,0 @@
class FreeSlot {
List event;
DateTime slot;
FreeSlot(this.slot, this.event);
@override
String toString() {
return '{ ${this.slot}, ${this.event} }';
}
}

@ -32,9 +32,9 @@ class _SearchState extends State<Search> with SingleTickerProviderStateMixin {
),
title: Text(TranslationBase.of(context).bookAppo),
),
body: TabBarView(children: [
SearchByClinic(),
SearchByDoctor()
], controller: _tabController));
body: TabBarView(
physics: NeverScrollableScrollPhysics(),
children: [SearchByClinic(), SearchByDoctor()],
controller: _tabController));
}
}

@ -1,5 +1,5 @@
import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
@ -11,7 +11,7 @@ class SearchByClinic extends StatefulWidget {
class _SearchByClinicState extends State<SearchByClinic> {
bool nearestAppo = false;
String dropdownValue = null;
String dropdownValue;
List<ListClinicCentralized> clinicsList = [];
@override
@ -60,17 +60,17 @@ class _SearchByClinicState extends State<SearchByClinic> {
child: DropdownButton<String>(
hint: new Text("Select Clinic"),
value: dropdownValue,
items: clinicsList
.map((ListClinicCentralized clinicSelected) {
items: clinicsList.map((item) {
return new DropdownMenuItem<String>(
// value: dropdownValue,
child: new Text(clinicSelected.clinicDescription),
value: item.clinicID.toString(),
child: new Text(item.clinicDescription),
);
}).toList(),
onChanged: (newValue) {
setState(() {
print(newValue);
dropdownValue = newValue;
print(dropdownValue);
getDoctorsList();
});
},
),
@ -88,22 +88,26 @@ class _SearchByClinicState extends State<SearchByClinic> {
res['ListClinicCentralized'].forEach((v) {
clinicsList.add(new ListClinicCentralized.fromJson(v));
});
clinicsList.forEach((v) {
print(v.clinicID);
});
});
} else {
// handel error
setState(() {
// projectsList = ListProject;
});
}
} else {}
}).catchError((err) {
setState(() {
// projectsList = ListProject;
});
print(err);
});
}
getDoctorsList() {
DoctorsListService service = new DoctorsListService();
service.getDoctorsList(int.parse(dropdownValue), 0).then((res) {
print(res['DoctorList']);
// if (res['MessageStatus'] == 1) {
// setState(() {
// res['ListClinicCentralized'].forEach((v) {
// clinicsList.add(new ListClinicCentralized.fromJson(v));
// });
// });
// } else {}
}).catchError((err) {
print(err);
});
}
}

@ -1,3 +1,4 @@
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
@ -73,6 +74,23 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
);
}
getDoctorsList() {
DoctorsListService service = new DoctorsListService();
service.getDoctorsListByName(doctorNameController.text).then((res) {
print(res['DoctorList']);
if (res['MessageStatus'] == 1) {
// setState(() {
// res['ListClinicCentralized'].forEach((v) {
// clinicsList.add(new ListClinicCentralized.fromJson(v));
// });
// });
navigateToSearchResults(context);
} else {}
}).catchError((err) {
print(err);
});
}
_onDocTextChanged(content) {
print(content);
if (content.length >= 4) {
@ -88,7 +106,7 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
}
void _searchDoctor() {
navigateToSearchResults(context);
getDoctorsList();
}
Future navigateToSearchResults(context) async {

@ -0,0 +1,88 @@
import 'package:diplomaticquarterapp/client/base_app_client.dart';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/models/Request.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
class DoctorsListService {
AppSharedPreferences sharedPref = AppSharedPreferences();
AppGlobal appGlobal = new AppGlobal();
Future<Map> getDoctorsList(int clinicID, int projectID) async {
Map<String, dynamic> request;
var languageID = await sharedPref.getString(APP_LANGUAGE);
Request req = appGlobal.getPublicRequest();
request = {
"LanguageID": languageID == 'ar' ? 1 : 2,
"IPAdress": "10.20.10.20",
"VersionID": req.VersionID,
"Channel": req.Channel,
"generalid": 'Cs2020@2016\$2958',
"PatientOutSA": 0,
"TokenID": "",
"DeviceTypeID": req.DeviceTypeID,
"SessionID": null,
"ClinicID": 21,
"ProjectID": 0,
"ContinueDentalPlan": false,
"IsSearchAppointmnetByClinicID": true,
"PatientID": 0,
"gender": 0,
"age": 0,
"IsGetNearAppointment": false,
"Latitude": 0,
"Longitude": 0,
"License": true
};
dynamic localRes;
await BaseAppClient.post(GET_DOCTORS_LIST_URL,
onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future<Map> getDoctorsListByName(String docName) async {
Map<String, dynamic> request;
var languageID = await sharedPref.getString(APP_LANGUAGE);
Request req = appGlobal.getPublicRequest();
request = {
"LanguageID": languageID == 'ar' ? 1 : 2,
"IPAdress": "10.20.10.20",
"VersionID": req.VersionID,
"Channel": req.Channel,
"generalid": 'Cs2020@2016\$2958',
"PatientOutSA": 0,
"TokenID": "",
"DeviceTypeID": req.DeviceTypeID,
"SessionID": null,
"ClinicID": 0,
"ProjectID": 0,
"ContinueDentalPlan": false,
"IsSearchAppointmnetByClinicID": false,
"DoctorName": docName,
"PatientID": 0,
"gender": 0,
"age": 0,
"IsGetNearAppointment": false,
"Latitude": 0,
"Longitude": 0,
"License": true
};
dynamic localRes;
await BaseAppClient.post(GET_DOCTORS_LIST_URL,
onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
}
Loading…
Cancel
Save