implementing Dental Appointment flow

find_us
haroon amjad 5 years ago
parent a7f5dfab5c
commit 1886f3a763

@ -69,6 +69,9 @@ const GET_QR_PARKING = '/Services/SWP.svc/REST/GetQRParkingByID';
//URL to get clinic list
const GET_CLINICS_LIST_URL = "Services/lists.svc/REST/GetClinicCentralized";
//URL to get projects list
const GET_PROJECTS_LIST = 'Services/Lists.svc/REST/GetProject';
//URL to get doctors list
const GET_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/SearchDoctorsByTime";

@ -0,0 +1,10 @@
class SearchInfo {
int ProjectID;
int ClinicID;
String DoctorName;
String SelectedDate;
String SelectedTime;
String currentLat;
String currentLong;
DateTime date;
}

@ -0,0 +1,49 @@
import 'package:diplomaticquarterapp/models/Appointments/SearchInfoModel.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:smart_progress_bar/smart_progress_bar.dart';
class DentalComplaints extends StatefulWidget {
SearchInfo searchInfo;
DentalComplaints({@required this.searchInfo});
@override
_DentalComplaintsState createState() => _DentalComplaintsState();
}
class _DentalComplaintsState extends State<DentalComplaints> {
@override
void initState() {
WidgetsBinding.instance
.addPostFrameCallback((_) => getChiefComplaintsList());
super.initState();
}
@override
Widget build(BuildContext context) {
return AppScaffold(
isShowAppBar: true,
appBarTitle: "Symptoms",
body: Container(),
);
}
getChiefComplaintsList() {
ClinicListService service = new ClinicListService();
service
.getChiefComplaintsList(
widget.searchInfo.ClinicID, widget.searchInfo.ProjectID, context)
.then((res) {
if (res['MessageStatus'] == 1) {
// setState(() {
// res['List_DentalChiefComplain'].forEach((v) {});
// });
} else {}
}).catchError((err) {
print(err);
}).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
}
}

