Dental appointment flow implemented

merge-update-with-lab-changes
haroon amjad 5 years ago
parent 779b08e34e
commit 51078227ab

@ -75,6 +75,9 @@ const GET_PROJECTS_LIST = 'Services/Lists.svc/REST/GetProject';
//URL to get doctors list
const GET_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/SearchDoctorsByTime";
//URL to dental doctors list
const GET_DENTAL_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/Dental_DoctorChiefComplaintMapping";
//URL to get doctor free slots
const GET_DOCTOR_FREE_SLOTS = "Services/Doctors.svc/REST/GetDoctorFreeSlots";

@ -374,5 +374,6 @@ const Map<String, Map<String, String>> localizedValues = {
"gate":{"en":"Gate:","ar":"بوابة"},
"building":{"en":"Building:","ar":"المبنى"},
"branch":{"en":"Branch:","ar":"الفرع"},
"emergencyServices":{"en":"Emergency Services:","ar":"خدمات الطوارئ"}
"emergencyServices":{"en":"Emergency Services:","ar":"خدمات الطوارئ"},
"km":{"en":"KMs:","ar":"كم"},
};

@ -2,14 +2,11 @@ import 'dart:convert';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/pages/login/login-type.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:http/http.dart' as http;
import '../../../locator.dart';
import '../../../routes.dart';
AppSharedPreferences sharedPref = new AppSharedPreferences();
@ -33,9 +30,11 @@ class BaseAppClient {
var languageID =
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'en');
var user = await sharedPref.getObject(USER_PROFILE);
body['SetupID'] = body.containsKey('SetupID')
? body['SetupID'] != null ? body['SetupID'] : SETUP_ID
: SETUP_ID;
if (body.containsKey('SetupID')) {
body['SetupID'] = body.containsKey('SetupID')
? body['SetupID'] != null ? body['SetupID'] : SETUP_ID
: SETUP_ID;
}
body['VersionID'] = body.containsKey('VersionID')
? body['VersionID'] != null ? body['VersionID'] : VERSION_ID
: VERSION_ID;
@ -46,16 +45,29 @@ class BaseAppClient {
body['PatientOutSA'] = body.containsKey('PatientOutSA')
? body['PatientOutSA'] != null ? body['PatientOutSA'] : PATIENT_OUT_SA
: PATIENT_OUT_SA;
body['isDentalAllowedBackend'] = IS_DENTAL_ALLOWED_BACKEND;
if (body.containsKey('isDentalAllowedBackend')) {
body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend')
? body['isDentalAllowedBackend'] != null ? body['isDentalAllowedBackend'] : IS_DENTAL_ALLOWED_BACKEND
: IS_DENTAL_ALLOWED_BACKEND;
}
body['DeviceTypeID'] = DeviceTypeID;
body['PatientType'] = body.containsKey('PatientType')
? body['PatientType'] != null ? body['PatientType'] : PATIENT_TYPE
: PATIENT_TYPE;
body['PatientTypeID'] = body.containsKey('PatientTypeID')
? body['PatientTypeID'] != null
? body['PatientTypeID']
: PATIENT_TYPE_ID
: PATIENT_TYPE_ID;
if (body.containsKey('PatientType')) {
body['PatientType'] = body.containsKey('PatientType')
? body['PatientType'] != null ? body['PatientType'] : PATIENT_TYPE
: PATIENT_TYPE;
}
if (body.containsKey('PatientTypeID')) {
body['PatientTypeID'] = body.containsKey('PatientTypeID')
? body['PatientTypeID'] != null
? body['PatientTypeID']
: PATIENT_TYPE_ID
: PATIENT_TYPE_ID;
}
if (user != null) {
body['TokenID'] = token;
body['PatientID'] =

@ -0,0 +1,48 @@
class DentalChiefComplaintsModel {
List<ListDentalChiefComplain> listDentalChiefComplain;
DentalChiefComplaintsModel({this.listDentalChiefComplain});
DentalChiefComplaintsModel.fromJson(Map<String, dynamic> json) {
if (json['List_DentalChiefComplain'] != null) {
listDentalChiefComplain = new List<ListDentalChiefComplain>();
json['List_DentalChiefComplain'].forEach((v) {
listDentalChiefComplain.add(new ListDentalChiefComplain.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.listDentalChiefComplain != null) {
data['List_DentalChiefComplain'] =
this.listDentalChiefComplain.map((v) => v.toJson()).toList();
}
return data;
}
}
class ListDentalChiefComplain {
int projectID;
int iD;
String name;
String nameN;
ListDentalChiefComplain({this.projectID, this.iD, this.name, this.nameN});
ListDentalChiefComplain.fromJson(Map<String, dynamic> json) {
projectID = json['ProjectID'];
iD = json['ID'];
name = json['Name'];
nameN = json['NameN'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ProjectID'] = this.projectID;
data['ID'] = this.iD;
data['Name'] = this.name;
data['NameN'] = this.nameN;
return data;
}
}

@ -1,5 +1,10 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/models/Appointments/DentalChiefComplaintsModel.dart';
import 'package:diplomaticquarterapp/models/Appointments/SearchInfoModel.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DentalComplaintCard.dart';
import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_card.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:smart_progress_bar/smart_progress_bar.dart';
@ -14,6 +19,11 @@ class DentalComplaints extends StatefulWidget {
}
class _DentalComplaintsState extends State<DentalComplaints> {
List<ListDentalChiefComplain> complaintsList = [];
AppSharedPreferences sharedPref = AppSharedPreferences();
bool isDataLoaded = false;
var languageID;
@override
void initState() {
WidgetsBinding.instance
@ -26,20 +36,43 @@ class _DentalComplaintsState extends State<DentalComplaints> {
return AppScaffold(
isShowAppBar: true,
appBarTitle: "Symptoms",
body: Container(),
body: Container(
margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0),
child: ListView.builder(
itemCount: complaintsList.length,
itemBuilder: (BuildContext context, int index) {
return Container(
margin: EdgeInsets.only(bottom: 10.0),
child: DentalComplaintCard(
listDentalChiefComplain: complaintsList[index],
languageID: languageID,
),
);
},
),
),
);
}
getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE);
}
getChiefComplaintsList() {
getLanguageID();
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) {});
// });
print(res['List_DentalChiefComplain']);
setState(() {
res['List_DentalChiefComplain'].forEach((v) {
complaintsList.add(new ListDentalChiefComplain.fromJson(v));
});
print(complaintsList.length);
});
} else {}
}).catchError((err) {
print(err);

@ -43,7 +43,7 @@ class _SearchResultsState extends State<SearchResults> {
(index) => AppExpandableNotifier(
title: widget
.patientDoctorAppointmentListHospital[index].filterName + " - " +widget
.patientDoctorAppointmentListHospital[index].distanceInKMs + " KMs" ,
.patientDoctorAppointmentListHospital[index].distanceInKMs + " " + TranslationBase.of(context).km,
bodyWidget: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,

@ -145,7 +145,7 @@ class _ExpandableListViewState extends State<ExpandableListView> {
String getProjectDistance(String distance) {
if (distance != "0")
return " - " + distance + " KMs";
return " - " + distance + " " + TranslationBase.of(context).km;
else {
return "";
}

@ -0,0 +1,135 @@
import 'package:diplomaticquarterapp/models/Appointments/DentalChiefComplaintsModel.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:flutter/material.dart';
import 'package:smart_progress_bar/smart_progress_bar.dart';
// ignore: must_be_immutable
class DentalComplaintCard extends StatefulWidget {
final ListDentalChiefComplain listDentalChiefComplain;
var languageID;
DentalComplaintCard(
{@required this.listDentalChiefComplain, this.languageID});
@override
_DentalComplaintCardState createState() => _DentalComplaintCardState();
}
class _DentalComplaintCardState extends State<DentalComplaintCard> {
@override
Widget build(BuildContext context) {
return Container(
child: InkWell(
onTap: () {
getChiefComplaintsList();
},
child: Card(
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child: Row(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width * 0.85,
padding: EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Container(
child: Text(widget.listDentalChiefComplain.name,
style:
TextStyle(fontSize: 16.0, color: Colors.black)),
),
],
),
),
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Icon(Icons.arrow_forward_ios,
size: 20.0, color: Colors.black54),
],
),
),
],
),
),
),
);
}
getChiefComplaintsList() {
List<DoctorList> doctorsList = [];
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital =
List();
ClinicListService service = new ClinicListService();
service
.getChiefComplaintDoctorList(widget.listDentalChiefComplain.iD,
widget.listDentalChiefComplain.projectID, context)
.then((res) {
if (res['MessageStatus'] == 1) {
print(res['List_DentalDoctorChiefComplaintMapping']);
setState(() {
doctorsList.clear();
res['List_DentalDoctorChiefComplaintMapping'].forEach((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,
distanceInKMs:
element.projectDistanceInKiloMeters.toString(),
patientDoctorAppointment: element));
}
});
navigateToSearchResults(
context, doctorsList, _patientDoctorAppointmentListHospital);
});
} else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
}
}).catchError((err) {
print(err);
}).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
}
Future navigateToSearchResults(
context,
List<DoctorList> docList,
List<PatientDoctorAppointmentList>
patientDoctorAppointmentListHospital) async {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SearchResults(
doctorsList: docList,
patientDoctorAppointmentListHospital:
patientDoctorAppointmentListHospital)));
}
}

