Doctor rating dialog revamped

fix_issues
haroon amjad 4 years ago
parent a03d5c6d57
commit 7edb0c8009

@ -15,6 +15,8 @@ const GET_PROJECT = 'Services/Lists.svc/REST/GetProject';
const GET_MY_DOCTOR =
'Services/Doctors.svc/REST/GetPatientDoctorAppointmentResult';
const GET_DOCTOR_PROFILE = 'Services/Doctors.svc/REST/GetDocProfiles';
const GET_DOCTOR_RATING_NOTES = 'Services/Doctors.svc/REST/dr_GetNotesDoctorRating';
const GET_DOCTOR_RATING_DETAILS = 'Services/Doctors.svc/REST/dr_GetDoctorRatingDetails';
const GET_DOCTOR_RATING = 'Services/Doctors.svc/REST/dr_GetAvgDoctorRating';
///Prescriptions

@ -1043,5 +1043,33 @@ const Map localizedValues = {
"en": "Survey",
"ar": "إستبيان"
},
"labResults": {
"en": "Lab Result",
"ar": "نتيجة المختبر"
},
"doctorRating": {
"en": "Doctor Rating",
"ar": "تقييم الطبيب"
},
"good": {
"en": "Good",
"ar": "جيد"
},
"v-good": {
"en": "Very Good",
"ar": "جيد جدا"
},
"excellent": {
"en": "Excellent",
"ar": "ممتاز"
},
"average": {
"en": "Average",
"ar": "متوسط"
},
"below-average": {
"en": "Below Average",
"ar": "أقل من المتوسط"
},
};

