diff --git a/assets/images/png/smartwatches/Apple-Watch-6.png b/assets/images/png/smartwatches/Apple-Watch-6.png
new file mode 100644
index 0000000..1e67050
Binary files /dev/null and b/assets/images/png/smartwatches/Apple-Watch-6.png differ
diff --git a/assets/images/png/smartwatches/apple-watch-1.jpeg b/assets/images/png/smartwatches/apple-watch-1.jpeg
new file mode 100644
index 0000000..7262e7e
Binary files /dev/null and b/assets/images/png/smartwatches/apple-watch-1.jpeg differ
diff --git a/assets/images/png/smartwatches/apple-watch-2.jpg b/assets/images/png/smartwatches/apple-watch-2.jpg
new file mode 100644
index 0000000..f688f74
Binary files /dev/null and b/assets/images/png/smartwatches/apple-watch-2.jpg differ
diff --git a/assets/images/png/smartwatches/apple-watch-3.jpg b/assets/images/png/smartwatches/apple-watch-3.jpg
new file mode 100644
index 0000000..b68c1ce
Binary files /dev/null and b/assets/images/png/smartwatches/apple-watch-3.jpg differ
diff --git a/assets/images/png/smartwatches/apple-watch-4.jpg b/assets/images/png/smartwatches/apple-watch-4.jpg
new file mode 100644
index 0000000..2fc19b6
Binary files /dev/null and b/assets/images/png/smartwatches/apple-watch-4.jpg differ
diff --git a/assets/images/png/smartwatches/apple-watch-5.jpg b/assets/images/png/smartwatches/apple-watch-5.jpg
new file mode 100644
index 0000000..4c497ea
Binary files /dev/null and b/assets/images/png/smartwatches/apple-watch-5.jpg differ
diff --git a/assets/images/png/smartwatches/bloodoxygen_icon.svg b/assets/images/png/smartwatches/bloodoxygen_icon.svg
new file mode 100644
index 0000000..0971a30
--- /dev/null
+++ b/assets/images/png/smartwatches/bloodoxygen_icon.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/images/png/smartwatches/calories_icon.svg b/assets/images/png/smartwatches/calories_icon.svg
new file mode 100644
index 0000000..660ce0d
--- /dev/null
+++ b/assets/images/png/smartwatches/calories_icon.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/png/smartwatches/distance_icon.svg b/assets/images/png/smartwatches/distance_icon.svg
new file mode 100644
index 0000000..29dcf3d
--- /dev/null
+++ b/assets/images/png/smartwatches/distance_icon.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/png/smartwatches/galaxy_fit_3.jpg b/assets/images/png/smartwatches/galaxy_fit_3.jpg
new file mode 100644
index 0000000..ff05834
Binary files /dev/null and b/assets/images/png/smartwatches/galaxy_fit_3.jpg differ
diff --git a/assets/images/png/smartwatches/galaxy_watch_7.webp b/assets/images/png/smartwatches/galaxy_watch_7.webp
new file mode 100644
index 0000000..09748b4
Binary files /dev/null and b/assets/images/png/smartwatches/galaxy_watch_7.webp differ
diff --git a/assets/images/png/smartwatches/galaxy_watch_7_classic.jpg b/assets/images/png/smartwatches/galaxy_watch_7_classic.jpg
new file mode 100644
index 0000000..f177dd4
Binary files /dev/null and b/assets/images/png/smartwatches/galaxy_watch_7_classic.jpg differ
diff --git a/assets/images/png/smartwatches/galaxy_watch_8.jpg b/assets/images/png/smartwatches/galaxy_watch_8.jpg
new file mode 100644
index 0000000..7fd4746
Binary files /dev/null and b/assets/images/png/smartwatches/galaxy_watch_8.jpg differ
diff --git a/assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg b/assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg
new file mode 100644
index 0000000..6e84096
Binary files /dev/null and b/assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg differ
diff --git a/assets/images/png/smartwatches/galaxy_watch_ultra.jpg b/assets/images/png/smartwatches/galaxy_watch_ultra.jpg
new file mode 100644
index 0000000..e401d73
Binary files /dev/null and b/assets/images/png/smartwatches/galaxy_watch_ultra.jpg differ
diff --git a/assets/images/png/smartwatches/heartrate_icon.svg b/assets/images/png/smartwatches/heartrate_icon.svg
new file mode 100644
index 0000000..dac05ef
--- /dev/null
+++ b/assets/images/png/smartwatches/heartrate_icon.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/png/smartwatches/steps_icon.svg b/assets/images/png/smartwatches/steps_icon.svg
new file mode 100644
index 0000000..4af073a
--- /dev/null
+++ b/assets/images/png/smartwatches/steps_icon.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/images/svg/ancillary_orders_list_icon.svg b/assets/images/svg/ancillary_orders_list_icon.svg
new file mode 100644
index 0000000..f0497d8
--- /dev/null
+++ b/assets/images/svg/ancillary_orders_list_icon.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/images/svg/ask_doctor_medical_file_icon.svg b/assets/images/svg/ask_doctor_medical_file_icon.svg
new file mode 100644
index 0000000..11facfb
--- /dev/null
+++ b/assets/images/svg/ask_doctor_medical_file_icon.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/images/svg/blood_sugar_icon.svg b/assets/images/svg/blood_sugar_icon.svg
new file mode 100644
index 0000000..3c77019
--- /dev/null
+++ b/assets/images/svg/blood_sugar_icon.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/images/svg/daily_water_monitor.svg b/assets/images/svg/daily_water_monitor.svg
new file mode 100644
index 0000000..b5f057d
--- /dev/null
+++ b/assets/images/svg/daily_water_monitor.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/images/svg/health_calculators_services_icon.svg b/assets/images/svg/health_calculators_services_icon.svg
new file mode 100644
index 0000000..9f30d08
--- /dev/null
+++ b/assets/images/svg/health_calculators_services_icon.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/svg/health_converters_icon.svg b/assets/images/svg/health_converters_icon.svg
new file mode 100644
index 0000000..225ad01
--- /dev/null
+++ b/assets/images/svg/health_converters_icon.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/images/svg/insurance_approval_icon.svg b/assets/images/svg/insurance_approval_icon.svg
new file mode 100644
index 0000000..b46a54a
--- /dev/null
+++ b/assets/images/svg/insurance_approval_icon.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/images/svg/internet_pairing_icon.svg b/assets/images/svg/internet_pairing_icon.svg
new file mode 100644
index 0000000..3e1ac63
--- /dev/null
+++ b/assets/images/svg/internet_pairing_icon.svg
@@ -0,0 +1,7 @@
+
diff --git a/assets/images/svg/invoices_list_icon.svg b/assets/images/svg/invoices_list_icon.svg
new file mode 100644
index 0000000..f123096
--- /dev/null
+++ b/assets/images/svg/invoices_list_icon.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/images/svg/medical_reports_icon.svg b/assets/images/svg/medical_reports_icon.svg
new file mode 100644
index 0000000..862b813
--- /dev/null
+++ b/assets/images/svg/medical_reports_icon.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/images/svg/monthly_reports_icon.svg b/assets/images/svg/monthly_reports_icon.svg
new file mode 100644
index 0000000..5e786e2
--- /dev/null
+++ b/assets/images/svg/monthly_reports_icon.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/images/svg/my_doctors_icon.svg b/assets/images/svg/my_doctors_icon.svg
new file mode 100644
index 0000000..c5fc541
--- /dev/null
+++ b/assets/images/svg/my_doctors_icon.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/images/svg/my_radiology_icon.svg b/assets/images/svg/my_radiology_icon.svg
new file mode 100644
index 0000000..7b5ebe4
--- /dev/null
+++ b/assets/images/svg/my_radiology_icon.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/svg/my_sick_leave_icon.svg b/assets/images/svg/my_sick_leave_icon.svg
new file mode 100644
index 0000000..f488cff
--- /dev/null
+++ b/assets/images/svg/my_sick_leave_icon.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/images/svg/sick_leave_report_icon.svg b/assets/images/svg/sick_leave_report_icon.svg
new file mode 100644
index 0000000..521c063
--- /dev/null
+++ b/assets/images/svg/sick_leave_report_icon.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/images/svg/smartwatch_icon.svg b/assets/images/svg/smartwatch_icon.svg
new file mode 100644
index 0000000..162ab36
--- /dev/null
+++ b/assets/images/svg/smartwatch_icon.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/svg/update_insurance_icon.svg b/assets/images/svg/update_insurance_icon.svg
new file mode 100644
index 0000000..684d672
--- /dev/null
+++ b/assets/images/svg/update_insurance_icon.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/images/svg/weight_tracker_icon.svg b/assets/images/svg/weight_tracker_icon.svg
new file mode 100644
index 0000000..5110575
--- /dev/null
+++ b/assets/images/svg/weight_tracker_icon.svg
@@ -0,0 +1,4 @@
+
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 8f2ef94..ab9828e 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -71,6 +71,8 @@
This app requires contacts access to show incoming virtual consultation request.
NSFaceIDUsageDescription
This app requires Face ID to allow biometric authentication for app login.
+ NSHealthClinicalHealthRecordsShareUsageDescription
+ This App need access to HealthKit to read heart rate & other data from your smart watch.
NSHealthShareUsageDescription
This App need access to HealthKit to read heart rate & other data from your smart watch.
NSHealthUpdateUsageDescription
diff --git a/ios/Runner/Runner.entitlements b/ios/Runner/Runner.entitlements
index 319178a..2c37e77 100644
--- a/ios/Runner/Runner.entitlements
+++ b/ios/Runner/Runner.entitlements
@@ -4,6 +4,14 @@
aps-environment
development
+ com.apple.developer.healthkit
+
+ com.apple.developer.healthkit.access
+
+ health-records
+
+ com.apple.developer.healthkit.background-delivery
+
com.apple.developer.in-app-payments
merchant.com.hmgwebservices
diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart
index 5499787..d284b5c 100644
--- a/lib/core/api_consts.dart
+++ b/lib/core/api_consts.dart
@@ -723,6 +723,8 @@ class ApiConsts {
static String GET_TAMARA_INSTALLMENTS_URL = "https://mdlaboratories.com/tamaralive/Home/GetInstallments";
static String GET_TAMARA_PAYMENT_STATUS = 'https://mdlaboratories.com/tamaralive/api/OnlineTamara/order_status?orderid=';
+ static String QLINE_URL = "https://ms.hmg.com/nscapi/api/PatientCall/PatientInQueue_Detail";
+
// static String GET_TAMARA_INSTALLMENTS_URL = "https://epharmacy.hmg.com/tamara/Home/getinstallments";
// var payFortEnvironment = FortEnvironment.test;
@@ -739,6 +741,7 @@ class ApiConsts {
GET_TAMARA_INSTALLMENTS_URL = "https://mdlaboratories.com/tamaralive/Home/GetInstallments";
GET_TAMARA_PAYMENT_STATUS = 'https://mdlaboratories.com/tamaralive/api/OnlineTamara/order_status?orderid=';
rcBaseUrl = 'https://rc.hmg.com/';
+ QLINE_URL = "https://ms.hmg.com/nscapi/api/PatientCall/PatientInQueue_Detail";
break;
case AppEnvironmentTypeEnum.dev:
baseUrl = "https://uat.hmgwebservices.com/";
@@ -749,6 +752,7 @@ class ApiConsts {
GET_TAMARA_INSTALLMENTS_URL = "https://epharmacy.hmg.com/tamara/Home/getinstallments";
GET_TAMARA_PAYMENT_STATUS = 'https://epharmacy.hmg.com/tamara/api/OnlineTamara/order_status?orderid=';
rcBaseUrl = 'https://rc.hmg.com/uat/';
+ QLINE_URL = "https://ms.hmg.com/nscapi/api/PatientCall/PatientInQueue_Detail";
break;
case AppEnvironmentTypeEnum.uat:
baseUrl = "https://uat.hmgwebservices.com/";
@@ -759,6 +763,7 @@ class ApiConsts {
GET_TAMARA_INSTALLMENTS_URL = "https://epharmacy.hmg.com/tamara/Home/getinstallments";
GET_TAMARA_PAYMENT_STATUS = 'https://epharmacy.hmg.com/tamara/api/OnlineTamara/order_status?orderid=';
rcBaseUrl = 'https://rc.hmg.com/uat/';
+ QLINE_URL = "https://ms.hmg.com/nscapi/api/PatientCall/PatientInQueue_Detail";
break;
case AppEnvironmentTypeEnum.preProd:
baseUrl = "https://webservices.hmg.com/";
@@ -769,6 +774,7 @@ class ApiConsts {
GET_TAMARA_INSTALLMENTS_URL = "https://epharmacy.hmg.com/tamara/Home/getinstallments";
GET_TAMARA_PAYMENT_STATUS = 'https://epharmacy.hmg.com/tamara/api/OnlineTamara/order_status?orderid=';
rcBaseUrl = 'https://rc.hmg.com/';
+ QLINE_URL = "https://ms.hmg.com/nscapi/api/PatientCall/PatientInQueue_Detail";
break;
case AppEnvironmentTypeEnum.qa:
baseUrl = "https://uat.hmgwebservices.com/";
@@ -779,6 +785,7 @@ class ApiConsts {
GET_TAMARA_INSTALLMENTS_URL = "https://epharmacy.hmg.com/tamara/Home/getinstallments";
GET_TAMARA_PAYMENT_STATUS = 'https://epharmacy.hmg.com/tamara/api/OnlineTamara/order_status?orderid=';
rcBaseUrl = 'https://rc.hmg.com/uat/';
+ QLINE_URL = "https://ms.hmg.com/nscapi/api/PatientCall/PatientInQueue_Detail";
break;
case AppEnvironmentTypeEnum.staging:
baseUrl = "https://uat.hmgwebservices.com/";
@@ -789,6 +796,7 @@ class ApiConsts {
GET_TAMARA_INSTALLMENTS_URL = "https://epharmacy.hmg.com/tamara/Home/getinstallments";
GET_TAMARA_PAYMENT_STATUS = 'https://epharmacy.hmg.com/tamara/api/OnlineTamara/order_status?orderid=';
rcBaseUrl = 'https://rc.hmg.com/uat/';
+ QLINE_URL = "https://ms.hmg.com/nscapi/api/PatientCall/PatientInQueue_Detail";
break;
}
}
diff --git a/lib/core/app_assets.dart b/lib/core/app_assets.dart
index 3ee41f2..aa8d26e 100644
--- a/lib/core/app_assets.dart
+++ b/lib/core/app_assets.dart
@@ -188,6 +188,24 @@ class AppAssets {
static const String latest_news_icon = '$svgBasePath/latest_news_icon.svg';
static const String hmg_contact_icon = '$svgBasePath/hmg_contact_icon.svg';
static const String services_medical_file_icon = '$svgBasePath/services_medical_file_icon.svg';
+ static const String blood_sugar_icon = '$svgBasePath/blood_sugar_icon.svg';
+ static const String weight_tracker_icon = '$svgBasePath/weight_tracker_icon.svg';
+ static const String ask_doctor_medical_file_icon = '$svgBasePath/ask_doctor_medical_file_icon.svg';
+ static const String internet_pairing_icon = '$svgBasePath/internet_pairing_icon.svg';
+ static const String my_doctors_icon = '$svgBasePath/my_doctors_icon.svg';
+ static const String my_sick_leave_icon = '$svgBasePath/my_sick_leave_icon.svg';
+ static const String my_radiology_icon = '$svgBasePath/my_radiology_icon.svg';
+ static const String monthly_reports_icon = '$svgBasePath/monthly_reports_icon.svg';
+ static const String medical_reports_icon = '$svgBasePath/medical_reports_icon.svg';
+ static const String sick_leave_report_icon = '$svgBasePath/sick_leave_report_icon.svg';
+ static const String update_insurance_icon = '$svgBasePath/update_insurance_icon.svg';
+ static const String insurance_approval_icon = '$svgBasePath/insurance_approval_icon.svg';
+ static const String invoices_list_icon = '$svgBasePath/invoices_list_icon.svg';
+ static const String ancillary_orders_list_icon = '$svgBasePath/ancillary_orders_list_icon.svg';
+ static const String daily_water_monitor_icon = '$svgBasePath/daily_water_monitor.svg';
+ static const String health_calculators_services_icon = '$svgBasePath/health_calculators_services_icon.svg';
+ static const String health_converters_icon = '$svgBasePath/health_converters_icon.svg';
+ static const String smartwatch_icon = '$svgBasePath/smartwatch_icon.svg';
//bottom navigation//
static const String homeBottom = '$svgBasePath/home_bottom.svg';
diff --git a/lib/core/dependencies.dart b/lib/core/dependencies.dart
index 4c17de6..054819e 100644
--- a/lib/core/dependencies.dart
+++ b/lib/core/dependencies.dart
@@ -39,6 +39,7 @@ import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_mo
import 'package:hmg_patient_app_new/features/profile_settings/profile_settings_view_model.dart';
import 'package:hmg_patient_app_new/features/radiology/radiology_repo.dart';
import 'package:hmg_patient_app_new/features/radiology/radiology_view_model.dart';
+import 'package:hmg_patient_app_new/features/smartwatch_health_data/health_provider.dart';
import 'package:hmg_patient_app_new/features/symptoms_checker/symptoms_checker_repo.dart';
import 'package:hmg_patient_app_new/features/symptoms_checker/symptoms_checker_view_model.dart';
import 'package:hmg_patient_app_new/features/todo_section/todo_section_repo.dart';
@@ -232,6 +233,10 @@ class AppDependencies {
() => BloodDonationViewModel(bloodDonationRepo: getIt(), errorHandlerService: getIt(), navigationService: getIt(), dialogService: getIt(), appState: getIt()),
);
+ getIt.registerLazySingleton(
+ () => HealthProvider(),
+ );
+
// Screen-specific VMs → Factory
// getIt.registerFactory(
// () => BookAppointmentsViewModel(
diff --git a/lib/core/utils/utils.dart b/lib/core/utils/utils.dart
index 857c0c2..397adad 100644
--- a/lib/core/utils/utils.dart
+++ b/lib/core/utils/utils.dart
@@ -913,14 +913,14 @@ class Utils {
return AppColors.primaryRedColor;
}
- static String getCardButtonText(int currentQueueStatus) {
+ static String getCardButtonText(int currentQueueStatus, String roomNumber) {
switch (currentQueueStatus) {
case 0:
return "Please wait! you will be called for vital signs".needTranslation;
case 1:
- return "Please visit Room S5 for vital signs".needTranslation;
+ return "Please visit Room $roomNumber for vital signs".needTranslation;
case 2:
- return "Please visit Room S5 to the Doctor".needTranslation;
+ return "Please visit Room $roomNumber to the Doctor".needTranslation;
}
return "";
}
diff --git a/lib/features/authentication/authentication_view_model.dart b/lib/features/authentication/authentication_view_model.dart
index fa16423..faedcd8 100644
--- a/lib/features/authentication/authentication_view_model.dart
+++ b/lib/features/authentication/authentication_view_model.dart
@@ -586,6 +586,7 @@ class AuthenticationViewModel extends ChangeNotifier {
activation.list!.first.bloodGroup = activation.patientBlodType;
_appState.setAuthenticatedUser(activation.list!.first);
_appState.setPrivilegeModelList(activation.list!.first.listPrivilege!);
+ _appState.setUserBloodGroup = activation.patientBlodType ?? "N/A";
}
// _appState.setUserBloodGroup = (activation.patientBlodType ?? "");
_appState.setAppAuthToken = activation.authenticationTokenId;
diff --git a/lib/features/my_appointments/models/resp_models/patient_queue_details_response_model.dart b/lib/features/my_appointments/models/resp_models/patient_queue_details_response_model.dart
new file mode 100644
index 0000000..c36b9ec
--- /dev/null
+++ b/lib/features/my_appointments/models/resp_models/patient_queue_details_response_model.dart
@@ -0,0 +1,40 @@
+class PatientQueueDetails {
+ int? patientID;
+ String? patientName;
+ String? queueNo;
+ int? callType;
+ String? roomNo;
+ String? calledOn;
+ bool? servingNow;
+
+ PatientQueueDetails(
+ {this.patientID,
+ this.patientName,
+ this.queueNo,
+ this.callType,
+ this.roomNo,
+ this.calledOn,
+ this.servingNow});
+
+ PatientQueueDetails.fromJson(Map json) {
+ patientID = json['patientID'];
+ patientName = json['patientName'];
+ queueNo = json['queueNo'];
+ callType = json['callType'];
+ roomNo = json['roomNo'];
+ calledOn = json['calledOn'];
+ servingNow = json['servingNow'];
+ }
+
+ Map toJson() {
+ final Map data = new Map();
+ data['patientID'] = this.patientID;
+ data['patientName'] = this.patientName;
+ data['queueNo'] = this.queueNo;
+ data['callType'] = this.callType;
+ data['roomNo'] = this.roomNo;
+ data['calledOn'] = this.calledOn;
+ data['servingNow'] = this.servingNow;
+ return data;
+ }
+}
diff --git a/lib/features/my_appointments/my_appointments_repo.dart b/lib/features/my_appointments/my_appointments_repo.dart
index 87ec10d..3308f93 100644
--- a/lib/features/my_appointments/my_appointments_repo.dart
+++ b/lib/features/my_appointments/my_appointments_repo.dart
@@ -13,6 +13,7 @@ import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart' show HospitalsModel;
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_share_response_model.dart';
+import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_queue_details_response_model.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart';
abstract class MyAppointmentsRepo {
@@ -58,6 +59,8 @@ abstract class MyAppointmentsRepo {
Future>> sendAskDocCallRequest(
{required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel, required String requestType, required String remarks, required String userMobileNumber});
+
+ Future>>> getPatientAppointmentQueueDetails({required int appointmentNo, required int patientID});
}
class MyAppointmentsRepoImp implements MyAppointmentsRepo {
@@ -746,4 +749,35 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
return Left(UnknownFailure(e.toString()));
}
}
+
+ @override
+ Future>>> getPatientAppointmentQueueDetails({required int appointmentNo, required int patientID}) async {
+ Map mapDevice = {"appointmentNo": appointmentNo, "patientID": patientID, "apiKey": "EE17D21C7943485D9780223CCE55DCE5"};
+ try {
+ GenericApiModel>? apiResponse;
+ Failure? failure;
+ await apiClient.post(ApiConsts.QLINE_URL, onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ }, onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ try {
+ final list = response['data'];
+ final queueList = list.map((item) => PatientQueueDetails.fromJson(item as Map)).toList().cast();
+
+ apiResponse = GenericApiModel>(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: null,
+ data: queueList,
+ );
+ } catch (e) {
+ failure = DataParsingFailure(e.toString());
+ }
+ }, body: mapDevice, isExternal: true, isAllowAny: true);
+ if (failure != null) return Left(failure!);
+ if (apiResponse == null) return Left(ServerFailure("Unknown error"));
+ return Right(apiResponse!);
+ } catch (e) {
+ return Left(UnknownFailure(e.toString()));
+ }
+ }
}
diff --git a/lib/features/my_appointments/my_appointments_view_model.dart b/lib/features/my_appointments/my_appointments_view_model.dart
index 71e0312..7dfef90 100644
--- a/lib/features/my_appointments/my_appointments_view_model.dart
+++ b/lib/features/my_appointments/my_appointments_view_model.dart
@@ -6,6 +6,7 @@ import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/get_tamara_installments_details_response_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_share_response_model.dart';
+import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_queue_details_response_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_repo.dart';
import 'package:hmg_patient_app_new/features/my_appointments/utils/appointment_type.dart';
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
@@ -37,8 +38,11 @@ class MyAppointmentsViewModel extends ChangeNotifier {
DateTime? start = null;
DateTime? end = null;
+ bool isAppointmentQueueDetailsLoading = false;
bool isPatientHasQueueAppointment = false;
int currentQueueStatus = 0;
+ List patientQueueDetailsList = [];
+ late PatientQueueDetails currentPatientQueueDetails;
List patientAppointmentsHistoryList = [];
List filteredAppointmentList = [];
@@ -88,7 +92,7 @@ class MyAppointmentsViewModel extends ChangeNotifier {
isTamaraDetailsLoading = true;
isAppointmentPatientShareLoading = true;
isEyeMeasurementsAppointmentsLoading = true;
- isPatientHasQueueAppointment = false;
+
notifyListeners();
}
@@ -218,6 +222,10 @@ class MyAppointmentsViewModel extends ChangeNotifier {
patientAppointmentsHistoryList.addAll(patientArrivedAppointmentsHistoryList);
filteredAppointmentList.addAll(patientAppointmentsHistoryList);
+ if (patientArrivedAppointmentsHistoryList.isNotEmpty) {
+ getPatientAppointmentQueueDetails(appointmentNo: patientArrivedAppointmentsHistoryList.first.appointmentNo, patientID: patientArrivedAppointmentsHistoryList.first.patientID);
+ }
+
print('Upcoming Appointments: ${patientUpcomingAppointmentsHistoryList.length}');
print('Arrived Appointments: ${patientArrivedAppointmentsHistoryList.length}');
print('All Appointments: ${patientAppointmentsHistoryList.length}');
@@ -659,6 +667,50 @@ class MyAppointmentsViewModel extends ChangeNotifier {
);
}
+ Future getPatientAppointmentQueueDetails({required int appointmentNo, required int patientID, Function(dynamic)? onSuccess, Function(String)? onError}) async {
+ isAppointmentQueueDetailsLoading = true;
+ notifyListeners();
+ final result = await myAppointmentsRepo.getPatientAppointmentQueueDetails(appointmentNo: appointmentNo, patientID: patientID);
+
+ isAppointmentQueueDetailsLoading = false;
+
+ result.fold(
+ // (failure) async => await errorHandlerService.handleError(failure: failure),
+ (failure) async {
+ if (onError != null) {
+ onError(failure.message);
+ }
+ },
+ (apiResponse) {
+ if (apiResponse.messageStatus == 2) {
+ onError!(apiResponse.errorMessage!);
+ } else if (apiResponse.messageStatus == 1) {
+ if (apiResponse.data != null && apiResponse.data!.isNotEmpty) {
+ isPatientHasQueueAppointment = true;
+ patientQueueDetailsList = apiResponse.data!;
+ for (var element in patientQueueDetailsList) {
+ if (element.patientID == patientID) {
+ currentPatientQueueDetails = element;
+ currentQueueStatus = element.callType!;
+ // currentQueueStatus = 2;
+ break;
+ }
+ }
+ // patientQueueDetailsList.first.callType = 1;
+
+ patientQueueDetailsList.removeWhere((element) => element.patientID == patientID);
+ } else {
+ isPatientHasQueueAppointment = false;
+ }
+ notifyListeners();
+ if (onSuccess != null) {
+ onSuccess(apiResponse.data);
+ }
+ }
+ },
+ );
+ }
+
Future sendAskDocCallRequest({
required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel,
required String requestType,
diff --git a/lib/features/smartwatch_health_data/health_provider.dart b/lib/features/smartwatch_health_data/health_provider.dart
new file mode 100644
index 0000000..fc9dacc
--- /dev/null
+++ b/lib/features/smartwatch_health_data/health_provider.dart
@@ -0,0 +1,85 @@
+import 'package:flutter/foundation.dart';
+import 'package:health/health.dart';
+import 'package:hmg_patient_app_new/features/smartwatch_health_data/health_service.dart';
+
+class HealthProvider with ChangeNotifier {
+ final HealthService _healthService = HealthService();
+ Map> healthData = {};
+ bool isLoading = false;
+ String? error;
+ String selectedTimeRange = '7D';
+ int selectedTabIndex = 0;
+
+ void onTabChanged(int index) {
+ selectedTabIndex = index;
+ notifyListeners();
+ }
+
+ Future fetchHealthData() async {
+ isLoading = true;
+ error = null;
+ notifyListeners();
+ healthData.clear();
+ try {
+ final authorized = await _healthService.requestAuthorization();
+ if (!authorized) {
+ error = 'Health data access not authorized';
+ isLoading = false;
+ notifyListeners();
+ return;
+ }
+
+ final startTime = _getStartDate();
+ final endTime = DateTime.now();
+
+ healthData = await _healthService.getAllHealthData(startTime, endTime);
+
+ isLoading = false;
+ notifyListeners();
+ } catch (e) {
+ error = 'Error fetching health data: $e';
+ isLoading = false;
+ notifyListeners();
+ }
+ }
+
+ Future refreshMetric(HealthDataType type) async {
+ try {
+ final startTime = _getStartDate();
+ final endTime = DateTime.now();
+
+ final data = await _healthService.getSpecificHealthData(
+ type,
+ startTime,
+ endTime,
+ );
+
+ healthData[type] = data;
+ notifyListeners();
+ } catch (e) {
+ print('Error refreshing metric $type: $e');
+ }
+ }
+
+ void updateTimeRange(String range) {
+ selectedTimeRange = range;
+ fetchHealthData();
+ }
+
+ DateTime _getStartDate() {
+ switch (selectedTimeRange) {
+ case '1D':
+ return DateTime.now().subtract(const Duration(days: 1));
+ case '7D':
+ return DateTime.now().subtract(const Duration(days: 7));
+ case '1M':
+ return DateTime.now().subtract(const Duration(days: 30));
+ case '3M':
+ return DateTime.now().subtract(const Duration(days: 90));
+ case '1Y':
+ return DateTime.now().subtract(const Duration(days: 365));
+ default:
+ return DateTime.now().subtract(const Duration(days: 7));
+ }
+ }
+}
diff --git a/lib/features/smartwatch_health_data/health_service.dart b/lib/features/smartwatch_health_data/health_service.dart
new file mode 100644
index 0000000..c5dca48
--- /dev/null
+++ b/lib/features/smartwatch_health_data/health_service.dart
@@ -0,0 +1,166 @@
+import 'dart:io';
+
+import 'package:easy_localization/easy_localization.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:health/health.dart';
+import 'package:permission_handler/permission_handler.dart';
+
+import 'health_utils.dart';
+
+class HealthService {
+ static final HealthService _instance = HealthService._internal();
+
+ factory HealthService() => _instance;
+
+ HealthService._internal();
+
+ final Health health = Health();
+
+ final List _healthMetrics = [
+ HealthDataType.HEART_RATE,
+ // HealthDataType.STEPS,
+ // HealthDataType.BLOOD_OXYGEN,
+ // HealthDataType.BLOOD_PRESSURE_SYSTOLIC,
+ // HealthDataType.BLOOD_PRESSURE_DIASTOLIC,
+ // HealthDataType.BODY_TEMPERATURE,
+ // HealthDataType.DISTANCE_WALKING_RUNNING,
+ // HealthDataType.ACTIVE_ENERGY_BURNED,
+ ];
+
+ final List _healthMetricsAndroid = [
+ HealthDataType.HEART_RATE,
+ HealthDataType.STEPS,
+ HealthDataType.BLOOD_OXYGEN,
+ // HealthDataType.BLOOD_PRESSURE_SYSTOLIC,
+ // HealthDataType.BLOOD_PRESSURE_DIASTOLIC,
+ // HealthDataType.BODY_TEMPERATURE,
+ HealthDataType.DISTANCE_DELTA,
+ HealthDataType.ACTIVE_ENERGY_BURNED,
+ HealthDataType.BASAL_ENERGY_BURNED,
+ HealthDataType.TOTAL_CALORIES_BURNED
+ ];
+
+ final List _healthPermissions = [
+ HealthDataType.HEART_RATE,
+ HealthDataType.STEPS,
+ HealthDataType.BLOOD_OXYGEN,
+ // HealthDataType.BLOOD_PRESSURE_SYSTOLIC,
+ // HealthDataType.BLOOD_PRESSURE_DIASTOLIC,
+ // HealthDataType.BODY_TEMPERATURE,
+ Platform.isAndroid ? HealthDataType.DISTANCE_DELTA : HealthDataType.DISTANCE_WALKING_RUNNING,
+ HealthDataType.ACTIVE_ENERGY_BURNED,
+ HealthDataType.BASAL_ENERGY_BURNED,
+ HealthDataType.TOTAL_CALORIES_BURNED
+ ];
+
+ final List _healthMetricsCumulative = [
+ HealthDataType.BLOOD_OXYGEN,
+ HealthDataType.STEPS,
+ Platform.isAndroid ? HealthDataType.DISTANCE_DELTA : HealthDataType.DISTANCE_WALKING_RUNNING,
+ HealthDataType.ACTIVE_ENERGY_BURNED,
+ HealthDataType.BASAL_ENERGY_BURNED,
+ HealthDataType.TOTAL_CALORIES_BURNED
+ ];
+
+ Future requestAuthorization() async {
+ try {
+ final types = (Platform.isAndroid) ? dataTypesAndroid : _healthPermissions;
+ final granted = await health.requestAuthorization(types);
+ await Permission.activityRecognition.request();
+ await Permission.location.request();
+ // request access to read historic data
+ await Health().requestHealthDataHistoryAuthorization();
+ // await authorize();
+ return granted;
+ } catch (e) {
+ print('Authorization error: $e');
+ return false;
+ }
+ }
+
+ Future