@ -37,10 +37,10 @@ class ClinicListService extends BaseService {
await baseAppClient.post(GET_CLINICS_LIST_URL,
onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
@ -64,14 +64,15 @@ class ClinicListService extends BaseService {
await baseAppClient.post(GET_PROJECTS_LIST,
onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future<Map> getChiefComplaintsList(int clinicID, int projectID, BuildContext context,
Future<Map> getChiefComplaintsList(
int clinicID, int projectID, BuildContext context,
{doctorId}) async {
//Utils.showProgressDialog(context);
Map<String, dynamic> request;
@ -82,12 +83,6 @@ class ClinicListService extends BaseService {
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 = {
@ -114,11 +109,56 @@ class ClinicListService extends BaseService {
await baseAppClient.post(GET_DOCTORS_LIST_URL,
onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future<Map> getChiefComplaintDoctorList(
int chiefComplaintID, int projectID, BuildContext context,
{doctorId}) async {
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 = {
"ChiefComplaintID": chiefComplaintID,
"ProjectID": projectID,
"VersionID": 5.6,
"Channel": 3,
"LanguageID": languageID == 'ar' ? 1 : 2,
"IPAdress": req.IPAdress,
"generalid": req.generalid,
"PatientOutSA": 0,
"SessionID": null,
"isDentalAllowedBackend": true,
"Latitude": lat.toString(),
"Longitude": long.toString(),
"DeviceTypeID": 1
};
dynamic localRes;
await baseAppClient.post(GET_DENTAL_DOCTORS_LIST_URL,
onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
}

@ -452,6 +452,8 @@ class TranslationBase {
localizedValues['textToSpeech'][locale.languageCode];
String get locationDialogMessage =>
localizedValues['locationDialogMessage'][locale.languageCode];
String get km =>
localizedValues['km'][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save