@ -1,7 +1,10 @@
import "dart:collection";
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
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/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
@ -19,8 +22,11 @@ class SearchByClinic extends StatefulWidget {
class _SearchByClinicState extends State<SearchByClinic> {
bool nearestAppo = false;
String dropdownValue;
String projectDropdownValue;
var event = RobotProvider();
List<ListClinicCentralized> clinicsList = [];
List<HospitalsModel> projectsList = [];
bool isMobileAppDentalAllow = false;
@override
void initState() {
@ -76,27 +82,93 @@ class _SearchByClinicState extends State<SearchByClinic> {
onChanged: (newValue) {
setState(() {
dropdownValue = newValue;
if (!isDentalSelectedAndSupported()) {
projectDropdownValue = "";
getDoctorsList(context);
}
});
},
),
)),
isDentalSelectedAndSupported() == true || nearestAppo
? Container(
height: 60.0,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.grey[400],
width: 1.0,
),
borderRadius: BorderRadius.circular(10),
),
padding: EdgeInsets.all(8.0),
width: MediaQuery.of(context).size.width,
margin: EdgeInsets.only(top: 15.0),
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
hint: new Text("Select Project"),
value: projectDropdownValue,
items: projectsList.map((item) {
return new DropdownMenuItem<String>(
value: item.mainProjectID.toString(),
child: new Text(item.name),
);
}).toList(),
onChanged: (newValue) {
setState(() {
projectDropdownValue = newValue;
getDoctorsList(context);
});
},
),
))
: Container(),
],
),
);
}
bool isDentalSelectedAndSupported() {
return dropdownValue != "" &&
(dropdownValue == "17") &&
isMobileAppDentalAllow;
}
getClinicsList() {
ClinicListService service = new ClinicListService();
service.getClinicsList(context).then((res) {
service
.getClinicsList(context)
.then((res) {
if (res['MessageStatus'] == 1) {
setState(() {
isMobileAppDentalAllow = res['ISMobileAppDentalAllow'];
res['ListClinicCentralized'].forEach((v) {
clinicsList.add(new ListClinicCentralized.fromJson(v));
});
});
} else {}
})
.catchError((err) {
print(err);
})
.showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6))
.then((value) {
getProjectsList();
});
}
getProjectsList() {
ClinicListService service = new ClinicListService();
service.getProjectsList(context).then((res) {
if (res['MessageStatus'] == 1) {
setState(() {
res['ListProject'].forEach((v) {
projectsList.add(new HospitalsModel.fromJson(v));
});
print(projectsList.length);
});
} else {}
}).catchError((err) {
print(err);
}).showProgressBar(
@ -104,15 +176,26 @@ class _SearchByClinicState extends State<SearchByClinic> {
}
getDoctorsList(BuildContext context) {
List<DoctorList> doctorsList = [];
SearchInfo searchInfo = new SearchInfo();
if (dropdownValue == "17") {
searchInfo.ProjectID = int.parse(projectDropdownValue);
searchInfo.ClinicID = int.parse(dropdownValue);
searchInfo.date = DateTime.now();
navigateToDentalComplaints(context, searchInfo);
} else {
List<DoctorList> doctorsList = [];
List<String> arr = [];
List<String> arrDistance = [];
var distinctIds;
List<String> result;
int numAll;
DoctorsListService service = new DoctorsListService();
service.getDoctorsList(int.parse(dropdownValue), 0, context).then((res) {
service
.getDoctorsList(
int.parse(dropdownValue),
projectDropdownValue != "" ? int.parse(projectDropdownValue) : 0,
context)
.then((res) {
if (res['MessageStatus'] == 1) {
setState(() {
if (res['DoctorList'].length != 0) {
@ -142,13 +225,23 @@ class _SearchByClinicState extends State<SearchByClinic> {
}).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
}
}
Future navigateToDentalComplaints(
BuildContext context, SearchInfo searchInfo) async {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DentalComplaints(searchInfo: searchInfo),
),
);
}
Future navigateToSearchResults(
context, docList, result, numAll, resultDistance) async {
Navigator.push(
context,
MaterialPageRoute(
// builder: (context) => SearchResults(doctorsList: docList)
builder: (context) => BranchView(
doctorsList: docList,
result: result,
@ -156,6 +249,5 @@ class _SearchByClinicState extends State<SearchByClinic> {
resultDistance: resultDistance),
),
);
//builder: (context) => SearchResults(doctorsList: docList)));
}
}

@ -1,13 +1,22 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/Request.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:flutter/material.dart';
class ClinicListService extends BaseService {
AppSharedPreferences sharedPref = AppSharedPreferences();
AppGlobal appGlobal = new AppGlobal();
AuthenticatedUser authUser = new AuthenticatedUser();
AuthProvider authProvider = new AuthProvider();
double lat;
double long;
Future<Map> getClinicsList(context) async {
Map<String, dynamic> request;
var languageID = await sharedPref.getString(APP_LANGUAGE);
@ -34,4 +43,82 @@ class ClinicListService extends BaseService {
}, body: request);
return Future.value(localRes);
}
Future<Map> getProjectsList(context) 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
};
dynamic localRes;
await baseAppClient.post(GET_PROJECTS_LIST,
onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future<Map> getChiefComplaintsList(int clinicID, int projectID, BuildContext context,
{doctorId}) async {
//Utils.showProgressDialog(context);
Map<String, dynamic> request;
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
var data = AuthenticatedUser.fromJson(
await this.sharedPref.getObject(USER_PROFILE));
authUser = data;
}
if (await this.sharedPref.getDouble(USER_LAT) != null &&
await this.sharedPref.getDouble(USER_LONG) != null) {
lat = await this.sharedPref.getDouble(USER_LAT);
long = await this.sharedPref.getDouble(USER_LONG);
}
var languageID = await sharedPref.getString(APP_LANGUAGE);
Request req = appGlobal.getPublicRequest();
request = {
"ClinicID": clinicID,
"ProjectID": projectID,
"SelectedDate": "",
"SelectedTime": "",
"License": true,
"VersionID": 5.6,
"Channel": 3,
"LanguageID": languageID == 'ar' ? 1 : 2,
"IPAdress": "10.20.10.20",
"generalid": "Cs2020@2016\$2958",
"PatientOutSA": 0,
"SessionID": null,
"isDentalAllowedBackend": true,
"DeviceTypeID": 1,
"PatientID": 1,
"ContinueDentalPlan": true,
"IsSearchAppointmnetByClinicID": false
};
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