From 7bc8f69dfbbe467b70b5be30c428d4eb88f79c60 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 9 Dec 2021 16:10:09 +0300 Subject: [PATCH 1/2] JIRA bug fixes --- lib/models/Appointments/DoctorListResponse.dart | 3 +++ .../BookAppointment/widgets/DoctorView.dart | 17 +++++++++++++---- lib/pages/medical/doctor/doctor_home_page.dart | 1 + 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index 0da1a273..d43dceb3 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -9,6 +9,7 @@ class DoctorList { int actualDoctorRate; int clinicRoomNo; dynamic date; + dynamic appointmentDate; dynamic dayName; int doctorID; String doctorImageURL; @@ -53,6 +54,7 @@ class DoctorList { this.actualDoctorRate, this.clinicRoomNo, this.date, + this.appointmentDate, this.dayName, this.doctorID, this.doctorImageURL, @@ -97,6 +99,7 @@ class DoctorList { actualDoctorRate = json['ActualDoctorRate']; clinicRoomNo = json['ClinicRoomNo']; date = json['Date']; + appointmentDate = json['AppointmentDate']; dayName = json['DayName']; doctorID = json['DoctorID']; doctorImageURL = json['DoctorImageURL']; diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 1e2e48df..7ebc26ca 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -7,7 +7,6 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -54,9 +53,19 @@ class DoctorView extends StatelessWidget { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - doctor.name, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + Row( + children: [ + Expanded( + child: Text( + doctor.name, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ), + Text( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(doctor.date)), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), + ), + ], ), if (doctor.doctorTitle != null) SizedBox(height: 6), Row( diff --git a/lib/pages/medical/doctor/doctor_home_page.dart b/lib/pages/medical/doctor/doctor_home_page.dart index 28e1c1a9..ebf32924 100644 --- a/lib/pages/medical/doctor/doctor_home_page.dart +++ b/lib/pages/medical/doctor/doctor_home_page.dart @@ -72,6 +72,7 @@ class DoctorHomePage extends StatelessWidget { clinicName: _doctorList.clinicName, actualDoctorRate: _doctorList.actualDoctorRate, doctorID: _doctorList.doctorID, + date: _doctorList.appointmentDate, doctorRate: _doctorList.doctorRate, gender: _doctorList.gender, doctorTitle: _doctorList.doctorTitle, From 4c2410cfd590d320eb15d7b7eafb6f57b8c3cd7d Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 13 Dec 2021 11:11:22 +0300 Subject: [PATCH 2/2] Health plugin updated --- lib/config/config.dart | 6 +- .../parmacyModule/order-preview-service.dart | 2 +- .../components/LiveCareBookAppointment.dart | 2 + .../syncHealthData.dart | 168 ++++-------------- lib/widgets/in_app_browser/InAppBrowser.dart | 8 +- pubspec.yaml | 2 +- 6 files changed, 42 insertions(+), 146 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index f68ce30e..3ed8d764 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -15,8 +15,8 @@ const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; const PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; + const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs // const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; @@ -257,7 +257,7 @@ const GET_PATIENT_SHARE = //URL to get patient appointment history const GET_PATIENT_APPOINTMENT_HISTORY = - "Services/Doctors.svc/REST/PateintHasAppoimentHistory"; + "Services/Doctors.svc/REST/PateintHasAppoimentHistory_Async"; const DOCTOR_SCHEDULE_URL = 'Services/Doctors.svc/REST/GetDoctorWorkingHoursTable'; diff --git a/lib/core/service/parmacyModule/order-preview-service.dart b/lib/core/service/parmacyModule/order-preview-service.dart index 52892641..b9368180 100644 --- a/lib/core/service/parmacyModule/order-preview-service.dart +++ b/lib/core/service/parmacyModule/order-preview-service.dart @@ -201,7 +201,7 @@ class OrderPreviewService extends BaseService { orderBody['custom_values_xml'] = "PaymentOption:${getPaymentOptionName(paymentCheckoutData.paymentOption)}"; orderBody['shippingOption'] = paymentCheckoutData.shippingOption; orderBody['shipping_address'] = paymentCheckoutData.address; - orderBody['lakum_amount'] = paymentCheckoutData.usedLakumPoints; + // orderBody['lakum_amount'] = paymentCheckoutData.usedLakumPoints; List> itemsList = List(); shoppingCarts.forEach((item) { diff --git a/lib/pages/BookAppointment/components/LiveCareBookAppointment.dart b/lib/pages/BookAppointment/components/LiveCareBookAppointment.dart index ee3e7b4a..7901d7b6 100644 --- a/lib/pages/BookAppointment/components/LiveCareBookAppointment.dart +++ b/lib/pages/BookAppointment/components/LiveCareBookAppointment.dart @@ -24,6 +24,8 @@ class _LiveCareBookAppointmentState extends State { @override Widget build(BuildContext context) { return AppScaffold( + showNewAppBarTitle: true, + showNewAppBar: true, appBarTitle: TranslationBase.of(context).bookAppo, isShowAppBar: true, isShowDecPage: false, diff --git a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart index 5a0b95b5..a81dce6a 100644 --- a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart +++ b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart @@ -8,10 +8,8 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:fit_kit/fit_kit.dart'; import 'package:flutter/material.dart'; import 'package:health/health.dart'; -import 'package:intl/intl.dart'; class syncHealthDataButton extends StatefulWidget { double marginTop; @@ -27,8 +25,6 @@ class syncHealthDataButton extends StatefulWidget { } class _syncHealthDataButtonState extends State { - List dataTypes = List(); - List _healthDataList = []; List Med_InsertTransactionsInputsList = new List(); @@ -44,12 +40,6 @@ class _syncHealthDataButtonState extends State { @override void initState() { - dataTypes.add(DataType.DISTANCE); - dataTypes.add(DataType.STEP_COUNT); - dataTypes.add(DataType.HEART_RATE); - // dataTypes.add(DataType.SLEEP); - // dataTypes.add(DataType.ENERGY); - super.initState(); } @@ -61,53 +51,13 @@ class _syncHealthDataButtonState extends State { padding: const EdgeInsets.all(20.0), child: DefaultButton(TranslationBase.of(context).syncHealthData, () { print("ReadAll"); - fetchData(); - // readAll(); + // fetchData(); + readAll(); }), ), ); } - Future fetchData() async { - // get everything from midnight until now - DateTime startDate = DateTime(2021, 11, 01, 0, 0, 0); - DateTime endDate = DateTime(2021, 12, 06, 23, 59, 59); - - HealthFactory health = HealthFactory(); - - // define the types to get - List types = [ - HealthDataType.STEPS, - HealthDataType.HEART_RATE, - Platform.isAndroid ? HealthDataType.DISTANCE_DELTA : HealthDataType.DISTANCE_WALKING_RUNNING - ]; - - // you MUST request access to the data types before reading them - // bool accessWasGranted = await health.requestAuthorization(types); - await health.requestAuthorization(types); - - int steps = 0; - try { - List healthData = await health.getHealthDataFromTypes(startDate, endDate, types); - _healthDataList.addAll(healthData); - } catch (e) { - print("Caught exception in getHealthDataFromTypes: $e"); - } - - // filter out duplicates - _healthDataList = HealthFactory.removeDuplicates(_healthDataList); - - // print the results - _healthDataList.forEach((x) { - if(x.type == HealthDataType.STEPS) { - print("Data point: $x"); - steps += x.value.round(); - } - }); - - print("Steps: $steps"); - } - void readAll() async { TransactionsListID = 1; var MedSubCategoryID = 0; @@ -115,91 +65,37 @@ class _syncHealthDataButtonState extends State { GifLoaderDialogUtils.showMyDialog(context); Med_InsertTransactionsInputsList.clear(); - var date; - var differenceInHours; - String strDifferenceInHours; - var differenceInMinutes; - String strDifferenceInMinutes; - var today = DateTime.now(); - var yearNum = DateFormat('y').format(today).toString(); - - var firstDayOfTheYear = DateTime.parse(yearNum + "-" + "01" + "-" + "01"); - - if (await FitKit.requestPermissions(dataTypes)) { - for (DataType type in dataTypes) { - final results = await FitKit.read( - type, - dateFrom: firstDayOfTheYear, - dateTo: DateTime.now(), - limit: 1000, - ); - - if (type == DataType.DISTANCE) { - MedCategoryID = 7; - } else if (type == DataType.STEP_COUNT) { - MedCategoryID = 6; - } else if (type == DataType.HEART_RATE) { - MedCategoryID = 3; - } + DateTime startDate = DateTime.now().subtract(new Duration(days: 30)); - results.forEach((result) { - // print("in forEach"); - date = result.dateTo; - if (result.value.runtimeType.toString() == "int") { - value = double.parse(result.value.toString()); - } else { - value = result.value; - } - - MedSubCategoryID = 0; - - if (MedCategoryID == 4) { - differenceInHours = null; - var sleepDate = result.dateFrom.toString().substring(0, 10); - - DateTime dateFrom = result.dateFrom; - DateTime dateTo = result.dateTo; - - differenceInMinutes = dateTo.difference(dateFrom).inMinutes; - differenceInMinutes > 59 ? differenceInHours = differenceInMinutes / 60 : differenceInMinutes = differenceInMinutes; - - if (differenceInHours != null && differenceInHours != 0) { - differenceInHours = differenceInHours.toInt(); - differenceInMinutes = differenceInMinutes % 60; - - differenceInHours < 10 ? strDifferenceInHours = "0" + differenceInHours.toString() : strDifferenceInHours = differenceInHours.toString(); - } else { - strDifferenceInHours = "00"; - differenceInHours = 00; - } - differenceInMinutes < 10 ? strDifferenceInMinutes = "0" + differenceInMinutes.toString() : strDifferenceInMinutes = differenceInMinutes.toString(); - - sleepDate = DateTime.parse(sleepDate + " " + strDifferenceInHours + ":" + strDifferenceInMinutes + ":" + "00.00").toString(); - String hours = sleepDate.substring(11, sleepDate.indexOf(":")); - print(hours); - - String minutes = sleepDate.substring(sleepDate.indexOf(":") + 1, sleepDate.indexOf(":") + 3); - print(minutes); - - if (value == 0 || value == 109) { - print("in Bed"); - MedSubCategoryID = 1; - value = double.parse(hours + "." + minutes); - print("value"); - print(value); - } else if (value == 1 || value == 110) { - print("Sleep"); - MedSubCategoryID = 2; - value = double.parse(hours + "." + minutes); - print("value"); - print(value); - } - } - date = DateUtil.convertDateToString(date); - Med_InsertTransactionsInputsList.add(healthData(MedCategoryID: MedCategoryID, MedSubCategoryID: MedSubCategoryID, MachineDate: date, Value: value, TransactionsListID: TransactionsListID++)); - }); - } + HealthFactory health = HealthFactory(); + List types = [HealthDataType.STEPS, HealthDataType.HEART_RATE, Platform.isAndroid ? HealthDataType.DISTANCE_DELTA : HealthDataType.DISTANCE_WALKING_RUNNING]; + + await health.requestAuthorization(types); + + try { + List healthData = await health.getHealthDataFromTypes(startDate, DateTime.now(), types); + _healthDataList.addAll(healthData); + } catch (e) { + print("Caught exception in getHealthDataFromTypes: $e"); } + + _healthDataList = HealthFactory.removeDuplicates(_healthDataList); + + _healthDataList.forEach((x) { + if (x.type == HealthDataType.STEPS) { + Med_InsertTransactionsInputsList.add( + healthData(MedCategoryID: 6, MedSubCategoryID: MedSubCategoryID, MachineDate: DateUtil.convertDateToString(x.dateFrom), Value: x.value, TransactionsListID: TransactionsListID++)); + } + if (x.type == HealthDataType.HEART_RATE) { + Med_InsertTransactionsInputsList.add( + healthData(MedCategoryID: 3, MedSubCategoryID: MedSubCategoryID, MachineDate: DateUtil.convertDateToString(x.dateFrom), Value: x.value, TransactionsListID: TransactionsListID++)); + } + if (x.type == HealthDataType.DISTANCE_DELTA || x.type == HealthDataType.DISTANCE_WALKING_RUNNING) { + Med_InsertTransactionsInputsList.add( + healthData(MedCategoryID: 7, MedSubCategoryID: MedSubCategoryID, MachineDate: DateUtil.convertDateToString(x.dateFrom), Value: x.value, TransactionsListID: TransactionsListID++)); + } + }); + getAllHealthDataLists(); } @@ -238,10 +134,8 @@ class _syncHealthDataButtonState extends State { totalSteps += element['Value']; } else if (element['MedCategoryID'] == 7) { MedCategoryID = 7; - // to convert from meter to km totalDistance += (element['Value'] * 0.001); } else if (element['MedCategoryID'] == 3) { - // print("HeartRate"); MedCategoryID = 3; counter++; totalHeartRate += element['Value']; diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 49e23271..6e0e6c51 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -28,13 +28,13 @@ var _InAppBrowserOptions = InAppBrowserClassOptions( class MyInAppBrowser extends InAppBrowser { _PAYMENT_TYPE paymentType; - static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE - static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT + // static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT - // static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store + static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store // static String PRESCRIPTION_PAYMENT_WITH_ORDERID = // 'https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID='; diff --git a/pubspec.yaml b/pubspec.yaml index 5b1b0a1f..8dd0f73f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -30,7 +30,7 @@ dependencies: get_it: ^4.0.2 #Google Fit & Apple HealthKit - fit_kit: ^1.1.2 + health: ^3.0.3 #chart fl_chart: ^0.12.3