@ -54,9 +54,9 @@ class BaseAppClient {
: languageID == 'ar'
? 1
: 2
: languageID == 'ar'
? 1
: 2;
: languageID == 'en'
? 2
: 1;
body['IPAdress'] = IP_ADDRESS;
body['generalid'] = GENERAL_ID;

@ -0,0 +1,32 @@
class DoctorRateDetails {
dynamic doctorID;
dynamic projectID;
dynamic clinicID;
dynamic rate;
dynamic patientNumber;
DoctorRateDetails(
{this.doctorID,
this.projectID,
this.clinicID,
this.rate,
this.patientNumber});
DoctorRateDetails.fromJson(Map<String, dynamic> json) {
doctorID = json['DoctorID'];
projectID = json['ProjectID'];
clinicID = json['ClinicID'];
rate = json['Rate'];
patientNumber = json['PatientNumber'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['DoctorID'] = this.doctorID;
data['ProjectID'] = this.projectID;
data['ClinicID'] = this.clinicID;
data['Rate'] = this.rate;
data['PatientNumber'] = this.patientNumber;
return data;
}
}

@ -1,11 +1,14 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorRateDetails.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -42,6 +45,8 @@ class _DoctorProfileState extends State<DoctorProfile>
AppSharedPreferences sharedPref = AppSharedPreferences();
List<DoctorRateDetails> doctorDetailsList = List();
@override
void initState() {
_tabController = new TabController(
@ -150,19 +155,26 @@ class _DoctorProfileState extends State<DoctorProfile>
emptyIcon: Icons.star,
),
),
Container(
margin: EdgeInsets.only(top: 5.0),
alignment: Alignment.center,
child: Text(
"(" +
widget.doctor.noOfPatientsRate.toString() +
" " + TranslationBase.of(context).reviews + ")",
style: TextStyle(
fontSize: 14.0,
color: Colors.blue[800],
letterSpacing: 1.0,
decoration: TextDecoration.underline,
)),
InkWell(
onTap: () {
getDoctorRatingsDetails();
},
child: Container(
margin: EdgeInsets.only(top: 5.0),
alignment: Alignment.center,
child: Text(
"(" +
widget.doctor.noOfPatientsRate.toString() +
" " +
TranslationBase.of(context).reviews +
")",
style: TextStyle(
fontSize: 14.0,
color: Colors.blue[800],
letterSpacing: 1.0,
decoration: TextDecoration.underline,
)),
),
),
Container(
margin: EdgeInsets.only(top: 10.0),
@ -213,6 +225,279 @@ class _DoctorProfileState extends State<DoctorProfile>
);
}
getDoctorRatings() {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service.getDoctorsRating(widget.doctor.doctorID, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) {
print(res['NotesDoctorRatingList']);
} else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);
print(err);
});
}
getDoctorRatingsDetails() {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service
.getDoctorsRatingDetails(widget.doctor.doctorID, context)
.then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) {
doctorDetailsList.clear();
res['DoctorRatingDetailsList'].forEach((v) {
doctorDetailsList.add(new DoctorRateDetails.fromJson(v));
});
showRatingDialog(doctorDetailsList);
} else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);
print(err);
});
}
void showRatingDialog(List<DoctorRateDetails> doctorDetailsList) {
showGeneralDialog(
barrierColor: Colors.black.withOpacity(0.5),
transitionBuilder: (context, a1, a2, widget) {
final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0;
return Transform(
transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0),
child: Opacity(
opacity: a1.value,
child: Dialog(
child: Container(
height: 400.0,
width: MediaQuery.of(context).size.width * 0.8,
color: Colors.white,
child: Column(
children: [
Container(
alignment: Alignment.center,
width: MediaQuery.of(context).size.width,
color: Theme.of(context).primaryColor,
margin: EdgeInsets.only(bottom: 5.0),
padding: EdgeInsets.all(10.0),
child: Text(TranslationBase.of(context).doctorRating,
style: TextStyle(
fontSize: 22.0, color: Colors.white))),
Container(
margin: EdgeInsets.only(top: 0.0),
child: Text(
this
.widget
.doctor
.actualDoctorRate
.ceilToDouble()
.toString(),
style: TextStyle(
fontSize: 32.0, color: Colors.black))),
Container(
margin: EdgeInsets.only(top: 5.0),
alignment: Alignment.center,
child: RatingBar.readOnly(
initialRating:
this.widget.doctor.actualDoctorRate.toDouble(),
size: 35.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text(
this.widget.doctor.noOfPatientsRate.toString() +
" " +
TranslationBase.of(context).reviews,
style: TextStyle(
fontSize: 14.0, color: Colors.black))),
Container(
margin: EdgeInsets.only(top: 10.0),
child: Row(
children: [
Container(
width: 100.0,
margin: EdgeInsets.only(
top: 10.0, left: 15.0, right: 15.0),
child: Text(
TranslationBase.of(context).excellent,
style: TextStyle(
fontSize: 13.0, color: Colors.black))),
Container(
margin: EdgeInsets.only(top: 10.0),
child: SizedBox(
width: getRatingWidth(
doctorDetailsList[0].patientNumber),
height: 6.0,
child: Container(
color: Colors.green[700],
),
),
),
],
),
),
Container(
child: Row(
children: [
Container(
width: 100.0,
margin: EdgeInsets.only(
top: 10.0, left: 15.0, right: 15.0),
child: Text(TranslationBase.of(context).v_good,
style: TextStyle(
fontSize: 13.0, color: Colors.black))),
Container(
margin: EdgeInsets.only(top: 10.0),
child: SizedBox(
width: getRatingWidth(
doctorDetailsList[1].patientNumber),
height: 6.0,
child: Container(
color: Color(0xffB7B723),
),
),
),
],
),
),
Container(
child: Row(
children: [
Container(
width: 100.0,
margin: EdgeInsets.only(
top: 10.0, left: 15.0, right: 15.0),
child: Text(TranslationBase.of(context).good,
style: TextStyle(
fontSize: 13.0, color: Colors.black))),
Container(
margin: EdgeInsets.only(top: 10.0),
child: SizedBox(
width: getRatingWidth(
doctorDetailsList[2].patientNumber),
height: 6.0,
child: Container(
color: Color(0xffEBA727),
),
),
),
],
),
),
Container(
child: Row(
children: [
Container(
width: 100.0,
margin: EdgeInsets.only(
top: 10.0, left: 15.0, right: 15.0),
child: Text(TranslationBase.of(context).average,
style: TextStyle(
fontSize: 13.0, color: Colors.black))),
Container(
margin: EdgeInsets.only(top: 10.0),
child: SizedBox(
width: getRatingWidth(
doctorDetailsList[3].patientNumber),
height: 6.0,
child: Container(
color: Color(0xffEB7227),
),
),
),
],
),
),
Container(
child: Row(
children: [
Container(
width: 100.0,
margin: EdgeInsets.only(
top: 10.0, left: 15.0, right: 15.0),
child: Text(
TranslationBase.of(context).below_average,
style: TextStyle(
fontSize: 13.0, color: Colors.black))),
Container(
margin: EdgeInsets.only(top: 10.0),
child: SizedBox(
width: getRatingWidth(
doctorDetailsList[4].patientNumber),
height: 6.0,
child: Container(
color: Color(0xffE20C0C),
),
),
),
],
),
),
Container(
margin: EdgeInsets.only(top: 40.0), child: Divider()),
Container(
margin: EdgeInsets.only(top: 0.0),
child: Align(
alignment: FractionalOffset.bottomCenter,
child: ButtonTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
minWidth: MediaQuery.of(context).size.width,
height: 40.0,
child: RaisedButton(
elevation: 0.0,
color: Colors.white,
textColor: Colors.red,
hoverColor: Colors.transparent,
focusColor: Colors.transparent,
highlightColor: Colors.transparent,
disabledColor: new Color(0xFFbcc2c4),
onPressed: () {
Navigator.of(context).pop();
},
child: Text(TranslationBase.of(context).cancel,
style: TextStyle(fontSize: 18.0)),
),
),
),
),
],
),
),
),
),
);
},
transitionDuration: Duration(milliseconds: 500),
barrierDismissible: true,
barrierLabel: '',
context: context,
pageBuilder: (context, animation1, animation2) {});
}
double getRatingWidth(int patientNumber) {
print(patientNumber);
print(this.widget.doctor.noOfPatientsRate);
var width = (patientNumber / this.widget.doctor.noOfPatientsRate) * 100;
print(width);
return width;
}
getPatientData() async {
if (await sharedPref.getObject(USER_PROFILE) != null) {
var data =

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/laboratory_result_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
@ -21,7 +22,7 @@ class LaboratoryResultPage extends StatelessWidget {
orderNo: patientLabOrders.orderNo),
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,
appBarTitle: 'Laboratory result',
appBarTitle: TranslationBase.of(context).labResults,
baseViewModel: model,
body: Scaffold(
body: ListView.builder(

@ -177,6 +177,72 @@ class DoctorsListService extends BaseService {
return Future.value(localRes);
}
Future<Map> getDoctorsRating(
int docID, context) async {
Map<String, dynamic> request;
var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
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": authUser.outSA,
"TokenID": "",
"DeviceTypeID": req.DeviceTypeID,
"SessionID": null,
"doctorID": docID,
"PatientID": 0,
"License": true,
"IsRegistered": true,
"isDentalAllowedBackend": false
};
dynamic localRes;
await baseAppClient.post(GET_DOCTOR_RATING_NOTES,
onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future<Map> getDoctorsRatingDetails(
int docID, context) async {
Map<String, dynamic> request;
var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
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": authUser.outSA,
"TokenID": "",
"DeviceTypeID": req.DeviceTypeID,
"SessionID": null,
"DoctorID": docID,
"PatientID": 0,
"License": true,
"IsRegistered": true,
"isDentalAllowedBackend": false
};
dynamic localRes;
await baseAppClient.post(GET_DOCTOR_RATING_DETAILS,
onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future<Map> getDoctorFreeSlots(
int docID, int clinicID, int projectID, BuildContext context) async {
Map<String, dynamic> request;

@ -867,8 +867,12 @@ String get fileno => localizedValues['fileno'][locale.languageCode];
String get openRad => localizedValues['open-rad'][locale.languageCode];
String get sendCopyRad => localizedValues['send-copy'][locale.languageCode];
String get appoSurvey => localizedValues['appoSurvey'][locale.languageCode];
String get labResults => localizedValues['labResults'][locale.languageCode];
String get doctorRating => localizedValues['doctorRating'][locale.languageCode];
String get good => localizedValues['good'][locale.languageCode];
String get v_good => localizedValues['v-good'][locale.languageCode];
String get excellent => localizedValues['excellent'][locale.languageCode];
String get below_average => localizedValues['below-average'][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save