diff --git a/assets/images/svg/blood_pressure_icon.svg b/assets/images/svg/blood_pressure_icon.svg
new file mode 100644
index 0000000..0b027ad
--- /dev/null
+++ b/assets/images/svg/blood_pressure_icon.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/images/svg/blood_sugar_only_icon.svg b/assets/images/svg/blood_sugar_only_icon.svg
new file mode 100644
index 0000000..f81cee8
--- /dev/null
+++ b/assets/images/svg/blood_sugar_only_icon.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/svg/low_indicator_icon.svg b/assets/images/svg/low_indicator_icon.svg
new file mode 100644
index 0000000..f2ca09f
--- /dev/null
+++ b/assets/images/svg/low_indicator_icon.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/svg/normal_status_green_icon.svg b/assets/images/svg/normal_status_green_icon.svg
new file mode 100644
index 0000000..b3f2619
--- /dev/null
+++ b/assets/images/svg/normal_status_green_icon.svg
@@ -0,0 +1,7 @@
+
diff --git a/assets/images/svg/send_email_icon.svg b/assets/images/svg/send_email_icon.svg
new file mode 100644
index 0000000..eb8684a
--- /dev/null
+++ b/assets/images/svg/send_email_icon.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/svg/weight_icon.svg b/assets/images/svg/weight_icon.svg
new file mode 100644
index 0000000..f93c662
--- /dev/null
+++ b/assets/images/svg/weight_icon.svg
@@ -0,0 +1,3 @@
+
diff --git a/lib/core/api/api_client.dart b/lib/core/api/api_client.dart
index f366329..039787b 100644
--- a/lib/core/api/api_client.dart
+++ b/lib/core/api/api_client.dart
@@ -210,7 +210,7 @@ class ApiClientImp implements ApiClient {
final int statusCode = response.statusCode;
log("uri: ${Uri.parse(url.trim())}");
log("body: ${json.encode(body)}");
- // log("response.body: ${response.body}");
+ log("response.body: ${response.body}");
if (statusCode < 200 || statusCode >= 400) {
onFailure('Error While Fetching data', statusCode, failureType: StatusCodeFailure("Error While Fetching data"));
logApiEndpointError(endPoint, 'Error While Fetching data', statusCode);
diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart
index c103291..07f9ee5 100644
--- a/lib/core/api_consts.dart
+++ b/lib/core/api_consts.dart
@@ -398,19 +398,6 @@ var GET_COVID_DRIVETHRU_PROCEDURES_LIST = 'Services/Doctors.svc/REST/COVID19_Get
var GET_PATIENT_LAST_RECORD = 'Services/Patients.svc/REST/Med_GetPatientLastRecord';
var INSERT_PATIENT_HEALTH_DATA = 'Services/Patients.svc/REST/Med_InsertTransactions';
-///My Trackers
-var GET_DIABETIC_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetDiabeticResultAverage';
-var GET_DIABTEC_RESULT = 'Services/Patients.svc/REST/Patient_GetDiabtecResults';
-var ADD_DIABTEC_RESULT = 'Services/Patients.svc/REST/Patient_AddDiabtecResult';
-
-var GET_BLOOD_PRESSURE_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetBloodPressureResultAverage';
-var GET_BLOOD_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_GetBloodPressureResult';
-var ADD_BLOOD_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_AddBloodPressureResult';
-
-var GET_WEIGHT_PRESSURE_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResultAverage';
-var GET_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResult';
-var ADD_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_AddWeightMeasurementResult';
-
var ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID = 'Services/Patients.svc/Rest/GetActivePrescriptionReportByPatientID';
var GET_CALL_INFO_HOURS_RESULT = 'Services/Doctors.svc/REST/GetCallInfoHoursResult';
@@ -420,7 +407,6 @@ var GET_QUESTION_TYPES = 'Services/OUTPs.svc/REST/getQuestionsTypes';
var UPDATE_DIABETIC_RESULT = 'Services/Patients.svc/REST/Patient_UpdateDiabeticResult';
-var SEND_AVERAGE_BLOOD_SUGAR_REPORT = 'Services/Notifications.svc/REST/SendAverageBloodSugarReport';
var DEACTIVATE_DIABETIC_STATUS = 'services/Patients.svc/REST/Patient_DeactivateDiabeticStatus';
var DEACTIVATE_BLOOD_PRESSURES_STATUS = 'services/Patients.svc/REST/Patient_DeactivateBloodPressureStatus';
@@ -825,11 +811,12 @@ class ApiConsts {
static final String updateHHCOrder = 'api/hhc/update';
static final String addHHCOrder = 'api/HHC/add';
- // SYMPTOMS CHECKER
+ // SYMPTOMS CHECKER API
+ static final String symptomsUserLogin = '$symptomsCheckerApi/user_login';
static final String getBodySymptomsByName = '$symptomsCheckerApi/GetBodySymptomsByName';
static final String getRiskFactors = '$symptomsCheckerApi/GetRiskFactors';
static final String getSuggestions = '$symptomsCheckerApi/GetSuggestion';
- static final String diagnosis = '$symptomsCheckerApi/diagnosis';
+ static final String diagnosis = '$symptomsCheckerApi/GetDiagnosis';
static final String explain = '$symptomsCheckerApi/explain';
//E-REFERRAL SERVICES
@@ -848,6 +835,31 @@ class ApiConsts {
static String h2oUpdateUserDetail = "Services/H2ORemainder.svc/REST/H2O_UpdateUserDetails_New";
static String h2oUndoUserActivity = "Services/H2ORemainder.svc/REST/H2o_UndoUserActivity";
+ // HEALTH TRACKERS
+ // Blood Sugar (Diabetic)
+ static String getDiabeticResultAverage = 'Services/Patients.svc/REST/Patient_GetDiabeticResultAverage';
+ static String getDiabeticResult = 'Services/Patients.svc/REST/Patient_GetDiabtecResults';
+ static String addDiabeticResult = 'Services/Patients.svc/REST/Patient_AddDiabtecResult';
+ static String updateDiabeticResult = 'Services/Patients.svc/REST/Patient_UpdateDiabtecResult';
+ static String deactivateDiabeticStatus = 'Services/Patients.svc/REST/Patient_DeactivateDiabeticStatus';
+ static String sendAverageBloodSugarReport = 'Services/Notifications.svc/REST/SendAverageBloodSugarReport';
+
+ // Blood Pressure
+ static String getBloodPressureResultAverage = 'Services/Patients.svc/REST/Patient_GetBloodPressureResultAverage';
+ static String getBloodPressureResult = 'Services/Patients.svc/REST/Patient_GetBloodPressureResult';
+ static String addBloodPressureResult = 'Services/Patients.svc/REST/Patient_AddBloodPressureResult';
+ static String updateBloodPressureResult = 'Services/Patients.svc/REST/Patient_UpdateBloodPressureResult';
+ static String deactivateBloodPressureStatus = 'Services/Patients.svc/REST/Patient_DeactivateBloodPressureStatus';
+ static String sendAverageBloodPressureReport = 'Services/Notifications.svc/REST/SendAverageBloodPressureReport';
+
+ // Weight Measurement
+ static String getWeightMeasurementResultAverage = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResultAverage';
+ static String getWeightMeasurementResult = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResult';
+ static String addWeightMeasurementResult = 'Services/Patients.svc/REST/Patient_AddWeightMeasurementResult';
+ static String updateWeightMeasurementResult = 'Services/Patients.svc/REST/Patient_UpdateWeightMeasurementResult';
+ static String deactivateWeightMeasurementStatus = 'Services/Patients.svc/REST/Patient_DeactivateWeightMeasurementStatus';
+ static String sendAverageBodyWeightReport = 'Services/Notifications.svc/REST/SendAverageBodyWeightReport';
+
//Blood Donation
static String bloodGroupUpdate = "Services/PatientVarification.svc/REST/BloodDonation_RegisterBloodType";
static String userAgreementForBloodGroupUpdate = "Services/PatientVarification.svc/REST/AddUserAgreementForBloodDonation";
diff --git a/lib/core/app_assets.dart b/lib/core/app_assets.dart
index 9763758..c470bc2 100644
--- a/lib/core/app_assets.dart
+++ b/lib/core/app_assets.dart
@@ -270,16 +270,21 @@ class AppAssets {
static const String yellowArrowDownIcon = '$svgBasePath/yellow_arrow_down_icon.svg';
static const String greenTickIcon = '$svgBasePath/green_tick_icon.svg';
- // PNGS
-
-
static const String bloodSugar = '$svgBasePath/bloodsugar.svg';
static const String bloodCholestrol = '$svgBasePath/bloodcholestrol.svg';
static const String triglycerides = '$svgBasePath/triglycerides.svg';
static const String bulb = '$svgBasePath/bulb.svg';
static const String switchBtn = '$svgBasePath/switch.svg';
+ //Health Trackers
+ static const String bloodPressureIcon = '$svgBasePath/blood_pressure_icon.svg';
+ static const String bloodSugarOnlyIcon = '$svgBasePath/blood_sugar_only_icon.svg';
+ static const String weightIcon = '$svgBasePath/weight_icon.svg';
+ static const String normalStatusGreenIcon = '$svgBasePath/normal_status_green_icon.svg';
+ static const String sendEmailIcon = '$svgBasePath/send_email_icon.svg';
+ static const String lowIndicatorIcon = '$svgBasePath/low_indicator_icon.svg';
+ // Health Calculators
static const String ovulationAccordion = '$svgBasePath/approximate_ovulation_accordion.svg';
static const String nextPeriodAccordion = '$svgBasePath/next_period_accordion.svg';
static const String fertileAccordion = '$svgBasePath/fertile_window_accordion.svg';
@@ -288,9 +293,7 @@ class AppAssets {
static const String covid19icon = '$svgBasePath/covid_19.svg';
-
//vital sign
-
static const String heartRate = '$svgBasePath/heart_rate.svg';
static const String respRate = '$svgBasePath/resp_rate.svg';
static const String weightVital = '$svgBasePath/weight_2.svg';
@@ -299,8 +302,6 @@ class AppAssets {
static const String bloodPressure = '$svgBasePath/blood_pressure.svg';
static const String temperature = '$svgBasePath/temperature.svg';
-
-
// PNGS //
static const String hmgLogo = '$pngBasePath/hmg_logo.png';
static const String liveCareService = '$pngBasePath/livecare_service.png';
@@ -327,8 +328,6 @@ class AppAssets {
static const String fullBodyFront = '$pngBasePath/full_body_front.png';
static const String fullBodyBack = '$pngBasePath/full_body_back.png';
static const String bmiFullBody = '$pngBasePath/bmi_image_1.png';
-
-
}
class AppAnimations {
@@ -349,6 +348,4 @@ class AppAnimations {
static const String ambulance = '$lottieBasePath/ambulance.json';
static const String ambulanceAlert = '$lottieBasePath/ambulance_alert.json';
static const String rrtAmbulance = '$lottieBasePath/rrt_ambulance.json';
-
-
}
diff --git a/lib/core/dependencies.dart b/lib/core/dependencies.dart
index 7db5d41..582b795 100644
--- a/lib/core/dependencies.dart
+++ b/lib/core/dependencies.dart
@@ -18,6 +18,7 @@ import 'package:hmg_patient_app_new/features/emergency_services/emergency_servic
import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_model.dart';
import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_repo.dart';
import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart';
+import 'package:hmg_patient_app_new/features/health_trackers/health_trackers_repo.dart';
import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_repo.dart';
import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart';
import 'package:hmg_patient_app_new/features/immediate_livecare/immediate_livecare_repo.dart';
@@ -52,6 +53,7 @@ import 'package:hmg_patient_app_new/features/todo_section/todo_section_repo.dart
import 'package:hmg_patient_app_new/features/todo_section/todo_section_view_model.dart';
import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_repo.dart';
import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_view_model.dart';
+import 'package:hmg_patient_app_new/presentation/health_trackers/health_trackers_view_model.dart';
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
import 'package:hmg_patient_app_new/services/cache_service.dart';
import 'package:hmg_patient_app_new/services/dialog_service.dart';
@@ -143,6 +145,7 @@ class AppDependencies {
getIt.registerLazySingleton(() => BloodDonationRepoImp(loggerService: getIt(), apiClient: getIt()));
getIt.registerLazySingleton(() => WaterMonitorRepoImp(loggerService: getIt(), apiClient: getIt()));
getIt.registerLazySingleton(() => MyInvoicesRepoImp(loggerService: getIt(), apiClient: getIt()));
+ getIt.registerLazySingleton(() => HealthTrackersRepoImp(loggerService: getIt(), apiClient: getIt()));
getIt.registerLazySingleton(() => MonthlyReportRepoImp(loggerService: getIt(), apiClient: getIt()));
// ViewModels
@@ -260,10 +263,16 @@ class AppDependencies {
getIt.registerLazySingleton(() => HealthProvider());
- getIt.registerLazySingleton(() => WaterMonitorViewModel(waterMonitorRepo: getIt()));
+ getIt.registerLazySingleton(() => WaterMonitorViewModel(waterMonitorRepo: getIt(), errorHandlerService: getIt()));
getIt.registerLazySingleton(() => MyInvoicesViewModel(myInvoicesRepo: getIt(), errorHandlerService: getIt(), navServices: getIt()));
getIt.registerLazySingleton(() => MonthlyReportViewModel(errorHandlerService: getIt(), monthlyReportRepo: getIt()));
+ getIt.registerLazySingleton(() => MyInvoicesViewModel(
+ myInvoicesRepo: getIt(),
+ errorHandlerService: getIt(),
+ navServices: getIt(),
+ ));
+ getIt.registerLazySingleton(() => HealthTrackersViewModel(healthTrackersRepo: getIt(), errorHandlerService: getIt()));
}
}
diff --git a/lib/core/enums.dart b/lib/core/enums.dart
index 8fd4818..6dc3bf6 100644
--- a/lib/core/enums.dart
+++ b/lib/core/enums.dart
@@ -16,7 +16,7 @@ enum CountryEnum { saudiArabia, unitedArabEmirates }
enum CalenderEnum { gregorian, hijri }
-enum SelectionTypeEnum { dropdown, calendar, search }
+enum SelectionTypeEnum { dropdown, calendar, search, time }
enum GenderTypeEnum { male, female }
@@ -38,7 +38,19 @@ enum HealthCalConEnum { calculator, converter }
enum HealthCalculatorEnum { general, women }
-enum HealthCalculatorsTypeEnum { bmi, calories, bmr, idealBodyWeight, bodyFat, crabsProteinFat, ovulation, deliveryDueDate, bloodSugar, bloodCholesterol, triglycerides }
+enum HealthCalculatorsTypeEnum {
+ bmi,
+ calories,
+ bmr,
+ idealBodyWeight,
+ bodyFat,
+ crabsProteinFat,
+ ovulation,
+ deliveryDueDate,
+ bloodSugar,
+ bloodCholesterol,
+ triglycerides
+}
extension HealthCalculatorExtenshion on HealthCalculatorsTypeEnum {
String get displayName {
@@ -297,3 +309,5 @@ extension ServiceTypeEnumExt on ServiceTypeEnum {
// SymptomsChecker
enum PossibleConditionsSeverityEnum { seekMedicalAdvice, monitorOnly, emergency }
+
+enum HealthTrackerTypeEnum { bloodSugar, bloodPressure, weightTracker }
diff --git a/lib/core/utils/size_utils.dart b/lib/core/utils/size_utils.dart
index 4fdc09c..02b8195 100644
--- a/lib/core/utils/size_utils.dart
+++ b/lib/core/utils/size_utils.dart
@@ -7,16 +7,14 @@ import 'package:flutter/material.dart'; // These are the Viewport values of your
const num figmaDesignWidth = 375; // iPhone X / 12 base width
const num figmaDesignHeight = 812; // iPhone X / 12 base height
-
extension ConstrainedResponsive on num {
/// Width with max cap for tablets
- double get wCapped => isTablet ? math.min( w, this * 1.3) : w;
+ double get wCapped => isTablet ? math.min(w, this * 1.3) : w;
/// Height with max cap for tablets
double get hCapped => isTablet ? math.min(h, this * 1.3) : h;
}
-
extension ResponsiveExtension on num {
double get _screenWidth => SizeUtils.width;
diff --git a/lib/core/utils/utils.dart b/lib/core/utils/utils.dart
index 03ff6b5..f5ffd36 100644
--- a/lib/core/utils/utils.dart
+++ b/lib/core/utils/utils.dart
@@ -262,16 +262,6 @@ class Utils {
return await prefs.remove(key);
}
- static void showLoading({bool isNeedBinding = true}) {
- if (isNeedBinding) {
- WidgetsBinding.instance.addPostFrameCallback((_) {
- showLoadingDialog();
- });
- } else {
- showLoadingDialog();
- }
- }
-
static void showLoadingDialog() {
_isLoadingVisible = true;
showDialog(
@@ -288,18 +278,6 @@ class Utils {
);
}
- static void hideLoading() {
- try {
- if (_isLoadingVisible) {
- _isLoadingVisible = false;
- Navigator.of(navigationService.navigatorKey.currentContext!).pop();
- }
- _isLoadingVisible = false;
- } catch (e) {
- log("errr: ${e.toString()}");
- }
- }
-
static List uniqueBy(List list, K Function(T) keySelector) {
final seenKeys = {};
return list.where((item) => seenKeys.add(keySelector(item))).toList();
diff --git a/lib/features/health_trackers/health_trackers_repo.dart b/lib/features/health_trackers/health_trackers_repo.dart
new file mode 100644
index 0000000..2a64fc4
--- /dev/null
+++ b/lib/features/health_trackers/health_trackers_repo.dart
@@ -0,0 +1,873 @@
+import 'package:dartz/dartz.dart';
+import 'package:hmg_patient_app_new/core/api/api_client.dart';
+import 'package:hmg_patient_app_new/core/api_consts.dart';
+import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
+import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
+import 'package:hmg_patient_app_new/services/logger_service.dart';
+
+/// Progress types to request different ranges from the progress API.
+enum ProgressType { today, week, month }
+
+abstract class HealthTrackersRepo {
+ // ==================== BLOOD SUGAR (DIABETIC) ====================
+ /// Get blood sugar result averages (week, month, year).
+ Future>> getDiabeticResultAverage();
+
+ /// Get blood sugar results (week, month, year).
+ Future>> getDiabeticResults();
+
+ /// Add new blood sugar result.
+ Future>> addDiabeticResult({
+ required String bloodSugarDateChart,
+ required String bloodSugarResult,
+ required String diabeticUnit,
+ required int measuredTime,
+ });
+
+ /// Update existing blood sugar result.
+ Future>> updateDiabeticResult({
+ required DateTime month,
+ required DateTime hour,
+ required String bloodSugarResult,
+ required String diabeticUnit,
+ required int measuredTime,
+ required int lineItemNo,
+ });
+
+ /// Deactivate blood sugar record.
+ Future>> deactivateDiabeticStatus({
+ required int lineItemNo,
+ });
+
+ /// Send blood sugar report by email.
+ Future>> sendBloodSugarReportByEmail({
+ required String email,
+ });
+
+ // ==================== BLOOD PRESSURE ====================
+ /// Get blood pressure result averages (week, month, year).
+ Future>> getBloodPressureResultAverage();
+
+ /// Get blood pressure results (week, month, year).
+ Future>> getBloodPressureResults();
+
+ /// Add new blood pressure result.
+ Future>> addBloodPressureResult({
+ required String bloodPressureDate,
+ required String diastolicPressure,
+ required String systolicePressure,
+ required int measuredArm,
+ });
+
+ /// Update existing blood pressure result.
+ Future>> updateBloodPressureResult({
+ required String bloodPressureDate,
+ required String diastolicPressure,
+ required String systolicePressure,
+ required int measuredArm,
+ required int lineItemNo,
+ });
+
+ /// Deactivate blood pressure record.
+ Future>> deactivateBloodPressureStatus({
+ required int lineItemNo,
+ });
+
+ /// Send blood pressure report by email.
+ Future>> sendBloodPressureReportByEmail({
+ required String email,
+ });
+
+ // ==================== WEIGHT MEASUREMENT ====================
+ /// Get weight measurement result averages (week, month, year).
+ Future>> getWeightMeasurementResultAverage();
+
+ /// Get weight measurement results (week, month, year).
+ Future>> getWeightMeasurementResults();
+
+ /// Add new weight measurement result.
+ Future>> addWeightMeasurementResult({
+ required String weightDate,
+ required String weightMeasured,
+ required int weightUnit,
+ });
+
+ /// Update existing weight measurement result.
+ Future>> updateWeightMeasurementResult({
+ required int lineItemNo,
+ required int weightUnit,
+ required String weightMeasured,
+ required String weightDate,
+ });
+
+ /// Deactivate weight measurement record.
+ Future>> deactivateWeightMeasurementStatus({
+ required int lineItemNo,
+ });
+
+ /// Send weight report by email.
+ Future>> sendWeightReportByEmail({
+ required String email,
+ });
+}
+
+class HealthTrackersRepoImp implements HealthTrackersRepo {
+ final ApiClient apiClient;
+ final LoggerService loggerService;
+
+ HealthTrackersRepoImp({required this.loggerService, required this.apiClient});
+
+ // ==================== BLOOD SUGAR (DIABETIC) METHODS ====================
+
+ @override
+ Future>> getDiabeticResultAverage() async {
+ try {
+ GenericApiModel? apiResponse;
+ Failure? failure;
+
+ await apiClient.post(
+ ApiConsts.getDiabeticResultAverage,
+ body: {},
+ onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ },
+ onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ try {
+ dynamic extracted;
+ if (response is Map) {
+ // Extract average lists
+ extracted = {
+ 'monthAverageList': response['List_MonthDiabtectResultAverage'] ?? [],
+ 'weekAverageList': response['List_WeekDiabtectResultAverage'] ?? [],
+ 'yearAverageList': response['List_YearDiabtecResultAverage'] ?? [],
+ };
+ } else {
+ extracted = response;
+ }
+
+ apiResponse = GenericApiModel(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: errorMessage,
+ data: extracted,
+ );
+ } catch (e) {
+ failure = DataParsingFailure(e.toString());
+ }
+ },
+ );
+
+ if (failure != null) return Left(failure!);
+ if (apiResponse == null) return Left(ServerFailure("Unknown error"));
+ return Right(apiResponse!);
+ } catch (e) {
+ return Left(UnknownFailure(e.toString()));
+ }
+ }
+
+ @override
+ Future>> getDiabeticResults() async {
+ try {
+ GenericApiModel? apiResponse;
+ Failure? failure;
+
+ await apiClient.post(
+ ApiConsts.getDiabeticResult,
+ body: {},
+ onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ },
+ onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ try {
+ dynamic extracted;
+ if (response is Map) {
+ // Extract patient result lists
+ extracted = {
+ 'monthResultList': response['List_MonthDiabtecPatientResult'] ?? [],
+ 'weekResultList': response['List_WeekDiabtecPatientResult'] ?? [],
+ 'yearResultList': response['List_YearDiabtecPatientResult'] ?? [],
+ };
+ } else {
+ extracted = response;
+ }
+
+ apiResponse = GenericApiModel(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: errorMessage,
+ data: extracted,
+ );
+ } catch (e) {
+ failure = DataParsingFailure(e.toString());
+ }
+ },
+ );
+
+ if (failure != null) return Left(failure!);
+ if (apiResponse == null) return Left(ServerFailure("Unknown error"));
+ return Right(apiResponse!);
+ } catch (e) {
+ return Left(UnknownFailure(e.toString()));
+ }
+ }
+
+ @override
+ Future>> addDiabeticResult({
+ required String bloodSugarDateChart,
+ required String bloodSugarResult,
+ required String diabeticUnit,
+ required int measuredTime,
+ }) async {
+ try {
+ GenericApiModel? apiResponse;
+ Failure? failure;
+
+ Map body = {
+ 'BloodSugerDateChart': bloodSugarDateChart,
+ 'BloodSugerResult': bloodSugarResult,
+ 'DiabtecUnit': diabeticUnit,
+ 'MeasuredTime': measuredTime + 1, // Add 1 as per old service
+ };
+
+ await apiClient.post(
+ ApiConsts.addDiabeticResult,
+ body: body,
+ onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ },
+ onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ apiResponse = GenericApiModel(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: errorMessage,
+ data: response,
+ );
+ },
+ );
+
+ if (failure != null) return Left(failure!);
+ if (apiResponse == null) return Left(ServerFailure("Unknown error"));
+ return Right(apiResponse!);
+ } catch (e) {
+ return Left(UnknownFailure(e.toString()));
+ }
+ }
+
+ @override
+ Future>> updateDiabeticResult({
+ required DateTime month,
+ required DateTime hour,
+ required String bloodSugarResult,
+ required String diabeticUnit,
+ required int measuredTime,
+ required int lineItemNo,
+ }) async {
+ try {
+ GenericApiModel? apiResponse;
+ Failure? failure;
+
+ // Format: 'YYYY-MM-DD HH:MM:SS' as per old service
+ String formattedDate = '${month.year}-${month.month}-${month.day} ${hour.hour}:${hour.minute}:00';
+
+ Map body = {
+ 'BloodSugerDateChart': formattedDate,
+ 'BloodSugerResult': bloodSugarResult,
+ 'DiabtecUnit': diabeticUnit,
+ 'MeasuredTime': measuredTime + 1, // Add 1 as per old service
+ 'LineItemNo': lineItemNo,
+ };
+
+ await apiClient.post(
+ ApiConsts.updateDiabeticResult,
+ body: body,
+ onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ },
+ onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ apiResponse = GenericApiModel(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: errorMessage,
+ data: response,
+ );
+ },
+ );
+
+ if (failure != null) return Left(failure!);
+ if (apiResponse == null) return Left(ServerFailure("Unknown error"));
+ return Right(apiResponse!);
+ } catch (e) {
+ return Left(UnknownFailure(e.toString()));
+ }
+ }
+
+ @override
+ Future>> deactivateDiabeticStatus({
+ required int lineItemNo,
+ }) async {
+ try {
+ GenericApiModel? apiResponse;
+ Failure? failure;
+
+ Map body = {
+ 'LineItemNo': lineItemNo,
+ };
+
+ await apiClient.post(
+ ApiConsts.deactivateDiabeticStatus,
+ body: body,
+ onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ },
+ onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ apiResponse = GenericApiModel(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: errorMessage,
+ data: response,
+ );
+ },
+ );
+
+ if (failure != null) return Left(failure!);
+ if (apiResponse == null) return Left(ServerFailure("Unknown error"));
+ return Right(apiResponse!);
+ } catch (e) {
+ return Left(UnknownFailure(e.toString()));
+ }
+ }
+
+ @override
+ Future>> sendBloodSugarReportByEmail({
+ required String email,
+ }) async {
+ try {
+ GenericApiModel? apiResponse;
+ Failure? failure;
+
+ Map body = {
+ 'To': email,
+ };
+
+ await apiClient.post(
+ ApiConsts.sendAverageBloodSugarReport,
+ body: body,
+ onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ },
+ onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ apiResponse = GenericApiModel(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: errorMessage,
+ data: response,
+ );
+ },
+ );
+
+ if (failure != null) return Left(failure!);
+ if (apiResponse == null) return Left(ServerFailure("Unknown error"));
+ return Right(apiResponse!);
+ } catch (e) {
+ return Left(UnknownFailure(e.toString()));
+ }
+ }
+
+ // ==================== BLOOD PRESSURE METHODS ====================
+
+ @override
+ Future>> getBloodPressureResultAverage() async {
+ try {
+ GenericApiModel? apiResponse;
+ Failure? failure;
+
+ await apiClient.post(
+ ApiConsts.getBloodPressureResultAverage,
+ body: {},
+ onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ },
+ onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ try {
+ dynamic extracted;
+ if (response is Map) {
+ // Extract all three list types
+ extracted = {
+ 'monthList': response['List_MonthBloodPressureResultAverage'] ?? [],
+ 'weekList': response['List_WeekBloodPressureResultAverage'] ?? [],
+ 'yearList': response['List_YearBloodPressureResultAverage'] ?? [],
+ };
+ } else {
+ extracted = response;
+ }
+
+ apiResponse = GenericApiModel(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: errorMessage,
+ data: extracted,
+ );
+ } catch (e) {
+ failure = DataParsingFailure(e.toString());
+ }
+ },
+ );
+
+ if (failure != null) return Left(failure!);
+ if (apiResponse == null) return Left(ServerFailure("Unknown error"));
+ return Right(apiResponse!);
+ } catch (e) {
+ return Left(UnknownFailure(e.toString()));
+ }
+ }
+
+ @override
+ Future>> getBloodPressureResults() async {
+ try {
+ GenericApiModel? apiResponse;
+ Failure? failure;
+
+ await apiClient.post(
+ ApiConsts.getBloodPressureResult,
+ body: {},
+ onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ },
+ onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ try {
+ dynamic extracted;
+ if (response is Map) {
+ // Extract all three list types
+ extracted = {
+ 'weekList': response['List_WeekBloodPressureResult'] ?? [],
+ 'monthList': response['List_MonthBloodPressureResult'] ?? [],
+ 'yearList': response['List_YearBloodPressureResult'] ?? [],
+ };
+ } else {
+ extracted = response;
+ }
+
+ apiResponse = GenericApiModel(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: errorMessage,
+ data: extracted,
+ );
+ } catch (e) {
+ failure = DataParsingFailure(e.toString());
+ }
+ },
+ );
+
+ if (failure != null) return Left(failure!);
+ if (apiResponse == null) return Left(ServerFailure("Unknown error"));
+ return Right(apiResponse!);
+ } catch (e) {
+ return Left(UnknownFailure(e.toString()));
+ }
+ }
+
+ @override
+ Future>> addBloodPressureResult({
+ required String bloodPressureDate,
+ required String diastolicPressure,
+ required String systolicePressure,
+ required int measuredArm,
+ }) async {
+ try {
+ GenericApiModel? apiResponse;
+ Failure? failure;
+
+ Map body = {
+ 'BloodPressureDate': bloodPressureDate,
+ 'DiastolicPressure': diastolicPressure,
+ 'SystolicePressure': systolicePressure,
+ 'MeasuredArm': measuredArm,
+ };
+
+ await apiClient.post(
+ ApiConsts.addBloodPressureResult,
+ body: body,
+ onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ },
+ onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ apiResponse = GenericApiModel(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: errorMessage,
+ data: response,
+ );
+ },
+ );
+
+ if (failure != null) return Left(failure!);
+ if (apiResponse == null) return Left(ServerFailure("Unknown error"));
+ return Right(apiResponse!);
+ } catch (e) {
+ return Left(UnknownFailure(e.toString()));
+ }
+ }
+
+ @override
+ Future>> updateBloodPressureResult({
+ required String bloodPressureDate,
+ required String diastolicPressure,
+ required String systolicePressure,
+ required int measuredArm,
+ required int lineItemNo,
+ }) async {
+ try {
+ GenericApiModel? apiResponse;
+ Failure? failure;
+
+ Map body = {
+ 'BloodPressureDate': bloodPressureDate,
+ 'DiastolicPressure': diastolicPressure,
+ 'SystolicePressure': systolicePressure,
+ 'MeasuredArm': measuredArm,
+ 'LineItemNo': lineItemNo,
+ };
+
+ await apiClient.post(
+ ApiConsts.updateBloodPressureResult,
+ body: body,
+ onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ },
+ onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ apiResponse = GenericApiModel(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: errorMessage,
+ data: response,
+ );
+ },
+ );
+
+ if (failure != null) return Left(failure!);
+ if (apiResponse == null) return Left(ServerFailure("Unknown error"));
+ return Right(apiResponse!);
+ } catch (e) {
+ return Left(UnknownFailure(e.toString()));
+ }
+ }
+
+ @override
+ Future>> deactivateBloodPressureStatus({
+ required int lineItemNo,
+ }) async {
+ try {
+ GenericApiModel? apiResponse;
+ Failure? failure;
+
+ Map body = {
+ 'LineItemNo': lineItemNo,
+ };
+
+ await apiClient.post(
+ ApiConsts.deactivateBloodPressureStatus,
+ body: body,
+ onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ },
+ onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ apiResponse = GenericApiModel(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: errorMessage,
+ data: response,
+ );
+ },
+ );
+
+ if (failure != null) return Left(failure!);
+ if (apiResponse == null) return Left(ServerFailure("Unknown error"));
+ return Right(apiResponse!);
+ } catch (e) {
+ return Left(UnknownFailure(e.toString()));
+ }
+ }
+
+ @override
+ Future>> sendBloodPressureReportByEmail({
+ required String email,
+ }) async {
+ try {
+ GenericApiModel? apiResponse;
+ Failure? failure;
+
+ Map body = {
+ 'To': email,
+ };
+
+ await apiClient.post(
+ ApiConsts.sendAverageBloodPressureReport,
+ body: body,
+ onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ },
+ onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ apiResponse = GenericApiModel(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: errorMessage,
+ data: response,
+ );
+ },
+ );
+
+ if (failure != null) return Left(failure!);
+ if (apiResponse == null) return Left(ServerFailure("Unknown error"));
+ return Right(apiResponse!);
+ } catch (e) {
+ return Left(UnknownFailure(e.toString()));
+ }
+ }
+
+ // ==================== WEIGHT MEASUREMENT METHODS ====================
+
+ @override
+ Future>> getWeightMeasurementResultAverage() async {
+ try {
+ GenericApiModel? apiResponse;
+ Failure? failure;
+
+ await apiClient.post(
+ ApiConsts.getWeightMeasurementResultAverage,
+ body: {},
+ onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ },
+ onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ try {
+ dynamic extracted;
+ if (response is Map) {
+ // Extract average lists
+ extracted = {
+ 'monthAverageList': response['List_MonthWeightMeasurementResultAverage'] ?? [],
+ 'weekAverageList': response['List_WeekWeightMeasurementResultAverage'] ?? [],
+ 'yearAverageList': response['List_YearWeightMeasurementResultAverage'] ?? [],
+ };
+ } else {
+ extracted = response;
+ }
+
+ apiResponse = GenericApiModel(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: errorMessage,
+ data: extracted,
+ );
+ } catch (e) {
+ failure = DataParsingFailure(e.toString());
+ }
+ },
+ );
+
+ if (failure != null) return Left(failure!);
+ if (apiResponse == null) return Left(ServerFailure("Unknown error"));
+ return Right(apiResponse!);
+ } catch (e) {
+ return Left(UnknownFailure(e.toString()));
+ }
+ }
+
+ @override
+ Future>> getWeightMeasurementResults() async {
+ try {
+ GenericApiModel? apiResponse;
+ Failure? failure;
+
+ await apiClient.post(
+ ApiConsts.getWeightMeasurementResult,
+ body: {},
+ onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ },
+ onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ try {
+ dynamic extracted;
+ if (response is Map) {
+ // Extract result lists
+ extracted = {
+ 'weekResultList': response['List_WeekWeightMeasurementResult'] ?? [],
+ 'monthResultList': response['List_MonthWeightMeasurementResult'] ?? [],
+ 'yearResultList': response['List_YearWeightMeasurementResult'] ?? [],
+ };
+ } else {
+ extracted = response;
+ }
+
+ apiResponse = GenericApiModel(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: errorMessage,
+ data: extracted,
+ );
+ } catch (e) {
+ failure = DataParsingFailure(e.toString());
+ }
+ },
+ );
+
+ if (failure != null) return Left(failure!);
+ if (apiResponse == null) return Left(ServerFailure("Unknown error"));
+ return Right(apiResponse!);
+ } catch (e) {
+ return Left(UnknownFailure(e.toString()));
+ }
+ }
+
+ @override
+ Future>> addWeightMeasurementResult({
+ required String weightDate,
+ required String weightMeasured,
+ required int weightUnit,
+ }) async {
+ try {
+ GenericApiModel? apiResponse;
+ Failure? failure;
+
+ Map body = {
+ 'WeightDate': weightDate,
+ 'WeightMeasured': weightMeasured,
+ 'weightUnit': weightUnit,
+ };
+
+ await apiClient.post(
+ ApiConsts.addWeightMeasurementResult,
+ body: body,
+ onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ },
+ onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ apiResponse = GenericApiModel(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: errorMessage,
+ data: response,
+ );
+ },
+ );
+
+ if (failure != null) return Left(failure!);
+ if (apiResponse == null) return Left(ServerFailure("Unknown error"));
+ return Right(apiResponse!);
+ } catch (e) {
+ return Left(UnknownFailure(e.toString()));
+ }
+ }
+
+ @override
+ Future>> updateWeightMeasurementResult({
+ required int lineItemNo,
+ required int weightUnit,
+ required String weightMeasured,
+ required String weightDate,
+ }) async {
+ try {
+ GenericApiModel? apiResponse;
+ Failure? failure;
+
+ Map body = {
+ 'LineItemNo': lineItemNo,
+ 'weightUnit': '$weightUnit', // Convert to string as per old service
+ 'WeightMeasured': weightMeasured,
+ 'WeightDate': weightDate,
+ };
+
+ await apiClient.post(
+ ApiConsts.updateWeightMeasurementResult,
+ body: body,
+ onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ },
+ onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ apiResponse = GenericApiModel(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: errorMessage,
+ data: response,
+ );
+ },
+ );
+
+ if (failure != null) return Left(failure!);
+ if (apiResponse == null) return Left(ServerFailure("Unknown error"));
+ return Right(apiResponse!);
+ } catch (e) {
+ return Left(UnknownFailure(e.toString()));
+ }
+ }
+
+ @override
+ Future>> deactivateWeightMeasurementStatus({required int lineItemNo}) async {
+ try {
+ GenericApiModel? apiResponse;
+ Failure? failure;
+
+ Map body = {
+ 'LineItemNo': lineItemNo,
+ };
+
+ await apiClient.post(
+ ApiConsts.deactivateWeightMeasurementStatus,
+ body: body,
+ onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ },
+ onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ apiResponse = GenericApiModel(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: errorMessage,
+ data: response,
+ );
+ },
+ );
+
+ if (failure != null) return Left(failure!);
+ if (apiResponse == null) return Left(ServerFailure("Unknown error"));
+ return Right(apiResponse!);
+ } catch (e) {
+ return Left(UnknownFailure(e.toString()));
+ }
+ }
+
+ @override
+ Future>> sendWeightReportByEmail({
+ required String email,
+ }) async {
+ try {
+ GenericApiModel? apiResponse;
+ Failure? failure;
+
+ Map body = {
+ 'To': email,
+ };
+
+ await apiClient.post(
+ ApiConsts.sendAverageBodyWeightReport,
+ body: body,
+ onFailure: (error, statusCode, {messageStatus, failureType}) {
+ failure = failureType;
+ },
+ onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
+ apiResponse = GenericApiModel(
+ messageStatus: messageStatus,
+ statusCode: statusCode,
+ errorMessage: errorMessage,
+ data: response,
+ );
+ },
+ );
+
+ 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/health_trackers/models/blood_pressure/blood_pressure_result.dart b/lib/features/health_trackers/models/blood_pressure/blood_pressure_result.dart
new file mode 100644
index 0000000..f024d8e
--- /dev/null
+++ b/lib/features/health_trackers/models/blood_pressure/blood_pressure_result.dart
@@ -0,0 +1,87 @@
+import 'package:hmg_patient_app_new/core/utils/date_util.dart';
+
+class BloodPressureResult {
+ int? patientID;
+ int? lineItemNo;
+ DateTime? bloodPressureDate;
+ int? measuredArm;
+ int? systolicePressure;
+ int? diastolicPressure;
+ dynamic remark;
+ bool? isActive;
+ int? chartYear;
+ String? chartMonth;
+ dynamic yearSystolicePressureAverageResult;
+ dynamic monthSystolicePressureResult;
+ dynamic weekSystolicePressureResult;
+ int? yearDiastolicPressureAverageResult;
+ dynamic monthDiastolicPressureResult;
+ dynamic weekDiastolicPressureResult;
+ String? measuredArmDesc;
+ dynamic weekDesc;
+
+ BloodPressureResult(
+ {this.patientID,
+ this.lineItemNo,
+ this.bloodPressureDate,
+ this.measuredArm,
+ this.systolicePressure,
+ this.diastolicPressure,
+ this.remark,
+ this.isActive,
+ this.chartYear,
+ this.chartMonth,
+ this.yearSystolicePressureAverageResult,
+ this.monthSystolicePressureResult,
+ this.weekSystolicePressureResult,
+ this.yearDiastolicPressureAverageResult,
+ this.monthDiastolicPressureResult,
+ this.weekDiastolicPressureResult,
+ this.measuredArmDesc,
+ this.weekDesc});
+
+ BloodPressureResult.fromJson(Map json) {
+ patientID = json['PatientID'];
+ lineItemNo = json['LineItemNo'];
+ bloodPressureDate = DateUtil.convertStringToDate(json['BloodPressureDate']);
+ measuredArm = json['MeasuredArm'];
+ systolicePressure = json['SystolicePressure'];
+ diastolicPressure = json['DiastolicPressure'];
+ remark = json['Remark'];
+ isActive = json['IsActive'];
+ chartYear = json['ChartYear'];
+ chartMonth = json['ChartMonth'];
+ yearSystolicePressureAverageResult = json['YearSystolicePressureAverageResult'];
+ monthSystolicePressureResult = json['MonthSystolicePressureResult'];
+ weekSystolicePressureResult = json['WeekSystolicePressureResult'];
+ yearDiastolicPressureAverageResult = json['YearDiastolicPressureAverageResult'];
+ monthDiastolicPressureResult = json['MonthDiastolicPressureResult'];
+ weekDiastolicPressureResult = json['WeekDiastolicPressureResult'];
+ measuredArmDesc = json['MeasuredArmDesc'];
+ weekDesc = json['WeekDesc'];
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['PatientID'] = patientID;
+ data['LineItemNo'] = lineItemNo;
+ data['BloodPressureDate'] = bloodPressureDate;
+ data['MeasuredArm'] = measuredArm;
+ data['SystolicePressure'] = systolicePressure;
+ data['DiastolicPressure'] = diastolicPressure;
+ data['Remark'] = remark;
+ data['IsActive'] = isActive;
+ data['ChartYear'] = chartYear;
+ data['ChartMonth'] = chartMonth;
+ data['YearSystolicePressureAverageResult'] = yearSystolicePressureAverageResult;
+ data['MonthSystolicePressureResult'] = monthSystolicePressureResult;
+ data['WeekSystolicePressureResult'] = weekSystolicePressureResult;
+ data['YearDiastolicPressureAverageResult'] = yearDiastolicPressureAverageResult;
+ data['MonthDiastolicPressureResult'] = monthDiastolicPressureResult;
+ data['WeekDiastolicPressureResult'] = weekDiastolicPressureResult;
+ data['MeasuredArmDesc'] = measuredArmDesc;
+ data['WeekDesc'] = weekDesc;
+ return data;
+ }
+}
+
diff --git a/lib/features/health_trackers/models/blood_pressure/month_blood_pressure_result_average.dart b/lib/features/health_trackers/models/blood_pressure/month_blood_pressure_result_average.dart
new file mode 100644
index 0000000..3975805
--- /dev/null
+++ b/lib/features/health_trackers/models/blood_pressure/month_blood_pressure_result_average.dart
@@ -0,0 +1,58 @@
+class MonthBloodPressureResultAverage {
+ dynamic weekfourSystolicePressureAverageResult;
+ dynamic weekfourDiastolicPressureAverageResult;
+ dynamic weekthreeSystolicePressureAverageResult;
+ dynamic weekthreeDiastolicPressureAverageResult;
+ dynamic weektwoSystolicePressureAverageResult;
+ dynamic weektwoDiastolicPressureAverageResult;
+ dynamic weekoneSystolicePressureAverageResult;
+ dynamic weekoneDiastolicPressureAverageResult;
+ String? weekDesc;
+ int? weekDiastolicPressureAverageResult;
+ int? weekSystolicePressureAverageResult;
+
+ MonthBloodPressureResultAverage({
+ this.weekfourSystolicePressureAverageResult,
+ this.weekfourDiastolicPressureAverageResult,
+ this.weekthreeSystolicePressureAverageResult,
+ this.weekthreeDiastolicPressureAverageResult,
+ this.weektwoSystolicePressureAverageResult,
+ this.weektwoDiastolicPressureAverageResult,
+ this.weekoneSystolicePressureAverageResult,
+ this.weekoneDiastolicPressureAverageResult,
+ this.weekDesc,
+ this.weekDiastolicPressureAverageResult,
+ this.weekSystolicePressureAverageResult,
+ });
+
+ MonthBloodPressureResultAverage.fromJson(Map json) {
+ weekfourSystolicePressureAverageResult = json['weekfourSystolicePressureAverageResult'];
+ weekfourDiastolicPressureAverageResult = json['weekfourDiastolicPressureAverageResult'];
+ weekthreeSystolicePressureAverageResult = json['weekthreeSystolicePressureAverageResult'];
+ weekthreeDiastolicPressureAverageResult = json['weekthreeDiastolicPressureAverageResult'];
+ weektwoSystolicePressureAverageResult = json['weektwoSystolicePressureAverageResult'];
+ weektwoDiastolicPressureAverageResult = json['weektwoDiastolicPressureAverageResult'];
+ weekoneSystolicePressureAverageResult = json['weekoneSystolicePressureAverageResult'];
+ weekoneDiastolicPressureAverageResult = json['weekoneDiastolicPressureAverageResult'];
+ weekDesc = json['WeekDesc'];
+ weekDiastolicPressureAverageResult = json['WeekDiastolicPressureAverageResult'];
+ weekSystolicePressureAverageResult = json['WeekSystolicePressureAverageResult'];
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['weekfourSystolicePressureAverageResult'] = weekfourSystolicePressureAverageResult;
+ data['weekfourDiastolicPressureAverageResult'] = weekfourDiastolicPressureAverageResult;
+ data['weekthreeSystolicePressureAverageResult'] = weekthreeSystolicePressureAverageResult;
+ data['weekthreeDiastolicPressureAverageResult'] = weekthreeDiastolicPressureAverageResult;
+ data['weektwoSystolicePressureAverageResult'] = weektwoSystolicePressureAverageResult;
+ data['weektwoDiastolicPressureAverageResult'] = weektwoDiastolicPressureAverageResult;
+ data['weekoneSystolicePressureAverageResult'] = weekoneSystolicePressureAverageResult;
+ data['weekoneDiastolicPressureAverageResult'] = weekoneDiastolicPressureAverageResult;
+ data['WeekDesc'] = weekDesc;
+ data['WeekDiastolicPressureAverageResult'] = weekDiastolicPressureAverageResult;
+ data['WeekSystolicePressureAverageResult'] = weekSystolicePressureAverageResult;
+ return data;
+ }
+}
+
diff --git a/lib/features/health_trackers/models/blood_pressure/week_blood_pressure_result_average.dart b/lib/features/health_trackers/models/blood_pressure/week_blood_pressure_result_average.dart
new file mode 100644
index 0000000..381d514
--- /dev/null
+++ b/lib/features/health_trackers/models/blood_pressure/week_blood_pressure_result_average.dart
@@ -0,0 +1,24 @@
+import 'package:hmg_patient_app_new/core/utils/date_util.dart';
+
+class WeekBloodPressureResultAverage {
+ int? dailySystolicePressureAverageResult;
+ int? dailyDiastolicPressureAverageResult;
+ DateTime? bloodPressureDate;
+
+ WeekBloodPressureResultAverage({this.dailySystolicePressureAverageResult, this.dailyDiastolicPressureAverageResult, this.bloodPressureDate});
+
+ WeekBloodPressureResultAverage.fromJson(Map json) {
+ dailySystolicePressureAverageResult = json['DailySystolicePressureAverageResult'];
+ dailyDiastolicPressureAverageResult = json['DailyDiastolicPressureAverageResult'];
+ bloodPressureDate = DateUtil.convertStringToDate(json['BloodPressureDate']);
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['DailySystolicePressureAverageResult'] = dailySystolicePressureAverageResult;
+ data['DailyDiastolicPressureAverageResult'] = dailyDiastolicPressureAverageResult;
+ data['BloodPressureDate'] = bloodPressureDate;
+ return data;
+ }
+}
+
diff --git a/lib/features/health_trackers/models/blood_pressure/year_blood_pressure_result_average.dart b/lib/features/health_trackers/models/blood_pressure/year_blood_pressure_result_average.dart
new file mode 100644
index 0000000..6f34246
--- /dev/null
+++ b/lib/features/health_trackers/models/blood_pressure/year_blood_pressure_result_average.dart
@@ -0,0 +1,37 @@
+import 'package:hmg_patient_app_new/core/utils/date_util.dart';
+
+class YearBloodPressureResultAverage {
+ int? monthSystolicePressureAverageResult;
+ int? monthDiastolicPressureAverageResult;
+ dynamic monthNumber;
+ String? monthName;
+ String? yearName;
+ DateTime? date;
+
+ YearBloodPressureResultAverage({
+ this.monthSystolicePressureAverageResult,
+ this.monthDiastolicPressureAverageResult,
+ this.monthNumber,
+ this.monthName,
+ this.yearName,
+ });
+
+ YearBloodPressureResultAverage.fromJson(Map json) {
+ monthSystolicePressureAverageResult = json['monthSystolicePressureAverageResult'];
+ monthDiastolicPressureAverageResult = json['monthDiastolicPressureAverageResult'];
+ monthNumber = json['monthNumber'];
+ monthName = json['monthName'];
+ yearName = json['yearName'];
+ date = DateUtil.getMonthDateTime(monthName!, yearName);
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['monthSystolicePressureAverageResult'] = monthSystolicePressureAverageResult;
+ data['monthDiastolicPressureAverageResult'] = monthDiastolicPressureAverageResult;
+ data['monthNumber'] = monthNumber;
+ data['monthName'] = monthName;
+ data['yearName'] = yearName;
+ return data;
+ }
+}
diff --git a/lib/features/health_trackers/models/blood_sugar/diabetic_patient_result.dart b/lib/features/health_trackers/models/blood_sugar/diabetic_patient_result.dart
new file mode 100644
index 0000000..066df3c
--- /dev/null
+++ b/lib/features/health_trackers/models/blood_sugar/diabetic_patient_result.dart
@@ -0,0 +1,99 @@
+import 'package:hmg_patient_app_new/core/utils/date_util.dart';
+
+class DiabeticPatientResult {
+ String? chartMonth;
+ var chartYear;
+ DateTime? dateChart;
+ var description;
+ var descriptionN;
+ int? diabtecAvarage;
+ bool? isActive;
+ int? lineItemNo;
+ var listMonth;
+ var listWeek;
+ int? measured;
+ String? measuredDesc;
+ var monthAverageResult;
+ int? patientID;
+ var remark;
+ var resultDesc;
+ dynamic resultValue;
+ String? unit;
+ var weekAverageResult;
+ String? weekDesc;
+ var yearAverageResult;
+
+ DiabeticPatientResult(
+ {this.chartMonth,
+ this.chartYear,
+ this.dateChart,
+ this.description,
+ this.descriptionN,
+ this.diabtecAvarage,
+ this.isActive,
+ this.lineItemNo,
+ this.listMonth,
+ this.listWeek,
+ this.measured,
+ this.measuredDesc,
+ this.monthAverageResult,
+ this.patientID,
+ this.remark,
+ this.resultDesc,
+ this.resultValue,
+ this.unit,
+ this.weekAverageResult,
+ this.weekDesc,
+ this.yearAverageResult});
+
+ DiabeticPatientResult.fromJson(Map json) {
+ chartMonth = json['ChartMonth'];
+ chartYear = json['ChartYear'];
+ dateChart = DateUtil.convertStringToDate(json['DateChart']);
+ description = json['Description'];
+ descriptionN = json['DescriptionN'];
+ diabtecAvarage = json['DiabtecAvarage'];
+ isActive = json['IsActive'];
+ lineItemNo = json['LineItemNo'];
+ listMonth = json['List_Month'];
+ listWeek = json['List_Week'];
+ measured = json['Measured'];
+ measuredDesc = json['MeasuredDesc'];
+ monthAverageResult = json['MonthAverageResult'];
+ patientID = json['PatientID'];
+ remark = json['Remark'];
+ resultDesc = json['ResultDesc'];
+ resultValue = json['ResultValue'];
+ unit = json['Unit'];
+ weekAverageResult = json['WeekAverageResult'];
+ weekDesc = json['WeekDesc'];
+ yearAverageResult = json['YearAverageResult'];
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['ChartMonth'] = chartMonth;
+ data['ChartYear'] = chartYear;
+ data['DateChart'] = DateUtil.convertDateToString(dateChart!);
+ data['Description'] = description;
+ data['DescriptionN'] = descriptionN;
+ data['DiabtecAvarage'] = diabtecAvarage;
+ data['IsActive'] = isActive;
+ data['LineItemNo'] = lineItemNo;
+ data['List_Month'] = listMonth;
+ data['List_Week'] = listWeek;
+ data['Measured'] = measured;
+ data['MeasuredDesc'] = measuredDesc;
+ data['MonthAverageResult'] = monthAverageResult;
+ data['PatientID'] = patientID;
+ data['Remark'] = remark;
+ data['ResultDesc'] = resultDesc;
+ data['ResultValue'] = resultValue;
+ data['Unit'] = unit;
+ data['WeekAverageResult'] = weekAverageResult;
+ data['WeekDesc'] = weekDesc;
+ data['YearAverageResult'] = yearAverageResult;
+ return data;
+ }
+}
+
diff --git a/lib/features/health_trackers/models/blood_sugar/month_diabetic_result_average.dart b/lib/features/health_trackers/models/blood_sugar/month_diabetic_result_average.dart
new file mode 100644
index 0000000..77b06f1
--- /dev/null
+++ b/lib/features/health_trackers/models/blood_sugar/month_diabetic_result_average.dart
@@ -0,0 +1,37 @@
+class MonthDiabeticResultAverage {
+ var weekfourAverageResult;
+ var weekthreeAverageResult;
+ var weektwoAverageResult;
+ var weekoneAverageResult;
+ dynamic weekAverageResult;
+ String? weekDesc;
+
+ MonthDiabeticResultAverage(
+ {this.weekfourAverageResult,
+ this.weekthreeAverageResult,
+ this.weektwoAverageResult,
+ this.weekoneAverageResult,
+ this.weekAverageResult,
+ this.weekDesc});
+
+ MonthDiabeticResultAverage.fromJson(Map json) {
+ weekfourAverageResult = json['weekfourAverageResult'];
+ weekthreeAverageResult = json['weekthreeAverageResult'];
+ weektwoAverageResult = json['weektwoAverageResult'];
+ weekoneAverageResult = json['weekoneAverageResult'];
+ weekAverageResult = json['WeekAverageResult'];
+ weekDesc = json['WeekDesc'];
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['weekfourAverageResult'] = weekfourAverageResult;
+ data['weekthreeAverageResult'] = weekthreeAverageResult;
+ data['weektwoAverageResult'] = weektwoAverageResult;
+ data['weekoneAverageResult'] = weekoneAverageResult;
+ data['WeekAverageResult'] = weekAverageResult;
+ data['WeekDesc'] = weekDesc;
+ return data;
+ }
+}
+
diff --git a/lib/features/health_trackers/models/blood_sugar/week_diabetic_result_average.dart b/lib/features/health_trackers/models/blood_sugar/week_diabetic_result_average.dart
new file mode 100644
index 0000000..3b35fe7
--- /dev/null
+++ b/lib/features/health_trackers/models/blood_sugar/week_diabetic_result_average.dart
@@ -0,0 +1,21 @@
+import 'package:hmg_patient_app_new/core/utils/date_util.dart';
+
+class WeekDiabeticResultAverage {
+ dynamic dailyAverageResult;
+ DateTime? dateChart;
+
+ WeekDiabeticResultAverage({this.dailyAverageResult, this.dateChart});
+
+ WeekDiabeticResultAverage.fromJson(Map json) {
+ dailyAverageResult = json['DailyAverageResult'];
+ dateChart = DateUtil.convertStringToDate(json['DateChart']);
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['DailyAverageResult'] = dailyAverageResult;
+ data['DateChart'] = DateUtil.convertDateToString(dateChart!);
+ return data;
+ }
+}
+
diff --git a/lib/features/health_trackers/models/blood_sugar/year_diabetic_result_average.dart b/lib/features/health_trackers/models/blood_sugar/year_diabetic_result_average.dart
new file mode 100644
index 0000000..fb34056
--- /dev/null
+++ b/lib/features/health_trackers/models/blood_sugar/year_diabetic_result_average.dart
@@ -0,0 +1,35 @@
+import 'dart:developer';
+
+import 'package:hmg_patient_app_new/core/utils/date_util.dart';
+
+class YearDiabeticResultAverage {
+ dynamic monthAverageResult;
+ var monthNumber;
+ String? monthName;
+ String? yearName;
+ DateTime? date;
+
+ YearDiabeticResultAverage({this.monthAverageResult, this.monthNumber, this.monthName, this.yearName});
+
+ YearDiabeticResultAverage.fromJson(Map json) {
+ try {
+ monthAverageResult = json['monthAverageResult'];
+ monthNumber = json['monthNumber'];
+ monthName = json['monthName'];
+ yearName = json['yearName'];
+ date = DateUtil.getMonthDateTime(monthName!, yearName);
+ } catch (e) {
+ log(e.toString());
+ }
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['monthAverageResult'] = monthAverageResult;
+ data['monthNumber'] = monthNumber;
+ data['monthName'] = monthName;
+ data['yearName'] = yearName;
+ return data;
+ }
+}
+
diff --git a/lib/features/health_trackers/models/weight/month_weight_measurement_result_average.dart b/lib/features/health_trackers/models/weight/month_weight_measurement_result_average.dart
new file mode 100644
index 0000000..f95470c
--- /dev/null
+++ b/lib/features/health_trackers/models/weight/month_weight_measurement_result_average.dart
@@ -0,0 +1,37 @@
+class MonthWeightMeasurementResultAverage {
+ dynamic weekfourAverageResult;
+ dynamic weekthreeAverageResult;
+ dynamic weektwoAverageResult;
+ dynamic weekoneAverageResult;
+ dynamic weekAverageResult;
+ String? weekDesc;
+
+ MonthWeightMeasurementResultAverage(
+ {this.weekfourAverageResult,
+ this.weekthreeAverageResult,
+ this.weektwoAverageResult,
+ this.weekoneAverageResult,
+ this.weekAverageResult,
+ this.weekDesc});
+
+ MonthWeightMeasurementResultAverage.fromJson(Map json) {
+ weekfourAverageResult = json['weekfourAverageResult'];
+ weekthreeAverageResult = json['weekthreeAverageResult'];
+ weektwoAverageResult = json['weektwoAverageResult'];
+ weekoneAverageResult = json['weekoneAverageResult'];
+ weekAverageResult = json['WeekAverageResult'];
+ weekDesc = json['WeekDesc'];
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['weekfourAverageResult'] = weekfourAverageResult;
+ data['weekthreeAverageResult'] = weekthreeAverageResult;
+ data['weektwoAverageResult'] = weektwoAverageResult;
+ data['weekoneAverageResult'] = weekoneAverageResult;
+ data['WeekAverageResult'] = weekAverageResult;
+ data['WeekDesc'] = weekDesc;
+ return data;
+ }
+}
+
diff --git a/lib/features/health_trackers/models/weight/week_weight_measurement_result_average.dart b/lib/features/health_trackers/models/weight/week_weight_measurement_result_average.dart
new file mode 100644
index 0000000..ad53325
--- /dev/null
+++ b/lib/features/health_trackers/models/weight/week_weight_measurement_result_average.dart
@@ -0,0 +1,21 @@
+import 'package:hmg_patient_app_new/core/utils/date_util.dart';
+
+class WeekWeightMeasurementResultAverage {
+ dynamic dailyAverageResult;
+ DateTime? weightDate;
+
+ WeekWeightMeasurementResultAverage({this.dailyAverageResult, this.weightDate});
+
+ WeekWeightMeasurementResultAverage.fromJson(Map json) {
+ dailyAverageResult = json['DailyAverageResult'];
+ weightDate = DateUtil.convertStringToDate(json['WeightDate']);
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['DailyAverageResult'] = dailyAverageResult;
+ data['WeightDate'] = weightDate;
+ return data;
+ }
+}
+
diff --git a/lib/features/health_trackers/models/weight/weight_measurement_result.dart b/lib/features/health_trackers/models/weight/weight_measurement_result.dart
new file mode 100644
index 0000000..896d33f
--- /dev/null
+++ b/lib/features/health_trackers/models/weight/weight_measurement_result.dart
@@ -0,0 +1,77 @@
+import 'dart:developer';
+
+import 'package:hmg_patient_app_new/core/utils/date_util.dart';
+
+class WeightMeasurementResult {
+ int? patientID;
+ int? lineItemNo;
+ int? weightMeasured;
+ DateTime? weightDate;
+ dynamic remark;
+ bool? isActive;
+ int? measured;
+ dynamic unit;
+ int? chartYear;
+ dynamic chartMonth;
+ double? yearAverageResult;
+ dynamic monthAverageResult;
+ dynamic weekAverageResult;
+ dynamic weekDesc;
+
+ WeightMeasurementResult(
+ {this.patientID,
+ this.lineItemNo,
+ this.weightMeasured,
+ this.weightDate,
+ this.remark,
+ this.isActive,
+ this.measured,
+ this.unit,
+ this.chartYear,
+ this.chartMonth,
+ this.yearAverageResult,
+ this.monthAverageResult,
+ this.weekAverageResult,
+ this.weekDesc});
+
+ WeightMeasurementResult.fromJson(Map json) {
+ try {
+ patientID = json['PatientID'];
+ lineItemNo = json['LineItemNo'];
+ weightMeasured = json['WeightMeasured'];
+ weightDate = DateUtil.convertStringToDate(json['WeightDate']);
+ remark = json['Remark'];
+ isActive = json['IsActive'];
+ measured = json['Measured'];
+ unit = json['Unit'];
+ chartYear = json['ChartYear'];
+ chartMonth = json['ChartMonth'];
+ // Convert to double safely since API may return int
+ yearAverageResult = json['YearAverageResult'] != null ? (json['YearAverageResult'] as num).toDouble() : null;
+ monthAverageResult = json['MonthAverageResult'];
+ weekAverageResult = json['WeekAverageResult'];
+ weekDesc = json['WeekDesc'];
+ } catch (e) {
+ log(e.toString());
+ }
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['PatientID'] = patientID;
+ data['LineItemNo'] = lineItemNo;
+ data['WeightMeasured'] = weightMeasured;
+ data['WeightDate'] = weightDate;
+ data['Remark'] = remark;
+ data['IsActive'] = isActive;
+ data['Measured'] = measured;
+ data['Unit'] = unit;
+ data['ChartYear'] = chartYear;
+ data['ChartMonth'] = chartMonth;
+ data['YearAverageResult'] = yearAverageResult;
+ data['MonthAverageResult'] = monthAverageResult;
+ data['WeekAverageResult'] = weekAverageResult;
+ data['WeekDesc'] = weekDesc;
+ return data;
+ }
+}
diff --git a/lib/features/health_trackers/models/weight/year_weight_measurement_result_average.dart b/lib/features/health_trackers/models/weight/year_weight_measurement_result_average.dart
new file mode 100644
index 0000000..7dc4b24
--- /dev/null
+++ b/lib/features/health_trackers/models/weight/year_weight_measurement_result_average.dart
@@ -0,0 +1,29 @@
+import 'package:hmg_patient_app_new/core/utils/date_util.dart';
+
+class YearWeightMeasurementResultAverage {
+ dynamic monthAverageResult;
+ int? monthNumber;
+ String? monthName;
+ String? yearName;
+ DateTime? date;
+
+ YearWeightMeasurementResultAverage({this.monthAverageResult, this.monthNumber, this.monthName, this.yearName});
+
+ YearWeightMeasurementResultAverage.fromJson(Map json) {
+ monthAverageResult = json['monthAverageResult'];
+ monthNumber = json['monthNumber'];
+ monthName = json['monthName'];
+ yearName = json['yearName'];
+ date = DateUtil.getMonthDateTime(monthName!, yearName);
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['monthAverageResult'] = monthAverageResult;
+ data['monthNumber'] = monthNumber;
+ data['monthName'] = monthName;
+ data['yearName'] = yearName;
+ return data;
+ }
+}
+
diff --git a/lib/features/symptoms_checker/models/resp_models/symptoms_user_details_response_model.dart b/lib/features/symptoms_checker/models/resp_models/symptoms_user_details_response_model.dart
new file mode 100644
index 0000000..c0466c4
--- /dev/null
+++ b/lib/features/symptoms_checker/models/resp_models/symptoms_user_details_response_model.dart
@@ -0,0 +1,188 @@
+class SymptomsUserDetailsResponseModel {
+ final TokenDetails? tokenDetails;
+ final UserDetails? userDetails;
+ final String? sessionId;
+
+ SymptomsUserDetailsResponseModel({
+ this.tokenDetails,
+ this.userDetails,
+ this.sessionId,
+ });
+
+ factory SymptomsUserDetailsResponseModel.fromJson(Map json) {
+ return SymptomsUserDetailsResponseModel(
+ tokenDetails: json['tokenDetails'] != null ? TokenDetails.fromJson(json['tokenDetails']) : null,
+ userDetails: json['userDetails'] != null ? UserDetails.fromJson(json['userDetails']) : null,
+ sessionId: json['sessionId'],
+ );
+ }
+
+ Map toJson() {
+ return {
+ 'tokenDetails': tokenDetails?.toJson(),
+ 'userDetails': userDetails?.toJson(),
+ 'sessionId': sessionId,
+ };
+ }
+}
+
+class TokenDetails {
+ final String? id;
+ final String? authToken;
+ final int? expiresIn;
+
+ TokenDetails({
+ this.id,
+ this.authToken,
+ this.expiresIn,
+ });
+
+ factory TokenDetails.fromJson(Map json) {
+ return TokenDetails(
+ id: json['id'],
+ authToken: json['auth_token'],
+ expiresIn: json['expires_in'],
+ );
+ }
+
+ Map toJson() {
+ return {
+ 'id': id,
+ 'auth_token': authToken,
+ 'expires_in': expiresIn,
+ };
+ }
+}
+
+class UserDetails {
+ final String? fileNo;
+ final String? nationalId;
+ final String? email;
+ final String? dateOfBirth;
+ final String? dateOfBirthHijri;
+ final int? age;
+ final UserName? name;
+ final int? maritalStatus;
+ final String? maritalStatusCode;
+ final String? nationality;
+ final String? nationalityIsoCode;
+ final String? occupation;
+ final int? idType;
+ final int? gender;
+ final String? jwtToken;
+ final String? countryDialCode;
+ final String? phoneNo;
+
+ UserDetails({
+ this.fileNo,
+ this.nationalId,
+ this.email,
+ this.dateOfBirth,
+ this.dateOfBirthHijri,
+ this.age,
+ this.name,
+ this.maritalStatus,
+ this.maritalStatusCode,
+ this.nationality,
+ this.nationalityIsoCode,
+ this.occupation,
+ this.idType,
+ this.gender,
+ this.jwtToken,
+ this.countryDialCode,
+ this.phoneNo,
+ });
+
+ factory UserDetails.fromJson(Map json) {
+ return UserDetails(
+ fileNo: json['FileNo'],
+ nationalId: json['national_id'],
+ email: json['email'],
+ dateOfBirth: json['date_of_birth'],
+ dateOfBirthHijri: json['date_of_birth_hijri'],
+ age: json['age'],
+ name: json['name'] != null ? UserName.fromJson(json['name']) : null,
+ maritalStatus: json['marital_status'],
+ maritalStatusCode: json['marital_status_code'],
+ nationality: json['nationality'],
+ nationalityIsoCode: json['nationality_iso_code'],
+ occupation: json['occupation'],
+ idType: json['id_type'],
+ gender: json['gender'],
+ jwtToken: json['jwt_token'],
+ countryDialCode: json['country_dial_code'],
+ phoneNo: json['phone_no'],
+ );
+ }
+
+ Map toJson() {
+ return {
+ 'FileNo': fileNo,
+ 'national_id': nationalId,
+ 'email': email,
+ 'date_of_birth': dateOfBirth,
+ 'date_of_birth_hijri': dateOfBirthHijri,
+ 'age': age,
+ 'name': name?.toJson(),
+ 'marital_status': maritalStatus,
+ 'marital_status_code': maritalStatusCode,
+ 'nationality': nationality,
+ 'nationality_iso_code': nationalityIsoCode,
+ 'occupation': occupation,
+ 'id_type': idType,
+ 'gender': gender,
+ 'jwt_token': jwtToken,
+ 'country_dial_code': countryDialCode,
+ 'phone_no': phoneNo,
+ };
+ }
+
+ // Helper method to get full name
+ String getFullName(bool isArabic) {
+ if (name == null) return '';
+ if (isArabic) {
+ return '${name!.firstNameAr ?? ''} ${name!.middleNameAr ?? ''} ${name!.lastNameAr ?? ''}'.trim();
+ }
+ return '${name!.firstName ?? ''} ${name!.middleName ?? ''} ${name!.lastName ?? ''}'.trim();
+ }
+}
+
+class UserName {
+ final String? firstName;
+ final String? middleName;
+ final String? lastName;
+ final String? firstNameAr;
+ final String? middleNameAr;
+ final String? lastNameAr;
+
+ UserName({
+ this.firstName,
+ this.middleName,
+ this.lastName,
+ this.firstNameAr,
+ this.middleNameAr,
+ this.lastNameAr,
+ });
+
+ factory UserName.fromJson(Map json) {
+ return UserName(
+ firstName: json['first_name'],
+ middleName: json['middle_name'],
+ lastName: json['last_name'],
+ firstNameAr: json['first_name_ar'],
+ middleNameAr: json['middle_name_ar'],
+ lastNameAr: json['last_name_ar'],
+ );
+ }
+
+ Map toJson() {
+ return {
+ 'first_name': firstName,
+ 'middle_name': middleName,
+ 'last_name': lastName,
+ 'first_name_ar': firstNameAr,
+ 'middle_name_ar': middleNameAr,
+ 'last_name_ar': lastNameAr,
+ };
+ }
+}
diff --git a/lib/features/symptoms_checker/models/resp_models/triage_response_model.dart b/lib/features/symptoms_checker/models/resp_models/triage_response_model.dart
new file mode 100644
index 0000000..f0d7e90
--- /dev/null
+++ b/lib/features/symptoms_checker/models/resp_models/triage_response_model.dart
@@ -0,0 +1,209 @@
+class TriageDataDetails {
+ final TriageQuestion? question;
+ final List? conditions;
+ final bool? hasEmergencyEvidence;
+ final bool? shouldStop;
+ final String? interviewToken;
+ final String? message;
+ final List? errorList;
+ final int? id;
+ final String? language;
+ final String? generalId;
+ final String? createDate;
+ final String? lastEditDate;
+ final String? createdBy;
+ final String? lastEditBy;
+ final bool? active;
+ final int? sortOrder;
+ final int? userType;
+ final String? userId;
+
+ TriageDataDetails({
+ this.question,
+ this.conditions,
+ this.hasEmergencyEvidence,
+ this.shouldStop,
+ this.interviewToken,
+ this.message,
+ this.errorList,
+ this.id,
+ this.language,
+ this.generalId,
+ this.createDate,
+ this.lastEditDate,
+ this.createdBy,
+ this.lastEditBy,
+ this.active,
+ this.sortOrder,
+ this.userType,
+ this.userId,
+ });
+
+ factory TriageDataDetails.fromJson(Map json) {
+ return TriageDataDetails(
+ question: json['question'] != null ? TriageQuestion.fromJson(json['question']) : null,
+ conditions: json['conditions'] != null ? (json['conditions'] as List).map((item) => TriageCondition.fromJson(item)).toList() : null,
+ hasEmergencyEvidence: json['has_emergency_evidence'],
+ shouldStop: json['should_stop'],
+ interviewToken: json['interview_token'],
+ message: json['Message'],
+ errorList: json['ErrorList'] != null ? List.from(json['ErrorList']) : null,
+ id: json['Id'],
+ language: json['language'],
+ generalId: json['generalId'],
+ createDate: json['CreateDate'],
+ lastEditDate: json['LastEditDate'],
+ createdBy: json['CreatedBy'],
+ lastEditBy: json['LastEditBy'],
+ active: json['Active'],
+ sortOrder: json['SortOrder'],
+ userType: json['userType'],
+ userId: json['userId'],
+ );
+ }
+
+ Map toJson() {
+ return {
+ 'question': question?.toJson(),
+ 'conditions': conditions?.map((item) => item.toJson()).toList(),
+ 'has_emergency_evidence': hasEmergencyEvidence,
+ 'should_stop': shouldStop,
+ 'interview_token': interviewToken,
+ 'Message': message,
+ 'ErrorList': errorList,
+ 'Id': id,
+ 'language': language,
+ 'generalId': generalId,
+ 'CreateDate': createDate,
+ 'LastEditDate': lastEditDate,
+ 'CreatedBy': createdBy,
+ 'LastEditBy': lastEditBy,
+ 'Active': active,
+ 'SortOrder': sortOrder,
+ 'userType': userType,
+ 'userId': userId,
+ };
+ }
+}
+
+class TriageQuestion {
+ final int? type;
+ final String? text;
+ final List? items;
+
+ TriageQuestion({
+ this.type,
+ this.text,
+ this.items,
+ });
+
+ factory TriageQuestion.fromJson(Map json) {
+ return TriageQuestion(
+ type: json['type'],
+ text: json['text'],
+ items: json['items'] != null ? (json['items'] as List).map((item) => TriageQuestionItem.fromJson(item)).toList() : null,
+ );
+ }
+
+ Map toJson() {
+ return {
+ 'type': type,
+ 'text': text,
+ 'items': items?.map((item) => item.toJson()).toList(),
+ };
+ }
+}
+
+class TriageQuestionItem {
+ final String? id;
+ final String? name;
+ final List? choices;
+
+ TriageQuestionItem({
+ this.id,
+ this.name,
+ this.choices,
+ });
+
+ factory TriageQuestionItem.fromJson(Map json) {
+ return TriageQuestionItem(
+ id: json['id'],
+ name: json['name'],
+ choices: json['choices'] != null ? (json['choices'] as List).map((item) => TriageChoice.fromJson(item)).toList() : null,
+ );
+ }
+
+ Map toJson() {
+ return {
+ 'id': id,
+ 'name': name,
+ 'choices': choices?.map((item) => item.toJson()).toList(),
+ };
+ }
+}
+
+class TriageChoice {
+ final String? id;
+ final String? label;
+
+ TriageChoice({
+ this.id,
+ this.label,
+ });
+
+ factory TriageChoice.fromJson(Map json) {
+ return TriageChoice(
+ id: json['id'],
+ label: json['label'],
+ );
+ }
+
+ Map toJson() {
+ return {
+ 'id': id,
+ 'label': label,
+ };
+ }
+}
+
+class TriageCondition {
+ final String? id;
+ final String? name;
+ final String? commonName;
+ final double? probability;
+ final dynamic conditionDetails;
+
+ TriageCondition({
+ this.id,
+ this.name,
+ this.commonName,
+ this.probability,
+ this.conditionDetails,
+ });
+
+ factory TriageCondition.fromJson(Map json) {
+ return TriageCondition(
+ id: json['id'],
+ name: json['name'],
+ commonName: json['common_name'],
+ probability: json['probability']?.toDouble(),
+ conditionDetails: json['condition_details'],
+ );
+ }
+
+ Map toJson() {
+ return {
+ 'id': id,
+ 'name': name,
+ 'common_name': commonName,
+ 'probability': probability,
+ 'condition_details': conditionDetails,
+ };
+ }
+
+ /// Get probability as percentage
+ String getProbabilityPercentage() {
+ if (probability == null) return '0%';
+ return '${(probability! * 100).toStringAsFixed(1)}%';
+ }
+}
diff --git a/lib/features/symptoms_checker/symptoms_checker_repo.dart b/lib/features/symptoms_checker/symptoms_checker_repo.dart
index 954d414..c55c2f0 100644
--- a/lib/features/symptoms_checker/symptoms_checker_repo.dart
+++ b/lib/features/symptoms_checker/symptoms_checker_repo.dart
@@ -1,5 +1,4 @@
import 'dart:convert';
-import 'dart:developer';
import 'package:dartz/dartz.dart';
import 'package:hmg_patient_app_new/core/api/api_client.dart';
@@ -8,25 +7,56 @@ import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
import 'package:hmg_patient_app_new/features/symptoms_checker/models/resp_models/body_symptom_response_model.dart';
import 'package:hmg_patient_app_new/features/symptoms_checker/models/resp_models/risk_and_suggestions_response_model.dart';
+import 'package:hmg_patient_app_new/features/symptoms_checker/models/resp_models/symptoms_user_details_response_model.dart';
+import 'package:hmg_patient_app_new/features/symptoms_checker/models/resp_models/triage_response_model.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart';
abstract class SymptomsCheckerRepo {
- Future>> getBodySymptomsByName({
+ Future>>
+ getUserDetails({
+ required String userName,
+ required String password,
+ });
+
+ Future>>
+ getBodySymptomsByName({
required List organNames,
+ required String userSessionToken,
+ required int gender,
+ });
+
+ Future>>
+ getRiskFactors({
+ required int age,
+ required String sex,
+ required List evidenceIds,
+ required String language,
+ required String userSessionToken,
+ required int gender,
+ required String sessionId,
});
- Future>> getRiskFactors({
+ Future>>
+ getSuggestions({
required int age,
required String sex,
required List evidenceIds,
required String language,
+ required String userSessionToken,
+ required String sessionId,
+ required int gender,
});
- Future>> getSuggestions({
+ Future>>
+ getDiagnosisForTriage({
required int age,
required String sex,
required List evidenceIds,
+ List