diff --git a/assets/images/new/body/abdomin.svg b/assets/images/new/body/abdomin.svg
new file mode 100644
index 00000000..c28cd70b
--- /dev/null
+++ b/assets/images/new/body/abdomin.svg
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/chest.svg b/assets/images/new/body/chest.svg
new file mode 100644
index 00000000..77f603cb
--- /dev/null
+++ b/assets/images/new/body/chest.svg
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/head.svg b/assets/images/new/body/head.svg
new file mode 100644
index 00000000..5ec9c3f3
--- /dev/null
+++ b/assets/images/new/body/head.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/left_ankle.svg b/assets/images/new/body/left_ankle.svg
new file mode 100644
index 00000000..e7bf8080
--- /dev/null
+++ b/assets/images/new/body/left_ankle.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/left_arm.svg b/assets/images/new/body/left_arm.svg
new file mode 100644
index 00000000..6445b6be
--- /dev/null
+++ b/assets/images/new/body/left_arm.svg
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/left_ear.svg b/assets/images/new/body/left_ear.svg
new file mode 100644
index 00000000..402f5f20
--- /dev/null
+++ b/assets/images/new/body/left_ear.svg
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/left_elbow.svg b/assets/images/new/body/left_elbow.svg
new file mode 100644
index 00000000..9e741679
--- /dev/null
+++ b/assets/images/new/body/left_elbow.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/left_eye.svg b/assets/images/new/body/left_eye.svg
new file mode 100644
index 00000000..add3c780
--- /dev/null
+++ b/assets/images/new/body/left_eye.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/left_foot.svg b/assets/images/new/body/left_foot.svg
new file mode 100644
index 00000000..c3f8de42
--- /dev/null
+++ b/assets/images/new/body/left_foot.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/left_forearm.svg b/assets/images/new/body/left_forearm.svg
new file mode 100644
index 00000000..7a8224b6
--- /dev/null
+++ b/assets/images/new/body/left_forearm.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/left_hand.svg b/assets/images/new/body/left_hand.svg
new file mode 100644
index 00000000..168d05c4
--- /dev/null
+++ b/assets/images/new/body/left_hand.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/left_knee.svg b/assets/images/new/body/left_knee.svg
new file mode 100644
index 00000000..5ff004f6
--- /dev/null
+++ b/assets/images/new/body/left_knee.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/left_leg.svg b/assets/images/new/body/left_leg.svg
new file mode 100644
index 00000000..352cf2b9
--- /dev/null
+++ b/assets/images/new/body/left_leg.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/left_soulder.svg b/assets/images/new/body/left_soulder.svg
new file mode 100644
index 00000000..8bd69c8c
--- /dev/null
+++ b/assets/images/new/body/left_soulder.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/left_thigh.svg b/assets/images/new/body/left_thigh.svg
new file mode 100644
index 00000000..880e1da2
--- /dev/null
+++ b/assets/images/new/body/left_thigh.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/left_wrist.svg b/assets/images/new/body/left_wrist.svg
new file mode 100644
index 00000000..b99c3f1c
--- /dev/null
+++ b/assets/images/new/body/left_wrist.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/mouth.svg b/assets/images/new/body/mouth.svg
new file mode 100644
index 00000000..1dd7ca76
--- /dev/null
+++ b/assets/images/new/body/mouth.svg
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/neck.svg b/assets/images/new/body/neck.svg
new file mode 100644
index 00000000..e3c0d951
--- /dev/null
+++ b/assets/images/new/body/neck.svg
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/nose.svg b/assets/images/new/body/nose.svg
new file mode 100644
index 00000000..1e08b591
--- /dev/null
+++ b/assets/images/new/body/nose.svg
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/pelvis.svg b/assets/images/new/body/pelvis.svg
new file mode 100644
index 00000000..77d32820
--- /dev/null
+++ b/assets/images/new/body/pelvis.svg
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/publs.svg b/assets/images/new/body/publs.svg
new file mode 100644
index 00000000..40909b35
--- /dev/null
+++ b/assets/images/new/body/publs.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/right_ankle.svg b/assets/images/new/body/right_ankle.svg
new file mode 100644
index 00000000..2eec1180
--- /dev/null
+++ b/assets/images/new/body/right_ankle.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/right_arm.svg b/assets/images/new/body/right_arm.svg
new file mode 100644
index 00000000..60a03321
--- /dev/null
+++ b/assets/images/new/body/right_arm.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/right_ear.svg b/assets/images/new/body/right_ear.svg
new file mode 100644
index 00000000..65de3b24
--- /dev/null
+++ b/assets/images/new/body/right_ear.svg
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/right_elbow.svg b/assets/images/new/body/right_elbow.svg
new file mode 100644
index 00000000..0a58f385
--- /dev/null
+++ b/assets/images/new/body/right_elbow.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/right_eye.svg b/assets/images/new/body/right_eye.svg
new file mode 100644
index 00000000..4642c353
--- /dev/null
+++ b/assets/images/new/body/right_eye.svg
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/right_foot.svg b/assets/images/new/body/right_foot.svg
new file mode 100644
index 00000000..5faa7b58
--- /dev/null
+++ b/assets/images/new/body/right_foot.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/right_forearm.svg b/assets/images/new/body/right_forearm.svg
new file mode 100644
index 00000000..fea91ddf
--- /dev/null
+++ b/assets/images/new/body/right_forearm.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/right_hand.svg b/assets/images/new/body/right_hand.svg
new file mode 100644
index 00000000..b36dd80c
--- /dev/null
+++ b/assets/images/new/body/right_hand.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/right_knee.svg b/assets/images/new/body/right_knee.svg
new file mode 100644
index 00000000..16a174cf
--- /dev/null
+++ b/assets/images/new/body/right_knee.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/right_leg.svg b/assets/images/new/body/right_leg.svg
new file mode 100644
index 00000000..2cd6a760
--- /dev/null
+++ b/assets/images/new/body/right_leg.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/right_soulder.svg b/assets/images/new/body/right_soulder.svg
new file mode 100644
index 00000000..cb29dc98
--- /dev/null
+++ b/assets/images/new/body/right_soulder.svg
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/right_thigh.svg b/assets/images/new/body/right_thigh.svg
new file mode 100644
index 00000000..8d9ef522
--- /dev/null
+++ b/assets/images/new/body/right_thigh.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/assets/images/new/body/right_wrist.svg b/assets/images/new/body/right_wrist.svg
new file mode 100644
index 00000000..d54c14c8
--- /dev/null
+++ b/assets/images/new/body/right_wrist.svg
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/lib/config/config.dart b/lib/config/config.dart
index 1b09e86f..4cbd2646 100644
--- a/lib/config/config.dart
+++ b/lib/config/config.dart
@@ -327,6 +327,7 @@ const GET_COVID_DRIVETHRU_PROCEDURES_LIST = 'Services/Doctors.svc/REST/COVID19_G
///Smartwatch Integration Services
const GET_PATIENT_LAST_RECORD = 'Services/Patients.svc/REST/Med_GetPatientLastRecord';
+const INSERT_PATIENT_HEALTH_DATA = 'Services/Patients.svc/REST/Med_InsertTransactions';
///My Trackers
const GET_DIABETIC_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetDiabeticResultAverage';
diff --git a/lib/core/service/PrescriptionDeliveryService.dart b/lib/core/service/PrescriptionDeliveryService.dart
index 104b390d..1d849755 100644
--- a/lib/core/service/PrescriptionDeliveryService.dart
+++ b/lib/core/service/PrescriptionDeliveryService.dart
@@ -25,9 +25,9 @@ class PrescriptionDeliveryService extends BaseService {
Map body = Map();
body['latitude'] = latitude;
body['longitude'] = longitude;
- body['AppointmentNo'] = appointmentNo;
- body['CreatedBy'] = createdBy;
- body['DischargeID'] = dischargeID;
+ body['AppointmentNo'] = appointmentNo.toString();
+ // body['CreatedBy'] = createdBy;
+ body['DischargeID'] = dischargeID.toString();
await baseAppClient.post(ADD_PRESCRIPTION_ORDER_RC, onSuccess: (dynamic response, int statusCode) {
var asd = "";
}, onFailure: (String error, int statusCode) {
diff --git a/lib/core/service/medical/prescriptions_service.dart b/lib/core/service/medical/prescriptions_service.dart
index fa2a24c6..48c4f1bf 100644
--- a/lib/core/service/medical/prescriptions_service.dart
+++ b/lib/core/service/medical/prescriptions_service.dart
@@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
+import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart';
@@ -16,8 +17,9 @@ import 'package:flutter/cupertino.dart';
class PrescriptionsService extends BaseService {
List prescriptionsList = List();
List prescriptionReportListINP = List();
- List prescriptionsOrderList = List();
+ List prescriptionsOrderList = List();
var isMedDeliveryAllowed;
+
Future getPrescriptions() async {
hasError = false;
Map body = Map();
@@ -36,10 +38,24 @@ class PrescriptionsService extends BaseService {
Future getPrescriptionsOrders() async {
prescriptionsOrderList.clear();
Map body = Map();
- body['isDentalAllowedBackend'] = false;
+ // body['isDentalAllowedBackend'] = false;
await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, onSuccess: (dynamic response, int statusCode) {
response['PatientER_GetPatientAllPresOrdersList'].forEach((prescriptionsOrder) {
- prescriptionsOrderList.add(PrescriptionsOrder.fromJson(prescriptionsOrder));
+ // prescriptionsOrderList.add(PrescriptionsOrder.fromJson(prescriptionsOrder));
+ });
+ }, onFailure: (String error, int statusCode) {
+ hasError = true;
+ super.error = error;
+ }, body: body);
+ }
+
+ Future getPrescriptionsOrdersRC() async {
+ prescriptionsOrderList.clear();
+ Map body = Map();
+ // body['isDentalAllowedBackend'] = false;
+ await baseAppClient.post(GET_ALL_PRESCRIPTION_ORDERS_RC, onSuccess: (dynamic response, int statusCode) {
+ response['response'].forEach((prescriptionsOrder) {
+ prescriptionsOrderList.add(GetCMCAllOrdersResponseModel.fromJson(prescriptionsOrder));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
diff --git a/lib/core/viewModels/medical/prescriptions_view_model.dart b/lib/core/viewModels/medical/prescriptions_view_model.dart
index 03018878..be6153bd 100644
--- a/lib/core/viewModels/medical/prescriptions_view_model.dart
+++ b/lib/core/viewModels/medical/prescriptions_view_model.dart
@@ -1,3 +1,4 @@
+import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart';
@@ -26,7 +27,7 @@ class PrescriptionsViewModel extends BaseViewModel {
List get prescriptionsList => _prescriptionsService.prescriptionsList;
- List get prescriptionsHistory => _prescriptionsService.prescriptionsOrderList;
+ List get prescriptionsHistory => _prescriptionsService.prescriptionsOrderList;
List get pharmacyPrescriptionsList => _prescriptionsService.pharmacyPrescriptionsList;
@@ -79,7 +80,8 @@ class PrescriptionsViewModel extends BaseViewModel {
getPrescriptionsOrders({bool showLoading = false}) async {
setState(ViewState.Busy);
Future.delayed(new Duration(milliseconds: 300)).then((value) async {
- await _prescriptionsService.getPrescriptionsOrders();
+ // await _prescriptionsService.getPrescriptionsOrders();
+ await _prescriptionsService.getPrescriptionsOrdersRC();
if (_prescriptionsService.hasError) {
error = _prescriptionsService.error;
setState(ViewState.ErrorLocal);
diff --git a/lib/models/SmartWatch/HealthData.dart b/lib/models/SmartWatch/HealthData.dart
index f01c3bf8..d681f764 100644
--- a/lib/models/SmartWatch/HealthData.dart
+++ b/lib/models/SmartWatch/HealthData.dart
@@ -1,8 +1,37 @@
class healthData {
int MedCategoryID;
int MedSubCategoryID;
- String Value;
- String Notes;
String MachineDate;
+ double Value;
int TransactionsListID;
-}
+ String Notes;
+
+ healthData({
+ this.MedCategoryID,
+ this.MedSubCategoryID,
+ this.MachineDate,
+ this.Value,
+ this.TransactionsListID,
+ this.Notes,
+ });
+
+ healthData.fromJson(Map json) {
+ MedCategoryID = json['MedCategoryID'];
+ MedSubCategoryID = json['MedSubCategoryID'];
+ MachineDate = json['MachineDate'];
+ Value = json['Value'];
+ TransactionsListID = json['TransactionsListID'];
+ Notes = json['Notes'];
+ }
+
+ Map toJson() {
+ final Map data = new Map();
+ data['MedCategoryID'] = this.MedCategoryID;
+ data['MedSubCategoryID'] = this.MedSubCategoryID;
+ data['MachineDate'] = this.MachineDate;
+ data['Value'] = this.Value;
+ data['TransactionsListID'] = this.TransactionsListID;
+ data['Notes'] = this.Notes;
+ return data;
+ }
+}
\ No newline at end of file
diff --git a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart
index d85db81f..bbd73d64 100644
--- a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart
+++ b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart
@@ -27,6 +27,8 @@ class _HospitalsPageState extends State {
LocationUtils locationUtils;
var weather = '--';
+ ProjectViewModel projectViewModel;
+
@override
void initState() {
locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context);
@@ -37,7 +39,7 @@ class _HospitalsPageState extends State {
@override
Widget build(BuildContext context) {
- ProjectViewModel projectViewModel = Provider.of(context);
+ projectViewModel = Provider.of(context);
return BaseView(
onModelReady: (model) => model.getWeatherData(),
allowAny: true,
@@ -131,7 +133,7 @@ class _HospitalsPageState extends State {
padding: EdgeInsets.all(15),
child: Column(
children: mode.weatherIndicatorData.map((data) {
- return WeatherSlider(data);
+ return WeatherSlider(data, projectViewModel);
}).toList()))
]))
: Center(child: AppCircularProgressIndicator())),
diff --git a/lib/pages/BookAppointment/LaserBooking.dart b/lib/pages/BookAppointment/LaserBooking.dart
new file mode 100644
index 00000000..f1acaf2c
--- /dev/null
+++ b/lib/pages/BookAppointment/LaserBooking.dart
@@ -0,0 +1,127 @@
+import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_svg/flutter_svg.dart';
+
+class LaserBooking extends StatefulWidget {
+ @override
+ _LaserBookingState createState() => _LaserBookingState();
+}
+
+class _LaserBookingState extends State {
+ @override
+ Widget build(BuildContext context) {
+ return AppScaffold(
+ isShowDecPage: false,
+ isShowAppBar: true,
+ showNewAppBarTitle: true,
+ showNewAppBar: true,
+ appBarTitle: "Laser",
+ body: Container(
+ child: Column(
+ children: [
+ HumanAnatomy(),
+ ],
+ ),
+ ));
+ }
+}
+
+class HumanAnatomy extends StatefulWidget {
+ final ValueChanged onChanged;
+
+ const HumanAnatomy({Key key, this.onChanged}) : super(key: key);
+
+ @override
+ _HumanAnatomyState createState() => new _HumanAnatomyState();
+}
+
+class _HumanAnatomyState extends State {
+ var _bodyPartList = [];
+
+ @override
+ void initState() {
+ super.initState();
+ if (mounted) {
+ _publishSelection(_bodyPartList);
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return humanAnatomy();
+ }
+
+ Widget humanAnatomy() {
+ return Container(
+ width: 320.0,
+ height: 560.0,
+ child: SizedBox(
+ child: Stack(
+ children: [
+ bodyPart("assets/images/new/body/head.svg", "Head", 0.0, 0.0, 0.0, 70.0),
+ bodyPart("assets/images/new/body/left_ear.svg", "leftEar", 32.0, 50.0, 0.0, 20.0),
+ bodyPart("assets/images/new/body/right_ear.svg", "rightEar", 32.0, 0.0, 50.0, 20.0),
+ bodyPart("assets/images/new/body/left_eye.svg", "LeftEye", 22.0, 20.0, 0.0, 10.0),
+ bodyPart("assets/images/new/body/right_eye.svg", "rightEye", 22.0, 0.0, 20.0, 10.0),
+ bodyPart("assets/images/new/body/nose.svg", "Nose", 25.0, 0.0, 0.0, 20.0),
+ bodyPart("assets/images/new/body/mouth.svg", "Mouth", 48.0, 0.0, 0.0, 10.0),
+ bodyPart("assets/images/new/body/neck.svg", "Neck", 58.0, 0.0, 0.0, 40.0),
+ bodyPart("assets/images/new/body/chest.svg", "Chest", 93.0, 0.0, 0.0, 95.0),
+ bodyPart("assets/images/new/body/abdomin.svg", "Abdomin", 175.0, 0.0, 0.0, 65.0),
+ bodyPart("assets/images/new/body/pelvis.svg", "Pelvis", 225.0, 0.0, 0.0, 50.0),
+ bodyPart("assets/images/new/body/publs.svg", "Publs", 275.0, 0.0, 0.0, 15.0),
+ bodyPart("assets/images/new/body/left_soulder.svg", "leftSoulder", 90.0, 105.0, 0.0, 50.0),
+ bodyPart("assets/images/new/body/right_soulder.svg", "rightSoulder", 89.0, 0.0, 110.0, 50.0),
+ bodyPart("assets/images/new/body/left_arm.svg", "leftArm", 120.0, 145.0, 0.0, 70.0),
+ bodyPart("assets/images/new/body/right_arm.svg", "rightArm", 118.0, 0.0, 142.0, 70.0),
+ bodyPart("assets/images/new/body/left_elbow.svg", "leftElbow", 172.0, 172.0, 0.0, 39.0),
+ bodyPart("assets/images/new/body/right_elbow.svg", "rightElbow", 170.0, 0.0, 170.0, 40.0),
+ bodyPart("assets/images/new/body/left_forearm.svg", "leftForearm", 195.0, 190.0, 0.0, 54.0),
+ bodyPart("assets/images/new/body/right_forearm.svg", "rightForearm", 195.0, 0.0, 190.0, 54.0),
+ bodyPart("assets/images/new/body/left_wrist.svg", "leftWrist", 238.0, 220.0, 0.0, 23.0),
+ bodyPart("assets/images/new/body/right_wrist.svg", "rightWrist", 238.0, 0.0, 220.0, 23.0),
+ bodyPart("assets/images/new/body/left_hand.svg", "leftHand", 250.0, 250.0, 0.0, 60.0),
+ bodyPart("assets/images/new/body/right_hand.svg", "rightHand", 250.0, 0.0, 250.0, 60.0),
+ bodyPart("assets/images/new/body/left_thigh.svg", "leftThigh", 242.0, 63.0, 0.0, 138.0),
+ bodyPart("assets/images/new/body/right_thigh.svg", "rightThigh", 242.0, 0.0, 63.0, 138.0),
+ bodyPart("assets/images/new/body/left_knee.svg", "leftKnee", 360.0, 68.0, 0.0, 48.0),
+ bodyPart("assets/images/new/body/right_knee.svg", "rightKnee", 360.0, 0.0, 68.0, 48.0),
+ bodyPart("assets/images/new/body/left_leg.svg", "leftLeg", 395.0, 64.0, 0.0, 105.0),
+ bodyPart("assets/images/new/body/right_leg.svg", "rightLeg", 393.0, 0.0, 65.0, 106.0),
+ bodyPart("assets/images/new/body/left_ankle.svg", "leftAnkle", 495.0, 64.0, 0.0, 25.0),
+ bodyPart("assets/images/new/body/right_ankle.svg", "rightAnkle", 493.0, 0.0, 68.0, 25.0),
+ bodyPart("assets/images/new/body/left_foot.svg", "leftFoot", 510.0, 80.0, 0.0, 60.0),
+ bodyPart("assets/images/new/body/right_foot.svg", "rightFoot", 508.0, 0.0, 83.0, 56.0),
+ ],
+ ),
+ ),
+ );
+ }
+
+ Widget bodyPart(String svgPath, String svgName, double marginTop, double marginRight, double marginLeft, double height) {
+ Color _svgColor = _bodyPartList.contains(svgName) ? Colors.redAccent : null;
+ final Widget bodyPartSvg = new SvgPicture.asset(svgPath, semanticsLabel: svgName, color: _svgColor);
+ return Container(
+ margin: EdgeInsets.only(top: marginTop, right: marginRight, left: marginLeft),
+ height: height,
+ alignment: Alignment.topCenter,
+ child: GestureDetector(
+ onTap: () {
+ setState(() {
+ if (_bodyPartList.contains(svgName)) {
+ _bodyPartList.remove(svgName);
+ } else {
+ _bodyPartList.add(svgName);
+ }
+ });
+ },
+ child: bodyPartSvg),
+ );
+ }
+
+ void _publishSelection(List _bodyPartList) {
+ if (widget.onChanged != null) {
+ widget.onChanged(_bodyPartList);
+ }
+ }
+}
diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart
index 147cb9f9..63e84e96 100644
--- a/lib/pages/BookAppointment/components/SearchByClinic.dart
+++ b/lib/pages/BookAppointment/components/SearchByClinic.dart
@@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/models/Appointments/SearchInfoModel.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/DentalComplaints.dart';
+import 'package:diplomaticquarterapp/pages/BookAppointment/LaserBooking.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart';
import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
@@ -176,9 +177,10 @@ class _SearchByClinicState extends State {
),
],
),
-
- Container(child: inputWidget("Age", "", ageController),margin: EdgeInsets.only(left: 20, right: 20),),
-
+ Container(
+ child: inputWidget("Age", "", ageController),
+ margin: EdgeInsets.only(left: 20, right: 20),
+ ),
],
),
Padding(
@@ -421,15 +423,15 @@ class _SearchByClinicState extends State {
prefixIcon: prefix == null
? null
: Text(
- "+" + prefix,
- style: TextStyle(
- fontSize: 14,
- height: 21 / 14,
- fontWeight: FontWeight.w500,
- color: Color(0xff2E303A),
- letterSpacing: -0.56,
- ),
- ),
+ "+" + prefix,
+ style: TextStyle(
+ fontSize: 14,
+ height: 21 / 14,
+ fontWeight: FontWeight.w500,
+ color: Color(0xff2E303A),
+ letterSpacing: -0.56,
+ ),
+ ),
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
focusedBorder: InputBorder.none,
@@ -446,7 +448,6 @@ class _SearchByClinicState extends State {
);
}
-
void openDropdown(GlobalKey key) {
GestureDetector detector;
void searchForGestureDetector(BuildContext element) {
@@ -537,6 +538,9 @@ class _SearchByClinicState extends State {
searchInfo.date = DateTime.now();
navigateToDentalComplaints(context, searchInfo);
+ } else if (dropdownValue.split("-")[0] == "253") {
+ // navigateToLaserClinic(context);
+ callDoctorsSearchAPI();
} else if (dropdownValue.split("-")[1] == "true"
// && authProvider.isLogin &&
// authUser.patientType == 1
@@ -625,6 +629,19 @@ class _SearchByClinicState extends State {
});
}
+ Future navigateToLaserClinic(BuildContext context) async {
+ Navigator.push(
+ context,
+ FadePage(
+ page: LaserBooking(),
+ ),
+ ).then((value) {
+ setState(() {
+ dropdownValue = null;
+ });
+ });
+ }
+
Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async {
isProjectLoaded = false;
Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital)))
diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart
index 26b6421c..8688fec3 100644
--- a/lib/pages/login/welcome.dart
+++ b/lib/pages/login/welcome.dart
@@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/pages/login/login-type.dart';
import 'package:diplomaticquarterapp/pages/login/register.dart';
+import 'package:diplomaticquarterapp/pages/login/register_new.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
@@ -78,7 +79,7 @@ class _WelcomeLogin extends State {
child: DefaultButton(
TranslationBase.of(context).no,
() => {
- Navigator.of(context).push(FadePage(page: Register())),
+ Navigator.of(context).push(FadePage(page: RegisterNew())),
},
color: CustomColors.accentColor,
textColor: Colors.white,
diff --git a/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart b/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart
index 986fb848..719b2196 100644
--- a/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart
+++ b/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart
@@ -9,9 +9,10 @@ import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
-import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
+import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
+import 'package:diplomaticquarterapp/widgets/show_zoom_image_dialog.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@@ -101,23 +102,43 @@ class PrescriptionOrderOverview extends StatelessWidget {
prescriptionReportEnhList.length,
(index) => Container(
margin: EdgeInsets.all(0.0),
- decoration: cardRadius(0),
+ // decoration: cardRadius(0),
child: Row(
children: [
- Container(
- margin: EdgeInsets.only(bottom: 10.0),
- decoration: BoxDecoration(
- border: Border.all(width: 1.0, color: Color(0xffEBEBEB)),
- borderRadius: BorderRadius.all(Radius.circular(30.0)),
- ),
- child: ClipRRect(
- borderRadius: BorderRadius.all(Radius.circular(30)),
- child: Image.network(
- prescriptionReportEnhList[index].imageSRCUrl,
- fit: BoxFit.cover,
- width: 48,
- height: 48,
- ),
+ InkWell(
+ onTap: () {
+ showZoomImageDialog(context, prescriptionReportEnhList[index].imageSRCUrl);
+ },
+ child: Stack(
+ alignment: Alignment.center,
+ children: [
+ Container(
+ margin: EdgeInsets.only(bottom: 10.0),
+ decoration: BoxDecoration(
+ border: Border.all(width: 1.0, color: Color(0xffEBEBEB)),
+ borderRadius: BorderRadius.all(Radius.circular(30.0)),
+ ),
+ child: ClipRRect(
+ borderRadius: BorderRadius.all(Radius.circular(30)),
+ child: Image.network(
+ prescriptionReportEnhList[index].imageSRCUrl,
+ fit: BoxFit.cover,
+ width: 48,
+ height: 48,
+ ),
+ ),
+ ),
+ Container(
+ margin: EdgeInsets.only(bottom: 10.0),
+ child: Icon(
+ Icons.search,
+ size: 18,
+ color: Colors.white,
+ ),
+ padding: EdgeInsets.all(3),
+ decoration: containerRadius(Colors.black.withOpacity(0.3), 200),
+ )
+ ],
),
),
SizedBox(width: 14),
@@ -153,15 +174,14 @@ class PrescriptionOrderOverview extends StatelessWidget {
),
),
Container(
- decoration: cardRadius(0),
+ // decoration: cardRadius(0),
margin: EdgeInsets.zero,
child: Container(
width: double.infinity,
margin: EdgeInsets.all(12),
- child: SecondaryButton(
- label: TranslationBase.of(context).submit.toUpperCase(),
- color: CustomColors.accentColor,
- onTap: () async {
+ child: DefaultButton(
+ TranslationBase.of(context).submit.toUpperCase(),
+ () async {
showDialog(
context: context,
child: ConfirmWithMessageDialog(
diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart
index 3fbc2baf..5a47ec3b 100644
--- a/lib/pages/medical/prescriptions/prescription_details_page.dart
+++ b/lib/pages/medical/prescriptions/prescription_details_page.dart
@@ -23,6 +23,7 @@ import 'package:provider/provider.dart';
class PrescriptionDetailsPage extends StatelessWidget {
final PrescriptionReport prescriptionReport;
final Prescriptions prescriptions;
+
PrescriptionDetailsPage({Key key, this.prescriptionReport, this.prescriptions});
@override
@@ -111,14 +112,18 @@ class PrescriptionDetailsPage extends StatelessWidget {
decoration: cardRadius(2000),
),
Container(
- child: Icon(Icons.search,size: 18,color: Colors.white,),
+ child: Icon(
+ Icons.search,
+ size: 18,
+ color: Colors.white,
+ ),
padding: EdgeInsets.all(6),
decoration: containerRadius(Colors.black.withOpacity(0.3), 200),
)
],
),
- onTap: (){
- showZoomImageDialog(context, prescriptionReport.imageSRCUrl);
+ onTap: () {
+ showZoomImageDialog(context, prescriptionReport.imageSRCUrl);
},
),
SizedBox(width: 12),
diff --git a/lib/pages/medical/prescriptions/prescriptions_history_page.dart b/lib/pages/medical/prescriptions/prescriptions_history_page.dart
index 1da0adb6..adce13bb 100644
--- a/lib/pages/medical/prescriptions/prescriptions_history_page.dart
+++ b/lib/pages/medical/prescriptions/prescriptions_history_page.dart
@@ -1,12 +1,11 @@
+import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
-import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history_details_page.dart';
+import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
-import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
-import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@@ -25,126 +24,130 @@ class PrescriptionsHistoryPage extends StatelessWidget {
onModelReady: (model) => model.getPrescriptionsOrders(showLoading: true),
builder: (_, model, widget) => AppScaffold(
baseViewModel: prescriptionsViewModel,
- body: ListView.separated(
- physics: BouncingScrollPhysics(),
- padding: EdgeInsets.all(21),
- separatorBuilder: (context, index) {
- return SizedBox(height: 12);
- },
- itemBuilder: (context, index) {
- int status = prescriptionsViewModel.prescriptionsHistory[index].status;
- String _statusDisp = projectViewModel.isArabic ? prescriptionsViewModel.prescriptionsHistory[index].descriptionN : prescriptionsViewModel.prescriptionsHistory[index].description;
- Color _color;
- if (status == 1) {
- //pending
- _color = Color(0xffCC9B14);
- } else if (status == 2) {
- //processing
- _color = Color(0xff2E303A);
- } else if (status == 3) {
- //completed
- _color = Color(0xff359846);
- } else if (status == 4) {
- //cancel // Rejected
- _color = Color(0xffD02127);
- }
+ body: model.state != ViewState.Busy
+ ? prescriptionsViewModel.prescriptionsHistory.length > 0
+ ? ListView.separated(
+ physics: BouncingScrollPhysics(),
+ padding: EdgeInsets.all(21),
+ separatorBuilder: (context, index) {
+ return SizedBox(height: 12);
+ },
+ itemBuilder: (context, index) {
+ int status = prescriptionsViewModel.prescriptionsHistory[index].statusId;
+ String _statusDisp = prescriptionsViewModel.prescriptionsHistory[index].statusText;
+ Color _color;
+ if (status == 1) {
+ //pending
+ _color = Color(0xffCC9B14);
+ } else if (status == 2) {
+ //processing
+ _color = Color(0xff2E303A);
+ } else if (status == 3) {
+ //completed
+ _color = Color(0xff359846);
+ } else if (status == 4 || status == 6 || status == 7) {
+ //cancel // Rejected
+ _color = Color(0xffD02127);
+ }
- return InkWell(
- onTap: () async {
- final result = await Navigator.push(
- context,
- FadePage(
- page: PrescriptionsHistoryDetailsPage(
- prescriptionsOrder: prescriptionsViewModel.prescriptionsHistory[index],
- ),
- ),
- );
- if (result != null) {
- showOrderLog();
- }
- },
- child: Container(
- height: 65,
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(
- Radius.circular(10.0),
- ),
- boxShadow: [
- BoxShadow(
- color: Color(0xff000000).withOpacity(.05),
- blurRadius: 27,
- offset: Offset(0, -3),
- ),
- ],
- ),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Container(
- width: 6,
- decoration: BoxDecoration(
- color: _color,
- borderRadius: BorderRadius.only(
- topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
- bottomLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
- topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
- bottomRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
- ),
- ),
- ),
- Expanded(
- child: Padding(
- padding: EdgeInsets.only(left: projectViewModel.isArabic ? 6 : 12, right: projectViewModel.isArabic ? 12 : 6),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- Expanded(
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- _statusDisp,
- style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10),
- ),
- Text(
- '${TranslationBase.of(context).orderNo}. ${prescriptionsViewModel.prescriptionsHistory[index].iD}',
- style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
- ),
- ],
- ),
+ return InkWell(
+ onTap: () async {
+ // final result = await Navigator.push(
+ // context,
+ // FadePage(
+ // page: PrescriptionsHistoryDetailsPage(
+ // prescriptionsOrder: prescriptionsViewModel.prescriptionsHistory[index],
+ // ),
+ // ),
+ // );
+ // if (result != null) {
+ // showOrderLog();
+ // }
+ },
+ child: Container(
+ height: 65,
+ decoration: BoxDecoration(
+ color: Colors.white,
+ borderRadius: BorderRadius.all(
+ Radius.circular(10.0),
),
- Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- Text(
- DateUtil.getDayMonthYearDateFormatted(prescriptionsViewModel.prescriptionsHistory[index].createdOn),
- style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10),
+ boxShadow: [
+ BoxShadow(
+ color: Color(0xff000000).withOpacity(.05),
+ blurRadius: 27,
+ offset: Offset(0, -3),
+ ),
+ ],
+ ),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Container(
+ width: 6,
+ decoration: BoxDecoration(
+ color: _color,
+ borderRadius: BorderRadius.only(
+ topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
+ bottomLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
+ topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
+ bottomRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
+ ),
),
- Text(
- DateUtil.formatDateToTimeLang(prescriptionsViewModel.prescriptionsHistory[index].createdOn, false),
- style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
+ ),
+ Expanded(
+ child: Padding(
+ padding: EdgeInsets.only(left: projectViewModel.isArabic ? 6 : 12, right: projectViewModel.isArabic ? 12 : 6),
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Expanded(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ _statusDisp,
+ style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10),
+ ),
+ Text(
+ '${TranslationBase.of(context).orderNo}. ${prescriptionsViewModel.prescriptionsHistory[index].iD}',
+ style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
+ ),
+ ],
+ ),
+ ),
+ Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.end,
+ children: [
+ Text(
+ DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(prescriptionsViewModel.prescriptionsHistory[index].created)),
+ style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10),
+ ),
+ Text(
+ DateUtil.formatDateToTimeLang(DateTime.tryParse(prescriptionsViewModel.prescriptionsHistory[index].created), false),
+ style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
+ ),
+ ],
+ )
+ ],
+ ),
),
- ],
- )
- ],
- ),
- ),
- ),
- Icon(
- Icons.arrow_forward,
- size: 16,
- ),
- mWidth(6),
- ],
- ),
- ));
- },
- itemCount: prescriptionsViewModel.prescriptionsHistory.length,
- ),
+ ),
+ Icon(
+ Icons.arrow_forward,
+ size: 16,
+ ),
+ mWidth(6),
+ ],
+ ),
+ ));
+ },
+ itemCount: prescriptionsViewModel.prescriptionsHistory.length,
+ )
+ : getNoDataWidget(context)
+ : Container(),
));
}
}
diff --git a/lib/pages/medical/prescriptions/prescriptions_home_page.dart b/lib/pages/medical/prescriptions/prescriptions_home_page.dart
index 26c8dc22..d5efa38b 100644
--- a/lib/pages/medical/prescriptions/prescriptions_home_page.dart
+++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart
@@ -90,7 +90,7 @@ class _HomePrescriptionsPageState extends State with Sing
prescriptionsViewModel: model,
showOrderLog: () async {
_tabController.animateTo(2);
- await model.getPrescriptionsOrders(showLoading: true);
+ // await model.getPrescriptionsOrders(showLoading: true);
setState(() {});
},
),
@@ -99,7 +99,7 @@ class _HomePrescriptionsPageState extends State with Sing
prescriptionsViewModel: model,
showOrderLog: () async {
_tabController.animateTo(2);
- await model.getPrescriptionsOrders(showLoading: true);
+ // await model.getPrescriptionsOrders(showLoading: true);
setState(() {});
},
),
diff --git a/lib/pages/medical/smart_watch_health_data/health_data_list.dart b/lib/pages/medical/smart_watch_health_data/health_data_list.dart
index f43a6e63..80a12cca 100644
--- a/lib/pages/medical/smart_watch_health_data/health_data_list.dart
+++ b/lib/pages/medical/smart_watch_health_data/health_data_list.dart
@@ -1,8 +1,8 @@
import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/Steps/stepsTracker.dart';
import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/distance/distanceTracker.dart';
import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart';
+import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/syncHealthData.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
-import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@@ -64,20 +64,10 @@ class _HealthDataListState extends State {
),
),
),
- bottomSheet: Container(
- color: Colors.white,
- child: Padding(
- padding: const EdgeInsets.all(20.0),
- child: DefaultButton(TranslationBase.of(context).syncHealthData, () {
- print("ReadLast");
- // readLast();
- }),
- ),
- ),
+ bottomSheet: syncHealthDataButton(),
);
}
-
List myOptionsList(BuildContext context) {
List medical = List();
@@ -123,7 +113,6 @@ class _HealthDataListState extends State {
return medical;
}
-
// void readLast() async {
// print("ReadLast");
// final result = await FitKit.readLast(DataType.DISTANCE);
diff --git a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart
new file mode 100644
index 00000000..47be3c5f
--- /dev/null
+++ b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart
@@ -0,0 +1,274 @@
+import 'package:collection/collection.dart';
+import 'package:diplomaticquarterapp/models/SmartWatch/HealthData.dart';
+import 'package:diplomaticquarterapp/services/smartwatch_integration/SmartWatchIntegrationService.dart';
+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:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart';
+import 'package:fit_kit/fit_kit.dart';
+import 'package:flutter/material.dart';
+import 'package:intl/intl.dart';
+
+class syncHealthDataButton extends StatefulWidget {
+ double marginTop;
+
+ double hight;
+
+ double minWidth;
+
+ syncHealthDataButton({this.marginTop, this.hight, this.minWidth});
+
+ @override
+ _syncHealthDataButtonState createState() => _syncHealthDataButtonState();
+}
+
+class _syncHealthDataButtonState extends State {
+ List dataTypes = List();
+
+ List Med_InsertTransactionsInputsList = new List();
+ List Med_InsertTransactionsInputsList2 = new List();
+
+ List sleepDataList = new List();
+
+ List healthDataList = new List();
+
+ int TransactionsListID = 1;
+
+ int MedCategoryID = 0;
+
+ @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();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Container(
+ color: Colors.white,
+ child: Padding(
+ padding: const EdgeInsets.all(20.0),
+ child: DefaultButton(TranslationBase.of(context).syncHealthData, () {
+ print("ReadAll");
+ readAll();
+ }),
+ ),
+ );
+ }
+
+ void readAll() async {
+ TransactionsListID = 1;
+ var MedSubCategoryID = 0;
+ double value = 0.0;
+
+ 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: 1000500,
+ );
+
+ if (type == DataType.DISTANCE) {
+ MedCategoryID = 7;
+ } else if (type == DataType.STEP_COUNT) {
+ MedCategoryID = 6;
+ } else if (type == DataType.HEART_RATE) {
+ MedCategoryID = 3;
+ }
+
+ 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++, Notes: ""));
+ });
+ }
+ }
+ getAllHealthDataLists();
+ }
+
+ void getAllHealthDataLists() {
+ var totalSteps = 0.0;
+ var totalDistance = 0.0;
+ // double totalCalories = 0.0 ;
+ double totalHeartRate = 0.0;
+ double avgTotalHeartRate = 0.0;
+ var counter = 0;
+ List data = [];
+ TransactionsListID = 1;
+
+ DateTime date;
+ sleepDataList.clear();
+
+ Med_InsertTransactionsInputsList.forEach((result) {
+ data.add(result.toJson());
+ });
+
+ Med_InsertTransactionsInputsList2.clear();
+
+ var newMap = groupBy(data, (obj) => DateUtil.convertStringToDate(obj['MachineDate']).toString().substring(0, 10));
+
+ newMap.forEach((key, value) {
+ totalSteps = 0.0;
+ totalDistance = 0.0;
+ totalHeartRate = 0.0;
+ avgTotalHeartRate = 0.0;
+ counter = 0;
+
+ date = DateTime.parse(key);
+
+ value.forEach((element) {
+ if (element['MedCategoryID'] == 6) {
+ MedCategoryID = 6;
+
+ 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'];
+ } else if (element['MedCategoryID'] == 4) {
+ print("sleeeeep");
+ sleepDataList.add(new healthData(
+ MedCategoryID: 4,
+ MedSubCategoryID: element['MedSubCategoryID'],
+ MachineDate: DateUtil.convertDateToString(date),
+ Value: element['Value'],
+ TransactionsListID: TransactionsListID++,
+ Notes: ""));
+
+ Med_InsertTransactionsInputsList2.add(new healthData(
+ MedCategoryID: 4,
+ MedSubCategoryID: element['MedSubCategoryID'],
+ MachineDate: DateUtil.convertDateToString(date),
+ Value: element['Value'],
+ TransactionsListID: TransactionsListID++,
+ Notes: ""));
+ }
+ // else if(element['MedCategoryID'] == 8){
+ //
+ // totalCalories += element['Value'] ;
+ // }
+ });
+
+ if (counter == 0) {
+ counter = 1;
+ }
+ if (totalHeartRate == 0) {
+ avgTotalHeartRate = 0;
+ } else {
+ avgTotalHeartRate = totalHeartRate / counter;
+ }
+
+ Med_InsertTransactionsInputsList2.add(
+ new healthData(MedCategoryID: 6, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: totalSteps, TransactionsListID: TransactionsListID++, Notes: ""));
+ Med_InsertTransactionsInputsList2.add(
+ new healthData(MedCategoryID: 7, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: totalDistance, TransactionsListID: TransactionsListID++, Notes: ""));
+ Med_InsertTransactionsInputsList2.add(
+ new healthData(MedCategoryID: 3, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: avgTotalHeartRate, TransactionsListID: TransactionsListID++, Notes: ""));
+
+ // Med_InsertTransactionsInputsList2.add(new healthData(MedCategoryID: 8 , MedSubCategoryID: 0 , MachineDate: DateUtil.convertDateToStringWithBackSlash(date) , Value: totalCalories , TransactionsListID: TransactionsListID++ , Notes: ""));
+ });
+
+ GifLoaderDialogUtils.hideDialog(context);
+
+ AlertDialogBox dialog = new AlertDialogBox(
+ context: context,
+ confirmMessage: TranslationBase.of(context).alreadySynced,
+ okText: TranslationBase.of(context).ok,
+ okFunction: () => {
+ AlertDialogBox.closeAlertDialog(context),
+ },
+ );
+
+ dialog.showAlertDialog(context);
+ }
+
+ addInsertTransactionsInputsList() {
+ if (Med_InsertTransactionsInputsList2.isNotEmpty) {
+ SmartWatchIntegrationService service = new SmartWatchIntegrationService();
+ service.insertPatientHealthData(Med_InsertTransactionsInputsList2, context).then((res) {
+ print(res);
+ }).catchError((err) {
+ print(err);
+ });
+ } else {
+ return;
+ }
+ }
+}
diff --git a/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart b/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart
index 3bfe62e3..459c0e83 100644
--- a/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart
+++ b/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart
@@ -3,6 +3,7 @@ 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/models/SmartWatch/HealthData.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:flutter/material.dart';
@@ -18,8 +19,7 @@ class SmartWatchIntegrationService extends BaseService {
Map request;
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
- var data = AuthenticatedUser.fromJson(
- await this.sharedPref.getObject(USER_PROFILE));
+ var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE));
authUser = data;
}
@@ -42,13 +42,29 @@ class SmartWatchIntegrationService extends BaseService {
dynamic localRes;
- await baseAppClient.post(GET_PATIENT_LAST_RECORD,
- onSuccess: (response, statusCode) async {
- localRes = response;
- }, onFailure: (String error, int statusCode) {
- throw error;
- }, body: request);
+ await baseAppClient.post(GET_PATIENT_LAST_RECORD, onSuccess: (response, statusCode) async {
+ localRes = response;
+ }, onFailure: (String error, int statusCode) {
+ throw error;
+ }, body: request);
return Future.value(localRes);
+ }
+ Future